From cbdcbcf87ae214439b91a7fa4471de413119f286 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 26 Oct 2006 20:02:57 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3214 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/Makefile | 2 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/Makefile b/src/mod/endpoints/mod_sofia/Makefile index fc75f03687..edec196d87 100644 --- a/src/mod/endpoints/mod_sofia/Makefile +++ b/src/mod/endpoints/mod_sofia/Makefile @@ -1,6 +1,6 @@ OS_ARCH := $(subst /,_,$(shell uname -s | sed /\ /s//_/)) VERSION = sofia-sip-1.12 -TARBALL = sofia-sip-1.12.3.5.tar.gz +TARBALL = sofia-sip-1.12.3.4.tar.gz CFLAGS += -I. -I$(PREFIX)/include/$(VERSION) LDFLAGS += -lsofia-sip-ua LINKER=$(CC) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 2a90b3dd93..49c470e6d4 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1145,17 +1145,13 @@ static switch_status_t sofia_on_hangup(switch_core_session_t *session) tech_pvt = (private_object_t *) switch_core_session_get_private(session); assert(tech_pvt != NULL); - if (switch_test_flag(tech_pvt, TFLAG_BYE)) { - return SWITCH_STATUS_SUCCESS; - } - cause = switch_channel_get_cause(channel); sip_cause = hangup_cause_to_sip(cause); deactivate_rtp(tech_pvt); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s hanging up, cause: %s\n", - switch_channel_get_name(channel), switch_channel_cause2str(cause), sip_cause); + switch_channel_get_name(channel), switch_channel_cause2str(cause), sip_cause); if (tech_pvt->hash_key) { switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->hash_key); @@ -1181,16 +1177,14 @@ static switch_status_t sofia_on_hangup(switch_core_session_t *session) nua_cancel(tech_pvt->nh, TAG_END()); } } + switch_set_flag_locked(tech_pvt, TFLAG_BYE); } - nua_handle_destroy(tech_pvt->nh); - tech_pvt->nh = NULL; } if (tech_pvt->from_str) { switch_safe_free(tech_pvt->from_str); } - switch_set_flag_locked(tech_pvt, TFLAG_BYE); switch_clear_flag_locked(tech_pvt, TFLAG_IO); if (tech_pvt->home) { @@ -1425,14 +1419,14 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) switch_channel_get_name(channel), tech_pvt->local_sdp_str); nua_respond(tech_pvt->nh, SIP_200_OK, - SIPTAG_CONTACT_STR(tech_pvt->profile->url), + SIPTAG_CONTACT_STR(tech_pvt->profile->url), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END()); } - } + } return SWITCH_STATUS_SUCCESS; } @@ -1877,7 +1871,7 @@ static void logger(void *logarg, char const *fmt, va_list ap) #endif } - switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, (char*) "%s", data); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, (char*) "%s", data); free(data); } @@ -2435,6 +2429,7 @@ static void sip_i_state(int status, switch_channel_set_variable(channel, "endpoint_disposition", "RECEIVED"); switch_channel_set_state(channel, CS_INIT); switch_set_flag_locked(tech_pvt, TFLAG_READY); + //sofia_answer_channel(session);//XXX TMP switch_core_session_thread_launch(session); if (replaces_str && (replaces = sip_replaces_make(tech_pvt->home, replaces_str)) && (bnh = nua_handle_by_replaces(nua, replaces))) { @@ -2573,14 +2568,16 @@ static void sip_i_state(int status, switch_set_flag_locked(tech_pvt, TFLAG_BYE); if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) { switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP); - nua_handle_destroy(tech_pvt->nh); - tech_pvt->nh = NULL; } else { snprintf(st, sizeof(st), "%d", status); switch_channel_set_variable(channel, "sip_term_status", st); terminate_session(&session, sip_cause_to_freeswitch(status), __LINE__); } } + tech_pvt->nh = NULL; + } + if (nh) { + nua_handle_destroy(nh); } break; }