Digium Phones - Using the Phone's App Development CGI
Desk Phone API features described in this section are deprecated and supported only on the following models: D40, d45, d50, d60, d62, d65, d70
The Sangoma Phone's development tools are available via a CGI that can be accessed from any desktop computer after you enable the phone's App Development mode. This guide describes how to access the app development CGI and use the tools via a commandline interface.
CGI Access
The Phone App web service is available from http:// phone-ip-address /cgi-bin/app_dev.cgi. The web service expects a mode parameter with additional parameters as appropriate to the mode.
Phone App Web Service Modes
mode=install
Action: Installs an application on the phone.
Required parameters: An uploaded zip file containing the application.
Optional parameters: name: The name of the app contained in the uploaded file. If the name does not match the name in the app.json file, the upload will be rejected.
Example:
curl --anyauth --form mode=install --form file=@/tmp/myapp.zip http://PHONE_IP/cgi-bin/app_dev.cgi --user admin:789
mode=uninstall
Action: Uninstalls an application from the phone.
Required parameters: appname: The name of the app to uninstall. This is the name from the app's app.json file.
Example:
curl --anyauth --form mode=uninstall --form appname=myapp http://PHONE_IP/cgi-bin/app_dev.cgi --user admin:789
mode=start, mode=show, mode=shutdown
Action: start will start up an app in the background, if it isn't already running. show will start an app if necessary, and show the app on the phone's screen in full-screen mode. shutdown will cause an app to shut down.
Required parameters: appname: The name of the app to start/show/shut down. This must match the value of the "name" attribute in app.json.
Example:
curl --anyauth --form mode=show --form appname=myapp --user admin:789 http://PHONE_IP/cgi-bin/app_dev.cgi
mode=log
Action: Streams logging output from the app. This includes print() and println() output from the app iteself and certain error messages generated by the app engine related to the specified app.
Required parameters: appname: The name of the app.
Optional parameters: prebuffer: Some web browsers will wait until a certain amount of data is buffered up before attempting to display anything. Specifying prebuffer=1024 will cause 1024 spaces, followed by a newline, to be printed out before sending log data. This is normally not needed when using curl or an HTTP library, but can be useful when pointing a browser at this mode.
Example:
XML responses
In addition, all modes return a short XML document describing the results of the request.
A normal response looks like this:
For mode=install, a successful install also includes
Error Codes
Errors are indicated by a status other than 1. Error codes include the following:
-100 error with upload
-101 problem with app.json
-102 invalid app name
-103 app.json requests privileges that aren't allowed
-104, -105, -108 internal errors
-106 missing or invalid cgi parameter
-108 internal error
-109 unauthorized (app development mode not turned on)
-110 insufficient space for install
-111 uninstall error
See Also: