From 5ca52148d3cdc7028e72b4b9116ff00165c782e9 Mon Sep 17 00:00:00 2001 From: Tom Briden Date: Thu, 15 May 2025 15:40:43 +0100 Subject: [PATCH] MT#55283 fix not processing DTMF events while media is being blocked and DTMF-security=silence when DTMF-security is set to an option that results in a transcode, the packets go into handler_func_transcode. This returns immediately when handler_silence_block returns false due to block-media, resulting in the events not being processed for sending on log-DTMF etc. This change only uses the transcode function for transcoded DTMF if we're not blocking media (and logically, blocking media should mean _all_ media). It instead goes into __handler_func_supplemental as normal so packet_dtmf can process the packet, but drop it if its in one of these modes and media is blocked Change-Id: I19901877f6018f3916b22ff60799e8c74d02e065 --- daemon/codec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index 7da9d8f0a..921c77630 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -2702,7 +2702,11 @@ static tc_code packet_dtmf(struct codec_ssrc_handler *ch, struct codec_ssrc_hand bool do_blocking = block_dtmf == BLOCK_DTMF_DROP; - if (packet->payload->len >= sizeof(struct telephone_event_payload)) { + if (is_dtmf_replace_mode(block_dtmf) && !handler_silence_block(packet->handler, mp)) { + // don't send transcoded DTMF audio during media blocking"); + do_blocking = true; + } + else if (packet->payload->len >= sizeof(struct telephone_event_payload)) { struct telephone_event_payload *dtmf = (void *) packet->payload->s; struct codec_handler *h = input_ch->handler; // fudge up TS and duration values @@ -2836,7 +2840,11 @@ static int __handler_func_supplemental(struct codec_handler *h, struct media_pac } static int handler_func_dtmf(struct codec_handler *h, struct media_packet *mp) { // DTMF input - can we do DTMF output? - if (h->dtmf_payload_type == -1) + + // handler_func_transcode will return immediately if we're blockinh media, which means + // the DTMF event won't be processed for log-dtmf etc. So, if media is being blocked, + // let it run through packet_dtmf, which will process it and then drop it + if (h->dtmf_payload_type == -1 && handler_silence_block(h, mp)) return handler_func_transcode(h, mp); return __handler_func_supplemental(h, mp, packet_dtmf, packet_dtmf_dup);