Real-time user data
CREATE VIEW vwrealtimeuser AS (
SELECT rd.name AS user_name,
rd.id AS user_id,
rd.divisionid,
rd.groupname,
rd.managername,
rd.managerid,
CASE
WHEN (rd.systempresence = 'ON_QUEUE'::text) THEN (rd.routingstatus)::text
ELSE upper(replace(rd.orgpresence, 'On Queue'::text, 'ON_QUEUE'::text))
END AS agentstatus,
CASE
WHEN (rd.systempresence = 'ON_QUEUE'::text) THEN rd.routstattime
ELSE rd.presencetime
END AS agenttime,
CASE
WHEN (rd.systempresence = 'ON_QUEUE'::text) THEN ((rd.routstattime)::double precision * '00:00:01'::interval)
ELSE ((rd.presencetime)::double precision * '00:00:01'::interval)
END AS agenttime_formatted,
((
CASE
WHEN (rd.systempresence = 'ON_QUEUE'::text) THEN rd.routstattime
ELSE rd.presencetime
END)::numeric / 86400.00) AS agenttimeday,
rd.systempresence,
rd.orgpresence,
rd.routingstatus,
rd.routstarttime,
rd.routstattime,
rd.routstattimeday,
rd.presenceid,
rd.presstarttime,
rd.presencetime,
rd.presencetimeday,
rd.queuename,
rd.conversationid,
rd.media,
rd.direction,
rd.adherencestate,
rd.adherencestarttime,
rd.impact,
rd.scheduledactivitycategory
FROM ( SELECT rl.id,
rl.name,
ud.managerid,
ud.managername,
ud.divisionid,
upper(replace((rl.systempresence)::text, 'On Queue'::text, 'ON_QUEUE'::text)) AS systempresence,
upper(replace((pr.orgpresence)::text, 'On Queue'::text, 'ON_QUEUE'::text)) AS orgpresence,
CASE
WHEN (((rl.routingstatus)::text = 'IDLE'::text) AND (((((rl.cccallactive + rl.othcallactive) + rl.cbcallactive) + rl.cbothcallactive) + rl.ccemailactive) > 0)) THEN 'ALERT'::character varying
ELSE rl.routingstatus
END AS routingstatus,
rl.routstarttime,
datediff('second'::character varying, rl.routstarttime, now_utc()) AS routstattime,
((datediff('second'::character varying, rl.routstarttime, now_utc()))::numeric / 86400.00) AS routstattimeday,
rl.presenceid,
rl.presstarttime,
datediff('second'::character varying, rl.presstarttime, now_utc()) AS presencetime,
((datediff('second'::character varying, rl.presstarttime, now_utc()))::numeric / 86400.00) AS presencetimeday,
qd.name AS queuename,
qd.id AS queueid,
uc.conversationid,
uc.media,
uc.direction,
uc.conversationstate,
gd.name AS groupname,
rl.adherencestate,
rl.adherencestarttime,
rl.impact,
rl.scheduledactivitycategory
FROM ((((((userrealtimedata rl
LEFT JOIN presencedetails pr ON (((pr.id)::text = (rl.presenceid)::text)))
LEFT JOIN userrealtimeconvdata uc ON (((uc.userid)::text = (rl.id)::text)))
LEFT JOIN queuedetails qd ON (((qd.id)::text = (uc.queueid)::text)))
LEFT JOIN vwuserdetail ud ON (((ud.id)::text = (rl.id)::text)))
LEFT JOIN usergroupmappings ug ON (((ug.userid)::text = (rl.id)::text)))
LEFT JOIN groupdetails gd ON (((gd.id)::text = (ug.groupid)::text)))) rd
)
Name | Type | Default | Nullable | Children | Parents | Comment |
---|---|---|---|---|---|---|
user_name | varchar(255) | true | Name of the user | |||
user_id | varchar(50) | true | GUID of the user | |||
divisionid | varchar(50) | true | GUID of the division | |||
groupname | varchar(255) | true | Name of the user group | |||
managername | varchar(200) | true | Name of the user manager | |||
managerid | varchar(50) | true | ID of the user manager | |||
agentstatus | text | true | Status of the user (agent) | |||
agenttime | integer | true | Time of the user status | |||
agenttime_formatted | interval | true | Formatted time of the user status | |||
agenttimeday | numeric | true | Duration of the user status in days | |||
systempresence | text | true | System presence status of the user | |||
orgpresence | text | true | Original presence status of the user | |||
routingstatus | varchar | true | Routing status of the user | |||
routstarttime | timestamp without time zone | true | Start time of the user routing status | |||
routstattime | integer | true | Time of the user routing status | |||
routstattimeday | numeric | true | Duration of the user routing status in days | |||
presenceid | varchar(50) | true | Presence GUID | |||
presstarttime | timestamp without time zone | true | Start time of the user presence | |||
presencetime | integer | true | Time of the user presence | |||
presencetimeday | numeric | true | Duration of the user presence in days | |||
queuename | varchar(255) | true | Name of the associated queue | |||
conversationid | varchar(50) | true | ID of the associated conversation | |||
media | varchar(50) | true | Type of media | |||
direction | varchar(50) | true | Direction of the conversation | |||
adherencestate | varchar(50) | true | Adherence state of the user | |||
adherencestarttime | timestamp without time zone | true | Start time of adherence | |||
impact | varchar(50) | true | Impact of the user on the conversation | |||
scheduledactivitycategory | varchar(50) | true | Category of scheduled activity |
Name | Columns | Comment | Type |
---|---|---|---|
public.userrealtimedata | 34 | BASE TABLE | |
public.presencedetails | 7 | Persence Code Lookup Data | BASE TABLE |
public.userrealtimeconvdata | 32 | User Real Time Conversation Data | BASE TABLE |
public.queuedetails | 17 | Queue Lookup data | BASE TABLE |
public.vwuserdetail | 17 | See UserDetail: User Description in detail | VIEW |
public.usergroupmappings | 5 | BASE TABLE | |
public.groupdetails | 8 | Agent Group Lookup Data | BASE TABLE |