]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adjust ringing var
authorAnthony Minessale <anthm@freeswitch.org>
Sun, 29 Jun 2014 19:00:35 +0000 (00:00 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Sun, 29 Jun 2014 20:23:07 +0000 (01:23 +0500)
html5/verto/demo/verto.js

index fee1effc6e8b62d1d25cd5f1516194aa6c0a4763..1aa29f8558c84f33eff9900b11b7b0684d5be4e9 100644 (file)
@@ -130,12 +130,17 @@ var callbacks = {
     onDialogState: function(d) {
         cur_call = d;
 
+       if (d.state == $.verto.enum.state.ringing) {
+           ringing = true;
+       } else {
+           ringing = false;
+       }
+
         switch (d.state) {
         case $.verto.enum.state.ringing:
             display("Call From: " + d.cidString());
 
             $("#ansbtn").click(function() {
-               ringing = false;
                 cur_call.answer({
                    useStereo: $("#use_stereo").is(':checked')
                });
@@ -143,19 +148,15 @@ var callbacks = {
             });
 
             $("#declinebtn").click(function() {
-               ringing = false;
                 cur_call.hangup();
                 $('#dialog-incoming-call').dialog('close');
             });
-           
-           ringing = true;
 
             goto_dialog("incoming-call");
             $("#dialog-incoming-call-txt").text("Incoming call from: " + d.cidString());
 
             if (d.params.wantVideo) {
                 $("#vansbtn").click(function() {
-                   ringing = false;
                     $("#use_vid").prop("checked", true);
                     cur_call.answer({
                         useVideo: true,
@@ -190,6 +191,9 @@ var callbacks = {
     onWSLogin: function(v, success) {
         display("");
 
+       cur_call = null;
+       ringing = false;
+
         if (success) {
             online(true);