Asterisk not hanging up after the callee hangs up


I am having trouble with this extension:

exten => *200,1,Answer()
    same => n,Playtones(${tones})
    same => n,Wait(0.3)
    same => n,Dial(SIP/siptrunk/5551231234)
    same => n,Hangup()

When 555-123-1234 hangs up, the softphone that dialler the *200 extension stays on the line as if Asterisk didn’t hang up. There is nothing on the line, just silence. I tried with and without the Hangup() line, I tried adding StopPlayTones() after the Wait() command to no avail.


  == Using SIP RTP CoS mark 5
    -- Executing [*200@LocalSets:1] Answer("SIP/user1-00000045", "") in new stack
    -- Executing [*200@LocalSets:2] PlayTones("SIP/user1-00000045", "!941+1209/50,!697+1336/50,!770+1477/50,!697+1209/50,!852+1477/50,!770+1209/50") in new stack
    -- Executing [*200@LocalSets:3] Wait("SIP/user1-00000045", "0.3") in new stack
    -- Executing [*200@LocalSets:4] Dial("SIP/user1-00000045", "SIP/siptrunk/5551231234") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/siptrunk/51551231234
    -- SIP/voipms-00000046 is making progress passing it to SIP/user1-00000045
    -- SIP/voipms-00000046 answered SIP/user1-00000045
    -- Remotely bridging SIP/user1-00000045 and SIP/siptrunk-00000046
  == Spawn extension (LocalSets, *200, 4) exited non-zero on 'SIP/user1-00000045'

Please advise,

That is normal behaviour for a PSTN callee.

The network will signal an on hook status, but can subsequently signal a re-answer status when the callee picks up the call on another extension. It won’t, typically, signal a release status until two or three minutes later.

If you were using an analogue line, you would definitely have to live with this, as disconnect supervision will not be sent until the release. As you are presumably using an ITSP, they will, presumably, have an ISDN connection and will have access to the hangup and re-answer events, as well as the final release. They could chose to treat hangup as release, although they could also ignore it, or treat it as hold.

If your SIP connections goes to a gateway device to an analogue line, then you will have the full limitations of an analogue line.

You may be able to ask your ITSP or PSTN operator to release when they get hangup, but if you are a home user, it is unlikely that they will offer that option.

If you are using a gateway, you may also not have any disconnect supervision being provided, not have the gateway configured correctly for it, or have a gateway that cannot detect it.

PS telling people that you are a newbie is unlikely to make an real difference to the answers you get, although it may discourage some people from answering.

The problem might be on my end because when I am placing a call using a softphone directly connected to my VoIP provider (thus bypassing Asterisk), the call is hung up the way it should.

In that case, you are going to have to provide sip set set debug on traces, and verbose level 3 console output.

Nevermind, I can’t reproduce the issue.