[Asterisk-code-review] res rtp asterisk: fix infinite dtmf issue when switching to ... (asterisk[11])

Torrey Searle asteriskteam at digium.com
Thu Sep 29 12:54:29 CDT 2016


Torrey Searle has uploaded a new change for review.

  https://gerrit.asterisk.org/3999

Change subject: res_rtp_asterisk: fix infinite dtmf issue when switching to p2p bridge
......................................................................

res_rtp_asterisk: fix infinite dtmf issue when switching to p2p bridge

Change-Id: I7e2a3efe0d59d4b214ed50cd0b5d0317e2d92e29
---
M res/res_rtp_asterisk.c
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/99/3999/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 3223cc9..5401fb0 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -4166,6 +4166,8 @@
 	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;
@@ -4188,6 +4190,22 @@
 		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;

-- 
To view, visit https://gerrit.asterisk.org/3999
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e2a3efe0d59d4b214ed50cd0b5d0317e2d92e29
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>



More information about the asterisk-code-review mailing list