How Can we execute a Agi script after hangup - asterisk

How Can we execute a Agi script after hangup ,Actually i am using queue with local channel, I m trying with "h,1,AGI()".but it is executing two times after hangup but i want to execute it one time after hangup of both channels

Correct way - NEVER execute scripts after hangups. Use mysql or other db cdrs, put all info you need into cdrs using custom fields
exten => s,n,Set(CDR(my_db_custom_field)=something)
After call end check cdrs and execute needed action by EXTERNAL threads.
Asterisk h extensions designed for fast non-blocking actions only.
It will be executed only once. If you have twice, very likly you have more then 1 channel (Local/ channels) in your dialplan.
You have add h-extension only into ONE place(in case of queue only in agent call or better use queue_log action for queue)

Related

IVR call simulation on Asterisk 15 server

I am using Asterisk 15 server and wanted to configure IVR call simulation. My configuration scenario is
1. A subscriber will register to Asterisk server and start a call.
2. The IVR audio will come from the Asterisk sever to sbscriber.
3. Once the subscriber pressed the botton, the call will connect to a number based on DTMF digit pressed by subscriber. Then call will continue for 30 seconds.
I observered for normal call pjsip.conf file is used for configuration of a subscribers.
Could you please help me on below queries ?
1. Which file we need to configure for the IVR call simulation ?
2. Please suggest a good documentation for IVR simulation.
Files are extensions.conf and pjsip.conf/sip.conf
You have read book for beginner, for example "Asterisk the future of telephony".
After that write dialling core or reuse vicidial.org or other core and write dialplan in extensions.conf for you ivr.
What you tried to do usually called "press-1 outbound dialling campaign"

Asterisk - how to execute script on call received

How can I execute a script to open our CRM app on the specific client CALLERID in when the call is answered in asterisk (on the computer of the receiver of the call and not the server asterisk) ?
I can execute a script on the server, but can't do it on the client that reveives the call.
Thanks a lot.
You probably need asterisk events
https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+AMI+Events
Event can be AgentConnect if you use queues or Join/Bridge if you need it fire without queues.
You need write always-running daemon which will fire your scripts on event.

channel originate, how to do call from a local channel? (call intercom and send dtmf)

My goal is to :
run a background task activated by dynamic feature while in active call, that will execute dial to another EXT and send DTMF.
It means, when a user is active call with someone, when the user press 5555, the door will be opened.
In order to open the door today, I have to manually call EXT 6(the door) and send DTMF digits: 00*
All of this has to happen automatically when the user press 5555 without interfering the active call.
I tried before to do all of this with dial, but dial blocks the call or bridges with another extension and then I lose the original call.
I figured out that I need to do this with ASYNC, means I can not use dialplan, I need to use CLI, and then originate some how.
Asterisk will need to create a local session / local channel and establish/connect to the door extension, then send DTMF and hangup
All of this – in background.
this is somthing i managed to do so far:
features_applicationmap_custom.conf
openthedoor=> 5555,caller,macro,OpenIntercomCall
then in ->
extensions_custom.conf
[macro-OpenIntercomCall]
exten => s,1,System(asterisk -rx "channel originate SIP/6 extension#yoyo")
i do not understand how do i call to SIP/6 from asterisk(using a local or random channel), and then send DTMF on answer.
the door ext is SIP/6, and 00* is the dtmf to open it.
What i am trying to do is that when a user 5555 in a call, the door will be opened.
means i want asterisk to call the intercom and send dtmf
There are no any sence do exec asterisk from inside asterisk. You can do Originate command.
Originate(tech_data,type,arg1[,arg2[,arg3[,timeout]]])
For example you can do something like this
exten => s,1,Originate(SIP/6,app,SendDTMF,ww00*)
Should be enought for your need.

AGI on Queue Ringing an Agent in Asterisk?

We can trigger an AGI if an agent attends a call in Queue.Is it possible to trigger an AGI when an agent rings in a Queue?
You can do agi on
1) before call other party - using AGI command
2) answer call before bridge - using M in dial command
No, not posible start agi on ringing event, but posible catch ringing event using AMI event listener and do action based on that.

record calls in asterisk withing dial() application

I am trying to call 5 sip phones simultaneously and also i want to record call when it is connected to any of the sip phone.
my dialplan is :
exten => s,1,Dial(SIP/user1&SIP/user2&SIP/user3&SIP/user4&SIP/user5,55,options)
I m able to receive call but I tried many options and I am not able to record call .
I need to record call like callerid-reciverid-date.wav
You can use MixMonitor to record calls
exten=> s,1,Set(Date=${STRFTIME(,EST4EDT,%Y-%m-%d_%H%M%S)})
exten=> s,n,MixMonitor(${CALLERID(NUM)}-${EXTEN}_${Date}.WAV,W(1));
exten=> s,n,Dial(SIP/user1&SIP/user2&SIP/user3&SIP/user4&SIP/user5,55,options)
your recorded files usually are in /var/spool/asterisk/monitor

Resources