make sure bargers use the same codec as bargee to avoid transcoding delay

This commit is contained in:
Anthony Minessale 2012-05-14 10:03:35 -05:00
parent ec0f4c9f6c
commit 5b3b77071b
4 changed files with 36 additions and 2 deletions

View File

@ -120,6 +120,7 @@ struct switch_core_session {
switch_codec_t *video_write_codec;
switch_codec_implementation_t read_impl;
switch_codec_implementation_t real_read_impl;
switch_codec_implementation_t write_impl;
switch_codec_implementation_t video_read_impl;
switch_codec_implementation_t video_write_impl;

View File

@ -1500,6 +1500,7 @@ SWITCH_DECLARE(void) switch_core_session_unlock_codec_read(_In_ switch_core_sess
SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
SWITCH_DECLARE(switch_status_t) switch_core_session_get_real_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);

View File

@ -8464,12 +8464,33 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
bridge_uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE);
if (call_info) {
const char *olu;
switch_core_session_t *os;
switch_codec_implementation_t read_impl = { 0 };
char *codec_str = "";
if (!zstr(bridge_uuid) && switch_channel_test_flag(b_channel, CF_LEG_HOLDING)) {
olu = bridge_uuid;
} else {
olu = b_private->uuid;
}
if ((os = switch_core_session_locate(olu))) {
switch_core_session_get_real_read_impl(os, &read_impl);
switch_core_session_rwunlock(os);
codec_str = switch_core_session_sprintf(session, "set:absolute_codec_string=%s@%di,", read_impl.iananame,
read_impl.microseconds_per_packet / 1000);
}
if (!zstr(bridge_uuid) && switch_channel_test_flag(b_channel, CF_LEG_HOLDING)) {
tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool,
"answer,intercept:%s", bridge_uuid);
"%sanswer,intercept:%s", codec_str, bridge_uuid);
} else {
tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool,
"answer,sofia_sla:%s", b_private->uuid);
"%sanswer,sofia_sla:%s", codec_str, b_private->uuid);
}
} else {
if (!zstr(bridge_uuid)) {

View File

@ -206,6 +206,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
session->read_codec = session->real_read_codec = codec;
if (codec->implementation) {
session->read_impl = *codec->implementation;
session->real_read_impl = *codec->implementation;
} else {
memset(&session->read_impl, 0, sizeof(session->read_impl));
}
@ -319,6 +320,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_se
return SWITCH_STATUS_FALSE;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_get_real_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
{
if (session->real_read_impl.codec_id) {
*impp = session->real_read_impl;
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_FALSE;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
{
if (session->write_impl.codec_id) {