Place a call
/api/v1/ext/calls
Call a contact from the workspace's line, and talk through a LiveKit room.
The dashboard's call button. The line dials the contact and the response carries the LiveKit room the caller joins to talk: connect to room.url with room.token (the livekit-client SDK, or any LiveKit client), publish a microphone track and subscribe to the contact's audio. Use the room.url of each call: it is not one fixed address (our LiveKit server, LiveKit Cloud, or a white-label account's own calls domain), so never store or hard-code it. audio: false means the line rings without browser audio (an Android phone whose calling line is off): the call still happens on the device.
With no channel, the first line in Call Routing dials (or the Mac, then Android, when none is set). allow_backup: true returns backup_lines: when the line fails after dialling, call again with the same body plus backup_tried naming the lines tried, and the next line dials. An email can only be called over FaceTime from the Mac. Hang up with *End call*.
To follow the call, its steps are pushed to your callback URL as call.status events: see Build calling into your own system.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| workspace_id | body | number | yes | A workspace of the installer. |
| contact_id | body | number | no | The contact to call: its phone number, or its email over FaceTime when it has none. One of contact_id, phone or email. |
| phone | body | string | no | A phone number with country code; filed against its contact when there is one. |
body | string | no | An Apple ID email — FaceTime Audio from the workspace's Mac only. | |
| channel | body | enum | no | The line to call from. Default: Call Routing (Mac first). |
| allow_backup | body | boolean | no | true = follow Call Routing onto the next line when this one fails after dialling (the response says which lines are left). |
| backup_tried | body | array | no | With allow_backup: the lines already tried for this call (imessage, android, whatsapp, twilio). Send it when the call failed after dialling and you are calling again; the next line in Call Routing dials. |
| whatsapp_line_id | body | number | no | WhatsApp only: which connected number to call from. Default: the workspace's default line. |
Responses
| Status | When |
|---|---|
202 | Dialling — join the room to talk |
400 | No recipient, a contact with no handle, an email on a line other than FaceTime, or the line refused (no Mac, offline, no calling plan) |
401 | Missing or invalid token |
403 | Missing scope |
404 | Contact does not exist or is not the installer's (same response for both) |
409 | The line is already on a call |
curl -X POST "https://backend.mysmsgateway.app/api/v1/ext/calls" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": 7,
"contact_id": 1234,
"channel": "imessage",
"allow_backup": true
}'{
"success": true,
"message": "Call placed",
"data": {
"call_id": "c7f1a2b3-4d5e-4f60-8a9b-0c1d2e3f4a5b",
"channel": "imessage",
"to": "+61412345678",
"contact_id": 1234,
"workspace_id": 7,
"from_number": null,
"room": {
"url": "wss://livekit.example.com",
"name": "call-c7f1a2b3",
"token": "eyJhbGciOiJIUzI1NiIs…",
"identity": "browser-42-c7f1a2b3"
},
"audio": true,
"backup_lines": [
"android"
]
}
}« Call readiness
End call »
