# WhatsApp calls

Receive and make voice calls with WebRTC.

Your customers can call your WhatsApp number, and you can call them. The platform relays the signalling: SDP offers and answers, accepting, rejecting and ending a call. The sound never goes through the platform: it flows directly between Meta and your infrastructure (WebRTC), which can be a voice agent, a softphone or a call centre.

## Before you start

- The number must be **dedicated to the API**. A number in [coexistence](/en/docs/guides/coexistence) does not handle calls: the API answers `409 calling_not_supported`.
- Meta requires a sending tier of at least **2,000 people per 24 hours** to enable calls.
- Outbound calls are not available for numbers with the country code of the United States, Canada, Egypt, Vietnam or Nigeria. Inbound calls work wherever the Cloud API is available.
- You need a WebRTC stack on your side: it produces the SDP offer or answer and handles the audio.
- Your [webhooks](/en/docs/webhooks) must receive the `calls` event (no filter, or `calls` in `events`).

## 1. Enable calls on a number

`PATCH /connections/{id}/calling`:

```json
{
  "status": "ENABLED",
  "callbackPermissionStatus": "ENABLED",
  "callHours": {
    "status": "ENABLED",
    "timezoneId": "Africa/Douala",
    "weeklyOperatingHours": [{ "dayOfWeek": "MONDAY", "openTime": "0800", "closeTime": "1700" }]
  }
}
```

- `status` turns calls on or off, and `callIconVisibility` (`DEFAULT` or `DISABLE_ALL`) shows or hides the call icon.
- `callHours` fully replaces the existing hours: at most two ranges per day, in `HHmm` format, and at most 20 holidays (`holidaySchedule`).
- `callbackPermissionStatus` set to `ENABLED` gives a customer permission to call you back when they call you.

`GET /connections/{id}/calling` reads the settings back. It can take Meta up to 7 days for every customer to see a change in their app.

## 2. Receive a call

An inbound call arrives in your webhooks, with `event_type` set to `calls`:

```json
{
  "event_type": "calls",
  "connection_id": "con_...",
  "payload": { "entry": [{ "changes": [{ "field": "calls", "value": {
    "calls": [{
      "id": "wacid.ABGGFjFVU2AfAgo6V", "event": "connect", "direction": "USER_INITIATED",
      "from": "237600000000", "session": { "sdp_type": "offer", "sdp": "v=0..." }
    }]
  } }] }] }
}
```

The call rings for 30 to 60 seconds: react to the event right away. Pass the `sdp` offer to your WebRTC stack, which produces an SDP answer, then:

1. `POST /calls/{id}/pre-accept` with `{ "sdpAnswer": "..." }`. This is recommended: the audio connection is set up before you answer, so the start of the conversation is not clipped.
2. `POST /calls/{id}/accept` with the same answer, when you are ready to talk.
3. `POST /calls/{id}/reject` to decline, or `POST /calls/{id}/terminate` to hang up.

`{id}` is the platform's `cal_...` identifier or Meta's `wacid...` identifier. If nobody answers, the customer sees "Not answered".

## 3. Call a customer

A customer must have given you call permission. See where they stand with `GET /connections/{id}/call-permissions?to=+237600000000`: `status` is `temporary` (7 days), `permanent` or `no_permission`, and `actions` shows the remaining limits.

Without permission, ask for it with a message:

```json
{
  "connectionId": "con_...",
  "to": "+237600000000",
  "callPermissionRequest": { "text": "May I call you to confirm your order?" }
}
```

Meta allows one request per 24 hours and two per 7 days, reset by a connected call. The customer's answer arrives as an inbound `interactive` message (`call_permission_reply`), and the portal shows it as "Permission d'appel accordée" or "refusée". Meta removes the permission after 4 consecutive unanswered calls.

Once you have permission, `POST /calls`:

```json
{ "connectionId": "con_...", "to": "+237600000000", "sdpOffer": "v=0...", "bizOpaqueCallbackData": "order-42" }
```

`bizOpaqueCallbackData` (512 characters at most) comes back in every event of the call. When the customer picks up, you receive a `connect` event with `direction` set to `BUSINESS_INITIATED` and the SDP answer: apply it to your WebRTC stack to open the audio.

## 4. Follow the calls

A number's call events are passed on as Meta sends them: `connect`, the statuses (`RINGING`, `ACCEPTED`, `REJECTED`) and `terminate`, which carries the duration and any error.

The platform also keeps a call log: `GET /calls` (filters `connectionId`, `direction`, `status`) and `GET /calls/{id}`. A call goes through `connecting` (outbound), `ringing`, `accepted`, then ends as `completed`, `rejected` or `failed`, with `startedAt`, `endedAt` and `durationSeconds`. SDP data is never kept.

## The errors to know

| Response | What to do |
|---|---|
| `409 calling_not_supported` | The number is in coexistence: use a number dedicated to the API. |
| `409 invalid_call_state` | The call has already ended. |
| `422 graph_error`, `metaCode` 138006 | The customer has not given permission: see [error 138006](/en/docs/errors/138006). |
| `422 graph_error`, `metaCode` 138037 | Too many attempts to customers without permission: see [error 138037](/en/docs/errors/138037). |
| `402 subscription_past_due` | The subscription is no longer active: an outbound call is refused. |
| `402 plan_feature_required` | Calling is not included in the plan (Pro and above). |

For a complete server-side example, read [Plug in a voice agent](/en/docs/guides/voice-agent).
