Get DN of primary line

Version 1
    This document was generated from CDN thread

    Created by: Mayank Sharma on 03-12-2008 04:12:34 PM
    For reference, I posted this in IPPS forums but I believe it is more suited for this forum now.
    Reference thread:

    This query gets me the DN of the device in question. The problem is that when more than one line is configured for the device, it shows multiple DNs. Is it possible to get only the Primary DN or Primary line number.

    "select numplan.dnorpattern from device,numplan,devicenumplanmap where like 'SEPXXXXX' and devicenumplanmap.fknumplan=numplan.pkid and devicenumplanmap.fkdevice=device.pkid"


    Subject: Re: Get DN of primary line
    Replied by: Madhukar Bhandaryr on 03-12-2008 04:58:45 PM
    Could you let us know exactly what the application is expecting and trying to do to here? This will make it easy to help you with this.
    If it is the primary extension of a user you are talking about here, you could get the Primary DN information by using the getUser AXL API to fetch the information.

    Primary DN- you could use the getPhone AXL API to get the information about the lines.

    To know more on the AXL API's, kindly have a look at the API schema's available.


    Subject: Re: Get DN of primary line
    Replied by: Mayank Sharma on 03-12-2008 05:29:30 PM

    Thanks for your response. I had posted the link to my other thread to show what I was talking about. I will try to explain it in short again.

    I created a phone service and I wanted to know the phone number (primary) which requested my service. David mentioned that I could embed #DEVICENAME# in the service URI and the phone will replace that with its own device name. He then suggested an AXL query similar to what I have posted here to get the DN.

    What I am trying to do is to pull some information from the EndUser table of the CUCM depending on the DN.

    So in a nutshell, what I want to do is pull some information from the enduser table depending on the DeviceName.

    If there is another way to link the DeviceName to the EndUser table, please let me know. If this is still not clear enough, please let me know.


    Subject: Re: Get DN of primary line
    Replied by: David Staudt on 03-12-2008 06:44:10 PM
    In that case you may want to use the user-device association mechanism, which is related via the device, enduser and enduserdevicemap tables:

    select enduser.userid from enduser, enduserdevicemap, device where >enduser.pkid = enduserdevicemap.fkenduser and enduserdevicemap.fkdevice = >device.pkid and = 'SEP000000000000'

    Subject: Re: Get DN of primary line
    Replied by: Mayank Sharma on 03-12-2008 06:51:33 PM
    Fabulous. Thank you so much. This works.

    P.S. I am not able to find where to mark the post as answer. Neither in this one nor the other one where you responded.