[solved] Slow hangup on PBX -> IAX -> PBX trunk


This is a little curly.

The Scenereo:
I have two asterisk boxes.
One is on a public IP, in a data centre, which is used for external handsets. PBX-1
The second is in the office behind a SIP ignorant NAT router. PBX-2
The two systems work flawlessly on their own.

I have connected them together with an IAX2 trunk whereby PBX-2 registers to PBX-1

This allows us to call from a SIP extension on one PBX to a SIP extension on the other and the call quality is fine. Caller ID works. Life is sweet…except for one annoyance they want me to fix. :confused:

The Challenge:
If I call from extension 101 or PBX-1 to 202 on PBX-2 and hand up before they answer, extension 202 continues to ring.
And vice versa. :neutral_face: Furthermore, the call on the handset stays active for 1-3 secs after the other party hangs up. Not a deal breaker, but a deal spoiler.

This doesnt seem to happen with a SIP trunk, however there are complications in using SIP especially in relation to multiple registrations behind NAT from a single IP to an Asterisk box. Specifically, regardless of the context=wherever that is in your SIP peer, you always end up with inbound calls starting in the context of the last SIP peer you registered from that IP.

I am running an older version, 1.4.22, becuase at the time it seemed to work the best with the SIP providers we have. It has nothing to do with system load as it does this when this is the only call.

Can anyone shed any light on this one :open_mouth:

I would like it to work with IAX, however if I am forced back to using SIP, I’ll have to do some major rework of our dial plans as we have multiple contexts for multiple departments / tenants.

Much appreciated.

Anyone ???


You need to post some verbose and debug cli output so we can see whats happening

Do you have qualify=yes?
Use tcpdump on both servers to campture the BYE packet and see when it gets to the other PBX

Cheers for the suggestions.

I’m only running verbose output. Nothing other than the fact that the service keeps ringing.

I’ll set up a test system and jam wireshark or something onto it to see what is going on and post the results.

Bogged down a little at the moment with some other work, so give me some time.


Still plugging away, however, I have managed to create a SIP registration workaround, so the job isnt as urgent as it was last week.

Also got a strange message when I just tested it then.

Here is some CLI. The IPs have been changed to protect the systems

    -- Accepting AUTHENTICATED call from
       > requested format = alaw,
       > requested prefs = (alaw|ulaw|g726|g729|gsm),
       > actual format = alaw,
       > host prefs = (alaw|ulaw|g726|g729|gsm),
       > priority = mine
    -- Executing [204@t02-extn-remote:1] NoOp("IAX2/t02-iaxtrunk-1957", "") in new stack
    -- Executing [204@t02-extn-remote:2] NoOp("IAX2/t02-iaxtrunk-1957", "Kylie 202") in new stack
    -- Executing [204@t02-extn-remote:3] GotoIf("IAX2/t02-iaxtrunk-1957", "0?noname") in new stack
    -- Executing [204@t02-extn-remote:4] Set("IAX2/t02-iaxtrunk-1957", "CALLERID(name)="Kylie 202"") in new stack
    -- Executing [204@t02-extn-remote:5] Set("IAX2/t02-iaxtrunk-1957", "CALLERID(num)="202"") in new stack
    -- Executing [204@t02-extn-remote:6] Macro("IAX2/t02-iaxtrunk-1957", "callextn|204") in new stack

***My extension macro is here, does a lot of crap which is irrelevant for here (voicemail, twinning, agents, etc)

    -- Executing [s@macro-callextn:43] Dial("IAX2/t02-iaxtrunk-1957", "SIP/HTI-extn204&Local/fm@macro-callextn|60|tTr") 

*** More off the local which hangs up as unavailable

    -- Called HTI-extn204
 Extension Changed 204[t02-hints] new state Ringing for Notify User HTI-extn206
    -- SIP/HTI-extn204-08e68ab0 is ringing  <- I Hang up the call when I see this
    -- SIP/HTI-extn204-08e68ab0 is ringing 
    -- SIP/HTI-extn204-08e68ab0 is ringing
    -- SIP/HTI-extn204-08e68ab0 is ringing
    -- SIP/HTI-extn204-08e68ab0 is ringing
 Extension Changed 204[t02-hints] new state Idle for Notify User HTI-extn206
  == Spawn extension (macro-callextn, s, 43) exited non-zero on 'IAX2/t02-iaxtrunk-1957' in macro 'callextn'
  == Spawn extension (macro-callextn, s, 43) exited non-zero on 'IAX2/t02-iaxtrunk-1957'
    -- Hungup 'IAX2/t02-iaxtrunk-1957'
[Jul 21 00:21:06] WARNING[5703]: chan_sip.c:8919 get_destination: Huh?  Not a SIP header ()?

I’ll do some SIP Debug dumps and see what goes on. I would like it to work, however, I probably won’t get a chance to look at it again this week.

If someone else wants to set up a test and see if it replicates, that would be good. Let me know if it does the same for you, or it behaves its self.

The target box, i relaised, is a VMWare box running CentOS 5.4 with a vm kernel and clock=pit configured in the start up. I just fixed it up after a yum update screwed it. IAX is dependednt on DAHDI expecially for trunks…maybe something, who knows ?? ( Hopefully one of you)

Keep you all posted,


Solved !!!

Specifically this was to do with DAHDI timing and some hardware timing issues with the Kernel and VMWare :open_mouth: .

I trashed everything and moved the service over to another box and everything worked as it should have.

There was a copy of VMWare on the machine which I found when we recently decommissioned things. I thought that I had had the machine to myself !

Oh well