05-08-2006 03:12 PM - edited 03-13-2019 01:12 PM
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!!
05-08-2006 03:30 PM
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
05-08-2006 04:23 PM
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()
05-08-2006 10:48 PM
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.)
05-09-2006 02:25 AM
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
05-09-2006 11:29 PM
Urgh, you are right.. I was thinking about the reverse scenario (DN -> device).
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide