Aggiornamento, dopo parecchie decine di ore di studio sulla wiki di Asterisk, YouTube, FibraClick, e vari forum, sono arrivato a creare queste configurazioni, che mi permettono di chiamare e ricevere. Mi aspettavo problemi col NAT eppure sia SIP che RTP funzionano, non ho effettuato alcun port forwarding, non uso STUN, né SIP ALG sul router.
Ecco pjsip.conf
(bob è il telefono VoIP)
[udp_transport]
type = transport
protocol = udp
bind = 0.0.0.0
[bob]
type = endpoint
context = internal
disallow = all
allow = ulaw,alaw
aors = bob
auth = bob_auth
[bob]
type = aor
max_contacts = 1
qualify_frequency = 25
[bob_auth]
type = auth
auth_type = userpass
username = bob
password = 12345678
[telecom]
type = endpoint
aors = telecom
outbound_proxy = sip:xxxxx.co.imsw.telecomitalia.it\;lr
disallow = all
allow = ulaw,alaw
context = external
outbound_auth = telecom_auth
direct_media = no
[telecom]
type = aor
contact = sip:telecomitalia.it
outbound_proxy = sip:xxxxx.co.imsw.telecomitalia.it\;lr
qualify_frequency = 25
[telecom_auth]
type = auth
auth_type = userpass
username = +39NUM_TEL
password = SIP_KEY
realm = telecomitalia.it
[telecom_reg]
type = registration
endpoint = telecom
transport = udp_transport
outbound_auth = telecom_auth
server_uri = sip:telecomitalia.it
client_uri = sip:+39NUM_TEL@telecomitalia.it
outbound_proxy = sip:xxxxx.co.imsw.telecomitalia.it\;lr
contact_user = +39NUM_TEL
expiration = 86400
line = yes
[telecom_id]
type = identify
endpoint = telecom
match = xxxxx.co.imsw.telecomitalia.it
srv_lookups = yes
E il dialplan extensions.conf
. Permette solo chiamate verso l'Italia.
[external]
exten => +39NUM_TEL,1,Goto(internal,001,1)
[internal]
exten => 001,1,Verbose(2, Chiamata in entrata da "${CALLERID(num)}")
same => n,Dial(PJSIP/bob)
same => n,Hangup()
exten => _X.,1,Set(SAFE_EXTEN=${FILTER(0-9,${EXTEN})})
same => n,Set(ORIGINAL_EXTEN=${EXTEN})
same => n,GotoIf($["${EXTEN}" != "${SAFE_EXTEN}"]?error,1)
same => n,Verbose(2, Chiamata in uscita verso "${SAFE_EXTEN}")
same => n,Dial(PJSIP/${SAFE_EXTEN}@telecom)
same => n,Hangup()
exten => _+39X.,1,Set(SAFE_EXTEN=+39${FILTER(0-9,${EXTEN:3})})
same => n,Set(ORIGINAL_EXTEN=${EXTEN})
same => n,GotoIf($["${EXTEN}" != "${SAFE_EXTEN}"]?error,1)
same => n,Verbose(2, Chiamata in uscita verso "${SAFE_EXTEN}")
same => n,Dial(PJSIP/${SAFE_EXTEN}@telecom)
same => n,Hangup()
exten => error,1,Verbose(2, Chiamata in uscita rifiutata, numero "${ORIGINAL_EXTEN}" non valido)
same => n,Hangup()
@eutampieri Confermo che le chiamate in uscita verso TIM funzionano. Inoltre, alla luce di quanto scritto qui credo che il tuo dialplan sia bypassabile per chiamare all'estero.