SIP Trunk registered but no incoming calls

Hello,

I tried to configure Asterisk to use the SIP Trunk from my ISP (SFR in France).
The SIP Truck appeared as registered with the command sip show registry:

Host                                    dnsmgr Username       Refresh State                Reg.Time                 
corbas.p-cscf.sfr.net:5062              N      *****       105 Registered           Tue, 14 Sep 2021 08:45:43
1 SIP registrations.

My problem is that I didn’t receive incoming calls.

Here are my sip.conf file:

[general]
websocket_enabled = false
context=from-sfr

udpbindaddr=0.0.0.0
udpbindport=5080

tcpenable=no
tcpbindaddr=0.0.0.0
transport=udp

srvlookup=yes

language=fr

register => ***@ims.mnc010.mcc208.3gppnetwork.org:***:***.IZU.THD@sfr.fr@corbas.p-cscf.sfr.net:5062

allowguest=no
alwaysauthreject=yes
contactpermit=0.0.0.0/0.0.0.0 ;Only for tests. I will configure my local network when everything will be ok.
media_address=MY_PUBLIC_IP_ADDRESS

disallow=all
allow=ulaw
allow=alaw

nat=force_rport

[authentication]

[basic-options](!)                ; a template
        dtmfmode=rfc2833
        context=from-office
        type=friend

[natted-phone](!,basic-options)   ; another template inheriting basic-options
        directmedia=no
        host=dynamic

[public-phone](!,basic-options)   ; another template inheriting basic-options
        directmedia=yes

[my-codecs](!)                    ; a template for my preferred codecs
        disallow=all
        allow=ilbc
        allow=g729
        allow=gsm
        allow=g723
        allow=ulaw

[ulaw-phone](!)                   ; and another one for ulaw-only
        disallow=all
        allow=ulaw

My extensions.conf file:

[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
CONSOLE=Console/dsp                             ; Console interface for demo
IAXINFO=guest                                   ; IAXtel username/password
TRUNK=DAHDI/G2                                  ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)

[from-sfr]
exten => s,1,Dial(SIP/6001)

Outgoing calls are working so I removed concerned piece of code to focus on my issue.
Asterisk is installed on a RaspberryPi, which is behind my OpenWrt router.
I think it is a NAT-related and/or firewall-related issue.

Thanks in advance

You haven’t defined any peers, and as you have allowguest=no, all incoming calls will be rejected. In particular, there is nothing in the from-sfr context.

Also please note that chan_sip should not be used for new systems unless there are specific technical reasons (a ITSP claiming they don’t support chan_pjsip is not a good enough reason). However if you use chan_sip, best practice is to use type=peer, unless it is impossible to uniquely identify callers by IP address, in which case type=friend should still be the exception.

Is SFR really sufficiently broken to require nat=force-rport?

Thanks David.

I tried to switch to chan_pjsip with the following configuration:

[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0:5080
local_net=192.168.1.0/24
external_media_address=***
external_signaling_address=***

[trunk-sfr]
type=registration
transport=transport-udp-nat
outbound_auth=trunk-sfr
server_uri=sip:+33***@ims.mnc010.mcc208.3gppnetwork.org
client_uri=sip:+33***@ims.mnc010.mcc208.3gppnetwork.org
outbound_proxy=sip:corbas.p-cscf.sfr.net:5062\;lr

[trunk-sfr]
type=auth
password=***
username=***.IZU.THD@sfr.fr

[trunk-sfr]
type = aor
contact = sip:+33***@ims.mnc010.mcc208.3gppnetwork.org
outbound_proxy = sip:corbas.p-cscf.sfr.net:5062\;lr

[trunk-sfr]
type = identify
endpoint = trunk-sfr
match = corbas.p-cscf.sfr.net:5062

[trunk-sfr]
type=endpoint
transport=transport-udp-nat
context=extensions
outbound_auth=trunk-sfr
from_domain=ims.mnc010.mcc208.3gppnetwork.org
from_user=+33***
allow=!all,opus,speex,g722,alaw,ulaw,gsm
outbound_proxy = sip:corbas.p-cscf.sfr.net:5062\;lr
aors = trunk-sfr

extensions.conf:

[extensions]
exten => _0[12345679]XXXXXXXX,1,Dial(PJSIP/${EXTEN}@trunk-sfr) 

I am unable to send or receive calls anymore.
About receiving calls, the registration seems to be ok but the extension 6001 isn’t been triggered:

pjsip show registrations

 <Registration/ServerURI..............................>  <Auth..........>  <Status.......>
==========================================================================================

 trunk-sfr/sip:+33***@ims.mnc010.mcc208.3gppnetwo  trunk-sfr         Registered      

Objects found: 1

About outgoing calls, I have the following issue:

ERROR[256]: res_pjsip_outbound_authenticator_digest.c:128 digest_create_request_with_auth: Endpoint: 'trunk-sfr': Unable to find authenticate header in challenge.

Thanks in advance