summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-10-11 06:47:59 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-10-11 06:47:59 -0500
commitda78600feba37cf5415eac01b1d4b5cee7bcac3a (patch)
tree755f5e71978eb55578048f2671453825093b4124
parentd75beaa04ab30aed45da2a32a4b1488995484180 (diff)
parent349c34f72a0a84c052b62adbefe73b481f66c93c (diff)
Merge "res_rtp_asterisk: Fix infinite DTMF issue when switching to P2P bridge" into 13
-rw-r--r--res/res_rtp_asterisk.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 627f800a4..95fe6d3ea 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -4286,6 +4286,7 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance, unsigned int
int reconstruct = ntohl(rtpheader[0]);
struct ast_sockaddr remote_address = { {0,} };
int ice;
+ unsigned int timestamp = ntohl(rtpheader[1]);
/* Get fields from packet */
payload = (reconstruct & 0x7f0000) >> 16;
@@ -4314,6 +4315,22 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance, unsigned int
return -1;
}
+ /* If bridged peer is in dtmf, feed all packets to core until it finishes to avoid infinite dtmf */
+ if (bridged->sending_digit) {
+ ast_debug(1, "Feeding packets to core until DTMF finishes\n");
+ return -1;
+ }
+
+ /*
+ * Even if we are no longer in dtmf, we could still be receiving
+ * re-transmissions of the last dtmf end still. Feed those to the
+ * core so they can be filtered accordingly.
+ */
+ if (rtp->last_end_timestamp == timestamp) {
+ ast_debug(1, "Feeding packet with duplicate timestamp to core\n");
+ return -1;
+ }
+
/* If the marker bit has been explicitly set turn it on */
if (ast_test_flag(rtp, FLAG_NEED_MARKER_BIT)) {
mark = 1;