How to Link my AGI Script to queue

Hi every one,

I am using realtime database asterisk 18. Queue, Queue_members are stored in PostgresSQL, queue is working as expected and queue_members are receiving call from the queue correctly. I have an AGI script with PHP, I need to link my agi script to the queue to be executed once the call is offered to queue_member. I need to collect some caller, agent details in my custom database for reports.

I am not much familiar with asterisk advance features. Please guide me how and where i can link/set my script to be executed accordingly.

Thanks,
Neyamt

if set, run this gosub when connected to the queue member
; you can override this gosub by setting the gosub option on
; the queue application
;
;membergosub=gosub_context_name[,arg1[,…][,argN]]

thank you for replying.

this field is null in database: membergosub: NULL

how can I point my script, if you can provide a sample/example, will be appreciated.

thanks,

I’ve used such a feature in the configuration file or the dial plan, but I’m not sure how to implement it using a database, so you’ll need to figure it out yourself.

Asterisk doesn’t populate the database; you do (or third party software does). It is up to you to know how to populate the database the way you want.

okay, I will try to figure it our.

thanks, can you share your sample/example which you have used this feature in config/dialplan file.

this way i can get the idea quickly.

Again thank you for sharing you idea and experience.

Regards,
Neyamt

I have populated the database and all required fields are there in the able. I need to know the way how to link/point my AGI script with queue to be executed while the call is connected to queue_member.

Did you really mean at the point in time just before it is connected. You can’t have an AGI script running in parallel with a bridge.

Its not import to be just be before connecting, whenever queue try/attempt to identify the queue_member to connect call to it next.

You can only do something on the PBX thread (run dialplan, AGI, or stasis (for ARI)) at the point where the agent has answered, but not yet been connected to the caller. If you want to do anything when Queue starts to ring an agent, you would need to monitor events with AMI (other event listening APIs exist, but this is the one designed for this).

I think it would help if you said what you were trying to achieve at a very high level (goal), rather than how you are attempting to achieve it. But if you have to do the latter, I think an example timeline of the events in a call and which ones you want to know about, would be helpful. I’d suggest you had about the right level of detail is list somewhere between 12 and 24 steps.

I will try to use Dialplan while transferring the call to the queue. is it possible to debug the queue flow in console/logs using AGI script? I need to know more whats happening while a call enter in a queue, what happens to it while being in the queue and while its exiting the queue.

thanks for sharing your ideas.

Regards,
Neyamt

I’ve made some improvements. I am trying using dialplan with queue, but I noticed that the AGI script is only executed when the calls are answered by agents. If the agent is ringing or doesn’t answer the call, the AGI script won’t be executed. This means that I won’t be able to collect call reports if agents don’t answer the call. Can someone please guide me on how to overcome this?.

I need my agi script to be executed when queue identify the agent in queue while attempting to route the call to agent or during agent availability identification

You could also modify the source code, and there is logging (CDR, Queue, and CEL) which might tell you, after the fact.

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