[asterisk-commits] russell: branch russell/sla_updates r56750 - /team/russell/sla_updates/apps/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Feb 25 18:08:22 MST 2007


Author: russell
Date: Sun Feb 25 19:08:21 2007
New Revision: 56750

URL: http://svn.digium.com/view/asterisk?view=rev&rev=56750
Log:
Implement the first step of adding ring delay options.  Get the values from the
config and put them in the right data structures.

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=56750&r1=56749&r2=56750
==============================================================================
--- team/russell/sla_updates/apps/app_meetme.c (original)
+++ team/russell/sla_updates/apps/app_meetme.c Sun Feb 25 19:08:21 2007
@@ -384,6 +384,10 @@
 	 *  is set for a specific trunk on this station, that will take
 	 *  priority over this value. */
 	unsigned int ring_timeout;
+	/*! Ring delay for this station, for any trunk.  If a ring delay
+	 *  is set for a specific trunk on this station, that will take
+	 *  priority over this value. */
+	unsigned int ring_delay;
 };
 
 struct sla_station_ref {
@@ -406,9 +410,6 @@
 	/*! Number of stations that have this trunk on hold. */
 	unsigned int hold_stations;
 	struct ast_channel *chan;
-	/*! Ring timeout to use when this trunk is ringing on this specific
-	 *  station.  This takes higher priority than a ring timeout set at
-	 *  the station level. */
 	unsigned int ring_timeout;
 };
 
@@ -417,7 +418,14 @@
 	struct sla_trunk *trunk;
 	enum sla_trunk_state state;
 	struct ast_channel *chan;
+	/*! Ring timeout to use when this trunk is ringing on this specific
+	 *  station.  This takes higher priority than a ring timeout set at
+	 *  the station level. */
 	unsigned int ring_timeout;
+	/*! Ring delay to use when this trunk is ringing on this specific
+	 *  station.  This takes higher priority than a ring delay set at
+	 *  the station level. */
+	unsigned int ring_delay;
 };
 
 static AST_RWLIST_HEAD_STATIC(sla_stations, sla_station);
@@ -1049,17 +1057,24 @@
 	AST_RWLIST_TRAVERSE(&sla_stations, station, entry) {
 		struct sla_trunk_ref *trunk_ref;
 		char ring_timeout[16] = "(none)";
+		char ring_delay[16] = "(none)";
 		if (station->ring_timeout) {
 			snprintf(ring_timeout, sizeof(ring_timeout), 
 				"%u", station->ring_timeout);
+		}
+		if (station->ring_delay) {
+			snprintf(ring_delay, sizeof(ring_delay), 
+				"%u", station->ring_delay);
 		}
 		ast_cli(fd, "--- Station Name:    %s\n"
 		            "--- ==> Device:      %s\n"
 					"--- ==> AutoContext: %s\n"
 					"--- ==> RingTimeout: %s\n"
+					"--- ==> RingDelay:   %s\n"
 					"--- ==> Trunks ...\n",
 					station->name, station->device,
-					S_OR(station->autocontext, "(none)"), ring_timeout);
+					S_OR(station->autocontext, "(none)"), 
+					ring_timeout, ring_delay);
 		AST_RWLIST_RDLOCK(&sla_trunks);
 		AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
 			if (trunk_ref->ring_timeout) {
@@ -1067,11 +1082,18 @@
 					"%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);
+			if (trunk_ref->ring_delay) {
+				snprintf(ring_delay, sizeof(ring_delay),
+					"%u", trunk_ref->ring_delay);
+			} else
+				strcpy(ring_delay, "(none)");
+			ast_cli(fd, "---    ==> Trunk Name: %s\n"
+			            "---       ==> State:       %s\n"
+			            "---       ==> RingTimeout: %s\n"
+			            "---       ==> RingDelay:   %s\n",
+			            trunk_ref->trunk->name,
+			            trunkstate2str(trunk_ref->state),
+			            ring_timeout, ring_delay);
 		}
 		AST_RWLIST_UNLOCK(&sla_trunks);
 		ast_cli(fd, "---\n");
@@ -4111,6 +4133,12 @@
 					"trunk '%s' on station '%s'\n", value, trunk->name, station->name);
 				trunk_ref->ring_timeout = 0;
 			}
+		} else if (!strcasecmp(name, "ringdelay")) {
+			if (sscanf(value, "%u", &trunk_ref->ring_delay) != 1) {
+				ast_log(LOG_WARNING, "Invalid ringdelay value '%s' for "
+					"trunk '%s' on station '%s'\n", value, trunk->name, station->name);
+				trunk_ref->ring_delay = 0;
+			}
 		} else {
 			ast_log(LOG_WARNING, "Invalid option '%s' for "
 				"trunk '%s' on station '%s'\n", name, trunk->name, station->name);
@@ -4159,6 +4187,12 @@
 				ast_log(LOG_WARNING, "Invalid ringtimeout '%s' specified for station '%s'\n",
 					var->value, station->name);
 				station->ring_timeout = 0;
+			}
+		} else if (!strcasecmp(var->name, "ringdelay")) {
+			if (sscanf(var->value, "%u", &station->ring_delay) != 1) {
+				ast_log(LOG_WARNING, "Invalid ringdelay '%s' specified for station '%s'\n",
+					var->value, station->name);
+				station->ring_delay = 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",



More information about the asterisk-commits mailing list