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

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5402 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-06-20 06:14:57 +00:00
parent 4e85a86775
commit ee67c1412b
4 changed files with 11 additions and 36 deletions

View 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;

View 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;

View 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;

View 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;