aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authormattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-21 15:06:50 +0000
committermattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-21 15:06:50 +0000
commit99c911fbba5e7c3edc23084b8ebfae5a4f95d607 (patch)
tree17aadbb106bc1af3bc72b9ad0769e262fa05c78d /channels/chan_zap.c
parent51853788bd6b35b1ad2055cb7d3a04df39120efe (diff)
Get rid of DSP after we don't need it anymore in MF mode
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6181 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-xchannels/chan_zap.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 19613c7c0..b10b2741c 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -531,6 +531,7 @@ static struct zt_pvt {
unsigned int faxhandled:1; /* Has a fax tone already been handled? */
unsigned int firstradio:1;
unsigned int hanguponpolarityswitch:1;
+ unsigned int hardwaredtmf:1;
unsigned int hidecallerid;
unsigned int ignoredtmf:1;
unsigned int immediate:1; /* Answer before getting digits? */
@@ -4793,10 +4794,16 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
}
#ifdef ZT_TONEDETECT
x = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE;
- if (ioctl(i->subs[index].zfd, ZT_TONEDETECT, &x) || NEED_MFDETECT(i))
+ if (ioctl(i->subs[index].zfd, ZT_TONEDETECT, &x)) {
#endif
+ i->hardwaredtmf = 0;
features |= DSP_FEATURE_DTMF_DETECT;
-
+#ifdef ZT_TONEDETECT
+ } else if (NEED_MFDETECT(i)) {
+ i->hardwaredtmf = 1;
+ features |= DSP_FEATURE_DTMF_DETECT;
+ }
+#endif
if (features) {
if (i->dsp) {
ast_log(LOG_DEBUG, "Already have a dsp on %s?\n", tmp->name);
@@ -5192,8 +5199,17 @@ static void *ss_thread(void *data)
zt_wink(p, index);
}
zt_enable_ec(p);
- if ((p->sig == SIG_FEATDMF) || (p->sig == SIG_E911) || (p->sig == SIG_FEATB))
- if (p->dsp) ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_DTMF | p->dtmfrelax);
+ if (NEED_MFDETECT(p)) {
+ if (p->dsp) {
+ if (!p->hardwaredtmf)
+ ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_DTMF | p->dtmfrelax);
+ else {
+ ast_dsp_free(p->dsp);
+ p->dsp = NULL;
+ }
+ }
+ }
+
if (ast_exists_extension(chan, chan->context, exten, 1, chan->cid.cid_num)) {
ast_copy_string(chan->exten, exten, sizeof(chan->exten));
if (p->dsp) ast_dsp_digitreset(p->dsp);