Digium Phones Custom Applications
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.
The name of the custom application, e.g. JasonParkerApp; also used for the idlescreen_softkey label
A named .zip file containing the user's application, as reachable from the file_url_prefix.
yes / no
Sets whether or not the custom application should load when the phone boots, or the first time a user opens the application
Optional key=value parameters may be passed to the application
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
Accessing custom key value pairs using a custom application
A custom application can access the custom key value pairs using app.getConfig().
When using the example configuration above, here is an example of accessing the custom key value pairs with a custom application:
Interacting with Asterisk
In order to register methods with Asterisk, the DPMA provides an Action DPMAMessageRegister
It's registered via Manager like:
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()
Asterisk will then receive the method from the pbx.request function and issue an Event like:
To respond to this event, Message Responses can be sent back using the DPMAMessageResponse AMI Action like:
Push Messages, which don't initiate as a response to an Event received from the phone application, can be sent into the phone using the DPMAMessageSend AMI Action like:
where PhoneName represents the phone context from res_digium_phone.conf.
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
Custom applications are defined in the XML structure in an appconfig element. The phone will retrieve the application as directed by the element and load the settings as directed by the element.
The named identifier for the application
Optional. The id of a network, defined in the "networks" element
url: Child Element of <appconfig>
Sets the URL path used to retrieve the application
Optional. The md5 sum of the file to be retrieved
settings: Child Element of <appconfig>
User-defined key-pair values that are passed to the application and can be used by it.
auto_start: Child Element of <appconfig>
If the auto_start element is present, the application will load when the phone is booted. If the element is not present, the application will only load when the user manually starts the application through the applications menu.
Custom Applications and FreePBX
Custom applications can be loaded onto Digium phones within FreePBX using the "Custom" applications sub-tab of the "Applications" tab of the Digium phones FreePBX configuration utility. For details on this, please see this wiki page.
Frequently Asked Questions (FAQ)
Q: Is there a developer walkthrough video for the Phone API?
A: Yes. Please see - http://www.youtube.com/watch?v=41OCM3zwoiM
Q: Is there a place where I can list my app or search for others' apps?
A: Yes. Apps can be listed on the Asterisk Exchange at http://www.asteriskexchange.com/listings/category/82
Q: Are any tools or examples available on Github?
A: Yes. Tools and example may be found on Git hub at https://github.com/digium/digium-phone-apps