Error receiving second call Verto
Hi im user verto.js library and i can execute first call verto-client to verto-client but when i execute second call to same verto-client so failed bucause this is redirect to destroy event first receive call into to "ringing" event --> answering --> active --> hangout --> destroy second receive call into to "destroy" event this is my code (function() { var vertoHandle, vertoCallbacks, destinationNumber, currentCall, ext, passExt; function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } ext = getParameterByName("ext"); passExt = getParameterByName("pass"); $.verto.init({}, bootstrap); function bootstrap(status) { console.log("extension: " + ext) vertoHandle = new jQuery.verto({ login: ext + '@conference2.cibersys.com', passwd: passExt, socketUrl: 'wss://conference2.cibersys.com:9061', ringFile: 'sounds/bell_ring2.wav', tag: 'video-container', // specifying video tag in our html deviceParams: { useCamera: true, // asking for camera permissions and devices useMic: true, useSpeak: true }, iceServers: true }, vertoCallbacks); document.getElementById("make-call").addEventListener("click", makeCall); document.getElementById("answer-call").addEventListener("click", answerCall); document.getElementById("hang-up-call").addEventListener("click", hangupCall); document.getElementById("mute-call").addEventListener("click", muteCall); document.getElementById("unmute-call").addEventListener("click", unmuteCall); document.getElementById("mute-unmute-call").addEventListener("click", muteUnmuteCall); document.getElementById("hold-call").addEventListener("click", holdCall); document.getElementById("unhold-call").addEventListener("click", unholdCall); document.getElementById("transfer-call").addEventListener("click", transferCall); document.getElementById("muteVideo-call").addEventListener("click", muteVideoCall); document.getElementById("unmuteVideo-call").addEventListener("click", unmuteVideoCall); }; function makeCall() { destinationNumber = prompt("Insert destination number"); if(destinationNumber) { currentCall = vertoHandle.newCall({ destination_number: destinationNumber, caller_id_name: "Test Guy", caller_id_number: destinationNumber, outgoingBandwidth: "default", incomingBandwidth: "default", useVideo: true, // telling verto to make a call with video support mirrorInput: true, // telling verto to mirror user's webcam useStereo: true, useMic: true, useSpeak: true, dedEnc: false, userVariables: { avatar: "", email: "test@test.com" } }); } }; function answerCall() { currentCall.answer({ useStereo: true, useCamera: true, useVideo: true, useMic: true, callee_id_name: "answer ponit", callee_id_number: ext }); }; function hangupCall() { currentCall.hangup(); }; function muteCall() { currentCall.setMute("off"); }; function unmuteCall() { currentCall.setMute("on"); }; function muteVideoCall() { currentCall.setVideoMute("off"); }; function unmuteVideoCall() { currentCall.setVideoMute("on"); }; function muteUnmuteCall() { currentCall.mute("toggle"); }; function holdCall() { currentCall.hold(); }; function unholdCall() { currentCall.unhold(); }; function transferCall() { destinationNumber = prompt("Insert transfer destination number"); if(destinationNumber) { currentCall.transfer(destinationNumber); } }; vertoCallbacks = { onWSLogin: onWSLogin, onWSClose: onWSClose, onDialogState: onDialogState }; function onWSLogin(verto, success) { console.log('onWSLogin', success, verto); }; function onWSClose(verto, success) { console.log('onWSClose', success); }; function onDialogState(dialog) { console.debug('onDialogState', dialog); if(!currentCall) { currentCall = dialog; } if (currentCall.state.name == 'ringing') { console.warn('onDialogState ringing', currentCall); } if (currentCall.state.name == 'new') { console.warn('Someone is calling you, new!'); } if (currentCall.state.name == 'requesting') { console.warn('Someone is calling you, requesting!'); } if (currentCall.state.name == 'recovering') { console.warn('Someone is calling you, recovering!'); } if (currentCall.state.name == 'active') { //$scope.offLocalVideo(); console.warn('Someone is calling you, active!'); } if (currentCall.state.name == 'held') { console.warn('Someone is calling you, held!'); } if (currentCall.state.name == 'purge') { console.warn('Someone is calling you, purge!'); } if (currentCall.state.name == 'early') { console.warn('Someone is calling you, early!'); } if (currentCall.state.name == 'answering') { console.warn('Someone is calling you, answering!'); } if (currentCall.state.name == 'hangup') { //$scope.resetCall(); console.warn('Someone is calling you, hangup!'); //$scope.resetCall(); //console.log("sreamLocalVideo.getVideoTracks()", sreamLocalVideo.getVideoTracks()[0].stop()); //sreamLocalVideo.src=null; } if (currentCall.state.name == 'destroy') { console.warn('Someone is calling you, destroy!'); } } })(); -- T.S.U Azlain Saavedra Movil: +58 04142528099 Skype: azlain.saavedra
participants (1)
-
Azlain Saavedra