adjust ringing var

This commit is contained in:
Anthony Minessale 2014-06-30 00:00:35 +05:00
parent c3798dbb02
commit 1ef5d114f5
1 changed files with 9 additions and 5 deletions

View File

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