Tasks
Answer Dial Call
Answers a ringing phone call and connects the caller to a live AI voice call. Useful for voice assistants that pick up calls to an extension on your phone system.
When a phone call comes in through a SIP connection, the stub gets an _update_from_dial with is_incoming_call set to true. To pick up, start a voice call with Start Voice Chat on the dial channel, then run this task with the call and the new voice call.
The task waits until the call is connected and the caller can hear the assistant, usually within a second, and then returns. From then on the call works like any live voice call: the stub steers it with voice notifications and gets _update_from_voice updates, including when the call ends.
The call must be answered within 25 seconds of the incoming call event. The caller hears ringing until then. After that the call is turned away, and the stub gets a missed call event instead.
Basic usage
Parameters
dialcalluuid required string
The id of the call, from stubpost.data._incoming_dial_data.call_data.dialcalluuid on the incoming call event.
voice_session_uuid required string
The voice call to connect the caller to, from the Start Voice Chat result. Start it with "channel": "dial" and the call's audio format:
Phone calls use the G.711 format the phone system prefers, audio/pcmu (μ-law) or audio/pcma (A-law), and the voice call has to match it. Use ~~ so the format is passed as an object. Without audio.format, the voice call uses the dial channel's default, μ-law, and an A-law call fails at the gateway_join step.
Result
Properties
payload.status string
answered: the caller is connected to the assistant.
payload.dialcalluuid string
The id of the call that was answered.
payload.voice_session_uuid string
The voice call the caller is connected to.
payload.audio_format object
The audio format of the call.
Errors
These are conceptual errors.
When answering fails along the way, the task returns a technical error, and error.details.step says where it failed. The caller's call ends. A voice call that never got the caller ends as abandoned by itself, with a session_ended _update_from_voice.
Examples
Answer every incoming call
On the action that receives _update_from_dial, start the voice call and answer. Both tasks use is_incoming_call as their condition, so they don't run for missed calls. The greeting makes the assistant speak first.
Greet known callers by name
from is the caller's number. When the stub knows the caller, put their name in the greeting:
End the call
There is no task to hang up a phone call. End the voice call as usual, eg with a hangup voice notification or the Voice Hangup task. The assistant says goodbye, then the phone call ends.