avoiding racelock

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7624 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-02-15 19:48:16 +00:00
parent dd1c14cfa8
commit 1f3edc49dc
3 changed files with 16 additions and 17 deletions

View File

@ -702,7 +702,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_status_t status;
switch_assert(tech_pvt != NULL);
if (switch_channel_get_state(channel) >= CS_HANGUP || !tech_pvt) {
return SWITCH_STATUS_FALSE;
}
if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
const char *var;
@ -755,11 +757,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch_core_session_t *other_session;
switch_channel_t *other_channel;
const char *ip = NULL, *port = NULL;
if (switch_channel_get_state(channel) >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
switch_channel_set_flag(channel, CF_BYPASS_MEDIA);
tech_pvt->local_sdp_str = NULL;
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
@ -792,10 +790,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
{
uint32_t count = 0;
if (switch_channel_get_state(channel) >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
switch_channel_clear_flag(channel, CF_BYPASS_MEDIA);
tech_pvt->local_sdp_str = NULL;
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
@ -975,8 +969,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
case SWITCH_MESSAGE_INDICATE_ANSWER:
sofia_answer_channel(session);
break;
case SWITCH_MESSAGE_INDICATE_PROGRESS:{
if (!switch_test_flag(tech_pvt, TFLAG_ANS)) {
case SWITCH_MESSAGE_INDICATE_PROGRESS:
{
if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_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);

View File

@ -1462,6 +1462,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
goto done;
}
if (status == 183 && !r_sdp) {
status = 180;
}
if (channel && (status == 180 || status == 183) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
const char *val;
if ((val = switch_channel_get_variable(channel, "sip_auto_answer")) && switch_true(val)) {

View File

@ -1084,6 +1084,11 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
{
int ms;
if (!tech_pvt->iananame) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No audio codec available\n");
return SWITCH_STATUS_FALSE;
}
if (tech_pvt->read_codec.implementation) {
if (!force) {
return SWITCH_STATUS_SUCCESS;
@ -1102,11 +1107,6 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
}
}
if (!tech_pvt->iananame) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec with no name?\n");
return SWITCH_STATUS_FALSE;
}
if (switch_core_codec_init(&tech_pvt->read_codec,
tech_pvt->iananame,
tech_pvt->rm_fmtp,