[svn-commits] file: trunk r82329 - in /trunk: ./ channels/ configs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 13 11:59:00 CDT 2007


Author: file
Date: Thu Sep 13 11:58:59 2007
New Revision: 82329

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82329
Log:
Add setvar support to chan_zap. Just like you can in chan_sip and chan_iax2 you can now use it with zaptel channels. (done while in Montreal at the Asterisk bootcamp!)

Modified:
    trunk/CHANGES
    trunk/channels/chan_zap.c
    trunk/configs/zapata.conf.sample

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=82329&r1=82328&r2=82329
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Sep 13 11:58:59 2007
@@ -220,6 +220,7 @@
     those carriers that transmit CID via dtmf after a polarity change.
   * CID matching information is now shown when doing 'dialplan show'.
   * Added zap show version CLI command to chan_zap.
+  * Added setvar support to zapata.conf channel entries.
 
 H.323 Changes
 -------------

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=82329&r1=82328&r2=82329
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Thu Sep 13 11:58:59 2007
@@ -604,6 +604,7 @@
 	int propconfno;					/*!< Propagated conference number */
 	ast_group_t callgroup;
 	ast_group_t pickupgroup;
+	struct ast_variable *vars;
 	int channel;					/*!< Channel Number or CRV */
 	int span;					/*!< Span number */
 	time_t guardtime;				/*!< Must wait this much time before using for new call */
@@ -2489,6 +2490,8 @@
 		ASTOBJ_UNREF(p->smdi_iface, ast_smdi_interface_destroy);
 	if (p->mwi_event_sub)
 		ast_event_unsubscribe(p->mwi_event_sub);
+	if (p->vars)
+		ast_variables_destroy(p->vars);
 	ast_mutex_destroy(&p->lock);
 	ast_free(p);
 	*pvt = NULL;
@@ -5492,6 +5495,7 @@
 	int x,y;
 	int features;
 	struct ast_str *chan_name;
+	struct ast_variable *v;
 	ZT_PARAMS ps;
 	if (i->subs[index].owner) {
 		ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]);
@@ -5653,6 +5657,10 @@
 	zt_confmute(i, 0);
 	/* Configure the new channel jb */
 	ast_jb_configure(tmp, &global_jbconf);
+
+	for (v = i->vars ; v ; v = v->next)
+                pbx_builtin_setvar_helper(tmp, v->name, v->value);
+
 	if (startpbx) {
 		if (ast_pbx_start(tmp)) {
 			ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
@@ -7889,6 +7897,10 @@
 		tmp->group = conf.chan.group;
 		tmp->callgroup = conf.chan.callgroup;
 		tmp->pickupgroup= conf.chan.pickupgroup;
+		if (conf.chan.vars) {
+			tmp->vars = conf.chan.vars;
+			conf.chan.vars = NULL;
+		}
 		tmp->cid_rxgain = conf.chan.cid_rxgain;
 		tmp->rxgain = conf.chan.rxgain;
 		tmp->txgain = conf.chan.txgain;
@@ -10953,6 +10965,12 @@
 			ast_cli(fd, "Caller ID: %s\n", tmp->cid_num);
 			ast_cli(fd, "Calling TON: %d\n", tmp->cid_ton);
 			ast_cli(fd, "Caller ID name: %s\n", tmp->cid_name);
+			if (tmp->vars) {
+				struct ast_variable *v;
+				ast_cli(fd, "Variables:\n");
+				for (v = tmp->vars ; v ; v = v->next)
+					ast_cli(fd, "       %s = %s\n", v->name, v->value);
+			}
 			ast_cli(fd, "Destroy: %d\n", tmp->destroy);
 			ast_cli(fd, "InAlarm: %d\n", tmp->inalarm);
 			ast_cli(fd, "Signalling Type: %s\n", sig2str(tmp->sig));
@@ -12102,6 +12120,16 @@
 				confp->chan.pickupgroup = 0;
 			else
 				confp->chan.pickupgroup = ast_get_group(v->value);
+		} else if (!strcasecmp(v->name, "setvar")) {
+			char *varname = ast_strdupa(v->value), *varval = NULL;
+			struct ast_variable *tmpvar;
+			if (varname && (varval = strchr(varname, '='))) {
+				*varval++ = '\0';
+				if ((tmpvar = ast_variable_new(varname, varval, ""))) {
+					tmpvar->next = confp->chan.vars;
+					confp->chan.vars = tmpvar;
+				}
+			}
 		} else if (!strcasecmp(v->name, "immediate")) {
 			confp->chan.immediate = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "transfertobusy")) {

Modified: trunk/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/zapata.conf.sample?view=diff&rev=82329&r1=82328&r2=82329
==============================================================================
--- trunk/configs/zapata.conf.sample (original)
+++ trunk/configs/zapata.conf.sample Thu Sep 13 11:58:59 2007
@@ -395,6 +395,8 @@
 callgroup=1
 pickupgroup=1
 
+;setvar=CHANNEL=42             ; Channel variable to be set for all calls from this channel
+
 ;
 ; Specify whether the channel should be answered immediately or if the simple
 ; switch should provide dialtone, read digits, etc.




More information about the svn-commits mailing list