FS-11855: [Core] Offer all negotiated codecs in 200 OK when receiving re-INVITE without SDP

This commit is contained in:
Liyang 2019-05-20 19:56:42 +08:00 committed by Andrey Volk
parent 8e2bba1d9d
commit b1714199ce
3 changed files with 9 additions and 4 deletions

View File

@ -1564,6 +1564,7 @@ typedef enum {
CF_T38_PASSTHRU,
CF_DROP_DTMF,
CF_REINVITE,
CF_NOSDP_REINVITE,
CF_AUTOFLUSH_DURING_BRIDGE,
CF_RTP_NOTIMER_DURING_BRIDGE,
CF_AVPF,

View File

@ -8028,6 +8028,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
goto done;
}
switch_channel_set_flag(channel, CF_NOSDP_REINVITE);
if (switch_channel_var_true(channel, "sip_unhold_nosdp")) {
switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, "sendrecv",
zstr(tech_pvt->mparams.local_sdp_str) || !switch_channel_test_flag(channel, CF_PROXY_MODE));
@ -8036,6 +8038,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
zstr(tech_pvt->mparams.local_sdp_str) || !switch_channel_test_flag(channel, CF_PROXY_MODE));
}
switch_channel_clear_flag(channel, CF_NOSDP_REINVITE);
if (zstr(tech_pvt->mparams.local_sdp_str)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot find a SDP\n");
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);

View File

@ -10582,10 +10582,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", a_engine->cur_payload_map->pt);
if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO)) {
if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO) || switch_channel_test_flag(session->channel, CF_NOSDP_REINVITE)) {
switch_mutex_lock(smh->sdp_mutex);
for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) {
if (pmap->pt != a_engine->cur_payload_map->pt) {
if (pmap->pt != a_engine->cur_payload_map->pt && pmap->pt != smh->mparams->te) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", pmap->pt);
}
}
@ -10621,10 +10621,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\r\n", a_engine->cur_payload_map->pt, fmtp_out);
}
if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO)) {
if (switch_media_handle_test_media_flag(smh, SCMF_MULTI_ANSWER_AUDIO) || switch_channel_test_flag(session->channel, CF_NOSDP_REINVITE)) {
switch_mutex_lock(smh->sdp_mutex);
for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) {
if (pmap->pt != a_engine->cur_payload_map->pt) {
if (pmap->pt != a_engine->cur_payload_map->pt && pmap->pt != smh->mparams->te) {
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%ld\r\n",
pmap->pt, pmap->iananame,
pmap->rate);