Polycom::Contact - Contact in a Polycom VoIP phone's local contact directory.
use Polycom::Contact; # Create a new contact my $contact = Polycom::Contact->new( first_name => 'Bob', last_name => 'Smith', contact => '1234', ); # The contact can be interpolated in strings # Prints: "The contact is: Bob Smith at 1234" print "The contact is: $contact\n"; # The contact can also be compared with other contacts my $otherContact = Polycom::Contact->new(first_name => 'Jimmy', contact => '5678'); if ($otherContact != $contact) { print "$otherContact is not the same as $contact\n"; } # Or, of course, you can simply query the contact's fields my $first_name = $contact->first_name; my $last_name = $contact->last_name;
The Polycom::Contact class represents a contact in a Polycom SoundPoint IP, SoundStation IP, or VVX phone's local contact directory. This class is intended to be used with Polycom::Contact::Directory, which parses entire contact directory files, extracting the contacts, and enabling you to read or modify them.
Polycom::Contact
Polycom::Contact::Directory
use Polycom::Contact; my $contact = Polycom::Contact->new(first_name => 'Bob', contact => 1234);
Returns a newly created Polycom::Contact object.
In all, each Polycom::Contact object can have the following fields:
first_name - first name last_name - last name contact - phone number or URL (required) speed_index - speed dial index (1 - 9999) label - label to show on speed dial keys ring_type - distinctive incoming ring tone (1 - 22) divert - phone number or URL to divert incoming calls to auto_reject - automatically reject calls from this contact (0 = no, 1 = yes) auto_divert - automatically divert calls from this contact (0 = no, 1 = yes) buddy_watching - include in the list of watched phones (0 = no, 1 = yes) buddy_block - block from watching this phone (0 = no, 1 = yes) user_photo - index of a user photo/icon set by the icons.x parameter.
Of those fields, the contact field is the only required field; without a unique contact field, the phone will not load the contact.
contact
my $fn = $contact->first_name; $contact->first_name('Bob'); # Set the first_name to "Bob"
my $ln = $contact->last_name; $contact->last_name('Smith'); # Set the last_name to "Smith"
The phone number, extension, or URL of the contact. This field must be present (i.e. not blank) and must be unique.
my $num = $contact->contact; $contact->contact('1234'); # Set the contact number to 1234
The speed dial index for the contact (1 - 9999).
my $sd = $contact->speed_index; $contact->speed_index(5); # Set the speed index to 5
Contacts that have a speed dial index specified are listed in the phone's speed dial menu and are mapped to unused line keys for quick access.
The label to show on speed dial keys (e.g. "Manager").
my $lb = $contact->label; $contact->label('Sales'); # Set the label to "Sales"
The distinctive incoming ring tone for this contact (1 - 22).
my $rt = $contact->ring_type; $contact->ring_type(2); # Set the ring type to 2
The ring type number must correspond to a ring type listed in the Settings > Basic > Ring Type menu on the phone. When an incoming call is received from the contact, the specified ring tone will play instead of the default ring tone.
The phone number or URL to divert incoming calls to.
my $divert = $contact->divert; $contact->divert(2345); # Set the divert phone number to 2345
Specifies whether to automatically reject calls from this contact (0 = no, 1 = yes).
print "Calls from $contact will be automatically rejected" if ($contact->auto_reject); $contact->auto_reject(1); # Enable auto reject
Specifies whether to automatically divert calls from this contact (0 = no, 1 = yes).
print "Calls from $contact will be automatically diverted" if ($contact->auto_divert); $contact->auto_divert(1); # Enable auto divert
Specifies whether to include this contact in the list of watched phones (0 = no, 1 = yes).
print "$contact is in the watched list" if ($contact->buddy_watching); $contact->buddy_watching(1); # Add this contact to the buddy list
Specifies whether to block this contact from watching this phone (0 = no, 1 = yes).
print "$contact is blocked from watching" if ($contact->buddy_block); $contact->buddy_block(1); # Prevent this contact from watching this phone
The index of an optional user photo that has been specified in the configuration using the icons.x parameter.
# Copy a photo to the provisioning server (e.g. bob.png) and add the following to the phone's configuration: # <icons icons.1="bob.png" /> $contact->user_photo(1); # Show the image "bob.png" for this contact on Trio and CCX phones =head1 METHODS
if (!$contact->is_valid) { print "$contact is invalid.\n"; }
Returns undef if the contact is invalid (i.e. it has no contact value specified), or 1 otherwise.
my @contacts = $dir->search({first_name => 'Bob'}); $contacts[0]->delete;
Removes the contact from the directory it belongs to (see Polycom::Contact::Directory). If the Polycom::Contact object was created from scratch, rather than from an existing contact directory object, then calling delete has no effect.
delete
my @differences = $contact1->diff($contact2);
Returns an array of contact field names that do not match (e.g. "First Name", "Speed Dial").
Polycom::Contact::Directory - A closely related module that parses the XML-based local contact directory file used by Polycom SoundPoint IP, SoundStation IP, VVX, Trio and CCX VoIP phones, and can be used to read, modify, or create contacts in the file.
Zachary Blair, <zblair@cpan.org>
Copyright (C) 2010 by Polycom Canada
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install Polycom::Contact::Directory, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Polycom::Contact::Directory
CPAN shell
perl -MCPAN -e shell install Polycom::Contact::Directory
For more information on module installation, please visit the detailed CPAN module installation guide.