aboutsummaryrefslogtreecommitdiffstats
path: root/main/loader.c
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-30 21:48:41 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-30 21:48:41 +0000
commiteb896134ce40c3124edb593bf9f291f2a2241909 (patch)
tree55bf4b5c1c9abf5a43863e3f5bb7fbf100ff7759 /main/loader.c
parent5eadfaeff549cc20b1602c727922bd8ca58d2968 (diff)
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: http://svn.digium.com/svn/asterisk/trunk@46513 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/loader.c')
-rw-r--r--main/loader.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/main/loader.c b/main/loader.c
index 192cbd894..c0636142a 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -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;