1

I have currently been given a task in work to link data in the LcsCDR SessionDetails table. I'm using SSMS to do this. Currently I have to create a excel report of all the calls that happen the previous day, but there is no linking this data. It also wants the duration of the call. When a call comes in, it goes through HQ then put on hold and then into the call centre to be answered but there is no way of linking this to say it is one. Any one know how to do so? I am able to find when the call has been answered in the centre like so:

SELECT u2.UserId,
    u1.UserUri,
    u2.UserUri, 
    [CorrelationId],
    rmd.Description, --Get the description
    CONCAT((DATEDIFF(Hour,SessionIdTime,SessionEndTime)),':',
    (DATEDIFF(Minute,SessionIdTime,SessionEndTime)), ':',
    DATEDIFF(SECOND,SessionIdTime,SessionEndTime)) as TotalHours, -- Show the time in seconds
    [SessionIdTime],
    [SessionEndTime]
FROM SessionDetails sd
INNER JOIN Users AS u1 ON sd.User1Id = u1.UserId
INNER JOIN Users AS u2 ON sd.User2Id = u2.UserId
LEFT JOIN SIPResponseMetaData rmd ON sd.ResponseCode = rmd.ResponseCode
WHERE DATEDIFF(DAY, SessionIdTime, GETDATE()) = 1
    AND rmd.Description <> 'Request Terminated'
    AND CorrelationId IS NULL
    AND DATEDIFF(SECOND, SessionIdTime, SessionEndTime) <> 0
ORDER BY SessionIdTime
CiaraNolan
  • 11
  • 3

0 Answers0