Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.677 diff -u -r1.677 chan_sip.c --- channels/chan_sip.c 17 Mar 2005 23:03:07 -0000 1.677 +++ channels/chan_sip.c 19 Mar 2005 08:29:43 -0000 @@ -1901,7 +1901,10 @@ ast_mutex_unlock(&usecnt_lock); ast_update_use_count(); - ast_set_flag(&locflags, SIP_NEEDDESTROY); + /* According to RFC3261, a CANCEL needs to wait 64 Timer 1 units (500 ms) + before it automatically destroys the dialog. For BYE no timing is + specified, but we assume the same delay */ + sip_scheddestroy(p, 32000); /* Start the process if it's not already started */ if (!ast_test_flag(p, SIP_ALREADYGONE) && !ast_strlen_zero(p->initreq.data)) { if (needcancel) { @@ -1909,8 +1912,6 @@ transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0); /* Actually don't destroy us yet, wait for the 487 on our original INVITE, but do set an autodestruct just in case we never get it. */ - ast_clear_flag(&locflags, SIP_NEEDDESTROY); - sip_scheddestroy(p, 15000); if ( p->initid != -1 ) { /* channel still up - reverse dec of inUse counter only if the channel is not auto-congested */