1
0
mirror of https://github.com/signalwire/freeswitch.git synced 2025-04-18 01:28:42 +00:00

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
src
include
mod/applications/mod_bridgecall

@ -270,7 +270,7 @@ SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t s
SWITCH_DECLARE(int) switch_perform_regex(char *field, char *expression, pcre **new_re, int *ovector, uint32_t olen);
SWITCH_DECLARE(void) switch_perform_substitution(pcre *re, int match_count, char *data, char *field_data, char *substituted, uint32_t len, int *ovector);
#define SWITCH_READ_ACCEPTABLE(status) status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK
#define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK)
SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len);
SWITCH_DECLARE(char *) switch_url_decode(char *s);
SWITCH_END_EXTERN_C

@ -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);