Ciao a tutti,
ho passato i giorni scorsi a configurare Asterisk versione 20.8 per funzionare con una linea residenziale di Sky.
I messaggi in questo forum mi hanno aiutato, anche se nessuna configurazione che ho trovato qui ha funzionato, però tra i messaggi del forum, una sana dose di insulti e i suggerimenti di un paio di LLM ho trovato una configurazione per me ottimale.
Anzitutto alcune premesse, che servono per capire come mai la mia configurazione è così com'è perchè potrebbe sembrare un pelo più complicata del dovuto.
Sky usa un utente "s" per le chiamate inbound che manda in confusione Asterisk, e allo stesso modo Asterisk tende a sbroccare quando mappa indirizzi IPv6 ai vari endpoint, per questo la configurazione che ho creato ha il concetto di "catch-all", che è un livello di indirezione che serve a mappare le chiamate inbound al telefono interno.
I miei telefoni usano IPv4, e Sky usa solo IPv6, quindi ci sono 2 transport diversi mappati di conseguenza ai rispettivi endpoint.
Il firewall non espone la porta 5060 su internet, quindi le chiamate che ricevo son relative solo alla registrazione che Asterisk attua verso Sky, non esponete la porta 5060 sull'interfaccia pubblica!
Il dominio voip.sky.it è interno alla rete sky, solo il proxy voip.it.isp.sky lo può raggiungere. Va specificato in tutti i casi rilevanti di usare voip.it.isp.sky con loose routing ("\;lr")
Asterisk deve necessariamente usare i DNS di sky per poter risolvere voip.it.isp.sky (dig any voip.it.isp.sky deve restituire un record NAPTR)
192.168.0.1 è l'indirizzo interno del mio server, che uso anche come dominio
<USER_SKY> e <PASS_SKY> si richiedono a questa pagina https://assistenza.sky.it/sky-wifi-fibra/sky-hub/guida-configurazione-modem-libero
La scelta di associare 2a0e:402:100:300::/64 a sky è del tutto empirica, ma mi sembra sensata osservando il traffico di rete
Ho messo delle ACL per aggiungere un livello di sicurezza al setup, anche se il firewall che ho configurato non dovrebbe renderle necessarie. Non fanno male, ma le potete anche omettere.
Detto questo, le configurazioni importanti sono:
pjsip.conf
[global]
type = global
user_agent = SkyVoIPClient-Asterisk
[system]
type = system
timer_t1 = 100
timer_b = 8000
compact_headers = no
[transport-udp-ipv6]
type = transport
protocol = udp
bind = [::]:5060
symmetric_transport = yes
allow_reload = yes
[transport-udp]
type = transport
protocol = udp
bind = 192.168.0.1:5060
local_net = 192.168.0.0/16
domain = 192.168.0.1
allow_reload = yes
[s_auth]
type = auth
auth_type = userpass
username = <USER_SKY>
password = <PASS_SKY>
realm = voip.sky.it
[s_aor]
type = aor
support_path = yes
qualify_frequency = 0
default_expiration = 1500
outbound_proxy=sip:voip.it.isp.sky\;lr
contact = sip:<USER_SKY>@voip.sky.it:5060
[s]
type = endpoint
allow_subscribe = yes
allow_overlap = yes
transport = transport-udp-ipv6
from_user = <USER_SKY>
context = from-sky
from_domain = voip.sky.it
contact_user = <USER_SKY>
disallow = all
allow = alaw,ulaw,g729
outbound_auth = s_auth
aors = s_aor
dtmf_mode = rfc4733
direct_media = no ; Let audio always flow through Asterisk (Sky trunk!)
trust_id_inbound = yes ; Accept From, P-Asserted-ID, etc.
send_pai = yes ; Send P-Associated-URI header
100rel = yes ; Supports 100rel (required for Sky)
t38_udptl = no ; FAX not used
language = it
media_encryption = no
acl = acl_deny_all_v4, acl_only_sky_trunk_v6
[s_reg]
type = registration
transport = transport-udp-ipv6
outbound_auth = s_auth
outbound_proxy = sip:voip.it.isp.sky\;lr
server_uri = sip:voip.sky.it
client_uri = sip:<USER_SKY>@voip.sky.it
retry_interval = 2
fatal_retry_interval = 2
forbidden_retry_interval = 2
auth_rejection_permanent = no
expiration = 1500
[catch_all_identify]
type = identify
endpoint = catch_all
match = 2a0e:402:100:300::/64
[user_identify]
type = identify
endpoint = catch_all
match_header = From:.*sip:.*@voip\.sky\.it.*
[catch_all]
type = endpoint
context = from-sky
disallow = all
allow = alaw,ulaw,g729
allow_subscribe = yes
direct_media = no
direct_media_method = invite
dtmf_mode = rfc4733
force_rport = yes
identify_by = username,ip,header
language = it
media_encryption = no
rewrite_contact = yes
rtp_symmetric = yes
send_pai = yes
transport = transport-udp-ipv6
trust_id_inbound = yes
outbound_proxy=sip:voip.it.isp.sky\;lr
acl = acl_deny_all_v4, acl_only_sky_trunk_v6
[catch_all]
type = aor
max_contacts = 1
remove_existing = yes
qualify_frequency = 60
[softphone_auth]
type = auth
auth_type = userpass
username = softphone
password = <PASS>
realm = 192.168.0.1
[softphone]
type = aor
max_contacts = 1
remove_existing = yes
qualify_frequency = 60
[softphone]
type = endpoint
transport = transport-udp
context = from-internal
disallow = all
allow = alaw,ulaw,g729
aors = softphone
auth = softphone_auth
acl = acl_deny_all_v6, acl_only_internal_v4
[softphone_identify]
type = identify
endpoint = softphone
match = 192.168.74.0/24
extensions.conf
[from-sky]
; Generic catch-all for incoming calls
exten => _X.,1,NoOp(Incoming Sky calls)
same => n,Dial(PJSIP/softphone,40)
same => n,Hangup()
; Also catch the special "s" extension which may be used
exten => s,1,NoOp(Incoming Sky calls via s)
same => n,Dial(PJSIP/softphone,40)
same => n,Hangup()
[from-internal]
exten => _[+0-9].,1,NoOp(Dialing number ${EXTEN})
same => n,Dial(PJSIP/${EXTEN}@s)
same => n,Hangup()
exten => _X.,1,Dial(PJSIP/${EXTEN}@s)
exten => _X.,n,Hangup()
acl.conf
[acl_only_internal_v4]
deny = 0.0.0.0/0.0.0.0
permit = 192.168.0.0/16
[acl_only_sky_trunk_v6]
deny = ::/0
permit = 2a0e:402:100:300::/64
[acl_deny_all_v4]
deny = 0.0.0.0/0.0.0.0
[acl_deny_all_v6]
deny = ::/0