fix no_media mode

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4192 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2007-02-10 19:34:03 +00:00
1 parent 3b6d163b73
commit 59d4d0b071
4 files changed
+122 -86

No files matched your search

@@ -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);
+20 -1
View File
@@ -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
};