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!)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Joshua Colp 18 years ago
parent 10d22b6e13
commit 5460e72015

@ -220,6 +220,7 @@ Zaptel channel driver (chan_zap) Changes
those carriers that transmit CID via dtmf after a polarity change. those carriers that transmit CID via dtmf after a polarity change.
* CID matching information is now shown when doing 'dialplan show'. * CID matching information is now shown when doing 'dialplan show'.
* Added zap show version CLI command to chan_zap. * Added zap show version CLI command to chan_zap.
* Added setvar support to zapata.conf channel entries.
H.323 Changes H.323 Changes
------------- -------------

@ -604,6 +604,7 @@ static struct zt_pvt {
int propconfno; /*!< Propagated conference number */ int propconfno; /*!< Propagated conference number */
ast_group_t callgroup; ast_group_t callgroup;
ast_group_t pickupgroup; ast_group_t pickupgroup;
struct ast_variable *vars;
int channel; /*!< Channel Number or CRV */ int channel; /*!< Channel Number or CRV */
int span; /*!< Span number */ int span; /*!< Span number */
time_t guardtime; /*!< Must wait this much time before using for new call */ time_t guardtime; /*!< Must wait this much time before using for new call */
@ -2489,6 +2490,8 @@ static void destroy_zt_pvt(struct zt_pvt **pvt)
ASTOBJ_UNREF(p->smdi_iface, ast_smdi_interface_destroy); ASTOBJ_UNREF(p->smdi_iface, ast_smdi_interface_destroy);
if (p->mwi_event_sub) if (p->mwi_event_sub)
ast_event_unsubscribe(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_mutex_destroy(&p->lock);
ast_free(p); ast_free(p);
*pvt = NULL; *pvt = NULL;
@ -5492,6 +5495,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
int x,y; int x,y;
int features; int features;
struct ast_str *chan_name; struct ast_str *chan_name;
struct ast_variable *v;
ZT_PARAMS ps; ZT_PARAMS ps;
if (i->subs[index].owner) { if (i->subs[index].owner) {
ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]); ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]);
@ -5653,6 +5657,10 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
zt_confmute(i, 0); zt_confmute(i, 0);
/* Configure the new channel jb */ /* Configure the new channel jb */
ast_jb_configure(tmp, &global_jbconf); 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 (startpbx) {
if (ast_pbx_start(tmp)) { if (ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name); ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
@ -7889,6 +7897,10 @@ static struct zt_pvt *mkintf(int channel, struct zt_chan_conf conf, struct zt_pr
tmp->group = conf.chan.group; tmp->group = conf.chan.group;
tmp->callgroup = conf.chan.callgroup; tmp->callgroup = conf.chan.callgroup;
tmp->pickupgroup= conf.chan.pickupgroup; 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->cid_rxgain = conf.chan.cid_rxgain;
tmp->rxgain = conf.chan.rxgain; tmp->rxgain = conf.chan.rxgain;
tmp->txgain = conf.chan.txgain; tmp->txgain = conf.chan.txgain;
@ -10953,6 +10965,12 @@ static int zap_show_channel(int fd, int argc, char **argv)
ast_cli(fd, "Caller ID: %s\n", tmp->cid_num); ast_cli(fd, "Caller ID: %s\n", tmp->cid_num);
ast_cli(fd, "Calling TON: %d\n", tmp->cid_ton); ast_cli(fd, "Calling TON: %d\n", tmp->cid_ton);
ast_cli(fd, "Caller ID name: %s\n", tmp->cid_name); 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, "Destroy: %d\n", tmp->destroy);
ast_cli(fd, "InAlarm: %d\n", tmp->inalarm); ast_cli(fd, "InAlarm: %d\n", tmp->inalarm);
ast_cli(fd, "Signalling Type: %s\n", sig2str(tmp->sig)); ast_cli(fd, "Signalling Type: %s\n", sig2str(tmp->sig));
@ -12102,6 +12120,16 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
confp->chan.pickupgroup = 0; confp->chan.pickupgroup = 0;
else else
confp->chan.pickupgroup = ast_get_group(v->value); 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")) { } else if (!strcasecmp(v->name, "immediate")) {
confp->chan.immediate = ast_true(v->value); confp->chan.immediate = ast_true(v->value);
} else if (!strcasecmp(v->name, "transfertobusy")) { } else if (!strcasecmp(v->name, "transfertobusy")) {

@ -395,6 +395,8 @@ group=1
callgroup=1 callgroup=1
pickupgroup=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 ; Specify whether the channel should be answered immediately or if the simple
; switch should provide dialtone, read digits, etc. ; switch should provide dialtone, read digits, etc.

Loading…
Cancel
Save