Pull info from AD

Version 1
    This document was generated from CDN thread

    Created by: Mike Callagy on 10-04-2009 01:51:56 AM
    I was told from another group that the answer to this question would be found somewhere in IP Phone Services.  I have downloaded the SDK but it appears that all the apps are geared towards Call Manager 4.x. I am hoping somebody here can help me.
     
    I would like to provide more information to my users when they go to
    Directories --> Corporate Directory on their 7945 phones.  For
    example I would like to provide cell phone numbers for other users
    contained within Active Directory.  Upon further invesitigation I found
    that you are limited to just a few attributes that CUCM will pull from
    AD via LDAP.
     
    I was told by my SE that I should go into
    Enterprise Parameters --> URL directories and redirect the phones to
    a web server with a custom XML script that would pull the desired data
    from AD.  I am by no means an XML expert and I am wondering if anybody
    else has done this or anything similiar.
     
    I am running 6.1.2 and AD on Server 2003
     
    Thank you,
    Mike.

    Subject: RE: Pull info from AD
    Replied by: Praful Kapadia on 20-04-2009 10:29:10 PM
    Hi Mike
     
    Your SE is right.
     
    As far as I can tell you cannot customise the existing Corporate Directory application. Instead you have to write your own one, that returns what you want. I have written one to provide information from our companies coontact list.
     
    See the PhotoDirectory JSP example in the SDK. This also gets info from LDAP (which AD supports). You can ignore the stuff about images and concentrate on the bit that queries LDAP and displays names.
     
    It may help to know that there's not much to XML in ths context. Your app has to return XML. There are different XML tags based on what you want the phone to display. They are documented in the IP Phone Services Application Development Notes. Use the <CiscoIPPhoneDirectory> tag to display a directory listing like the one displayed by the Corporate Directory.
     
    Praful

    Subject: RE: Pull info from AD
    Replied by: Mike Callagy on 29-04-2009 06:13:40 PM
    At this point, I have setup a server running IIS/PHP and I have created a php script that pulls the necessary data from AD.  The php script outputs the data into an XML format and it looks good in a browser no errors.  The problem is now that the phone cannot access the page.
     
    When I try to access the same page from the phone I am getting "XML Error [4]: Parse Error".  I have searched for any special characters or character limits that may be causing the issue but I can't find anything.  Does anybody know if there is a limit to the length of a page that the 7945 phone can display?
     
    Any other suggestions would be apprecitaed.
     
    Thanks,
    Mike.

    Subject: RE: Pull info from AD
    Replied by: David Staudt on 29-04-2009 07:13:19 PM
    The XML returned needs to validate against the Cisco IP Phone Services xsd schema: http://developer.cisco.com/web/ipps/docs
     
    This will document the maximum menu items, field lengths, etc.  If you are unable to spot the problem, feel free to attach an example XML document.

    Subject: RE: Pull info from AD
    Replied by: Mike Callagy on 13-05-2009 08:26:45 PM
    I was finally able to get this working.  The information below was gleaned from many sites and many hours of trial and error.  The main site that got me rolling was http://croesnet.eu/trixbox/ldap-directory-for-cisco-7940-7960-ip-phones/
     
    First, as mentioned earlier I setup a websever running IIS/PHP but I have since moved to an Apache/PHP setup and the same php files worked on both systems.
     
    Create a file called directory.php (see attached file).  For the URL directive point to <webserver IP address>/result.php.
     
    In CUCM go to Device --> Device Settings --> Phone Services and create a service that points to your webserver/directiory.php.
     
    Create a file called result.php (see attached file).  This script will make the call to AD via LDAP and pull the information we are looking for.  It will then send the results back to the phone in XML format.
     
    It will probably not work the first time or the tenth time for that matter but this should definitely get you close.  With the proper tweaking for your environment you should get what you're looking for.  YMMV
     
    Thanks to all who responded,
    Mike.

    Subject: RE: Pull info from AD
    Replied by: Leif Arne on 23-09-2009 08:03:17 AM
    - After som changed a few type error in the directory.php I get the directory search to enter "search criteria".
    Telnet to the cisco phone (7940G) show that I get result on my search is success, but the phone it self show result as :
     CMXML ERROR
    XML Parse error.
    Do I need another PHP version ? IIS ?
    ______________________________________________________
    Telnet result :
     
    [09:46:12:70485]
    Http Recv [186] Bytes of Data
    Data Packet is:
    ===============
    HTTP/1.1 200 OK
    Connection: close
    Date: Wed, 23 Sep 2009 07:46:14 GMT
    Server: Microsoft-IIS/6.0
    MicrosoftOfficeWebServer: 5.0_Pub
    X-Powered-By: PHP/4.4.7
    Content-Type: text/xml


    ===============

    [09:46:12:70486]
    Http Recv [153] Bytes of Data
    Data Packet is:
    ===============
    <?xml version="1.0" ?>Using LDAP v3<CiscoIPPhoneDirectory>
    <Title>IP Telephony Directory</Title>
    <Prompt>4 Reachable person(s)</Prompt>
    <DirectoryEntry>

    ===============

    [09:46:12:70487] HTTP RECV (CLOSE CMD)
    [09:46:12:70487] Platform_Close_Socket conn[2]
    [09:46:12:70488] GUI_XML_Parse: Unknown Parse Error
    [09:46:12:70489] Platform_Close_Socket conn[2]
    __
     
     
    --- Found the error. Needed to enable PHP extension (extension=php_iconv.dll) in php.ini so it could use "iconv"

    Subject: RE: Pull info from AD
    Replied by: David Staudt on 23-09-2009 01:37:18 PM
    It looks like the XML sent to the phone contains some erroneous stuff (bold):
     
    <?xml version="1.0" ?>Using LDAP v3<CiscoIPPhoneDirectory>
    <Title>IP Telephony Directory</Title>
    <Prompt>4 Reachable person(s)</Prompt>
    <DirectoryEntry>

    Subject: RE: ups tracking
    Replied by: qiaohua liu on 15-10-2009 10:24:44 PM
    I tried the ups traking appli on IP Phone, but the track.asp failed, has anybody tried it successfully?
     

    Subject: RE: ups tracking
    Replied by: David Staudt on 16-10-2009 05:07:28 AM
    That sample was written several years ago, and just does a screen scrape of an HTML page from UPS.  Almost certainly they have changed the URL and/or contents of the tracking page, and the scrape logic will need to be updated.  An even better solution would be possible if they now publish a web services API you could use to get the data.
     
    The only only dependency should be the CiscoURLProxy COM server - make sure that is installed on the .asp server (it's included in the SDK.)