Index: main/rtp.c =================================================================== --- main/rtp.c (revision 560) +++ main/rtp.c (working copy) @@ -1446,8 +1446,18 @@ struct frame_list frames; /* If time is up, kill it */ - if (rtp->sending_digit) + if (rtp->sending_digit > 1) { ast_rtp_senddigit_continuation(rtp); + } else { + /* Skip the first one due to possible BEGIN retransmits + Yes, this is a poor coding solution, more of a bad hack. + Tests have shown that there's always one CONT packet sent without an incoming CONT + right after we've sent the BEGIN. Un-needed. + */ + if (rtp->sending_digit == 1) { + rtp->sending_digit = 2; + } + } len = sizeof(sin); @@ -2707,11 +2717,11 @@ ntohs(rtp->them.sin_port), payload, rtp->seqno, rtp->lastdigitts, res - hdrlen); /* Increment sequence number */ rtp->seqno++; - /* Increment duration */ - rtp->send_duration += 160; /* Clear marker bit and set seqno */ rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno)); } + /* Increment duration */ + rtp->send_duration += 160; /* Since we received a begin, we can safely store the digit and disable any compensation */ rtp->sending_digit = 1; @@ -2731,6 +2741,7 @@ if (!rtp->them.sin_addr.s_addr || !rtp->them.sin_port) return 0; + /* Setup packet to send */ rtpheader = (unsigned int *)data; rtpheader[0] = htonl((2 << 30) | (1 << 23) | (rtp->send_payload << 16) | (rtp->seqno)); @@ -2768,7 +2779,7 @@ /* If no address, then bail out */ if (!rtp->them.sin_addr.s_addr || !rtp->them.sin_port) return 0; - + if ((digit <= '9') && (digit >= '0')) digit -= '0'; else if (digit == '*') @@ -2792,6 +2803,7 @@ rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (rtp->send_duration)); /* Set end bit */ rtpheader[3] |= htonl((1 << 23)); + rtp->send_duration -= 160; /* Compensate for the last CONT packet */ /* Send 3 termination packets */ for (i = 0; i < 3; i++) {