[asterisk-commits] russell: branch russell/sla_updates r54525 -
/team/russell/sla_updates/apps/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Feb 14 17:24:52 MST 2007
Author: russell
Date: Wed Feb 14 18:24:52 2007
New Revision: 54525
URL: http://svn.digium.com/view/asterisk?view=rev&rev=54525
Log:
Finish up the parsing of the ringtimeout per-station and per-trunk on a
station. Also, print out these values in the "sla show stations" CLI
command.
Modified:
team/russell/sla_updates/apps/app_meetme.c
Modified: team/russell/sla_updates/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/sla_updates/apps/app_meetme.c?view=diff&rev=54525&r1=54524&r2=54525
==============================================================================
--- team/russell/sla_updates/apps/app_meetme.c (original)
+++ team/russell/sla_updates/apps/app_meetme.c Wed Feb 14 18:24:52 2007
@@ -1032,16 +1032,31 @@
AST_RWLIST_RDLOCK(&sla_stations);
AST_RWLIST_TRAVERSE(&sla_stations, station, entry) {
struct sla_trunk_ref *trunk_ref;
+ char ring_timeout[16] = "(none)";
+ if (station->ring_timeout) {
+ snprintf(ring_timeout, sizeof(ring_timeout),
+ "%u", station->ring_timeout);
+ }
ast_cli(fd, "--- Station Name: %s\n"
"--- ==> Device: %s\n"
"--- ==> AutoContext: %s\n"
+ "--- ==> RingTimeout: %s\n"
"--- ==> Trunks ...\n",
- station->name, station->device,
+ station->name, station->device, ring_timeout,
S_OR(station->autocontext, "(none)"));
AST_RWLIST_RDLOCK(&sla_trunks);
- AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry)
- ast_cli(fd, "--- =====> Trunk Name: %s State: %s\n",
- trunk_ref->trunk->name, trunkstate2str(trunk_ref->state));
+ AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
+ if (trunk_ref->ring_timeout) {
+ snprintf(ring_timeout, sizeof(ring_timeout),
+ "%u", trunk_ref->ring_timeout);
+ } else
+ strcpy(ring_timeout, "(none)");
+ ast_cli(fd, "--- =====> Trunk Name: %s\n",
+ trunk_ref->trunk->name);
+ ast_cli(fd, "--- ========> State: %s\n",
+ trunkstate2str(trunk_ref->state));
+ ast_cli(fd, "--- ========> RingTimeout: %s\n", ring_timeout);
+ }
AST_RWLIST_UNLOCK(&sla_trunks);
ast_cli(fd, "---\n");
}
@@ -3916,7 +3931,7 @@
struct sla_trunk *trunk;
struct sla_trunk_ref *trunk_ref;
struct sla_station_ref *station_ref;
- char *trunk_name, *options;
+ char *trunk_name, *options, *cur;
options = ast_strdupa(var->value);
trunk_name = strsep(&options, ",");
@@ -3926,6 +3941,7 @@
if (!strcasecmp(trunk->name, trunk_name))
break;
}
+
AST_RWLIST_UNLOCK(&sla_trunks);
if (!trunk) {
ast_log(LOG_ERROR, "Trunk '%s' not found!\n", var->value);
@@ -3934,6 +3950,22 @@
if (!(trunk_ref = create_trunk_ref(trunk)))
return;
trunk_ref->state = SLA_TRUNK_STATE_IDLE;
+
+ while ((cur = strsep(&options, ","))) {
+ char *name, *value = cur;
+ name = strsep(&value, "=");
+ if (!strcasecmp(name, "ringtimeout")) {
+ if (sscanf(value, "%u", &trunk_ref->ring_timeout) != 1) {
+ ast_log(LOG_WARNING, "Invalid ringtimeout value '%s' for "
+ "trunk '%s' on station '%s'\n", value, trunk->name, station->name);
+ trunk_ref->ring_timeout = 0;
+ }
+ } else {
+ ast_log(LOG_WARNING, "Invalid option '%s' for "
+ "trunk '%s' on station '%s'\n", name, trunk->name, station->name);
+ }
+ }
+
if (!(station_ref = ast_calloc(1, sizeof(*station_ref)))) {
free(trunk_ref);
return;
More information about the asterisk-commits
mailing list