APIdaze Script Reference

ExternalScripts are a sequence of XML instructions executed when a call is placed to a number of your domain, or when a call is placed from one of your SIP accounts, trunk and from a web page (using our WebRTC/Flash UDP JavaScript API).

ExternalScripts are located in a web server, and their URL can be set/updated through APIdaze’s REST API ExternalScript objects.

The web server that serves the XML content of your ExternalScript must set the Content-type HTTP header to text/xml.

APIdaze Script Parameters

Each call triggers an HTTP request to your script, and HTTP parameters are the keys that let you handle your calls. Your script is fetched at the beginning of the call, and also when the call ends (with the “exiting” parameter set to “true”). The main parameters that you’ll find are :

  • session_id : a UUID like (RFC 4722) string that identifies the current channel that placed the call.
  • destination_number : the number dialed by the caller.
  • caller_id_number : the phone number, or SIP address, or any string that identifies the caller.
  • caller_username : the name that identifies the caller, if available.
  • url : the URL of the fetched script.

Calls can come from the PSTN, SIP accounts under your domain, SIP trunks and the web using our WebRTC/Flash UDP JavaScript API. Depending on the source of the call, various parameters can be sent along with each HTTP request to help you process the call :

  • exiting : a variable set to true when the set of XML instructions of the current script is exhausted. Note that if the <hangup/> is not explicitly called, the script will be fetched again to call for a new set of XML instructions.
  • bridge_status : a status variable sent as the result of the <dial/> tag. Values can be “SUCCESS”, “BUSY”, or “NO_ANSWER”.
  • dialed_digits : a status variable sent as the result of the <bind/> tag that contains the digits entered by the caller.
  • Also note that if someone places a call from the web, any parameter set in the JavaScript API is passed to your script, therefore allowing full control over your web calls!