yes virginia, sip has shortcommings

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4138 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-02-06 19:15:26 +00:00
parent d44d8510db
commit b42e387938
2 changed files with 20 additions and 1 deletions
@@ -81,6 +81,25 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
return;
} else {
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);
uint8_t bad = 1;
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);
return;
}
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirecting media to point-to-point mode.\n");
switch_ivr_nomedia(switch_core_session_get_uuid(session), SMF_FORCE);
switch_ivr_nomedia(switch_core_session_get_uuid(peer_session), SMF_FORCE);