cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
374
Views
1
Helpful
2
Replies

need to pull report of how many calls hit icm script with SQL queries

kavle
Level 3
Level 3

Hello

I need some help on how many calls hit the specific icm script in the last month.

can anyone provide me the sql query or DB table that I need to look for that.

regards,

Kavle

1 Accepted Solution

Accepted Solutions

DECLARE @StartDate DateTime
DECLARE @EndDate DateTime
SET @StartDate = '2023-08-01 00:00:00.000'
SET @EndDate = '2023-09-01 00:00:00.000'
 
SELECT 
rcd.DateTime
,rcd.RecoveryKey
,rcd.RouterCallKeyDay
,rcd.RouterCallKey
,rcd.RouterCallKeySequenceNumber as RCK
,rcd.RoutingClientCallKey
,rcd.DialedNumberID, dn.EnterpriseName as DialedNumber
,rcd.RouteID, r.EnterpriseName as Route
,rsg.SkillTargetID as RouteSkillTargetID
,rsg.EnterpriseName as RouteSkillGroup
,rcd.RoutingClientID, rc.EnterpriseName as RoutingClient
,rcd.TargetLabelID, rcd.TargetLabel
,rcd.ScriptID, ms.EnterpriseName as ScriptName
,rcd.FinalObjectID as FinalNode
,rcd.CallTypeID, ct.EnterpriseName as CallType
,rcd.NetworkTargetID --*****
,rcd.LabelID, rcd.Label
,rcd.MRDomainID --mrd.EnterpriseName as MRDomain
,rcd.ECCPayloadID
,CASE rcd.RequestType
WHEN 1 THEN 'Pre-Routing request (1)'
WHEN 2 THEN 'Blind transfer or network VRU (2)'
WHEN 3 THEN 'Announced transfer or MCI 800 call (3)'
WHEN 4 THEN 'Overflow (4)'
WHEN 5 THEN 'Re-route (5)'
WHEN 6 THEN 'Post-Routing request (6)'
ELSE 'Undefined: ' + Cast( rcd.RequestType AS Varchar(2))
END RequestType
 
,CASE rcd.OriginatorType
WHEN 0 THEN 'Unknown (0)'
WHEN 1 THEN 'Trunk (1)'
WHEN 2 THEN 'Teleset (2)'
WHEN 3 THEN 'VRU (3)'
WHEN 4 THEN 'Trunk Group (4)'
ELSE 'Undefined: ' + Cast( rcd.OriginatorType AS Varchar(2))
END OriginatorType
 
,rcd.Originator as Originator
 
,CASE rcd.TargetType
WHEN 0 THEN 'resultNone: Call routing ended badly. (0)'
WHEN 1 THEN 'resultDefaultRouteCall: routing ended using a default route. (1)'
WHEN 2 THEN 'resultRouteAgentCall: routing ended with a route to an agent. (2)'
WHEN 3 THEN 'resultRouteService: Call routing ended with a route to a service. (3)'
WHEN 4 THEN 'resultRouteGroup: Call routing ended with a route to a skill group. (4)'
WHEN 5 THEN 'resultAnnouncement: Call routing ended with an announcement. (5)'
WHEN 6 THEN 'resultBusy: Call routing ended in a Busy node. (6)'
WHEN 7 THEN 'resultRing Call routing ended in a Ring node. (7)'
WHEN 8 THEN 'resultNone Call routing ended in a Label node. (8)'
WHEN 9 THEN 'resultNetworkDefault: Call routing ended in a Termination node using a network default route (9)'
WHEN 10 THEN 'resultRouteServiceArray: Call routing ended with a route to a service array. (10)'
WHEN 11 THEN 'resultMultipleLabels: Call routing ended badly. (11)'
WHEN 12 THEN 'resultScheduledTarget: Call routing ended in a Scheduled Target node(busy link functionality). (12)'
WHEN 13 THEN 'resultDone: Only applicable to an AdminScript that ends with no errors. (13)'
WHEN 14 THEN 'resultAborted: Call disconnected. (14)'
WHEN 15 THEN 'resultReleaseCall: Call routing ended with a Release Call node. (15)'
WHEN 16 THEN 'resultQueuedTooLong: Call routing exceeded the queue limit. (16)'
WHEN 17 THEN 'resultSendAgent: Call routing ended with an Agent to Agent node. (17)'
WHEN 18 THEN 'resultDynamicLabelCall: routing ended with a dynamic label node. (18)'
WHEN 19 THEN 'resultDivertDynamicLabels: Call routing ended with a divert-on-busy dynamic label (19)'
WHEN 20 THEN 'resultQueuedDialogFailure: The administrator asked to fail queued calls (20)'
WHEN 21 THEN 'resultRouteAgentAndGroup: Call routing ended with a route to an agent in a specified group (21)'
WHEN 22 THEN 'RouteToPrecisionQueue (22)'
ELSE 'Undefined: ' + Cast( rcd.TargetType AS Varchar(2))
END TargetType
 
