Real-time queue data
CREATE VIEW vwrealtimequeue AS (
SELECT qd.id AS queueid,
qd.name AS queuename,
qd.divisionid,
qd.divisionname,
qr.media,
COALESCE(qr.conversationstate, ''::character varying) AS conversationstate,
sum(
CASE
WHEN ((qr.actingas)::text = 'acd'::text) THEN 1
ELSE 0
END) AS acd_count,
sum(
CASE
WHEN ((qr.actingas)::text = 'agent'::text) THEN 1
ELSE 0
END) AS interacting,
COALESCE(min(
CASE
WHEN ((qr.actingas)::text = 'acd'::text) THEN qr.startdate
ELSE NULL::timestamp without time zone
END)) AS startdate,
COALESCE(min(
CASE
WHEN ((qr.actingas)::text = 'acd'::text) THEN qr.startdateltc
ELSE NULL::timestamp without time zone
END)) AS startdateltc,
datediff('second'::character varying, min(
CASE
WHEN ((qr.actingas)::text = 'acd'::text) THEN qr.startdate
ELSE NULL::timestamp without time zone
END), timezone('utc'::text, now())) AS statussecs,
((datediff('second'::character varying, min(
CASE
WHEN ((qr.actingas)::text = 'acd'::text) THEN qr.startdate
ELSE NULL::timestamp without time zone
END), timezone('utc'::text, now())))::numeric / 86400.00) AS statusdays,
max(qr.updated) AS updated
FROM (vwqueuedetails qd
LEFT JOIN queuerealtimeconvdata qr ON (((qr.queueid)::text = (qd.id)::text)))
GROUP BY qd.id, qd.name, qd.divisionid, qd.divisionname, qr.media, qr.conversationstate
ORDER BY qd.name
)
Name | Type | Default | Nullable | Children | Parents | Comment |
---|---|---|---|---|---|---|
queueid | varchar(50) | true | Queue GUID | |||
queuename | varchar(255) | true | Queue name | |||
divisionid | varchar(50) | true | Division ID | |||
divisionname | varchar(50) | true | Division name | |||
media | varchar(50) | true | Type of media (voice, chat, email, etc.) | |||
conversationstate | varchar | true | ||||
acd_count | bigint | true | Count of interactions with actingas = acd | |||
interacting | bigint | true | Total count of interactions currently being handled by agents | |||
startdate | timestamp without time zone | true | Start date of the interaction filtered to acd | |||
startdateltc | timestamp without time zone | true | Logical timestamp counter for start date filtered to acd | |||
statussecs | integer | true | Status duration in seconds calculated with DATEDIFF | |||
statusdays | numeric | true | Status duration in days calculated with DATEDIFF | |||
updated | timestamp without time zone | true | Timestamp of the last update |
Name | Columns | Comment | Type |
---|---|---|---|
public.vwqueuedetails | 24 | See QueueDetails: Queue Lookup data | VIEW |
public.queuerealtimeconvdata | 32 | BASE TABLE |