]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add dialplan interfaces to new module loader, add dialplan function helper macro.
authorMichael Jerris <mike@jerris.com>
Wed, 20 Jun 2007 06:14:57 +0000 (06:14 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 20 Jun 2007 06:14:57 +0000 (06:14 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5402 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/mod/applications/mod_enum/mod_enum.c
src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c

index 0064180b78c9f8738b3fbe0bd024622a5b2fa6da..fa54220b528d4f384e39890d98c8587e9a5a4068 100644 (file)
@@ -1040,6 +1040,8 @@ typedef void (*switch_application_function_t) (switch_core_session_t *, char *);
 
 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;
 
index 09f8d578e290e7bc83c6e7fce78c7f1412cb5bc4..72fd62b0f3f1e4bec7ac384da8151015891abd95 100644 (file)
@@ -514,7 +514,7 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t ** result
 }
 
 
-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;
index 9257ce49857036807c6885de75f38035da2ec421..f11a4d5ada773bef47be9d8686b2c39e25aacce2 100644 (file)
@@ -83,7 +83,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_directory_name, globals.directory_n
        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_caller_extension_t *directory_dialplan_hunt(switch_core_session_t
 }
 
 
-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;
index 476647cba7783aadc81a8c0c948888da5c228618..b36a7be0a149738dd76dfcfeb9d09fdd290dfb7c 100644 (file)
@@ -292,7 +292,7 @@ static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switc
        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 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session,
        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;