[svn-commits] file: branch group/vldtmf r39454 - /team/group/vldtmf/rtp.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Aug 8 21:07:31 MST 2006


Author: file
Date: Tue Aug  8 23:07:30 2006
New Revision: 39454

URL: http://svn.digium.com/view/asterisk?rev=39454&view=rev
Log:
Add support so (if configured) we will compensate for the remote RFC2833 implementation. Based on their specified duration we will send the AST_FRAME_DTMF_END at the appropriate time.

Modified:
    team/group/vldtmf/rtp.c

Modified: team/group/vldtmf/rtp.c
URL: http://svn.digium.com/view/asterisk/team/group/vldtmf/rtp.c?rev=39454&r1=39453&r2=39454&view=diff
==============================================================================
--- team/group/vldtmf/rtp.c (original)
+++ team/group/vldtmf/rtp.c Tue Aug  8 23:07:30 2006
@@ -611,7 +611,7 @@
 		resp = 'X';
 	}
 	if (rtp->resp && (rtp->resp != resp)) {
-		f = send_dtmf(rtp, AST_FRAME_DTMF_BEGIN);
+		f = send_dtmf(rtp, AST_FRAME_DTMF_END);
 	}
 	rtp->resp = resp;
 	rtp->dtmfcount = dtmftimeout;
@@ -665,10 +665,9 @@
 
 	if ((!(rtp->resp) && (!(event_end & 0x80))) || (rtp->resp && rtp->resp != resp)) {
 		rtp->resp = resp;
-		/* Only actually send an AST_FRAME_DTMF_BEGIN If we are not compensating */
-		if (!ast_test_flag(rtp, FLAG_DTMF_COMPENSATE))
-			f = send_dtmf(rtp, AST_FRAME_DTMF_BEGIN);
-	} else if ((event_end & 0x80) && rtp->resp && rtp->lasteventendseqn != seqno) {
+		f = send_dtmf(rtp, AST_FRAME_DTMF_BEGIN);
+	} else if ((event_end & 0x80) && rtp->resp && rtp->lasteventendseqn != seqno && !ast_test_flag(rtp, FLAG_DTMF_COMPENSATE)) {
+		/* If we are compensating then our AST_FRAME_DTMF_END will come from elsewhere */
 		rtp->lasteventendseqn = seqno;
 		f = send_dtmf(rtp, AST_FRAME_DTMF_END);
 		rtp->resp = 0;
@@ -953,6 +952,7 @@
 	unsigned int timestamp;
 	unsigned int *rtpheader;
 	struct rtpPayloadType rtpPT;
+	struct ast_frame *fr = NULL;
 	
 	len = sizeof(sin);
 	
@@ -1130,6 +1130,16 @@
 			printf("dtmfcount is %d\n", rtp->dtmfcount);
 #endif
 	}
+
+	/* If we are compensating for lack of VLDTMF, then check to see if we need to send an AST_FRAME_DTMF_END */
+	if (rtp->resp && ast_test_flag(rtp, FLAG_DTMF_COMPENSATE) && (timestamp - rtp->lastrxts) >= rtp->dtmfduration) {
+		fr = send_dtmf(rtp, AST_FRAME_DTMF_END);
+		rtp->lastrxts = timestamp;
+		rtp->resp = 0;
+		return fr;
+	}
+
+	/* Record received timestamp as last received now */
 	rtp->lastrxts = timestamp;
 
 	/* Send any pending DTMF */



More information about the svn-commits mailing list