Help translating sip conf to pjsip conf

Hi,

I’m upgrading my organization’s Asterisk server from 11 to 13, specifically to 13.13. I’ve never been an Asterisk guy but by some miracle I’ve been able to manage our Asterisk 11 server so far. Due to 11’s no support for 100rel, I need to upgrade to Asterisk 13. I just learned that chan_sip is deprecated and that now I need to use chan_pjsip. I’ having a hard time understanding pjsip’s configuration object format, which is causing me headaches trying to convert the config in sip.conf to pjsip.conf. Here is what I have so far:

sip.conf:

[ISP_Trunk]
type = peer
context = inbound-from-ISP
host = IPaddressX
disallow = all
allow = ulaw
canreinvite = yes
dtmfmode = auto
;dtmf = rfc2833
insecure = port,invite
t38pt_udptl = yes
transport = udp
outboundproxy = IPaddressX
qualify = yes

[My_Trunk]
context=My_Trunk_Context
type = peer
bindaddr = IPaddressY:5060
port = 5068
host = IPaddressZ
transport = tcp, udp
tcpenable = yes
disallow=all
allow = ulaw
dtmfmode = rfc2833
canreinvite=yes
nat=yes
qualify=5000
directmedia=no

pjsip.conf:

[UDP-Transport]
type = transport
protocol = udp
external_media_address = IPaddressX
external_signaling_address = IPaddressX
bind = IPaddressY

[TCP-Transport]
type =transport
protocol = tcp
bind = IPaddressY:5060

[ISP_Trunk]
type = endpoint
disallow = all
allow = ulaw
dtmf_mode = auto
context = inbound-from-ISP
100rel = yes
outbound_proxy = IPaddressX
t38_udptl = yes
t38_updtl_nat = yes
transport = UDP-Transport
aors = ISP_Trunk
connect_line_method = reinvite

[ISP_Trunk]
type = aor
contact = sip:IPaddressX
qualify_frequency = 30
outbound_proxy = IPaddressX

[My_Trunk]
type = endpoint
context = My_Trunk_Context
dtmf_mode = rfc4733
disallow = all
allow = ulaw
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
connect_line_method = reinvite
direct_media = no

[My_Trunk]
type = aor
contact = sip:IPaddressZ:5068
qualify_frequency = 30

If anyone can take a look over my configs and let me know if there is anything wrong or anything that I can improve, I would appreciate that greatly!

Asterisk’s wiki provide a very well documented link with the migration from SIP to PJSIP, also you can make use of a single object called ‘wizard’ that can be used to configure most common chan_pjsip scenarios.

https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip

https://wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard

chan_sip is deprecated but not removed. You can still use it in Asterisk 13.
What you can do is start using chan_sip in 13 and meanwhile learn pjsip and next time when you upgrade Asterisk go with chan_pjsip.

–Satish Barot

Does chan_sip have 100rel support on Asterisk 13? This is the main reason I’m upgrading to 13. If not then I’ll have to use chan_pjsip.

My mistake. I just missed that part from your original post.
I don’t think support for 100rel has been added in 13.

Do you know what is the pjsip.conf equivalent of canreinvite in sip.conf? is it connect_line_method?

I’ve looked online but can’t find any info on this.

chan_sip hasn’t had canreinvite for a long time, except for backward compatibility. It looks like pjsip uses the same name of this as chan_sip now does, but with an _ between the words.

canreinvite was renamed because it doesn’t affect things like connected line and session timers, even though they use re-INVITEs.

So the pjsip equivalent would be can_re_invite? I would put can_re_invite=yes in the endpoint object in pjsip?

I use canreinvite in sip.conf so unanswered calls can go to voicemail in my current VoIP setup.

The equivalent is direct_media. As for canreinvite being needed for going to voicemail… that doesn’t really make sense… it just controls direct media.

1 Like

Well, Asterisk is not actually my VoIP system, I use it more as a gateway between my VoIP system (Lync 2010) and my SIP trunk. And the only way to get voicemail working is with canreinvite.

In my sip.conf, I have the following config:

[Lync Trunk]
type = peer
.
.
.
canreinvite = yes
directmedia = no

If I may ask for your advice, how would you convert the above for pjsip.conf?

Well, those options are the same so the end result of that is directmedia=no wins as it came last, so the equivalent would be direct_media=no in pjsip.conf

1 Like

Thanks! I will try this and report back.

Hey jcolp, may I pick your brain again?

What would be the pjsip equivalent of “insecure = port, invite” on sip.conf?

There is no option on an endpoint for that. It is a separate configuration section[1] with an example on the wiki[2].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Configuration_res_pjsip_endpoint_identifier_ip
[2] https://wiki.asterisk.org/wiki/display/AST/res_pjsip+Configuration+Examples

1 Like

Most uses of insecure=port,invite are wrong!

You need to work our what you are really trying to achieve and code for that.

Even with chan_sip, the most common use (which should be just insecure=invite) is better handled by remotesecret. I don’t know if pjsip better matches the secret = insecure or the remotesecret solution to the problem.

insecure=invite was needed because of the lack, remotesecret. Cook book authors thought it safest (but not in a security sense) to use insecure=very, which is port and invite. insecure=very was deprecated, probably because people were failing to think what they really needed. Instead of thinking, the cook book authors just expanded it to port,invite!