Asterisk Configuration Examples
Examples of Asterisk Configurations
- http://asterisk.drunkcoder.com/ (A.K.A. 'asstricks') sample Asterisk config files, very simple - sends calls directly into voicemail, quite old (from 2002)
- http://www.loligo.com/asterisk/current/ quite complete setup with iax and sip, various SIP providers, call recording, access control (local, toll, free), emergency call and one analog FXO port
- http://www.sbuehl.com/projects/asterisk/ sample config with ISDN phones and SIPgate outbound, also some some AGI script examples
- Panasonic KSU integration. SOHO config with 2xFXS and 2xFXO plus VoicePulse and BroadVoice in-out. Least cost routing examples. Find me macro example. Seperate house-office IVR menus.
- A more complete example
- http://people.sysnetworks.net/apardo/asterisk/ Works for me in Spain with a TDM11B card to the PSTN.
- http://danielwebb.us/software/asterisk/ A fairly complete home system example
- http://odunix.org/pbx/ ODUnix Dialplan and NBLUG Open Document Presentation
- http://www.spanky-world.com/lab/asterisk/asterisk_lab_config_samples.html Japan based configuration, Confguration samples
- http://shells.homeunix.net/unicommAsterisk/ A simple Realtime example using MySQL
Asterisk
Dead links
- http://capi4linux.thepenguin.de/download/asterisk/config/ with German stuff, extension in database, advanced cause/error handling and enhanced access control (internal, local, national, international) for extensions
- http://www.wheely-bin.co.uk/asterisk/ UK based configuration, softhangup for emergency calls, an say-last-callerid function (1471), voice menu,
- http://www.fnords.org/~eric/asterisk/ sample zapata phone, fax, two access groups (local, toll) - This site has been closed. All the information, files, etc were donated to the Asterisk Documentation Project.
- http://www.sprackett.com/asterisk/ centered around an AGI script that does call-forwarding, DND; with call-recoding, various outbound contexts etc, time based call routing, call queue
- http://stageofbattle.org/asterisk.html Small office setup call queue's and multiple menu's.

