Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

How to convert a device name into a phone number?

Anyone know if I have an IP phone's device name (SEP0014Axxxxxxx), how do I convert it into the phone number of that phone in my Java program? Please help! Thanks in advance!!

5 REPLIES
New Member

Re: How to convert a device name into a phone number?

you can use an SQL query to get the directory number of the first line of the nominated phone. here is the query:

SELECT b.dnorpattern

FROM device a, numplan b, devicenumplanmap c

WHERE a.pkid = c.fkdevice

AND b.pkid = c.fknumplan

AND c.numplanindex = 1

AND a.name = 'SEP0014Axxxxxxx'

A couple of ways to do this with Java: Use JDBC and connect directly to the SQL database ('Audience frowns at this point'), OR submit your SQL query via the AXL executeQuery method. Details on these two techniques can be found by searching these forums ...

C

New Member

Re: How to convert a device name into a phone number?

Thanks C! Appreciate your help! It turned out I'm furtunate enough to have the instance of the provider in my code, so this works for me

provider.getTerminal("SEPxxxxxxxxx").getAddresses()

Re: How to convert a device name into a phone number?

Just a technical reminder: It is possible to have the same DN multiple times, in different partitions. So the SQL query, while correct, is unable to handle that particular situation. I'm not sure how frequent that scenario ocurrs, I've never seen it in the wild, but it's a potential issue that you should keep in mind when searching the database.

provider.getTerminal is in fact the most proper solution because it gives you the addresses currently on the phone.. if you're working with EM and have this multiple DN in different partitions thing, it's the only way (I doubt many people would opt for a heterogeneous numbering plan though if it can be done differently.. it's a pain to maintain.)

New Member

Re: How to convert a device name into a phone number?

if i understand you correctly, that's not quite correct. Irrespective of the partition, that query gives the DN of the first line of the nominated phone, which is the stated requirement. other identical DNs in different partitions will not be returned, because they are not associated with the first line of the nominated phone.

I agree that, if you already have a JTAPI provider, then getAddress() is the easiest thing to do. The drawback is having to have a JTAPI provider, ie, you can't associate every phone with a single JTAPI user in a large installation.

So, if you already have a JTAPI provider, and the phones you wish to query are under JTAPI control, the easiest thing to do is to use the JTAPI provider. If you want to query *any* phone in the cluster, the SQL option is quite a good option.

c

Re: How to convert a device name into a phone number?

Urgh, you are right.. I was thinking about the reverse scenario (DN -> device).

183
Views
0
Helpful
5
Replies