[svn-commits] russell: branch russell/sla_updates r54440 - in
/team/russell/sla_updates: ap...
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Wed Feb 14 11:58:31 MST 2007
Author: russell
Date: Wed Feb 14 12:58:31 2007
New Revision: 54440
URL: http://svn.digium.com/view/asterisk?view=rev&rev=54440
Log:
Parse the "ringtimeout" option from the config, print it out in the
"sla show trunks" cli command, and tweak the output of the commands to be
more .... pretty.
Modified:
team/russell/sla_updates/apps/app_meetme.c
team/russell/sla_updates/configs/sla.conf.sample
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=54440&r1=54439&r2=54440
==============================================================================
--- team/russell/sla_updates/apps/app_meetme.c (original)
+++ team/russell/sla_updates/apps/app_meetme.c Wed Feb 14 12:58:31 2007
@@ -393,7 +393,7 @@
/*! Number of stations that have this trunk on hold. */
unsigned int hold_stations;
struct ast_channel *chan;
- pthread_t station_thread;
+ unsigned int ringtimeout;
};
struct sla_trunk_ref {
@@ -953,25 +953,33 @@
{
const struct sla_trunk *trunk;
- ast_cli(fd, "--- Configured SLA Trunks -----------------------------------\n"
- "-------------------------------------------------------------\n\n");
+ ast_cli(fd, "\n"
+ "--- Configured SLA Trunks -----------------------------------\n"
+ "-------------------------------------------------------------\n"
+ "---\n");
AST_RWLIST_RDLOCK(&sla_trunks);
AST_RWLIST_TRAVERSE(&sla_trunks, trunk, entry) {
struct sla_station_ref *station_ref;
+ char ringtimeout[16] = "(none)";
+ if (trunk->ringtimeout)
+ snprintf(ringtimeout, sizeof(ringtimeout), "%u Seconds", trunk->ringtimeout);
ast_cli(fd, "--- Trunk Name: %s\n"
"--- ==> Device: %s\n"
"--- ==> AutoContext: %s\n"
+ "--- ==> RingTimeout: %s\n"
"--- ==> Stations ...\n",
trunk->name, trunk->device,
- S_OR(trunk->autocontext, "(none)"));
+ S_OR(trunk->autocontext, "(none)"),
+ ringtimeout);
AST_RWLIST_RDLOCK(&sla_stations);
AST_LIST_TRAVERSE(&trunk->stations, station_ref, entry)
ast_cli(fd, "--- =====> Station name: %s\n", station_ref->station->name);
AST_RWLIST_UNLOCK(&sla_stations);
- ast_cli(fd, "\n");
+ ast_cli(fd, "---\n");
}
AST_RWLIST_UNLOCK(&sla_trunks);
- ast_cli(fd, "-------------------------------------------------------------\n");
+ ast_cli(fd, "-------------------------------------------------------------\n"
+ "\n");
return RESULT_SUCCESS;
}
@@ -997,8 +1005,10 @@
{
const struct sla_station *station;
- ast_cli(fd, "--- Configured SLA Stations ---------------------------------\n"
- "-------------------------------------------------------------\n\n");
+ ast_cli(fd, "\n"
+ "--- Configured SLA Stations ---------------------------------\n"
+ "-------------------------------------------------------------\n"
+ "---\n");
AST_RWLIST_RDLOCK(&sla_stations);
AST_RWLIST_TRAVERSE(&sla_stations, station, entry) {
struct sla_trunk_ref *trunk_ref;
@@ -1013,10 +1023,11 @@
ast_cli(fd, "--- =====> Trunk Name: %s State: %s\n",
trunk_ref->trunk->name, trunkstate2str(trunk_ref->state));
AST_RWLIST_UNLOCK(&sla_trunks);
- ast_cli(fd, "\n");
+ ast_cli(fd, "---\n");
}
AST_RWLIST_UNLOCK(&sla_stations);
- ast_cli(fd, "-------------------------------------------------------------\n");
+ ast_cli(fd, "-------------------------------------------------------------\n"
+ "\n");
return RESULT_SUCCESS;
}
@@ -3749,7 +3760,13 @@
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 if (strcasecmp(var->name, "type") && strcasecmp(var->name, "device")) {
+ else if (!strcasecmp(var->name, "ringtimeout")) {
+ if (sscanf(var->value, "%u", &trunk->ringtimeout) != 1) {
+ ast_log(LOG_WARNING, "Invalid ringtimeout '%s' specified for trunk '%s'\n",
+ var->value, trunk->name);
+ trunk->ringtimeout = 0;
+ }
+ } else if (strcasecmp(var->name, "type") && strcasecmp(var->name, "device")) {
ast_log(LOG_ERROR, "Invalid option '%s' specified at line %d of %s!\n",
var->name, var->lineno, SLA_CONFIG_FILE);
}
Modified: team/russell/sla_updates/configs/sla.conf.sample
URL: http://svn.digium.com/view/asterisk/team/russell/sla_updates/configs/sla.conf.sample?view=diff&rev=54440&r1=54439&r2=54440
==============================================================================
--- team/russell/sla_updates/configs/sla.conf.sample (original)
+++ team/russell/sla_updates/configs/sla.conf.sample Wed Feb 14 12:58:31 2007
@@ -23,6 +23,9 @@
; zapata.conf, this device should be configured to have incoming calls go to
; this context.
autocontext=line1
+; Set how long to allow this trunk to ring before hanging it up as an
+; unanswered call. The value is in seconds.
+ringtimeout=30
[line2]
type=trunk
More information about the svn-commits
mailing list