Custom Phone Applications with Asterisk
Sangoma D-Series phones support loading and running user-created custom JavaScript applications. Fore more information about creating these applications, and the endless possibilities therein, please see the Getting Started page on our Digium Phone API Center website.
Tip |
---|
Sangoma phones use version 3.2.6 of the V8 JavaScript engine |
...
Custom applications may only be loaded onto phones running firmware version 1.3+. Phone firmware 1.3 is now generally available, For information about setting up your phone for application development, see the Getting Started page.
Custom Applications and DPMA
Custom applications are always defined with an application type of "custom" and are loaded onto phones using the phone type option application, just as a queue or status application would be loaded onto a phone. This application type is supported by DPMA, beginning with DPMA version 1.3.0.
Option | Values | Description |
---|---|---|
name | string | The name of the custom application, e.g. JasonParkerApp; also used for the idlescreen_softkey label |
filename | string | A named .zip file containing the user's application, as reachable from the file_url_prefix. |
autostart | yes / no | Sets whether or not the custom application should load when the phone boots, or the first time a user opens the application |
key | value | Optional key=value parameters may be passed to the application |
Example
In this example:
An application named Jason-Fancy-App is declared, it's of the Custom application type
The internal name of the application is jasonapp
The filename of the application, as retrieved from the file_url_prefix is jasonsillyapp.zip
The application will start when the phone boots
Custom keypairs for 'user=1234', 'permission=lots', 'string=hello world' are passed in
...
Example of custom application accessing custom key value pairs
|
Interacting with Asterisk
...
When a method has been registered, phone applications can use the pbx.request function to call that method and pass parameters into Asterisk. Here's an example:
|
In this example, we pass the method digium.qwelltest.okay with the parameter account_id and a fictitious value derived from app.getAccountID()
...
When a notification is pushed from Asterisk into the phone, the notification can be read from the phone's application by using the digium.event.observe handler, such as:
|
Custom Applications and XML Provisioning
...
Appconfig Element Example
Option | Values | Description |
---|---|---|
id | string | The named identifier for the application |
network_id | string | Optional. The id of a network, defined in the "networks" element |
url: Child Element of <appconfig>
Option | Values | Description |
---|---|---|
url | URL string | Sets the URL path used to retrieve the application |
md5 | md5 sum | Optional. The md5 sum of the file to be retrieved |
settings: Child Element of <appconfig>
Options | Values | Description |
---|---|---|
string | string, integer | User-defined key-pair values that are passed to the application and can be used by it. |
auto_start: Child Element of <appconfig>
...
Custom applications can be loaded onto Sangoma phones within FreePBX using the "Custom" applications sub-tab of the "Applications" tab of the Sangoma phones FreePBX configuration utility. For details on this, please see this wiki page.
Frequently Asked Questions (FAQ)
...