Call flows
Fonada handles both inbound and outbound calls. Your endpoint implementation is identical for both — the connection, the message protocol, and the audio format are the same. Only two things differ: a call-direction label, and which of the two phone numbers plays which role.
Inbound calls
An inbound call begins when an end user dials one of your numbers hosted on the Fonada platform. Fonada answers, opens a WebSocket connection to your endpoint, and sends the session_start message. Audio then flows in both directions for the duration of the call.
- End user dials your Fonada number.
- Fonada opens a WebSocket connection (wss://) to your endpoint.
- Your endpoint accepts with HTTP 101 Switching Protocols.
- Fonada sends session_start as a text frame.
- Bidirectional PCM16 audio: caller audio to you, TTS audio back to the caller.
Outbound calls
An outbound call is placed by the Fonada platform — from a campaign or an on-demand click-to-call request — and the answered call is connected to your endpoint. From the moment the end user answers, the flow is identical to an inbound call.
- Fonada dials the end user (campaign or click-to-call).
- The end user answers.
- Fonada opens a WebSocket and sends session_start.
- From here the flow is identical to inbound.
- Your bot should play a greeting first — the person who just answered is waiting.
Design for these outbound behaviours
Distinguishing inbound from outbound
Fonada sends a call-direction value so your bot can branch on it. The field name and exact strings are configured per account — you specify what your service expects (for example inbound/outbound, IN/OUT, or any other values) and Fonada sends exactly that. See Customisation.
The two phone numbers are always present, and their roles are consistent in both directions:
| Field | Inbound | Outbound |
|---|---|---|
customer_phone | The caller — the end user who dialled your number | The number Fonada dialled — the end user |
business_phone | Your number that was dialled | The caller ID Fonada presented |
In other words, customer_phone is always the end user, and business_phone is always your number on the Fonada platform. Both field names are configurable.
Initiating outbound calls
Submitting campaigns, uploading contact lists, and placing on-demand click-to-call requests are handled by a separate API, documented independently of this guide. Request the outbound API documentation from your Fonada account contact.
Everything that occurs from the moment the end user answers is covered here. Your streaming endpoint requires no changes to support outbound traffic beyond the direction handling above.