Got this working ages ago.
Should have update this dicussion.
below is a Report which grabs the last 20 calls.
You can filter on ANI so you only see the calls you made etc.
Very useful for troubleshooting and finding out what the Dialed number is, if the dialplan is not well designed.
http://orourke.tv/web/doku.php?id=cisco:uc:icm:sqlhttp://orourke.tv/web/lib/exe/fetch.php?media=cisco:uc:icm:last20calls-callroutedetail_v1-02.zipBelow is an extract of the SQL
SET ARITHABORT OFF SET ANSI_WARNINGS OFF SET NOCOUNT ON
SELECT TOP (20)
StartDateTime = Route_Call_Detail.DateTime,
DBDateTime = Route_Call_Detail.DbDateTime,
ANI = ISNULL(Route_Call_Detail.ANI,'NULL'),
DialedNumberString = Route_Call_Detail.DialedNumberString,
RoutingClientID = Route_Call_Detail.RoutingClientID,
RoutingClientName = Routing_Client.EnterpriseName,
..
..
..
..
FROM
Route_Call_Detail(nolock),
Script(nolock),
Master_Script(nolock),
Call_Type(nolock),
Routing_Client(nolock)
WHERE
(Route_Call_Detail.ScriptID = Script.ScriptID) AND
(Script.MasterScriptID = Master_Script.MasterScriptID) AND
(Route_Call_Detail.CallTypeID = Call_Type.CallTypeID) AND
(Route_Call_Detail.RoutingClientID = Routing_Client.RoutingClientID)AND
(Route_Call_Detail.DbDateTime > GetDate()-1)
ORDER BY
Route_Call_Detail.DbDateTime DESC