Section 1 Flashcards
How do you setup asterisk?

What are the standard asterisk ports?
Standard SIP Port: UDP 5060
Standard Media Port Range: UDP 10000-20000
IAX2 Standard Port: UDP 4569
What the typical layout of a asterisk based infrastructure?

Where do you create phone extensions?
sip.conf
How can you create a phone extension?
[extension]
type=friend
secret=[password]
disallow=all
allow=alaw
host=dynamic
context=[extension-context]
qualify=yes

Where do you create extension contexts?
extensions.conf
What does sip reload do?
reloads the sip.conf file
How do you reload all configuration files?
reload
Where do you create voicemails?
voicemail.conf
How do you create a simple voicemail?
[exten] => [password],[name],[email]
e.g.
[internal-vm]
101 => 123456,John Doe,john-email@gmail.com
Then add in sip.conf:
mailbox=101@internal-vm

How do you set a dialplan to go to a voicemail?
exten => 1,1,Answer
exten => 1,n,NoOp(This-is-a-sample-context)
exten => 1,n,Voicemail(101@internal-vm)
exten => 1,n,Hangup()
How do you set a dialplan to dial a number?
exten => 101,1,Answer
exten => 101,n,NoOp(internal-phone-call)
exten => 101,n,Dial([protocol]/[trunk]/[number], [call-time], [options]);
exten => 101,n,Hangup()
Note: You can exclude a trunk if it is an internal call
Why after the following dial plan does the call not go to voicemail after answer?
exten => 101,1,Answer
exten => 101,n,NoOp(internal-phone-call)
exten => 101,n,Dial(SIP/101,12,r);
exten => 101,n,Hangup()
Because the ‘g’ option was not specified, without the ‘g’ option, when an answered call is hungup the dial plan execution wont continue
What are the default standard extensions?
- s: Start. Used primarily for dialplans that enter a context with no other extension information. Think of a non DID phone line, call comes in, and we may only know that the line is ringing and nothing else. Even if you knew callerid, you have to still have a place to start. You can also think about s as a place to place part of the dialplan that you don’t want callers to get back to unless they have passed through other functions.
- t: Timeout. Used for when calls have been inactive after a prompt was played. Also used to hang up a line that has been idle.
- T: AbsoluteTimeout. Used for calls that have been hung up due to an AbsoluteTimeout() being reached. For example useful to play a notification with Playback().
- h: Hangup. Used to clean up a call. Could be used to play a goodbye message before hanging up. Also seemingly used by the calling card people to record end of call for billing purposes. h won’t run if the call is parked. More…
- i: Used when dialling an unknown extension in a context or unknown input in an IVR menu
Why do you need to register with a SIP trunk?
You need to register so that the trunk provider knows where to route calls to when an inbound call comes in
Where do you place register strings?
In the general context within sip.conf
What does the underscore mean in an asterisk dialplan?
It tell asterisk that the extension contains pattern matching characters
e.g.
_1XX will match 101, 102, 103, 115 etc…
Note: Extension dial plan with literal values will be given priority over pattern matching ones
What is the ${EXTEN} variable?
It is the value of the extension that was dialed
What is the difference between the type user, friend and peer?
- peer: A SIP entity to which Asterisk sends calls (a SIP provider for example). If you want a user (extension) to have multiple phones, define an extension that calls two SIP peers. The peer authenticates at registration.
- user: A SIP entity which places calls through Asterisk (A phone which can place calls only). Users authenticate to reach services with their context.
- friend: An entity which is both a user and a peer. This make sense for most desk handsets and other devices. Asterisk will create two objects, one peer and one user, with the same name.
What are the asterisk pattern matching characters?
- X matches any digit from 0-9
- Z matches any digit from 1-9
- N matches any digit from 2-9
- [1237-9] matches any digit or letter in the brackets
- [a-z] matches any lower case letter
- [A-Z] matches any UPPER case letter
- . wildcard, matches one or more characters
- ! wildcard, matches zero or more characters immediately
What are the different config files?

What is FastAGI?
Technically speaking, FastAGI is different in the following context: when Asterisk executes an AGI script via FastAGI, the resources required for the AGI script to run are consumed by a completely different process, and not Asterisk. In addition, the communications that were previously based on internal STDIN/STDOUT communications are now based on a TCP socket. This means that your AGI script, now actually an AGI server, can be operated and maintained on a completely different server, enabling you to separate the application logic from the Asterisk dialplan logic.
How do you see all AGI commands?
‘agi show’
What are blocking applications?
Blocking applications include the following: Dial, MeetMe, MusicOnHold, Playback (when dealing with long playbacks), Monitor, ChanSpy, and other applications that have an unknown execution duration.
What is an AGI script?
An AGI script is an external script that asterisk executes to perform an atomic operation, this could be checking if a number should be called, doing something based on the status of a call etc….
An AGI script should terminate as fast as possible and return back to asterisk, this is due to performance, e.g. if asterisk handles hundreds of calls and each call invoking an external script, then the longer the scripts are running the more resources are being used
AGI is analogous to CGI in Apache. AGI provides an interface between the Asterisk dialplan and an external program that wants to manipulate a channel in the dialplan. In general, the interface is synchronous - actions taken on a channel from an AGI block and do not return until the action is completed.
What is AMI?
Asterisk Manager Interface provides a mechanism to control where channels execute in the dialplan. Unlike AGI, AMI is an asynchronous, event driven interface. For the most part, AMI does not provide mechanisms to control channel execution - rather, it provides information about the state of the channels and controls about where the channels are executing.
What is ARI?
While AMI is good at call control and AGI is good at allowing a remote process to execute dialplan applications, neither of these APIs was designed to let a developer build their own custom communications application. ARI is an asynchronous API that allows developers to build communications applications by exposing the raw primitive objects in Asterisk - channels, bridges, endpoints, media, etc. - through an intuitive REST interface. The state of the objects being controlled by the user are conveyed via JSON events over a WebSocket.
ARI consists of three different pieces that are - for all intents and purposes - interrelated and used together. They are:
- A RESTful interface that a client uses to control resources in Asterisk.
- A WebSocket that conveys events in JSON about the resources in Asterisk to the client.
- The Stasis dialplan application that hands over control of a channel from Asterisk to the client.
“ARI is not about telling a channel to execute the VoiceMail dialplan application or redirecting a channel in the dialplan to VoiceMail.
It is about letting you build your own VoiceMail application.”
What is the Statis application?
It is used in conjuction with ARI, it starts an external ARI application which is used to create a telephony based application based on an organisations needs
Where do you configure queues?
In queues.conf
What is state hinting?
It allows a device to tell asterisk what state it is in, this is useful in queue scenarios, where you don’t want to call a member of a queue if they are in a call
Extension state is the state of an Asterisk extension, as opposed to the direct state of a device or a user.
Where is state hinting defined?
It is defined in sip.conf and the ‘hint’ priority is used
You need to also set ‘callcounter=yes’ on an asterisk device to enable state hinting for that particular device
