[asterisk-commits] kpfleming: branch group/vldtmf r40518 - /team/group/vldtmf/channels/chan_zap.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Aug 19 07:12:04 MST 2006


Author: kpfleming
Date: Sat Aug 19 09:12:03 2006
New Revision: 40518

URL: http://svn.digium.com/view/asterisk?rev=40518&view=rev
Log:
send DTMF_BEGIN/DTMF_END events properly when Zaptel does tone detection for us

Modified:
    team/group/vldtmf/channels/chan_zap.c

Modified: team/group/vldtmf/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/group/vldtmf/channels/chan_zap.c?rev=40518&r1=40517&r2=40518&view=diff
==============================================================================
--- team/group/vldtmf/channels/chan_zap.c (original)
+++ team/group/vldtmf/channels/chan_zap.c Sat Aug 19 09:12:03 2006
@@ -3587,7 +3587,6 @@
 	pthread_t threadid;
 	pthread_attr_t attr;
 	struct ast_channel *chan;
-	struct ast_frame dtmf_frame = { .frametype = AST_FRAME_DTMF };
 
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -3615,24 +3614,15 @@
 	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_DTMFUP)) {
-		if (res & ZT_EVENT_PULSEDIGIT)
-			p->pulsedial = 1;
-		else
-			p->pulsedial = 0;
+		p->pulsedial =  (res & ZT_EVENT_PULSEDIGIT) ? 1 : 0;
 		ast_log(LOG_DEBUG, "Detected %sdigit '%c'\n", p->pulsedial ? "pulse ": "", res & 0xff);
 #ifdef HAVE_PRI
 		if (!p->proceeding && p->sig == SIG_PRI && p->pri && p->pri->overlapdial) {
 			/* absorb event */
 		} else {
 #endif
-			/* Send a DTMF event for 'legacy' channels and all applications,
-			   and a DTMF_BEGIN event for channels that handle variable duration
-			   DTMF events
-			*/
-			p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
+			p->subs[index].f.frametype = AST_FRAME_DTMF_END;
 			p->subs[index].f.subclass = res & 0xff;
-			dtmf_frame.subclass = res & 0xff;
-			p->subs[index].f.next = ast_frdup(&dtmf_frame);
 #ifdef HAVE_PRI
 		}
 #endif
@@ -3645,9 +3635,6 @@
 		ast_log(LOG_DEBUG, "DTMF Down '%c'\n", res & 0xff);
 		/* Mute conference */
 		zt_confmute(p, 1);
-		/* Send a DTMF_BEGIN event for devices that want variable
-		   duration DTMF events
-		*/
 		p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
 		p->subs[index].f.subclass = res & 0xff;
 		return &p->subs[index].f;



More information about the asterisk-commits mailing list