How to get what phones have a specific line?

Version 1
    This document was generated from CDN thread

    Created by: Andrew Gray on 17-02-2009 09:59:38 PM
    Subject says it all, really.  I have line information (either UUID or number/partition), and I need to know what phone(s) have that line associated with them.  getLine() doesn't return that information, and nothing under the listPhoneXXX() set seems appropriate.

    Subject: RE: How to get what phones have a specific line?
    Replied by: David Staudt on 17-02-2009 11:40:52 PM
    The most efficient way to do this is via a SQL statement against the UCM database, using the AXL <executeSQLQuery> request.  The tables involved will be device, numplan and devicenumplanmap, and the query may look something like this:
     
    select name from device, numplan, devicenumplanmap where device.pkid=devicenumplanmap.fkdevice and numplan.pkid=devicenumplanmap.fknumplan and numplan.pkid='6d057752-9267-7f4d-7f96-d6677d528710'
     
    The Data Dictionary document will be your guide here.

    Subject: RE: How to get what phones have a specific line?
    Replied by: Andrew Gray on 18-02-2009 08:41:00 PM
    Thank you, that query does exactly what I need.