Dopo aver analizzato i log di Asterisk mi sono reso conto che Tiscali utilizza lo schema TEL-URI e facendo ulteriori ricerche ho scoperto che questo chema è disponibile solo nel driver chan_sip e non in pjsip

dopo aver installato FreePBX sarà quindi necessario abilitare tale driver, disabilitare pjsip e assegnare la porta 5060 a chan_sip

Queste impostazioni si trovano in Settings / Advanced Settings

Per impostare la porta 5060 ci dobbiamo recare in 

Settings / Asterisk SIP settings / SIP Legacy Settings [chan_sip]

Procediamo con la creazione del Trunk

Add Trunk -> Add SIP (chan_sip) Trunk

e configurare come in foto

 

creiamo una rotta in uscita e assegniamo il Trunk creato in precedenza

Qui inizia la parte interessante, come precedentemente accennato Tiscali utilizza lo schema TEL-URI ma a quanto pare non rispetta l'rfc ufficiale e nel log compare questo:

[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  0 [ 53]: INVITE sip:Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo.:5060 SIP/2.0
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  1 [ 74]: Via: SIP/2.0/UDP 94.32.130.112:5060;branch=z9hG4bKda2812d8d8cf6f1ecb5ctaN0
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  2 [ 49]: To: <sip:Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo.;user=phone>
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  3 [ 77]: From: <tel:0039XXXXXXXXX>;tag=ztesip-OuI1Xd1pFvXrhAVYtGwr5x*2-2-20481*cdej.2
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  4 [ 37]: Call-ID: bM4IWJIsW1O_Hsrq2debc@zteims
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  5 [ 17]: CSeq: 1000 INVITE
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  6 [ 16]: Max-Forwards: 63
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  7 [ 74]: Contact: <sip:Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo.:5060;zte-did=2-2-20481-3760-12>
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  8 [ 69]: P-Called-Party-ID: "?"<sip:Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo.;user=phone>
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header  9 [ 23]: Supported: 100rel,timer
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 10 [ 24]: P-Early-Media: supported
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 11 [ 37]: P-Asserted-Identity: <tel:373XXXXXX>
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 12 [ 57]: X-ZTE-Cookie: 7zs4rm21;id=Questo indirizzo email è protetto dagli spambots. È necessario abilitare JavaScript per vederlo.
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 13 [ 88]: Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,UPDATE,REGISTER,INFO,PRACK,SUBSCRIBE,NOTIFY,MESSAGE
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 14 [ 10]: Min-SE: 90
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 15 [ 35]: Session-Expires: 1800;refresher=uac
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 16 [ 29]: Content-Type: application/sdp
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 17 [ 19]: Content-Length: 235
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 18 [ 28]: Content-Disposition: session
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:  Header 19 [  0]:
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  0 [  3]: v=0
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  1 [ 52]: o=UTSTARCOM 894511378 779705889 IN IP4 94.32.130.114
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  2 [  3]: s=-
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  3 [ 22]: c=IN IP4 94.32.130.114
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  4 [  5]: t=0 0
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  5 [ 30]: m=audio 37904 RTP/AVP 8 18 100
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  6 [ 10]: a=sendrecv
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  7 [ 21]: a=rtpmap:18 G729/8000
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  8 [ 19]: a=fmtp:18 annexb=no
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body  9 [ 33]: a=rtpmap:100 telephone-event/8000
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c:    Body 10 [ 15]: a=fmtp:100 0-15
[2020-09-28 12:22:40] VERBOSE[1901] chan_sip.c: --- (19 headers 11 lines) ---
[2020-09-28 12:22:40] DEBUG[1901] acl.c: For destination '94.32.130.112', our source address is '192.168.50.1'.
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c: Target address 94.32.130.112:5060 is not local, substituting externaddr
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c: Setting AST_TRANSPORT_UDP with address 217.133.80.167:5060
[2020-09-28 12:22:40] VERBOSE[1901] chan_sip.c: Sending to 94.32.130.112:5060 (no NAT)
[2020-09-28 12:22:40] DEBUG[1901] chan_sip.c: Allocating new SIP dialog for bM4IWJIsW1O_Hsrq2debc@zteims - INVITE (No RTP)
[2020-09-28 12:22:40] DEBUG[1901][C-0000001d] chan_sip.c: **** Received INVITE (5) - Command in SIP INVITE
[2020-09-28 12:22:40] DEBUG[1901][C-0000001d] sip/reqresp_parser.c: Begin: parsing SIP "Supported: 100rel,timer"
[2020-09-28 12:22:40] DEBUG[1901][C-0000001d] sip/reqresp_parser.c: Found SIP option: -100rel-
[2020-09-28 12:22:40] DEBUG[1901][C-0000001d] sip/reqresp_parser.c: Matched SIP option: 100rel
[2020-09-28 12:22:40] DEBUG[1901][C-0000001d] sip/reqresp_parser.c: Found SIP option: -timer-
[2020-09-28 12:22:40] DEBUG[1901][C-0000001d] sip/reqresp_parser.c: Matched SIP option: timer
[2020-09-28 12:22:40] VERBOSE[1901][C-0000001d] chan_sip.c: Sending to 94.32.130.112:5060 (no NAT)
[2020-09-28 12:22:40] DEBUG[1901][C-0000001d] chan_sip.c: Initializing initreq for method INVITE - callid bM4IWJIsW1O_Hsrq2debc@zteims
[2020-09-28 12:22:40] VERBOSE[1901][C-0000001d] chan_sip.c: Using INVITE request as basis request - bM4IWJIsW1O_Hsrq2debc@zteims
[2020-09-28 12:22:40] DEBUG[1901][C-0000001d] sip/reqresp_parser.c: No RFC 3966 global number or context found in '0039XXXXXXX'; returning local number anyway
[2020-09-28 12:22:40] NOTICE[1901][C-0000001d] chan_sip.c: From address missing 'sip:', using it anyway
[2020-09-28 12:22:40] ERROR[1901][C-0000001d] chan_sip.c: Empty domain name in FROM header
[2020-09-28 12:22:40] NOTICE[1901][C-0000001d] chan_sip.c: Unexpected error for device <tel:0039XXXXXXXXX>;tag=ztesip-OuI1Xd1pFvXrhAVYtGwr5x*2-2-20481*cdej.2 for INVITE, code = -100
[2020-09-28 12:22:40] VERBOSE[1901][C-0000001d] chan_sip.c:
<--- Reliably Transmitting (no NAT) to 94.32.130.112:5060 --->
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP 94.32.130.112:5060;branch=z9hG4bKda2812d8d8cf6f1ecb5ctaN0;received=94.32.130.112

Il driver ci dice che non riesce a identificare nessun contesto o numero globale corrispondente a quanto indicato nel RFC3966 quindi va in errore e chiude la conversazione con 503 servizio non disponibile ...

Questo perchè l'RFC si aspetta di trovare un numero globale che inizi con +39 anzichè 0039

non ho trovato altra soluzione,

anche in rete seguendo altri tutorial dove sostenevano di essere riusciti a far funzionare tiscali senza accrocchi ... ma nessuno ha funzionato nel mio caso .... mi chiedo se cisiano configurazioni diverse in base alla zona ...

alla fine ho dovuto mettere le mani sul file reqresp_parser.c e ricompilare il driver chan_sip

ho creato una macchina virtuale, potete usare vmware o virtualbox o quello che volete, ho installato ubuntu

dobbiamo quindi scaricare Asterisk 16, la stessa versione utilizzata da FreePBX

 

git clone -b 16 http://gerrit.asterisk.org/asterisk asterisk-16

Il file da editare si trova in Asterisk-16/channels/sip/reqresp_parser.c

alla riga 122

} else if ('+' == uri[0]) {
/* Global number without context or domain; possibly followed by RFC 3966 and optional other parameters. */

sostituiamo il + con lo 0 (zero)

} else if ('0' == uri[0]) {

Salviamo e rechiamoci alla base della cartella Asterisk-16

è necessario, prima di ricompiare, verificare e attivare tutte le opzioni relative al driver chan_sip

./configure

make

make menuconfig

abilitate il driver chan_sip che non viene compilato di default in quanto considerato deprecated, va quindi riabilitato

make

alla fine della procedura non ci resta che prelevare il file chan_sip.so (che troverete dentro la cartella channels solo se compilato correttamente) e copiarlo in FreePBX al posto di /usr/lib64/asterisk/modules/chan_sip.so

fatto questo riavviate FreePBX

Dovreste essere in grado di ricevere e telefonare e a vedere chi vi chiama