[Freeswitch-svn] [commit] r7489 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Fri Feb 1 19:49:25 EST 2008


Author: anthm
Date: Fri Feb  1 19:49:25 2008
New Revision: 7489

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c

Log:
update

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Fri Feb  1 19:49:25 2008
@@ -280,7 +280,12 @@
 	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 {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	Fri Feb  1 19:49:25 2008
@@ -396,6 +396,7 @@
 	char *video_fmtp_out;
 	uint32_t video_count;
 	sofia_dtmf_t dtmf_type;
+	int q850_cause;
 };
 
 struct callback_t {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Fri Feb  1 19:49:25 2008
@@ -136,6 +136,15 @@
 	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 @@
 					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);
                     }



More information about the Freeswitch-svn mailing list