]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 2 Feb 2008 00:49:25 +0000 (00:49 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 2 Feb 2008 00:49:25 +0000 (00:49 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7489 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index 96e786909c604179205894483f06d0d71e19ca0d..132207f4ccf6152506db6b3c0db5a0302a78f06a 100644 (file)
@@ -280,7 +280,12 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
        if (tech_pvt->nh  && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
                if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
             char reason[128] = "";
-            switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
+            if (cause < 128) {
+                switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
+            } else {
+                switch_snprintf(reason, sizeof(reason), "FreeSWITCH;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
+            }
+
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
                        nua_bye(tech_pvt->nh, SIPTAG_REASON_STR(reason), TAG_END());
                } else {
index 35ab30b211b4dba23cb345ba8d3d7310a3f6548e..7fc55b9d65b6b144a8cad9a269a1a095caeb0397 100644 (file)
@@ -396,6 +396,7 @@ struct private_object {
        char *video_fmtp_out;
        uint32_t video_count;
        sofia_dtmf_t dtmf_type;
+       int q850_cause;
 };
 
 struct callback_t {
index 1b00f1cfc0cf6e6d67a1ddf1887b7585489f736c..b698f5c73c0a0285866e68f8072f5a69b57397bf 100644 (file)
@@ -136,6 +136,15 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
        if (!session) return;
 
        channel = switch_core_session_get_channel(session); 
+
+
+    if (sip->sip_reason && sip->sip_reason->re_protocol && 
+        (!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) &&
+        sip->sip_reason->re_cause) {
+        private_object_t *tech_pvt = switch_core_session_get_private(session);
+        tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
+    }
+
        if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)){
                switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
        }
@@ -1784,8 +1793,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
                                } else {
                     int cause;
-                    if (sip->sip_reason && sip->sip_reason->re_protocol && !strcasecmp(sip->sip_reason->re_protocol, "Q.850") && sip->sip_reason->re_cause) {
-                        cause = atoi(sip->sip_reason->re_cause);
+                    if (tech_pvt->q850_cause) {
+                        cause = tech_pvt->q850_cause;
                     } else {
                         cause = sofia_glue_sip_cause_to_freeswitch(status);
                     }