[asterisk-commits] russell: branch russell/sla_rewrite r51458 - /team/russell/sla_rewrite/apps/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jan 22 14:15:14 MST 2007


Author: russell
Date: Mon Jan 22 15:15:13 2007
New Revision: 51458

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51458
Log:
read the "autocontext" option from sla.conf

Modified:
    team/russell/sla_rewrite/apps/app_meetme.c

Modified: team/russell/sla_rewrite/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/sla_rewrite/apps/app_meetme.c?view=diff&rev=51458&r1=51457&r2=51458
==============================================================================
--- team/russell/sla_rewrite/apps/app_meetme.c (original)
+++ team/russell/sla_rewrite/apps/app_meetme.c Mon Jan 22 15:15:13 2007
@@ -335,6 +335,7 @@
 	AST_DECLARE_STRING_FIELDS(
 		AST_STRING_FIELD(name);
 		AST_STRING_FIELD(device);
+		AST_STRING_FIELD(autocontext);	
 	);
 };
 
@@ -348,6 +349,7 @@
 	AST_DECLARE_STRING_FIELDS(
 		AST_STRING_FIELD(name);	
 		AST_STRING_FIELD(device);	
+		AST_STRING_FIELD(autocontext);	
 	);
 	AST_LIST_HEAD_NOLOCK(, sla_trunk_ref) trunks;
 };
@@ -843,9 +845,11 @@
 	            "-------------------------------------------------------------\n\n");
 	AST_RWLIST_RDLOCK(&sla_trunks);
 	AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) {
-		ast_cli(fd, "--- Trunk Name: %s\n"
-		            "--- ==> Device: %s\n\n", 
-					trunk->name, trunk->device);
+		ast_cli(fd, "--- Trunk Name:      %s\n"
+		            "--- ==> Device:      %s\n"
+					"--- ==> AutoContext: %s\n\n", 
+					trunk->name, trunk->device, 
+					S_OR(trunk->autocontext, "(none)"));
 	}
 	AST_RWLIST_UNLOCK(&sla_trunks);
 	ast_cli(fd, "-------------------------------------------------------------\n");
@@ -866,10 +870,12 @@
 	AST_RWLIST_RDLOCK(&sla_stations);
 	AST_RWLIST_TRAVERSE(&sla_stations, station, entry) {
 		struct sla_trunk_ref *trunk_ref;
-		ast_cli(fd, "--- Station Name: %s\n"
-		            "--- ==> Device:   %s\n"
+		ast_cli(fd, "--- Station Name:    %s\n"
+		            "--- ==> Device:      %s\n"
+					"--- ==> AutoContext: %s\n"
 					"--- ==> Trunks ...\n",
-					station->name, station->device);
+					station->name, station->device, 
+					S_OR(station->autocontext, "(none)"));
 		AST_RWLIST_RDLOCK(&sla_trunks);
 		AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry)
 			ast_cli(fd, "--- =====> Trunk Name: %s\n", trunk_ref->trunk->name);
@@ -2713,6 +2719,7 @@
 static int build_trunk(struct ast_config *cfg, const char *cat)
 {
 	struct sla_trunk *trunk;
+	struct ast_variable *var;
 	const char *dev;
 
 	if (!(dev = ast_variable_retrieve(cfg, cat, "device"))) {
@@ -2729,6 +2736,15 @@
 
 	ast_string_field_set(trunk, name, cat);
 	ast_string_field_set(trunk, device, dev);
+
+	for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
+		if (!strcasecmp(var->name, "autocontext"))
+			ast_string_field_set(trunk, autocontext, var->value);
+		else {
+			ast_log(LOG_ERROR, "Invalid option '%s' specified at line %d of %s!\n",
+				var->name, var->lineno, SLA_CONFIG_FILE);
+		}
+	}
 
 	AST_RWLIST_WRLOCK(&sla_trunks);
 	AST_RWLIST_INSERT_HEAD(&sla_trunks, trunk, entry);
@@ -2776,6 +2792,8 @@
 				continue;
 			trunk_ref->trunk = trunk;
 			AST_LIST_INSERT_TAIL(&station->trunks, trunk_ref, entry);
+		} else if (!strcasecmp(var->name, "autocontext")) {
+			ast_string_field_set(station, autocontext, var->value);
 		} else {
 			ast_log(LOG_ERROR, "Invalid option '%s' specified at line %d of %s!\n",
 				var->name, var->lineno, SLA_CONFIG_FILE);



More information about the asterisk-commits mailing list