How to get the DN of calling device

Version 1
    This document was generated from CDN thread

    Created by: Mayank Sharma on 26-11-2008 07:10:18 PM
    The XML for creating a phone directory entry looks like this:

    <Name>{0}, {1}</Name>

    This gives the user of the phone some default options like dialing the phone number displayed. I am creating this entry using C#. Is there a way to get the DN of the phone that dialed the displayed number?

    For example, say I am user of the service and I use it to display the Directory Entries (DE) on my phone (my phone's DN=1234). The DE displayed on my phone shows 5678 as the telephone number.
    Here 1234 = Calling Number and 5678 is the Called Number.

    1. Is it possible to get the value of the Calling Number in my C# code using AXL or something before the user hits "Dial"?
    2. Also, is there a way to handle the "Dial" event from my C# code itself (I would like to modify the dialed number).
    3. Is there a way to identify which device is requesting my service (basically I want the DN of the device)?

    If this explaination is not clear enough, please let me know.


    Subject: Re: How to get the DN of calling device
    Replied by: David Staudt on 26-11-2008 09:47:20 PM
    There are several tricks and techniques that you can combine that may help here:

    • When the phone requests a URL (i.e. when requesting a service), it will replace the occurrence of #DEVICENAME# in the URL with its actual device name (SEPxxxx). You can configure the service itself with this keyword embedded in it:

    Then your service can extract the device name from the URL parameters

    • Once you have the device name, you can use AXL and a custom executeSQLQuery action to get a list of DNs (could be multiple) configured on the device. Use a query like:

    select from device,numplan,devicenumplanmap where >numplan.dnorpattern like "DN to look for" and >devicenumplanmap.fknumplan=numplan.pkid and >devicenumplanmap.fkdevice=device.pkid

    Doing this once, you can use session/cookie to keep track of it or embed the DN in any URLs you send to the phone from then on.

    • Your service can do the dialing (with a chance to modify the number) in several different ways, possibly the easiest being to create an IP Phone Execute object with the Dial URI set to the modified number. Also available is a JTAPI action. Note both Execute/JTAPI require some administrative configuration (the phone must be associated with a special application user, CUAE device pool config, etc.)

    Subject: Re: How to get the DN of calling device
    Replied by: Mayank Sharma on 02-12-2008 01:19:55 PM
    Thanks David. This sounds promising. Let me work on it and post back.

    Subject: Re: How to get the DN of calling device
    Replied by: Mayank Sharma on 02-12-2008 02:23:22 PM

    Is there any field in these tables that whould imply that the DN I get is the primary DN? As you mentioned in your post, the query would result in multiple DNs if they are configured for the user. I would like to pull only the primary line.