Professional Documents
Culture Documents
Lab 2
Setup of Asterisk under FreeBSD
Introduction
This section introduces the open source package asterisk under FreeBSD and uses it to provide basic SIP
based telephony services. In this lab you will configure software based SIP phones to connect to an existing
asterisk server (rule26). You will then configure an asterisk server running on your own lower number rule
host and connect your SIP clients to it. You will then configure a SIP connection between your asterisk
server and the asterisk server running on rule26. By the end of this section you will be able to use a SIP
client to place calls that pass through both servers.
Methodology:
Part 1
1. What is asterisk? What can it do? What platforms does it run on?
2. An asterisk server has been configured on rule26.i4t.swin.edu.au. As in Figure 1, configure software SIP
phones on both of your lab PCs to use this server with
the user names “1RULExx” and “2RULExx”, both with
the password of “RULExx” (where xx is your rule host
SIP Client 1
number). RULE26
SIP Client 2
3. After configuration, dial extension 1000 on both
phones as a test. Explore the recorded messages and Figure 1
menu system. If you have a microphone, do the “echo”
(loop back) test.
Part 2
Now that you have explored the software SIP clients, you will configure an asterisk server on your rule
host, then reconfigure your SIP clients to authenticate to it instead (Figure 2).
4. All the asterisk configuration files are kept in
RULE26
/usr/local/etc/asterisk/. You may want to take a look at
some of these configuration files - but a full and
SIP Client 1
detailed knowledge of them will not be needed for this
lab. SIP Client 2 RULExx
5. The two files we will concentrate on in this lab will be Figure 2
extensions.conf and sip.conf. These configuration
files will be discussed in class.
[general]
port=5060 ; Port to bind to
context=default ; Default context for incoming calls
disallow=all ; Disallow all codecs
allow=gsm ; Allow codecs in order of preference
allow=ulaw
allow=alaw
[1RULExx]
canreinvite=no
type=friend
username=1RULExx
secret=RULExx
host=dynamic
nat=yes
[2RULExx]
canreinvite=no
type=friend
username=2RULExx
secret=RULExx
host=dynamic
nat=yes
exten => 111,1,Playback(demomoreinfo) ; Information message.
exten => 111,2,Playback(demothanks) ; "Thanks for trying the demo".
exten => 111,3,Hangup ; Hang up.
7. Start your asterisk server by typing asterisk at the command line - it will launch and go into the
background (sockstat and/or ps to confirm it's running). To connect to it and issue commands, type
asterisk -r.
To stop the asterisk server completely when in the asterisk console type core stop now. To exit the
asterisk console but keep asterisk going, type quit. What port numbers has asterisk bound to when it's
running? What services do these represent?
8. Test your asterisk server by configuring both your SIP clients to authenticate to it. Place a call between
the two software SIP phones (if you have a microphone or two, test audio connectivity). Dial 111 and
confirm you can hear the recorded message from both of your soft phone clients.
9. What do each of the lines in your sip.conf file and the extensions.conf file do?
[rule26]
type=friend
host=rule26.i4t.swin.edu.au
username=RULExx
fromuser=RULExx
secret=RULExx
nat=yes
exten => _0.,1,Dial(Sip/${EXTEN:1}@rule26)
12.Dial 01000, what do you hear? What are the asterisk servers doing here to route the call? (Keep
discussion to the application layer – ie. no need to go into SIP message exchange details.)
13.What do each of the new lines in the sip.conf file and the extensions.conf file do?
Part 4
14.Setup one of your SIP phones (“2RULExx”) to use rule26 again as shown in Figure 4.
15.The extensions.conf file on rule26.i4t.swin.edu.au has the following line included:
exten => _9xx.,1,Dial(Sip/2RULExx)
• Having home network connection problems (including VPN issues) is not considered an excuse for
late, or non-submission. Make sure that you setup and test your VPN access before relying on VPN
access to submit work.