Although it's not LDAP I used a script that I found on the voip wiki and changed it so it looked at only sip configuration files. It also alphabetizes the output so it can be displayed that way on the phone. Below are my notes on the subject. If someone is willing to post this to the wiki and send me a link, that would be awesome.
Cisco Phone Extension Directory Using Services Button I used a PHP script that I found on the Internet and rewrote it to fit our needs. Original code is found at: http://users.marshall.edu/~twohig5/directory.php.txt The new code only looks at the sip.conf file since we are only using sip phones. My version also alphabetizes the directory. Below is the source code: Directory.php.txt <? header("Content-type: text/xml"); header("Connection: close"); header("Expires: -1"); // location of asterisk config files $location = "/etc/asterisk/"; $dirname = "MISD Directory"; // parse sip.conf $sip_array = parse_ini_file($location."sip.conf", true); while ($v = current($sip_array)) { if (isset($v['name'])) { $directory[] = "<Name>". $v['name']."</Name>\n". "<Telephone>".key($sip_array)."</Telephone>\n"; } next($sip_array); } sort ($directory); echo "<CiscoIPPhoneDirectory>\n"; echo "<Title>".$dirname."</Title>\n"; foreach ($directory as $v) { echo "\n<DirectoryEntry>\n"; echo $v; echo "</DirectoryEntry>\n"; } echo "\n<Prompt>Choose Name and Press Dial</Prompt>\n"; echo "</CiscoIPPhoneDirectory>\n"; ?> >From here you can schedule this to run every so often. Once the file is created you must place it in your web directory on the server. I chained the command and also wrote the output to an xml file in the web directory. The command looks like this: 'php /etc/asterisk/directory.php.txt > /var/www/html/directory.xml' System Speeddials using Services Button For speed dials I modified the php code to look to a specific file in the asterisk directory called speeddials.conf. This file only contains attributes that the php script will look for. This is great because you only need to specify the number and name fields. Below is my example of speeddial.php.txt (php code) and speeddials.conf (speed dials): Speeddial.php.txt <? header("Content-type: text/xml"); header("Connection: close"); header("Expires: -1"); // location of asterisk config files $location = "/etc/asterisk/"; $dirname = "System Speed Dial"; // parse speeddials.conf $ssd_array = parse_ini_file($location."speeddials.conf", true); while ($v = current($ssd_array)) { if (isset($v['name'])) { $directory[] = "<Name>". $v['name']."</Name>\n". "<Telephone>".key($ssd_array)."</Telephone>\n"; } next($ssd_array); } sort ($directory); echo "<CiscoIPPhoneDirectory>\n"; echo "<Title>".$dirname."</Title>\n"; foreach ($directory as $v) { echo "\n<DirectoryEntry>\n"; echo $v; echo "</DirectoryEntry>\n"; } echo "\n<Prompt>Choose Name and Press Dial</Prompt>\n"; echo "</CiscoIPPhoneDirectory>\n"; ?> Speeddials.conf ;System Speed Dial File ;This is used in conjuction with speeddial.php.txt ; [9,7234264] name=MISD Admin Office [9,7236205] name=MISD Special Ed Office [9,7233521] name=MAPS Supintendent Office [9,7232547] name=MAPS MHS Once these files are create just run the php command: 'php speeddials.php.txt > /var/www/html/speeddial.xml' This will generate the speed dial file and place it in your web directory. You can also schedule this to run just like the extension directory script. Creating the Main Services Menu To display these two items when the user presses the Services button you first we need to create a file that contains the menus. I created a file called services.xml and placed in the web directory /var/www/html/. Then I wrote the menu structure using XML. I used the information found on the Cisco website as guide to do this. Below is my services.xml file: <CiscoIPPhoneMenu> <Title>Information Services</Title> <Prompt>Press to Enter</Prompt> <MenuItem> <Name>Extension Directory</Name> <URL>http://192.168.1.94/directory.xml</URL> </MenuItem> <SoftKeyItem> <Name>Dir</Name> <URL></URL> <Position></Position> </SoftKeyItem> <Prompt>Press to Enter</Prompt> <MenuItem> <Name>System Speed Dial</Name> <URL>http://192.168.1.94/speeddial.xml</URL> </MenuItem> <SoftKeyItem> <Name>Dir</Name> <URL></URL> <Position></Position> </SoftKeyItem> </CiscoIPPhoneMenu> As you can see the example above uses the <CiscoIPPhoneMenu> tag. I created a couple of menu items called "Extension Directory" & "System Speed Dial" which points to the directory.xml and speeddial.xml files we created earlier. For photos of how this looks on the phone visit: http://picasaweb.google.com/ranciso/AsteriskImagesCiscoPhones/photo#5135 353621777248450 <http://picasaweb.google.com/ranciso/AsteriskImagesCiscoPhones/photo> One major caveat is for some reason Cisco has a limit on how many numbers you can display using the <CiscoIPPhoneDirectory> directive. I believe it is 32. So to keep things sane I created a directory "/etc/asterisk/sip" and departmentalized my sip registrations there. You can tell asterisk to load the sip config files by inserting the following in your main /etc/asterisk/sip.conf file under the general settings: #include "/etc/asterisk/sip/*.conf After creating separate sip files I also duplicated the php script to point to each sip file and adjusted the Cisco XML files accordingly. Cisco Resources & Links for SIP Configuration (You need a Cisco Login to Access) Description: This link is to the documentation for all the Cisco phones: http://cisco.com/en/US/customer/products/hw/phones/ps379/prod_maintenanc e_guides_list.html Description: This link is for setting up the 7906 & 7911 phones with SIP http://cisco.com/en/US/customer/products/hw/phones/ps379/products_admini stration_guide_book09186a00807307c8.html ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of satish patel Sent: Sunday, January 06, 2008 9:58 AM To: [EMAIL PROTECTED]; Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Cisco 79xx XML services I am useing Cisco 7975 with Asterisk on SIP protocol and its working gr8 I have also implemeted SCCP but i got problem of Hangup and my asterisk got hang i dont know what was it but it is working fine with SIP I need LDAP base directory for my Cisco 7975 have u work on it ??? Matthew Rubenstein <[EMAIL PROTECTED]> wrote: I Googled for CMXML_App_Guide.pdf . The first result was the voip-info wiki article "Asterisk phone cisco 79xx" at http://www.voip-info.org/wiki-Asterisk+phone+cisco+79xx . That article mentions CMXML_App_Guide.pdf in the "Company Telephone Directory" section, with a link to the "Asterisk Cisco 79XX XML Services" wiki article at http://www.voip-info.org/wiki/view/Asterisk+Cisco+79XX+XML +Services . Which in turn mentions that the relevant Cisco doc is called "Cisco IP Phone Services Application Development Notes (Cisco IP Phone XML Objects)". So I Googled for "Cisco IP Phone XML Objects" which turned up several results for a 2002 O'Reilly book, followed by the doc itself at http://www.cisco.com/univercd/cc/td/doc/product/voice/vpdd/cdd/5_0/5_0_1 /ipphsv/ip503ch2.htm . Along the way there were several other docs and examples, including differences between SIP/SCCP version of the service. I'm interested to see how well the feature works on the 7970s with Asterisk instead of CallManager. Please keep me posted on your progress. On Fri, 2008-01-04 at 17:08 -0600, [EMAIL PROTECTED] wrote: > Date: Fri, 04 Jan 2008 13:41:31 -0800 > From: Edwin Lam > Subject: [asterisk-users] Cisco 79xx XML services > To: Asterisk Users Mailing List - Non-Commercial Discussion > > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=UTF-8; format=flowed > > > hi guys. > > i'm writing some simple applications for the cisco 7970 > services button. i read the asterisk wiki and it mention > there's a CMXML_App_Guide.pdf file but there's nowhere > can i find a link for it. does anybody know where can > i find it? > > regards. > -- > Edwin Lam -- (C) Matthew Rubenstein _______________________________________________ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ----PGP Signature-- Satish Patel mobile:- +91-9818875535 http://www.linuxbug.org ________________________________ Never miss a thing. Make Yahoo your homepage. <http://us.rd.yahoo.com/evt=51438/*http:/www.yahoo.com/r/hs>
_______________________________________________ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users