From d799c66ba366a3a5b01062120837fbdad535092d Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 14 Aug 2024 08:17:27 -0400 Subject: [PATCH] MT#60347 fix fringe DTMF payload type case Change-Id: I2fbb659c445ec9733b87f01d75e38c50e69caf3a --- daemon/codec.c | 12 ++++++++ t/auto-daemon-tests.pl | 64 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/daemon/codec.c b/daemon/codec.c index efb6bb625a..9c38c603a2 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -5687,6 +5687,12 @@ void __codec_store_answer(struct codec_store *dst, struct codec_store *src, sdp_ // handle associated supplemental codecs if (h->cn_payload_type != -1) { pt = t_hash_table_lookup(orig_dst.codecs, GINT_TO_POINTER(h->cn_payload_type)); + if (a.allow_asymmetric) { + struct rtp_payload_type *src_pt + = t_hash_table_lookup(src->codecs, GINT_TO_POINTER(h->cn_payload_type)); + if (src_pt && (!pt || !rtp_payload_type_eq_compat(src_pt, pt))) + pt = src_pt; + } if (!pt && a.allow_asymmetric) pt = t_hash_table_lookup(src->codecs, GINT_TO_POINTER(h->cn_payload_type)); if (!pt) @@ -5699,6 +5705,12 @@ void __codec_store_answer(struct codec_store *dst, struct codec_store *src, sdp_ dtmf_payload_type = h->real_dtmf_payload_type; if (dtmf_payload_type != -1) { pt = t_hash_table_lookup(orig_dst.codecs, GINT_TO_POINTER(dtmf_payload_type)); + if (a.allow_asymmetric) { + struct rtp_payload_type *src_pt + = t_hash_table_lookup(src->codecs, GINT_TO_POINTER(dtmf_payload_type)); + if (src_pt && (!pt || !rtp_payload_type_eq_compat(src_pt, pt))) + pt = src_pt; + } if (!pt && a.allow_asymmetric) pt = t_hash_table_lookup(src->codecs, GINT_TO_POINTER(dtmf_payload_type)); if (!pt) diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 6694176e48..11c8245862 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -359,7 +359,69 @@ sub stun_succ { -#done_testing;NGCP::Rtpengine::AutoTest::terminate('f00');exit; +new_call; + +offer('duplicate t-e', { codec => { + strip => ['all'], + except => [qw/opus G722 PCMA telephone-event/], + transcode => ['telephone-event'], + } }, < ['allow asymmetric codecs'] }, < [qw(codec-strip-all codec-transcode-PCMA codec-transcode-telephone-event)],