Showing results for 
Search instead for 
Did you mean: 
Level 8

Query to get calls with some conditions

Hi Guys,

I'm trying to get a report where all calls out of work hours can be generated on a report, I have a query that get the date and time, I convert the hour to 24 hours and 12 hours format, but on the table VoIpCallDetails I don't find the field originphoneextension and destinationphoneextension, I see only incoming calls but not all calls (incoming and outcoming). Another table called VoIpCalls I see fields like OrigDeviceName and DestDeviceName but for my propose I need extenions because I will filter all those calls where the destionation number starts with 00 (international calls), on Orion web when I make a report, the field "origphoneextension" contains the extension but on tables directly over database I don't see something similar, Does some know if there is a table on database that contains a field with origin extension and destination extension for a call generated?

This is my query

select OrigDateTimeStamp ,

FORMAT(OrigDateTimeStamp ,'hh') as hora12,

cast(DATEPART(hour, OrigDateTimeStamp ) as numeric)  as hora24

from VoipCallDetails

where OrigDateTimeStamp BETWEEN  '06/01/2019'  AND '06/30/2019' AND

(   cast(DATEPART(hour, OrigDateTimeStamp ) as numeric)   IN (19,20,21,22,23,0,1,2,3,4,5,6,7))

Thanks you so much for any support

0 Kudos