How to: Configure Tel2 SIP trunk with Asterisk using PJSIP

Matthew Atkinson

Last Update 8 months ago

As a big supporter of open source projects, Tel2 supports connectivity to Asterisk using either the SIP or IAX2 protocol.


This guide is a sample configuration for connecting to Asterisk using PJSIP (pjsip.conf). For sample configurations for CHAN_SIP or IAX2, please see our configuration guides:



Below is a basic template/config of how to setup a SIP trunk/line using the PJSIP module in Asterisk based systems instead of the older chan_sip module.

Example 1

A SIP trunk on Tel2, including outbound registration using UDP protocol for SIP transport and a single phone number using ALAW as the VoIP Codec and 'from-external' as the incoming context. (Replace <yourphonenumber> with your phone number and <yourpassword> with your phone password).

pjsip.conf

;==============TRANSPORTS
[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0
;===============TRUNK
[tel2trunk]
type=registration
outbound_auth=tel2
server_uri=sip:phone.tel2.co.uk
client_uri=sip:<yourphonenumber>@phone.tel2.co.uk
retry_interval=60
[tel2trunk]
type=auth
auth_type=userpass
password=<yourpassword>
username=<yourphonenumber>
[tel2trunk]
type=aor
contact=sip:phone.tel2.co.uk:5060
[tel2trunk]
type=endpoint
context=from-external
disallow=all
allow=alaw
outbound_auth=tel2trunk
aors=tel2trunk
[tel2trunk]
type=identify
endpoint=tel2trunk
match=phone.tel2.co.uk

Example 2

A SIP trunk on Tel2, including outbound registration using TLS protocol for SIP transport and a single phone number using ALAW as the VoIP Codec and 'from-external' as the incoming context. (Replace <yourphonenumber> with your phone number and <yourpassword> with your phone password)

pjsip.conf

;==============TRANSPORTS
[simpletrans]
type=transport
protocol=tls
bind=0.0.0.0
;===============TRUNK
[tel2trunk]
type=registration
outbound_auth=tel2
server_uri=sip:phone.tel2.co.uk
client_uri=sip:<yourphonenumber>@phone.tel2.co.uk
retry_interval=60
[tel2trunk]
type=auth
auth_type=userpass
password=<yourpassword>
username=<yourphonenumber>
[tel2trunk]
type=aor
contact=sip:phone.tel2.co.uk:5061
[tel2trunk]
type=endpoint
context=from-external
disallow=all
allow=alaw
outbound_auth=herotrunk
aors=tel2trunk
[tel2trunk]
type=identify
endpoint=tel2trunk
match=phone.tel2.co.uk

Still need help? Message Us