[Freeswitch-svn] [commit] r3746 - in freeswitch/trunk/src: . mod/applications/mod_enum mod/dialplans/mod_dialplan_directory mod/dialplans/mod_dialplan_xml

Freeswitch SVN anthm at freeswitch.org
Tue Dec 19 21:49:28 EST 2006


Author: anthm
Date: Tue Dec 19 21:49:26 2006
New Revision: 3746

Modified:
   freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
   freeswitch/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
   freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
   freeswitch/trunk/src/switch_core.c

Log:
fix dialplan stack

Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	Tue Dec 19 21:49:26 2006
@@ -549,10 +549,7 @@
 
 	if (extension) {
         switch_channel_set_state(channel, CS_EXECUTE);
-    } else {
-        switch_channel_hangup(channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
     }
-
 
 	return extension;
 

Modified: freeswitch/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
==============================================================================
--- freeswitch/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	(original)
+++ freeswitch/trunk/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	Tue Dec 19 21:49:26 2006
@@ -150,8 +150,6 @@
 	
 	if (extension) {
 		switch_channel_set_state(channel, CS_EXECUTE);
-	} else {
-		switch_channel_hangup(channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
 	}
 
 	return extension;

Modified: freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	(original)
+++ freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	Tue Dec 19 21:49:26 2006
@@ -290,7 +290,6 @@
         
 	if (switch_xml_locate("dialplan", NULL, NULL, NULL, &xml, &cfg, stream.data) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of dialplan failed\n");
-		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		return NULL;
 	}
 	
@@ -300,7 +299,6 @@
 	if (!(xcontext = switch_xml_find_child(cfg, "context", "name", context))) {
 		if (!(xcontext = switch_xml_find_child(cfg, "context", "name", "global"))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "context %s not found\n", context);
-			switch_channel_hangup(channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
 			switch_xml_free(xml);
 			return NULL;
 		}
@@ -328,8 +326,6 @@
 
 	if (extension) {
 		switch_channel_set_state(channel, CS_EXECUTE);
-	} else {
-		switch_channel_hangup(channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
 	}
 
 	return extension;

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Tue Dec 19 21:49:26 2006
@@ -2617,45 +2617,50 @@
 {
 	switch_dialplan_interface_t *dialplan_interface = NULL;
 	switch_caller_profile_t *caller_profile;
-	switch_caller_extension_t *extension;
+	switch_caller_extension_t *extension = NULL;
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RING %s\n", switch_channel_get_name(session->channel));
 
 	if ((caller_profile = switch_channel_get_caller_profile(session->channel)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't get profile!\n");
 		switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+        return;
 	} else {
 		char *dp[25];
+        char *dpstr;
 		int argc, x, count = 0;
 
 		if (!switch_strlen_zero(caller_profile->dialplan)) {
-			argc = switch_separate_string(caller_profile->dialplan, ',', dp, (sizeof(dp) / sizeof(dp[0]))); 
-			for (x = 0; x < argc; x++) {
-				if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dp[x]))) {
-					continue;
-				}
+            if ((dpstr = switch_core_session_strdup(session, caller_profile->dialplan))) {
+                argc = switch_separate_string(dpstr, ',', dp, (sizeof(dp) / sizeof(dp[0]))); 
+                for (x = 0; x < argc; x++) {
+                    if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dp[x]))) {
+                        continue;
+                    }
 
-				count++;
+                    count++;
 
-				if ((extension = dialplan_interface->hunt_function(session)) != 0) {
-					switch_channel_set_caller_extension(session->channel, extension);
-					break;
-				}
-			}
-		}
+                    if ((extension = dialplan_interface->hunt_function(session)) != 0) {
+                        switch_channel_set_caller_extension(session->channel, extension);
+                        return;
+                    }
+                }
+            }
+        }
 
 		if (!count) {
 			if (switch_channel_test_flag(session->channel, CF_OUTBOUND)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No Dialplan, changing state to HOLD\n");
 				switch_channel_set_state(session->channel, CS_HOLD);
 				return;
-			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No Dialplan, Aborting\n");
-				switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
-			}
+			} 
 		}
 	}
-	
+
+	if (!extension) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No Route, Aborting\n");
+        switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
+    }
 }
 
 static void switch_core_standard_on_execute(switch_core_session_t *session)



More information about the Freeswitch-svn mailing list