[Home]

Summary:ASTERISK-24526: Exec dial from AGI script does not hang up caller after called party hangs up
Reporter:Taylor Hawkes (antiochIst)Labels:
Date Opened:2014-11-14 15:03:33.000-0600Date Closed:2014-11-14 15:30:17.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:
Versions:12.7.0 13.0.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Linux/Ubuntu 13.04 (Raring Ringtail)Attachments:
Description:When executing a DIAL command from an AGI script the calling party will continue to the next extension after called party hangs up. This occurs when the "g" option in the dial command is not set.

Behavior works as expected if Dial is called in the (extensions.conf), seems to be something with AGI &  dial application.

This issue does not occur in Asterisk 11.7 and does occur in Asterisk 12.7.

From my AGI Script.
$agi->write("EXEC DIAL SIP/6001\n");

extensions.conf
[others]
exten => 12345,1,Answer
exten => 12345,2,AGI(/home/a_web/sip_load.php)
exten => 12345,3,SayDigits(12345))
exten => 12345,4,Hangup()


---------------------------------------------------------------------------
-- Executing [12345@others:1] Answer("SIP/168.244.49.149-00000004", "") in new stack
[Nov 14 20:57:03] WARNING[31242]: config.c:2829 find_engine: Realtime mapping for 'sippeers' found to engine 'mysql', but the engine is not available
[Nov 14 20:57:03] WARNING[31242]: config.c:2829 find_engine: Realtime mapping for 'sippeers' found to engine 'mysql', but the engine is not available
      > 0x7f3244053e50 -- Probation passed - setting RTP source address to 168.244.49.149:7078
   -- Executing [12345@others:2] AGI("SIP/168.244.49.149-00000004", "/home/ivr_test/sip_load.php") in new stack
   -- Launched AGI Script /home/ivr_test/sip_load.php
   -- AGI Script Executing Application: (DIAL) Options: (SIP/6001)
 == Using SIP RTP CoS mark 5
   -- Called SIP/6001
   -- SIP/6001-00000005 is ringing
      > 0x7f325801d9f0 -- Probation passed - setting RTP source address to 168.244.49.149:8000
   -- SIP/6001-00000005 answered SIP/168.244.49.149-00000004
   -- Channel SIP/168.244.49.149-00000004 joined 'simple_bridge' basic-bridge <a1f53451-3bf1-4fde-9b23-fa865cfdf2a7>
   -- Channel SIP/6001-00000005 joined 'simple_bridge' basic-bridge <a1f53451-3bf1-4fde-9b23-fa865cfdf2a7>
      > Bridge a1f53451-3bf1-4fde-9b23-fa865cfdf2a7: switching from simple_bridge technology to native_rtp
      > 0x7f325801d9f0 -- Probation passed - setting RTP source address to 168.244.49.149:8000
   -- Channel SIP/6001-00000005 left 'native_rtp' basic-bridge <a1f53451-3bf1-4fde-9b23-fa865cfdf2a7>
   -- Channel SIP/168.244.49.149-00000004 left 'native_rtp' basic-bridge <a1f53451-3bf1-4fde-9b23-fa865cfdf2a7>
[Nov 14 20:57:10] ERROR[31321][C-00000002]: utils.c:1363 ast_carefulwrite: write() returned error: Broken pipe
   -- <SIP/168.244.49.149-00000004>AGI Script /home/ivr_test/sip_load.php completed, returning 0
   -- Executing [12345@others:3] SayDigits("SIP/168.244.49.149-00000004", "12345)") in new stack
   -- <SIP/168.244.49.149-00000004> Playing 'digits/1.ulaw' (language 'en')
   -- <SIP/168.244.49.149-00000004> Playing 'digits/2.ulaw' (language 'en')
   -- <SIP/168.244.49.149-00000004> Playing 'digits/3.ulaw' (language 'en')
   -- <SIP/168.244.49.149-00000004> Playing 'digits/4.ulaw' (language 'en')
   -- <SIP/168.244.49.149-00000004> Playing 'digits/5.ulaw' (language 'en')
   -- Executing [12345@others:4] Hangup("SIP/168.244.49.149-00000004", "") in new stack
 == Spawn extension (others, 12345, 4) exited non-zero on 'SIP/168.244.49.149-00000004'
   -- Executing [h@others:1] Answer("SIP/168.244.49.149-00000004", "") in new stack


Comments:By: Taylor Hawkes (antiochIst) 2014-11-14 15:29:43.587-0600

Sorry, looks like this is expected behavior: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_AGI

Executes an Asterisk Gateway Interface compliant program on a channel. AGI allows Asterisk to launch external programs written in any language to control a telephony channel, play audio, read DTMF digits, etc. by communicating with the AGI protocol on stdin and stdout. As of 1.6.0, this channel will not stop dialplan execution on hangup inside of this application. Dialplan execution will continue normally, even upon hangup until the AGI application signals a desire to stop (either by exiting or, in the case of a net script, by closing the connection). A locally executed AGI script will receive SIGHUP on hangup from the channel except when using DeadAGI. A fast AGI server will correspondingly receive a HANGUP inline with the command dialog. Both of theses signals may be disabled by setting the AGISIGHUP channel variable to no before executing the AGI application. Alternatively, if you would like the AGI application to exit immediately after a channel hangup is detected, set the AGIEXITONHANGUP variable to yes.