External call not hanging up if caller hangs up while phone is ringing

Hello all,

I’ve been setting up a SIP-based asterisk system with a SIP trunk dialing into a provider’s server, but I have been having some issues with hanging up calls.

My dial plan is simple - I am attaching the relevant part below. I have also tried adding another line with the Hangup() command below, but this did not help

exten => phonenumber1,1,Dial(SIP/phonenumber2/phonenumber1,,f(phonenumber2))

(basically, if phone number 1 is dialed, it proxys that call through another SIP connection with the caller ID being the second phone number from the trunk)

The dialing works, and I am able to answer the call on the called party and talk from one party of the call to the other and everything works great, including hanging up. However, if I dial this number from my SIP phone and then hang up on the calling phone, the called party keeps ringing. If I let the call time out, I get another call from the trunk number, and this repeats until I hang up the call on the called side.

Could I get a hint on how to possibly fix this?

Thanks in advance,
Kryštof Píštěk

Please provide “sip set debug on output” for both legs.

Please note that chan_sip only has limited support, so, if this is a new system, you should be using chan_pjsip.

(Your phone should send CANCEL, and Asterisk should send CANCEL to the provider.)

“f” isn’t an option I’ve seen used before, but I get the impression that it isn’t used in this case, because this is not a transfer as far as Asterisk is concerned. You would normally use fromuser, in sip.conf, if the provider identifies you bay the From header caller ID, and would use Set(CALLERID(num) to change the initially presented number, in other cases. However, that would cause the call to be rejected fast.

Hello again,

please disregard this issue, I found out that the problem is not with asterisk, but with the Cisco phone I am using to place calls. When I use a softphone, the issue disappears. Looking at the logs reveals that the CANCEL message from the VOIP phone includes a different Call-ID header than the INVITE did. This is not true for the softphone, so I’m blaming the Cisco phone here. The problem also happens with local (same-server) numbers.

Adding an Answer() into the dial plan before the Dial() seems to work around the issue, so I will have to find a way to conditionally insert it for calls placed from this device.

Thanks once again,
Kryštof Píštěk