Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 233049) +++ channels/chan_sip.c (working copy) @@ -2160,9 +2160,13 @@ if (sscanf(p->lastmsg, "Tx: %30s", method_str) == 1 || sscanf(p->lastmsg, "Rx: %30s", method_str) == 1) { if (method_match(SIP_CANCEL, method_str) || method_match(SIP_BYE, method_str)) { ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); + return 10000; } } - return 10000; + + /* Give them twice the maximum interval to respond, then really kill the dialog. */ + snprintf(p->lastmsg, sizeof(p->lastmsg), "Tx: CANCEL (autodestruct)\n"); + return (p->timer_t1 < 500 ? 500 : p->timer_t1) * 64 * 2; } /* If we're destroying a subscription, dereference peer object too */ @@ -3116,6 +3120,8 @@ ast_queue_control(p->owner, AST_CONTROL_CONGESTION); ast_channel_unlock(p->owner); } + ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); + p->invitestate = INV_CANCELLED; } ast_mutex_unlock(&p->lock); return 0;