<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2">
</HEAD>
<BODY>
Using tethereal, I noticed what you said below.. When the sender presses a digit, Asterisk will send the receiver 6 packets per digit also (3 "ON" followed by 3 "OFF"). I think our SIP ATA's are freaking out over this strange construction of data which is why I don't hear the digits.<BR>
<BR>
I am not using BSD and not sure I understand what your "patch-rtp.c" was for, but I will apply your "rtp.c.patch" today and see what happens. Thank you!<BR>
<BR>
Bryan<BR>
<BR>
<BR>
On Sat, 2005-05-21 at 12:02 +0500, Vahan Yerkanian wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Greetings,</FONT>
<FONT COLOR="#000000">I've encountered this same problem and by measuring the duration on the </FONT>
<FONT COLOR="#000000">gateway device I found out that Asterisk sends 3 rtp packets with the </FONT>
<FONT COLOR="#000000">DTFM payload for each digit, and 3 rtp packets with DTFM mute. Looking </FONT>
<FONT COLOR="#000000">into the source of rtp.c you can find that Asterisk sends those 6 </FONT>
<FONT COLOR="#000000">packets in a very interesting way. Anyhow this fast cludge piece of </FONT>
<FONT COLOR="#000000">patch fixed that for me. Also note about 800ms of silence / mute after </FONT>
<FONT COLOR="#000000">pressing the digit, not sure why it's so big. Well if you don't press </FONT>
<FONT COLOR="#000000">digits and talk simultaneously/right away, no bigie.</FONT>
<FONT COLOR="#000000">Again, this is an ugly hack over a hack.</FONT>
<FONT COLOR="#000000">patch-rtp.c is patched version for the freebsd ports version for 1.0.7, </FONT>
<FONT COLOR="#000000">to be copied over the original in /usr/ports/net/asterisk/files</FONT>
<FONT COLOR="#000000">rtp.c.patch is just a diff -u.</FONT>
<FONT COLOR="#000000">Both are for STABLE. I think this was "corrected" in the CVS last week.</FONT>
<FONT COLOR="#000000">HTH,</FONT>
<FONT COLOR="#000000">Vahan</FONT>
<FONT COLOR="#000000">Bryan Field-Elliot wrote:</FONT>
<FONT COLOR="#000000">> I am using the current release of Asterisk (1.0.7).</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> When either a SIP user or a IAX2 user is transferred to a SIP extension, </FONT>
<FONT COLOR="#000000">> DTMF doesn't seem to be handled very well. Specifically, when the caller </FONT>
<FONT COLOR="#000000">> presses DTMF digits (even if they hold them down), the recipient of the </FONT>
<FONT COLOR="#000000">> call (SIP) only hears the briefest DTMF pulse imaginable (e.g. 50 </FONT>
<FONT COLOR="#000000">> milliseconds or so).</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> Is this a bug in Asterisk? When the caller holds down a DTMF digit, I </FONT>
<FONT COLOR="#000000">> need the callee to hear the full duration of the tone.</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> We are using RFC2833 everywhere.</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> Thank you,</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> Bryan</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> ------------------------------------------------------------------------</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> _______________________________________________</FONT>
<FONT COLOR="#000000">> Asterisk-Dev mailing list</FONT>
<FONT COLOR="#000000">> <A HREF="mailto:Asterisk-Dev@lists.digium.com">Asterisk-Dev@lists.digium.com</A></FONT>
<FONT COLOR="#000000">> <A HREF="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</A></FONT>
<FONT COLOR="#000000">> To UNSUBSCRIBE or update options visit:</FONT>
<FONT COLOR="#000000">> <A HREF="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</A></FONT>
</PRE>
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="1">
<TR>
<TD>
<FONT SIZE="2">plain text document attachment (patch-rtp.c)</FONT>
</TD>
</TR>
</TABLE>
<PRE>
<FONT COLOR="#000000">--- rtp.c.orig        Sun May 15 16:33:19 2005</FONT>
<FONT COLOR="#000000">+++ rtp.c        Sun May 15 16:33:15 2005</FONT>
<FONT COLOR="#000000">@@ -127,7 +127,7 @@</FONT>
<FONT COLOR="#000000"> {</FONT>
<FONT COLOR="#000000">         switch(buf & TYPE_MASK) {</FONT>
<FONT COLOR="#000000">         case TYPE_DONTSEND:</FONT>
<FONT COLOR="#000000">-                return 0;</FONT>
<FONT COLOR="#000000">+                return 2;</FONT>
<FONT COLOR="#000000">                 break;</FONT>
<FONT COLOR="#000000">         case TYPE_SILENCE:</FONT>
<FONT COLOR="#000000">                 return 4;</FONT>
<FONT COLOR="#000000">@@ -351,9 +351,7 @@</FONT>
<FONT COLOR="#000000">                                         0, (struct sockaddr *)&sin, &len);</FONT>
<FONT COLOR="#000000">         </FONT>
<FONT COLOR="#000000">         if (res < 0) {</FONT>
<FONT COLOR="#000000">-                if (errno == EAGAIN)</FONT>
<FONT COLOR="#000000">-                        ast_log(LOG_NOTICE, "RTP: Received packet with bad UDP checksum\n");</FONT>
<FONT COLOR="#000000">-                else</FONT>
<FONT COLOR="#000000">+                if (errno != EAGAIN)</FONT>
<FONT COLOR="#000000">                         ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));</FONT>
<FONT COLOR="#000000">                 if (errno == EBADF)</FONT>
<FONT COLOR="#000000">                         CRASH;</FONT>
<FONT COLOR="#000000">@@ -431,9 +429,7 @@</FONT>
<FONT COLOR="#000000"> </FONT>
<FONT COLOR="#000000">         rtpheader = (unsigned int *)(rtp->rawdata + AST_FRIENDLY_OFFSET);</FONT>
<FONT COLOR="#000000">         if (res < 0) {</FONT>
<FONT COLOR="#000000">-                if (errno == EAGAIN)</FONT>
<FONT COLOR="#000000">-                        ast_log(LOG_NOTICE, "RTP: Received packet with bad UDP checksum\n");</FONT>
<FONT COLOR="#000000">-                else</FONT>
<FONT COLOR="#000000">+                if (errno != EAGAIN)</FONT>
<FONT COLOR="#000000">                         ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));</FONT>
<FONT COLOR="#000000">                 if (errno == EBADF)</FONT>
<FONT COLOR="#000000">                         CRASH;</FONT>
<FONT COLOR="#000000">@@ -862,8 +858,10 @@</FONT>
<FONT COLOR="#000000">                 /* Must be an even port number by RTP spec */</FONT>
<FONT COLOR="#000000">                 rtp->us.sin_port = htons(x);</FONT>
<FONT COLOR="#000000">                 rtp->us.sin_addr = addr;</FONT>
<FONT COLOR="#000000">-                if (rtp->rtcp)</FONT>
<FONT COLOR="#000000">+                if (rtp->rtcp) {</FONT>
<FONT COLOR="#000000">                         rtp->rtcp->us.sin_port = htons(x + 1);</FONT>
<FONT COLOR="#000000">+                        rtp->rtcp->us.sin_addr = addr;</FONT>
<FONT COLOR="#000000">+                }</FONT>
<FONT COLOR="#000000">                 if (!(first = bind(rtp->s, (struct sockaddr *)&rtp->us, sizeof(rtp->us))) &&</FONT>
<FONT COLOR="#000000">                         (!rtp->rtcp || !bind(rtp->rtcp->s, (struct sockaddr *)&rtp->rtcp->us, sizeof(rtp->rtcp->us))))</FONT>
<FONT COLOR="#000000">                         break;</FONT>
<FONT COLOR="#000000">@@ -1037,7 +1035,7 @@</FONT>
<FONT COLOR="#000000">         rtpheader[1] = htonl(rtp->lastts);</FONT>
<FONT COLOR="#000000">         rtpheader[2] = htonl(rtp->ssrc); </FONT>
<FONT COLOR="#000000">         rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (0));</FONT>
<FONT COLOR="#000000">-        for (x=0;x<6;x++) {</FONT>
<FONT COLOR="#000000">+        for (x=0;x<20;x++) {</FONT>
<FONT COLOR="#000000">                 if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {</FONT>
<FONT COLOR="#000000">                         res = sendto(rtp->s, (void *)rtpheader, hdrlen + 4, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));</FONT>
<FONT COLOR="#000000">                         if (res <0) </FONT>
<FONT COLOR="#000000">@@ -1046,14 +1044,14 @@</FONT>
<FONT COLOR="#000000">                 printf("Sent %d bytes of RTP data to %s:%d\n", res, ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr), ntohs(rtp->them.sin_port));</FONT>
<FONT COLOR="#000000">         #endif                </FONT>
<FONT COLOR="#000000">                 }</FONT>
<FONT COLOR="#000000">-                if (x == 2) {</FONT>
<FONT COLOR="#000000">+                if (x == 17) {</FONT>
<FONT COLOR="#000000">                         /* Clear marker bit and increment seqno */</FONT>
<FONT COLOR="#000000">                         rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno++));</FONT>
<FONT COLOR="#000000">                         /* Make duration 800 (100ms) */</FONT>
<FONT COLOR="#000000">                         rtpheader[3] |= htonl((800));</FONT>
<FONT COLOR="#000000">                         /* Set the End bit for the last 3 */</FONT>
<FONT COLOR="#000000">                         rtpheader[3] |= htonl((1 << 23));</FONT>
<FONT COLOR="#000000">-                } else if ( x < 5) {</FONT>
<FONT COLOR="#000000">+                } else if ( x < 19) {</FONT>
<FONT COLOR="#000000">                         rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno++));</FONT>
<FONT COLOR="#000000">                 }</FONT>
<FONT COLOR="#000000">         }</FONT>
</PRE>
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="1">
<TR>
<TD>
<FONT SIZE="2">plain text document attachment (rtp.c.patch)</FONT>
</TD>
</TR>
</TABLE>
<PRE>
<FONT COLOR="#000000">--- rtp.c        Sun May 15 15:41:40 2005</FONT>
<FONT COLOR="#000000">+++ rtp.c.orig        Sun May 15 12:34:11 2005</FONT>
<FONT COLOR="#000000">@@ -1035,7 +1035,7 @@</FONT>
<FONT COLOR="#000000">         rtpheader[1] = htonl(rtp->lastts);</FONT>
<FONT COLOR="#000000">         rtpheader[2] = htonl(rtp->ssrc); </FONT>
<FONT COLOR="#000000">         rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (0));</FONT>
<FONT COLOR="#000000">-        for (x=0;x<20;x++) {</FONT>
<FONT COLOR="#000000">+        for (x=0;x<6;x++) {</FONT>
<FONT COLOR="#000000">                 if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {</FONT>
<FONT COLOR="#000000">                         res = sendto(rtp->s, (void *)rtpheader, hdrlen + 4, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));</FONT>
<FONT COLOR="#000000">                         if (res <0) </FONT>
<FONT COLOR="#000000">@@ -1044,14 +1044,14 @@</FONT>
<FONT COLOR="#000000">                 printf("Sent %d bytes of RTP data to %s:%d\n", res, ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr), ntohs(rtp->them.sin_port));</FONT>
<FONT COLOR="#000000">         #endif                </FONT>
<FONT COLOR="#000000">                 }</FONT>
<FONT COLOR="#000000">-                if (x == 17) {</FONT>
<FONT COLOR="#000000">+                if (x == 2) {</FONT>
<FONT COLOR="#000000">                         /* Clear marker bit and increment seqno */</FONT>
<FONT COLOR="#000000">                         rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno++));</FONT>
<FONT COLOR="#000000">                         /* Make duration 800 (100ms) */</FONT>
<FONT COLOR="#000000">                         rtpheader[3] |= htonl((800));</FONT>
<FONT COLOR="#000000">                         /* Set the End bit for the last 3 */</FONT>
<FONT COLOR="#000000">                         rtpheader[3] |= htonl((1 << 23));</FONT>
<FONT COLOR="#000000">-                } else if ( x < 19) {</FONT>
<FONT COLOR="#000000">+                } else if ( x < 5) {</FONT>
<FONT COLOR="#000000">                         rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno++));</FONT>
<FONT COLOR="#000000">                 }</FONT>
<FONT COLOR="#000000">         }</FONT>
<FONT COLOR="#000000">_______________________________________________</FONT>
<FONT COLOR="#000000">Asterisk-Dev mailing list</FONT>
<FONT COLOR="#000000"><A HREF="mailto:Asterisk-Dev@lists.digium.com">Asterisk-Dev@lists.digium.com</A></FONT>
<FONT COLOR="#000000"><A HREF="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</A></FONT>
<FONT COLOR="#000000">To UNSUBSCRIBE or update options visit:</FONT>
<FONT COLOR="#000000"> <A HREF="http://lists.digium.com/mailman/listinfo/asterisk-dev">http://lists.digium.com/mailman/listinfo/asterisk-dev</A></FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>