Skip to content

Commit

Permalink
MT#60347 fix fringe DTMF payload type case
Browse files Browse the repository at this point in the history
Change-Id: I2fbb659c445ec9733b87f01d75e38c50e69caf3a
  • Loading branch information
rfuchs committed Aug 14, 2024
1 parent 9b3cd95 commit d799c66
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
12 changes: 12 additions & 0 deletions daemon/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
64 changes: 63 additions & 1 deletion t/auto-daemon-tests.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
} }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.11
s=tester
t=0 0
m=audio 3000 RTP/AVP 127 98 97 9 8 101 102
c=IN IP4 198.51.100.50
a=sendrecv
a=rtpmap:127 EVS/16000/1
a=fmtp:127 evs-mode-switch=0;br=5.9-24.4;bw=nb-wb;cmr=-1;ch-aw-recv=0;max-red=0
a=rtpmap:98 AMR-WB/16000/1
a=fmtp:98 octet-align=0;mode-change-capability=2;max-red=0
a=rtpmap:97 AMR/8000/1
a=fmtp:97 octet-align=0;mode-change-capability=2;max-red=0
a=rtpmap:101 telephone-event/16000
a=rtpmap:102 telephone-event/8000
-------------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.11
s=tester
t=0 0
m=audio PORT RTP/AVP 9 8 102
c=IN IP4 203.0.113.1
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:102 telephone-event/8000
a=sendrecv
a=rtcp:PORT
SDP

answer('duplicate t-e', { flags => ['allow asymmetric codecs'] }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.11
s=tester
t=0 0
m=audio 3000 RTP/AVP 8 101
c=IN IP4 198.51.100.50
a=sendrecv
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
-------------------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.11
s=tester
t=0 0
m=audio PORT RTP/AVP 8 101
c=IN IP4 203.0.113.1
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=rtcp:PORT
SDP



new_call;

offer('t-e fmtp', { flags => [qw(codec-strip-all codec-transcode-PCMA codec-transcode-telephone-event)],
Expand Down

0 comments on commit d799c66

Please sign in to comment.