Index: chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.292.2.23 diff -u -r1.292.2.23 chan_sip.c --- chan_sip.c 23 Mar 2004 18:09:54 -0000 1.292.2.23 +++ chan_sip.c 24 Mar 2004 19:21:20 -0000 @@ -288,6 +288,7 @@ struct sip_pvt *owner; /* Owner call */ int retransid; /* Retransmission ID */ int packetlen; /* Length of packet */ + int noncritical; /* 0 if critical, 1 if non-critical (info,notify) */ char data[0]; }; @@ -493,21 +494,29 @@ __sip_xmit(pkt->owner, pkt->data, pkt->packetlen); res = 1; } else { - ast_log(LOG_WARNING, "Maximum retries exceeded on call %s for seqno %d (%s)\n", pkt->owner->callid, pkt->seqno, pkt->resp ? "Response" : "Request"); pkt->retransid = -1; - while(pkt->owner->owner && ast_mutex_trylock(&pkt->owner->owner->lock)) { + + if (pkt->noncritical) { + ast_log(LOG_WARNING, "Maximum retries exceeded on noncritical (i.e. INFO) message %s for seqno %d \n", pkt->owner->callid, pkt->seqno); + } else { + /* pkt->owner is a sip_pvt structure, the SIP dialogue (CALL ID) */ + /* pkt->owner->owner is an ast call structure, the call within the PBX */ + ast_log(LOG_WARNING, "Maximum retries exceeded on call %s for seqno %d (%s)\n", pkt->owner->callid, pkt->seqno, pkt->resp ? "Response" : "Request"); + + while(pkt->owner->owner && ast_mutex_trylock(&pkt->owner->owner->lock)) { ast_mutex_unlock(&pkt->owner->lock); usleep(1); ast_mutex_lock(&pkt->owner->lock); - } - if (pkt->owner->owner) { + } + if (pkt->owner->owner) { /* XXX Potential deadlocK?? XXX */ ast_queue_hangup(pkt->owner->owner, 0); ast_mutex_unlock(&pkt->owner->owner->lock); - } else { + } else { /* If no owner, destroy now */ pkt->owner->needdestroy = 1; - } + } + } } if (pkt) ast_mutex_unlock(&pkt->owner->lock); @@ -531,7 +540,17 @@ pkt->retransid = ast_sched_add(sched, DEFAULT_RETRANS, retrans_pkt, pkt); pkt->next = p->packets; p->packets = pkt; + + /* INFO packets within dialogue should not cancel the call */ + if (!strncasecmp(pkt->data, "INFO", 4)) + pkt->noncritical = 1; + + /* MESSAGE packets within dialogue should not cancel the call */ + if (!strncasecmp(pkt->data, "MESSAGE", 7)) + pkt->noncritical = 1; + __sip_xmit(pkt->owner, pkt->data, pkt->packetlen); + if (!strncasecmp(pkt->data, "INVITE", 6)) { /* Note this is a pending invite */ p->pendinginvite = seqno;