---
url: https://next.zammad.org/it/reference/rest-api/cti.md
---

# CTI generico

## Introduzione

Questa pagina descrive gli ambiti e le funzionalità generiche dell'API CTI.

::: warning

* L'autenticazione su questo endpoint funziona in modo fondamentalmente diverso rispetto
  al resto.
  :::

## Funzionalità

Ecco un piccolo elenco condensato delle possibilità che questa API CTI
fornisce.

### In entrata

* Funzioni del registro chiamante per i tuoi agenti.
* Blocco degli ID chiamante durante la segnalazione.

### In uscita

* Funzioni del registro chiamante per i tuoi agenti.
* Imposta gli ID chiamante in uscita a seconda dell'ID chiamante di
  destinazione.

### Endpoint

L'endpoint si trova nell'integrazione CTI generica e contiene un token
univoco che.

::: info
La configurazione CTI generica e l'endpoint corretto si trovano nel tuo
Zammad nell'amministrazione.
:::

::: tip
Ci sono due opzioni su come inviare con `POST` i dati rilevanti a Zammad:

* JSON (consigliato)
* F
  :::

### Eventi

Ci sono diversi eventi in termini di una chiamata in corso. Queste azioni
provengono sempre dal tuo.

* Evento "newCall" (inizio di una chiamata)
* Evento "hangup" (fine chiamata)
* Evento "answer" (ovvero rispondere al telefono)

In alcune situazioni Zammad potrebbe fornire una risposta sulle tue chiamate
PBX (ad esempio un rifiuto) se blocchi.

### Used examples

**Esempio:**
Le chiamate seguenti sono state inviate con la seguente configurazione. Questo è importante.

**In uscita:**

* ID chiamante destinazione `4989*` imposta ID chiamante in uscita
  `498999998145` con nota "Tutto da mu
* ID chiamante destinazione `4930*` imposta ID chiamante in uscita
  `493023125877` "Tutto da Berlino"

**Altre impostazioni:**

* ID chiamante predefinito per chiamate in uscita `496990009111`

## New call event

### Generale

`attributes` disponibili e :

`event`&#x20;
:
Tell Zammad there is a new call.

`from`&#x20;
:
Number that initiated the call. Can be `anonymous` as well.

`to`&#x20;
:
Number that is being called.

`direction`&#x20;
:
The call direction. If your agent initiates a call, this will be `out`. Calls
from external side to you are `in`.

`callId`&#x20;
: Un ID univoco.

`user`&#x20;
: Il nome reale dell'utente coinvolto. Potresti avere.

`queue`&#x20;
: Un nome di coda opzionale, questa opzione è rilevante.

### In uscita

:::: details

::: tabs key:cti

\=== JSON

`POST`-Request inviato:
`https://{FQDN-Zammad}/api/v1/cti/{instance specific token}`

Payload:

```json
{
  "event": "newCall",
  "from": "493023125741",
  "to": "492214710334",
  "direction": "out",
  "callId": "f4ebd2be-7b9a-4d58-94c2-eb06a3c2ce76",
  "user": "Lauren Brooks"
}

```

Response:

```json
{
  "action": "dial",
  "caller_id": "496990009111",
  "number": "492214710334"
}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "event": "newCall",
    "from": "493023125741",
    "to": "492214710334",
    "direction": "out",
    "callId": "f4ebd2be-7b9a-4d58-94c2-eb06a3c2ce76",
    "user": "Lauren Brooks"
  }'

```

\=== Form-data

`POST`-Request inviata:
`https://{FQDN-Zammad}/api/v1/cti/{instance specific token}`

Payload:

```
event:"newCall"
from:"493023125741"
to:"492214710334"
direction:"out"
callId:"f0871278-0600-4f5c-a746-bec3acf04f41"
user:"Lauren Brooks"

```

Restituisce:

```json
{
  "action": "dial",
  "caller_id": "496990009111",
  "number": "492214710334"
}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --form 'event="newCall"' \
  --form 'from="493023125741"' \
  --form 'to="492214710334"' \
  --form 'direction="out"' \
  --form 'callId="f0871278-0600-4f5c-a746-bec3acf04f41"' \
  --form 'user="Lauren Brooks"'

```

:::
::::

### In entrata

:::: details

::: tabs key:cti

\=== JSON

Payload:

