]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
MODSOFIA-57 actually do the hangup handler, skipping sofiasip calls
authorMathieu Rene <mrene@avgs.ca>
Tue, 16 Feb 2010 00:49:42 +0000 (00:49 +0000)
committerMathieu Rene <mrene@avgs.ca>
Tue, 16 Feb 2010 00:49:42 +0000 (00:49 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16655 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index f076bdf2cf6d5bb30ebd9aa404f5b032b8a87071..1b1770ed23969e0d4d871ea75f8c2287778f814e 100644 (file)
@@ -380,14 +380,11 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
        switch_call_cause_t cause = switch_channel_get_cause(channel);
        int sip_cause = hangup_cause_to_sip(cause);
        const char *ps_cause = NULL, *use_my_cause;
-       
-       if (sofia_test_pflag(tech_pvt->profile, PFLAG_DESTROY)) {
-               return SWITCH_STATUS_SUCCESS;
-       }
 
        switch_mutex_lock(tech_pvt->sofia_mutex);
 
        sofia_clear_flag(tech_pvt, TFLAG_RECOVERING);
+
        sofia_glue_tech_untrack(tech_pvt->profile, session, SWITCH_TRUE);
 
        if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
@@ -414,7 +411,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel %s hanging up, cause: %s\n",
                                          switch_channel_get_name(channel), switch_channel_cause2str(cause));
 
-       if (tech_pvt->hash_key) {
+       if (tech_pvt->hash_key && !sofia_test_pflag(tech_pvt->profile, PFLAG_DESTROY)) {
                switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->hash_key);
        }
 
@@ -430,7 +427,9 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                switch_core_session_rwunlock(a_session);
        }
 
-       if (tech_pvt->nh && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+       if (sofia_test_pflag(tech_pvt->profile, PFLAG_DESTROY)) {
+               sofia_set_flag(tech_pvt, TFLAG_BYE);            
+       } else if (tech_pvt->nh && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
                char reason[128] = "";
                char *bye_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_BYE_HEADER_PREFIX);
                const char *val = NULL;
@@ -482,7 +481,6 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                                }
                        }
                }
-
                sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
                switch_safe_free(bye_headers);
        }
index 987e25cbf684a8d330d305331346c77ac7d9cd0e..7929d8e02bdf8708bbc309f4d823afd92f482f6d 100644 (file)
@@ -4701,8 +4701,7 @@ void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bo
 
 switch_cache_db_handle_t *sofia_glue_get_db_handle(sofia_profile_t *profile)
 {
-       switch_cache_db_connection_options_t options = { {0}
-       };
+       switch_cache_db_connection_options_t options = { {0} };
        switch_cache_db_handle_t *dbh = NULL;
 
        if (!zstr(profile->odbc_dsn)) {