]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix RTP DTMF for Sipura SPA-3000 (bug #3675, yet again)
authorKevin P. Fleming <kpfleming@digium.com>
Sun, 15 May 2005 04:06:16 +0000 (04:06 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Sun, 15 May 2005 04:06:16 +0000 (04:06 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5666 65c4cc65-6c06-0410-ace0-fbb531ad65f3

rtp.c

diff --git a/rtp.c b/rtp.c
index d03308dd3e3d30674cf7905e5c0a919a6e899f81..eef91944b1c7fadc2a78f751d31f3fc90ba33adb 100755 (executable)
--- a/rtp.c
+++ b/rtp.c
@@ -1077,21 +1077,25 @@ int ast_rtp_senddigit(struct ast_rtp *rtp, char digit)
        rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (0));
        for (x=0;x<6;x++) {
                if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {
-                       res = sendto(rtp->s, (void *)rtpheader, hdrlen + 4, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
+                       res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, sizeof(rtp->them));
                        if (res < 0) 
-                               ast_log(LOG_ERROR, "RTP Transmission error to %s:%d: %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr), ntohs(rtp->them.sin_port), strerror(errno));
-                       if(rtp_debug_test_addr(&rtp->them))
-                               ast_verbose("Sent RTP packet to %s:%d (type %d, seq %d, ts %d, len %d)\n"
-                                               , ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr), ntohs(rtp->them.sin_port), payload, rtp->seqno, rtp->lastdigitts, res - hdrlen);                
-                  
+                               ast_log(LOG_ERROR, "RTP Transmission error to %s:%d: %s\n",
+                                       ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr),
+                                       ntohs(rtp->them.sin_port), strerror(errno));
+                       if (rtp_debug_test_addr(&rtp->them))
+                               ast_verbose("Sent RTP packet to %s:%d (type %d, seq %d, ts %d, len %d)\n",
+                                           ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr),
+                                           ntohs(rtp->them.sin_port), payload, rtp->seqno, rtp->lastdigitts, res - hdrlen);
                }
                /* Clear marker bit and increment seqno */
-               rtpheader[0] = htonl((2 << 30)  | (payload << 16) | (rtp->seqno++));
+               rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno++));
                /* For the last three packets, set the duration and the end bit */
                if (x == 2) {
+                       rtp->lastdigitts++; /* or else the SPA3000 will click instead of beeping... */
+                       rtpheader[1] = htonl(rtp->lastdigitts);
                        /* Make duration 800 (100ms) */
                        rtpheader[3] |= htonl((800));
-                       /* Set the End bit for the last 3 */
+                       /* Set the End bit */
                        rtpheader[3] |= htonl((1 << 23));
                }
        }