Comments
333IAX Bridging
\to_iaxprovider\
type=peer
auth=md5
notransfer=yes
host=192.168.40.1
qualify=yes
trunk=yes
bootcampX
type=user
auth=md5
notransfer=yes
secret=secret
context=from_outside
Edit extensions.conf
features
exten => 4812,1,Dial(IAX2/bootcampX:secret@to_iaxprovider/2154)
333
local
exten => _NXXNXXXXXX,1,Set(CALLERID(num)=8005551212)
exten => _NXXNXXXXXX,n,Set(CALLERID(name)=Watson)
exten => _NXXNXXXXXX,n,Dial(SIP/to_sipprovider/${EXTEN})
include => users
333zapata.conf for 2 Lines (1 x FXS, 1 x FXO)
context=default
;configuration for T1 card (as PRI)
echocancel=yes
echocancelwhenbridgend=no
echotraining=yes
switchingtype=5ess
context=from_outside
signalling=pri_cpe
group=3
channel => 1-23
;configuration for E1 card (as PRI)
echocancel=yes
echocancelwhenbridgend=no
echotraining=yes
switchingtype=euroisdn
context=from_outside
signalling=pri_cpe
group=3
channel => 1-15
channel => 17-31
group=1
context=users
signalling=fxo_ks
callerid="AnalogUser_01" <6004>
mailbox="6004"
callwaiting=yes
threewaycalling=yes
transfer=yes
channel => 1
group=2
context=from_outside
signalling=fxs_ks
callerid=asreceived
callwaiting=no
channel => 4
333iax.conf example
bandwidth=low
disallow=lpc10
jitterbuffer=no
forcejitterbuffer=no
autokill=yes
;************************************************************
;** REGISTER STATEMENTS
register => bootcampX:bootcamp@192.168.101.1
to_iaxprovider
type=peer
auth=md5
notransfer=yes
host=192.168.101.1
disallow=all
allow=gsm
allow=ulaw
allow=alaw
qualify=yes
trunk=yes
bootcampX
type=user
auth=md5
notransfer=yes
disallow=all
allow=gsm
allow=ulaw
allow=alaw
trunk=yes
secret=bootcamp
context=from_outside
333queues.conf example
sales
musiconhold = default
announce = queue-sales
strategy = ringall
announce-holdtime = yes
member => Zap/g1
member => Agent/2001
support
musiconhold = default
announce = queue-support
strategy = leastrecent
announce-holdtime = yes
member => Zap/g1
member => Agent/2002
333sip.conf example
; ** GLOBAL SETTINGS FOR THE ASTERISK SIP CHANNEL v 1.4
general
context=from_outside
realm=ds.com
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
disallow=all
allow=ulaw
allow=gsm
language=de
trustrpid = yes
sendrpid = yes
;************************************************************
;** REGISTER STATEMENTS
register => bootcampX:bootcamp@192.168.101.1
;************************************************************
;** FRIENDS, USERS AND PEERS BELOW THIS LINE
to_sipprovider
type=peer
username=bootcampX
fromuser=bootcampX
fromdomain=bootcamp.com
secret=bootcamp
canreinvite=no
insecure=invite,port
host=192.168.101.1
deny=0.0.0.0/0
permit=192.168.101.1/255.255.255.255
disallow=all
allow=gsm
allow=ulaw
allow=alaw
qualify=yes
nat=no
User_xlite
type=friend
host=dynamic
secret=xlite
context=local
mailbox=6001@default
callerid="Tom Smith" <6001>
setvar=USERID=tom
setvar=USER=tom
User_polycom
type=friend
host=dynamic
secret=polycom
context=unlimited
mailbox=6002@default
callerid="Joe Jones" <6002>
setvar=USERID=joe
setvar=USER=joe
333
exten => 00888,1,AgentCallbackLogin(${CALLERIDNUM}|${CALLERIDNUM}@default)
exten => 00888,2,Hangup
;agent logout extension
exten => 00999,1,Dial(Local/00901/n,,D(#))
exten => 00901,1,AgentCallbackLogin(${CALLERIDNUM}|'#')
exten => 00901,2,Hangup
;test queue extension
exten => 777,1,Answer
exten => 777,2,Queue(agent1)
exten => 777,3,Hangup
333
general
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
priorityjumping=no
globals
TRUNK1=SIP/binfone
TRUNK2=IAX2/iaxprovider
TRUNK3=ZAP/g1
TRUNK4=IAX2/bootcamp
users
include => inside
include => features
include => parkedcalls
features
exten => 6500,1,Answer()
exten => 6500,n,VoiceMailMain(@default)
exten => 6599,1,Answer()
exten => 6599,2,Playback(hello-world)
exten => 6599,3,Hangup()
exten => 6598,1,Goto(demo-menu,s,1)
exten => 6600,1,Answer()
exten => 6600,n,Wait(0.5)
exten => 6600,n,Record(day_menu.gsm)
exten => 6600,n,Wait(1)
exten => 6600,n,Playback(day_menu)
exten => 6600,n,Hangup()
exten => 6601,1,Answer()
exten => 6601,n,Wait(0.5)
exten => 6601,n,Record(night_menu.gsm)
exten => 6601,n,Wait(1)
exten => 6601,n,Playback(night_menu)
exten => 6601,n,Hangup()
exten => 6700,1,Dial(SIP/sipprovider/6000)
exten => 6701,1,Dial(${TRUNK2}/6000,30,O)
exten => 6510,1,Meetme(Washington)
exten => 6511,1,Meetme(Jefferson)
exten => 6512,1,Meetme(Lincoln)
exten => 6520,1,Answer
exten => 6520,2,MusicOnhold()
exten => 6545,1,Answer()
exten => 6545,n,Wait(0.5)
exten => 6545,n,Set(SUM=0)
exten => 6545,n(getit),Noop(${SUM})
exten => 6545,n,Read(TMP,entering-conf-number,4,,2,4)
exten => 6545,n,GotoIf($ISNULL(${TMP})?false:true)
exten => 6545,n(false),Set(TMP=0)
exten => 6545,n(true),Set(SUM=$${SUM} + ${TMP})
exten => 6545,n,SayNumber(${SUM})
exten => 6545,n,Goto(getit)
exten => 8701,1,Answer()
exten => 8701,n,Wait(0.5)
exten => 8701,n,Set(DB(users/${USERID}/DND)=1)
exten => 8701,n,Playback(enabled)
exten => 8701,n,Hangup()
exten => 8702,1,Answer()
exten => 8702,n,Wait(0.5)
exten => 8702,n,Set(DB(users/${USERID}/DND)=0)
exten => 8702,n,Playback(disabled)
exten => 8702,n,Hangup()
exten => 8703,1,Answer()
exten => 8703,n,Wait(0.5)
exten => 8703,n,Set(DB(users/nzapata/DND)=1)
exten => 8703,n,Playback(enabled)
exten => 8703,n,Hangup()
exten => 8704,1,Answer()
exten => 8704,n,Wait(0.5)
exten => 8704,n,Set(DB(users/nzapata/DND)=0)
exten => 8704,n,Playback(disabled)
exten => 8704,n,Hangup()
exten => 6555,1,AgentLogin()
exten => 6556,1,AgentCallbackLogin(||@inside)
exten => 8551,1,Queue(sales)
exten => 8552,1,Queue(support)
exten => 6575,1,Answer()
exten => 6575,n,Wait(0.5)
exten => 6575,n,AGI(hello.sh)
exten => 6575,n,Hangup()
demo-menu
exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n,Background(press-1)
exten => s,n,Background(or)
exten => s,n,Background(press-2)
exten => s,n,WaitExten(3)
exten => 1,1,Playback(you-entered)
exten => 1,n,Playback(digits/1)
exten => 1,n,Goto(s,1)
exten => 2,1,Playback(you-entered)
exten => 2,n,Playback(digits/2)
exten => 2,n,Goto(s,1)
exten => h,1,Noop(Shucks, they hung up!)
exten => t,1,Playback(too-low)
exten => t,n,Hangup()
exten => i,1,Playback(pbx-invalid)
exten => i,n,Hangup()
day_menu
exten => s,1,Answer()
exten => s,n,Set(TRIES=0)
exten => s,n,Wait(1)
exten => s,n(playback),Background(day_menu)
exten => s,n,WaitExten(5)
exten => 1,1,Goto(users,6001,1)
exten => 2,1,Goto(users,6002,1)
exten => 3,1,MeetMe(Washington)
exten => 3,n,Hangup()
exten => 9,1,Directory(default,users,e)
exten => *,1,Goto(s,1)
exten => h,1,NoOp(Shucks, they hung up!)
exten => i,1,Playback(im-sorry)
exten => i,n,Set(TRIES=$${TRIES}+1)
exten => i,n,GotoIf($${TRIES} > 2?t,disconnect)
exten => i,n,Goto(s,playback)
exten => t,1,Playback(im-sorry)
exten => t,n,Set(TRIES=$${TRIES}+1)
exten => t,n,GotoIf($${TRIES} > 2?t,disconnect)
exten => t,n,Goto(s,playback)
exten => t,n(disconnect),Playback(goodbye)
exten => t,n,Hangup()
night_menu
exten => s,1,Answer()
exten => s,n,Wait(0.5)
exten => s,n,Playback(night_menu)
exten => s,n,Directory(default,users,e)
inside
exten => 6001,1,Macro(stduser,SIP/zoiper,nzoiper)
exten => 6002,1,Macro(stduser,SIP/polycom1,npolycom)
exten => 6003,1,Macro(stduser,ZAP/1,nzapata)
macro-stduser
exten => s,1,NoOP(Standar User call To ${MACRO_EXTEN} ON ${ARG1})
exten => s,n,GotoIf($"${DB(users/${ARG2}/DND}" = "1"?UNAVAIL)
exten => s,n,Dial(${ARG1},5)
exten => s,n,NoOp(${DIALSTATUS})
exten => s,n,GotoIf($"${DIALSTATUS}" = "NOANSWER"?UNAVAIL)
exten => s,n,GotoIf($"${DIALSTATUS}" = "CHANUNAVAIL"?UNAVAIL)
exten => s,n,GotoIf($"${DIALSTATUS}" = "CONGESTION"?UNAVAIL)
exten => s,n,GotoIf($"${DIALSTATUS}" = "CANCEL"?HANGUP)
exten => s,n,GotoIf($"${DIALSTATUS}" = "BUSY"?BUSY)
exten => s,n,Goto(CONGEST)
exten => s,n(UNAVAIL),Answer()
exten => s,n,Wait(0.5)
exten => s,n,Voicemail(${MACRO_EXTEN}@default,u)
exten => s,n,Hangup()
exten => s,n(BUSY),Answer()
exten => s,n,Wait(0.5)
exten => s,n,Voicemail(${MACRO_EXTEN}@default,b)
exten => s,n,Hangup()
exten => s,n(CONGEST),Answer()
exten => s,n,Wait(0.5)
exten => s,n,Congestion()
exten => s,n(HANGUP),Hangup()
local
exten => _9NXXXXXX,1,Set(CALLERID(num)=8005551212)
exten => _9NXXXXXX,n,Set(CALLERID(name)=MY COMPANY)
exten => _9NXXXXXX,n,Dial(${TRUNK4}/${EXTEN})
exten => _NXXNXXXXXX,1,Set(CALLERID(num)=8005551212)
exten => _NXXNXXXXXX,n,Set(CALLERID(name)=MY COMPANY)
exten => _NXXNXXXXXX,n,Dial(${TRUNK2}/${EXTEN})
exten => _1800NXXXXXX,1,Dial(${TRUNK3}/${EXTEN})
exten => _1888NXXXXXX,1,Dial(${TRUNK3}/${EXTEN})
exten => _1877NXXXXXX,1,Dial(${TRUNK3}/${EXTEN})
exten => _1866NXXXXXX,1,Dial(${TRUNK3}/${EXTEN})
include => users
longdistance
exten => _1900NXXXXXX,1,Congestion()
exten => _1NXXNXXXXXX,1,Set(CALLERID(num)=8005551212)
exten => _1NXXNXXXXXX,n,Set(CALLERID(name)=MY COMPANY)
exten => _1NXXNXXXXXX,n,Dial(${TRUNK3}/${EXTEN})
include => local
international
exten => _011.,1,Set(CALLERID(num)=8005551212)
exten => _011.,n,Set(CALLERID(name)=MY ASTERISK)
exten => _011.,n,Dial(${TRUNK2}/${EXTEN})
exten => _9011.,1,Dial(${TRUNK1}/${EXTEN:1})
include => longdistance
from_outside
exten => 8005550511,1,GotoIfTime(9:00-17:00|mon-fri|*|*?day_menu,s,1)
exten => 8005550511,n,Goto(night_menu,s,1)
exten => 8005550512,1,Meetme(5001)
exten => 8005550513,1,Directory(default)
exten => 8005550514,1,Queue(sales)
exten => 8005550515,1,Queue(support)
exten => 7473056000,1,GotoIfTime(9:00-17:00|mon-fri|*|*?day_menu,s,1)
exten => 7473056000,n,Goto(night_menu,s,1)
exten => 7473056001,1,Macro(stduser,SIP/zoiper,nzoiper)
exten => 7473056002,1,Macro(stduser,SIP/polycom1,npolycom)
exten => 7473056003,1,Macro(stduser,ZAP/1,nzapata)
exten => 7473056004,1,VoiceMailMain(@default)
include => inside
unknown
exten => _X.,1,GotoIfTime(9:00-17:00|mon-fri|*|*?day_menu,s,1)
exten => _X.,n,Goto(night_menu,s,1)
unlimited
switch => IAX2/bootcamp5:bootcamp@192.168.1.1/unlimited
switch => ZAP/g0/unlimited
include => international
services
exten => s,1,Dial(Zap/1,50)