Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The first audio file has sound #35

Open
1142338114 opened this issue Aug 15, 2019 · 1 comment
Open

The first audio file has sound #35

1142338114 opened this issue Aug 15, 2019 · 1 comment

Comments

@1142338114
Copy link

Ring ringing rings for the first time, but no ringing rings for the next time.

@1142338114
Copy link
Author

(function() {
  var vertoHandle, vertoCallbacks, currentCall;

  $.verto.init({}, bootstrap);

  function bootstrap(status) {
    vertoHandle = new jQuery.verto({
      login:  "***",
      passwd: '****',
      tag: "webcam",
      socketUrl: '****',
      ringFile: './music/bell_ring2.wav' ,
      deviceParams: {
        useMic: true,
        useSpeak: true
      },
      iceServers: true
    }, vertoCallbacks);


    document.getElementById("answer-call").addEventListener("click", answerCall);

  };

  function makeCall() {
    currentCall = vertoHandle.newCall({
      destination_number: "3520",
      caller_id_name: "Test Guy",
      caller_id_number: "1008",
      outgoingBandwidth: "default",
      incomingBandwidth: "default",
      useStereo: true,
      useMic: true,
      useSpeak: true,
      dedEnc: false,
      userVariables: {
        avatar: "",
        email: "[email protected]"
      }
    });
  };
  function answerCall() {
    currentCall.answer();

  };
  function hangupCall() {
    currentCall.hangup();
  };

  vertoCallbacks = {
    onWSLogin: onWSLogin,
    onWSClose: onWSClose,
    onDialogState: onDialogState
  };

  function onWSLogin(verto, success) {
    console.log('onWSLogin', success);
  };

  function onWSClose(verto, success) {
    console.log('onWSClose', success);
  };

  function onDialogState(dialog) {
    // console.debug('onDialogState', dialog);

    if(!currentCall) {
      currentCall = dialog;
    }

    if(dialog.state.name == 'ringing') {
      alert('Someone is calling you, answer!');
    }
    if (dialog.state.name == 'answering') {
      currentCall.hangup();

    }
    if (dialog.state.name == 'destroy') {
      let a= document.getElementById('webcam');
      console.log(a);
      a.pause();
      currentCall.stopRinging();
    }
  };
})();


<body>

    <button id="answer-call">Answer call</button>
      <audio width=800 id="webcam" autoplay="autoplay" controls ></audio>


    <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script> 
    <script type="text/javascript" src="js/jquery.mobile.min.js"></script> 
    <script type="text/javascript" src="js/jquery.json-2.4.min.js"></script>  
    <script type="text/javascript" src="js/jquery.cookie.js"></script>
    <script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="js/verto-min.js"></script>
    <script type="text/javascript" src="main.js"></script>
</body>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant