Sip and pjsip configuration issue?


#1

Hello,

I am using the Asterisk 13. I have configured pjsip.conf to have all the information of the sip server. I have not changed anything in the sip.conf.

Example config files:
sip.conf

[general]
context=incoming-analog
videosupport=yes
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
qualify=5000
alwaysauthreject=yes	; for the script kiddies attack
tos_sip=cs3
tos_audio=ef
icesupport=yes
dtmfmode=rfc2833
rfc2833compensate=yes
relaxdtmf=yes

pjsip.conf:

[global]
type=global
keep_alive_interval=20
endpoint_identifier_order=username,ip,anonymous

[simple]
type=transport
protocol=udp
bind=0.0.0.0
tos=cs7
cos=7

[simpletrans]
type=transport
protocol=tcp
bind=0.0.0.0:5060
tos=cs7
cos=7
local_net=192.168.2.0/24
external_media_address=71.225.187.142
external_signaling_address=71.225.187.142

[user12]
type=registration
outbound_auth=user12
outbound_proxy=sip:AAAAAAAAA.com\;transport=tcp
transport=simpletrans
line=yes
retry_interval=60
endpoint=user12
expiration=600
max_retries=240
server_uri=sip:AAAAAAAAA.com\;transport=tcp
client_uri=sip:user12@AAAAAAAAA.com\;transport=tcp

[user12]
type=auth
auth_type=userpass
password=helloabcdworld
username=user12

[user12]
type=aor
remove_existing=yes
contact=sip:AAAAAAAAA.com\;transport=tcp

[user12]
type=endpoint
tos_audio=cs7
cos_audio=7
direct_media=no
force_rport=yes
allow_subscribe=yes
context=line1
rewrite_contact=yes
transport=simpletrans
mailboxes=999@vm_setup
disallow=all
allow=ulaw,h263,h264
from_user=user12
from_domain=AAAAAAAAA.com\;transport=tcp
aors=user12
outbound_auth=user12

[8883]
type=endpoint
transport=simple
allow_subscribe=yes
context=sla_stations
disallow=all
tos_audio=cs7
cos_audio=7
rewrite_contact=yes
dtmf_mode=rfc4733
allow=ulaw,h263,h264
mailboxes=999@vm_setup
auth=8883
aors=8883

[8883]
type=auth
auth_type=userpass
password=password8883
username=8883

[8883]
type=aor
max_contacts=2

The setup is behind the NAT and not sure if the above files are configured properly for the NAT. The customer is encountering call-drops so that is the main issue we are trying to solve.

My questions are:

  1. Any settings in the sip.conf(related to NAT) will affect my VoIP system even though I only configured the pjsip.conf and I want to use only the pjsip.conf?
  2. If I configure Nat settings in the sip.conf, will it help in call dropping issue even though I am using pjsip.conf?

#2

I think sip.conf configuration will only affect devices using chan_sip.so , and also why just dont disble the chan_sip.so from your module configuration,

Also on the endpoint section this fix my nat issues

direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes ; necessary if endpoint does not know/register public ip:p

Also if you read the sample configuration file you will see an example for transport under nat
UDP transport behind NAT
;
;[transport-udp-nat]
;type=transport
;protocol=udp
;bind=0.0.0.0
;local_net=192.0.2.0/24
;external_media_address=203.0.113.1
;external_signaling_address=203.0.113.


#3

Hi @neondal_for_voip1

Of course, settings in sip.conf affect only endpoints using chan_sip, whereas settings in chan_pjsip affect only endpoints using chan_pjsip.
However, your configuration files are conflicting with each other: both tell their channel drivers to listen on UDP/5060, but which one is actually taking it?
As you are using PJSIP, I suggest temporarily unloading “old” SIP:
module unload chan_sip


#4

Regarding NAT itself, it depends on whether it has opeartional SIP ALG or not.
If “yes”, you should NOT manually provide external addresses in pjsip.conf - ALG will discover them.
If “no”, you SHOULD provide them as shown in the example:

external_media_address=203.0.113.1
external_signaling_address=203.0.113.1

#5

Thanks guys for the reply.

@ambiorixg12 ,

  • I have all the settings related to the NAT as you mentioned in the comments other than “rtp_symmetric=yes”. Can you explain what is the use of that?
  • Also, currently I am using the TCP as you can see from my file, should I switch to the UDP? I was using the UDP but was having issue with incoming calls so switched to TCP and it helped solving that problem.

@Pentium-5
What is SIP ALG? If I am unloading the SIP channel (Chan_sip) and going to use the pjsip channel only, should I add the external addresses or not? Note: currently we add the external addresses to all the customer.


#6

“rtp_symmetric=yes , this option enforce that RTP must be symmetric


#7

ALG stands for “Application Layer Gateway”. This feature can be enabled on a network equipment (more specifically, on a device doing NAT) to translate IP addresses inside IP packets (i.e. in SIP and SDP messages) along with translating IP headers from private to public addresses and backwards.


#8

The normal advice on SIP-ALG is that most implementations are broken, and it is better to disable it in the router.


#9

…except for Cisco where this feature is implemented correctly.


#10

Thanks guys for the information and reply.