Execute a specified section or URL as a subroutine, and upon completion, return to the current document. Use the return statement to pass any return values or objects back to the current document.
An object that accepts the following properties.
Accepts any valid destination
Named parameters to send to section or URL
User-defined metadata. This data is ignored by SignalWire and can be used for your own tracking purposes.
Array of SWML methods to execute when the executed section or URL returns.
Action to take based on the result of the call. This will run once the peer leg of the call has ended.
Will use the switch method when the return_value is a object, and will use the cond method when the return_value is an array.
The destination string can be one of:
"section_name" - section in the current document to execute. (For example: main)params object is passed, along with the variables and the call object. Authentication can also be set in the url in the format of username:password@url.A minimal server for this SWML script can be written as follows:
This server (running on localhost) can be made accessible to the wider web (and thus this SWML script) using forwarding tools like ngrok.
Visit ngrok.com to learn how.
The server will be sent the following payload:
The call object is described in detail in the Calling overview. All variables created
within the SWML document are passed inside vars, and the params object contains the parameters defined in the params
parameter of execute.