How does this API work?

Since I don’t see any architectural level documentation on how does this API work. I am going to ask some questions here.

  1. Where is this javascript running on once you deployed the code, is this anything to do with Node.js?
  2. How does the javascript communicated with the phone (or server if it is involved), by ajax, network event, postMessage?
  3. If I have a web application, how can I control the phone using the javascript in my own web page?

Thanks,

Hi,

Deployed apps run on the actual phone. It’s not Node.js, but there is a javascript virtual machine on the phone that runs your app.

Communication with the phone application running on the physical phone is via a digium.phone object. The phone app sends events to your custom app when certain events happen, for example on an incoming call. You can see the full list of events the phone app can send on the doc page for digium.event

Communicating with external servers is via the NetRequest object which is very similar to XMLHttpRequest.

If you want to control the phone from your web page, you’ll need to have the phone poll your server for commands to execute via NetRequest. You can also use standard long polling techniques.

Cheers,
Shaun