Hello,
I am developing an application to control asterisk using AMI
and AGI. The application place a call from an internal to a public
extension (tipically a mobile number) and play message used to deliver
notification from a Control Center. I am using AMI to place the call
using “originate” command and control the flow using async agi via ami.
The application seem to works but when the called user hangup the call, I
am not able to place a second call (to any extension number) for a
while. If a place the call, the called extension start ringing and
suddenly stops as someone refuse the call. If I hangup using ami/agi
command, everything works fine. Does someone have an idea on how to
investigate that issue ?
I thank you very much for your help.
Regards.
Marco Bisio
I would suggest providing a console log as well as more details about the environment. What technology are you using? SIP?
Thank you very much for your reply. Following I will post two console snapshots got using “core set verbose 10”. The first one has been taken during a succesfull call. This call has been ended using the hanghup button on the phone (the red button on the mobile device whose number I substitue with XXXXX in example below. After that I generate a second identical call that is unable to complete generating the behaviour of the subject of this post. Yes I am using SIP. Asterisk is connected to a SPA8800 Cisco Voice Gateway on which the PSTN line used to call the mobile XXXX is connected. The IP address of the Voice Gateway is 192.168.100.202. what I have to do is to completely control the call to the mobile device using ansi c. So I plan to use (maybe this is not the best choice but I am at the beginning…) AMI and Async Agi to control the call process. As long as a call is placed, the software starts to play a message to the user until a particular key in the mobile phone (dtmf) is stroken (and the corresponding dtmf is received on asterisk e deliveret to the application via AMI socket). The problem arise when the called mobile hangup using the red key closing the call from its side. What I do is to place a call using Originate AMI command issued by an internal phone (really existing) which extension number is SIP/201 that will autoanswer the placed call with originate to fully automate the process.
The command placed to AMI is:
sprintf(buffer, “ACTION:ORIGINATE\r\nCHANNEL:SIP/201\r\nCONTEXT:from-internal\r\nEXTEN:70%s\r\nASYNC:YES\r\nVariable: __SIPADDHEADER51=Call-Info: sip:192.168.100.231\;answer-after=0\r\nPRIORITY:1\r\nACTIONID:98765\r\n\r\n”,foniatelnum);
send(socktAMI, buffer, strlen(buffer),0);
Here you find extension_custom.conf:
[from-internal]
exten => _7.,1,Dial(SIP/${EXTEN:1}@pstnbo,60,rtM(callscript))
[macro-callscript]
exten => s,1,Wait(1)
same => n,Answer()
same => n,AGI(agi:async)
same => n,Wait(5);
Asterisk revision: 11.16.0
Thank you very much for your support.
Regards.
Marco Bisio
Console Log:
WORKING:
mbvoxCLI> core set verbose 10
Console verbose was OFF and is now 10.
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
[2016-06-06 23:09:07] WARNING[1868]: res_odbc.c:1412 _ast_odbc_request_obj2: SetConnectAttr (Txn isolation) returned an error: HY000: [MySQL][ODBC 5.1 Driver]MySQL server has gone away
[2016-06-06 23:09:07] WARNING[1868]: res_odbc.c:646 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 08S01: [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]MySQL server has gone away (65)
[2016-06-06 23:09:07] WARNING[1868]: res_odbc.c:658 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to asteriskcdrdb [MySQL-asteriskcdrdb]…
[2016-06-06 23:09:07] WARNING[1868]: res_odbc.c:762 ast_odbc_sanity_check: Connection is down attempting to reconnect…
[2016-06-06 23:09:07] NOTICE[1868]: res_odbc.c:1537 odbc_obj_connect: Connecting asteriskcdrdb
[2016-06-06 23:09:07] NOTICE[1868]: res_odbc.c:1569 odbc_obj_connect: res_odbc: Connected to asteriskcdrdb [MySQL-asteriskcdrdb]
> Channel SIP/201-00000004 was answered
– Executing [XXXXXXXXXX@from-internal:1] Dial(“SIP/201-00000004”, “SIP/XXXXXXXXX@pstnbo,60,rtM(callscript)”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/XXXXXXXXXX@pstnbo
> 0x7ffcac013780 – Probation passed - setting RTP source address to 192.168.100.20:16464
– SIP/pstnbo-00000005 answered SIP/201-00000004
– Executing [s@macro-callscript:1] Wait(“SIP/pstnbo-00000005”, “1”) in new stack
> 0x7ffcac02daa0 – Probation passed - setting RTP source address to 192.168.100.202:17453
– Executing [s@macro-callscript:2] Answer(“SIP/pstnbo-00000005”, “”) in new stack
– Executing [s@macro-callscript:3] AGI(“SIP/pstnbo-00000005”, “agi:async”) in new stack
– <SIP/pstnbo-00000005> Playing ‘richiesta.slin’ (escape_digits=0) (sample_offset 0) (language ‘en’)
– <SIP/pstnbo-00000005> Playing ‘richiesta.slin’ (escape_digits=0) (sample_offset 0) (language ‘en’)
– <SIP/pstnbo-00000005> Playing ‘richiesta.slin’ (escape_digits=0) (sample_offset 0) (language ‘en’)
– <SIP/pstnbo-00000005> Playing ‘richiesta.slin’ (escape_digits=0) (sample_offset 0) (language ‘en’)
== Spawn extension (macro-callscript, s, 3) exited non-zero on ‘SIP/pstnbo-00000005’ in macro ‘callscript’
== Spawn extension (from-internal, XXXXXXXXXX, 1) exited non-zero on ‘SIP/201-00000004’
– Executing [h@from-internal:1] Hangup(“SIP/201-00000004”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/201-00000004’
mbvoxCLI> core set verbose off
NOT WORKING
mbvoxCLI> core set verbose 10
Console verbose was OFF and is now 10.
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
> Channel SIP/201-00000006 was answered
– Executing [XXXXXXXXXX@from-internal:1] Dial(“SIP/201-00000006”, “SIP/XXXXXXXXX@pstnbo,60,rtM(callscript)”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called SIP/XXXXXXXXXX@pstnbo
> 0x7ffcac0139b0 – Probation passed - setting RTP source address to 192.168.100.20:16466
– SIP/pstnbo-00000007 answered SIP/201-00000006
– Executing [s@macro-callscript:1] Wait(“SIP/pstnbo-00000007”, “1”) in new stack
> 0x7ffcac02def0 – Probation passed - setting RTP source address to 192.168.100.202:17455
– Executing [s@macro-callscript:2] Answer(“SIP/pstnbo-00000007”, “”) in new stack
– Executing [s@macro-callscript:3] AGI(“SIP/pstnbo-00000007”, “agi:async”) in new stack
– <SIP/pstnbo-00000007> Playing ‘richiesta.slin’ (escape_digits=0) (sample_offset 0) (language ‘en’)
– <SIP/pstnbo-00000007> Playing ‘richiesta.slin’ (escape_digits=0) (sample_offset 0) (language ‘en’)
== Spawn extension (macro-callscript, s, 3) exited non-zero on ‘SIP/pstnbo-00000007’ in macro ‘callscript’
== Spawn extension (from-internal, XXXXXXXXXX, 1) exited non-zero on ‘SIP/201-00000006’
– Executing [h@from-internal:1] Hangup(“SIP/201-00000006”, “”) in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/201-00000006’
mbvoxCLI> core set verbose off