summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index a1a3730ba..4738e37d4 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -6740,7 +6740,7 @@ void ast_do_masquerade(struct ast_channel *original)
* The clonechan was sending a DTMF digit that was not completed
* before the masquerade.
*/
- ast_bridge_end_dtmf(original, clone_sending_dtmf_digit, clone_sending_dtmf_tv,
+ ast_channel_end_dtmf(original, clone_sending_dtmf_digit, clone_sending_dtmf_tv,
"masquerade");
}
@@ -10406,3 +10406,24 @@ int ast_channel_unsuppress(struct ast_channel *chan, unsigned int direction, enu
return 0;
}
+
+void ast_channel_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(ast_channel_flags(chan), AST_FLAG_ZOMBIE)
+ || (ast_channel_softhangup_internal_flag(chan)
+ & ~(AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE));
+ ast_channel_unlock(chan);
+ if (dead) {
+ /* Channel is a zombie or a real hangup. */
+ 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, ast_channel_name(chan), why, duration);
+} \ No newline at end of file