format refactor

This commit is contained in:
Anthony Minessale 2010-06-17 14:28:31 -05:00
parent cc346c21d5
commit 8b4a8cc3ef
3 changed files with 24 additions and 6 deletions

View File

@ -394,6 +394,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
const char *ps_cause = NULL, *use_my_cause;
const char *gateway_name = NULL;
sofia_gateway_t *gateway_ptr = NULL;
int rec;
if ((gateway_name = switch_channel_get_variable(channel, "sip_gateway_name"))) {
gateway_ptr = sofia_reg_find_gateway(gateway_name);
@ -401,9 +402,12 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
switch_mutex_lock(tech_pvt->sofia_mutex);
rec = sofia_test_flag(tech_pvt, TFLAG_RECOVERING);
sofia_clear_flag(tech_pvt, TFLAG_RECOVERING);
sofia_glue_tech_untrack(tech_pvt->profile, session, SWITCH_TRUE);
if (!rec) {
sofia_glue_tech_untrack(tech_pvt->profile, session, SWITCH_TRUE);
}
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {

View File

@ -4454,6 +4454,8 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
const char *r_ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
const char *r_port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
sofia_set_flag(tech_pvt, TFLAG_RECOVERING);
if (!switch_channel_test_flag(channel, CF_PROXY_MODE) && ip && port) {
const char *tmp;
tech_pvt->iananame = tech_pvt->rm_encoding = (char *) switch_channel_get_variable(channel, "sip_use_codec_name");
@ -4475,7 +4477,11 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
tech_pvt->adv_sdp_audio_ip = tech_pvt->extrtpip = (char *) ip;
tech_pvt->adv_sdp_audio_port = tech_pvt->local_sdp_audio_port = atoi(port);
tech_pvt->local_sdp_audio_ip = tech_pvt->rtpip;
if ((tmp = switch_channel_get_variable(channel, "local_media_ip"))) {
tech_pvt->local_sdp_audio_ip = switch_core_session_strdup(session, tmp);
tech_pvt->rtpip = tech_pvt->local_sdp_audio_ip;
}
if (r_ip && r_port) {
tech_pvt->remote_sdp_audio_ip = (char *) r_ip;
@ -4518,11 +4524,12 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
sofia_glue_activate_rtp(tech_pvt, 0);
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
switch_xml_free(xml);
return 0;
}
}
sofia_set_flag(tech_pvt, TFLAG_RECOVERING);
if (switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
sofia_set_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE);
} else {
@ -4548,6 +4555,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Resurrecting fallen channel %s\n", switch_channel_get_name(channel));
switch_core_session_thread_launch(session);
switch_xml_free(xml);
h->total++;

View File

@ -1201,6 +1201,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_se
switch_threadattr_create(&thd_attr, session->pool);
switch_threadattr_detach_set(thd_attr, 1);
if (switch_test_flag(session, SSF_THREAD_RUNNING) || switch_test_flag(session, SSF_THREAD_STARTED)) {
goto end;
}
switch_mutex_lock(session->mutex);
if (switch_test_flag(session, SSF_THREAD_RUNNING)) {
@ -1223,6 +1227,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(switch_core_se
switch_mutex_unlock(session->mutex);
end:
return status;
}