]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
try to avoid internal routing loops.
authorMichael Jerris <mike@jerris.com>
Mon, 14 Apr 2008 15:55:37 +0000 (15:55 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 14 Apr 2008 15:55:37 +0000 (15:55 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8103 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr.c

index 747f99b94a84920161a840a0c848eb752c760b31..5274c462028378cc66c2782b87df1a972c2b0f5e 100644 (file)
@@ -934,6 +934,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
        switch_core_session_t *other_session;
        switch_channel_t *other_channel = NULL;
        const char *uuid = NULL;
+       const char *max_forwards;
+       const char *forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
+       int forwardval = 70;
+
+       if (!switch_strlen_zero(forwardvar)) {
+               forwardval =  atoi(forwardvar) - 1;
+       }
+       if (forwardval <= 0) {
+               switch_channel_hangup(channel, SWITCH_CAUSE_EXCHANGE_ROUTING_ERROR);
+               return SWITCH_STATUS_FALSE;
+       }
+
+       max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
+       switch_channel_set_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
 
        switch_core_session_reset(session, SWITCH_TRUE);
        switch_channel_clear_flag(channel, CF_ORIGINATING);