--- channels/chan_sip.c.orig 2010-07-08 14:51:53.000000000 +0000 +++ channels/chan_sip.c 2010-07-08 14:53:51.000000000 +0000 @@ -22085,6 +22085,25 @@ } } p->recv = *sin; + if(!p->owner) { + char *e; + int respid; + + e = ast_skip_blanks(REQ_OFFSET_TO_STR(req, rlPart2)); + + if (!ast_strlen_zero(e)) { + if (sscanf(e, "SIP/2.0 %30u", &respid) == 1) { + if((respid == 180)||(respid == 100)) { + transmit_request(p, SIP_CANCEL, p->lastinvite, XMIT_RELIABLE, FALSE); + p->needdestroy = 0; + sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); + sip_pvt_unlock(p); + return 1; + + } + } + } + } if (p->do_history) /* This is a request or response, note what it was for */ append_history(p, "Rx", "%s / %s / %s", req->data->str, get_header(req, "CSeq"), REQ_OFFSET_TO_STR(req, rlPart2));