Summary:ASTERISK-13718: IAX2 doesn't issue HANGUP when using DIAL ring
Reporter:David O Reilly (trendboy)Labels:
Date Opened:2009-03-09 12:22:54Date Closed:2011-06-07 14:02:45
Versions:Frequency of
Description:This is a strange one.

I have recorded a video of this happening on:


Steps to repro:
1) Set up your extensions.ael with simple extensions like as follows inside some context:

       7001 =>  {

       7002 =>  {

       7003 =>  {

2) Call one of the extensions and hang up without answering it

3) The call will not end and the phone will continue to ring out.

** This also happens on Zoiper as well as real phones. It is as though there is no Hangup request being sent to the software or the phone in the IAX2 packet.

*** Please see the video of this happening (link above) ***

Now continue on by changing the ring flag in the dial command to be m for music on hold so you have:

       7001 =>  {

and so on

2) Again call an extension and hang up, the hangup packet works and the phone hangs up. Same correct behaviour on Zoiper softphone.

So could it have something to do with the m option??? I first thought it was the phones themselves and reported it to the makers of the phones, however when I saw it happening on Zoiper then I knew it has to be something to do with asterisk.


Repro video: http://video.google.com/videoplay?docid=-8122305684689236739

I had the same problem on version so upgraded thinking it might have been already spotted

It doesn't happen on SIP.

iax2.conf code snippet:


Comments:By: David O Reilly (trendboy) 2009-03-20 14:03:33

I have more information on this after investigation.

If you set up asterisk on a default install (compile everything with menuselect) then set up some basic extensions.

Do NOT use extensions.conf - ONLY USE extensions.ael.

Now set up something like this:

s => {


... do whatever and send to a queue

What you will find is that Asterisk will play the Ring sound but NEVER DO MUSIC ON HOLD when you send to a queue nor if you Dial and extension on IAX2. If you call a SIP extension it will not know when you hangup and keep the SIP call active.

Now if you comment out Ringing() and wait(2) it works perfect!!! SIP extension hangs up as expected and music on hold works perfect.

Very strange!!! :-)

could it be something to do with Ringing()?

ps-if you would like me to give you more info on anything and out the case pending me could you let me know how to update it?? do I just enter the update in here? as in a previous bug I couldn't work out how to reply and assign it back to you guys. Hehe sorry I know it must be a silly request.


By: David O Reilly (trendboy) 2009-03-20 15:43:45

Ok even worse.....

A call comes in through one IAX2 channel and is then routed out through another IAX2 channel. Everything works...


When the caller who started the call hangs up - the connection never removes from the IAX2 list so:

iax2 show netstats

shows the connections forever!!!!! Even though they are long gone.

What is even more strange is that the second channel that the call went out on again is actually aware that the call has ended as the VOIP phone company who provide the channel actually stop charging me at that point. Yet asterisk on my box thinks the call is very much alive and shows:

diva*CLI> iax2 show netstats
                               -------- LOCAL ---------------------  -------- REMOTE --------------------
Channel                    RTT  Jit  Del  Lost   %  Drop  OOO  Kpkts  Jit  Del  Lost   %  Drop  OOO  Kpkts
IAX2/out-10789    1000   -1    0    -1  -1     0   -1      0    0    0     0   0     0    0      0
IAX2/out-12247    1000   -1    0    -1  -1     0   -1      0    0    0     0   0     0    0      0
2 active IAX channels

yet those calls are dead!!!!

Any ideas??

By: David O Reilly (trendboy) 2009-03-20 16:33:24

I think I may have found a work around that works for now but isn't great.

My Dial plan has Answer(); first then Dial(iax/etc.. dial command); and then Hangup();

If I remove the Answer() then when the call hangs up it actually hangs up and the iax2 show netstats shows no calls as it should do.

Should this be happening? surely this would be incorrect?? I was hoping to play a file when callers called, and I can still do this. But it doesn't seem logical to me to just start off playing a file without using the Answer() method first? but that works.


By: David Vossel (dvossel) 2009-03-23 10:59:14

"My Dial plan has Answer(); first then Dial(iax/etc.. dial command); and then Hangup();

If I remove the Answer() then when the call hangs up it actually hangs up and the iax2 show netstats shows no calls as it should do."

I'm confused.  In your last post you said taking out the Answer() fixed the problem, but your initial report said to use the following extension which has no Answer() could reproduce it.
7002 => {

I haven't been able to reproduce the issue, Can you update to the latest 1.6.0 branch code and verify the problem still exists?

By: David O Reilly (trendboy) 2009-03-25 10:32:28

Hi Dvossel, thanks for getting back to me.

Sorry for the confusion - the latest upgrade seems to have fixed it, but the answer(); part of it still exists :( so when you use it with Ringing() that is when the problem starts. Perhaps I should log a new case for that?


By: David Vossel (dvossel) 2009-03-25 11:05:20

I'm going to go ahead and close the issue since your original report is fixed.  Go ahead and create a new bug report for whatever else you're having trouble with.  It makes it easier for us to keep track of things.