chrome ask multiple time to allow use of speaker and mic for incoming call in twilio -


i creating call center application ,and when call come twilio client on chrome browser ask permission allow use of speaker , mic .when second call comes have allow 2 times , if third call come have allow 3 times , on.

and in firfox browser ,when acccept call second time automatically disconnect , give error of mediastream.

please suggest me wrong , how solve problem.

below javascript of twilio client,if need more information please let me know

<script 

type="text/javascript">

//var token =callaction(); var connection=null; var content; $(document).ready(function(){ $('#hangupcallbutton').hide(); $.post('cleanify?action=createcall', function(data){ content= data; twilio.device.setup(content, { debug: true} ); } ); twilio.device.ready(function (device) { $("#log").text("ready"); } ); twilio.device.error(function (error) { $("#log").text("error: " + error.message); } ); twilio.device.connect(function (conn) { //alert("connect handler"); $("#log").text("successfully established call"); connection = conn; } ); twilio.device.disconnect(function (conn) { //alert("in disconnect"); $("#callbutton").html('call'); $("#callbutton").removeclass("btn-danger ").addclass("btn-success"); // $("#callbutton").toggleclass('btn-danger btn-success'); $("#log").text("call ended"); $('#rejectcallbutton').show(); $('#acceptcallbutton').show(); $('#hangupcallbutton').hide(); $('#mymodal').modal('hide'); } ); twilio.device.incoming(function (conn) { // alert("in incomming"); connection = conn; $("#log").text("aa rahi h call"); $('#mymodal').modal('show'); $('#incomingnumber').html(conn.parameters.from); $('#rejectcallbutton').click(function() { connection.reject(); } ); $('#acceptcallbutton').click(function() { connection.accept(); $('#rejectcallbutton').hide(); $('#acceptcallbutton').hide(); $('#hangupcallbutton').show(); } ); $('#hangupcallbutton').click(function() { $('#rejectcallbutton').show(); $('#acceptcallbutton').show(); $('#hangupcallbutton').hide(); connection.disconnect(); } ); // accept incoming connection , start two-way audio } ); twilio.device.cancel( function (conn) { //alert("in cancel"); connection = conn; $('#mymodal').modal('hide'); } ); $.each(['0','1','2','3','4','5','6','7','8','9','star','pound'], function(index, value) { $('#button' + value).click(function(){ //alert("hello"); if(connection) { if (value=='star') connection.senddigits('*') else if (value=='pound') connection.senddigits('#') else connection.senddigits(value) return false; } } ); } ); // c alert(content); } ); function callhandle(){ if($("#callbutton").html().trim() == 'call'){ $("#callbutton").html('hangup'); $("#callbutton").removeclass("btn-success").addclass("btn-danger"); // $("#callbutton").toggleclass('btn-success btn-danger'); call(); } else if($("#callbutton").html().trim() == 'hangup'){ hangup(); $("#callbutton").html('call'); $("#callbutton").removeclass("btn-danger").addclass("btn-success"); // $("#callbutton").toggleclass('btn-danger btn-success'); } } function call() { // phone number connect call // phone number connect call // alert( $("#selectoutgoing").val()); params = {"phonenumber": $('.dialnumber').val(),"from": $("#selectoutgoing").val(),"isclient": "true"} ; twilio.device.connect(params); } function hangup() { twilio.device.disconnectall(); }  </script> 

from experience, chrome store settings on https. on htpp chrome not store settings prompt permissions every time


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -