[Freeswitch-svn] [commit] r8103 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Mon Apr 14 11:55:37 EDT 2008


Author: mikej
Date: Mon Apr 14 11:55:37 2008
New Revision: 8103

Modified:
   freeswitch/trunk/src/switch_ivr.c

Log:
try to avoid internal routing loops.

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Mon Apr 14 11:55:37 2008
@@ -934,6 +934,20 @@
 	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);



More information about the Freeswitch-svn mailing list