Revision: dd51afe6489f
Author:   Jean Deruelle <[email protected]>
Date:     Mon Aug 26 20:35:33 2013 UTC
Log:      Update Issue 234

Backport from TelScale 7 branch

Adding code to allow TURN and STUN to be set. To be tested on EC2
(cherry picked from commit 1432aefd308d62df0f5da64d5f1f14751bffe3ad)

http://code.google.com/p/sipservlets/source/detail?r=dd51afe6489f

Modified:
/sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/MobicentsWebRTCPhoneView.html /sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/js/MobicentsWebRTCPhoneController.js /sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/js/WebRTComm.js

=======================================
--- /sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/MobicentsWebRTCPhoneView.html Wed Jul 10 21:33:33 2013 UTC +++ /sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/MobicentsWebRTCPhoneView.html Mon Aug 26 20:35:33 2013 UTC
@@ -245,6 +245,21 @@
             {
                 document.getElementById("stunServer").value=value;
             }
+
+           function setTurnServerTextInputValue(value)
+            {
+                document.getElementById("turnServer").value=value;
+            }
+
+           function setTurnLoginTextInputValue(value)
+            {
+                document.getElementById("turnLogin").value=value;
+            }
+
+           function setTurnPasswordTextInputValue(value)
+            {
+                document.getElementById("turnPassword").value=value;
+            }

             function setSipOutboundProxyTextInputValue(value)
             {
@@ -294,6 +309,21 @@
             {
                 return getTextInputValue("stunServer")
             }
+
+           function getTurnServerTextInputValue()
+            {
+                return getTextInputValue("turnServer")
+            }
+
+           function getTurnLoginTextInputValue()
+            {
+                return getTextInputValue("turnLogin")
+            }
+
+           function getTurnPasswordTextInputValue()
+            {
+                return getTextInputValue("turnPassword")
+            }

             function getSipOutboundProxyTextInputValue()
             {
@@ -459,6 +489,18 @@
<label class="control-label" for="stunServer"><a style="color:#555555" href="#" rel="tooltip" title="Specify the IP Address and Port of a Stun Server" data-placement="top" data-delay: { show: 10, hide: 100 }>STUN server</a>:</label> <input id="stunServer" type="text" size="30">
                                             </div>
+                                           <div class="control-group" 
id='turnServerDiv'>
+ <label class="control-label" for="turnServer"><a style="color:#555555" href="#" rel="tooltip" title="Specify the IP Address and Port of a Turn Server" data-placement="top" data-delay: { show: 10, hide: 100 }>TURN server</a>:</label> + <input id="turnServer" type="text" size="30">
+                                            </div>
+                                           <div class="control-group" 
id='turnLoginDiv'>
+ <label class="control-label" for="turnLogin"><a style="color:#555555" href="#" rel="tooltip" title="Turn Server Login" data-placement="top" data-delay: { show: 10, hide: 100 }>TURN server Login</a>:</label> + <input id="turnLogin" type="text" size="30">
+                                            </div>
+                                           <div class="control-group" 
id='turnPasswordDiv'>
+ <label class="control-label" for="turnPassword"><a style="color:#555555" href="#" rel="tooltip" title="Turn Server Password" data-placement="top" data-delay: { show: 10, hide: 100 }>TURN server Password</a>:</label> + <input id="turnPassword" type="text" size="30">
+                                            </div>
<div class="control-group" id='sipOutboundProxyDiv'> <label class="control-label"><a style="color:#555555" href="#" rel="tooltip" title="Specify the IP Address and Port of a WebSocket Server" data-placement="top" data-delay: { show: 10, hide: 100 }>Outbound Proxy</a> :</label> <input id="sipOutboundProxy" type="text" size="30">
=======================================
--- /sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/js/MobicentsWebRTCPhoneController.js Wed Jul 10 22:01:34 2013 UTC +++ /sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/js/MobicentsWebRTCPhoneController.js Mon Aug 26 20:35:33 2013 UTC
@@ -32,11 +32,11 @@
 MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_PASSWORD=undefined;
 MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_CONTACT="bob";
 MobicentsWebRTCPhoneController.prototype.DEFAULT_SIP_REGISTER_MODE=true;
-MobicentsWebRTCPhoneController.prototype.DEFAULT_STUN_SERVER="undefined"; // stun.l.google.com:19302
-//MobicentsWebRTCPhoneController.prototype.DEFAULT_STUN_SERVER="webrtcstunserver:3478";
-//MobicentsWebRTCPhoneController.prototype.DEFAULT_TURN_SERVER="webrtcturnserver:5000";
-MobicentsWebRTCPhoneController.prototype.DEFAULT_TURN_LOGIN="test";
-MobicentsWebRTCPhoneController.prototype.DEFAULT_TURN_PASSWORD="1234";
+//MobicentsWebRTCPhoneController.prototype.DEFAULT_STUN_SERVER="undefined"; // stun.l.google.com:19302
+MobicentsWebRTCPhoneController.prototype.DEFAULT_STUN_SERVER=undefined;
+MobicentsWebRTCPhoneController.prototype.DEFAULT_TURN_SERVER=undefined;
+MobicentsWebRTCPhoneController.prototype.DEFAULT_TURN_LOGIN=undefined;
+MobicentsWebRTCPhoneController.prototype.DEFAULT_TURN_PASSWORD=undefined;
MobicentsWebRTCPhoneController.prototype.DEFAULT_AUDIO_CODECS_FILTER=undefined; // RTCPeerConnection default codec filter MobicentsWebRTCPhoneController.prototype.DEFAULT_VIDEO_CODECS_FILTER=undefined; // RTCPeerConnection default codec filter MobicentsWebRTCPhoneController.prototype.DEFAULT_LOCAL_VIDEO_FORMAT="{\"mandatory\": {\"maxWidth\": 500}}"
@@ -154,9 +154,9 @@
     this.view.stopRemoteVideo();
     this.view.hideRemoteVideo();
this.view.setStunServerTextInputValue(this.webRTCommClientConfiguration.RTCPeerConnection.stunServer); -// this.view.setTurnServerTextInputValue(this.webRTCommClientConfiguration.RTCPeerConnection.turnServer); -// this.view.setTurnLoginTextInputValue(this.webRTCommClientConfiguration.RTCPeerConnection.turnLogin); -// this.view.setTurnPasswordTextInputValue(this.webRTCommClientConfiguration.RTCPeerConnection.turnPassword); + this.view.setTurnServerTextInputValue(this.webRTCommClientConfiguration.RTCPeerConnection.turnServer); + this.view.setTurnLoginTextInputValue(this.webRTCommClientConfiguration.RTCPeerConnection.turnLogin); + this.view.setTurnPasswordTextInputValue(this.webRTCommClientConfiguration.RTCPeerConnection.turnPassword); this.view.setSipOutboundProxyTextInputValue(this.webRTCommClientConfiguration.sip.sipOutboundProxy); // this.view.setSipUserAgentTextInputValue(this.webRTCommClientConfiguration.sip.sipUserAgent); // this.view.setSipUriContactParametersTextInputValue(this.webRTCommClientConfiguration.sip.sipUriContactParameters);
@@ -325,7 +325,7 @@
     {
         try
         {
-                       /*if(this.view.getUseStunServerValue())
+           if(this.view.getStunServerTextInputValue() != null)
             {
this.webRTCommClientConfiguration.RTCPeerConnection.stunServer= this.view.getStunServerTextInputValue();
             }
@@ -333,7 +333,7 @@
             {
this.webRTCommClientConfiguration.RTCPeerConnection.stunServer=undefined;
             }
-            if(this.view.getUseTurnServerValue())
+            if(this.view.getTurnServerTextInputValue() != null)
             {
this.webRTCommClientConfiguration.RTCPeerConnection.turnServer= this.view.getTurnServerTextInputValue(); this.webRTCommClientConfiguration.RTCPeerConnection.turnLogin= this.view.getTurnLoginTextInputValue();
@@ -344,7 +344,7 @@
this.webRTCommClientConfiguration.RTCPeerConnection.turnServer= undefined; this.webRTCommClientConfiguration.RTCPeerConnection.turnLogin= undefined; this.webRTCommClientConfiguration.RTCPeerConnection.turnPassword= undefined;
-            }*/
+            }

//this.webRTCommClientConfiguration.RTCPeerConnection.forceTurnMediaRelay=this.view.getForceTurnMediaRelayValue(); //this.webRTCommClientConfiguration.RTCPeerConnection.dtlsSrtpKeyAgreement=this.view.getDtlsSrtpKeyAgreementValue();
=======================================
--- /sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/js/WebRTComm.js Wed Jul 10 17:32:58 2013 UTC +++ /sip-servlets-examples/websocket-b2bua/src/main/sipapp/MobicentsWebRTCPhone/js/WebRTComm.js Mon Aug 26 20:35:33 2013 UTC
@@ -2585,6 +2585,7 @@
     var that = this;
     if(this.webRTCommClient.configuration.RTCPeerConnection.stunServer)
     {
+ console.debug("Using Following stun server : " + this.webRTCommClient.configuration.RTCPeerConnection.stunServer);
         rtcPeerConnectionConfiguration.iceServers.push({
url:"stun:"+this.webRTCommClient.configuration.RTCPeerConnection.stunServer
         });
@@ -2593,12 +2594,21 @@
         && this.webRTCommClient.configuration.RTCPeerConnection.turnLogin
&& this.webRTCommClient.configuration.RTCPeerConnection.turnPassword)
         {
+ console.debug("Using Following turn server : " + this.webRTCommClient.configuration.RTCPeerConnection.turnServer + " with username " + this.webRTCommClient.configuration.RTCPeerConnection.turnLogin);
         rtcPeerConnectionConfiguration.iceServers.push({
url:"turn:"+this.webRTCommClient.configuration.RTCPeerConnection.turnLogin+"@"+this.webRTCommClient.configuration.RTCPeerConnection.turnServer, credential:this.webRTCommClient.configuration.RTCPeerConnection.turnPassword
         });
     }
-
+
+    if(this.webRTCommClient.configuration.RTCPeerConnection.turnServer
+ && this.webRTCommClient.configuration.RTCPeerConnection.turnLogin == null)
+        {
+ console.debug("Using Following turn server : " + this.webRTCommClient.configuration.RTCPeerConnection.turnServer);
+        rtcPeerConnectionConfiguration.iceServers.push({
+ url:"turn:"+this.webRTCommClient.configuration.RTCPeerConnection.turnServer
+        });
+    }

console.debug("WebRTCommCall:createPeerConnection():rtcPeerConnectionConfiguration="+JSON.stringify(rtcPeerConnectionConfiguration)); console.debug("WebRTCommCall:createPeerConnection():peerConnectionContraints="+JSON.stringify(peerConnectionContraints));

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to