genericConfirm empty screen after confirm

Community based support for the Digium Phone Application Programming Interface (API).

Moderators: jwitt, sruffell, malcolmd, Moderator

genericConfirm empty screen after confirm

Postby si458 » Tue Aug 04, 2015 10:28 am

Hi All,
im having an issue and im not 100% sure if its my code or something else?
but for some reason after i show the genericConfirm, after i click confrim, the screen just goes blank ? and then after say 20 seconds the app just closes itself ?
im calling my function from a List menu when i press the SoftKey1
Code: Select all
var app = require('app');
app.init();
var util = require('util');
var screen = require('screen');
var genericConfirm = require('genericConfirm');
var hello = new Text(0, 0, window.w, Text.LINE_HEIGHT, 'Loading Inbound Caller ID List...');
window.add(hello);
var listObj;
var a = {};
var request = new NetRequest();
request.open("GET", "http://192.168.123.123/xml.php", true);
request.oncomplete = function() {
   util.debug(JSON.stringify(request.responseText));
   var result = JSON.parse(request.responseText);
   //hello.label = JSON.stringify(a.contact);
   listObj = new List(0, 0, 200, 100);
   window.add(listObj);
   listObj.setColumnWidths(100, 100);
   listObj.rows = result.contact.length;
   listObj.cols = 2;
   for ( var i = 0; i < result.contact.length; i++ ) {
      listObj.set(i, 0, result.contact[i].name.toString() );
      listObj.set(i, 1, result.contact[i].number.toString() );
   }
   var call = new Image("app", "call.png", 0, 0, 14, 14);
   var add = new Image("app", "add.png", 0, 0, 14, 14);
   var smile = new Image("app", "SimonFace2.png", 0, 0, 14, 14);
   var edit = new Image("app", "edit.png", 0, 0, 14, 14);
   var remove = new Image("app", "delete.png", 0, 0, 14, 14);
   listObj.setSoftkey(1, 'Call', callNow);
   listObj.setSoftkey(2, 'Add');
   listObj.setSoftkey(3, 'Edit');
   listObj.setSoftkey(4, 'Delete', deleteNow);
   listObj.setSoftkeyIcon(1, call);
   listObj.setSoftkeyIcon(2, add);
   listObj.setSoftkeyIcon(3, edit);
   listObj.setSoftkeyIcon(4, remove);
   listObj.takeFocus();
   listObj.select(0);
   hello.label = "Completed";
   util.debug("Completed");
};
request.send(null);
function deleteNow(){
   a.processConfirm = function (params) {
      util.debug(JSON.stringify(params));
      if (params.confirm === true) {
         util.debug("please delete");
      } else {
         util.debug("dont delete");
      }
   };
   genericConfirm.show({
      'id'         : 'confirm_1',
      'message'      : 'Are You Sure You Want To Delete This Caller ID ?',
      'title'         : 'Confirm',
      'object'      : a,
      'confirmBtnText'   : 'Yes',
      'hideCancelButton'   : false,
      'cancelBtnText'      : 'No',
   });
}
function callNow(){
   var s = listObj.selected;
   var g = listObj.get(s, 1);
   digium.phone.dial({
      'number' : g,
      'handler' : function (obj) {
         util.debug(obj.state);  //prints the 'state' of the call
      }
   });
}

Thank you for help
Regards
SImon
--------------------------------------------------------------------
Hestor Ltd - www.hestor.com
Anywhere Support - www.anywheresupport.co.uk
--------------------------------------------------------------------
si458
Newsterisk
 
Posts: 1
Joined: Tue Aug 04, 2015 10:20 am
Location: Manchester

Return to Digium Phone API

Who is online

Users browsing this forum: No registered users and 2 guests