Skip to content

Instantly share code, notes, and snippets.

@jwoertink
Created October 28, 2014 15:17
Show Gist options
  • Save jwoertink/9841f5ae6f5181fb1f03 to your computer and use it in GitHub Desktop.
Save jwoertink/9841f5ae6f5181fb1f03 to your computer and use it in GitHub Desktop.
Asterisk Notes
# find dependencies
asterisk/contrib/scripts/install_prereq
# dialplan examples
exten => some_ext,priority,application
same => n(label),application
same => n,Goto(label) ;comments
n = next
s = start
i = invalid
t = timeout
e = error
h = hangup
[aa_menu]
exten => s,1,Answer()
exten => s,n(menu_beginning),Background(main-menu)
exten => s,n,WaitExten(5)
exten => s,n,Hangup()
exten => 1,1,Queue(sales)
exten => 2,1,Queue(support)
exten => 3,1,Directory()
exten => 0,1,Dial(SIP/phone-2) ; the operator
exten => i,1,,Playback(invalid)
exten => i,n,Goto(s,menu_beginning)
exten => t,1,Playback(vm-sorry)
exten => t,n,Goto(s,menu_beginning)
include => phones
[samples]
exten => 1000,1,Set(Number=0) ;set a variable
same => n,SayNumber(${Number})
same => n,Hangup()
IVR = interactive voice response
auto attendant = give menu options and direct to extensions or play submenus.
sound files in /var/lib/asterisk/sounds/en
CLI> `core show application SomeFunction` for docs on that function
function names are always in all caps.
${FUNCTION(argument)}
pattern matches begin with underscore
_X. ;match 1 or more digits. The dot is wildcard
${EXTEN:1} ; the colon is for substrings. The one is the index of the string
Set(i=${MATH(5+5, float)})
NoOp(i) ; prints out 10.000
$[expression]
exten => 1234,1,Set(count=$[2+3])
exten => 1234,n,Set(count=$[${count} + 1])
can use ternary operator
GotoIf($[${thing}]?true:false)
${IF($["${DIALSTATUS}" = "BUSY"])}
Conf Templates
[webrtc](!)
type=friend
context=default
[1060](webrtc)
username=1060
secret=password
core show hints (for phone presence)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment