[SOLVED] Digium vs Yealink registration endpoint pjsip NAT

Hi all,

I have a pbx Asterisk 13 with pjsip in the cloud. I can register endpoint like soft phone (X-Lite) and desk phone like Digium and Yealink. The problem is that Yealink cannot receive calls.
If I try to call from yealink to digium all goes ok in other direction from digium to yealink not work.
I think that is a problem of nat and I see that two phones have a different registration string in the pbx.

This is registration of digium that work well

Endpoint:  7003                                                 Not in use    0 of inf
 InAuth:  7003/7003
    Aor:  7003                                               1
  Contact:  7003/sip:7003@78.40.202.35:5060;transport=UDP;o  Avail              80.241
Transport:  transport-udp             udp      0      0  156.54.209.20:5060

This is registration of Yealink that not work

Endpoint:  7002                                                 Not in use    0 of inf
 InAuth:  7002/7002
    Aor:  7002                                               1
  Contact:  7002/sip:7002@192.168.50.105:5062                Unavail             0.000
Transport:  transport-udp             udp      0      0  156.54.209.20:5060

The pjsip configuration are the same but digium is in state Avail and Yealink Unavail and I don’t understand why.
Thanks a lot.

What is the endpoint configuration in pjsip.conf for both devices? Is rewrite_contact set to yes for 7002?

Yes the conf is the same:

[7002]
type=endpoint
transport=transport-udp 
context=inside
disallow=all
allow=ulaw,alaw
auth=7002
aors=7002
direct_media=no
rtp_symmetric=yes
force_rport=yes

[7002]
type=auth
auth_type=userpass  
password=7002
username=7002

[7002]
type=aor 
default_expiration=3600
maximum_expiration=7200
minimum_expiration=60
max_contacts=1
remove_existing=yes
qualify_frequency=100

The rewrite_contact option should be set to yes in the endpoint, without that it will attempt to contact the device using its local LAN IP which will be unreachable.

Perfect I configure parameter rewrite_contact in the endpoint section and after a reboot I can call yealink phone.

Thanks