From d37fee2b0f23190fc436aa0d8c5fef44c6bbe950 Mon Sep 17 00:00:00 2001 From: Olle Johansson Date: Wed, 6 Dec 2006 15:42:41 +0000 Subject: [PATCH] Issue #8528 - make sure we don't delete the dialog too quickly after receiving a 487. Move 487 handling into handle_response_invite where it really belongs and don't add an ALREADYGONE flag to the dialog. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@48320 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 51c90ea355..764ca032d8 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -9827,12 +9827,23 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru ast_log(LOG_WARNING, "Re-invite to non-existing call leg on other UA. SIP dialog '%s'. Giving up.\n", p->callid); transmit_request(p, SIP_ACK, seqno, 0, 0); break; + case 487: /* Cancelled transaction */ + /* We have sent CANCEL on an outbound INVITE + This transaction is already scheduled to be killed by sip_hangup(). + */ + transmit_request(p, SIP_ACK, seqno, 0, 0); + if (p->owner && !ignore) + ast_queue_hangup(p->owner); + else if (!ignore) + update_call_counter(p, DEC_CALL_LIMIT); + break; case 491: /* Pending */ /* we have to wait a while, then retransmit */ /* Transmission is rescheduled, so everything should be taken care of. We should support the retry-after at some point */ break; case 501: /* Not implemented */ + transmit_request(p, SIP_ACK, seqno, 0, 0); if (p->owner) ast_queue_control(p->owner, AST_CONTROL_CONGESTION); break; @@ -10140,6 +10151,10 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ ast_set_flag(p, SIP_NEEDDESTROY); break; + case 487: + if (sipmethod == SIP_INVITE) + handle_response_invite(p, resp, rest, req, ignore, seqno); + break; case 491: /* Pending */ if (sipmethod == SIP_INVITE) { handle_response_invite(p, resp, rest, req, ignore, seqno); @@ -10176,12 +10191,6 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ if (p->owner) ast_queue_control(p->owner, AST_CONTROL_BUSY); break; - case 487: - /* channel now destroyed - dec the inUse counter */ - if (owner) - ast_queue_hangup(p->owner); - update_call_counter(p, DEC_CALL_LIMIT); - break; case 482: /* SIP is incapable of performing a hairpin call, which is yet another failure of not having a layer 2 (again, YAY IETF for thinking ahead). So we treat this as a call -- 2.47.2