Phone Directory

Version 1
    This document was generated from CDN thread

    Created by: Jean-Francois Handfield on 03-07-2008 01:51:04 PM
    Hi,

    I'm pretty new to the whole AXL-SOAP developpement and I would like some pointers on how to accomplish something.

    1- I'm trying to create a Phone Directory on my business Intranet. Since I moved to CCM 6.1 it's seems like there is no more LDAP. So what I'm asking from you guys is a simple example on how to recreate that Phone Directory. I've looked at the one in the CM User Option and it looks really nice. So something like that!

    PS: Is there a webdialer available for CCM 6.1 or do I have to use the one from 3.1?

    2- I need to modify one of my PilotPoint every half hour, I'll spare you why, and right now I have a script on one of my server that opens up the web page and click on the different options to get to the pilot point and modify the stuff for me, but I would like to create a simple soft that load up only the pilot point users and shuffle them around like I do and reimport it back to the DB. Is that possible??

    Thank you for your help it greatly appreciated.

    Edited by: Jean-Francois Handfield on Jul 3, 2008 9:55 AM

    Subject: Re: Phone Directory
    Replied by: Jean-Francois Handfield on 03-07-2008 08:42:35 PM
    Nevermind the question about the WebDialer I figured it out and it's working right now!

    Any pointers on the other questions would be really appreciated!

    Subject: Re: Phone Directory
    Replied by: Jean-Francois Handfield on 04-07-2008 12:47:36 PM
    Ok so now I figured out how to access and send a request to my AXL web service. Here is the code I made in C#

    using (AXLAPIService axl = new AXLAPIService("IP", "user", "pwd"))
    {
    ListUserByNameReq req = new ListUserByNameReq();
    req.lastname = "handfield";
    req.firstname = "*";

    ListUserByNameRes res = axl.listUserByName(req);
    foreach (ListUserByNameResUser user in res.@return)
    {

    listBox1.Items.Add(string.Format("{0}: {1} {2}", user.userid, user.firstname, user.lastname));


    This working perfectly except for 2 things

    1- I can't seem to find the User Phone Extention

    2- The first time I make the request it takes a long time to load... Is there a way to speed up thing???

    Thanks

    Subject: Re: Phone Directory
    Replied by: Jean-Francois Handfield on 04-07-2008 01:54:50 PM
    Is there a way to get a copy of the Directory.asp from the CallManager 6.1???

    Subject: Re: Phone Directory
    Replied by: Jean-Francois Handfield on 07-07-2008 12:25:37 PM
    Why is it we get no help from here?? Is it because my question isn't clear enough of it's because no one ever did anything like that??

    Subject: Re: Phone Directory
    Replied by: David Staudt on 07-07-2008 04:15:15 PM
    'Phone extension' is a bit ambiguous. Users can be associated with multiple extensions.

    • In the getUser response object, there is a telephoneNumber field. This is optionally filled with whatever the admin puts in
    • In the getUser response object, there is a primaryExtension field. This field is optionally filled by the admin from a list of phone device/lines associated to the user via CCM admin.

    Note, both of these fields may be empty.

    • In the getUser response object, there is an associatedDevices list, containing all the phones associated with the user (this could also be empty.) You can retrieve each device individually (getPhone) and get the list of Lines on the device, then check the lines (getLine) to get the DNs


    -----

    Note: this forum is intended for community discussion. Cisco engineers monitor and respond on a best effort basis. For response-guaranteed support for developer issues, please join the Cisco Developer Services program: http://developer.cisco.com/web/devservices

    Subject: Re: Phone Directory
    Replied by: David Staudt on 07-07-2008 04:20:28 PM
    Regarding the initial request delay: I have seen this reported with .NET consuming the AXL WSDL. However in those instances, looking at the HTTP messages back/forth from the AXL web service, it appears the service responds quickly; implying client-side processing/init may be the culprit. My suspicion is that the AXL WSDL stub code is huge and takes a long time to load/init.

    You can confirm that AXL is responding quickly via a packet capture (Wireshark), in which case you'll need to investigate the .NET/WSDL issue.

    Subject: Re: Phone Directory
    Replied by: Jean-Francois Handfield on 07-07-2008 06:07:52 PM
    Thank you for your help.

    Basically what I would like to do is the same Phone Directory in the User Options control panel but outside in my Intranet. Is there a way to get the Source of the Directory.asp???

    This way I could implement the same thing even just call it from my Intranet without having the user to type in there user/pwd on the website then go and find the option.

    Thanks

    Subject: Re: Phone Directory
    Replied by: David Staudt on 07-07-2008 09:18:44 PM
    On CUCM5 and higher, the directory is going to be a servlet or .jsp - not .asp. As well, since it's an appliance without root access I can't get a copy of it. Further, I'd bet that the page doesn't use AXL, but rather uses JDBC direct access or similar (which you won't have access to.)

    Sorry I can't be more help with a good sample here.

    Subject: Re: Phone Directory
    Replied by: Jean-Francois Handfield on 09-07-2008 12:45:02 PM
    Thank you for your help David.

    I am now able to get the user PrimaryExtension and everything is looking nice. My only problem now is the time when the object is getting created. It takes at least 25 seconds!

    Anyways if you ever figure a way to speed up things let me know.

    Thank you

    PS: I posted a new question in the WebDialer section if ever you know anything about it!!

    Subject: Re: Phone Directory
    Replied by: kevin desai on 21-07-2008 05:30:20 AM
    Hi Jean-Francois,

    I am trying to create exactly the same application (Phone Directory) using ASP.NET (C#2.0) . I am using the following code to check if the specified phone exist in the Call Manager Database(6.0)

    the following code instantiates an object of the AXLAPISERVICE class

    -----
    public void axlTest() {

    sUserID = txtUserID.Text.Trim().ToString();
    sPassword = txtPassword.Text.Trim().ToString();

    AXLAPIService oAXL = new AXLAPIService(ccmServer, sUserID, sPassword);

    ListDeviceByNameAndClassReq phoneByName = new ListDeviceByNameAndClassReq();

    phoneByName.searchString = "SEP%";
    ListDeviceResDevice[] phones = oAXL.listDeviceByNameAndClass(phoneByName).@return;

    foreach (ListDeviceResDevice phone in phones) {

    lstResult.Items.Add(phone.uuid);
    lstResult.Items.Add(phone.name);
    }
    }

    Unfortunately, when I debug, I get the message : "connecting to the server machine 172.0.1.1 failed. This may be because the machine doesn't exist or a firewall is preventing communication to the remote computer".

    However I can able to access the web admin interface from the same machine. And also able to telnet the remote machine on port number 8443.(The client and Call Manager Host are on the same hub)

    Could you//any one please help me identify where exactly the problem is or what is it that I'm doing wrong?

    Thanks a lot!

    Subject: Re: Phone Directory
    Replied by: Jean-Francois Handfield on 21-07-2008 02:50:39 PM
    Hi Kevin,

    I'll be more then happy to give you a hand with that if I can.

    Did you modify the AXLAPISERVICE like the readme told you to??

    Subject: Re: Phone Directory
    Replied by: kevin desai on 22-07-2008 04:03:08 AM
    Hi Jean-Francois,

    Thanks for your quick response.

    I have already installed WSDL for .NET and also made the following changes based on the documentation (CUCM 6.0)

    1. created a public class derived from System.Net.ICertificatePolicy (CheckValidationResult is a method of BruteForcePolicy class )
    -----

    public bool CheckValidationResult(System.Net.ServicePoint sp, System.Security.Cryptography.X509Certificates.X509Certificate cert,
    System.Net.WebRequest request, int problem)
    {
    return true;
    }
    -----

    2. Modified the AXLAPIService constructor
    -----

    public AXLAPIService(string ccmIp, string user, string password) {
    System.Net.ServicePointManager.CertificatePolicy = new BruteForcePolicy();
    this.Url = "https://" + ccmIp + ":8443/axl/";

    }
    -----
    3. Overriden the GetWebRequest method in AXLAPIService Class

    -----

    protected override System.Net.WebRequest GetWebRequest(Uri uri){

    System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)base.GetWebRequest(uri);
    if (this.PreAuthenticate){

    System.Net.NetworkCredential nc = this.Credentials.GetCredential(uri, "Basic");
    if (nc != null) {

    byte[] credBuf = new System.Text.UTF8Encoding().GetBytes(nc.UserName + ":" + nc.Password);
    request.Headers = "Basic" + Convert.ToBase64String(credBuf);
    }
    }

    return request;

    }
    -----

    Also made changes according to the documentation, in the below mentioned method signature

    public XUserUserGroupUserRolesUserRole[] userRoles;

    Hope, I have made these modification correctly.

    Note: Cisco Call Manager is installed on a VMWare machine which actually runs on Windows XP. I 'have tried the telnet on port number 8443 and it is working fine. Just to check if the remote machine is connected with the client machine. Also if you can share what sort of environment you set up, especially CUCM.

    Thanks once again for your efforts and cooperation.

    Subject: Re: Phone Directory
    Replied by: Jean-Francois Handfield on 22-07-2008 06:01:39 PM
    I'm running CUCM on a Cisco Server directly. Unfortunately I can't tell you more cause Cisco closed there server down so no one can access them.

    On a other note I tired your code on a C# project and I don't get any errors! Everything is running smoothly. And the changes you made look fine. Can you at least connect to the WSDL from your code?? What I mean is can you at least create an object of AXLAPIService or it crash there??

    Edited by: Jean-Francois Handfield on Jul 22, 2008 2:02 PM