How does this API work?

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

Moderators: jwitt, sruffell, malcolmd, Moderator

How does this API work?

Postby rn2dy » Thu Apr 25, 2013 12:26 pm

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,
rn2dy
Newsterisk
 
Posts: 1
Joined: Thu Apr 25, 2013 12:15 pm

Re: How does this API work?

Postby sruffell » Thu Apr 25, 2013 3:09 pm

Hi,

rn2dy wrote:1. Where is this javascript running on once you deployed the code, is this anything to do with Node.js?


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.

rn2dy wrote:2. How does the javascript communicated with the phone (or server if it is involved), by ajax, network event, postMessage?


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.

rn2dy wrote:3. If I have a web application, how can I control the phone using the javascript in my own web page?


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
sruffell
Oldsterisk
 
Posts: 200
Joined: Fri Jan 07, 2011 2:02 pm


Return to Digium Phone API

Who is online

Users browsing this forum: No registered users and 1 guest