[asterisk-commits] russell: branch russell/sla_rewrite r51358 -
/team/russell/sla_rewrite/apps/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Jan 20 21:53:42 MST 2007
Author: russell
Date: Sat Jan 20 22:53:41 2007
New Revision: 51358
URL: http://svn.digium.com/view/asterisk?view=rev&rev=51358
Log:
Store the trunks associated with each station in the station struct.
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=51358&r1=51357&r2=51358
==============================================================================
--- team/russell/sla_rewrite/apps/app_meetme.c (original)
+++ team/russell/sla_rewrite/apps/app_meetme.c Sat Jan 20 22:53:41 2007
@@ -320,18 +320,19 @@
AST_LIST_ENTRY(ast_conf_user) list;
};
+struct sla_trunk {
+ AST_RWLIST_ENTRY(sla_trunk) entry;
+ AST_DECLARE_STRING_FIELDS(
+ AST_STRING_FIELD(device);
+ );
+};
+
struct sla_station {
+ AST_RWLIST_ENTRY(sla_station) entry;
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(device);
);
- AST_RWLIST_ENTRY(sla_station) entry;
-};
-
-struct sla_trunk {
- AST_DECLARE_STRING_FIELDS(
- AST_STRING_FIELD(device);
- );
- AST_RWLIST_ENTRY(sla_trunk) entry;
+ AST_LIST_HEAD_NOLOCK(, sla_trunk) trunks;
};
static AST_RWLIST_HEAD_STATIC(sla_stations, sla_station);
@@ -2643,6 +2644,7 @@
static int build_station(struct ast_config *cfg, const char *cat)
{
struct sla_station *station;
+ struct ast_variable *var;
const char *dev;
if (!(dev = ast_variable_retrieve(cfg, cat, "device"))) {
@@ -2654,6 +2656,26 @@
return -1;
ast_string_field_set(station, device, dev);
+
+ for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
+ if (!strcasecmp(var->name, "trunk")) {
+ struct sla_trunk *trunk;
+ AST_RWLIST_RDLOCK(&sla_trunks);
+ AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) {
+ if (!strcasecmp(trunk->device, var->value))
+ break;
+ }
+ AST_RWLIST_UNLOCK(&sla_trunks);
+ if (!trunk) {
+ ast_log(LOG_ERROR, "Trunk '%s' not found!\n", var->value);
+ continue;
+ }
+ AST_LIST_INSERT_TAIL(&station->trunks, trunk, entry);
+ } 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_stations);
AST_RWLIST_INSERT_HEAD(&sla_stations, station, entry);
More information about the asterisk-commits
mailing list