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.
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.
Please remember to rate helpful posts.
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.
Please remember to rate helpful posts.