From b60f5ef3ed8d174d86c827ef8770f6dbe3902f08 Mon Sep 17 00:00:00 2001
From: btovar <brando.tovar@savoirfairelinux.com>
Date: Mon, 6 Jul 2020 10:29:47 -0400
Subject: [PATCH] settings: reads port of the turn server

This patch enables Jami to read the port of the turn server after the ':'.

Change-Id: I045e3aa585b3d725445f666d2c9f8629501f124c
Gitlab: #258
---
 src/ice_transport.cpp      | 3 ++-
 src/sip/sipaccountbase.cpp | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp
index 74ea713228..914706f607 100644
--- a/src/ice_transport.cpp
+++ b/src/ice_transport.cpp
@@ -262,7 +262,8 @@ add_turn_server(pj_pool_t& pool, pj_ice_strans_cfg& cfg, const TurnServerInfo& i
     pj_ice_strans_turn_cfg_default(&turn);
     pj_strdup2_with_null(&pool, &turn.server, ip.toString().c_str());
     turn.af = ip.getFamily();
-    turn.port = PJ_STUN_PORT;
+    if (!(turn.port = ip.getPort()))
+        turn.port = PJ_STUN_PORT;
     turn.cfg.max_pkt_size = STUN_MAX_PACKET_SIZE;
     turn.conn_type = cfg.turn.conn_type;
 
diff --git a/src/sip/sipaccountbase.cpp b/src/sip/sipaccountbase.cpp
index f1c4c5d1c9..b590176213 100644
--- a/src/sip/sipaccountbase.cpp
+++ b/src/sip/sipaccountbase.cpp
@@ -449,14 +449,14 @@ SIPAccountBase::getIceOptions() const noexcept
         cached = cacheTurnV4_ || cacheTurnV6_;
         if (cacheTurnV4_ && *cacheTurnV4_) {
             opts.turnServers.emplace_back(TurnServerInfo()
-                                .setUri(*cacheTurnV4_)
+                                .setUri(cacheTurnV4_->toString(true))
                                 .setUsername(turnServerUserName_)
                                 .setPassword(turnServerPwd_)
                                 .setRealm(turnServerRealm_));
         }
         if (cacheTurnV6_ && *cacheTurnV6_) {
             opts.turnServers.emplace_back(TurnServerInfo()
-                                .setUri(*cacheTurnV4_)
+                                .setUri(cacheTurnV4_->toString(true))
                                 .setUsername(turnServerUserName_)
                                 .setPassword(turnServerPwd_)
                                 .setRealm(turnServerRealm_));
-- 
GitLab