NAME

Polycom::Config::File - Module for parsing, modifying, and creating Polycom VoIP phone config files.

SYNOPSIS

use Polycom::Config::File;

# Load an existing config file
my $cfg = Polycom::Config::File->new('0004f21ac123-regLine.cfg');

# Read some parameters
my $dialmap = $cfg->params->{'dialplan.digitmap'};

# Modify some parameters
$cfg->params->{'voIpProt.server.1.address'} = 'test.example.com';

# Save the file
$cfg->save('0004f21ac123-regLine.cfg');

DESCRIPTION

This module parses Polycom VoIP phone config files, and can be used to read, modify, or create config files for Polycom's SoundPoint IP, SoundStation IP, and VVX series of VoIP phones.

Configuration files enable administrators to configure phone parameters ranging from line registrations, to preferred codecs, to background images.

The files are structured using XML, where each attribute is named after a configuration parameter. For instance, the XML below would constitute a valid configuration file that specifies a SIP registration server and a dial plan digit map.

<?xml version="1.0" standalone="yes"?>
<localcfg>
   <server voIpProt.server.1.address="test.example.com"/>
   <digitmap
dialplan.digitmap="[2-9]11|0T|011xxx.T|[0-1][2-9]xxxxxxxxx|604xxxxxxx|
778xxxxxxx|[2-4]xxx"/>
</localcfg>

For more information about managing configuration files on Polycom SoundPoint IP or SoundStation IP phones, see the "Configuration File Management on Polycom SoundPoint IP Phones" document at http://www.polycom.com/global/documents/whitepapers/configuration_file_management_on_soundpoint_ip_phones.pdf.

For a detailed list of available configuration parameters, consult the "SoundPoint IP, SoundStation IP and Polycom VVX Administrator's Guide" at http://www.polycom.com/global/documents/support/setup_maintenance/products/voice/spip_ssip_vvx_Admin_Guide_SIP_3_2_2_eng.pdf.

CONSTRUCTOR

new

# Create a new empty config file
my $cfg = Polycom::Config::File->new('new-sip.cfg');

# Load a directory from a filename or file handle
my $cfg2 = Polycom::Config::File->new('0004f21ac123-sip.cfg');
my $cfg3 = Polycom::Config::File->new(\*FILEHANDLE);

If you have already slurped the contents of a config file into a scalar, you can also pass that scalar to new to parse those XML contents.

METHODS

params

# Read the 'dialplan.digitmap' parameter
my $dialmap = $cfg->params->{'dialplan.digitmap'};

# Modify the 'voIpProt.server.1.address' parameter
$cfg->params->{'voIpProt.server.1.address'} = 'test.example.com';

Returns a reference to a hash containing all of the config parameters in the config file. If you modify this hash, your changes will be written to the file when you call save.

equals ( $cfg2 )

if ($cfg1->equals($cfg2))
{
  print "The config files are equal\n";
}

Returns true if both config files are equal (i.e. they contain the same config parameters, and all of those config parameters have the same value).

Because the == and != operators have also been overloaded for Polycom::Config::File, it is equivalent to compare two config files using:

if ($cfg1 == $cfg2)
{
  print "The config files are equal\n";
}

save ( $filename | $file_handle )

$dir->save('0004f21acabf-directory.xml');
# or
$dir->save($fh);

Writes the contents of the contact directory object to the specified file such that a phone will be able to read those contacts from the file if the file is placed on the phone's boot server.

to_xml

my $xml = $cfg->to_xml;

Returns the XML representation of the config. It is exactly this XML representation that the save method writes to the config file.

SEE ALSO

Polycom::Contact::Directory - module that parses the XML-based local contact directory file used by Polycom SoundPoint IP, SoundStation IP, and VVX VoIP phones, and can be used to read, modify, or create contacts in the file.
Configuration File Management on Polycom SoundPoint IP Phones - http://www.polycom.com/global/documents/whitepapers/configuration_file_management_on_soundpoint_ip_phones.pdf
SoundPoint IP, SoundStation IP and Polycom VVX Administrator's Guide - http://www.polycom.com/global/documents/support/setup_maintenance/products/voice/spip_ssip_vvx_Admin_Guide_SIP_3_2_2_eng.pdf

AUTHOR

Zachary Blair, <zblair@cpan.org>

COPYRIGHT AND LICENSE

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.