--- main/rtp_engine.c (Asterisk 13.10.0) +++ main/rtp_engine.c (working copy) @@ -1784,6 +1784,50 @@ static void add_static_payload(int map, break; } } + /* http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml + * RFC 3551, Section 3: "[...] applications which need to define more + * than 32 dynamic payload types MAY bind codes below + * [AST_RTP_PT_FIRST_DYNAMIC], in which case it is RECOMMENDED that + * unassigned payload type numbers be used first." + */ + if (map < 0) { + for (x = 77; x < AST_RTP_PT_FIRST_DYNAMIC; ++x) { + if (!static_RTP_PT[x]) { + map = x; + break; + } + } + } + if (map < 0) { + for (x = 35; x < 77; ++x) { + if (!static_RTP_PT[x]) { + map = x; + break; + } + } + } + /* Yet, reusing mappings below 35 is not supported in Asterisk because + * when Compact Headers are activated, no rtpmap is send for those below + * 35. Therefore, you have to remove that code in chan_sip/res_pjsip or + * add a flag that this RTP Payload Type got reassigned dynamically and + * and requires a rtpmap even with Compact Headers enabled. + if (map < 0) { + for (x = 20; x < 35; ++x) { + if (!static_RTP_PT[x]) { + map = x; + break; + } + } + } + if (map < 0) { + for (x = 0; x < 20; ++x) { + if (!static_RTP_PT[x]) { + map = x; + break; + } + } + } + */ if (map < 0) { if (format) {