```json
{
  "event": "newCall",
  "from": "493023125741",
  "to": "492214710334",
  "direction": "in",
  "callId": "307fa962-de8d-4ffc-817b-7f6993204159",
  "user": [
    "Lauren Brooks",
    "Ethan Kwan"
  ]
}

```

Response:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
     "event": "newCall",
     "from": "493023125741",
     "to": "492214710334",
     "direction": "in",
     "callId": "307fa962-de8d-4ffc-817b-7f6993204159",
     "user": ["Lauren Brooks", "Ethan Kwan"]
  }'

```

\=== Form-data

Payload:

```
event:"newCall"
from:"493023125741"
to:"492214710334"
direction:"in"
callId:"25641e3f-3317-4c48-80b3-fc573c7ffe2b"
user[]:"Lauren Brooks"
user[]:"Ethan Kwan"

```

Restituisce:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --form 'event="newCall"' \
  --form 'from="493023125741"' \
  --form 'to="492214710334"' \
  --form 'direction="in"' \
  --form 'callId="25641e3f-3317-4c48-80b3-fc573c7ffe2b"' \
  --form 'user[]="Lauren Brooks"' \
  --form 'user[]="Ethan Kwan"'

```

:::
::::

### Situation specific responses

A seconda della direzione di chiamata scelta, Zammad restituirà un
(opzionalmente) configurato.

::: info
This has to be supported by your PBX to work.
:::

#### Reject blocked caller ids

Se una nuova chiamata in entrata corrisponde a un numero da bloccare, Zammad
restituirà quanto segue.

```json
{
  "action": "reject",
  "reason": "busy"
}

```

Se nessun numero da bloccare corrisponde, Zammad restituirà quanto segue.

```json
{}

```

::: warning
Il tuo PBX deve comunque terminare la chiamata (evento hangup). Altrimenti la
chiamata non apparirà semplicemente.
:::

#### Imposta ID chiamante in uscita specifico

Nel caso la tua istanza abbia un ID chiamante di sovrascrittura
corrispondente configurato, Zammad restituirà.

```json
{
  "action": "dial",
  "callerId": "493055571642",
  "number": "491711234567890"
}

```

Se non viene trovata nessuna corrispondenza di sovrascrittura o non hai
configurato nulla, Zammad restituirà.

```json
{}

```

## Call answer event

### Generale

`attributes` disponibili e :

`event` :
:
Tell Zammad that someone answered the call.

`from` :
:
Number that initiated the call.

`to` :
:
Number that is being called.

`direction` :
:
The call direction - if your agent initiates a call, this will be `out`.

`callId` :
: Un ID univoco.

`answeringNumber` :
:   Zammad cercherà un.

`user` :
: Il nome reale dell'utente coinvolto. Potresti avere.

Ci sono due opzioni su come inviare con `POST` i dati rilevanti a Zammad.

### In uscita

:::: details

::: tabs key:cti

\=== JSON

`POST`-Request inviato:
`https://{FQDN-Zammad}/api/v1/cti/{instance specific token}`

Payload:

```json
{
  "event": "answer",
  "from": "493023125741",
  "to": "492214710334",
  "direction": "out",
  "callId": "9f1840cb-8be9-4d3a-8200-3da2937085f0",
  "caller": "Lauren Brooks"
}

```

Response:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
     "event": "answer",
     "from": "493023125741",
     "to": "492214710334",
     "direction": "out",
     "callId": "9f1840cb-8be9-4d3a-8200-3da2937085f0",
     "caller": "Lauren Brooks"
  }'

```

\=== Form-data

`POST`-Request inviato:
`https://{FQDN-Zammad}/api/v1/cti/{instance specific token}`

Payload:

```
event:"answer"
from:"493023125741"
to:"492214710334"
direction:"out"
callId:"371e2cd7-67ff-4fd9-892b-030c8d128fb1"
caller[]:"Lauren Brooks"
caller[]:"Emily Tran"

```

Restituisce:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --form 'event="answer"' \
  --form 'from="493023125741"' \
  --form 'to="492214710334"' \
  --form 'direction="out"' \
  --form 'callId="371e2cd7-67ff-4fd9-892b-030c8d128fb1"' \
  --form 'caller[]="Lauren Brooks"' \
  --form 'caller[]="Emily Tran"'

```

:::
::::

### In entrata

:::: details

::: tabs key:cti

\=== JSON

Payload:

```json
{
  "event": "answer",
  "from": "493023125741",
  "to": "492214710334",
  "direction": "in",
  "callId": "307fa962-de8d-4ffc-817b-7f6993204159",
  "answeringNumber": "emily@fastlane.inc",
  "caller": [
    "Lauren Brooks",
    "Emily Tran"
  ]
}

