Asterisk after migrate to PJSIP no ring and unavailable

I have an Asterisk server in one Amazon EC2 running in Ubuntu server LTS 16.04 and migrate to use PJSIP protocol, before I was using SIP and was working properly, now after migration the extention shows like connected but unavailable, the calls doesn’t ring with exception one extension.

I have 3 extensions created and only one rings and show as Available, the 3 extensions have the same settings.

6001 work, available and ring
6002 doesn’t work, unavailable and doesn’t ring
6003 doesn’t work, unavailable and doesn’t ring

ip-172-31-12-250*CLI> pjsip show endpoints

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri..........................> <Hash....> <Status> <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <criteria.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time.....>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
==========================================================================================

Endpoint:  6001/6001                                            Not in use    0 of inf
     InAuth:  auth6001/6001
        Aor:  6001                                               3
      Contact:  6001/sip:6001@187.181.178.208:7190;rinstan 50e720a05a Avail        49.936
  Transport:  simpletrans               udp      0      0  0.0.0.0:5060
   Identify:  6001/6001

 Endpoint:  6002/6002                                            Unavailable   0 of inf
     InAuth:  auth6002/6002
        Aor:  6002                                               3
      Contact:  6002/sip:6002@192.168.0.102:36912          919ea93bb6 Unavail       0.000
  Transport:  simpletrans               udp      0      0  0.0.0.0:5060
   Identify:  6002/6002

 Endpoint:  6003/6003                                            Unavailable   0 of inf
     InAuth:  auth6003/6003
        Aor:  6003                                               3
      Contact:  6003/sip:6003@192.168.0.103:5062           c29db4164e Unavail       0.000
  Transport:  simpletrans               udp      0      0  0.0.0.0:5060
   Identify:  6003/6003

Objects found: 3

Please provide the actual endpoint configuration for the other endpoints, as well as network information - are they remote and behind NAT? You should also provide SIP trace of the inbound registration and call attempt using “pjsip set logger on”.

settings of pjsip.conf

[global]
type=global
user_agent=Asterisk HML
regcontext=registerstate
max_initial_qualify_time=4
keep_alive_interval=30
disable_multi_domain=yes
default_from_user=asterisk
mwi_tps_queue_high=5000
mwi_tps_queue_low=-1

;===============TRANSPORT

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0
external_media_address=X.X.X.X
external_signaling_address=X.X.X.X
external_signaling_port=5060
local_net=192.168.0.0/255.255.255.0

;===============EXTENSION 6001

[6001]
type = endpoint
transport=simpletrans
context = basic
disallow = all
allow = ulaw
aors = 6001
auth = auth6001
direct_media = no
rtp_keepalive = 30
identify_by = username
callerid = Computador X-Lite <6001>

[6001]
type=identify
endpoint=6001

[6001]
type=contact
endpoint=6001
via_addr=
via_port=

[6001]
type = aor
contact=
max_contacts = 3
remove_existing=yes
qualify_frequency=150

[auth6001]
type=auth
auth_type=userpass
password=#*6001kjX
username=6001

;===============EXTENSION 6002

[6002]
type = endpoint
transport=simpletrans
context=basic
disallow=all
allow=ulaw
aors=6002
auth=auth6002
direct_media = no
rtp_keepalive = 30
identify_by = username
callerid = Celular Android <6002>

[6002]
type=identify
endpoint=6002

[6002]
type=contact
endpoint=6002
via_addr=
via_port=

[6002]
type = aor
contact=
max_contacts = 3
remove_existing=yes
qualify_frequency=150

[auth6002]
type=auth
auth_type=userpass
password=6002
username=6002

;===============EXTENSION 6003

[6003]
type = endpoint
transport=simpletrans
context=basic
disallow=all
allow=ulaw
aors=6003
auth=auth6003
direct_media = no
rtp_keepalive = 30
identify_by = username
callerid = GrandStream IP Telephone <6003>

[6003]
type=identify
endpoint=6003

[6003]
type=contact
endpoint=6003
via_addr=
via_port=

[6003]
type = aor
contact=
max_contacts = 3
remove_existing=yes
qualify_frequency=150

[auth6003]
type=auth
auth_type=userpass
password=6003
username=6003

Don’t create a “type = contact” in the configuration, and don’t set an empty “contact=” in the AOR. Your “type=identify” section also does nothing and can be removed.

ok jcolp, thanks.

I corrected its, but didn’t work yet… I put these parameter to check if it works, but no success and I leave there.

More any sugestion?

As I mentioned previously you need to provide an actual SIP trace and information about the network layout.

Yes, I have my cloud server and the extension is working behind a NAT, all extensions.

You have no NAT support enabled for the endpoints. They would need “rewrite_contact=yes” and “rtp_symmetric=yes”.

great, now worked in parts, the endpoints are available and ring, but the calls are without audio.

Then you’ll need to look at the signaling to see where media is being told to go, check any firewalls, look at “rtp set debug on”.

the range of rtp ports seted is from 10000 to 20000 and it is opened in my firewall, was working well with SIP.

bellow the trace with rtp debug on


  == Setting global variable 'SIPDOMAIN' to 'siphml.dns123.com'
    -- Executing [6001@basic:1] Dial("PJSIP/6002-0000000b", "PJSIP/6001,90,tT") in new stack
    -- Called PJSIP/6001
    -- PJSIP/6001-0000000c is ringing
    -- PJSIP/6001-0000000c answered PJSIP/6002-0000000b
    -- Channel PJSIP/6001-0000000c joined 'simple_bridge' basic-bridge <994e445b-95d1-4572-8025-f31b1360674b>
    -- Channel PJSIP/6002-0000000b joined 'simple_bridge' basic-bridge <994e445b-95d1-4572-8025-f31b1360674b>
Sent Comfort Noise RTP packet to 187.181.178.208:8345 (type 02, seq 008148, ts 000000, len 000001)
Sent Comfort Noise RTP packet to 192.168.0.102:29504 (type 02, seq 008454, ts 000000, len 000001)

Your Asterisk is not receiving RTP, so you need to look at the SIP side to see where it told the endpoints to send it. As well for future reference there’s documentation on the wiki[1] for this kind of stuff, including how to set up PJSIP if it is behind NAT and what to do when endpoints are behind NAT.

[1] https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip

Audio solved, just was missing the parameter media_address in the endpoints.

Thank you very much jcolp