docs(cti): align staging nginx:80 and add minimal sniff/test commands

This commit is contained in:
michele 2026-03-11 18:15:15 +00:00
parent 22be2be817
commit 4080b74865

View File

@ -24,6 +24,13 @@ ## 1) Configurazione applicazione NetGescon
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`
@ -37,14 +44,46 @@ ## 2) Endpoint disponibili
Autenticazione: header `X-CTI-Token: <TOKEN>`.
## 3) Comando server web prova (porta 8000)
## 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
```
## 4) Listener terminale per vedere payload grezzi
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.
@ -53,7 +92,7 @@ ## 4) Listener terminale per vedere payload grezzi
bash scripts/ops/netgescon-cti-listener.sh --port 8099
```
## 5) Test rapido terminale (incoming + call-ended)
## 7) Test rapido terminale (incoming + call-ended)
```bash
cd /home/michele/netgescon/netgescon-day0
@ -68,7 +107,27 @@ ## 5) Test rapido terminale (incoming + call-ended)
--outcome "risposta"
```
## 6) Esempio comandi da usare lato interfaccia centralino
## 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:
@ -109,7 +168,7 @@ ## 6) Esempio comandi da usare lato interfaccia centralino
}'
```
## 7) Cosa fa il match numeri
## 10) Cosa fa il match numeri
- normalizza il numero (es. `+39`, `0039`, spazi, trattini)
- confronta le ultime 7 cifre con:
@ -118,10 +177,10 @@ ## 7) Cosa fa il match numeri
- `telefono_casa`
- `telefono_cellulare_nazionale`
## 8) Dev + staging sulla stessa macchina (.200)
## 11) Dev + staging sulla stessa macchina (.200)
- Sviluppo consigliato: `http://127.0.0.1:8000`
- Staging consigliato: `http://127.0.0.1:8001`
- 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:
@ -130,14 +189,16 @@ # sviluppo
cd /home/michele/netgescon/netgescon-day0
php artisan serve --host=0.0.0.0 --port=8000
# staging (altro terminale, altra working copy o env staging)
cd /home/michele/netgescon/netgescon-day0
APP_ENV=staging php artisan serve --host=0.0.0.0 --port=8001
# 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.
## 9) Step successivo consigliato
## 12) Step successivo consigliato
1. Agganciare evento reale CSTA incoming.
2. Agganciare evento call-ended per aggiornare `esito` e durata.