[asterisk-commits] jpeeler: branch 1.6.2 r289798 - in /branches/1.6.2: ./ channels/ include/aste...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Oct 1 18:01:35 CDT 2010
Author: jpeeler
Date: Fri Oct 1 18:01:31 2010
New Revision: 289798
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=289798
Log:
Merged revisions 289797 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r289797 | jpeeler | 2010-10-01 17:58:38 -0500 (Fri, 01 Oct 2010) | 15 lines
Change RFC2833 DTMF event duration on end to report actual elapsed time.
The scenario here is with a non P2P early media session. The reported time
length of DTMF presses are coming up short when sending to the remote side.
Currently the event duration is a running total that is incremented when sending
continuation packets. These continuation packets are only triggered upon
incoming media from the remote side, which means that the running total probably
is not going to end up matching the actual length of time Asterisk received
DTMF. This patch changes the end event duration to be lengthened if it is
detected that the end event is going to come up short.
Review: https://reviewboard.asterisk.org/r/957/
ABE-2476
........
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/channels/chan_sip.c
branches/1.6.2/include/asterisk/rtp.h
branches/1.6.2/main/rtp.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: branches/1.6.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=289798&r1=289797&r2=289798
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Fri Oct 1 18:01:31 2010
@@ -6441,7 +6441,7 @@
break;
case SIP_DTMF_RFC2833:
if (p->rtp)
- ast_rtp_senddigit_end(p->rtp, digit);
+ ast_rtp_senddigit_end_with_duration(p->rtp, digit, duration);
break;
case SIP_DTMF_INBAND:
res = -1; /* Tell Asterisk to stop inband indications */
Modified: branches/1.6.2/include/asterisk/rtp.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/include/asterisk/rtp.h?view=diff&rev=289798&r1=289797&r2=289798
==============================================================================
--- branches/1.6.2/include/asterisk/rtp.h (original)
+++ branches/1.6.2/include/asterisk/rtp.h Fri Oct 1 18:01:31 2010
@@ -211,6 +211,7 @@
int ast_rtp_senddigit_begin(struct ast_rtp *rtp, char digit);
int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit);
+int ast_rtp_senddigit_end_with_duration(struct ast_rtp *rtp, char digit, unsigned int duration);
int ast_rtp_sendcng(struct ast_rtp *rtp, int level);
Modified: branches/1.6.2/main/rtp.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/rtp.c?view=diff&rev=289798&r1=289797&r2=289798
==============================================================================
--- branches/1.6.2/main/rtp.c (original)
+++ branches/1.6.2/main/rtp.c Fri Oct 1 18:01:31 2010
@@ -206,6 +206,7 @@
static unsigned int ast_rtcp_calc_interval(struct ast_rtp *rtp);
static int ast_rtp_senddigit_continuation(struct ast_rtp *rtp);
int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit);
+int ast_rtp_senddigit_end_with_duration(struct ast_rtp *rtp, char digit, unsigned int duration);
#define FLAG_3389_WARNING (1 << 0)
#define FLAG_NAT_ACTIVE (3 << 1)
@@ -3285,12 +3286,18 @@
return 0;
}
+int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit)
+{
+ return ast_rtp_senddigit_end_with_duration(rtp, digit, 0);
+}
+
/*! \brief Send end packets for DTMF */
-int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit)
+int ast_rtp_senddigit_end_with_duration(struct ast_rtp *rtp, char digit, unsigned int duration)
{
unsigned int *rtpheader;
int hdrlen = 12, res = 0, i = 0;
char data[256];
+ unsigned int measured_samples;
/* If no address, then bail out */
if (!rtp->them.sin_addr.s_addr || !rtp->them.sin_port)
@@ -3312,6 +3319,11 @@
}
rtp->dtmfmute = ast_tvadd(ast_tvnow(), ast_tv(0, 500000));
+
+ if (duration > 0 && (measured_samples = duration * rtp_get_rate(rtp->f.subclass) / 1000) > rtp->send_duration) {
+ ast_debug(2, "Adjusting final end duration from %u to %u\n", rtp->send_duration, measured_samples);
+ rtp->send_duration = measured_samples;
+ }
rtpheader = (unsigned int *)data;
rtpheader[1] = htonl(rtp->lastdigitts);
More information about the asterisk-commits
mailing list