03-28-2010 07:16 PM - edited 03-15-2019 10:00 PM
Hi Guys
I would like to find out if there is any report or way to find out if a DN has activated call forwarding or, if a certain DN is being set as call forwarding destination by another DN.
Thanks
Solved! Go to Solution.
03-28-2010 09:09 PM
There is no native report in CUCM that can retrieve this information but you can use a SQL query (ether from the command line or via SQL Query Tool). Command line example of what you seek:
admin: run sql select d.name as device, n.dnorpattern, cfd.cfadestination from device as d inner join devicenumplanmap as dmap on dmap.fkdevice = d.pkid inner join numplan as n on n.pkid=dmap.fknumplan inner join callforwarddynamic as cfd on cfd.fknumplan=n.pkid where (cfd.cfadestination != '')
If you have an interest in seeing stations that are call forwarded to voicemail AND other destinations, then the following query can be used:
admin: run sql select d.name as device, n.dnorpattern, cfd.cfadestination from device as d inner join devicenumplanmap as dmap on dmap.fkdevice = d.pkid inner join numplan as n on n.pkid=dmap.fknumplan inner join callforwarddynamic as cfd on cfd.fknumplan=n.pkid where ((cfd.cfadestination != '') or (cfd.cfaVoicemailEnabled='t'))
If you are looking for a particular number like 17035551212 as the call forward destination, then the following could be used:
admin: run sql select d.name as device, n.dnorpattern, cfd.cfadestination from device as d inner join devicenumplanmap as dmap on dmap.fkdevice = d.pkid inner join numplan as n on n.pkid=dmap.fknumplan inner join callforwarddynamic as cfd on cfd.fknumplan=n.pkid where (cfd.cfadestination = '917035551212')
(NOTE: The above assumes that the off net access code is "9")
If you are curious about the SQL Query Toolkit I mentioned earlier, then you may find the following article interesting (part 1 of 3 part series:
The SQL Query Toolkit takes a little effort to employ. So, if messing with XML output parsing isn't your cup of tea, the queries I provided above (ran from the command line of the CUCM console) should do the trick.
HTH.
Regards,
Bill
Please remember to rate helpful posts.
Please remember to rate helpful responses and identify
03-29-2010 06:09 AM
Sorry for the delay in responding. Local timezone is EST and you probably sent this follow up as my head hit the pillow.
1. When i tried to run this command on another server, it prompts "The specified table (callforwarddynamic) is not in the database.". Does it mean it can't find any call forwarding?
No, this means that you have a different CUCM version on the other server. With each version of CUCM, the database schema changes. With 6.0, the way that call forwarding information was tracked in the databse changed and the "callforwarddynamic" table was added to the database. Prior to 6.0, this data was tracked directly in the numplan database. The following is a sample query that you should be able to use on databases prior to 6.x. In this query we are looking at all patterns where the call forward destination is either long distance or international (assumes that "9" is the off net access code and the dial plan is NANP).
select n.dNorPattern as pattern,rp.name as routePartition, n.cFADestination as ForwardDestination
from NumPlan as n
where ((n.cFADestination like '91%') or (n.cFADestination like '9011%'))
5.x: (NOTE, I haven't tested this query out on a 5.x system. But the 5.x database schema (at least as it relates to this topic) suggests it should accept the above query. Most of my customers bypassed this version altogether so the window of time where I worked on this rev. is relatively short in comparison to 4x/6x/7x.)
2. Related to Qn 1, how do i search based on device profile? or even just directory number?
Good question. Which server are we talking about for these query variants? I ask because on 6.x/7x, the query I provided in the original thread will pick up phones and device profiles. Now, as you have noticed if a number is not assigned to a device then the query I provided won't catch it. This is because I am doing an "inner join" to map devices to directory numbers and if there isn't a record in the foreign table then the query skips it. To poll all directory numbers in the numplan, you can use the following query:
select n.dnorpattern, cfd.cfadestination
from Numplan as n inner join callforwarddynamic as cfd on cfd.fkNumplan=n.pkid
where (cfd.cfadestination != '')
Your "where" clause could also specify the target destination: where (cfd.cfadestination = '917035551212')
Your "where" clause could also be used to show target destinations by class (e.g. long distance/international): where ((cfd.cfadestination like '91%') or (cfd.cfadestination like '9011%'))
Note, the examples assume that "9" is your off net access code and that the devices are using the NANP.
There are multiple variations on this theme and aside from the schema change that occurred with 6.0, the query structures are similar between pre- and post- 6.x systems.
On the system you are having trouble with try the query I provided in response to question #1. If that doesn't work, then please let me know which versions of CUCM you are trying this on.
HTH.
Regards,
Bill
Please remember to rate helpful posts.
Please remember to rate helpful responses and identify
03-28-2010 09:09 PM
There is no native report in CUCM that can retrieve this information but you can use a SQL query (ether from the command line or via SQL Query Tool). Command line example of what you seek:
admin: run sql select d.name as device, n.dnorpattern, cfd.cfadestination from device as d inner join devicenumplanmap as dmap on dmap.fkdevice = d.pkid inner join numplan as n on n.pkid=dmap.fknumplan inner join callforwarddynamic as cfd on cfd.fknumplan=n.pkid where (cfd.cfadestination != '')
If you have an interest in seeing stations that are call forwarded to voicemail AND other destinations, then the following query can be used:
admin: run sql select d.name as device, n.dnorpattern, cfd.cfadestination from device as d inner join devicenumplanmap as dmap on dmap.fkdevice = d.pkid inner join numplan as n on n.pkid=dmap.fknumplan inner join callforwarddynamic as cfd on cfd.fknumplan=n.pkid where ((cfd.cfadestination != '') or (cfd.cfaVoicemailEnabled='t'))
If you are looking for a particular number like 17035551212 as the call forward destination, then the following could be used:
admin: run sql select d.name as device, n.dnorpattern, cfd.cfadestination from device as d inner join devicenumplanmap as dmap on dmap.fkdevice = d.pkid inner join numplan as n on n.pkid=dmap.fknumplan inner join callforwarddynamic as cfd on cfd.fknumplan=n.pkid where (cfd.cfadestination = '917035551212')
(NOTE: The above assumes that the off net access code is "9")
If you are curious about the SQL Query Toolkit I mentioned earlier, then you may find the following article interesting (part 1 of 3 part series:
The SQL Query Toolkit takes a little effort to employ. So, if messing with XML output parsing isn't your cup of tea, the queries I provided above (ran from the command line of the CUCM console) should do the trick.
HTH.
Regards,
Bill
Please remember to rate helpful posts.
Please remember to rate helpful responses and identify
03-28-2010 09:28 PM
Thanks Bill! It works like a miracle!
Just one more question, if i were to activate a call forwarding now, how long it will takes to show up at the database? Is it spontaneous?
03-28-2010 09:40 PM
Found out the answer.. it is spontaneous.
Thanks Bill!~
03-28-2010 09:43 PM
Excellent. Glad I could help.
Regards,
Bill
Please remember to rate helpful responses and identify
03-29-2010 12:33 AM
Hi Bill
I have a few questions:
1. When i tried to run this command on another server, it prompts "The specified table (callforwarddynamic) is not in the database.". Does it mean it can't find any call forwarding?
I activated call forwarding on my device profile's DN which is signed in to a physical phone.
2. Related to Qn 1, how do i search based on device profile? or even just directory number?
This is because i have some unassigned DN in callmanager but just want to make sure it is not used at any call-forward destination. I think the command given in the above search based on device, so if the DN is not configured as a fixed number on any device, it can't be "found".
Thanks
03-29-2010 12:55 AM
-
03-29-2010 06:09 AM
Sorry for the delay in responding. Local timezone is EST and you probably sent this follow up as my head hit the pillow.
1. When i tried to run this command on another server, it prompts "The specified table (callforwarddynamic) is not in the database.". Does it mean it can't find any call forwarding?
No, this means that you have a different CUCM version on the other server. With each version of CUCM, the database schema changes. With 6.0, the way that call forwarding information was tracked in the databse changed and the "callforwarddynamic" table was added to the database. Prior to 6.0, this data was tracked directly in the numplan database. The following is a sample query that you should be able to use on databases prior to 6.x. In this query we are looking at all patterns where the call forward destination is either long distance or international (assumes that "9" is the off net access code and the dial plan is NANP).
select n.dNorPattern as pattern,rp.name as routePartition, n.cFADestination as ForwardDestination
from NumPlan as n
where ((n.cFADestination like '91%') or (n.cFADestination like '9011%'))
5.x: (NOTE, I haven't tested this query out on a 5.x system. But the 5.x database schema (at least as it relates to this topic) suggests it should accept the above query. Most of my customers bypassed this version altogether so the window of time where I worked on this rev. is relatively short in comparison to 4x/6x/7x.)
2. Related to Qn 1, how do i search based on device profile? or even just directory number?
Good question. Which server are we talking about for these query variants? I ask because on 6.x/7x, the query I provided in the original thread will pick up phones and device profiles. Now, as you have noticed if a number is not assigned to a device then the query I provided won't catch it. This is because I am doing an "inner join" to map devices to directory numbers and if there isn't a record in the foreign table then the query skips it. To poll all directory numbers in the numplan, you can use the following query:
select n.dnorpattern, cfd.cfadestination
from Numplan as n inner join callforwarddynamic as cfd on cfd.fkNumplan=n.pkid
where (cfd.cfadestination != '')
Your "where" clause could also specify the target destination: where (cfd.cfadestination = '917035551212')
Your "where" clause could also be used to show target destinations by class (e.g. long distance/international): where ((cfd.cfadestination like '91%') or (cfd.cfadestination like '9011%'))
Note, the examples assume that "9" is your off net access code and that the devices are using the NANP.
There are multiple variations on this theme and aside from the schema change that occurred with 6.0, the query structures are similar between pre- and post- 6.x systems.
On the system you are having trouble with try the query I provided in response to question #1. If that doesn't work, then please let me know which versions of CUCM you are trying this on.
HTH.
Regards,
Bill
Please remember to rate helpful posts.
Please remember to rate helpful responses and identify
03-29-2010 08:36 PM
Hey, thanks for the clarification. You are right. The version that I am trying on was 5.1.3 which explains the error returned.
However the actual system that I need to pull the information from is 6.1.3.
I have tried the string, on CUCM 7.0.1, that you gave which query based on directory number, and it works!
admin:run sql select n.dnorpattern, cfd.cfadestination from Numplan as n inner join callforwarddynamic as cfd on cfd.fkNumplan=n.pkid where (cfd.cfadestination != '')
So can I safely say this query string will work on 6.1.3?
03-29-2010 08:42 PM
Yes, it will work on 6.1.3.
HTH.
Regards,
Bill
Please remember to rate helpful responses and identify
03-29-2010 09:06 PM
Thanks for your great help!
=)
10-01-2019 04:55 AM
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