[asterisk-commits] elguero: trunk r381749 - in /trunk: channels/ include/asterisk/ main/ res/snmp/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 19 11:17:14 CST 2013


Author: elguero
Date: Tue Feb 19 11:17:10 2013
New Revision: 381749

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381749
Log:
Add The Status Of A Module To The Output Of "CLI> module show"

When a module's configuration is not loadable, we still load the module but it
is not in a running state.  When trying to troubleshoot, let's say, why
chan_motif is ignoring inbound XMPP traffic, there is no way to indicate that a
loaded module is not currently running.

(closes issue ASTERISK-21108)
Reported by: Rusty Newton
Tested by: Michael L. Young
Patches:
  asterisk-21108_add_status-v2.diff Michael L. Young (license 5026)

Review: https://reviewboard.asterisk.org/r/2331/

Modified:
    trunk/channels/chan_motif.c
    trunk/include/asterisk/module.h
    trunk/main/cli.c
    trunk/main/loader.c
    trunk/res/snmp/agent.c

Modified: trunk/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_motif.c?view=diff&rev=381749&r1=381748&r2=381749
==============================================================================
--- trunk/channels/chan_motif.c (original)
+++ trunk/channels/chan_motif.c Tue Feb 19 11:17:10 2013
@@ -2719,7 +2719,7 @@
 	ast_format_cap_add_all_by_type(jingle_tech.capabilities, AST_FORMAT_TYPE_AUDIO);
 
 	if (aco_process_config(&cfg_info, 0)) {
-		ast_log(LOG_ERROR, "Unable to read config file motif.conf. Not loading module.\n");
+		ast_log(LOG_ERROR, "Unable to read config file motif.conf. Module loaded but not running.\n");
 		aco_info_destroy(&cfg_info);
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: trunk/include/asterisk/module.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/module.h?view=diff&rev=381749&r1=381748&r2=381749
==============================================================================
--- trunk/include/asterisk/module.h (original)
+++ trunk/include/asterisk/module.h Tue Feb 19 11:17:10 2013
@@ -110,17 +110,17 @@
  */
 void ast_update_use_count(void);
 
-/*! 
- * \brief Ask for a list of modules, descriptions, and use counts.
+/*!
+ * \brief Ask for a list of modules, descriptions, use counts and status.
  * \param modentry A callback to an updater function.
  * \param like
  *
  * For each of the modules loaded, modentry will be executed with the resource,
  * description, and usecount values of each particular module.
- * 
+ *
  * \return the number of modules loaded
  */
-int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
+int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like),
 			   const char *like);
 
 /*!

Modified: trunk/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cli.c?view=diff&rev=381749&r1=381748&r2=381749
==============================================================================
--- trunk/main/cli.c (original)
+++ trunk/main/cli.c Tue Feb 19 11:17:10 2013
@@ -651,17 +651,17 @@
 	return CLI_SUCCESS;
 }
 
-#define MODLIST_FORMAT  "%-30s %-40.40s %-10d\n"
-#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s\n"
+#define MODLIST_FORMAT  "%-30s %-40.40s %-10d %s\n"
+#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s %s\n"
 
 AST_MUTEX_DEFINE_STATIC(climodentrylock);
 static int climodentryfd = -1;
 
-static int modlist_modentry(const char *module, const char *description, int usecnt, const char *like)
+static int modlist_modentry(const char *module, const char *description, int usecnt, const char *status, const char *like)
 {
 	/* Comparing the like with the module */
 	if (strcasestr(module, like) ) {
-		ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt);
+		ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt, status);
 		return 1;
 	}
 	return 0;
@@ -788,7 +788,7 @@
 
 	ast_mutex_lock(&climodentrylock);
 	climodentryfd = a->fd; /* global, protected by climodentrylock */
-	ast_cli(a->fd, MODLIST_FORMAT2, "Module", "Description", "Use Count");
+	ast_cli(a->fd, MODLIST_FORMAT2, "Module", "Description", "Use Count", "Status");
 	ast_cli(a->fd,"%d modules loaded\n", ast_update_module_list(modlist_modentry, like));
 	climodentryfd = -1;
 	ast_mutex_unlock(&climodentrylock);

Modified: trunk/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/loader.c?view=diff&rev=381749&r1=381748&r2=381749
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Tue Feb 19 11:17:10 2013
@@ -1240,7 +1240,7 @@
 	AST_LIST_UNLOCK(&updaters);
 }
 
-int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
+int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like),
 			   const char *like)
 {
 	struct ast_module *cur;
@@ -1251,7 +1251,8 @@
 		unlock = 0;
 
 	AST_LIST_TRAVERSE(&module_list, cur, entry) {
-		total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount, like);
+		total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount,
+						cur->flags.running ? "Running" : "Not Running", like);
 	}
 
 	if (unlock)

Modified: trunk/res/snmp/agent.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/snmp/agent.c?view=diff&rev=381749&r1=381748&r2=381749
==============================================================================
--- trunk/res/snmp/agent.c (original)
+++ trunk/res/snmp/agent.c Tue Feb 19 11:17:10 2013
@@ -760,7 +760,7 @@
 	return NULL;
 }
 
-static int countmodule(const char *mod, const char *desc, int use, const char *like)
+static int countmodule(const char *mod, const char *desc, int use, const char *status, const char *like)
 {
 	return 1;
 }




More information about the asterisk-commits mailing list