]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't pass around 0 status (possible fix for MODENDP-107)
authorMichael Jerris <mike@jerris.com>
Tue, 13 May 2008 00:50:12 +0000 (00:50 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 13 May 2008 00:50:12 +0000 (00:50 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8375 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c

index 49895ae22ab92a66e83320156940866e196ac895..a3631dbb1e192032e9a4700c5ae061d82764d06c 100644 (file)
@@ -226,9 +226,11 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
        
        if (!switch_strlen_zero(ps_cause) && !strncasecmp(ps_cause, "sip:", 4)) {
                int new_cause = atoi(ps_cause + 4);
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n", 
-                                                 switch_channel_get_name(channel), sip_cause, new_cause);
-               sip_cause = new_cause;
+               if (new_cause) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n", 
+                                                         switch_channel_get_name(channel), sip_cause, new_cause);
+                       sip_cause = new_cause;
+               }
        }
 
        if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
index 4902bee70e40f65521dbf1ec0a6d5cd45b0ee612..10230d7f8deb54c837510674072f3df512fb63d8 100644 (file)
@@ -2106,10 +2106,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                     } else {
                         cause = sofia_glue_sip_cause_to_freeswitch(status);
                     }
-                                       switch_snprintf(st, sizeof(st), "%d", status);
-                                       switch_channel_set_variable(channel, "sip_term_status", st);
-                                       switch_snprintf(st, sizeof(st), "sip:%d", status);
-                                       switch_channel_set_variable_partner(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st);
+                                       if (status) {
+                                               switch_snprintf(st, sizeof(st), "%d", status);
+                                               switch_channel_set_variable(channel, "sip_term_status", st);
+                                               switch_snprintf(st, sizeof(st), "sip:%d", status);
+                                               switch_channel_set_variable_partner(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, st);
+                                       }
                                        switch_snprintf(st, sizeof(st), "%d", cause);
                                        switch_channel_set_variable(channel, "sip_term_cause", st);
                                        switch_channel_hangup(channel, cause);