TT#92250 ignore format parameters for DTMF codec

closes #1098

Change-Id: I180667a7c5fa9da8a95d99826cb3fc4006598976
pull/1099/head
Richard Fuchs 5 years ago
parent 4910f7b33f
commit ee74914b22

@ -63,6 +63,8 @@ static int ilbc_decoder_input(decoder_t *dec, const str *data, GQueue *out);
static const char *dtmf_decoder_init(decoder_t *, const str *, const str *);
static int dtmf_decoder_input(decoder_t *dec, const str *data, GQueue *out);
static int format_cmp_ignore(const struct rtp_payload_type *, const struct rtp_payload_type *);
@ -396,6 +398,7 @@ static codec_def_t __codec_defs[] = {
.default_clockrate = 8000,
.default_channels = 1,
.default_fmtp = "0-15",
.format_cmp = format_cmp_ignore,
.codec_type = &codec_type_dtmf,
.support_encoding = 1,
.support_decoding = 1,
@ -2276,3 +2279,9 @@ static int dtmf_decoder_input(decoder_t *dec, const str *data, GQueue *out) {
return 0;
}
static int format_cmp_ignore(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
return 0;
}

@ -71,6 +71,7 @@ typedef int packetizer_f(AVPacket *, GString *, str *, encoder_t *);
typedef void format_init_f(struct rtp_payload_type *);
typedef void set_enc_options_f(encoder_t *, const str *, const str *);
typedef void set_dec_options_f(decoder_t *, const str *, const str *);
typedef int format_cmp_f(const struct rtp_payload_type *, const struct rtp_payload_type *);
@ -126,6 +127,7 @@ struct codec_def_s {
const int default_bitrate;
int default_ptime;
const char *default_fmtp;
format_cmp_f * const format_cmp;
packetizer_f * const packetizer;
const int bits_per_sample;
const enum media_type media_type;

@ -145,6 +145,10 @@ const struct rtp_payload_type *rtp_get_rfc_codec(const str *codec) {
int rtp_payload_type_cmp(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
if (rtp_payload_type_cmp_nf(a, b))
return 1;
if (a->codec_def && a->codec_def == b->codec_def) {
if (a->codec_def->format_cmp)
return a->codec_def->format_cmp(a, b);
}
if (str_cmp_str(&a->format_parameters, &b->format_parameters))
return 1;
return 0;

@ -36,10 +36,257 @@ my ($sock_a, $sock_b, $sock_c, $sock_d, $port_a, $port_b, $ssrc, $resp,
# inject DTMF with mismatched codecs
if (0) {
# GH 1098
new_call;
offer('gh 1098', {
codec => {
mask => ['all'],
transcode => ['G722', 'AMR-WB/16000/1///mode-set--0,1,2;mode-change-period--2;mode-change-capability--2/dtx--1', 'AMR', 'PCMA', 'telephone-event'],
}
}, <<SDP);
v=0
o=- 3812713289 3812713289 IN IP4 foo.bar.com
s=-
c=IN IP4 1.1.1.1
t=0 0
m=audio 40732 RTP/AVP 111 108 8 101 96
a=ptime:20
a=rtpmap:111 AMR-WB/16000
a=fmtp:111 mode-set=0,1,2; mode-change-period=2; mode-change-capability=2
a=rtpmap:108 AMR/8000
a=fmtp:108 mode-set=7
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/16000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=fmtp:101 0-15
----------------------------------
v=0
o=- 3812713289 3812713289 IN IP4 foo.bar.com
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 9 96 108 8 101 96
a=rtpmap:9 G722/8000
a=rtpmap:96 AMR-WB/16000
a=rtpmap:108 AMR/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/16000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 mode-set=0,1,2;mode-change-period=2;mode-change-capability=2
a=fmtp:108 mode-set=7
a=fmtp:101 0-15
a=fmtp:96 0-15
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
answer('gh 1098', {
flags => ['single-codec'],
}, <<SDP);
v=0
o=FreeSWITCH 1603706241 1603706242 IN IP4 3.3.3.3
s=FreeSWITCH
c=IN IP4 3.3.3.3
t=0 0
m=audio 18248 RTP/AVP 9 96
a=rtpmap:9 G722/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=rtcp:18249 IN IP4 3.3.3.3
----------------------------------
v=0
o=FreeSWITCH 1603706241 1603706242 IN IP4 3.3.3.3
s=FreeSWITCH
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 111 101
a=silenceSupp:off - - - -
a=rtpmap:111 AMR-WB/16000
a=rtpmap:101 telephone-event/16000
a=fmtp:111 mode-set=0,1,2; mode-change-period=2; mode-change-capability=2
a=fmtp:101 0-15
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
new_call;
offer('gh 1098', {
codec => {
mask => ['all'],
transcode => ['G722', 'AMR-WB/16000/1///mode-set--0,1,2;mode-change-period--2;mode-change-capability--2/dtx--1', 'AMR', 'PCMA', 'telephone-event'],
}
}, <<SDP);
v=0
o=- 3812713289 3812713289 IN IP4 foo.bar.com
s=-
c=IN IP4 1.1.1.1
t=0 0
m=audio 40732 RTP/AVP 111 108 8 101 96
a=ptime:20
a=rtpmap:111 AMR-WB/16000
a=fmtp:111 mode-set=0,1,2; mode-change-period=2; mode-change-capability=2
a=rtpmap:108 AMR/8000
a=fmtp:108 mode-set=7
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/16000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=fmtp:101 0-15
----------------------------------
v=0
o=- 3812713289 3812713289 IN IP4 foo.bar.com
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 9 96 108 8 101 96
a=rtpmap:9 G722/8000
a=rtpmap:96 AMR-WB/16000
a=rtpmap:108 AMR/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/16000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 mode-set=0,1,2;mode-change-period=2;mode-change-capability=2
a=fmtp:108 mode-set=7
a=fmtp:101 0-15
a=fmtp:96 0-15
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
answer('gh 1098', {
codec => {
strip => ['all'],
offer => ['PCMA'],
}
}, <<SDP);
v=0
o=FreeSWITCH 1603707514 1603707515 IN IP4 3.3.3.3
s=FreeSWITCH
c=IN IP4 3.3.3.3
t=0 0
m=audio 17766 RTP/AVP 8 96
a=rtpmap:8 PCMA/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=rtcp:17767 IN IP4 3.3.3.3
----------------------------------
v=0
o=FreeSWITCH 1603707514 1603707515 IN IP4 3.3.3.3
s=FreeSWITCH
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8
a=silenceSupp:off - - - -
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
new_call;
offer('gh 1098', {
codec => {
mask => ['all'],
transcode => ['G722', 'AMR-WB/16000/1///mode-set--0,1,2;mode-change-period--2;mode-change-capability--2/dtx--1', 'AMR', 'PCMA', 'telephone-event'],
}
}, <<SDP);
v=0
o=- 3812713289 3812713289 IN IP4 foo.bar.com
s=-
c=IN IP4 1.1.1.1
t=0 0
m=audio 40732 RTP/AVP 111 108 8 101 96
a=ptime:20
a=rtpmap:111 AMR-WB/16000
a=fmtp:111 mode-set=0,1,2; mode-change-period=2; mode-change-capability=2
a=rtpmap:108 AMR/8000
a=fmtp:108 mode-set=7
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/16000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=fmtp:101 0-15
----------------------------------
v=0
o=- 3812713289 3812713289 IN IP4 foo.bar.com
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 9 96 108 8 101 96
a=rtpmap:9 G722/8000
a=rtpmap:96 AMR-WB/16000
a=rtpmap:108 AMR/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/16000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 mode-set=0,1,2;mode-change-period=2;mode-change-capability=2
a=fmtp:108 mode-set=7
a=fmtp:101 0-15
a=fmtp:96 0-15
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
answer('gh 1098', {
codec => {
strip => ['all'],
offer => ['PCMA', 'telephone-event'],
}
}, <<SDP);
v=0
o=FreeSWITCH 1603707514 1603707515 IN IP4 3.3.3.3
s=FreeSWITCH
c=IN IP4 3.3.3.3
t=0 0
m=audio 17766 RTP/AVP 8 96
a=rtpmap:8 PCMA/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=rtcp:17767 IN IP4 3.3.3.3
----------------------------------
v=0
o=FreeSWITCH 1603707514 1603707515 IN IP4 3.3.3.3
s=FreeSWITCH
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 96
a=silenceSupp:off - - - -
a=rtpmap:8 PCMA/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
}
# inject DTMF with mismatched codecs
($sock_a, $sock_b) = new_call([qw(198.51.100.11 3000)], [qw(198.51.100.11 3002)]);
($port_a) = offer('inject, U/A offer',

Loading…
Cancel
Save