From 809166ff7876d6afef514dd4c627dd4670645d4b Mon Sep 17 00:00:00 2001
From: James Golovich <james@gnuinter.net>
Date: Sat, 2 Oct 2004 15:01:37 +0000
Subject: [PATCH] Allow PRI timers to be congfigurable.  (bug 2518)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3882 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_zap.c        | 28 +++++++++++++++++++++++++++-
 configs/zapata.conf.sample |  7 +++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index ec722be600..b88baaa79c 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -244,6 +244,7 @@ static char idleext[AST_MAX_EXTENSION];
 static char idledial[AST_MAX_EXTENSION];
 static int overlapdial = 0;
 static struct ast_channel inuse = { "GR-303InUse" };
+static int pritimers[PRI_MAX_TIMERS];
 #endif
 
 /* Wait up to 16 seconds for first digit (FXO logic) */
@@ -8101,6 +8102,12 @@ static int start_pri(struct zt_pri *pri)
 		}
 		pri_set_debug(pri->dchans[i], DEFAULT_PRI_DEBUG);
 		pri_set_nsf(pri->dchans[i], pri->nsf);
+#ifdef PRI_GETSET_TIMERS
+		for (x = 0; x < PRI_MAX_TIMERS; x++) {
+			if (pritimers[x] != 0)
+				pri_set_timer(pri->dchans[i], x, pritimers[x]);
+		}
+#endif
 	}
 	/* Assume primary is the one we use */
 	pri->pri = pri->dchans[0];
@@ -9496,7 +9503,26 @@ static int setup_zap(void)
 			strncpy(idledial, v->value, sizeof(idledial) - 1);
 		} else if (!strcasecmp(v->name, "overlapdial")) {
 			overlapdial = ast_true(v->value);
-#endif		
+		} else if (!strcasecmp(v->name, "pritimer")) {
+#ifdef PRI_GETSET_TIMERS
+			char *timerc;
+			int timer, timeridx;
+			c = v->value;
+			timerc = strsep(&c, ",");
+			if (timerc) {
+				timer = atoi(c);
+				if (!timer)
+					ast_log(LOG_WARNING, "'%s' is not a valid value for an ISDN timer\n", timerc);
+				else {
+					if ((timeridx = pri_timer2idx(timerc)))
+						pritimers[timeridx] = timer;
+					else
+						ast_log(LOG_WARNING, "'%s' is not a valid ISDN timer\n", timerc);
+				}
+			} else
+				ast_log(LOG_WARNING, "'%s' is not a valid ISDN timer configuration string\n", v->value);
+#endif /* PRI_GETSET_TIMERS */
+#endif /* ZAPATA_PRI */
 		} else if (!strcasecmp(v->name, "cadence")) {
 			/* setup to scan our argument */
 			int element_count, c[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
diff --git a/configs/zapata.conf.sample b/configs/zapata.conf.sample
index c692a27b86..aef8df6f5b 100755
--- a/configs/zapata.conf.sample
+++ b/configs/zapata.conf.sample
@@ -90,6 +90,13 @@ switchtype=national
 ;
 ; priindication = outofband
 ;
+; ISDN Timers
+; All of the ISDN timers and counters that are used are configurable.  Specify 
+; the timer name, and its value (in ms for timers)
+;
+; pritimer => t200,1000
+; pritimer => t313,4000
+;
 ;
 ; Signalling method (default is fxs).  Valid values:
 ; em:      E & M
-- 
GitLab