mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
Adding dialplan function IFMODULE, so you can create dialplans that handle
various PBX installations and checks if a module is loaded before using it. example IFMODULE(chan_sip3.so) issue #6671 in the bug tracker, finally gone. Thanks to mithraen for keeping it updated. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -871,6 +871,26 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr
|
||||
return total_mod_loaded;
|
||||
}
|
||||
|
||||
int ast_module_check(char *name)
|
||||
{
|
||||
struct ast_module *cur;
|
||||
int unlock = -1;
|
||||
int res = 0;
|
||||
|
||||
if (ast_strlen_zero(name))
|
||||
return 0; /* FALSE */
|
||||
|
||||
if (ast_mutex_trylock(&module_list.lock))
|
||||
unlock = 0;
|
||||
AST_LIST_TRAVERSE(&module_list, cur, entry)
|
||||
if (!res && !strcasecmp(name, cur->resource))
|
||||
res = 1;
|
||||
if (unlock)
|
||||
AST_LIST_UNLOCK(&module_list);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int ast_loader_register(int (*v)(void))
|
||||
{
|
||||
struct loadupdate *tmp;
|
||||
|
Reference in New Issue
Block a user