Enabling rtp_symmetiric for chan_pjsip "anonymous" endpoint

Hi community,

We use guest mode as we’d like to be able to receive anonymous calls (I realize that this may not be safe).

  • Calling side is behind NAT
  • FreePBX is behind NAT as well

FreePBX (chan_pjsip) sends the media to private IP of the calling side, so there is no RTP. So, I believe rtp_symmetric is not enabled out-of-the-box.

anonymous section in pjsip.endpoint.conf looks like this:

[anonymous]
type=endpoint
context=from-sip-external
allow=all

As I understand it, it is not recommended to change this file (even if you change it reverts back to its original configuration).

So, we added the following to pjsip.endpoint_custom.conf thinking that it could be overriden with user input:

[anonymous]
type=endpoint
context=from-sip-external
disallow=all
allow=opus,ulaw,alaw,g722,g729,g726,h264
rtp_symmetric=yes

However, FreePBX returns 401 Unathorized to incoming INVITE, somehow rejects anonymous calls.

Then we tried adding the parameters below pjsip.endpoint_custom.conf thinking that I could somehow be amended:

[anonymous]
disallow=all
allow=opus,ulaw,alaw,g722,g729,g726,h264
rtp_symmetric=yes

In this case,

  • INVITE with SDP (fast start): no RTP (rtp_symmetric is not really enabled)
  • INVITE without SDP (slowstart): FreePBX sends 200 OK without SDP offer, and then terminates the call with BYE.
  • FreePBX version: FPBX-15.0.17.67(16.17.0)

I’d appreciate any guidance on how to set this parameter properly via GUI or CLI or editing some files.

As I understand it Asterisk can do it by letting you edit just the pjsip.conf file; however the way FreePBX handles configuration is so much different (I am new to it). I could not figure out how to do it.

To make changes to pjsip endpoints using conf files in FreePBX, you use the the file pjsip.endpoint_custom_post.conf and this format:

[anonymous](+type=endpoint)
rtp_symmetric=yes

You can confirm your edits after an Asterisk reload:

# asterisk -x " pjsip show endpoint anonymous"  | grep rtp_symmetric
 rtp_symmetric                      : false
# asterisk -x " pjsip show endpoint anonymous"  | grep rtp_symmetric
 rtp_symmetric                      : true

It worked like a charm. Thanks very much. I would have never figured this out.

1 Like

You do understand that anonymous in this case isnt anonymous callerid it means Asterisk will accept requests from ANY SOURCE IP which means you will have a ton of unknown IPs sending requests into the PBX.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.