[Asterisk-cvs] asterisk/channels chan_zap.c,1.344.2.19,1.344.2.20
russell at lists.digium.com
russell at lists.digium.com
Wed Jun 15 17:41:05 CDT 2005
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv19802/channels
Modified Files:
Tag: v1-0
chan_zap.c
Log Message:
add support for native DTMF
Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.344.2.19
retrieving revision 1.344.2.20
diff -u -d -r1.344.2.19 -r1.344.2.20
--- chan_zap.c 13 Jun 2005 22:18:44 -0000 1.344.2.19
+++ chan_zap.c 15 Jun 2005 21:42:31 -0000 1.344.2.20
@@ -69,6 +69,12 @@
#error "Your zaptel is too old. please cvs update"
#endif
+#ifndef ZT_TONEDETECT
+/* Work around older code with no tone detect */
+#define ZT_EVENT_DTMFDOWN 0
+#define ZT_EVENT_DTMFUP 0
+#endif
+
/*
* Define ZHONE_HACK to cause us to go off hook and then back on hook when
* the user hangs up to reset the state machine so ring works properly.
@@ -3081,7 +3087,7 @@
} else
res = zt_get_event(p->subs[index].zfd);
ast_log(LOG_DEBUG, "Got event %s(%d) on channel %d (index %d)\n", event2str(res), res, p->channel, index);
- if (res & (ZT_EVENT_PULSEDIGIT | ZT_EVENT_DTMFDIGIT)) {
+ if (res & (ZT_EVENT_PULSEDIGIT | ZT_EVENT_DTMFUP)) {
if (res & ZT_EVENT_PULSEDIGIT)
p->pulsedial = 1;
else
@@ -3089,7 +3095,16 @@
ast_log(LOG_DEBUG, "Pulse dial '%c'\n", res & 0xff);
p->subs[index].f.frametype = AST_FRAME_DTMF;
p->subs[index].f.subclass = res & 0xff;
- /* Return the captured digit */
+ /* Unmute conference, return the captured digit */
+ zt_confmute(p, 0);
+ return &p->subs[index].f;
+ }
+ if (res & ZT_EVENT_DTMFDOWN) {
+ ast_log(LOG_DEBUG, "DTMF Down '%c'\n", res & 0xff);
+ p->subs[index].f.frametype = AST_FRAME_NULL;
+ p->subs[index].f.subclass = 0;
+ zt_confmute(p, 1);
+ /* Mute conference, return null frame */
return &p->subs[index].f;
}
switch(res) {
@@ -4415,7 +4430,11 @@
(i->outgoing && (i->callprogress & 2))) {
features |= DSP_FEATURE_FAX_DETECT;
}
- features |= DSP_FEATURE_DTMF_DETECT;
+#ifdef ZT_TONEDETECT
+ x = ZT_TONEDETECT_ON | ZT_TONEDETECT_MUTE;
+ if (ioctl(i->subs[index].zfd, ZT_TONEDETECT, &x))
+#endif
+ features |= DSP_FEATURE_DTMF_DETECT;
if (features) {
if (i->dsp) {
ast_log(LOG_DEBUG, "Already have a dsp on %s?\n", tmp->name);
@@ -6945,6 +6964,8 @@
} else if (opt == 'd') {
/* If this is an ISDN call, make it digital */
p->digital = 1;
+ if (tmp)
+ ast_set_flag(tmp, AST_FLAG_DIGITAL);
} else {
ast_log(LOG_WARNING, "Unknown option '%c' in '%s'\n", opt, (char *)data);
}
More information about the svn-commits
mailing list