mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-05 20:55:26 +00:00
res_rtp_asterisk: Fix infinite DTMF issue when switching to P2P bridge
If a bridge switched to P2P when a DTMF was in progress it was possible for the DTMF to continue being sent indefinitely. Change-Id: I7e2a3efe0d59d4b214ed50cd0b5d0317e2d92e29
This commit is contained in:
committed by
Richard Mudgett
parent
f2e392a3d2
commit
349c34f72a
@@ -4286,6 +4286,7 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance, unsigned int
|
|||||||
int reconstruct = ntohl(rtpheader[0]);
|
int reconstruct = ntohl(rtpheader[0]);
|
||||||
struct ast_sockaddr remote_address = { {0,} };
|
struct ast_sockaddr remote_address = { {0,} };
|
||||||
int ice;
|
int ice;
|
||||||
|
unsigned int timestamp = ntohl(rtpheader[1]);
|
||||||
|
|
||||||
/* Get fields from packet */
|
/* Get fields from packet */
|
||||||
payload = (reconstruct & 0x7f0000) >> 16;
|
payload = (reconstruct & 0x7f0000) >> 16;
|
||||||
@@ -4314,6 +4315,22 @@ static int bridge_p2p_rtp_write(struct ast_rtp_instance *instance, unsigned int
|
|||||||
return -1;
|
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 the marker bit has been explicitly set turn it on */
|
||||||
if (ast_test_flag(rtp, FLAG_NEED_MARKER_BIT)) {
|
if (ast_test_flag(rtp, FLAG_NEED_MARKER_BIT)) {
|
||||||
mark = 1;
|
mark = 1;
|
||||||
|
Reference in New Issue
Block a user