fix gremlins in code that worked before then changed it's mind

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3300 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-11-10 08:13:01 +00:00
parent 964e2e9886
commit 8dc1556b95
6 changed files with 77 additions and 43 deletions
@@ -287,8 +287,16 @@ static switch_status_t uuid_broadcast_function(char *cmd, switch_core_session_t
} else {
switch_media_flag_t flags = SMF_NONE;
if (argv[2] && !strcmp(argv[2], "both")) {
flags |= SMF_ECHO_BRIDGED;
if (argv[2]) {
if (!strcmp(argv[2], "both")) {
flags |= (SMF_ECHO_ALEG | SMF_ECHO_BLEG);
} else if (!strcmp(argv[2], "aleg")) {
flags |= SMF_ECHO_ALEG;
} else if (!strcmp(argv[2], "bleg")) {
flags |= SMF_ECHO_BLEG;
}
} else {
flags |= SMF_ECHO_ALEG;
}
status = switch_ivr_broadcast(argv[0], argv[1], flags);
@@ -111,7 +111,6 @@ static void playback_function(switch_core_session_t *session, char *data)
switch_channel_t *channel;
char *timer_name = NULL;
char *file_name = NULL;
switch_status_t status;
file_name = switch_core_session_strdup(session, data);
@@ -124,12 +123,8 @@ static void playback_function(switch_core_session_t *session, char *data)
switch_channel_pre_answer(channel);
status = switch_ivr_play_file(session, NULL, file_name, timer_name, on_dtmf, NULL, 0);
switch_ivr_play_file(session, NULL, file_name, timer_name, on_dtmf, NULL, 0);
if (!switch_channel_ready(channel) || (status != SWITCH_STATUS_SUCCESS && !SWITCH_STATUS_IS_BREAK(status))) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
}
+10 -7
View File
@@ -146,7 +146,7 @@ typedef enum {
typedef enum {
TFLAG_IO = (1 << 0),
TFLAG_USEME = (1 << 1),
TFLAG_CHANGE_MEDIA = (1 << 1),
TFLAG_OUTBOUND = (1 << 2),
TFLAG_READING = (1 << 3),
TFLAG_WRITING = (1 << 4),
@@ -1773,7 +1773,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
if (!tech_pvt->local_sdp_str) {
tech_absorb_sdp(tech_pvt);
}
do_invite(session);
}
break;
@@ -2403,24 +2402,29 @@ static void sip_i_message(int status,
}
}
static void pass_sdp(switch_channel_t *channel, char *sdp)
static void pass_sdp(private_object_t *tech_pvt, char *sdp)
{
char *val;
switch_channel_t *channel;
switch_core_session_t *other_session;
switch_channel_t *other_channel;
channel = switch_core_session_get_channel(tech_pvt->session);
assert(channel != NULL);
if ((val = switch_channel_get_variable(channel, SWITCH_ORIGINATOR_VARIABLE)) && (other_session = switch_core_session_locate(val))) {
other_channel = switch_core_session_get_channel(other_session);
assert(other_channel != NULL);
if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
}
if (
if (!switch_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (
switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
switch_channel_test_flag(other_channel, CF_NOMEDIA) &&
switch_channel_test_flag(channel, CF_OUTBOUND) &&
switch_channel_test_flag(channel, CF_NOMEDIA)) {
switch_channel_test_flag(channel, CF_NOMEDIA))) {
switch_ivr_nomedia(val, SMF_FORCE);
switch_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA);
}
switch_core_session_rwunlock(other_session);
@@ -2481,7 +2485,7 @@ static void sip_i_state(int status,
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote SDP:\n%s\n", r_sdp);
tech_pvt->remote_sdp_str = switch_core_session_strdup(session, (char *)r_sdp);
switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, (char *) r_sdp);
pass_sdp(channel, (char *) r_sdp);
pass_sdp(tech_pvt, (char *) r_sdp);
}
}
@@ -2639,7 +2643,6 @@ static void sip_i_state(int status,
if (tech_pvt && r_sdp) {
if (r_sdp) {
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "What should i do?\n%s\n", r_sdp);
return;
} else {
sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int)strlen(r_sdp), 0);