[svn-commits] jpeeler: branch 1.4 r117582 - /branches/1.4/channels/chan_zap.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed May 21 15:11:15 CDT 2008
Author: jpeeler
Date: Wed May 21 15:11:14 2008
New Revision: 117582
URL: http://svn.digium.com/view/asterisk?view=rev&rev=117582
Log:
Ensure that passed in zt_chan_conf structure is not modified in mkintf.
Modified:
branches/1.4/channels/chan_zap.c
Modified: branches/1.4/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_zap.c?view=diff&rev=117582&r1=117581&r2=117582
==============================================================================
--- branches/1.4/channels/chan_zap.c (original)
+++ branches/1.4/channels/chan_zap.c Wed May 21 15:11:14 2008
@@ -7149,7 +7149,7 @@
#endif
-static struct zt_pvt *mkintf(int channel, struct zt_chan_conf *conf, struct zt_pri *pri, int reloading)
+static struct zt_pvt *mkintf(int channel, const 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;
@@ -7207,6 +7207,7 @@
}
if (tmp) {
+ int chan_sig = conf->chan.sig;
if (!here) {
if ((channel != CHAN_PSEUDO) && !pri) {
snprintf(fn, sizeof(fn), "%d", channel);
@@ -7236,8 +7237,8 @@
span = p.spanno - 1;
} else {
if (channel == CHAN_PSEUDO)
- conf->chan.sig = 0;
- else if ((conf->chan.sig != SIG_FXOKS) && (conf->chan.sig != SIG_FXSKS)) {
+ chan_sig = 0;
+ else if ((chan_sig != SIG_FXOKS) && (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;
}
@@ -7363,23 +7364,35 @@
}
#endif
} else {
- conf->chan.sig = tmp->sig;
- conf->chan.radio = tmp->radio;
+ chan_sig = tmp->sig;
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 ((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)) {
+ switch (chan_sig) {
+ case SIG_FXSKS:
+ case SIG_FXSLS:
+ case SIG_EM:
+ case SIG_EM_E1:
+ case SIG_EMWINK:
+ case SIG_FEATD:
+ case SIG_FEATDMF:
+ case SIG_FEATDMF_TA:
+ case SIG_FEATB:
+ case SIG_E911:
+ case SIG_SF:
+ case SIG_SFWINK:
+ case SIG_FGC_CAMA:
+ case SIG_FGC_CAMAMF:
+ case SIG_SF_FEATD:
+ case SIG_SF_FEATDMF:
+ case SIG_SF_FEATB:
p.starttime = 250;
- }
- if (conf->chan.radio) {
+ break;
+ }
+
+ if (tmp->radio) {
/* XXX Waiting to hear back from Jim if these should be adjustable XXX */
p.channo = channel;
p.rxwinktime = 1;
@@ -7387,7 +7400,7 @@
p.starttime = 1;
p.debouncetime = 5;
}
- if (!conf->chan.radio) {
+ if (!tmp->radio) {
p.channo = channel;
/* Override timing settings based on config file */
if (conf->timing.prewinktime >= 0)
@@ -7436,12 +7449,11 @@
#endif
tmp->immediate = conf->chan.immediate;
tmp->transfertobusy = conf->chan.transfertobusy;
- tmp->sig = conf->chan.sig;
+ tmp->sig = chan_sig;
tmp->outsigmod = conf->chan.outsigmod;
- tmp->radio = conf->chan.radio;
tmp->ringt_base = ringt_base;
tmp->firstradio = 0;
- if ((conf->chan.sig == SIG_FXOKS) || (conf->chan.sig == SIG_FXOLS) || (conf->chan.sig == SIG_FXOGS))
+ if ((chan_sig == SIG_FXOKS) || (chan_sig == SIG_FXOLS) || (chan_sig == SIG_FXOGS))
tmp->permcallwaiting = conf->chan.callwaiting;
else
tmp->permcallwaiting = 0;
@@ -7536,7 +7548,7 @@
ast_dsp_digitmode(tmp->dsp, DSP_DIGITMODE_DTMF | tmp->dtmfrelax);
update_conf(tmp);
if (!here) {
- if (conf->chan.sig != SIG_PRI)
+ if (chan_sig != SIG_PRI)
/* Hang it up to be sure it's good */
zt_set_hook(tmp->subs[SUB_REAL].zfd, ZT_ONHOOK);
}
More information about the svn-commits
mailing list