assigning a callback to the hold button

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

Moderators: jwitt, sruffell, malcolmd, Moderator

assigning a callback to the hold button

Postby wallnutmonkeys » Fri Jul 19, 2013 9:58 am

Hi, thanks for all the help so far, my app is starting to look like something hehe, quick question, is it possible to specify a callback for the hold button on the phone?

thanks

wallnut
wallnutmonkeys
Newsterisk
 
Posts: 28
Joined: Thu Feb 10, 2011 9:52 pm

Re: assigning a callback to the hold button

Postby sruffell » Tue Jul 23, 2013 9:33 am

Yes, you should be able to use onkey to add a handler to the top level window.

For example, if I add to the end of helloworld.js
Code: Select all
window.onkey = function(ev) {
    util.debug("window:" + JSON.stringify(ev));
    return 0;
};


And then run it, I get the following output on the debug log when I press the various keys:
Code: Select all
$ ./update.sh log



+Done loading util.js
app.js:Init
                        app.init:appConfigXML:{"$NAME":"appconfig","$CHILDREN":[]}
                        app.init:this.config:{}
auth.js:Constructor
Could not load app specific language keys for fallback lang: en_us
Could not load app specific language keys for lang: en_us
window:{"key":"hold","type":"key"}
window:{"key":"xfer","type":"key"}
window:{"key":"msgs","type":"key"}


If you return true or 1 from the handler, you can prevent the key from being passed to the phone application if you would like.
sruffell
Oldsterisk
 
Posts: 200
Joined: Fri Jan 07, 2011 2:02 pm

Re: assigning a callback to the hold button

Postby wallnutmonkeys » Tue Jul 23, 2013 11:34 am

thx a lot

wallnut
wallnutmonkeys
Newsterisk
 
Posts: 28
Joined: Thu Feb 10, 2011 9:52 pm


Return to Digium Phone API

Who is online

Users browsing this forum: No registered users and 0 guests