Skip to end of metadata
Go to start of metadata

The Digium 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 parametersname: 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 parametersappname: 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

  • Actionstart 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 parametersappname: 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 parametersappname: The name of the app.
  • Optional parametersprebuffer: 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

    curl --anyauth --user admin:789 http://PHONE_IP/cgi-bin/app_dev.cgi --form mode=log --form appname=myapp --form prebuffer=1024 

XML responses

In addition, all modes return a short XML document describing the results of the request.

A normal response looks like this: 

<?xml version="1.0" ?>

<response>
    <status>1</status>
</response>

 

For mode=install, a successful install also includes  

<install name="name_of_installed_app"/>
      
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 

 

  • No labels