[Asterisk-code-review] Modules: Fix issues with CLI completion. (asterisk[master])
Corey Farrell
asteriskteam at digium.com
Mon Oct 30 00:37:05 CDT 2017
Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/6933
Change subject: Modules: Fix issues with CLI completion.
......................................................................
Modules: Fix issues with CLI completion.
* Stop using ast_module_helper to check if a module is loaded, use
ast_module_check instead (app_confbridge and app_meetme).
* Stop ast_module_helper from listing reload classes when needsreload
was not requested.
ASTERISK-27378
Change-Id: Iaed8c1e4fcbeb242921dbac7929a0fe75ff4b239
---
M apps/app_confbridge.c
M apps/app_meetme.c
M include/asterisk/module.h
M main/loader.c
4 files changed, 12 insertions(+), 21 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/33/6933/1
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index d218d0f..73dff86 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -2386,21 +2386,12 @@
user.tech_args.drop_silence = 1;
}
- if (ast_test_flag(&user.u_profile, USER_OPT_JITTERBUFFER)) {
- char *func_jb;
- if ((func_jb = ast_module_helper("", "func_jitterbuffer", 0, 0, 0, 0))) {
- ast_free(func_jb);
- ast_func_write(chan, "JITTERBUFFER(adaptive)", "default");
- }
+ if (ast_test_flag(&user.u_profile, USER_OPT_JITTERBUFFER) && ast_module_check("func_jitterbuffer.so")) {
+ ast_func_write(chan, "JITTERBUFFER(adaptive)", "default");
}
- if (ast_test_flag(&user.u_profile, USER_OPT_DENOISE)) {
- char *mod_speex;
- /* Reduce background noise from each participant */
- if ((mod_speex = ast_module_helper("", "codec_speex", 0, 0, 0, 0))) {
- ast_free(mod_speex);
- ast_func_write(chan, "DENOISE(rx)", "on");
- }
+ if (ast_test_flag(&user.u_profile, USER_OPT_DENOISE) && ast_module_check("codec_speex.so")) {
+ ast_func_write(chan, "DENOISE(rx)", "on");
}
/* if this user has a intro, play it before entering */
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 7ca9ba3..5567fe0 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -3198,7 +3198,7 @@
struct timeval now;
struct ast_dsp *dsp = NULL;
struct ast_app *agi_app;
- char *agifile, *mod_speex;
+ char *agifile;
const char *agifiledefault = "conf-background.agi", *tmpvar;
char meetmesecs[30] = "";
char exitcontext[AST_MAX_CONTEXT] = "";
@@ -3588,9 +3588,7 @@
}
/* Reduce background noise from each participant */
- if (!ast_test_flag64(confflags, CONFFLAG_DONT_DENOISE) &&
- (mod_speex = ast_module_helper("", "func_speex", 0, 0, 0, 0))) {
- ast_free(mod_speex);
+ if (!ast_test_flag64(confflags, CONFFLAG_DONT_DENOISE) && ast_module_check("func_speex.so")) {
ast_func_write(chan, "DENOISE(rx)", "on");
}
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index e614a72..3cfc48d 100644
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -200,7 +200,7 @@
/*!
* \brief Check if module with the name given is loaded
* \param name Module name, like "chan_sip.so"
- * \retval 1 if true
+ * \retval 1 if true
* \retval 0 if false
*/
int ast_module_check(const char *name);
diff --git a/main/loader.c b/main/loader.c
index d550007..8250f1f 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -708,8 +708,9 @@
int i, which=0, l = strlen(word);
char *ret = NULL;
- if (pos != rpos)
+ if (pos != rpos) {
return NULL;
+ }
AST_DLLIST_LOCK(&module_list);
AST_DLLIST_TRAVERSE(&module_list, cur, entry) {
@@ -722,10 +723,11 @@
}
AST_DLLIST_UNLOCK(&module_list);
- if (!ret) {
+ if (!ret && needsreload) {
for (i=0; !ret && reload_classes[i].name; i++) {
- if (!strncasecmp(word, reload_classes[i].name, l) && ++which > state)
+ if (!strncasecmp(word, reload_classes[i].name, l) && ++which > state) {
ret = ast_strdup(reload_classes[i].name);
+ }
}
}
--
To view, visit https://gerrit.asterisk.org/6933
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaed8c1e4fcbeb242921dbac7929a0fe75ff4b239
Gerrit-Change-Number: 6933
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171030/759dc6bb/attachment-0001.html>
More information about the asterisk-code-review
mailing list