From: Mark Spencer Date: Tue, 28 Sep 2004 12:55:08 +0000 (+0000) Subject: On register timeout, pretend to ack any messages so that if they were 100 Trying... X-Git-Tag: 1.0.2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c2148bea5e2dd4f7d446e9353af1ed32f05d86b;p=thirdparty%2Fasterisk.git On register timeout, pretend to ack any messages so that if they were 100 Trying and nothing else (e.g. certain iconnecthere failures), we still clean up. (bug #2524) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3848 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index be81665c8e..9b9cb8633d 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -827,6 +827,15 @@ static int __sip_ack(struct sip_pvt *p, int seqno, int resp, const char *msg) return res; } +/* Pretend to ack all packets */ +static int __sip_pretend_ack(struct sip_pvt *p) +{ + while(p->packets) { + __sip_ack(p, p->packets->seqno, (p->packets->flags & FLAG_RESPONSE), p->packets->data); + } + return 0; +} + /*--- __sip_semi_ack: Acks receipt of packet, keep it around (used for provisional responses) ---*/ static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, const char *msg) { @@ -4040,6 +4049,8 @@ static int sip_reg_timeout(void *data) p->registry = NULL; r->call = NULL; p->needdestroy = 1; + /* Pretend to ACK anything just in case */ + __sip_pretend_ack(p); } r->regstate=REG_STATE_UNREGISTERED; manager_event(EVENT_FLAG_SYSTEM, "Registry", "Channel: SIP\r\nDomain: %s\r\nStatus: %s\r\n", r->hostname, regstate2str(r->regstate));