[asterisk-commits] dhubbard: trunk r51273 - in /trunk: ./ channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 18 17:06:36 MST 2007


Author: dhubbard
Date: Thu Jan 18 18:06:35 2007
New Revision: 51273

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51273
Log:
Merged revisions 51272 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r51272 | dhubbard | 2007-01-18 17:56:49 -0600 (Thu, 18 Jan 2007) | 11 lines

Merged revisions 51271 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51271 | dhubbard | 2007-01-18 17:47:10 -0600 (Thu, 18 Jan 2007) | 3 lines

issue 7877: chan_zap module reload does not use default/initialized values on subsequent loads.  Reset configuration variables to default values prior to parsing configuration file.


........

................

Modified:
    trunk/   (props changed)
    trunk/channels/chan_zap.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=51273&r1=51272&r2=51273
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Thu Jan 18 18:06:35 2007
@@ -209,119 +209,18 @@
 
 #define DCHAN_AVAILABLE	(DCHAN_PROVISIONED | DCHAN_NOTINALARM | DCHAN_UP)
 
-static char context[AST_MAX_CONTEXT] = "default";
-static char cid_num[256] = "";
-static char cid_name[256] = "";
 static char defaultcic[64] = "";
 static char defaultozz[64] = "";
 
 static char language[MAX_LANGUAGE] = "";
-static char mohinterpret[MAX_MUSICCLASS] = "default";
-static char mohsuggest[MAX_MUSICCLASS] = "";
 static char progzone[10] = "";
 
 static int usedistinctiveringdetection = 0;
 static int distinctiveringaftercid = 0;
 
-static int transfertobusy = 1;
-
-static int use_callerid = 1;
-static int cid_signalling = CID_SIG_BELL;
-static int cid_start = CID_START_RING;
-static int zaptrcallerid = 0;
-static int cur_radio = 0;
-static int cur_signalling = -1;
-static int cur_outsignalling = -1;
-
-static ast_group_t cur_group = 0;
-static ast_group_t cur_callergroup = 0;
-static ast_group_t cur_pickupgroup = 0;
-static int relaxdtmf = 0;
-
-static int immediate = 0;
-
-static int stripmsd = 0;
-
-static int callwaiting = 0;
-
-static int callwaitingcallerid = 0;
-
-static int hidecallerid = 0;
-
-static int hidecalleridname = 0;
-
-static int restrictcid = 0;
-
-static int use_callingpres = 0;
-
-static int callreturn = 0;
-
-static int threewaycalling = 0;
-
-static int transfer = 0;
-
-static int canpark = 0;
-
-static int cancallforward = 0;
-
-static float rxgain = 0.0;
-
-static float txgain = 0.0;
-
-static int tonezone = -1;
-
-static int echocancel;
-
-static int echotraining;
-
-static int pulse;
-
-static int echocanbridged = 0;
-
-static int busydetect = 0;
-
-static int busycount = 3;
-static int busy_tonelength = 0;
-static int busy_quietlength = 0;
-
-static int callprogress = 0;
-
-static char accountcode[AST_MAX_ACCOUNT_CODE] = "";
-
-static char mailbox[AST_MAX_EXTENSION];
-
-static int amaflags = 0;
-
-static int adsi = 0;
-static int use_smdi = 0;
-static char smdi_port[SMDI_MAX_FILENAME_LEN] = "/dev/ttyS0";
 static int numbufs = 4;
 
-static int cur_prewink = -1;
-static int cur_preflash = -1;
-static int cur_wink = -1;
-static int cur_flash = -1;
-static int cur_start = -1;
-static int cur_rxwink = -1;
-static int cur_rxflash = -1;
-static int cur_debounce = -1;
-static int cur_priexclusive = 0;
-
-static int priindication_oob = 0;
-
 #ifdef HAVE_PRI
-static int minunused = 2;
-static int minidle = 0;
-static char idleext[AST_MAX_EXTENSION];
-static char idledial[AST_MAX_EXTENSION];
-static int overlapdial = 0;
-static int facilityenable = 0;
-static char internationalprefix[10] = "";
-static char nationalprefix[10] = "";
-static char localprefix[20] = "";
-static char privateprefix[20] = "";
-static char unknownprefix[20] = "";
-static long resetinterval = 3600;	/*!< How often (in seconds) to reset unused channels. Default 1 hour. */
 static struct ast_channel inuse;
 #ifdef PRI_GETSET_TIMERS
 static int pritimers[PRI_MAX_TIMERS];
@@ -348,18 +247,6 @@
 #ifdef HAVE_PRI
 AST_MUTEX_DEFINE_STATIC(pridebugfdlock);
 #endif
-
-/*! \brief Whether we answer on a Polarity Switch event */
-static int answeronpolarityswitch = 0;
-
-/*! \brief Whether we hang up on a Polarity Switch event */
-static int hanguponpolarityswitch = 0;
-
-/*! \brief How long (ms) to ignore Polarity Switch events after we answer a call */
-static int polarityonanswerdelay = 600;
-
-/*! \brief When to send the CallerID signals (rings) */
-static int sendcalleridafter = DEFAULT_CIDRINGS;
 
 /*! \brief Protect the monitoring thread, so only one process can kill or start it, and not
    when it's doing something critical. */
@@ -497,8 +384,6 @@
 
 static struct zt_pri pris[NUM_SPANS];
 
-static int pritype = PRI_CPE;
-
 #if 0
 #define DEFAULT_PRI_DEBUG (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_STATE)
 #else
@@ -509,11 +394,6 @@
 {
 	ast_mutex_unlock(&pri->lock);
 }
-
-static int switchtype = PRI_SWITCH_NI2;
-static int nsf = PRI_NSF_NONE;
-static int dialplan = PRI_NATIONAL_ISDN + 1;
-static int localdialplan = PRI_NATIONAL_ISDN + 1;
 
 #else
 /*! Shut up the compiler */
@@ -749,6 +629,97 @@
 #endif
 	char begindigit;
 } *iflist = NULL, *ifend = NULL;
