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

Freeswitch SVN mikej at freeswitch.org
Wed Jun 20 02:14:57 EDT 2007


Author: mikej
Date: Wed Jun 20 02:14:57 2007
New Revision: 5402

Modified:
   freeswitch/trunk/src/include/switch_types.h
   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

Log:
add dialplan interfaces to new module loader, add dialplan function helper macro.

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Wed Jun 20 02:14:57 2007
@@ -1040,6 +1040,8 @@
 
 typedef void (*switch_event_callback_t) (switch_event_t *);
 typedef switch_caller_extension_t *(*switch_dialplan_hunt_function_t) (switch_core_session_t *, void *, switch_caller_profile_t *);
+#define SWITCH_STANDARD_DIALPLAN(name) static switch_caller_extension_t * name (switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+
 
 typedef struct switch_scheduler_task switch_scheduler_task_t;
 

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	Wed Jun 20 02:14:57 2007
@@ -514,7 +514,7 @@
 }
 
 
-static switch_caller_extension_t *enum_dialplan_hunt(switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+SWITCH_STANDARD_DIALPLAN(enum_dialplan_hunt)
 {
 	switch_caller_extension_t *extension = NULL;
 	enum_record_t *results, *rp;

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	Wed Jun 20 02:14:57 2007
@@ -83,7 +83,7 @@
 	switch_xml_free(xml);
 }
 
-static switch_caller_extension_t *directory_dialplan_hunt(switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+SWITCH_STANDARD_DIALPLAN(directory_dialplan_hunt)
 {
 	switch_caller_extension_t *extension = NULL;
 	switch_channel_t *channel;
@@ -151,27 +151,14 @@
 }
 
 
-static switch_dialplan_interface_t directory_dialplan_interface = {
-	/*.interface_name = */ "directory",
-	/*.hunt_function = */ directory_dialplan_hunt
-		/*.next = NULL */
-};
-
-static switch_loadable_module_interface_t directory_dialplan_module_interface = {
-	/*.module_name = */ modname,
-	/*.endpoint_interface = */ NULL,
-	/*.timer_interface = */ NULL,
-	/*.dialplan_interface = */ &directory_dialplan_interface,
-	/*.codec_interface = */ NULL,
-	/*.application_interface = */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_directory_load)
 {
+	switch_dialplan_interface_t *dp_interface;
 
 	load_config();
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &directory_dialplan_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_DIALPLAN(dp_interface, "directory", directory_dialplan_hunt);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

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	Wed Jun 20 02:14:57 2007
@@ -292,7 +292,7 @@
 	return status;
 }
 
-static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+SWITCH_STANDARD_DIALPLAN(dialplan_hunt)
 {
 	switch_caller_extension_t *extension = NULL;
 	switch_channel_t *channel;
@@ -377,27 +377,13 @@
 	return extension;
 }
 
-
-static switch_dialplan_interface_t dialplan_interface = {
-	/*.interface_name = */ "XML",
-	/*.hunt_function = */ dialplan_hunt
-		/*.next = NULL */
-};
-
-static switch_loadable_module_interface_t dialplan_module_interface = {
-	/*.module_name = */ modname,
-	/*.endpoint_interface = */ NULL,
-	/*.timer_interface = */ NULL,
-	/*.dialplan_interface = */ &dialplan_interface,
-	/*.codec_interface = */ NULL,
-	/*.application_interface = */ NULL
-};
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_xml_load)
 {
+	switch_dialplan_interface_t *dp_interface;
 
 	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = &dialplan_module_interface;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	SWITCH_ADD_DIALPLAN(dp_interface, "XML", dialplan_hunt);
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;



More information about the Freeswitch-svn mailing list