Call Center Agent Name via ESL

Status
Not open for further replies.

jeetz

Member
Oct 15, 2019
84
2
8
41
Hi Gurus,

I have this call center 199, and I was wondering what value should I put here in ESL, so that Agent name pops up.

Currently here can I find the Agent name, currently I get Time, Name, Number and Status and Agent name.

1716818375811.png

But here, the Agent name doesnt show up on ESL, I can modify but what value to put, so that the Agent name pops up. Can somebody help?

webhook[http://xxxxxxx.com/genericPBX] sent. response = b'{"TelephonyEvent":"ANSWERED","CallerID":"075192xxxxx","Extension":"2045","OriginLine":"01924xxxxxx","RecordingRef":"https://xxxxx.com/recordings/locationhere/archive/2024/May/27/xx-xx-xx-xx.wav","TrunkNo":"01924xxxxxx","companyId":"1","typeTel":"genericPBX"}'


Jeet.
 

Attachments

  • 1716817923079.png
    1716817923079.png
    7.9 KB · Views: 10

jeetz

Member
Oct 15, 2019
84
2
8
41
Just to let you know, this the event I'm subscribed in.
# queue_data["member_uuid"] = get_header(e, "CC-Member-UUID")
# queue_data["member_session_uuid"] = get_header(e, "CC-Member-Session-UUID")

queue_data["callerId"] = get_header(e, "CC-Member-CID-Number")
queue_data["originLine"] = get_header(e, "CC-Member-DNIS")
queue_data["companyId"] = domain_name
queue_data["callCenter"] = queue_id


# if cc_action == "member-queue-start":
# # Joining the queue triggers this event,
# # allowing you to track when callers enter the queue.
# log(e.serialize())

if cc_action == "agent-offering":
# Every time a caller is presented to an agent (before he answers),
# this event is generated.
print(e.serialize())
queue_data["callState"] = "RINGING"

# json_outp(queue_data)
post_webhook(queue_data)

if cc_action == "bridge-agent-start":
print(e.serialize())
queue_data["callState"] = "ANSWERED"
queue_data["extension"] = get_header(e, "variable_sip_to_user")
queue_data["RecordingRef"] = get_header(e, "variable_uuid")
queue_data["Agent"] = get_header(e, "variable_sip_user_agent")
# queue_data["agent_call_uuid"] = get_header(e, "CC-Agent-UUID")
# json_outp(queue_data)
post_webhook(queue_data)
 

Mikeme

Member
Apr 26, 2021
176
4
18
39
It's seems like you are trying to notify some exteral server for call info.
Maybe try to use CURL with effective_caller_id_name
 

jeetz

Member
Oct 15, 2019
84
2
8
41
I'll tell in detail....

I've created the extension, and the number of stations that number is created in extension.

1716993039674.png

Now on call center bit. I've created over 100+ user, they can come and dial *61 and enter the id which is given below and login and logout.

1716993896038.png

I had the script made in python for intergrading with ESL which runs fine
webhook[http://xxxxxxx.com/genericPBX] sent. response = b'{"TelephonyEvent":"ANSWERED","CallerID":"075192xxxxx","Extension":"2045","OriginLine":"01924xxxxxx","RecordingRef":"https://xxxxx.com/recordings/locationhere/archive/2024/May/27/xx-xx-xx-xx.wav","TrunkNo":"01924xxxxxx","companyId":"1","typeTel":"genericPBX"}'

Every thing is so far so good.


But now I want is that name to appear on above. Like this.
webhook[http://xxxxxxx.com/genericPBX] sent. response = b'{"TelephonyEvent":"ANSWERED","CallerID":"075192xxxxx","Extension":"2045","Agent":"Daniel","OriginLine":"01924xxxxxx","RecordingRef":"https://xxxxx.com/recordings/locationhere/archive/2024/May/27/xx-xx-xx-xx.wav","TrunkNo":"01924xxxxxx","companyId":"1","typeTel":"genericPBX"}'

How may I achieve this?

Jeet
 
Jan 9, 2018
152
15
18
54
I have not done much programming in this area, but I would examine a CDR record and see if it contains the name you are looking for, and then use the corresponding variable in your script. I went back and looked at one of ours and it had "directory_full_name" associated with the name. So this would probably equate to something like:
Code:
queue_data["agent_name"] = get_header(e, "variable_directory_full_name")

Or, in your script, if you can dump the full contents of the "header" you are accessing to a log file, and just check that for the field you are looking for.

If it doesn't appear, you may need to use the dialplan to put that name into a channel variable so that you can then access it in your hook.
 

jeetz

Member
Oct 15, 2019
84
2
8
41
I have not done much programming in this area, but I would examine a CDR record and see if it contains the name you are looking for, and then use the corresponding variable in your script. I went back and looked at one of ours and it had "directory_full_name" associated with the name. So this would probably equate to something like:
Code:
queue_data["agent_name"] = get_header(e, "variable_directory_full_name")

Or, in your script, if you can dump the full contents of the "header" you are accessing to a log file, and just check that for the field you are looking for.

If it doesn't appear, you may need to use the dialplan to put that name into a channel variable so that you can then access it in your hook.
PM you the complete script. Tomorrow morning I'll give it a shot.
 

jeetz

Member
Oct 15, 2019
84
2
8
41
PM you the complete script. Tomorrow morning I'll give it a shot.


Right I've noticed 2 things.

1. queue_data["agent_name"] = get_header(e, "variable_directory_full_name") variable directory gives not nothing.
2. The Agent name is coming but it is in a form unreadable see below.
CC-Agent-UUID: afb5cebd-2fbf-4079-8f03-80960edc1792

How to convert above then so it can be read as a proper name.

variable_cc_export_vars: call_center_queue_uuid,did_origin
variable_did_origin: 01924xxxxxx
variable_origination_caller_id_name: Nxxxxxxxxxxxxxxxx
variable_origination_caller_id_number: xxxxxxxxxxxxxxxx
variable_originate_early_media: false
CC-Queue: c3ecc044-e169-4926-adc4-16ba9c9183ab
CC-Action: bridge-agent-start
CC-Agent: cb539ea9-c726-4fab-b747-12326636afc3
CC-Agent-System: single_box
CC-Agent-UUID: afb5cebd-2fbf-4079-8f03-80960edc1792
CC-Agent-Called-Time: 1717067400
CC-Agent-Answered-Time: 1717067408
CC-Member-Joined-Time: 1717067400
CC-Member-UUID: 8e286653-da78-474c-af32-5272548b903f
CC-Member-Session-UUID: 3617e96f-f5af-43f4-bea1-21f71914a12d
CC-Member-CID-Name: 0xxxxxxxxxxxxxxxx
CC-Member-CID-Number: 0xxxxxxxxxxxxxxxx
CC-Member-DNIS: 0xxxxxxxxxxxxxxxx
 

jeetz

Member
Oct 15, 2019
84
2
8
41
This what i am getting upon your selection. @Jonathan Black AgentName is blank.


2024-05-30 13:41:53 INFO webhook sending....
2024-05-30 13:41:53 INFO {"callerId": "02xxxxxxxxxx", "originLine": "012xxxxxxxxxx", "companyId": "75-xxxxxxxxxx", "callCenter": "600", "callState": "RINGING"}

2024-05-30 13:42:01 INFO webhook sending....
2024-05-30 13:42:01 INFO {"callerId": "02xxxxxxxxxx", "originLine": "012xxxxxxxxxx", "companyId": "75", "callCenter": "600", "callState": "ANSWERED", "extension": "2001", "RecordingRef": "f9b3cb47-7358-4dd6-9bab-1c025f01eb20", "AgentName": "", "agent_uuid": "c22a8381-482f-42c2-ba5d-c5fc2cff5c8f", "agent_call_uuid": "b6d8a643-4cff-4db1-8f48-4a9d049a568f"}






if cc_action == "bridge-agent-start":
# log(e.serialize())
queue_data["callState"] = "ANSWERED"
queue_data["extension"] = get_header(e, "variable_sip_to_user")
queue_data["RecordingRef"] = get_header(e, "CC-Member-Session-UUID")
queue_data["companyId"] = get_header(e, "variable_domain_name")
queue_data["AgentName"] = get_header(e, "variable_directory_full_name")
queue_data["agent_uuid"] = get_header(e, "CC-Agent")
queue_data["agent_call_uuid"] = get_header(e, "CC-Agent-UUID")
 
Jan 9, 2018
152
15
18
54
When you run the "serialize" command to the log, do you see the agent name in any variable? If so, use that instead of "directory_full_name" or "variable_directory_full_name".

If not, the CC_Agent_UUID is not the actual agent name. It's just a the lookup key to find that agent's info. In this case, you would need to use the "CC-Agent-UUID" to lookup the agent_name in the v_call_center_agents table. If you need to go this route, I would have to defer to someone else to explain how to do that in Python. There are plenty of examples in the FusionPBX code to show you how to do it in Lua, but I wouldn't have a clue how to do so in Python.
It will include something like this query from Postgresql:
SQL:
select agent_name from v_call_center_agents where call_center_agent_uuid = :cc_agent_uuid;
 
  • Like
Reactions: jeetz

jeetz

Member
Oct 15, 2019
84
2
8
41
When you run the "serialize" command to the log, do you see the agent name in any variable? If so, use that instead of "directory_full_name" or "variable_directory_full_name".

If not, the CC_Agent_UUID is not the actual agent name. It's just a the lookup key to find that agent's info. In this case, you would need to use the "CC-Agent-UUID" to lookup the agent_name in the v_call_center_agents table. If you need to go this route, I would have to defer to someone else to explain how to do that in Python. There are plenty of examples in the FusionPBX code to show you how to do it in Lua, but I wouldn't have a clue how to do so in Python.
It will include something like this query from Postgresql:
SQL:
select agent_name from v_call_center_agents where call_center_agent_uuid = :cc_agent_uuid;
Serialize PM you....nothing there too. Right so would this query go into python right?
 
Jan 9, 2018
152
15
18
54
Yeah, if you search that log (from "serialize") and do not see the agent name you expect, then it likely isn't being included in the event info. So then you have two options:
1. It MAY be possible to use a dialplan setting to insert the agent name as a custom channel variable that WOULD be included in the event. Basically, you add a "set" action and data would be agent_name = <agent's name> in the dialplan. However, that's a long shot: You have to figure out whether any dialplan is being executed AFTER the call is answered (probably not) and then find out if custom channel variables would be included in an event. I don't know the answer to either.
2. You already KNOW that you are getting the UUID of the CC Agent, so doing the query to the SQL table is more of a sure thing, even though it's going to require some coding. As I said, I can't tell you how to do it in Python. But I can point you to examples in Lua:

Or one I've worked on in the past:

Basically, look for any .lua files in FusionPBX and search it for "select" statements to get an idea how to do this. Note that there are references at the top to initialize the database library.
 
  • Like
Reactions: jeetz
Status
Not open for further replies.