+
+/*! \brief Channel configuration from zapata.conf .
+ * This struct is used for parsing the [channels] section of zapata.conf.
+ * Generally there is a field here for every possible configuration item.
+ *
+ * The state of fields is saved along the parsing and whenever a 'channel'
+ * statement is reached, the current zt_chan_conf is used to configure the 
+ * channel (struct zt_pvt)
+ *
+ * @seealso zt_chan_init for the default values.
+ */
+struct zt_chan_conf {
+	struct zt_pvt chan;
+	struct zt_pri pri;
+	ZT_PARAMS timing;
+
+	char smdi_port[SMDI_MAX_FILENAME_LEN];
+};
+
+/** returns a new zt_chan_conf with default values (by-value) */
+static struct zt_chan_conf zt_chan_conf_default(void) {
+	/* recall that if a field is not included here it is initialized
+	 * to 0 or equivalent
+	 */
+	struct zt_chan_conf conf = {
+		.pri = {
+#ifdef HAVE_PRI
+			.nsf = PRI_NSF_NONE,
+			.switchtype = PRI_SWITCH_NI2,
+			.dialplan = PRI_NATIONAL_ISDN + 1,
+			.localdialplan = PRI_NATIONAL_ISDN + 1,
+			.nodetype = PRI_CPE,
+
+			.minunused = 2,
+			.idleext = "",
+			.idledial = "",
+			.internationalprefix = "",
+			.nationalprefix = "",
+			.localprefix = "",
+			.privateprefix = "",
+			.unknownprefix = "",
+
+			.resetinterval = 3600
+#endif
+		},
+		.chan = {
+			.context = "default",
+			.cid_num = "",
+			.cid_name = "",
+			.mohinterpret = "default",
+			.mohsuggest = "",
+			.transfertobusy = 1,
+
+			.cid_signalling = CID_SIG_BELL,
+			.cid_start = CID_START_RING,
+			.zaptrcallerid = 0,
+			.use_callerid = 1,
+			.sig = -1,
+			.outsigmod = -1,
+
+			.tonezone = -1,
+
+			.echocancel = 1,
+
+			.busycount = 3,
+
+			.accountcode = "",
+
+			.mailbox = "",
+
+
+			.polarityonanswerdelay = 600,
+
+			.sendcalleridafter = DEFAULT_CIDRINGS
+		},
+		.timing = {
+			.prewinktime = -1,
+			.preflashtime = -1,
+			.winktime = -1,
+			.flashtime = -1,
+			.starttime = -1,
+			.rxwinktime = -1,
+			.rxflashtime = -1,
+			.debouncetime = -1
+		},
+		.smdi_port = "/dev/ttyS0",
+	};
+
+	return conf;
+}
+
 
 static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause);
 static int zt_digit_begin(struct ast_channel *ast, char digit);
@@ -7445,7 +7416,7 @@
 }
 #endif /* HAVE_SS7 */
 
-static struct zt_pvt *mkintf(int channel, int signalling, int outsignalling, int radio, struct zt_pri *pri, int reloading)
+static struct zt_pvt *mkintf(int channel, struct zt_chan_conf conf, struct zt_pri *pri, int reloading)
 {
 	/* Make a zt_pvt structure for this interface (or CRV if "pri" is specified) */
 	struct zt_pvt *tmp = NULL, *tmp2,  *prev = NULL;
@@ -7522,8 +7493,8 @@
 					destroy_zt_pvt(&tmp);
 					return NULL;
 				}
