few bugs on recent new features

This commit is contained in:
Anthony Minessale 2014-10-03 15:36:23 -05:00
parent acd8d74316
commit b2ae5f4cc2
2 changed files with 28 additions and 30 deletions

View File

@ -6364,37 +6364,36 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if (!tech_pvt || !tech_pvt->nh) { if (!tech_pvt || !tech_pvt->nh) {
goto done; goto done;
} }
}
if (tech_pvt) {
if ((status > 100 || switch_channel_test_flag(channel, CF_ANSWERED)) && status < 300 && !r_sdp && tech_pvt->mparams.last_sdp_str) { if ((status > 100 || switch_channel_test_flag(channel, CF_ANSWERED)) && status < 300 && !r_sdp && tech_pvt->mparams.last_sdp_str) {
r_sdp = tech_pvt->mparams.last_sdp_str; r_sdp = tech_pvt->mparams.last_sdp_str;
} }
tech_pvt->mparams.last_sdp_str = NULL; tech_pvt->mparams.last_sdp_str = NULL;
}
if (r_sdp && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) { if (r_sdp && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) {
const char *var; const char *var;
if ((var = switch_channel_get_variable(channel, "bypass_media_sdp_filter"))) { if ((var = switch_channel_get_variable(channel, "bypass_media_sdp_filter"))) {
if ((patched_sdp = switch_core_media_process_sdp_filter(r_sdp, var, session))) { if ((patched_sdp = switch_core_media_process_sdp_filter(r_sdp, var, session))) {
r_sdp = patched_sdp; r_sdp = patched_sdp;
}
} }
} }
}
if ((channel && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) || if ((switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) ||
(sofia_test_flag(profile, TFLAG_INB_NOMEDIA) || sofia_test_flag(profile, TFLAG_PROXY_MEDIA))) { (sofia_test_flag(profile, TFLAG_INB_NOMEDIA) || sofia_test_flag(profile, TFLAG_PROXY_MEDIA))) {
/* This marr in our code brought to you by people who can't read........ */ /* This marr in our code brought to you by people who can't read........ */
if (profile->ndlb & SM_NDLB_ALLOW_BAD_IANANAME && r_sdp && (p = (char *) switch_stristr("g729a/8000", r_sdp))) { if (profile->ndlb & SM_NDLB_ALLOW_BAD_IANANAME && r_sdp && (p = (char *) switch_stristr("g729a/8000", r_sdp))) {
p += 4; p += 4;
*p++ = '/'; *p++ = '/';
*p++ = '8'; *p++ = '8';
*p++ = '0'; *p++ = '0';
*p++ = '0'; *p++ = '0';
*p++ = '0'; *p++ = '0';
*p++ = ' '; *p++ = ' ';
}
} }
} }

View File

@ -8966,7 +8966,7 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
} }
len = strlen(sdp_str); len = strlen(sdp_str) + 1;
new_sdp = malloc(len); new_sdp = malloc(len);
o = new_sdp; o = new_sdp;
i = sdp_str; i = sdp_str;
@ -9095,7 +9095,6 @@ SWITCH_DECLARE(char *) switch_core_media_process_sdp_filter(const char *sdp, con
int argc = 0; int argc = 0;
char *argv[50]; char *argv[50];
int x = 0; int x = 0;
char *use_sdp = (char *) sdp;
char *patched_sdp = NULL; char *patched_sdp = NULL;
argc = switch_split(cmd, '|', argv); argc = switch_split(cmd, '|', argv);
@ -9118,19 +9117,19 @@ SWITCH_DECLARE(char *) switch_core_media_process_sdp_filter(const char *sdp, con
if (patched_sdp) { if (patched_sdp) {
tmp_sdp = switch_core_media_filter_sdp(patched_sdp, command, arg); tmp_sdp = switch_core_media_filter_sdp(patched_sdp, command, arg);
} else { } else {
tmp_sdp = switch_core_media_filter_sdp(use_sdp, command, arg); tmp_sdp = switch_core_media_filter_sdp(sdp, command, arg);
} }
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG,
"%s Filter command %s(%s)\nFROM:\n==========\n%s\nTO:\n==========\n%s\n\n", "%s Filter command %s(%s)\nFROM:\n==========\n%s\nTO:\n==========\n%s\n\n",
switch_channel_get_name(channel), switch_channel_get_name(channel),
command, arg, patched_sdp ? patched_sdp : use_sdp, tmp_sdp); command, arg, patched_sdp ? patched_sdp : sdp, tmp_sdp);
if (tmp_sdp) { if (tmp_sdp) {
switch_safe_free(patched_sdp); switch_safe_free(patched_sdp);
patched_sdp = use_sdp = tmp_sdp; patched_sdp = tmp_sdp;
} }
} }
} }