206 lines
5.8 KiB
Markdown
206 lines
5.8 KiB
Markdown
# CTI Panasonic NS1000 - Setup operativo
|
|
|
|
Obiettivo: intercettare chiamate dal centralino Panasonic NS1000 (CSTA porta 33333) e creare/chiudere automaticamente Post-it in NetGescon con filtro rubrica.
|
|
|
|
## Prerequisiti verificati
|
|
|
|
- Connessione TCP PBX CSTA: `192.168.0.101:33333` raggiungibile.
|
|
- Modello centralino: Panasonic NS1000.
|
|
|
|
## 1) Configurazione applicazione NetGescon
|
|
|
|
Aggiungi in `.env` del nodo applicativo:
|
|
|
|
```env
|
|
NETGESCON_CTI_SHARED_TOKEN=<TOKEN_LUNGO_RANDOM>
|
|
```
|
|
|
|
Poi:
|
|
|
|
```bash
|
|
cd /home/michele/netgescon/netgescon-day0
|
|
php artisan optimize:clear
|
|
php artisan config:clear
|
|
php artisan route:clear
|
|
```
|
|
|
|
Staging reale (confermato):
|
|
|
|
- path applicazione: `/var/www/netgescon`
|
|
- web server: `nginx`
|
|
- porta pubblica: `80`
|
|
- URL staging tipico: `http://<IP_SERVER_200>/`
|
|
|
|
## 2) Endpoint disponibili
|
|
|
|
- `POST /api/v1/cti/panasonic/incoming`
|
|
- crea Post-it chiamata in `chiamate_post_it`
|
|
- fa match automatico numero -> `rubrica_universale`
|
|
- `POST /api/v1/cti/panasonic/call-ended`
|
|
- chiude automaticamente il Post-it aperto (match su `event_id`, fallback su numero)
|
|
- salva `esito`, `durata_secondi`, `chiusa_il`
|
|
- `GET /api/v1/cti/panasonic/lookup?phone=...`
|
|
- solo lookup rubrica (match yes/no)
|
|
|
|
Autenticazione: header `X-CTI-Token: <TOKEN>`.
|
|
|
|
## 3) Comando server web prova (porta 8000, solo sviluppo)
|
|
|
|
```bash
|
|
cd /home/michele/netgescon/netgescon-day0
|
|
php artisan serve --host=0.0.0.0 --port=8000
|
|
```
|
|
|
|
Nota: in staging non usare `artisan serve`; usare nginx su porta `80` con root applicativa `/var/www/netgescon`.
|
|
|
|
## 4) Comando minimo per vedere solo dati HTTP in arrivo
|
|
|
|
Se vuoi solo vedere cosa arriva, senza script:
|
|
|
|
```bash
|
|
ncat -kl 8099
|
|
```
|
|
|
|
Se `ncat` non e disponibile:
|
|
|
|
```bash
|
|
while true; do nc -l -p 8099; echo; echo "-----"; done
|
|
```
|
|
|
|
Poi configura il centralino (o il tool di test) verso `http://<IP_SERVER_200>:8099`.
|
|
|
|
## 5) Comando minimo per sniffing CSTA grezzo (porta 33333)
|
|
|
|
Per vedere traffico protocollo CSTA a livello rete direttamente sul server `.200`:
|
|
|
|
```bash
|
|
sudo tcpdump -i any -nn -s0 -A host 192.168.0.101 and port 33333
|
|
```
|
|
|
|
Per dump esadecimale (piu utile se payload non testuale):
|
|
|
|
```bash
|
|
sudo tcpdump -i any -nn -s0 -X host 192.168.0.101 and port 33333
|
|
```
|
|
|
|
## 6) Listener terminale con script (log su file)
|
|
|
|
Metti questo listener in ascolto e punta il PBX a `http://<IP_SERVER_200>:8099` per vedere esattamente i dati in arrivo.
|
|
|
|
```bash
|
|
cd /home/michele/netgescon/netgescon-day0
|
|
bash scripts/ops/netgescon-cti-listener.sh --port 8099
|
|
```
|
|
|
|
## 7) Test rapido terminale (incoming + call-ended)
|
|
|
|
```bash
|
|
cd /home/michele/netgescon/netgescon-day0
|
|
bash scripts/ops/netgescon-panasonic-csta-test.sh \
|
|
--pbx-ip 192.168.0.101 \
|
|
--pbx-port 33333 \
|
|
--app-url http://127.0.0.1:8000 \
|
|
--token "<TOKEN_LUNGO_RANDOM>" \
|
|
--phone "+393331112233" \
|
|
--ext "101" \
|
|
--duration 90 \
|
|
--outcome "risposta"
|
|
```
|
|
|
|
## 8) Comandi singoli per simulare chiamate da terminale
|
|
|
|
Evento incoming (una riga):
|
|
|
|
```bash
|
|
curl -sS -X POST "http://127.0.0.1:8000/api/v1/cti/panasonic/incoming" -H "Content-Type: application/json" -H "X-CTI-Token: <TOKEN_LUNGO_RANDOM>" -d '{"phone":"+393331112233","direction":"in_arrivo","called_extension":"101","event_id":"evt-001","note":"test incoming"}'
|
|
```
|
|
|
|
Evento call-ended (una riga):
|
|
|
|
```bash
|
|
curl -sS -X POST "http://127.0.0.1:8000/api/v1/cti/panasonic/call-ended" -H "Content-Type: application/json" -H "X-CTI-Token: <TOKEN_LUNGO_RANDOM>" -d '{"phone":"+393331112233","event_id":"evt-001","outcome":"risposta","duration_seconds":83,"ended_at":"2026-03-11T10:20:00+01:00","note":"test call-ended"}'
|
|
```
|
|
|
|
Lookup rubrica (una riga):
|
|
|
|
```bash
|
|
curl -sS "http://127.0.0.1:8000/api/v1/cti/panasonic/lookup?phone=+393331112233" -H "X-CTI-Token: <TOKEN_LUNGO_RANDOM>"
|
|
```
|
|
|
|
## 9) Esempio comandi da usare lato interfaccia centralino
|
|
|
|
Se il centralino puo inviare HTTP su evento incoming call, usa:
|
|
|
|
```bash
|
|
curl -sS -X POST "http://<IP_NETGESCON>:8000/api/v1/cti/panasonic/incoming" \
|
|
-H "Content-Type: application/json" \
|
|
-H "X-CTI-Token: <TOKEN_LUNGO_RANDOM>" \
|
|
-d '{
|
|
"phone": "<CALLING_NUMBER>",
|
|
"name": "<CALLER_NAME_OPTIONAL>",
|
|
"direction": "in_arrivo",
|
|
"called_extension": "<EXT>",
|
|
"event_id": "<PBX_EVENT_ID>",
|
|
"note": "evento CSTA NS1000"
|
|
}'
|
|
```
|
|
|
|
Per filtro rubrica (prima del popup interno):
|
|
|
|
```bash
|
|
curl -sS "http://<IP_NETGESCON>:8000/api/v1/cti/panasonic/lookup?phone=<CALLING_NUMBER>" \
|
|
-H "X-CTI-Token: <TOKEN_LUNGO_RANDOM>"
|
|
```
|
|
|
|
Per evento fine chiamata (chiusura automatica Post-it):
|
|
|
|
```bash
|
|
curl -sS -X POST "http://<IP_NETGESCON>:8000/api/v1/cti/panasonic/call-ended" \
|
|
-H "Content-Type: application/json" \
|
|
-H "X-CTI-Token: <TOKEN_LUNGO_RANDOM>" \
|
|
-d '{
|
|
"phone": "<CALLING_NUMBER>",
|
|
"event_id": "<PBX_EVENT_ID>",
|
|
"outcome": "risposta",
|
|
"duration_seconds": 83,
|
|
"ended_at": "2026-03-11T10:20:00+01:00",
|
|
"note": "evento call-ended NS1000"
|
|
}'
|
|
```
|
|
|
|
## 10) Cosa fa il match numeri
|
|
|
|
- normalizza il numero (es. `+39`, `0039`, spazi, trattini)
|
|
- confronta le ultime 7 cifre con:
|
|
- `telefono_cellulare`
|
|
- `telefono_ufficio`
|
|
- `telefono_casa`
|
|
- `telefono_cellulare_nazionale`
|
|
|
|
## 11) Dev + staging sulla stessa macchina (.200)
|
|
|
|
- Sviluppo consigliato: `http://127.0.0.1:8000` (`artisan serve`)
|
|
- Staging reale: `http://<IP_SERVER_200>/` su `nginx:80`, app in `/var/www/netgescon`
|
|
|
|
Comandi esempio:
|
|
|
|
```bash
|
|
# sviluppo
|
|
cd /home/michele/netgescon/netgescon-day0
|
|
php artisan serve --host=0.0.0.0 --port=8000
|
|
|
|
# staging (deploy path reale)
|
|
cd /var/www/netgescon
|
|
php artisan optimize:clear
|
|
php artisan migrate --force
|
|
sudo systemctl reload nginx
|
|
```
|
|
|
|
Nel PBX configura URL diversi per ambiente, mantenendo stesso payload/token o token distinti.
|
|
|
|
## 12) Step successivo consigliato
|
|
|
|
1. Agganciare evento reale CSTA incoming.
|
|
2. Agganciare evento call-ended per aggiornare `esito` e durata.
|
|
3. Mostrare popup operatore in Filament con scheda rubrica trovata.
|