[asterisk-users] Script for seeding polycom phones with an extension directory

Anciso, Roy
Fri, 25 Jan 2008 19:53:53 -0000

Hello List,

Not sure if this will be helpful but I made changes to the original
Cisco directory.php.txt script and applied them for use on the Polycom
phones.  This will create an extension directory and alphabetize it
based on the sip registrations you have setup in sip.conf.  Note that
this only seeds the phones and does not synchronize them.  Anyway
thought it might save people some time.  To run do: php scriptname >
/home/polycom/000000000000-directory.xml.



<?

header("Content-type: text/xml");

header("Connection: close");

header("Expires: -1");



// location of asterisk config files

$location = "/etc/asterisk/";



// parse sip.conf

$sip_array = parse_ini_file($location."sip.conf", true);

while ($v = current($sip_array))

{ if (isset($v['name']))

{ $directory[] = " ".
$v['name']." \n".

    "<ct>".key($sip_array)."</ct>\n";

}

next($sip_array);

}



sort($directory);



echo "<directory>\n";

echo "<item_list>\n";

foreach ($directory as $v) {

  echo "<item>\n";

  echo $v;

  echo "</item>\n";

}

echo "</item_list>\n";

echo "</directory>\n";

?>



Roy Anciso

Director of Technology

Manistee Intermediate School District

1710 Merkey Road

Manistee, MI 49660

Ph: 231-723-4264

Fx: 231-723-1690

roy at manistee.org



-------------- next part --------------
An HTML attachment was scrubbed...