Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Sign In

Login to our social questions & Answers Engine to ask questions answer people's questions & connect with other people.

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

You must login to add post.

PJSIP Configuration Examples

Below are some sample configurations to demonstrate various scenarios with complete pjsip.conf files. To see examples side by side with old chan_sip config head to Migrating from chan_sip to res_pjsip. Explanations of the config sections found in each example can be found in PJSIP Configuration Sections and Relationships.

A tutorial on secure and encrypted calling is located in the Secure Calling section of the wiki.

An endpoint with a single SIP phone with inbound registration to Asterisk

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

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0

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

[6001]
type=endpoint
context=internal
disallow=all
allow=ulaw
auth=auth6001
aors=6001

[auth6001]
type=auth
auth_type=userpass
password=6001
username=6001

[6001]
type=aor
max_contacts=1

  • auth= is used for the endpoint as opposed to outbound_auth= since we want to allow inbound registration for this endpoint
  • max_contacts= is set to something non-zero as we want to allow contacts to be created through registration

 

A SIP trunk to your service provider, including outbound registration

Trunks are a little tricky since many providers have unique requirements. Your final configuration may differ from what you see here.

;==============TRANSPORTS

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0

;===============TRUNK

[mytrunk]
type=registration
outbound_auth=mytrunk
server_uri=sip:sip.example.com
client_uri=sip:1234567890@sip.example.com
retry_interval=60

[mytrunk]
type=auth
auth_type=userpass
password=1234567890
username=1234567890

[mytrunk]
type=aor
contact=sip:sip.example.com:5060

[mytrunk]
type=endpoint
context=from-external
disallow=all
allow=ulaw
outbound_auth=mytrunk
aors=mytrunk

[mytrunk]
type=identify
endpoint=mytrunk
match=sip.example.com

  • “contact=sip:203.0.113.1:5060”, we don’t define the user portion statically since we’ll set that dynamically in dialplan when we call the Dial application.
    See the dialing examples in the section “Dialing using chan_pjsip” for more.
  • “outbound_auth=mytrunk”, we use “outbound_auth” instead of “auth” since the provider isn’t typically going to authenticate with us when calling, but we will probably
    have to authenticate when calling through them.
  • We use an identify object to map all traffic from the provider’s IP as traffic to that endpoint since the user portion of their From: header may vary with each call.
  • This example assumes that sip.example.com resolves to 203.0.113.1

Icon

You can specify the transport type by appending it to the server_uri and client_uri parameters. e.g.:

[mytrunk]
type=registration
outbound_auth=mytrunk
server_uri=sip:sip.example.com\;transport=tcp
client_uri=sip:[email protected]\;transport=tcp
retry_interval=60







admin

admin

Enlightened

I like to receive and deal with challenging tasks. I am a very enthusiastic person and I think this is a strong point of mine. My friends say that I am a very funny with a good sense of humor. As soon as I meet new people who are happy to meet me, I feel extremely comfortable with them.

Leave a comment

You must login to add a new comment.