--- rtp.old 2005-03-31 15:33:36.000000000 +0200 +++ rtp.c 2005-03-31 15:32:44.000000000 +0200 @@ -1076,6 +1076,7 @@ int payload; char data[256]; char iabuf[INET_ADDRSTRLEN]; + unsigned int duration = 0; if ((digit <= '9') && (digit >= '0')) digit -= '0'; @@ -1109,8 +1110,19 @@ rtpheader[0] = htonl((2 << 30) | (1 << 23) | (payload << 16) | (rtp->seqno++)); rtpheader[1] = htonl(rtp->lastts); rtpheader[2] = htonl(rtp->ssrc); - rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (0)); - for (x=0;x<6;x++) { +// rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (0)); + for (x=0;x<10;x++) { + rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (duration)); + if (x > 0) { + /* Clear marker bit and increment seqno */ + rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno++)); + } + if (x < 7) duration+=320; /* 800 = 100ms */ + else { + /* Set the End bit for the last 3 */ + rtpheader[3] |= htonl((1 << 23)); + } + 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)); if (res <0) @@ -1120,16 +1132,6 @@ , ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr), ntohs(rtp->them.sin_port), payload, rtp->seqno, rtp->lastts,res - hdrlen); } - if (x == 2) { - /* Clear marker bit and increment seqno */ - rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno++)); - /* Make duration 800 (100ms) */ - rtpheader[3] |= htonl((800)); - /* Set the End bit for the last 3 */ - rtpheader[3] |= htonl((1 << 23)); - } else if ( x < 5) { - rtpheader[0] = htonl((2 << 30) | (payload << 16) | (rtp->seqno++)); - } } return 0; }