Skip to content

TinyML (XML) reference

TinyML is SIPRTC’s XML call-control language. When a call arrives on a number or SIP endpoint, or an API call is answered, SIPRTC requests the application URL and executes the TinyML document it returns on the call, one verb at a time, top to bottom. Element and attribute names are case-sensitive unless a verb says otherwise. When the document runs out of verbs the call is hung up.

Requests SIPRTC makes to action and Redirect URLs: POST sends the parameters as a JSON object (Content-Type: application/json), GET sends them as query-string parameters. URLs must be absolute http(s) URLs (only <Transcription statusCallbackUrl> may be relative to the document URL). user:password@ in a URL is sent as HTTP Basic authentication. A non-200 response, or a response that is not a TinyML document with a <Response> root, falls back to the application’s fallback URL and otherwise ends the call.

Verb What it does
<Say> / <Speak> Speak text to the caller with text-to-speech.
<Play> Play an audio file, or send DTMF digits.
<Pause> Wait in silence.
<Gather> Collect DTMF digits or speech from the caller.
<Record> Record the caller (voicemail).
<Dial> Connect the call to a phone number, SIP endpoint or conference.
<Enqueue> Put the caller in a TaskRouter queue to wait for an agent.
<Leave> Accepted and skipped; has no effect.
<Redirect> Continue the call with the TinyML at another URL.
<Hangup> End the call.
<Reject> Refuse an incoming call without answering it.
<Start> Start a one-way media stream or a live transcription, then go on with the document.
<Stop> Stop a stream or transcription started with <Start>.
<Connect> Hand the call’s audio to a bidirectional WebSocket stream (voice bot).
<Receive> Receive a fax on the call (T.38 / G.711).
<Sendfax> Send a fax document on the call.

Nouns appear inside a verb and say what the verb acts on.

Noun Used in What it is
<Number> <Dial> A phone number to dial, in E.164 (+14155550100).
<Sip> <Dial> A SIP endpoint to dial: a SIP URI (sip:alice@example.com), a registered user of the account (sip:alice@yourdomain), or an IP address (dialled as the call’s To user at that address).
<Conference> <Dial> Joins the caller to the named conference room (names are scoped to the account).
<Task> <Enqueue> The task’s attributes as a JSON object, written either as the text of <Task> or as an <Attributes> child followed by an optional <Proficiency> child (in that order).
<Stream> <Start>, <Connect> A WebSocket media stream of the call’s audio: one-way inside <Start>, bidirectional inside <Connect>.
<Transcription> <Start> Transcribes the call in real time and posts the transcript events to statusCallbackUrl.
<Stream> <Stop> Stops the stream running on the call.
<Transcription> <Stop> Stops the transcription with this name.

Requests SIPRTC makes to your document, action and Redirect URLs carry these parameters:

Parameter Description
CallSid Unique id of the call (leg) the request is about.
AccountSid The account that owns the call.
From The caller: phone number or SIP user.
To The called number or SIP user.
Caller Caller ANI as signalled.
Called Called (destination) number as signalled.
Direction inbound, outbound-api or outbound-call.
CallStatus initiated, ringing, in-progress, completed, busy, no-answer, failed or canceled.
ParentCallSid For a leg created by <Dial>, the call that dialled it.
Timestamp Time of the event (GMT).
ApiVersion API version, v1.
CallbackSource call-progress-events.

Custom SIP headers received on the call (X- headers) are added to these requests as extra parameters.

The XML Schema these pages are generated from is published at /api/TinyMLSchema.xsd. Point your editor or CI at it to catch misspelt verbs and attributes before they reach a call — SIPRTC skips what it does not recognise rather than failing the call.