Run an AGI Script (or something else) when agent joins/leaves a queue?


(Drew Hamilton) #1

I’d like to notify Microsoft Teams when an agent logs in or our of a queue. I can’t find any way to do this. My idea right now is to create a custom extension and have agents dial that to join/leave the queue, but I want to make sure that I’m not overlooking a more simple solution first.

Thanks!


#2

Look for exten => *45 and exten => *_45 in /etc/asterisk/extensions_additional.conf and note the variables being set depending on how the context [app-queue-toggle] (in the same file) is called, You will see

[app-queue-toggle]
include => app-queue-toggle-custom
exten => s,1(start),Answer
exten => s,n,Wait(1)
.
.
.

write your app-queue-toggle-context to query the asteriskdb to see ‘what is’ and ‘what will be’ then do your AGI stuff.


(Dave Burgess) #3

Be sure to put this code in your extensions_override.conf file, or it will either be ignored (if in extensions_custom) or overwritten (if in extensions.conf or extensions_additional.conf).

Hooking for fun and income might also be a good resource for you to help you understand how to modify the dial plan.


(Lorne Gaetz) #4

If you’re only using feature codes to login/out of queues, then the above will work fine. Otherwise, you’ll need to monitor the AMI for activity to trigger the API calls. This thread has some basics: Fun with AMI (node-red)


#5

my typo, my concept was to use the app-queue-toggle-context-custom , that way everything is fully FreePBX compliant. , if you ‘override’, all the db stuff is done for you (which is a good start , albeit possibly repetitive, for your custom code)


(Drew Hamilton) #6

Thank you all for your suggestions! I started off playing with app-queue-toggle-context-custom, but as far as I could tell it was completely ignored. I then played with making my own feature code in extensions_custom that duplicated the auto-generated ones, but with a different feature code.

But actually, as I thought about it, there are some other events that I will also want notifications on Microsoft Teams, so I ended up working with the AMI monitoring. I used lgaetz’s code as a base, then switched to the following library to handle parsing out the AMI events: https://github.com/marcelog/PAMI

It’s still pretty rough, but it looks like I’m on the right track.

Thanks!


#7

Let us know as you progress please.


(Communication Technologies) #8

Seconded, this is an interesting use case. I could see lots of uses here.


(system) closed #9

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.