This configuration is based on Asterisk 16 and the pjsip driver. As of writing this document, versions prior to 16 (except for 13 which has another year) are End of Life and not officially support by the Asterisk Community.
Please note: We do not support Asterisk and the below configuration is provided as-is.
pjsip.conf
[transport-swtrunk]
type=transport
protocol=udp
bind=0.0.0.0:5060
[swtrunk-reg]
type=registration
transport=transport-swtrunk
outbound_auth=swtrunk-auth
server_uri=sip:sip.voip123.co.uk
client_uri=sip:[TrunkUsername]@sip.voip123.co.uk
contact_user=trunk-[TrunkUsername]
expiration=300
[swtrunk-auth]
type=auth
auth_type=userpass
username=[TrunkUsername]
password=[TrunkPassword]
[swtrunk-aor]
type=aor
contact=sip:sip.voip123.co.uk
max_contacts=20
[swtrunk]
type=endpoint
allow=!all,ulaw,alaw
context=swtrunk-context
outbound_auth=swtrunk-auth
transport=transport-swtrunk
aors=swtrunk-aor
from_domain=sip.voip123.co.uk
[swtrunk-identify]
type=identify
endpoint=swtrunk
match=149.91.14.0/24
match=149.51.137.96/27
match=78.40.245.160/27
;Sample Extension
[2003]
type=endpoint
context=sw-trunk-outbound
allow=!all,ulaw,alaw
direct_media=no
dtmf_mode=rfc4733
auth=2003
aors=2003
[2003]
type=auth
auth_type=userpass
password=[ExtPassword]
username=2003
[2003]
type=aor
max_contacts=6
Extensions.conf
[sw-trunk-outbound]
;Outbound over Simwood Trunk
exten => _ZX.,1,NoOp(Outbound call via swtrunk from ${CALLERID(num)} to ${EXTEN:2})
same => n,Set(CALLERID(all)=[TrunkUsername])
same => n,Dial(PJSIP/${EXTEN}@swtrunk)
same => n,HangUp()
exten => _0ZX.,1,NoOp(Outbound call via swtrunk from ${CALLERID(num)} to ${EXTEN})
same => n,Set(CALLERID(num)=[TrunkUsername])
same => n,Dial(PJSIP/44${EXTEN:1}@swtrunk)
same => n,HangUp()
exten => _00ZX.,1,NoOp(Outbound call via swtrunk from ${CALLERID(num)} to ${EXTEN})
same => n,Set(CALLERID(num)=[TrunkUsername])
same => n,Dial(PJSIP/${EXTEN:2}@swtrunk)
same => n,HangUp()
[swtrunk-context]
;Inbound over Simwood Trunk
exten => trunk-[TrunkUsername],1,NoOp(Inbound [TrunkUsername] trunk)
same => n,goto(${PJSIP_HEADER(read,To):5:12},1)
same => n,Hangup()
exten => [CalleeNumber],1,NoOp()
same =>
Note: same => n,goto(${PJSIP_HEADER(read,To):5:12},1) will read the To number and go to that Exten within the dialplan.
Comments
0 comments
Article is closed for comments.