[Asterisk-cvs] asterisk rtp.c,1.47.2.2,1.47.2.3
markster at lists.digium.com
markster at lists.digium.com
Mon Mar 15 11:43:24 CST 2004
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv13270
Modified Files:
Tag: v1-0_stable
rtp.c
Log Message:
Back-port RTP fixes from -head
Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.47.2.2
retrieving revision 1.47.2.3
diff -u -d -r1.47.2.2 -r1.47.2.3
--- rtp.c 14 Mar 2004 22:50:27 -0000 1.47.2.2
+++ rtp.c 15 Mar 2004 16:37:35 -0000 1.47.2.3
@@ -75,6 +75,7 @@
struct sockaddr_in them;
struct timeval rxcore;
struct timeval txcore;
+ struct timeval dtmfmute;
struct ast_smoother *smoother;
int *ioid;
unsigned short seqno;
@@ -163,7 +164,17 @@
static struct ast_frame *send_dtmf(struct ast_rtp *rtp)
{
- ast_log(LOG_DEBUG, "Sending dtmf: %d (%c)\n", rtp->resp, rtp->resp);
+ struct timeval tv;
+ static struct ast_frame null_frame = { AST_FRAME_NULL, };
+ gettimeofday(&tv, NULL);
+ if ((tv.tv_sec < rtp->dtmfmute.tv_sec) ||
+ ((tv.tv_sec == rtp->dtmfmute.tv_sec) && (tv.tv_usec < rtp->dtmfmute.tv_usec))) {
+ ast_log(LOG_DEBUG, "Ignore potential DTMF echo from '%s'\n", inet_ntoa(rtp->them.sin_addr));
+ rtp->resp = 0;
+ rtp->dtmfduration = 0;
+ return &null_frame;
+ }
+ ast_log(LOG_DEBUG, "Sending dtmf: %d (%c), at %s\n", rtp->resp, rtp->resp, inet_ntoa(rtp->them.sin_addr));
rtp->f.frametype = AST_FRAME_DTMF;
rtp->f.subclass = rtp->resp;
rtp->f.datalen = 0;
@@ -867,6 +878,13 @@
if (!rtp->them.sin_addr.s_addr)
return 0;
+ gettimeofday(&rtp->dtmfmute, NULL);
+ rtp->dtmfmute.tv_usec += (500 * 1000);
+ if (rtp->dtmfmute.tv_usec > 1000000) {
+ rtp->dtmfmute.tv_usec -= 1000000;
+ rtp->dtmfmute.tv_sec += 1;
+ }
+
ms = calc_txstamp(rtp);
/* Default prediction */
pred = rtp->lastts + ms * 8;
@@ -889,8 +907,8 @@
if (x ==0) {
/* Clear marker bit and increment seqno */
rtpheader[0] = htonl((2 << 30) | (101 << 16) | (rtp->seqno++));
- /* Make duration 240 */
- rtpheader[3] |= htonl((240));
+ /* Make duration 800 (100ms) */
+ rtpheader[3] |= htonl((800));
/* Set the End bit for the last 3 */
rtpheader[3] |= htonl((1 << 23));
}
More information about the svn-commits
mailing list