User-Devices Queries

Version 1
    This document was generated from CDN thread

    Created by: darrell breyer on 07-06-2013 01:03:28 PM
    HI All,

    I'm building a .net application that will pass in a user name and return all the devices (if any) that user is currently logged into.  

    In reading some cisco api info they refer to this as User Device Queries?  I have used AXL in a previous project  to update extension mobility pins which worked great.  I was hoping someone might have some sample code or examples I can review for this new request.

    Thanks in advance.

    D

    Subject: RE: User-Devices Queries
    Replied by: David Staudt on 19-06-2013 03:13:42 PM
    This thread might be helpful:

    http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/16364144

    Subject: RE: User-Devices Queries
    Replied by: Adrienne Moherek on 27-06-2013 02:13:59 PM
    Hi Darrell,

    When CUCM 10.0 is released, a simple REST-based API called User Data Service API will also be released which will allow a user to get a list of all devices associated to a user.

    Thanks,
    Adrienne

    Subject: RE: User-Devices Queries
    Replied by: darrell breyer on 28-06-2013 09:25:54 AM
    Thanks Adrienne when will CUCM be released.  And what is the best place to go for me to see a complete API?  

    To complete my current project I used EM API to get a list of all devices.  Issue is the response is only returning the device with the lowest MAC address.  I need the query to return all devices a user is logged into.  Any suggestions?  

    Code:
    public static String getUserViaEM(string selectedUser)   
    {       
    String myResponse = "false";
     ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };          

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("http://ipaddy/emservice/EMServiceServlet"));               
    request.ProtocolVersion = System.Net.HttpVersion.Version10;       
    request.Method = "POST";       
    request.Credentials = new NetworkCredential("user", "pass");         
    request.Timeout = 100000;       
    request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";       
    request.Accept = "text/xml";
     string postData = "xml=<query><appInfo><appID>user</appID><appCertificate>pass</appCertificate></appInfo><userDevicesQuery><userID>" + selectedUser + "</userID></userDevicesQuery></query>";       

    Stream requestStream = request.GetRequestStream();
    requestStream.Write(System.Text.Encoding.ASCII.GetBytes(postData), 0, postData.Length);        requestStream.Close();

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();       
    Stream responseStream = response.GetResponseStream();       
    StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8);

    XDocument xmlDoc = XDocument.Parse(readStream.ReadToEnd());       
    var cols = xmlDoc.Descendants("response");    
           
    foreach (var col in cols.Elements())       
    {           
    if (col.Value != "")           
    {               
    myResponse = col.Value;                               
          
    }                             
    }
            
            return myResponse;                      


    Subject: RE: User-Devices Queries
    Replied by: David Staudt on 28-06-2013 10:12:46 AM
    Have you checked the full XML response?  Looking at the code below it looks like it would only return the last row...

    Also, I believe there is a UCM parameter which prevents multiple phone logins - assume this is not in effect?

    Subject: RE: New Message from David Staudt in AXL Developer - Administration XML Que
    Replied by: darrell breyer on 28-06-2013 10:34:21 AM
    Hi David,

    In administrator we see a user logged into 4 devices.  However when we run the query using my web app we get this response:

      <!DOCTYPE response (View Source for full doctype...)>
    - <response>
    - <userDevicesResults>
    - <user id="WEST">
      <deviceName>SEP0023334161A4</deviceName>
      </user>
      </userDevicesResults>
      </response>

    Shouldn’t there be 4 devicename nodes/elements?

    Thanks

    Darrell

    From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
    Sent: Friday, June 28, 2013 11:13 AM
    To: cdicuser@developer.cisco.com
    Subject: New Message from David Staudt in AXL Developer - Administration XML Questions: RE: User-Devices Queries

    David Staudt has created a new message in the forum "Administration XML Questions": -------------------------------------------------------------- Have you checked the full XML response?  Looking at the code below it looks like it would only return the last row...

    Also, I believe there is a UCM parameter which prevents multiple phone logins - assume this is not in effect?
    --
    To respond to this post, please click the following link: http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/16702190 or simply reply to this email.

    ________________________________

    The information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by email, postmaster@weil.com, and destroy the original message. Thank you.

    Subject: RE: User-Devices Queries
    Replied by: darrell breyer on 28-06-2013 10:37:47 AM
    But you are right if there are multiple responses my code will have to be altered so it appends the results to my string var.

    Subject: Re: New Message from Adrienne Moherek in AXL Developer - Administration XML
    Replied by: darrell breyer on 28-06-2013 01:21:58 PM
    David, never mind you were right.  Our system only allows a user to be logged in to one device at a time. The user with 4 devices had them hard coded to his profile.

    On Jun 27, 2013, at 3:19 PM, "Cisco Developer Community Forums" <cdicuser@developer.cisco.com<mailto:cdicuser@developer.cisco.com>> wrote:

    Adrienne Moherek has created a new message in the forum "Administration XML Questions": -------------------------------------------------------------- Hi Darrell,

    When CUCM 10.0 is released, a simple REST-based API called User Data Service API will also be released which will allow a user to get a list of all devices associated to a user.

    Thanks,
    Adrienne
    --
    To respond to this post, please click the following link: http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/16673598 or simply reply to this email.

    ________________________________

    The information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by email, postmaster@weil.com, and destroy the original message. Thank you.

    Subject: RE: User-Devices Queries
    Replied by: darrell breyer on 31-07-2013 02:36:23 PM
    Is there an API I can use to get the call history of a particular user? 

    Subject: RE: User-Devices Queries
    Replied by: David Staudt on 31-07-2013 02:45:46 PM
    Short answer: no
    Longer answer would involve an application which continuously received/archived UCM Call Detail Records (CSV flat files), and could be queried on the data to produce such report.

    Subject: RE: New Message from David Staudt in AXL Developer - Administration XML Que
    Replied by: Chikeobi Njaka on 31-07-2013 03:21:52 PM
    Hi Darrel,
    As David said, the only way to do that "realtime" would be a CTI application that monitors the user's device and produce the report. Alternatively, "near-realtime" can be achieved by downloading CDR at the minimum interval and searching for the user's device.

    [quote=
    darrell breyer]We would like to pick a user and retrieve the call history real time.

    Is there any API update that might include this?  Adrienne mentioned CUCM 10.0 is coming out soon.


    From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
    Sent: Wednesday, July 31, 2013 3:46 PM
    To: cdicuser@developer.cisco.com
    Subject: New Message from David Staudt in AXL Developer - Administration XML Questions: RE: User-Devices Queries

    David Staudt has created a new message in the forum "Administration XML Questions": -------------------------------------------------------------- Short answer: no
    Longer answer would involve an application which continuously received/archived UCM Call Detail Records (CSV flat files), and could be queried on the data to produce such report.
    --
    To respond to this post, please click the following link: http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/17826833 or simply reply to this email.

    ________________________________

    The information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by email, postmaster@weil.com, and destroy the original message. Thank you.

    Subject: RE: New Message from David Staudt in AXL Developer - Administration XML Que
    Replied by: darrell breyer on 31-07-2013 03:01:03 PM
    We would like to pick a user and retrieve the call history real time.

    Is there any API update that might include this?  Adrienne mentioned CUCM 10.0 is coming out soon.


    From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
    Sent: Wednesday, July 31, 2013 3:46 PM
    To: cdicuser@developer.cisco.com
    Subject: New Message from David Staudt in AXL Developer - Administration XML Questions: RE: User-Devices Queries

    David Staudt has created a new message in the forum "Administration XML Questions": -------------------------------------------------------------- Short answer: no
    Longer answer would involve an application which continuously received/archived UCM Call Detail Records (CSV flat files), and could be queried on the data to produce such report.
    --
    To respond to this post, please click the following link: http://developer.cisco.com/web/axl-developer/forums/-/message_boards/view_message/17826833 or simply reply to this email.

    ________________________________

    The information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by email, postmaster@weil.com, and destroy the original message. Thank you.

    Subject: RE: User-Devices Queries
    Replied by: darrell breyer on 31-07-2013 03:38:42 PM
    Thanks for the information guys!