Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 351448) +++ channels/chan_sip.c (working copy) @@ -23216,6 +23216,7 @@ stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */ if (p->owner) { ast_set_hangupsource(p->owner, p->owner->name, 0); + ast_log(LOG_NOTICE, "Queuing the hangup due to cancel\n"); ast_queue_hangup(p->owner); } else Index: main/channel.c =================================================================== --- main/channel.c (revision 351448) +++ main/channel.c (working copy) @@ -3503,6 +3503,16 @@ c->timingfunc = func; c->timingdata = data; + if (func == NULL && rate == 0 && c->fdno == AST_TIMING_FD) { + /* Clearing the timing func and setting the rate to 0 + * means that we don't want to be reading from the timingfd + * any more. Setting c->fdno to -1 means we won't have any + * errant reads from the timingfd, meaning we won't potentially + * miss any important frames. + */ + c->fdno = -1; + } + ast_channel_unlock(c); return res;