Here is some of the settings for use to Australia Phone Company.

But with a few changes can be used with other providers

Please note, these settings are for Asterisk use only but some settings may need to change depending on the version used, it was tested on a Asterisk 16.X.X box, also these settings are for chan_sip not pj_sip

 

Please Note: Things like EXTNO, EXTPASS & what is used in context=XXX, DID are to be changed on a server bases.

Also Note: this setup is for there 5 sip trunk system, this means EXTNO is one account only but has up to 5 DID lines.

sip.conf

[general]
register => EXTNO:This email address is being protected from spambots. You need JavaScript enabled to view it.:5060/EXTNO

[EXTNO]
type=peer
insecure=invite
;insecure=no
qualify=yes
sendrpid=yes
dtmfmode=rfc2833
host=sip.australianphone.com.au
username=EXTNO
fromuser=EXTNO
fromdomain=sip.australianphone.com.au
secret=EXTPASS
disallow=all
allow=alaw,ulaw,g729,gsm
port=5060
qualify=4000
faxdetect=yes
context=ausphone

 

extensions.conf

[incoming]
exten => EXTNO,1,Goto(ausphone,s,1)
exten => DID,1,Goto(ausphone-DID1,s,1)
exten => DID2,1,Goto(ausphone-DID2,s,1)
exten => DID3,1,Goto(ausphone-DID3,s,1)
exten => DID4,1,Goto(ausphone-DID4,s,1)
exten => DID5,1,Goto(ausphone-DID5,s,1)


[ausphone]
exten => DID,1,Goto(ausphone-DID1,s,1)
exten => DID2,1,Goto(ausphone-DID2,s,1)
exten => DID3,1,Goto(ausphone-DID3,s,1)
exten => DID4,1,Goto(ausphone-DID4,s,1)
exten => DID5,1,Goto(ausphone-DID5,s,1)
exten => EXTNO,1,Goto(ausphone-DID,s,1)
exten => t,1,Goto(ausphone-DID,s,1)

[ausphone-DID1]
exten => s,1,Wait(2)
exten => s,2,Dial(SIP/1,60)
exten => s,3,Hangup

[ausphone-DID2]
exten => s,1,Wait(2)
exten => s,2,Dial(SIP/2,60)
exten => s,3,Hangup

[ausphone-DID3]
exten => s,1,Wait(2)
exten => s,2,Dial(SIP/3,60)
exten => s,3,Hangup

[ausphone-DID4]
exten => s,1,Wait(2)
exten => s,2,Dial(SIP/4,60)
exten => s,3,Hangup

[ausphone-DID4]
exten => s,1,Wait(2)
exten => s,2,Dial(SIP/5,60)
exten => s,3,Hangup

[calls-out]
;     eg. 0290000000
;     STD n Mobile Calls out via there DID only
exten => _0XXXXXXXXX,1,Set(Var_FROM=${SIP_HEADER(From)})
exten => _0XXXXXXXXX,2,Set(Var_FROM=${CUT(Var_FROM,@,1)})
exten => _0XXXXXXXXX,3,Set(Var_FROM=${CUT(Var_FROM,<,2)})
exten => _0XXXXXXXXX,4,Set(Var_FROM=${CUT(Var_FROM,:,2)})
exten => _0XXXXXXXXX,5,GotoIf($["${Var_FROM}" = "1"]?dial1)
exten => _0XXXXXXXXX,6,GotoIf($["${Var_FROM}" = "2"]?dial2)
exten => _0XXXXXXXXX,7,GotoIf($["${Var_FROM}" = "3"]?dial3)
exten => _0XXXXXXXXX,8,GotoIf($["${Var_FROM}" = "4"]?dial4)
exten => _0XXXXXXXXX,9,GotoIf($["${Var_FROM}" = "5"]?dial5)
exten => _0XXXXXXXXX,10,Macro(LineOut1,${EXTEN},${EXTEN})
exten => _0XXXXXXXXX,n(dial1),Macro(LineOut1,${EXTEN},${EXTEN})
exten => _0XXXXXXXXX,n(dial2),Macro(LineOut2,${EXTEN},${EXTEN})
exten => _0XXXXXXXXX,n(dial3),Macro(LineOut3,${EXTEN},${EXTEN})
exten => _0XXXXXXXXX,n(dial4),Macro(LineOut4,${EXTEN},${EXTEN})


[macro-LineOut1]
exten => s,1,Set(CALLERID(all)=ME DID <did1>)
exten => s,1,Dial(SIP/EXTNO/${ARG1},60,r)

[macro-LineOut2]
exten => s,1,Set(CALLERID(all)=ME DID2 <did2>)
exten => s,1,Dial(SIP/EXTNO/${ARG1},60,r)

[macro-LineOut3]
exten => s,1,Set(CALLERID(all)=ME DID3 <did3>)
exten => s,1,Dial(SIP/EXTNO/${ARG1},60,r)

[macro-LineOut4]
exten => s,1,Set(CALLERID(all)=ME DID4 <did4>)
exten => s,1,Dial(SIP/EXTNO/${ARG1},60,r)

[macro-LineOut5]
exten => s,1,Set(CALLERID(all)=ME DID5 <did5>)
exten => s,1,Dial(SIP/EXTNO/${ARG1},60,r)