Zachary D. Blair > Polycom-Config-File-0.04 > Polycom::Config::File

Download:
Polycom-Config-File-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

Polycom::Config::File - Parser for 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 the 'dialplan.digitmap' parameter
  my $digitmap = $cfg->params->{'dialplan.digitmap'};

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

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

DESCRIPTION ^

This module 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, SoundStation IP, or VVX VoIP 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" document 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();

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

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.

path

If this object was created by passing a file path to new, then this function will return that file path. Otherwise, path simply returns undef.

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 )

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

Writes the configuration parameters to the specified file.

For the phone to load the parameters in the file, you will need to place the file on the phone's boot server and add its filename to the CONFIG_FILES field in <Ethernet address>.cfg, as described in the "Configuration File Management on Polycom SoundPoint IP Phones" document listed at the bottom of this page. The phone must then be restarted for it to pick up the changes to its configuration.

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 - parses the XML-based local contact directory files used by Polycom SoundPoint IP, SoundStation IP, and VVX VoIP phones.
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.

syntax highlighting: