> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vectalk.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Configurações de Chamadas

> Detalha os campos da seção calling retornada pelo GET /phone-numbers/settings e aceita pelo POST /phone-numbers/settings.

As configurações de chamadas são uma seção dentro das [Configurações do Número](/api-reference/phone-numbers/settings). Aqui detalhamos todos os campos disponíveis.

## Campos da Resposta (GET)

A seção `calling` retornada pelo `GET /api/phone-numbers/settings`:

### Campos Obrigatórios

| Campo                        | Tipo   | Valores                             | Descrição                        |
| ---------------------------- | ------ | ----------------------------------- | -------------------------------- |
| `status`                     | string | `NOT_SET`, `enabled`, `disabled`    | Status das chamadas              |
| `call_icon_visibility`       | string | `NOT_SET`, `DEFAULT`, `DISABLE_ALL` | Visibilidade do ícone de chamada |
| `callback_permission_status` | string | `NOT_SET`, `enabled`, `disabled`    | Status do callback de permissão  |

### Campos Opcionais (aparecem quando calling está habilitado)

| Campo                        | Tipo      | Valores                   | Descrição                         |
| ---------------------------- | --------- | ------------------------- | --------------------------------- |
| `ip_addresses`               | object    | —                         | Endereços IP usados para chamadas |
| `ip_addresses.default`       | string\[] | —                         | Lista de IPs padrão               |
| `srtp_key_exchange_protocol` | string    | `NOT_SET`, `DTLS`, `SDES` | Protocolo de troca de chaves SRTP |

### SIP (`sip`)

| Campo                    | Tipo    | Descrição                                                   |
| ------------------------ | ------- | ----------------------------------------------------------- |
| `sip.status`             | string  | `enabled` ou `disabled`                                     |
| `sip.servers`            | array   | Lista de servidores SIP configurados                        |
| `sip.servers[].app_id`   | string  | ID da aplicação (obrigatório)                               |
| `sip.servers[].hostname` | string  | Hostname do servidor SIP (obrigatório)                      |
| `sip.servers[].port`     | integer | Porta do servidor (opcional)                                |
| `sip.servers[].password` | string  | Senha SIP — só retornada com `include_sip_credentials=true` |

### Vídeo (`video`)

| Campo          | Tipo   | Descrição               |
| -------------- | ------ | ----------------------- |
| `video.status` | string | `enabled` ou `disabled` |

### Áudio (`audio`)

| Campo          | Tipo   | Descrição               |
| -------------- | ------ | ----------------------- |
| `audio.status` | string | `enabled` ou `disabled` |

### Horários de Chamada (`call_hours`)

| Campo                          | Tipo   | Descrição                          |
| ------------------------------ | ------ | ---------------------------------- |
| `call_hours.status`            | string | `enabled` ou `disabled`            |
| `call_hours.timezone`          | string | Timezone (ex: `America/Sao_Paulo`) |
| `call_hours.day_of_week_start` | string | Dia de início da semana            |

### Ícones de Chamada (`call_icons`)

| Campo                                   | Tipo      | Descrição                                              |
| --------------------------------------- | --------- | ------------------------------------------------------ |
| `call_icons.restrict_to_user_countries` | string\[] | Países onde o ícone de chamada é exibido (códigos ISO) |

### Restrições (`restrictions`)

| Campo                                    | Tipo    | Descrição                   |
| ---------------------------------------- | ------- | --------------------------- |
| `restrictions.restrictions`              | array   | Lista de restrições ativas  |
| `restrictions.restrictions[].type`       | string  | Tipo da restrição           |
| `restrictions.restrictions[].expiration` | integer | Timestamp Unix de expiração |

***

## Campos para Atualização (POST)

Ao enviar `POST /api/phone-numbers/settings` com a seção `calling`:

<ParamField body="calling.status" type="string" required>
  `enabled` ou `disabled` — habilita ou desabilita chamadas.
</ParamField>

<ParamField body="calling.call_icon_visibility" type="string">
  `DEFAULT` ou `DISABLE_ALL` — controla visibilidade do ícone de chamada.
</ParamField>

<ParamField body="calling.video" type="object">
  <Expandable title="Campos">
    <ParamField body="calling.video.status" type="string" required>
      `enabled` ou `disabled` — habilita ou desabilita chamadas de vídeo.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="calling.sip" type="object">
  <Expandable title="Campos">
    <ParamField body="calling.sip.status" type="string" required>
      `enabled` ou `disabled` — habilita ou desabilita SIP.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="calling.srtp_key_exchange_protocol" type="string">
  Protocolo de troca de chaves SRTP: `DTLS` ou `SDES`.
</ParamField>

***

## Exemplos

### Habilitar Chamadas com SIP

```bash theme={null}
curl --request POST \
  --url https://apis.vectalk.com.br/api/phone-numbers/settings \
  --header 'Authorization: Bearer {seu_token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "calling": {
      "status": "enabled",
      "call_icon_visibility": "DEFAULT",
      "sip": {
        "status": "enabled"
      },
      "srtp_key_exchange_protocol": "DTLS"
    }
  }'
```

### Desabilitar Chamadas

```bash theme={null}
curl --request POST \
  --url https://apis.vectalk.com.br/api/phone-numbers/settings \
  --header 'Authorization: Bearer {seu_token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "calling": {
      "status": "disabled"
    }
  }'
```

### Obter Configurações com Credenciais SIP

```bash theme={null}
curl --request GET \
  --url 'https://apis.vectalk.com.br/api/phone-numbers/settings?include_sip_credentials=true' \
  --header 'Authorization: Bearer {seu_token}'
```

### Resposta (calling não configurado)

```json theme={null}
{
  "calling": {
    "status": "NOT_SET",
    "call_icon_visibility": "NOT_SET",
    "callback_permission_status": "NOT_SET"
  },
  "storage_configuration": {
    "status": "DEFAULT"
  }
}
```

### Resposta (calling habilitado com SIP)

```json theme={null}
{
  "calling": {
    "status": "enabled",
    "call_icon_visibility": "DEFAULT",
    "ip_addresses": {
      "default": ["157.240.0.1", "157.240.0.2"]
    },
    "callback_permission_status": "enabled",
    "srtp_key_exchange_protocol": "DTLS",
    "sip": {
      "status": "enabled",
      "servers": [
        {
          "app_id": "12345",
          "hostname": "sip.whatsapp.com",
          "port": 5060,
          "password": "sip_password_here"
        }
      ]
    },
    "video": {
      "status": "disabled"
    },
    "audio": {
      "status": "enabled"
    },
    "call_hours": {
      "status": "disabled"
    },
    "restrictions": {
      "restrictions": []
    }
  },
  "storage_configuration": {
    "status": "DEFAULT"
  }
}
```
