--- chan_sip.old 2007-04-08 03:09:15.000000000 +0200 +++ chan_sip.c 2007-04-08 03:01:26.000000000 +0200 @@ -1181,6 +1181,11 @@ /* Lock channel */ ast_mutex_lock(&pkt->owner->lock); + if (ast_test_flag(pkt->owner, SIP_ALREADYGONE)) { /* This call is already gone */ + ast_log(LOG_WARNING, "Cancelling retransmit SIP message on call that is already terminated: %s\n", pkt->owner->callid); + pkt->retrans = MAX_RETRANS; + } + if (pkt->retrans < MAX_RETRANS) { char buf[80]; @@ -2511,15 +2516,15 @@ transmit_response_reliable(p, "603 Declined", &p->initreq, 1); } } else { /* Call is in UP state, send BYE */ - if (!p->pendinginvite) { + /*if (!p->pendinginvite) {*/ /* Send a hangup */ transmit_request_with_auth(p, SIP_BYE, 0, 1, 1); - } else { + /*} else {*/ /* Note we will need a BYE when this all settles out but we can't send one while we have "INVITE" outstanding. */ - ast_set_flag(p, SIP_PENDINGBYE); + /*ast_set_flag(p, SIP_PENDINGBYE); ast_clear_flag(p, SIP_NEEDREINVITE); - } + }*/ } } if (needdestroy)