Summary:ASTERISK-16205: Peer does not hang up when caller hangup while app_dial is executing - Deadagi
Reporter:mn3250 (mn3250)Labels:
Date Opened:2010-06-03 17:04:53Date Closed:2011-06-07 14:00:22
Versions:Frequency of
Description:Looks like * does not hang up the dialed outgoing call even when an agi hang up is issued.
Comments:By: Paul Belanger (pabelanger) 2010-06-03 18:10:28

Thank you for taking the time to report this bug and helping to make Asterisk better.

Unfortunately, we cannot work on this bug because your description did not include enough information.

You may find it helpful to read the Asterisk Issue Guidelines http://www.asterisk.org/developers/bug-guidelines.

We would be grateful if you would then provide a more complete description of the problem.

At a minimum, we need:
1. the specific steps or actions you took that caused you to encounter the problem,
2. the behavior you expected, and
3. the behavior you actually encountered (in as much detail as possible).

This likely includes output from the console with debug level logging, a SIP trace (if this is SIP related), and configuration information such as dialplan (e.g. extensions.conf) and channel configuration (e.g. sip.conf).


By: mn3250 (mn3250) 2010-06-04 01:18:05

Here comes some more details:

I am trying to execute a dead agi application:

exten => 1111,1,DeadAgi,calling.pl
exten => 1111,n,Hangup()

in calling.pl I have:
$result=$AGI->exec("Background", "connecting");
$dialstr = $type."/$callednumber@".$providerip."|90|rHL(" . ($calltime * 60 * 1000) . ")";
$result=$AGI->exec("DIAL $dialstr");

everything works fine if the caller does not hangup and the progress tone is played to the caller but if the caller disconnect the call while connecting.gsm is played, the peer does not disconnect even after the originating channel is hung up.
Should * not disconnect the briged channel when originating channel dissconnects?
Asterisk reports the caller disconnect and DIALSTATUS is CANCEL but the bridged call stays in progress and connects unless a restart is issued. If this is normal (I do not think so), is there a workaround to disconnect the bridged leg after caller hangs up in my agi script?

By: mn3250 (mn3250) 2010-06-04 20:19:52

The same happens in Asterisk 1.6.2.
Looks like if the caller hangs up while a message is played, Asterisk will countinue executing the dial command and there is no way to trap it in the AGI application. On top of this, the bridged channel does not disconnect if the caller hangs up.

By: sammo (lifeweaver) 2010-06-08 22:33:53

I also encountered the same problem, did not find a way.

By: Leif Madsen (lmadsen) 2010-06-09 10:55:52

If you just use AGI() in 1.6.2 do you have the same issue?

By: mn3250 (mn3250) 2010-06-09 11:02:30

Same problem using AGI in 1.6.2.

By: sammo (lifeweaver) 2010-06-15 12:00:14

I use the agi + pcntl_signal (PHP function) to solve.

By: Leif Madsen (lmadsen) 2010-06-15 12:00:59

lifeweaver: do you have an example usage?

By: fprior (fprior) 2010-06-18 14:59:16

I also encountered the same problem but I found this patch:

Summary: Hangup callee when caller hangs up during announcements in app_dial

Please, could someone tell me how apply the patch ? Is necessary rebuild all asterisk ?

By: sammo (lifeweaver) 2010-06-23 09:10:45

I'm so sorry, I just see the email.
Here is my code:
include_once ("lib/phpagi.php");
// Signal Processing
pcntl_signal(SIGHUP, 'sigHandler');
function sigHandler($r_signal)
  // Write the code

By: Leif Madsen (lmadsen) 2010-07-06 10:16:49


* download diff
* save file to system with Asterisk source
* copy your existing Asterisk source that you installed from to a new directory:  cp

* cd
* ./configure (may not be necessary)
* patch -p0 < /path/to/diff
* make install

It will recompile the portions of Asterisk it needs to recompile. Only run 'make install' if all the hunks succeed on the patching.

By: mn3250 (mn3250) 2010-07-27 12:53:21

Tried to use $SIG{HUP} to trap the error but there is no way to find the outgoing channel. Have not tried the patch yet.

By: Paul Belanger (pabelanger) 2010-09-04 14:15:51

Suspended due to lack of activity. Please request a bug marshal in #asterisk-bugs on the IRC network irc.freenode.net to reopen the issue should you have the additional information requested.

Further information can be found at http://www.asterisk.org/developers/bug-guidelines