[asterisk-commits] tzafrir: branch tzafrir/monitor-rtp-14 r213897 - /team/tzafrir/monitor-rtp-14...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Aug 24 19:16:02 CDT 2009
Author: tzafrir
Date: Mon Aug 24 19:15:59 2009
New Revision: 213897
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213897
Log:
backport 'setvar' for chan_dahdi.conf from 1.6.0
This backport is not part of the new monitoring code. However it makes
it simpler to use chan_dahdi with that code.
* Allows setting auto-monitoring without changing the actual dialplan.
* Allows setting RTP_PORT_OFFSET in chan_dahdi.c (next commit).
Modified:
team/tzafrir/monitor-rtp-14/channels/chan_dahdi.c
Modified: team/tzafrir/monitor-rtp-14/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tzafrir/monitor-rtp-14/channels/chan_dahdi.c?view=diff&rev=213897&r1=213896&r2=213897
==============================================================================
--- team/tzafrir/monitor-rtp-14/channels/chan_dahdi.c (original)
+++ team/tzafrir/monitor-rtp-14/channels/chan_dahdi.c Mon Aug 24 19:15:59 2009
@@ -762,6 +762,11 @@
* \note The "pickupgroup" bitmapped group string read in from chan_dahdi.conf
*/
ast_group_t pickupgroup;
+ /*!
+ * \brief Channel variable list with associated values to set when a channel is created.
+ * \note The "setvar" strings read in from chan_dahdi.conf
+ */
+ 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 */
@@ -2566,6 +2571,9 @@
p->next->prev = p->prev;
if (p->use_smdi)
ast_smdi_interface_unref(p->smdi_iface);
+ if (p->vars) {
+ ast_variables_destroy(p->vars);
+ }
ast_mutex_destroy(&p->lock);
dahdi_close_sub(p, SUB_REAL);
if (p->owner)
@@ -7997,6 +8005,9 @@
tmp->group = conf->chan.group;
tmp->callgroup = conf->chan.callgroup;
tmp->pickupgroup= conf->chan.pickupgroup;
+ if (conf->chan.vars) {
+ tmp->vars = conf->chan.vars;
+ }
tmp->rxgain = conf->chan.rxgain;
tmp->txgain = conf->chan.txgain;
tmp->tonezone = conf->chan.tonezone;
@@ -10665,6 +10676,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));
@@ -11520,6 +11537,17 @@
confp->chan.callgroup = ast_get_group(v->value);
} else if (!strcasecmp(v->name, "pickupgroup")) {
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;
+ ast_log(LOG_DEBUG, "setvar line: '%s'\n", v->value);
+ 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")) {
More information about the asterisk-commits
mailing list