Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 378070) +++ channels/chan_sip.c (working copy) @@ -23335,6 +23335,16 @@ sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); } res = -1; + if (c) { + p->invitestate = INV_COMPLETED; + p->owner = NULL; + ast_channel_unlock(c); + *nounlock = 1; + sip_pvt_unlock(p); + ast_channel_release(c); + sip_pvt_lock(p); + c = NULL; + } goto request_invite_cleanup; } @@ -23349,6 +23359,16 @@ sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); } res = -1; + if (c) { + p->invitestate = INV_COMPLETED; + p->owner = NULL; + ast_channel_unlock(c); + *nounlock = 1; + sip_pvt_unlock(p); + ast_channel_release(c); + sip_pvt_lock(p); + c = NULL; + } goto request_invite_cleanup; } } @@ -23364,6 +23384,16 @@ sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); } res = -1; + if (c) { + p->invitestate = INV_COMPLETED; + p->owner = NULL; + ast_channel_unlock(c); + *nounlock = 1; + sip_pvt_unlock(p); + ast_channel_release(c); + sip_pvt_lock(p); + c = NULL; + } goto request_invite_cleanup; } @@ -23395,6 +23425,16 @@ sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); } res = -1; + if (c) { + p->invitestate = INV_COMPLETED; + p->owner = NULL; + ast_channel_unlock(c); + *nounlock = 1; + sip_pvt_unlock(p); + ast_channel_release(c); + sip_pvt_lock(p); + c = NULL; + } goto request_invite_cleanup; } break;