]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add checkbox to demo to use stun or not
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 1 Aug 2014 20:20:00 +0000 (01:20 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 1 Aug 2014 20:20:00 +0000 (01:20 +0500)
html5/verto/demo/index.html
html5/verto/demo/js/verto-min.js
html5/verto/demo/verto.js
html5/verto/js/src/jquery.verto.js

index dd226989dee4efb962466a054c454c2b345a7cfc..12a6dbe78a6e44f60bee2f11d6a60375dad8add2 100644 (file)
        <br>
        <label><input id="use_vid" type="checkbox" value="foo" > Use Video</label>
        <label><input id="use_stereo" type="checkbox" value="foo" > Stereo Audio</label>
+       <label><input id="use_stun" type="checkbox" value="foo" > Use STUN</label>
        <br>
 <!--
        <b>TEXT</b><br>To: <input type="text" size="20" id="textto"/> MSG: <input type="text" size="40" id="textmsg"/>
index 28dcf4c1058c66e6e7ff0cfee9016c1b95d88fdb..de2bff19327ee91f85e9194752234c5beee65b5a 100644 (file)
@@ -104,7 +104,7 @@ else{if(!(response.id in handlers)&&'console'in window)console.log(response);els
 if(typeof all_done_cb==='function')all_done_cb(result);};})(jQuery);(function($){var generateGUID=(typeof(window.crypto)!=='undefined'&&typeof(window.crypto.getRandomValues)!=='undefined')?function(){var buf=new Uint16Array(8);window.crypto.getRandomValues(buf);var S4=function(num){var ret=num.toString(16);while(ret.length<4){ret="0"+ret;}
 return ret;};return(S4(buf[0])+S4(buf[1])+"-"+S4(buf[2])+"-"+S4(buf[3])+"-"+S4(buf[4])+"-"+S4(buf[5])+S4(buf[6])+S4(buf[7]));}:function(){return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=='x'?r:(r&0x3|0x8);return v.toString(16);});};$.verto=function(options,callbacks){var verto=this;$.verto.saved.push(verto);verto.options=$.extend({login:null,passwd:null,socketUrl:null,tag:null,videoParams:{},iceServers:false,ringSleep:6000},options);verto.sessid=$.cookie('verto_session_uuid')||generateGUID();$.cookie('verto_session_uuid',verto.sessid,{expires:1});verto.dialogs={};verto.callbacks=callbacks||{};verto.eventSUBS={};verto.rpcClient=new $.JsonRpcClient({login:verto.options.login,passwd:verto.options.passwd,socketUrl:verto.options.socketUrl,sessid:verto.sessid,onmessage:function(e){return verto.handleMessage(e.eventData);},onWSConnect:function(o){o.call('login',{});},onWSLogin:function(success){if(verto.callbacks.onWSLogin){verto.callbacks.onWSLogin(verto,success);}},onWSClose:function(success){if(verto.callbacks.onWSClose){verto.callbacks.onWSClose(verto,success);}
 verto.purge();}});if(verto.options.ringFile&&verto.options.tag){verto.ringer=$("#"+verto.options.tag);}
-verto.rpcClient.call('login',{});};$.verto.prototype.loginData=function(params){verto.options.login=params.login;verto.options.passwd=params.passwd;verto.rpcClient.loginData(params);};$.verto.prototype.logout=function(msg){var verto=this;verto.rpcClient.closeSocket();verto.purge();};$.verto.prototype.login=function(msg){var verto=this;verto.logout();verto.rpcClient.call('login',{});};$.verto.prototype.message=function(msg){var verto=this;var err=0;if(!msg.to){console.error("Missing To");err++;}
+verto.rpcClient.call('login',{});};$.verto.prototype.iceServers=function(on){var verto=this;verto.options.iceServers=on;};$.verto.prototype.loginData=function(params){verto.options.login=params.login;verto.options.passwd=params.passwd;verto.rpcClient.loginData(params);};$.verto.prototype.logout=function(msg){var verto=this;verto.rpcClient.closeSocket();verto.purge();};$.verto.prototype.login=function(msg){var verto=this;verto.logout();verto.rpcClient.call('login',{});};$.verto.prototype.message=function(msg){var verto=this;var err=0;if(!msg.to){console.error("Missing To");err++;}
 if(!msg.body){console.error("Missing Body");err++;}
 if(err){return false;}
 verto.sendMethod("verto.info",{msg:msg});return true;};$.verto.prototype.processReply=function(method,success,e){var verto=this;var i;switch(method){case"verto.subscribe":for(i in e.unauthorizedChannels){drop_bad(verto,e.unauthorizedChannels[i]);}
index a7c39295df3488462b74d65a23dfb20e9282915e..bee9381ea52430cd0cbb9cd8800091f37fa5ff7c 100644 (file)
@@ -384,6 +384,23 @@ function init() {
         });
     });
 
+    tmp = $.cookie("verto_demo_stun_checked") || "false";
+    $.cookie("verto_demo_stun_checked", tmp, {
+        expires: 365
+    });
+
+    $("#use_stun").prop("checked", tmp === "true").change(function(e) {
+        tmp = $("#use_stun").is(':checked');
+        $.cookie("verto_demo_stun_checked", tmp ? "true" : "false", {
+            expires: 365
+        });
+       if (verto) {
+           verto.iceServers(tmp);
+       }
+
+       alert(tmp);
+    });
+
     verto = new $.verto({
         login: $("#login").val() + "@" + $("#hostName").val(),
         passwd: $("#passwd").val(),
@@ -393,7 +410,8 @@ function init() {
         videoParams: {
             "minWidth": "1280",
             "minHeight": "720"
-        }
+        },
+       iceServers: $("#use_stun").is(':checked')
     },callbacks);
 
     $("#login").change(function(e) {
index aef3f39a81044e1fa1484ee3ac6c4bb8ce23e625..a80ed526b3b7f9f23fc35947d36e92b32ea64938 100644 (file)
 
     };
 
+    $.verto.prototype.iceServers = function(on) {
+        var verto = this;
+
+        verto.options.iceServers = on;
+    };
+
     $.verto.prototype.loginData = function(params) {
         verto.options.login = params.login;
         verto.options.passwd = params.passwd;