]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix cause code passthrough
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 26 Jan 2007 20:39:45 +0000 (20:39 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 26 Jan 2007 20:39:45 +0000 (20:39 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4061 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_channel.c
src/switch_ivr.c

index 4262f90b77057a9283bf873bc4cb82ce7d66b69b..0215a53ba7aae3218e071c780907c91281e32772 100644 (file)
@@ -779,7 +779,7 @@ typedef enum {
 } 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,
index 56647111bba5bcfe3c1539874779089cd43a4c8f..3971141a38011acb6abd9bc8d942f9796d10c968 100644 (file)
@@ -1175,7 +1175,6 @@ static switch_status_t sofia_on_execute(switch_core_session_t *session)
 // 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 @@ static switch_call_cause_t sip_cause_to_freeswitch(int status) {
        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;
index 82c080719bc9488f0c190f301b308a737be90fac..c69cd810e70095439d9cb721688f3495bc36169d 100644 (file)
@@ -120,7 +120,7 @@ struct switch_channel {
 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 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c
                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) {
index d243166cb351cff3189bdd8582cc6e687a9fcff3..7774042b45485ca064120d16b58b85f25b20c064 100644 (file)
@@ -2881,8 +2881,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                }
 
        done:
-               *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-
+               *cause = SWITCH_CAUSE_UNALLOCATED;
+        
         if (var_event) {
             switch_event_destroy(&var_event);
         }
@@ -2900,18 +2900,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                        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) {