[asterisk-commits] junky: branch group/res_clialiases r144995 - /team/group/res_clialiases/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 27 12:28:00 CDT 2008


Author: junky
Date: Sat Sep 27 12:28:00 2008
New Revision: 144995

URL: http://svn.digium.com/view/asterisk?view=rev&rev=144995
Log:
add the possibility of loading templates for alias
the template name must be defined in general context
based on that template, the loader will load that cli template.
Regular config template can be used in cli_aliases.conf like usual.


Modified:
    team/group/res_clialiases/res/res_clialiases.c

Modified: team/group/res_clialiases/res/res_clialiases.c
URL: http://svn.digium.com/view/asterisk/team/group/res_clialiases/res/res_clialiases.c?view=diff&rev=144995&r1=144994&r2=144995
==============================================================================
--- team/group/res_clialiases/res/res_clialiases.c (original)
+++ team/group/res_clialiases/res/res_clialiases.c Sat Sep 27 12:28:00 2008
@@ -192,6 +192,7 @@
 	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 	struct cli_alias *alias;
 	struct ast_variable *v;
+	char *template_name = NULL;
 
 	if (!(cfg = ast_config_load(config_file, config_flags))) {
 		ast_log(LOG_ERROR, "res_clialiases configuration file '%s' not found\n", config_file);
@@ -205,8 +206,18 @@
 		ao2_callback(cli_aliases, OBJ_NODATA, alias_mark, NULL);
 	}
 
+        for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
+		if ( !strcmp(v->name,"template") ) {
+			template_name = ast_strdup(v->value);
+		} else {
+			ast_log(LOG_WARNING, "%s is not a correct option in [%s]\n", v->name, "general");
+		}
+        }
+
+
+
 	/* Read in those there CLI aliases */
-	for (v = ast_variable_browse(cfg, "aliases"); v; v = v->next) {
+	for (v = ast_variable_browse(cfg, template_name); v; v = v->next) {
 		if (!(alias = ao2_alloc(sizeof(*alias), alias_destroy))) {
 			continue;
 		}




More information about the asterisk-commits mailing list