Fix stuck DTMF when bridge is broken.

When a bridge is broken by an AMI Redirect action or the ChannelRedirect
application, an in progress DTMF digit could be stuck sending forever.

* Made simulate a DTMF end event when a bridge is broken and a DTMF digit
was in progress.

(closes issue ASTERISK-20492)
Reported by: Jeremiah Gowdy
Patches:
      bridge_end_dtmf-v3.patch.txt (license #6358) patch uploaded by Jeremiah Gowdy
      Modified to jira_asterisk_20492_v1.8.patch
      jira_asterisk_20492_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett

Review: https://reviewboard.asterisk.org/r/2169/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@375964 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2012-11-06 18:18:32 +00:00
parent d8a6097f96
commit 2fcf4a32a0
5 changed files with 69 additions and 3 deletions

View File

@@ -3896,6 +3896,24 @@ static void clear_dialed_interfaces(struct ast_channel *chan)
ast_channel_unlock(chan);
}
void ast_bridge_end_dtmf(struct ast_channel *chan, char digit, struct timeval start, const char *why)
{
int dead;
long duration;
ast_channel_lock(chan);
dead = ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan);
ast_channel_unlock(chan);
if (dead) {
return;
}
duration = ast_tvdiff_ms(ast_tvnow(), start);
ast_senddigit_end(chan, digit, duration);
ast_log(LOG_DTMF, "DTMF end '%c' simulated on %s due to %s, duration %ld ms\n",
digit, chan->name, why, duration);
}
/*!
* \brief bridge the call and set CDR
*
@@ -4342,6 +4360,15 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
ast_cel_report_event(chan, AST_CEL_BRIDGE_END, NULL, NULL, peer);
before_you_go:
if (chan->sending_dtmf_digit) {
ast_bridge_end_dtmf(chan, chan->sending_dtmf_digit, chan->sending_dtmf_tv,
"bridge end");
}
if (peer->sending_dtmf_digit) {
ast_bridge_end_dtmf(peer, peer->sending_dtmf_digit, peer->sending_dtmf_tv,
"bridge end");
}
/* Just in case something weird happened and we didn't clean up the silence generator... */
if (silgen) {
ast_channel_stop_silence_generator(who == chan ? peer : chan, silgen);