-				if (p.sigtype != (signalling & 0x3ffff)) {
-					ast_log(LOG_ERROR, "Signalling requested on channel %d is %s but line is in %s signalling\n", channel, sig2str(signalling), sig2str(p.sigtype));
+				if (p.sigtype != (conf.chan.sig & 0x3ffff)) {
+					ast_log(LOG_ERROR, "Signalling requested on channel %d is %s but line is in %s signalling\n", channel, sig2str(conf.chan.sig), sig2str(p.sigtype));
 					destroy_zt_pvt(&tmp);
 					return NULL;
 				}
@@ -7532,14 +7503,14 @@
 				span = p.spanno - 1;
 			} else {
 				if (channel == CHAN_PSEUDO)
-					signalling = 0;
-				else if ((signalling != SIG_FXOKS) && (signalling != SIG_FXSKS)) {
+					conf.chan.sig = 0;
+				else if ((conf.chan.sig != SIG_FXOKS) && (conf.chan.sig != SIG_FXSKS)) {
 					ast_log(LOG_ERROR, "CRV's must use FXO/FXS Kewl Start (fxo_ks/fxs_ks) signalling only.\n");
 					return NULL;
 				}
 			}
 #ifdef HAVE_SS7
-			if (signalling == SIG_SS7) {
+			if (conf.chan.sig == SIG_SS7) {
 				struct zt_ss7 *ss7;
 				int clear = 0;
 				if (ioctl(tmp->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &clear)) {
@@ -7568,13 +7539,13 @@
 			}
 #endif
 #ifdef HAVE_PRI
-			if ((signalling == SIG_PRI) || (signalling == SIG_GR303FXOKS) || (signalling == SIG_GR303FXSKS)) {
+			if ((conf.chan.sig == SIG_PRI) || (conf.chan.sig == SIG_GR303FXOKS) || (conf.chan.sig == SIG_GR303FXSKS)) {
 				int offset;
 				int myswitchtype;
 				int matchesdchan;
 				int x,y;
 				offset = 0;
-				if ((signalling == SIG_PRI) && ioctl(tmp->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &offset)) {
+				if ((conf.chan.sig == SIG_PRI) && ioctl(tmp->subs[SUB_REAL].zfd, ZT_AUDIOMODE, &offset)) {
 					ast_log(LOG_ERROR, "Unable to set clear mode on clear channel %d of span %d: %s\n", channel, p.spanno, strerror(errno));
 					destroy_zt_pvt(&tmp);
 					return NULL;
@@ -7598,8 +7569,8 @@
 						destroy_zt_pvt(&tmp);
 						return NULL;
 					}
-					if (signalling == SIG_PRI)
-						myswitchtype = switchtype;
+					if (conf.chan.sig == SIG_PRI)
+						myswitchtype = conf.pri.switchtype;
 					else
 						myswitchtype = PRI_SWITCH_GR303_TMC;
 					/* Make sure this isn't a d-channel */
@@ -7614,7 +7585,7 @@
 					}
 					offset = p.chanpos;
 					if (!matchesdchan) {
-						if (pris[span].nodetype && (pris[span].nodetype != pritype)) {
+						if (pris[span].nodetype && (pris[span].nodetype != conf.pri.nodetype)) {
 							ast_log(LOG_ERROR, "Span %d is already a %s node\n", span + 1, pri_node2str(pris[span].nodetype));
 							destroy_zt_pvt(&tmp);
 							return NULL;
@@ -7624,28 +7595,28 @@
 							destroy_zt_pvt(&tmp);
 							return NULL;
 						}
-						if ((pris[span].dialplan) && (pris[span].dialplan != dialplan)) {
+						if ((pris[span].dialplan) && (pris[span].dialplan != conf.pri.dialplan)) {
 							ast_log(LOG_ERROR, "Span %d is already a %s dialing plan\n", span + 1, dialplan2str(pris[span].dialplan));
 							destroy_zt_pvt(&tmp);
 							return NULL;
 						}
-						if (!ast_strlen_zero(pris[span].idledial) && strcmp(pris[span].idledial, idledial)) {
-							ast_log(LOG_ERROR, "Span %d already has idledial '%s'.\n", span + 1, idledial);
+						if (!ast_strlen_zero(pris[span].idledial) && strcmp(pris[span].idledial, conf.pri.idledial)) {
+							ast_log(LOG_ERROR, "Span %d already has idledial '%s'.\n", span + 1, conf.pri.idledial);
 							destroy_zt_pvt(&tmp);
 							return NULL;
 						}
-						if (!ast_strlen_zero(pris[span].idleext) && strcmp(pris[span].idleext, idleext)) {
-							ast_log(LOG_ERROR, "Span %d already has idleext '%s'.\n", span + 1, idleext);
+						if (!ast_strlen_zero(pris[span].idleext) && strcmp(pris[span].idleext, conf.pri.idleext)) {
+							ast_log(LOG_ERROR, "Span %d already has idleext '%s'.\n", span + 1, conf.pri.idleext);
 							destroy_zt_pvt(&tmp);
 							return NULL;
 						}
-						if (pris[span].minunused && (pris[span].minunused != minunused)) {
-							ast_log(LOG_ERROR, "Span %d already has minunused of %d.\n", span + 1, minunused);
+						if (pris[span].minunused && (pris[span].minunused != conf.pri.minunused)) {
+							ast_log(LOG_ERROR, "Span %d already has minunused of %d.\n", span + 1, conf.pri.minunused);
 							destroy_zt_pvt(&tmp);
 							return NULL;
 						}
-						if (pris[span].minidle && (pris[span].minidle != minidle)) {
-							ast_log(LOG_ERROR, "Span %d already has minidle of %d.\n", span + 1, minidle);
+						if (pris[span].minidle && (pris[span].minidle != conf.pri.minidle)) {
+							ast_log(LOG_ERROR, "Span %d already has minidle of %d.\n", span + 1, conf.pri.minidle);
 							destroy_zt_pvt(&tmp);
 							return NULL;
 						}
@@ -7655,24 +7626,24 @@
 							destroy_zt_pvt(&tmp);
 							return NULL;
 						}
-						pris[span].nodetype = pritype;
+						pris[span].nodetype = conf.pri.nodetype;
 						pris[span].switchtype = myswitchtype;
-						pris[span].nsf = nsf;
-						pris[span].dialplan = dialplan;
-						pris[span].localdialplan = localdialplan;
+						pris[span].nsf = conf.pri.nsf;
+						pris[span].dialplan = conf.pri.dialplan;
+						pris[span].localdialplan = conf.pri.localdialplan;
 						pris[span].pvts[pris[span].numchans++] = tmp;
-						pris[span].minunused = minunused;
-						pris[span].minidle = minidle;
-						pris[span].overlapdial = overlapdial;
-						pris[span].facilityenable = facilityenable;
-						ast_copy_string(pris[span].idledial, idledial, sizeof(pris[span].idledial));
-						ast_copy_string(pris[span].idleext, idleext, sizeof(pris[span].idleext));
-						ast_copy_string(pris[span].internationalprefix, internationalprefix, sizeof(pris[span].internationalprefix));
-						ast_copy_string(pris[span].nationalprefix, nationalprefix, sizeof(pris[span].nationalprefix));
-						ast_copy_string(pris[span].localprefix, localprefix, sizeof(pris[span].localprefix));
-						ast_copy_string(pris[span].privateprefix, privateprefix, sizeof(pris[span].privateprefix));
-						ast_copy_string(pris[span].unknownprefix, unknownprefix, sizeof(pris[span].unknownprefix));
-						pris[span].resetinterval = resetinterval;
+						pris[span].minunused = conf.pri.minunused;
+						pris[span].minidle = conf.pri.minidle;
+						pris[span].overlapdial = conf.pri.overlapdial;
+						pris[span].facilityenable = conf.pri.facilityenable;
+						ast_copy_string(pris[span].idledial, conf.pri.idledial, sizeof(pris[span].idledial));
+						ast_copy_string(pris[span].idleext, conf.pri.idleext, sizeof(pris[span].idleext));
+						ast_copy_string(pris[span].internationalprefix, conf.pri.internationalprefix, sizeof(pris[span].internationalprefix));
+						ast_copy_string(pris[span].nationalprefix, conf.pri.nationalprefix, sizeof(pris[span].nationalprefix));
+						ast_copy_string(pris[span].localprefix, conf.pri.localprefix, sizeof(pris[span].localprefix));
+						ast_copy_string(pris[span].privateprefix, conf.pri.privateprefix, sizeof(pris[span].privateprefix));
+						ast_copy_string(pris[span].unknownprefix, conf.pri.unknownprefix, sizeof(pris[span].unknownprefix));
+						pris[span].resetinterval = conf.pri.resetinterval;
 						
 						tmp->pri = &pris[span];
 						tmp->prioffset = offset;
@@ -7688,23 +7659,23 @@
 			}
 #endif
 		} else {
-			signalling = tmp->sig;
-			radio = tmp->radio;
+			conf.chan.sig = tmp->sig;
+			conf.chan.radio = tmp->radio;
 			memset(&p, 0, sizeof(p));
 			if (tmp->subs[SUB_REAL].zfd > -1)
 				res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_GET_PARAMS, &p);
 		}
 		/* Adjust starttime on loopstart and kewlstart trunks to reasonable values */
-		if ((signalling == SIG_FXSKS) || (signalling == SIG_FXSLS) ||
-		    (signalling == SIG_EM) || (signalling == SIG_EM_E1) ||  (signalling == SIG_EMWINK) ||
-			(signalling == SIG_FEATD) || (signalling == SIG_FEATDMF) || (signalling == SIG_FEATDMF_TA) ||
-			  (signalling == SIG_FEATB) || (signalling == SIG_E911) ||
-		    (signalling == SIG_SF) || (signalling == SIG_SFWINK) || (signalling == SIG_FGC_CAMA) || (signalling == SIG_FGC_CAMAMF) ||
-			(signalling == SIG_SF_FEATD) || (signalling == SIG_SF_FEATDMF) ||
-			  (signalling == SIG_SF_FEATB)) {
+		if ((conf.chan.sig == SIG_FXSKS) || (conf.chan.sig == SIG_FXSLS) ||
+		    (conf.chan.sig == SIG_EM) || (conf.chan.sig == SIG_EM_E1) ||  (conf.chan.sig == SIG_EMWINK) ||
+			(conf.chan.sig == SIG_FEATD) || (conf.chan.sig == SIG_FEATDMF) || (conf.chan.sig == SIG_FEATDMF_TA) ||
+			  (conf.chan.sig == SIG_FEATB) || (conf.chan.sig == SIG_E911) ||
+		    (conf.chan.sig == SIG_SF) || (conf.chan.sig == SIG_SFWINK) || (conf.chan.sig == SIG_FGC_CAMA) || (conf.chan.sig == SIG_FGC_CAMAMF) ||
+			(conf.chan.sig == SIG_SF_FEATD) || (conf.chan.sig == SIG_SF_FEATDMF) ||
+			  (conf.chan.sig == SIG_SF_FEATB)) {
 			p.starttime = 250;
 		}
-		if (radio) {
+		if (conf.chan.radio) {
 			/* XXX Waiting to hear back from Jim if these should be adjustable XXX */
 			p.channo = channel;
 			p.rxwinktime = 1;
@@ -7712,25 +7683,25 @@
 			p.starttime = 1;
 			p.debouncetime = 5;
 		}
-		if (!radio) {
+		if (!conf.chan.radio) {
 			p.channo = channel;
 			/* Override timing settings based on config file */
-			if (cur_prewink >= 0)
-				p.prewinktime = cur_prewink;
-			if (cur_preflash >= 0)
-				p.preflashtime = cur_preflash;
-			if (cur_wink >= 0)
-				p.winktime = cur_wink;
-			if (cur_flash >= 0)
-				p.flashtime = cur_flash;
-			if (cur_start >= 0)
-				p.starttime = cur_start;
-			if (cur_rxwink >= 0)
-				p.rxwinktime = cur_rxwink;
-			if (cur_rxflash >= 0)
-				p.rxflashtime = cur_rxflash;
-			if (cur_debounce >= 0)
-				p.debouncetime = cur_debounce;
+			if (conf.timing.prewinktime >= 0)
+				p.prewinktime = conf.timing.prewinktime;
+			if (conf.timing.preflashtime >= 0)
+				p.preflashtime = conf.timing.preflashtime;
+			if (conf.timing.winktime >= 0)
+				p.winktime = conf.timing.winktime;
+			if (conf.timing.flashtime >= 0)
+				p.flashtime = conf.timing.flashtime;
+			if (conf.timing.starttime >= 0)
+				p.starttime = conf.timing.starttime;
+			if (conf.timing.rxwinktime >= 0)
+				p.rxwinktime = conf.timing.rxwinktime;
+			if (conf.timing.rxflashtime >= 0)
+				p.rxflashtime = conf.timing.rxflashtime;
+			if (conf.timing.debouncetime >= 0)
+				p.debouncetime = conf.timing.debouncetime;
 		}
 		
 		/* dont set parms on a pseudo-channel (or CRV) */
@@ -7759,50 +7730,50 @@
 				ast_log(LOG_WARNING, "Unable to check buffer policy on channel %d\n", channel);
 		}
 #endif
-		tmp->immediate = immediate;
-		tmp->transfertobusy = transfertobusy;
-		tmp->sig = signalling;
-		tmp->outsigmod = outsignalling;
-		tmp->radio = radio;
+		tmp->immediate = conf.chan.immediate;
+		tmp->transfertobusy = conf.chan.transfertobusy;
+		tmp->sig = conf.chan.sig;
+		tmp->outsigmod = conf.chan.outsigmod;
+		tmp->radio = conf.chan.radio;
 		tmp->ringt_base = ringt_base;
 		tmp->firstradio = 0;
-		if ((signalling == SIG_FXOKS) || (signalling == SIG_FXOLS) || (signalling == SIG_FXOGS))
-			tmp->permcallwaiting = callwaiting;
+		if ((conf.chan.sig == SIG_FXOKS) || (conf.chan.sig == SIG_FXOLS) || (conf.chan.sig == SIG_FXOGS))
+			tmp->permcallwaiting = conf.chan.callwaiting;
 		else
 			tmp->permcallwaiting = 0;
 		/* Flag to destroy the channel must be cleared on new mkif.  Part of changes for reload to work */
 		tmp->destroy = 0;
 		tmp->drings = drings;
 		tmp->usedistinctiveringdetection = usedistinctiveringdetection;
-		tmp->callwaitingcallerid = callwaitingcallerid;
-		tmp->threewaycalling = threewaycalling;
-		tmp->adsi = adsi;
-		tmp->use_smdi = use_smdi;
-		tmp->permhidecallerid = hidecallerid;
-		tmp->callreturn = callreturn;
-		tmp->echocancel = echocancel;
-		tmp->echotraining = echotraining;
-		tmp->pulse = pulse;
-		tmp->echocanbridged = echocanbridged;
-		tmp->busydetect = busydetect;
-		tmp->busycount = busycount;
-		tmp->busy_tonelength = busy_tonelength;
-		tmp->busy_quietlength = busy_quietlength;
-		tmp->callprogress = callprogress;
-		tmp->cancallforward = cancallforward;
-		tmp->dtmfrelax = relaxdtmf;
+		tmp->callwaitingcallerid = conf.chan.callwaitingcallerid;
+		tmp->threewaycalling = conf.chan.threewaycalling;
+		tmp->adsi = conf.chan.adsi;
+		tmp->use_smdi = conf.chan.use_smdi;
+		tmp->permhidecallerid = conf.chan.hidecallerid;
+		tmp->callreturn = conf.chan.callreturn;
+		tmp->echocancel = conf.chan.echocancel;
+		tmp->echotraining = conf.chan.echotraining;
+		tmp->pulse = conf.chan.pulse;
+		tmp->echocanbridged = conf.chan.echocanbridged;
+		tmp->busydetect = conf.chan.busydetect;
+		tmp->busycount = conf.chan.busycount;
+		tmp->busy_tonelength = conf.chan.busy_tonelength;
+		tmp->busy_quietlength = conf.chan.busy_quietlength;
+		tmp->callprogress = conf.chan.callprogress;
+		tmp->cancallforward = conf.chan.cancallforward;
+		tmp->dtmfrelax = conf.chan.dtmfrelax;
 		tmp->callwaiting = tmp->permcallwaiting;
 		tmp->hidecallerid = tmp->permhidecallerid;
 		tmp->channel = channel;
-		tmp->stripmsd = stripmsd;
-		tmp->use_callerid = use_callerid;
-		tmp->cid_signalling = cid_signalling;
-		tmp->cid_start = cid_start;
-		tmp->zaptrcallerid = zaptrcallerid;
-		tmp->restrictcid = restrictcid;
-		tmp->use_callingpres = use_callingpres;
-		tmp->priindication_oob = priindication_oob;
-		tmp->priexclusive = cur_priexclusive;
+		tmp->stripmsd = conf.chan.stripmsd;
+		tmp->use_callerid = conf.chan.use_callerid;
+		tmp->cid_signalling = conf.chan.cid_signalling;
+		tmp->cid_start = conf.chan.cid_start;
+		tmp->zaptrcallerid = conf.chan.zaptrcallerid;
+		tmp->restrictcid = conf.chan.restrictcid;
+		tmp->use_callingpres = conf.chan.use_callingpres;
+		tmp->priindication_oob = conf.chan.priindication_oob;
+		tmp->priexclusive = conf.chan.priexclusive;
 		if (tmp->usedistinctiveringdetection) {
 			if (!tmp->use_callerid) {
 				ast_log(LOG_NOTICE, "Distinctive Ring detect requires 'usecallerid' be on\n");
@@ -7817,37 +7788,37 @@
 			}
 		}
 		if (tmp->use_smdi) {
-			tmp->smdi_iface = ast_smdi_interface_find(smdi_port);
+			tmp->smdi_iface = ast_smdi_interface_find(conf.smdi_port);
 			if (!(tmp->smdi_iface)) {
 				ast_log(LOG_ERROR, "Invalid SMDI port specfied, disabling SMDI support\n");
 				tmp->use_smdi = 0;
 			}
 		}
 
-		ast_copy_string(tmp->accountcode, accountcode, sizeof(tmp->accountcode));
-		tmp->amaflags = amaflags;
+		ast_copy_string(tmp->accountcode, conf.chan.accountcode, sizeof(tmp->accountcode));
+		tmp->amaflags = conf.chan.amaflags;
 		if (!here) {
 			tmp->confno = -1;
 			tmp->propconfno = -1;
 		}
-		tmp->canpark = canpark;
-		tmp->transfer = transfer;
-		ast_copy_string(tmp->defcontext,context,sizeof(tmp->defcontext));
+		tmp->canpark = conf.chan.canpark;
+		tmp->transfer = conf.chan.transfer;
+		ast_copy_string(tmp->defcontext,conf.chan.context,sizeof(tmp->defcontext));
 		ast_copy_string(tmp->language, language, sizeof(tmp->language));
-		ast_copy_string(tmp->mohinterpret, mohinterpret, sizeof(tmp->mohinterpret));
-		ast_copy_string(tmp->mohsuggest, mohsuggest, sizeof(tmp->mohsuggest));
-		ast_copy_string(tmp->context, context, sizeof(tmp->context));
-		ast_copy_string(tmp->cid_num, cid_num, sizeof(tmp->cid_num));
+		ast_copy_string(tmp->mohinterpret, conf.chan.mohinterpret, sizeof(tmp->mohinterpret));
+		ast_copy_string(tmp->mohsuggest, conf.chan.mohsuggest, sizeof(tmp->mohsuggest));
+		ast_copy_string(tmp->context, conf.chan.context, sizeof(tmp->context));
+		ast_copy_string(tmp->cid_num, conf.chan.cid_num, sizeof(tmp->cid_num));
 		tmp->cid_ton = 0;
-		ast_copy_string(tmp->cid_name, cid_name, sizeof(tmp->cid_name));
-		ast_copy_string(tmp->mailbox, mailbox, sizeof(tmp->mailbox));
+		ast_copy_string(tmp->cid_name, conf.chan.cid_name, sizeof(tmp->cid_name));
+		ast_copy_string(tmp->mailbox, conf.chan.mailbox, sizeof(tmp->mailbox));
 		tmp->msgstate = -1;
-		tmp->group = cur_group;
-		tmp->callgroup=cur_callergroup;
-		tmp->pickupgroup=cur_pickupgroup;
-		tmp->rxgain = rxgain;
-		tmp->txgain = txgain;
-		tmp->tonezone = tonezone;
+		tmp->group = conf.chan.group;
+		tmp->callgroup = conf.chan.callgroup;
+		tmp->pickupgroup= conf.chan.pickupgroup;
+		tmp->rxgain = conf.chan.rxgain;
+		tmp->txgain = conf.chan.txgain;
+		tmp->tonezone = conf.chan.tonezone;
 		tmp->onhooktime = time(NULL);
 		if (tmp->subs[SUB_REAL].zfd > -1) {
 			set_actual_gain(tmp->subs[SUB_REAL].zfd, 0, tmp->rxgain, tmp->txgain, tmp->law);
@@ -7855,7 +7826,7 @@
 				ast_dsp_digitmode(tmp->dsp, DSP_DIGITMODE_DTMF | tmp->dtmfrelax);
 			update_conf(tmp);
 			if (!here) {
-				if ((signalling != SIG_PRI) && (signalling != SIG_SS7))
+				if ((conf.chan.sig != SIG_PRI) && (conf.chan.sig != SIG_SS7))
 					/* Hang it up to be sure it's good */
 					zt_set_hook(tmp->subs[SUB_REAL].zfd, ZT_ONHOOK);
 			}
@@ -7876,13 +7847,13 @@
 			if (si.alarms) tmp->inalarm = 1;
 		}
 
-		tmp->polarityonanswerdelay = polarityonanswerdelay;
-		tmp->answeronpolarityswitch = answeronpolarityswitch;
-		tmp->hanguponpolarityswitch = hanguponpolarityswitch;
-		tmp->sendcalleridafter = sendcalleridafter;
+		tmp->polarityonanswerdelay = conf.chan.polarityonanswerdelay;
+		tmp->answeronpolarityswitch = conf.chan.answeronpolarityswitch;
+		tmp->hanguponpolarityswitch = conf.chan.hanguponpolarityswitch;
+		tmp->sendcalleridafter = conf.chan.sendcalleridafter;
 		if (!here) {
 			tmp->locallyblocked = tmp->remotelyblocked = 0;
-			if ((signalling == SIG_PRI) || (signalling == SIG_SS7))
+			if ((conf.chan.sig == SIG_PRI) || (conf.chan.sig == SIG_SS7))
 				tmp->inservice = 0;
 			else /* We default to in service on protocols that don't have a reset */
 				tmp->inservice = 1;
@@ -10665,7 +10636,7 @@
 	}
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Channels destroyed. Now re-reading config.\n");
-	if (setup_zap(0) != 0) {
+	if (setup_zap(1) != 0) {
 		ast_log(LOG_WARNING, "Reload channels from zap config failed!\n");
 		return 1;
 	}
@@ -11642,7 +11613,7 @@
 	return __unload_module();
 }
 
-static int build_channels(int iscrv, const char *value, int reload, int lineno, int *found_pseudo)
+static int build_channels(struct zt_chan_conf conf, int iscrv, const char *value, int reload, int lineno, int *found_pseudo)
 {
 	char *c, *chan;
 	int x, start, finish;
@@ -11652,7 +11623,7 @@
 	int trunkgroup, y;
 #endif
 	
-	if ((reload == 0) && (cur_signalling < 0)) {
+	if ((reload == 0) && (conf.chan.sig < 0)) {
 		ast_log(LOG_ERROR, "Signalling must be specified before any channels are.\n");
 		return -1;
 	}
@@ -11707,9 +11678,9 @@
 
 		for (x = start; x <= finish; x++) {
 #ifdef HAVE_PRI
-			tmp = mkintf(x, cur_signalling, cur_outsignalling, cur_radio, pri, reload);
+			tmp = mkintf(x, conf, pri, reload);
 #else			
-			tmp = mkintf(x, cur_signalling, cur_outsignalling, cur_radio, NULL, reload);
+			tmp = mkintf(x, conf, NULL, reload);
 #endif			
 
 			if (tmp) {
@@ -11732,12 +11703,16 @@
 	return 0;
 }
 
-static int process_zap(struct ast_variable *v, int reload, int skipchannels)
+/** The length of the parameters list of 'zapchan'. 
+ * \todo Move definition of MAX_CHANLIST_LEN to a proper place. */
+#define MAX_CHANLIST_LEN 80
+static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int reload, int skipchannels)
 {
 	struct zt_pvt *tmp;
-	char *ringc;
+	char *ringc; /* temporary string for parsing the dring number. */
 	int y;
 	int found_pseudo = 0;
+        char zapchan[MAX_CHANLIST_LEN] = {};
 
 	for (; v; v = v->next) {
 		if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
@@ -11749,486 +11724,489 @@
 		    || !strcasecmp(v->name, "crv")
 #endif			
 			) {
-			if (!skipchannels) {
-				if (build_channels(!strcasecmp(v->name, "crv"), v->value, reload, v->lineno, &found_pseudo))
-					return -1;
-			}
+ 			if (skipchannels)
+ 				continue;
+ 			int iscrv = !strcasecmp(v->name, "crv");
+ 			if (build_channels(*confp, iscrv, v->value, reload, v->lineno, &found_pseudo))
+ 					return -1;
+ 		} else if (!strcasecmp(v->name, "zapchan")) {
+ 			ast_copy_string(zapchan, v->value, sizeof(zapchan));
 		} else if (!strcasecmp(v->name, "usedistinctiveringdetection")) {
 			usedistinctiveringdetection = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "distinctiveringaftercid")) {
 			distinctiveringaftercid = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "dring1context")) {
-			ast_copy_string(drings.ringContext[0].contextData,v->value,sizeof(drings.ringContext[0].contextData));
+			ast_copy_string(confp->chan.drings.ringContext[0].contextData,v->value,sizeof(confp->chan.drings.ringContext[0].contextData));
 		} else if (!strcasecmp(v->name, "dring2context")) {
-			ast_copy_string(drings.ringContext[1].contextData,v->value,sizeof(drings.ringContext[1].contextData));
+			ast_copy_string(confp->chan.drings.ringContext[1].contextData,v->value,sizeof(confp->chan.drings.ringContext[1].contextData));
 		} else if (!strcasecmp(v->name, "dring3context")) {
-			ast_copy_string(drings.ringContext[2].contextData,v->value,sizeof(drings.ringContext[2].contextData));
+			ast_copy_string(confp->chan.drings.ringContext[2].contextData,v->value,sizeof(confp->chan.drings.ringContext[2].contextData));
 		} else if (!strcasecmp(v->name, "dring1range")) {
 			drings.ringnum[0].range = atoi(v->value);
 			/* 10 is a nice default. */
-			if (drings.ringnum[0].range == 0)
-				drings.ringnum[0].range = 10;
+			if (confp->chan.drings.ringnum[0].range == 0)
+				confp->chan.drings.ringnum[0].range = 10;
 		} else if (!strcasecmp(v->name, "dring2range")) {
-			drings.ringnum[1].range = atoi(v->value);
+			confp->chan.drings.ringnum[1].range = atoi(v->value);
 			/* 10 is a nice default. */
-			if (drings.ringnum[1].range == 0)
-				drings.ringnum[1].range = 10;
+			if (confp->chan.drings.ringnum[1].range == 0)
+				confp->chan.drings.ringnum[1].range = 10;
 		} else if (!strcasecmp(v->name, "dring3range")) {
-			drings.ringnum[2].range = atoi(v->value);
+			confp->chan.drings.ringnum[2].range = atoi(v->value);
 			/* 10 is a nice default. */
-			if (drings.ringnum[2].range == 0)
-				drings.ringnum[2].range = 10;
+			if (confp->chan.drings.ringnum[2].range == 0)
+				confp->chan.drings.ringnum[2].range = 10;
 		} else if (!strcasecmp(v->name, "dring1")) {
 			ringc = v->value;
-			sscanf(ringc, "%d,%d,%d", &drings.ringnum[0].ring[0], &drings.ringnum[0].ring[1], &drings.ringnum[0].ring[2]);
+			sscanf(ringc, "%d,%d,%d", &confp->chan.drings.ringnum[0].ring[0], &confp->chan.drings.ringnum[0].ring[1], &confp->chan.drings.ringnum[0].ring[2]);
 		} else if (!strcasecmp(v->name, "dring2")) {
 			ringc = v->value;
-			sscanf(ringc,"%d,%d,%d", &drings.ringnum[1].ring[0], &drings.ringnum[1].ring[1], &drings.ringnum[1].ring[2]);
+			sscanf(ringc,"%d,%d,%d", &confp->chan.drings.ringnum[1].ring[0], &confp->chan.drings.ringnum[1].ring[1], &confp->chan.drings.ringnum[1].ring[2]);
 		} else if (!strcasecmp(v->name, "dring3")) {
 			ringc = v->value;
-			sscanf(ringc, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]);
+			sscanf(ringc, "%d,%d,%d", &confp->chan.drings.ringnum[2].ring[0], &confp->chan.drings.ringnum[2].ring[1], &confp->chan.drings.ringnum[2].ring[2]);
 		} else if (!strcasecmp(v->name, "usecallerid")) {
-			use_callerid = ast_true(v->value);
+			confp->chan.use_callerid = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "cidsignalling")) {
 			if (!strcasecmp(v->value, "bell"))
-				cid_signalling = CID_SIG_BELL;
+				confp->chan.cid_signalling = CID_SIG_BELL;
 			else if (!strcasecmp(v->value, "v23"))
-				cid_signalling = CID_SIG_V23;
+				confp->chan.cid_signalling = CID_SIG_V23;
 			else if (!strcasecmp(v->value, "dtmf"))
-				cid_signalling = CID_SIG_DTMF;
+				confp->chan.cid_signalling = CID_SIG_DTMF;
 			else if (!strcasecmp(v->value, "smdi"))
-				cid_signalling = CID_SIG_SMDI;
+				confp->chan.cid_signalling = CID_SIG_SMDI;
 			else if (!strcasecmp(v->value, "v23_jp"))
-				cid_signalling = CID_SIG_V23_JP;
+				confp->chan.cid_signalling = CID_SIG_V23_JP;
 			else if (ast_true(v->value))
-				cid_signalling = CID_SIG_BELL;
+				confp->chan.cid_signalling = CID_SIG_BELL;
 		} else if (!strcasecmp(v->name, "cidstart")) {
 			if (!strcasecmp(v->value, "ring"))
-				cid_start = CID_START_RING;
+				confp->chan.cid_start = CID_START_RING;
 			else if (!strcasecmp(v->value, "polarity"))
-				cid_start = CID_START_POLARITY;
+				confp->chan.cid_start = CID_START_POLARITY;
 			else if (ast_true(v->value))
-				cid_start = CID_START_RING;
+				confp->chan.cid_start = CID_START_RING;
 		} else if (!strcasecmp(v->name, "threewaycalling")) {
-			threewaycalling = ast_true(v->value);
+			confp->chan.threewaycalling = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "cancallforward")) {
-			cancallforward = ast_true(v->value);
+			confp->chan.cancallforward = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "relaxdtmf")) {
 			if (ast_true(v->value)) 
-				relaxdtmf = DSP_DIGITMODE_RELAXDTMF;
+				confp->chan.dtmfrelax = DSP_DIGITMODE_RELAXDTMF;
 			else
-				relaxdtmf = 0;
+				confp->chan.dtmfrelax = 0;
 		} else if (!strcasecmp(v->name, "mailbox")) {
-			ast_copy_string(mailbox, v->value, sizeof(mailbox));
+			ast_copy_string(confp->chan.mailbox, v->value, sizeof(confp->chan.mailbox));
 		} else if (!strcasecmp(v->name, "adsi")) {
-			adsi = ast_true(v->value);
+			confp->chan.adsi = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "usesmdi")) {
-			use_smdi = ast_true(v->value);
+			confp->chan.use_smdi = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "smdiport")) {
-			ast_copy_string(smdi_port, v->value, sizeof(smdi_port));
+			ast_copy_string(confp->smdi_port, v->value, sizeof(confp->smdi_port));
 		} else if (!strcasecmp(v->name, "transfer")) {
-			transfer = ast_true(v->value);
+			confp->chan.transfer = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "canpark")) {
-			canpark = ast_true(v->value);
+			confp->chan.canpark = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "echocancelwhenbridged")) {
-			echocanbridged = ast_true(v->value);
+			confp->chan.echocanbridged = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "busydetect")) {
-			busydetect = ast_true(v->value);
+			confp->chan.busydetect = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "busycount")) {
-			busycount = atoi(v->value);
+			confp->chan.busycount = atoi(v->value);
 		} else if (!strcasecmp(v->name, "busypattern")) {
-			if (sscanf(v->value, "%d,%d", &busy_tonelength, &busy_quietlength) != 2) {
+			if (sscanf(v->value, "%d,%d", &confp->chan.busy_tonelength, &confp->chan.busy_quietlength) != 2) {
 				ast_log(LOG_ERROR, "busypattern= expects busypattern=tonelength,quietlength\n");
 			}
 		} else if (!strcasecmp(v->name, "callprogress")) {
 			if (ast_true(v->value))
-				callprogress |= 1;
+				confp->chan.callprogress |= 1;
 			else
-				callprogress &= ~1;
+				confp->chan.callprogress &= ~1;
 		} else if (!strcasecmp(v->name, "faxdetect")) {
 			if (!strcasecmp(v->value, "incoming")) {
-				callprogress |= 4;
-				callprogress &= ~2;
+				confp->chan.callprogress |= 4;
+				confp->chan.callprogress &= ~2;
 			} else if (!strcasecmp(v->value, "outgoing")) {
-				callprogress &= ~4;
-				callprogress |= 2;
+				confp->chan.callprogress &= ~4;
+				confp->chan.callprogress |= 2;
 			} else if (!strcasecmp(v->value, "both") || ast_true(v->value))
-				callprogress |= 6;
+				confp->chan.callprogress |= 6;
 			else
-				callprogress &= ~6;
+				confp->chan.callprogress &= ~6;
 		} else if (!strcasecmp(v->name, "echocancel")) {
 			if (!ast_strlen_zero(v->value)) {
 				y = atoi(v->value);
 			} else
 				y = 0;
 			if ((y == 32) || (y == 64) || (y == 128) || (y == 256) || (y == 512) || (y == 1024))
-				echocancel = y;
+				confp->chan.echocancel = y;
 			else {
-				echocancel = ast_true(v->value);
-				if (echocancel)
-					echocancel=128;
+				confp->chan.echocancel = ast_true(v->value);
+				if (confp->chan.echocancel)
+					confp->chan.echocancel=128;
 			}
 		} else if (!strcasecmp(v->name, "echotraining")) {
 			if (sscanf(v->value, "%d", &y) == 1) {
 				if ((y < 10) || (y > 4000)) {
 					ast_log(LOG_WARNING, "Echo training time must be within the range of 10 to 4000 ms at line %d\n", v->lineno);					
 				} else {
-					echotraining = y;
+					confp->chan.echotraining = y;
 				}
 			} else if (ast_true(v->value)) {
-				echotraining = 400;
+				confp->chan.echotraining = 400;
 			} else
-				echotraining = 0;
+				confp->chan.echotraining = 0;
 		} else if (!strcasecmp(v->name, "hidecallerid")) {
-			hidecallerid = ast_true(v->value);
+			confp->chan.hidecallerid = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "hidecalleridname")) {
-			hidecalleridname = ast_true(v->value);
+			confp->chan.hidecalleridname = ast_true(v->value);
  		} else if (!strcasecmp(v->name, "pulsedial")) {
- 			pulse = ast_true(v->value);
+ 			confp->chan.pulse = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "callreturn")) {
-			callreturn = ast_true(v->value);
+			confp->chan.callreturn = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "callwaiting")) {
-			callwaiting = ast_true(v->value);
+			confp->chan.callwaiting = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "callwaitingcallerid")) {
-			callwaitingcallerid = ast_true(v->value);
+			confp->chan.callwaitingcallerid = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "context")) {
-			ast_copy_string(context, v->value, sizeof(context));
+			ast_copy_string(confp->chan.context, v->value, sizeof(confp->chan.context));
 		} else if (!strcasecmp(v->name, "language")) {
-			ast_copy_string(language, v->value, sizeof(language));
+			ast_copy_string(confp->chan.language, v->value, sizeof(confp->chan.language));
 		} else if (!strcasecmp(v->name, "progzone")) {
 			ast_copy_string(progzone, v->value, sizeof(progzone));
 		} else if (!strcasecmp(v->name, "mohinterpret") 
 			||!strcasecmp(v->name, "musiconhold") || !strcasecmp(v->name, "musicclass")) {
-			ast_copy_string(mohinterpret, v->value, sizeof(mohinterpret));
+			ast_copy_string(confp->chan.mohinterpret, v->value, sizeof(confp->chan.mohinterpret));
 		} else if (!strcasecmp(v->name, "mohsuggest")) {
-			ast_copy_string(mohsuggest, v->value, sizeof(mohsuggest));
+			ast_copy_string(confp->chan.mohsuggest, v->value, sizeof(confp->chan.mohsuggest));
 		} else if (!strcasecmp(v->name, "stripmsd")) {
-			stripmsd = atoi(v->value);
+			confp->chan.stripmsd = atoi(v->value);
 		} else if (!strcasecmp(v->name, "jitterbuffers")) {
 			numbufs = atoi(v->value);
 		} else if (!strcasecmp(v->name, "group")) {
-			cur_group = ast_get_group(v->value);
+			confp->chan.group = ast_get_group(v->value);
 		} else if (!strcasecmp(v->name, "callgroup")) {
 			if (!strcasecmp(v->value, "none"))
-				cur_callergroup = 0;
+				confp->chan.callgroup = 0;
 			else
-				cur_callergroup = ast_get_group(v->value);
+				confp->chan.callgroup = ast_get_group(v->value);
 		} else if (!strcasecmp(v->name, "pickupgroup")) {
 			if (!strcasecmp(v->value, "none"))
-				cur_pickupgroup = 0;
+				confp->chan.pickupgroup = 0;
 			else
-				cur_pickupgroup = ast_get_group(v->value);
+				confp->chan.pickupgroup = ast_get_group(v->value);
 		} else if (!strcasecmp(v->name, "immediate")) {
-			immediate = ast_true(v->value);
+			confp->chan.immediate = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "transfertobusy")) {
-			transfertobusy = ast_true(v->value);
+			confp->chan.transfertobusy = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "rxgain")) {
-			if (sscanf(v->value, "%f", &rxgain) != 1) {
+			if (sscanf(v->value, "%f", &confp->chan.rxgain) != 1) {
 				ast_log(LOG_WARNING, "Invalid rxgain: %s\n", v->value);
 			}
 		} else if (!strcasecmp(v->name, "txgain")) {
-			if (sscanf(v->value, "%f", &txgain) != 1) {
+			if (sscanf(v->value, "%f", &confp->chan.txgain) != 1) {
 				ast_log(LOG_WARNING, "Invalid txgain: %s\n", v->value);
 			}
 		} else if (!strcasecmp(v->name, "tonezone")) {
-			if (sscanf(v->value, "%d", &tonezone) != 1) {

[... 575 lines stripped ...]


More information about the asterisk-commits mailing list