summaryrefslogtreecommitdiff
path: root/res/res_rtp_asterisk.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-05-01 21:18:24 +0000
committerMatthew Jordan <mjordan@digium.com>2013-05-01 21:18:24 +0000
commitf054420df24dfd0a80359620fdd60be0a0578046 (patch)
treea987ef33588d689a54ad34af5ebf55a07a463e09 /res/res_rtp_asterisk.c
parenta2a8afe07a345308c26199541c40db80e57c2889 (diff)
Clear the DTMF sending digit tracking on off nominal paths
In certain situations, when the RTP engine goes to send a DTMF end digit it may be in a situation where the remote address is no longer available, or the digit that was supposed to be sent is invalid. In such cases, we need to clear the RTP counters appropriately. Otherwise, when the RTP source is set again, we'll continue to think that we're in the middle of sending a DTMF digit, which can confuse the remote party (signficantly). (closes issue ASTERISK-21522) Reported by: Corey Farrell patches: rtp_dtmf_process_end.patch uploaded by Corey Farrell (License 5909) ........ Merged revisions 387213 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 387216 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@387220 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r--res/res_rtp_asterisk.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index cf7c87910..ed91eaec8 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -2034,7 +2034,7 @@ static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, cha
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
struct ast_sockaddr remote_address = { {0,} };
- int hdrlen = 12, res = 0, i = 0;
+ int hdrlen = 12, res = -1, i = 0;
char data[256];
unsigned int *rtpheader = (unsigned int*)data;
unsigned int measured_samples;
@@ -2043,7 +2043,7 @@ static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, cha
/* Make sure we know where the remote side is so we can send them the packet we construct */
if (ast_sockaddr_isnull(&remote_address)) {
- return -1;
+ goto cleanup;
}
/* Convert the given digit to the one we are going to send */
@@ -2059,7 +2059,7 @@ static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, cha
digit = digit - 'a' + 12;
} else {
ast_log(LOG_WARNING, "Don't know how to represent '%c'\n", digit);
- return -1;
+ goto cleanup;
}
rtp->dtmfmute = ast_tvadd(ast_tvnow(), ast_tv(0, 500000));
@@ -2100,13 +2100,15 @@ static int ast_rtp_dtmf_end_with_duration(struct ast_rtp_instance *instance, cha
rtp->seqno++;
}
+ res = 0;
/* Oh and we can't forget to turn off the stuff that says we are sending DTMF */
rtp->lastts += rtp->send_duration;
+cleanup:
rtp->sending_digit = 0;
rtp->send_digit = 0;
- return 0;
+ return res;
}
static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)