,CASE rcd.MsgOrigin
WHEN 1 THEN 'Switch (1)'
WHEN 2 THEN 'CallSim (2)'
WHEN 3 THEN 'TestCall (3)'
ELSE 'Undefined: ' + Cast( rcd.MsgOrigin AS Varchar(2))
END MsgOrigin
 
,rcd.Priority
,rcd.CallSegmentTime
,rcd.NetQTime
,rcd.RouterQueueTime
,rcd.RouterErrorCode
,rcd.VruScripts
,rcd.VruProgress
,rcd.RequeryResult
,rcd.ANI
,rcd.CED
,rcd.CDPD
,rcd.DialedNumberString
,rcd.UserToUser
,rcd.Variable1
,rcd.Variable2
,rcd.Variable3
,rcd.Variable4
,rcd.Variable5
,rcd.Variable6
,rcd.Variable7
,rcd.Variable8
,rcd.Variable9
,rcd.Variable10
,rcd.BeganRoutingDateTime
,rcd.BeganCallTypeDateTime
,rcd.DbDateTime
 
 
FROM
dbo.Route_Call_Detail (NOLOCK) rcd
LEFT JOIN dbo.Call_Type (NOLOCK) ct ON rcd.CallTypeID = ct.CallTypeID
LEFT JOIN dbo.Route (NOLOCK) r ON rcd.RouteID = r.RouteID
LEFT JOIN dbo.Dialed_Number (NOLOCK) dn ON rcd.DialedNumberID = dn.DialedNumberID
LEFT JOIN dbo.Routing_Client (NOLOCK) rc ON rcd.RoutingClientID = rc.RoutingClientID
LEFT JOIN dbo.Script Script (NOLOCK) ON rcd.ScriptID = Script.ScriptID
LEFT JOIN dbo.Label (NOLOCK) lbl ON rcd.LabelID = lbl.LabelID
INNER JOIN dbo.Master_Script (NOLOCK) ms ON Script.MasterScriptID = ms.MasterScriptID
LEFT JOIN dbo.Skill_Group (NOLOCK) rsg ON r.SkillTargetID = rsg.SkillTargetID
 
 
WHERE
rcd.DateTime >=@StartDate and rcd.DateTime <=@EndDate
--Additional Where Clauses below here
--AND rcd.ANI like '%8675309%'
--and rcd.RouterCallKeyDay = 11111 AND RouterCallKey = 222
and ms.EnterpriseName = 'YOURSCRIPTNAMEHERE'
 
ORDER BY
rcd.RouterCallKey
,rcd.DateTime asc

Give this a go. Little more flexible than you asked.

Also this is only going to give you calls that completed in the script. To get all calls going through a script you are going to need to parse the rtr log on the router. 

 

View solution in original post

2 Replies 2

DECLARE @StartDate DateTime
DECLARE @EndDate DateTime
SET @StartDate = '2023-08-01 00:00:00.000'
SET @EndDate = '2023-09-01 00:00:00.000'
 
SELECT 
rcd.DateTime
,rcd.RecoveryKey
,rcd.RouterCallKeyDay
,rcd.RouterCallKey
,rcd.RouterCallKeySequenceNumber as RCK
,rcd.RoutingClientCallKey
,rcd.DialedNumberID, dn.EnterpriseName as DialedNumber
,rcd.RouteID, r.EnterpriseName as Route
,rsg.SkillTargetID as RouteSkillTargetID
,rsg.EnterpriseName as RouteSkillGroup
,rcd.RoutingClientID, rc.EnterpriseName as RoutingClient
,rcd.TargetLabelID, rcd.TargetLabel
,rcd.ScriptID, ms.EnterpriseName as ScriptName
,rcd.FinalObjectID as FinalNode
,rcd.CallTypeID, ct.EnterpriseName as CallType
,rcd.NetworkTargetID --*****
,rcd.LabelID, rcd.Label
,rcd.MRDomainID --mrd.EnterpriseName as MRDomain
,rcd.ECCPayloadID
,CASE rcd.RequestType
WHEN 1 THEN 'Pre-Routing request (1)'
WHEN 2 THEN 'Blind transfer or network VRU (2)'
WHEN 3 THEN 'Announced transfer or MCI 800 call (3)'
WHEN 4 THEN 'Overflow (4)'
WHEN 5 THEN 'Re-route (5)'
WHEN 6 THEN 'Post-Routing request (6)'
ELSE 'Undefined: ' + Cast( rcd.RequestType AS Varchar(2))
END RequestType
 
,CASE rcd.OriginatorType
WHEN 0 THEN 'Unknown (0)'
WHEN 1 THEN 'Trunk (1)'
WHEN 2 THEN 'Teleset (2)'
WHEN 3 THEN 'VRU (3)'
WHEN 4 THEN 'Trunk Group (4)'
ELSE 'Undefined: ' + Cast( rcd.OriginatorType AS Varchar(2))
END OriginatorType
 
,rcd.Originator as Originator
 
