From 700da9b4deea1441ede913100453d061b2a4cce2 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 13 May 2008 00:50:12 +0000 Subject: [PATCH] don't pass around 0 status (possible fix for MODENDP-107) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8375 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 8 +++++--- src/mod/endpoints/mod_sofia/sofia.c | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 49895ae22a..a3631dbb1e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -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) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4902bee70e..10230d7f8d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -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);