```

Response:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
     "event": "answer",
     "from": "493023125741",
     "to": "492214710334",
     "direction": "in",
     "callId": "307fa962-de8d-4ffc-817b-7f6993204159",
     "answeringNumber": "emily@fastlane.inc",
     "caller": ["Lauren Brooks", "Emily Tran"]
  }'

```

\=== Form-data

Payload:

```
event:"answer"
from:"493023125741"
to:"492214710334"
direction:"in"
callId:"61868f1e-2171-4313-970b-25982f0c5ce1"
answeringNumber:"emily@fastlane.inc"
caller="Emily Tran"

```

Restituisce:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --form 'event="answer"' \
  --form 'from="493023125741"' \
  --form 'to="492214710334"' \
  --form 'direction="in"' \
  --form 'callId="61868f1e-2171-4313-970b-25982f0c5ce1"' \
  --form 'answeringNumber="emily@fastlane.inc"' \
  --form 'caller="Emily Tran"'

```

:::
::::

## Call hangup

### Generale

`event` :
:
Tell Zammad that someone answered the call.

`from` :
:
Number that initiated the call.

`to` :
:
Number that is being called.

`direction` :
:
The call direction - if your agent initiates a call, this will be `out`.

`callId` :
: Un ID univoco.

`cause`
:   Definisce il motivo della fine chiamata. Zammad valuta la causa e indica.

`answeringNumber` :
:   Zammad cercherà un.

### In uscita

:::: details

::: tabs key:cti

\=== JSON

`POST`-Request inviato:
`https://{FQDN-Zammad}/api/v1/cti/{instance specific token}`

Payload:

```json
{
  "event": "hangup",
  "from": "493023125741",
  "to": "492214710334",
  "direction": "out",
  "callId": "f4ebd2be-7b9a-4d58-94c2-eb06a3c2ce76",
  "cause": "cancel"
}

```

Response:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
     "event": "hangup",
     "from": "493023125741",
     "to": "492214710334",
     "direction": "out",
     "callId": "f4ebd2be-7b9a-4d58-94c2-eb06a3c2ce76",
     "cause": "cancel"
  }'

```

\=== Form-data

`POST`-Request inviato:
`https://{FQDN-Zammad}/api/v1/cti/{instance specific token}`

Payload:

```
event:"hangup"
from:"493023125741"
to:"492214710334"
direction:"out"
callId:"da7cf8b8-2de2-4120-93c8-7db1f55225dc"
cause:"cancel"

```

Restituisce:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --form 'event="hangup"' \
  --form 'from="493023125741"' \
  --form 'to="492214710334"' \
  --form 'direction="out"' \
  --form 'callId="da7cf8b8-2de2-4120-93c8-7db1f55225dc"' \
  --form 'cause="cancel"'

```

:::
::::

### In entrata

:::: details

::: tabs key:cti

\=== JSON

Payload:

```json
{
  "event": "hangup",
  "from": "493023125741",
  "to": "492214710334",
  "direction": "in",
  "callId": "2d77882f-68df-40f0-8c62-b642589c00bc",
  "answeringNumber": "emily@fastlane.inc",
  "cause": "normalClearing"
}

```

Response:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
     "event": "hangup",
     "from": "493023125741",
     "to": "492214710334",
     "direction": "in",
     "callId": "307fa962-de8d-4ffc-817b-7f6993204159",
     "answeringNumber": "emily@fastlane.inc",
     "cause": "normalClearing"
  }'

```

\=== Form-data

Payload:

```
event:"hangup"
from:"493023125741"
to:"492214710334"
direction:"in"
callId:"2d77882f-68df-40f0-8c62-b642589c00bc"
answeringNumber:"emily@fastlane.inc",
cause:"normalClearing"

```

Response:

```json
{}

```

Comando curl di esempio:

```sh
curl --request POST 'https://{FQDN-Zammad}/api/v1/cti/{instance specific token}' \
  --form 'event="hangup"' \
  --form 'from="493023125741"' \
  --form 'to="492214710334"' \
  --form 'direction="in"' \
  --form 'callId="2d77882f-68df-40f0-8c62-b642589c00bc"' \
  --form 'answeringNumber="emily@fastlane.inc"' \
  --form 'cause="normalClearing"'

```

:::
::::
