Asterisk Issue with Inbound call and registration

Hello,

I am using asterisk 13 with OpenWRT. I am using Twilio as SIP provider.

When I start/restart asterisk, the inbound call does not work for initial registration, but it works fine after second registration. Outgoing works properly from the beginning.

In the different location, everything works fine since the starting/restarting of the asterisk.

When I contacted Twilio support, they told me that something is wrong with my firewall.

[ Note: I also tried the same setup with ONSIP (sip provider) and inbound & outbound works fine from the starting/restarting asterisk.(I do not have the issue with ONSIP at all). ]

Following are my setup files.

sip.conf

register => user@XXXX.twilio.com:abcde:authuser@XXXX.twilio.com:5060

[sipphone]
host=XXXX.twilio.com
secret=abcde
defaultuser=user
fromuser=user
fromdomain=XXXX.twilio.com
insecure=port,invite
type=peer
allow=gsm,ulaw,alaw,h263,h264
dtmfmode=rfc2833
trustrpid=yes
sendrpid=yes
context=incoming-context
alwaysauthreject=yes
mailbox=1001@vmset
tos_sip=cs3
tos_audio=ef

extensions.conf

[incoming-context]
exten => s,1,NoOp(inside context)
same => n,Wait(1)
same => n,Answer()
same => n,Dial(dahdi/1,20)
same => n,VoiceMail(1001@vmset)

exten => _X.,1,NoOp(dialing-remote)
same => n,Dial(SIP/+${EXTEN}@sipphone,20,r)

[Note: Since the first registration,‘sip show registry’ shows that it is registered.]

Can someone explain to me the reason for this issue and how can I solve the issue?

Thanks.

SIP trace is needed when the registration fail on the Asterisk side and also on the provider side tell you what is different on a sucessful and failed registration