aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-02 02:43:45 +0000
committerjpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-02 02:43:45 +0000
commit0cb3dec91ee785b8c07150d78ac296c1debb9a57 (patch)
treed11e0d1f7cdeb2456a50e9f47d0b592d113ccbd4 /res
parentdfb1c45c3cbd058d3fcb2fe7d982ccae6b6b562c (diff)
Merged revisions 289798 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r289798 | jpeeler | 2010-10-01 18:01:31 -0500 (Fri, 01 Oct 2010) | 22 lines 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.8@289840 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_rtp_asterisk.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 643794890..ffd7b2596 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -255,6 +255,7 @@ static int ast_rtp_new(struct ast_rtp_instance *instance, struct sched_context *
static int ast_rtp_destroy(struct ast_rtp_instance *instance);
static int ast_rtp_dtmf_begin(struct ast_rtp_instance *instance, char digit);
static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit);
+static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration);
static void ast_rtp_update_source(struct ast_rtp_instance *instance);
static void ast_rtp_change_source(struct ast_rtp_instance *instance);
static int ast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
@@ -279,6 +280,7 @@ static struct ast_rtp_engine asterisk_rtp_engine = {
.destroy = ast_rtp_destroy,
.dtmf_begin = ast_rtp_dtmf_begin,
.dtmf_end = ast_rtp_dtmf_end,
+ .dtmf_end_with_duration = ast_rtp_dtmf_end_with_duration,
.update_source = ast_rtp_update_source,
.change_source = ast_rtp_change_source,
.write = ast_rtp_write,
@@ -639,13 +641,14 @@ static int ast_rtp_dtmf_continuation(struct ast_rtp_instance *instance)
return 0;
}
-static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)
+static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
struct ast_sockaddr remote_address = { {0,} };
int hdrlen = 12, res = 0, i = 0;
char data[256];
unsigned int *rtpheader = (unsigned int*)data;
+ unsigned int measured_samples;
ast_rtp_instance_get_remote_address(instance, &remote_address);
@@ -672,6 +675,11 @@ static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)
rtp->dtmfmute = ast_tvadd(ast_tvnow(), ast_tv(0, 500000));
+ if (duration > 0 && (measured_samples = duration * rtp_get_rate(rtp->f.subclass.codec) / 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;
+ }
+
/* Construct the packet we are going to send */
rtpheader[0] = htonl((2 << 30) | (1 << 23) | (rtp->send_payload << 16) | (rtp->seqno));
rtpheader[1] = htonl(rtp->lastdigitts);
@@ -703,6 +711,11 @@ static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)
return 0;
}
+static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)
+{
+ return ast_rtp_dtmf_end_with_duration(instance, digit, 0);
+}
+
static void ast_rtp_update_source(struct ast_rtp_instance *instance)
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);