提交 59d4d0b0 authored 作者: Anthony Minessale's avatar Anthony Minessale

fix no_media mode

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4192 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 3b6d163b
......@@ -83,7 +83,6 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
if (no_media_bridge) {
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
switch_frame_t *read_frame;
/* SIP won't let us redir media until the call has been answered #$^#%& so we will proxy any early media until they do */
while(switch_channel_ready(caller_channel) && switch_channel_ready(peer_channel) && !switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
switch_status_t status = switch_core_session_read_frame(peer_session, &read_frame, -1, 0);
......@@ -92,7 +91,6 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
if (SWITCH_READ_ACCEPTABLE(status) && switch_core_session_write_frame(session, read_frame, -1, 0) == SWITCH_STATUS_SUCCESS) {
bad = 0;
}
if (bad) {
switch_channel_hangup(caller_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_channel_hangup(peer_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
......
......@@ -162,6 +162,15 @@ static void answer_function(switch_core_session_t *session, char *data)
switch_channel_answer(channel);
}
static void pre_answer_function(switch_core_session_t *session, char *data)
{
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_channel_pre_answer(channel);
}
static void redirect_function(switch_core_session_t *session, char *data)
{
switch_core_session_message_t msg = {0};
......@@ -595,13 +604,23 @@ static const switch_application_interface_t answer_application_interface = {
};
static const switch_application_interface_t pre_answer_application_interface = {
/*.interface_name */ "pre_answer",
/*.application_function */ pre_answer_function,
/* long_desc */ "Pre-Answer the call for a channel.",
/* short_desc */ "Pre-Answer the call",
/* syntax */ "",
/*.next */ &hangup_application_interface
};
static const switch_application_interface_t eval_application_interface = {
/*.interface_name */ "eval",
/*.application_function */ eval_function,
/* long_desc */ "Do Nothing",
/* short_desc */ "Do Nothing",
/* syntax */ "",
/*.next */ &answer_application_interface
/*.next */ &pre_answer_application_interface
};
......
......@@ -2552,7 +2552,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
file = NULL;
}
if ((var_val = switch_event_get_header(var_event, "noanswer_early_media")) && switch_true(var_val)) {
if ((var_val = switch_event_get_header(var_event, "ignore_early_media")) && switch_true(var_val)) {
early_ok = 0;
}
......@@ -2755,9 +2755,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_channel_pre_answer(caller_channel);
}
if (session && (ringback_data || !switch_channel_test_flag(caller_channel, CF_NOMEDIA))) {
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
if (session && (read_codec = switch_core_session_get_read_codec(session)) &&
(ringback_data || !switch_channel_test_flag(caller_channel, CF_NOMEDIA))) {
if (!(pass = (uint8_t)switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
if (switch_core_codec_init(&write_codec,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论