Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API reference (Rhai — deprecated)

The Rhai frontend is deprecated and will be removed in a future release. New scenarios should use the JavaScript/TypeScript frontend — see Writing scenarios and the JS API reference. This page documents the Rhai vocabulary for existing scenarios; Rhai frontend explains why and how to migrate.

The complete Rhai scenario vocabulary, generated from the engine (so it never drifts from the code) — organized by the thing you’re working with:

  • Scenario structure — defining and isolating tests: scenario, setup, teardown, skip.
  • Flow and timingawait_until, wait, parallel, default_timeout.
  • Agents — create SIP endpoints and drive calls: register, dial, accept, transfer, DTMF, audio.
    • Peer — the remote party of the active call.
    • Call state — the State::* phases for agent.state.
    • AudioSpec — audio sources for send_audio (tone, file, silent).
  • CallQuality
  • Assertions and matchers — the fluent assert(x).<matcher>(…), used inside await_until.
  • HTTPhttp(…) requests and the response.
  • HTTP mock servermock_server(…), routes and responders for webhook-driven flows.
    • Mock request — the recorded request a responder/assertion sees.
  • Environmentenv, load_env — credentials stay out of scripts.
  • Utilitieslog, uuid.

For editors and agents, the whole Rhai API is also available as Rhai type definitions (.d.rhai). In practice this is a reference you read, not tooling you get: the only Rhai language server is an unreleased experiment that no editor plugin ships, so there is no type-checking and no inline error reporting — one of the reasons the frontend is being retired in favour of JS/TS.