[Freeswitch-svn] [commit] r4061 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Fri Jan 26 15:39:45 EST 2007


Author: anthm
Date: Fri Jan 26 15:39:45 2007
New Revision: 4061

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_ivr.c

Log:
fix cause code passthrough

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Fri Jan 26 15:39:45 2007
@@ -779,7 +779,7 @@
 } switch_input_type_t;
 
 typedef enum {
-	SWITCH_CAUSE_UNALLOCATED = 1,
+	SWITCH_CAUSE_UNALLOCATED = 0,
 	SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET = 2,
 	SWITCH_CAUSE_NO_ROUTE_DESTINATION = 3,
 	SWITCH_CAUSE_CHANNEL_UNACCEPTABLE = 6,

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 Jan 26 15:39:45 2007
@@ -1175,7 +1175,6 @@
 // map QSIG cause codes to SIP from RFC4497 section 8.4.1
 static int hangup_cause_to_sip(switch_call_cause_t cause) {
 	switch (cause) {
-	case SWITCH_CAUSE_UNALLOCATED: 
 	case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET:
 	case SWITCH_CAUSE_NO_ROUTE_DESTINATION:
 		return 404;
@@ -2334,7 +2333,7 @@
 	case 404:
 	case 485:
 	case 604:	
-		return SWITCH_CAUSE_UNALLOCATED;
+		return SWITCH_CAUSE_NO_ROUTE_DESTINATION;
 	case 408: 
 	case 504:
 		return SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE;

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Fri Jan 26 15:39:45 2007
@@ -120,7 +120,7 @@
 SWITCH_DECLARE(char *) switch_channel_cause2str(switch_call_cause_t cause)
 {
 	uint8_t x;
-	char *str = "UNALLOCATED";
+	char *str = "UNKNOWN";
 
 	for(x = 0; CAUSE_CHART[x].name; x++) {
 		if (CAUSE_CHART[x].cause == cause) {
@@ -620,7 +620,7 @@
 		channel->state = state;
 		switch_mutex_unlock(channel->flag_mutex);
 
-		if (state == CS_HANGUP && channel->hangup_cause == SWITCH_CAUSE_UNALLOCATED) {
+		if (state == CS_HANGUP && !channel->hangup_cause) {
 			channel->hangup_cause = SWITCH_CAUSE_NORMAL_CLEARING;
 		}
 		if (state < CS_HANGUP) {

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Fri Jan 26 15:39:45 2007
@@ -2881,8 +2881,8 @@
 		}
 
 	done:
-		*cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-
+		*cause = SWITCH_CAUSE_UNALLOCATED;
+        
         if (var_event) {
             switch_event_destroy(&var_event);
         }
@@ -2900,18 +2900,19 @@
 					if (!peer_channels[i]) {
 						continue;
 					}
-				
-					*cause = switch_channel_get_cause(peer_channels[i]);
+                    *cause = switch_channel_get_cause(peer_channels[i]);
 					break;
 				}
 			}
 
-            if (reason != SWITCH_CAUSE_UNALLOCATED) {
-                *cause = reason;
-            } else if (caller_channel) {
-                *cause = switch_channel_get_cause(caller_channel);
-            } else {
-                *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+            if (!*cause) {
+                if (reason) {
+                    *cause = reason;
+                } else if (caller_channel) {
+                    *cause = switch_channel_get_cause(caller_channel);
+                } else {
+                    *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+                }
             }
 
 			if (idx == IDX_CANCEL) {



More information about the Freeswitch-svn mailing list