提交 047e3dd7 authored 作者: Anthony Minessale's avatar Anthony Minessale

don't parse ringback varable in proxy situations

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9095 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 f0e539a5
...@@ -256,7 +256,7 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map ...@@ -256,7 +256,7 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map
SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session) SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session)
{ {
switch_channel_t *caller_channel = switch_core_session_get_channel(session); switch_channel_t *caller_channel = NULL;
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session); switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
const char *ringback_data = NULL; const char *ringback_data = NULL;
switch_frame_t write_frame = { 0 }; switch_frame_t write_frame = { 0 };
...@@ -271,6 +271,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t ...@@ -271,6 +271,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
const char *var = switch_channel_get_variable(caller_channel, "call_timeout"); const char *var = switch_channel_get_variable(caller_channel, "call_timeout");
switch_time_t start = 0; switch_time_t start = 0;
if (session) {
caller_channel = switch_core_session_get_channel(session);
}
if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) { if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
...@@ -288,6 +292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t ...@@ -288,6 +292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
timelimit *= 1000000; timelimit *= 1000000;
start = switch_timestamp_now(); start = switch_timestamp_now();
if (caller_channel) {
if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) { if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback"); ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
} }
...@@ -297,8 +302,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t ...@@ -297,8 +302,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
} }
if (read_codec && (ringback_data || if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
(!(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA))))) { ringback_data = NULL;
}
}
if (read_codec && ringback_data) {
if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) { if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
if (switch_core_codec_init(&write_codec, if (switch_core_codec_init(&write_codec,
"L16", "L16",
...@@ -366,7 +376,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t ...@@ -366,7 +376,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
} }
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Error!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Error!\n");
if (caller_channel) {
switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE); switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE);
}
read_codec = NULL; read_codec = NULL;
} }
} }
...@@ -1031,6 +1043,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -1031,6 +1043,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
endfor1: endfor1:
if (caller_channel) {
if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
ringback_data = NULL;
}
}
if (ringback_data && !switch_channel_test_flag(caller_channel, CF_ANSWERED) if (ringback_data && !switch_channel_test_flag(caller_channel, CF_ANSWERED)
&& !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) { && !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
if ((status = switch_channel_pre_answer(caller_channel)) != SWITCH_STATUS_SUCCESS) { if ((status = switch_channel_pre_answer(caller_channel)) != SWITCH_STATUS_SUCCESS) {
...@@ -1039,10 +1057,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -1039,10 +1057,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
} }
if (session && (read_codec = switch_core_session_get_read_codec(session)) && if (session && (read_codec = switch_core_session_get_read_codec(session)) && ringback_data) {
(ringback_data ||
(!(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA))))) {
if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) { if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
if (switch_core_codec_init(&write_codec, if (switch_core_codec_init(&write_codec,
"L16", "L16",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论