[Freeswitch-svn] [commit] r7745 - in freeswitch/trunk/src: . mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Tue Feb 26 15:31:54 EST 2008
Author: anthm
Date: Tue Feb 26 15:31:53 2008
New Revision: 7745
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/switch_core_session.c
freeswitch/trunk/src/switch_core_state_machine.c
Log:
update
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Tue Feb 26 15:31:53 2008
@@ -707,8 +707,6 @@
private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_mutex_lock(tech_pvt->flag_mutex);
-
if (switch_channel_get_state(channel) >= CS_HANGUP || !tech_pvt) {
status = SWITCH_STATUS_FALSE;
goto end;
@@ -717,7 +715,7 @@
if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
const char *var;
if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
- switch_set_flag(tech_pvt, TFLAG_SECURE);
+ switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
}
}
@@ -789,7 +787,7 @@
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending media re-direct:\n%s\n", msg->string_arg);
tech_pvt->local_sdp_str = switch_core_session_strdup(session, msg->string_arg);
- switch_set_flag(tech_pvt, TFLAG_SENT_UPDATE);
+ switch_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
sofia_glue_do_invite(session);
}
break;
@@ -828,7 +826,7 @@
case SWITCH_MESSAGE_INDICATE_HOLD:
{
- switch_set_flag(tech_pvt, TFLAG_SIP_HOLD);
+ switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
}
break;
@@ -850,7 +848,7 @@
private_object_t *a_tech_pvt = switch_core_session_get_private(a_session);
private_object_t *b_tech_pvt = switch_core_session_get_private(b_session);
- switch_set_flag(a_tech_pvt, TFLAG_REINVITE);
+ switch_set_flag_locked(a_tech_pvt, TFLAG_REINVITE);
a_tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(a_session, b_tech_pvt->remote_sdp_audio_ip);
a_tech_pvt->remote_sdp_audio_port = b_tech_pvt->remote_sdp_audio_port;
a_tech_pvt->local_sdp_audio_ip = switch_core_session_strdup(a_session, b_tech_pvt->local_sdp_audio_ip);
@@ -886,7 +884,7 @@
if (msg->string_arg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-directing to %s\n", msg->string_arg);
nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
- switch_set_flag(tech_pvt, TFLAG_BYE);
+ switch_set_flag_locked(tech_pvt, TFLAG_BYE);
}
break;
@@ -963,7 +961,7 @@
nua_respond(tech_pvt->nh, code, reason, TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)),
SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
- switch_set_flag(tech_pvt, TFLAG_BYE);
+ switch_set_flag_locked(tech_pvt, TFLAG_BYE);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d %s\n", code, reason);
@@ -981,7 +979,7 @@
} else {
nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
}
- switch_set_flag(tech_pvt, TFLAG_BYE);
+ switch_set_flag_locked(tech_pvt, TFLAG_BYE);
}
}
@@ -1000,7 +998,7 @@
{
if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
- switch_set_flag(tech_pvt, TFLAG_EARLY_MEDIA);
+ switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
/* Transmit 183 Progress with SDP */
@@ -1061,10 +1059,6 @@
end:
- //xxxbot
-
- switch_mutex_unlock(tech_pvt->flag_mutex);
-
return status;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Tue Feb 26 15:31:53 2008
@@ -1425,7 +1425,7 @@
switch_assert(tech_pvt != NULL);
- switch_mutex_lock(tech_pvt->flag_mutex);
+ switch_core_session_signal_lock(tech_pvt->session);
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
status = SWITCH_STATUS_SUCCESS;
@@ -1665,7 +1665,8 @@
end:
- switch_mutex_unlock(tech_pvt->flag_mutex);
+ switch_core_session_signal_unlock(tech_pvt->session);
+
return status;
}
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Tue Feb 26 15:31:53 2008
@@ -343,13 +343,16 @@
switch_assert(session != NULL);
+ if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+ return SWITCH_STATUS_FALSE;
+ }
+
if ((status = switch_core_session_read_lock(session)) != SWITCH_STATUS_SUCCESS) {
return status;
}
-
switch_core_session_signal_lock(session);
-
+
if (session->endpoint_interface->io_routines->receive_message) {
status = session->endpoint_interface->io_routines->receive_message(session, message);
}
Modified: freeswitch/trunk/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/trunk/src/switch_core_state_machine.c (original)
+++ freeswitch/trunk/src/switch_core_state_machine.c Tue Feb 26 15:31:53 2008
@@ -414,6 +414,7 @@
break;
case CS_DONE:
goto done;
+ /* HANGUP INIT RING and RESET are all short term so we signal lock during their callbacks */
case CS_HANGUP: /* Deactivate and end the thread */
{
const char *var = switch_channel_get_variable(session->channel, SWITCH_PROCESS_CDR_VARIABLE);
@@ -431,35 +432,43 @@
do_extra_handlers = 0;
}
}
-
+ switch_core_session_signal_lock(session);
STATE_MACRO(hangup, "HANGUP");
+ switch_core_session_signal_unlock(session);
}
goto done;
- case CS_INIT: /* Basic setup tasks */
+ case CS_INIT: /* Basic setup tasks */
+ switch_core_session_signal_lock(session);
STATE_MACRO(init, "INIT");
+ switch_core_session_signal_unlock(session);
break;
- case CS_RING: /* Look for a dialplan and find something to do */
+ case CS_RING: /* Look for a dialplan and find something to do */
+ switch_core_session_signal_lock(session);
STATE_MACRO(ring, "RING");
+ switch_core_session_signal_unlock(session);
break;
- case CS_RESET: /* Reset */
+ case CS_RESET: /* Reset */
+ switch_core_session_signal_lock(session);
STATE_MACRO(reset, "RESET");
+ switch_core_session_signal_unlock(session);
break;
- case CS_EXECUTE: /* Execute an Operation */
+ /* These other states are intended for prolonged durations so we do not signal lock for them */
+ case CS_EXECUTE: /* Execute an Operation */
STATE_MACRO(execute, "EXECUTE");
break;
- case CS_LOOPBACK: /* loop all data back to source */
+ case CS_LOOPBACK: /* loop all data back to source */
STATE_MACRO(loopback, "LOOPBACK");
break;
- case CS_TRANSMIT: /* send/recieve data to/from another channel */
+ case CS_TRANSMIT: /* send/recieve data to/from another channel */
STATE_MACRO(transmit, "TRANSMIT");
break;
- case CS_PARK: /* wait in limbo */
+ case CS_PARK: /* wait in limbo */
STATE_MACRO(park, "PARK");
break;
- case CS_HOLD: /* wait in limbo */
+ case CS_HOLD: /* wait in limbo */
STATE_MACRO(hold, "HOLD");
break;
- case CS_HIBERNATE: /* sleep */
+ case CS_HIBERNATE: /* sleep */
STATE_MACRO(hibernate, "HIBERNATE");
break;
case CS_NONE:
More information about the Freeswitch-svn
mailing list