res_pjsip_sdp_rtp: Use negotiated DTMF Payload types on bitrate mismatch

When Asterisk sends an offer to Bob that includes 48K and 8K codecs with
matching 4733 offers, Bob may want to use the 48K audio codec but can not
accept 48K digits and so negotiates for a mixed set.

Asterisk will now check Bob's offer to make sure Bob has indicated this is
acceptible and if not, will use Bob's preference.

Fixes: #847
(cherry picked from commit ac673dd14e)
This commit is contained in:
Mike Bradeen
2024-08-21 10:11:31 -06:00
committed by Asterisk Development Team
parent 57242cbe31
commit 8ad9f7d320
4 changed files with 159 additions and 9 deletions

View File

@@ -344,6 +344,14 @@ static void get_codecs(struct ast_sip_session *session, const struct pjmedia_sdp
ast_copy_pj_str(name, &rtpmap->enc_name, sizeof(name));
if (strcmp(name, "telephone-event") == 0) {
if (tel_event == 0) {
int dtmf_rate = 0, dtmf_code = 0;
char dtmf_pt[8];
ast_copy_pj_str(dtmf_pt, &rtpmap->pt, sizeof(dtmf_pt));
dtmf_code = atoi(dtmf_pt);
dtmf_rate = rtpmap->clock_rate;
ast_rtp_codecs_set_preferred_dtmf_format(codecs, dtmf_code, dtmf_rate);
}
tel_event++;
}