aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-01 23:01:31 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-01 23:01:31 +0000
commitc7ce3d71d5256922347d6d2d7c238c4719a65fa6 (patch)
tree204b6b026496bb5a24cabaa5c2160b3d5080594c /main
parent045e4bf061183e40d4e39eb59f05913a726754c8 (diff)
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 ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@289798 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/rtp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/main/rtp.c b/main/rtp.c
index 2ed677769..7d60ad0bd 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -206,6 +206,7 @@ static int ast_rtcp_write_rr(const void *data);
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 @@ static int ast_rtp_senddigit_continuation(struct ast_rtp *rtp)
return 0;
}
-/*! \brief Send end packets for DTMF */
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_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)
@@ -3313,6 +3320,11 @@ int ast_rtp_senddigit_end(struct ast_rtp *rtp, char digit)
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);
rtpheader[2] = htonl(rtp->ssrc);