[Asterisk-code-review] chan sip: fixed ice candidate as media address when specified (asterisk[13.5])

Fabrizio Lombardozzi asteriskteam at digium.com
Mon Jan 25 12:19:56 CST 2016


Fabrizio Lombardozzi has uploaded a new change for review.

  https://gerrit.asterisk.org/2087

Change subject: chan_sip: fixed ice candidate as media_address when specified
......................................................................

chan_sip: fixed ice candidate as media_address when specified

The add_ice_to_sdp() function has been forced to use media_address when a
value is assigned in sip.conf.
This allow webrtc clients to work straight with wss natted server.

ASTERISK-25360 #close

Change-Id: I352dfc76096ef4d742f14f869ecd620d4b2c8fd6
---
M channels/chan_sip.c
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/87/2087/1

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 1838bda..3eac4c6 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -12684,9 +12684,16 @@
 
 	while ((candidate = ao2_iterator_next(&i))) {
 		ast_str_append(a_buf, 0, "a=candidate:%s %u %s %d ", candidate->foundation, candidate->id, candidate->transport, candidate->priority);
-		ast_str_append(a_buf, 0, "%s ", ast_sockaddr_stringify_host(&candidate->address));
 
-		ast_str_append(a_buf, 0, "%s typ ", ast_sockaddr_stringify_port(&candidate->address));
+                /* We still must use media_address if specified otherwise natted servers will never be heard */
+		if (  !ast_sockaddr_isnull(&media_address)  ) {
+			ast_str_append(a_buf, 0, "%s ", ast_sockaddr_stringify_host(&media_address));
+		}
+		else {
+			ast_str_append(a_buf, 0, "%s ", ast_sockaddr_stringify_host(&candidate->address));
+		}
+
+			ast_str_append(a_buf, 0, "%s typ ", ast_sockaddr_stringify_port(&candidate->address));
 
 		if (candidate->type == AST_RTP_ICE_CANDIDATE_TYPE_HOST) {
 			ast_str_append(a_buf, 0, "host");

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I352dfc76096ef4d742f14f869ecd620d4b2c8fd6
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13.5
Gerrit-Owner: Fabrizio Lombardozzi <fabrizio.lombardozzi at sociale.it>



More information about the asterisk-code-review mailing list