[Asterisk-code-review] chan sip.c: Start ICE negotiation when response is sent or r... (asterisk[master])

Eugene Voityuk asteriskteam at digium.com
Tue Dec 8 05:43:37 CST 2015


Eugene Voityuk has uploaded a new change for review.

  https://gerrit.asterisk.org/1780

Change subject: chan_sip.c: Start ICE negotiation when response is sent or received.
......................................................................

chan_sip.c: Start ICE negotiation when response is sent or received.

The current logic for ICE negotiation starts it
when receiving an SDP with ICE candidates. This is
incorrect as browsers only start ICE negotiation when
they receive SDP. Starting ICE negotiation early
would result in negotiation failure and ultimately
no audio.

This change makes it so ICE negotiation is only started
when a response with SDP is received or when a response
with SDP is sent.

ASTERISK-24146

Change-Id: I55a632bde9e9827871b09141d82747e08379a8ca
---
M channels/chan_sip.c
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/80/1780/1

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index d0e8212..efb3ea7 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -10519,7 +10519,11 @@
 	/* Setup audio address and port */
 	if (p->rtp) {
 		if (sa && portno > 0) {
-			start_ice(p->rtp, (req->method != SIP_RESPONSE) ? 0 : 1);
+			/* Start ICE negotiation here, only when it is response, and setting that we are conrolling agent,
+			   as we are offerer */
+			if (req->method == SIP_RESPONSE) {
+				start_ice(p->rtp, 1);
+			}
 			ast_sockaddr_set_port(sa, portno);
 			ast_rtp_instance_set_remote_address(p->rtp, sa);
 			if (debug) {
@@ -13265,6 +13269,11 @@
 		if (!doing_directmedia) {
 			if (ast_test_flag(&p->flags[2], SIP_PAGE3_ICE_SUPPORT)) {
 				add_ice_to_sdp(p->rtp, &a_audio);
+				/* Start ICE negotiation, and setting that we are controlled agent,
+				   as this is response to offer */
+				if (resp->method == SIP_RESPONSE) {
+					start_ice(p->rtp, 0);
+				}
 			}
 
 			add_dtls_to_sdp(p->rtp, &a_audio);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I55a632bde9e9827871b09141d82747e08379a8ca
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Eugene Voityuk <eugene at thirdlane.com>



More information about the asterisk-code-review mailing list