const switch_dialplan_interface *dialplan_interface;
const switch_codec_interface *codec_interface;
const switch_application_interface *application_interface;
+ const switch_api_interface *api_interface;
};
SWITCH_DECLARE(switch_status) switch_loadable_module_init(void);
SWITCH_DECLARE(switch_dialplan_interface *) loadable_module_get_dialplan_interface(char *name);
SWITCH_DECLARE(switch_timer_interface *) loadable_module_get_timer_interface(char *name);
SWITCH_DECLARE(switch_application_interface *) loadable_module_get_application_interface(char *name);
+SWITCH_DECLARE(switch_application_interface *) loadable_module_get_api_interface(char *name);
SWITCH_DECLARE(int) loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array, int arraylen);
SWITCH_DECLARE(int) loadable_module_get_codecs_sorted(switch_memory_pool *pool, switch_codec_interface **array, int arraylen, char **prefs, int preflen);
SWITCH_DECLARE(void) loadable_module_shutdown(void);
typedef struct switch_dialplan_interface switch_dialplan_interface;
typedef struct switch_codec_interface switch_codec_interface;
typedef struct switch_application_interface switch_application_interface;
+typedef struct switch_api_interface switch_api_interface;
typedef struct switch_core_session switch_core_session;
typedef struct switch_loadable_module_interface switch_loadable_module_interface;
typedef struct switch_caller_profile switch_caller_profile;
switch_hash *dialplan_hash;
switch_hash *timer_hash;
switch_hash *application_hash;
+ switch_hash *api_hash;
switch_memory_pool *pool;
};
switch_core_hash_init(&loadable_modules.codec_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.timer_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.application_hash, loadable_modules.pool);
+ switch_core_hash_init(&loadable_modules.api_hash, loadable_modules.pool);
switch_core_hash_init(&loadable_modules.dialplan_hash, loadable_modules.pool);
while (apr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) {
}
}
+ if (new_module->interface->api_interface) {
+ const switch_api_interface *ptr;
+
+ for(ptr = new_module->interface->api_interface; ptr; ptr = ptr->next) {
+ switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Adding API Function '%s'\n", ptr->interface_name);
+ switch_core_hash_insert(loadable_modules.api_hash,
+ (char *) ptr->interface_name,
+ (void *) ptr);
+ }
+ }
+
}
}
return switch_core_hash_find(loadable_modules.application_hash, name);
}
+SWITCH_DECLARE(switch_application_interface *) loadable_module_get_api_interface(char *name)
+{
+ return switch_core_hash_find(loadable_modules.api_hash, name);
+}
+
SWITCH_DECLARE(int) loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array, int arraylen)
{
apr_hash_index_t* hi;