,CASE rcd.TargetType
WHEN 0 THEN 'resultNone: Call routing ended badly. (0)'
WHEN 1 THEN 'resultDefaultRouteCall: routing ended using a default route. (1)'
WHEN 2 THEN 'resultRouteAgentCall: routing ended with a route to an agent. (2)'
WHEN 3 THEN 'resultRouteService: Call routing ended with a route to a service. (3)'
WHEN 4 THEN 'resultRouteGroup: Call routing ended with a route to a skill group. (4)'
WHEN 5 THEN 'resultAnnouncement: Call routing ended with an announcement. (5)'
WHEN 6 THEN 'resultBusy: Call routing ended in a Busy node. (6)'
WHEN 7 THEN 'resultRing Call routing ended in a Ring node. (7)'
WHEN 8 THEN 'resultNone Call routing ended in a Label node. (8)'
WHEN 9 THEN 'resultNetworkDefault: Call routing ended in a Termination node using a network default route (9)'
WHEN 10 THEN 'resultRouteServiceArray: Call routing ended with a route to a service array. (10)'
WHEN 11 THEN 'resultMultipleLabels: Call routing ended badly. (11)'
WHEN 12 THEN 'resultScheduledTarget: Call routing ended in a Scheduled Target node(busy link functionality). (12)'
WHEN 13 THEN 'resultDone: Only applicable to an AdminScript that ends with no errors. (13)'
WHEN 14 THEN 'resultAborted: Call disconnected. (14)'
WHEN 15 THEN 'resultReleaseCall: Call routing ended with a Release Call node. (15)'
WHEN 16 THEN 'resultQueuedTooLong: Call routing exceeded the queue limit. (16)'
WHEN 17 THEN 'resultSendAgent: Call routing ended with an Agent to Agent node. (17)'
WHEN 18 THEN 'resultDynamicLabelCall: routing ended with a dynamic label node. (18)'
WHEN 19 THEN 'resultDivertDynamicLabels: Call routing ended with a divert-on-busy dynamic label (19)'
WHEN 20 THEN 'resultQueuedDialogFailure: The administrator asked to fail queued calls (20)'
WHEN 21 THEN 'resultRouteAgentAndGroup: Call routing ended with a route to an agent in a specified group (21)'
WHEN 22 THEN 'RouteToPrecisionQueue (22)'
ELSE 'Undefined: ' + Cast( rcd.TargetType AS Varchar(2))
END TargetType
 
,CASE rcd.MsgOrigin
WHEN 1 THEN 'Switch (1)'
WHEN 2 THEN 'CallSim (2)'
WHEN 3 THEN 'TestCall (3)'
ELSE 'Undefined: ' + Cast( rcd.MsgOrigin AS Varchar(2))
END MsgOrigin
 
,rcd.Priority
,rcd.CallSegmentTime
,rcd.NetQTime
,rcd.RouterQueueTime
,rcd.RouterErrorCode
,rcd.VruScripts
,rcd.VruProgress
,rcd.RequeryResult
,rcd.ANI
,rcd.CED
,rcd.CDPD
,rcd.DialedNumberString
,rcd.UserToUser
,rcd.Variable1
,rcd.Variable2
,rcd.Variable3
,rcd.Variable4
,rcd.Variable5
,rcd.Variable6
,rcd.Variable7
,rcd.Variable8
,rcd.Variable9
,rcd.Variable10
,rcd.BeganRoutingDateTime
,rcd.BeganCallTypeDateTime
,rcd.DbDateTime
 
 
FROM
dbo.Route_Call_Detail (NOLOCK) rcd
LEFT JOIN dbo.Call_Type (NOLOCK) ct ON rcd.CallTypeID = ct.CallTypeID
LEFT JOIN dbo.Route (NOLOCK) r ON rcd.RouteID = r.RouteID
LEFT JOIN dbo.Dialed_Number (NOLOCK) dn ON rcd.DialedNumberID = dn.DialedNumberID
LEFT JOIN dbo.Routing_Client (NOLOCK) rc ON rcd.RoutingClientID = rc.RoutingClientID
LEFT JOIN dbo.Script Script (NOLOCK) ON rcd.ScriptID = Script.ScriptID
LEFT JOIN dbo.Label (NOLOCK) lbl ON rcd.LabelID = lbl.LabelID
INNER JOIN dbo.Master_Script (NOLOCK) ms ON Script.MasterScriptID = ms.MasterScriptID
LEFT JOIN dbo.Skill_Group (NOLOCK) rsg ON r.SkillTargetID = rsg.SkillTargetID
 
 
WHERE
rcd.DateTime >=@StartDate and rcd.DateTime <=@EndDate
--Additional Where Clauses below here
--AND rcd.ANI like '%8675309%'
--and rcd.RouterCallKeyDay = 11111 AND RouterCallKey = 222
and ms.EnterpriseName = 'YOURSCRIPTNAMEHERE'
 
ORDER BY
rcd.RouterCallKey
,rcd.DateTime asc

Give this a go. Little more flexible than you asked.

Also this is only going to give you calls that completed in the script. To get all calls going through a script you are going to need to parse the rtr log on the router. 

 

thank you sir!!!