onRequest
Passes a request body to onSwmlRequest() and returns its
result: an object of SWML modifications, or void to render with the
default behavior. A null or missing body is passed on as an empty object.
The agent’s request handler calls onSwmlRequest()
directly, not onRequest. Overriding onRequest doesn’t change how served
requests render. Override onSwmlRequest() to customize them, and call
onRequest when you want the modifications for a request body you supply.
onRequest returns an object of SWML modifications to merge into the
rendered document. To replace the entire SWML document for a request instead,
use setOnRequestCallback() on SWMLService.
Parameters
requestData
The request body. Call details sit under call, for example call.call_id
and the caller’s address in call.from.
callbackPath
Optional routing-callback path, passed on to onSwmlRequest().
Returns
Record<string, unknown> | void (or a Promise of these) — An object of SWML
modifications to merge before rendering, or void for default rendering.