--- main/rtp_engine.c (Asterisk 13.6.0) +++ main/rtp_engine.c (working copy) @@ -652,7 +652,7 @@ } ast_rwlock_rdlock(&static_RTP_PT_lock); - new_type = ao2_bump(static_RTP_PT[payload]); + new_type = static_RTP_PT[payload]; ast_rwlock_unlock(&static_RTP_PT_lock); if (!new_type) { ast_debug(1, "Don't have a default tx payload type %d format for m type on %p\n", @@ -663,6 +663,29 @@ ast_debug(1, "Setting tx payload type %d based on m type on %p\n", payload, codecs); + if (new_type->format) { + struct ast_format *new_format = ast_format_parse_sdp_fmtp(new_type->format, ""); + + if (new_type->format != new_format) { + struct ast_rtp_payload_type *tmp_type = ast_rtp_engine_alloc_payload_type(); + + if (!tmp_type) { + ao2_ref(new_format, -1); + return; + } + tmp_type->asterisk_format = new_type->asterisk_format; + tmp_type->rtp_code = new_type->rtp_code; + tmp_type->payload = payload; + tmp_type->format = new_format; + new_type = tmp_type; + } else { + ao2_ref(new_format, -1); + new_type = ao2_bump(new_type); + } + } else { + new_type = ao2_bump(new_type); + } + ast_rwlock_wrlock(&codecs->codecs_lock); if (payload < AST_VECTOR_SIZE(&codecs->payloads)) {