You are on page 1of 4

Swinburne University of Technology

Faculty of Science, Engineering and Technology

TNE40001/TNE80003 Broadband Multimedia Networks

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.

Version v20210319 Last updated: Mar 19, 2021 by Q.K. Le Page 1 of 4


6. Configure an extension for each SIP account - one on extension xx1 (“1RULExx”) the other on extension
xx2 (“2RULExx”).
Delete everything from your extensions.conf and sip.conf files and add the following:
Your sip.conf should look something like this:

[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

Your extensions.conf should look something like this:


[default]
exten => xx1,1,Dial(Sip/1RULExx) ; When we get the extension xx1 call "1RULExx"
exten => xx2,1,Dial(Sip/2RULExx) ; When we get the extension xx2 call "2RULExx"

exten => 111,1,Playback(demo­moreinfo) ; Information message.
exten => 111,2,Playback(demo­thanks) ; "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?

Version v20210319 Last updated: Mar 19, 2021 by Q.K. Le Page 2 of 4


Part 3
You will now set up your asterisk server to SIP Client 1 RULExx RULE26
authenticate to the asterisk server at rule26 so calls
can traverse through your server and on to rule26
SIP Client 2
(Figure 3). Figure 3

10.Add the following to your sip.conf file (changes discussed in class):

[rule26]
type=friend
host=rule26.i4t.swin.edu.au
username=RULExx
fromuser=RULExx
secret=RULExx
nat=yes

11.Add the following to your extensions.conf file (changes discussed in class):

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)

16.Armed with this information, ring SIP client 2 from SIP


client 1. What were the numbers you dialed? What does
SIP Client 1 RULExx RULE26
the “_9xx.” mean in the line above? What is happening
here? (Again - keep discussion to the application layer) SIP Client 2
17.To make your asterisk server start at startup, add the Figure 4
line asterisk_enable="YES" to the bottom of the file
/etc/rc.conf

Version v20210319 Last updated: Mar 19, 2021 by Q.K. Le Page 3 of 4


Lab Report:
A short lab report describing what you achieved, how you achieved it and answering the questions
posed, is required to be uploaded to Canvas via TurnItin. The report should be no more than 3 pages
long. See Canvas for the report's template, it is compulsory to use this template. The report MUST be
submitted as a Portable Document Format (.pdf) document. Failure to meet these requirements will
result in a loss of marks.

Please be aware of Swinburne's plagiarism policies and procedures.

Deadline: Refer to Swinburne Canvas (https://swinburne.instructure.com/).

Failure to hand in labs:

• 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.

• Email/paper submission of labs will not be accepted.

Version v20210319 Last updated: Mar 19, 2021 by Q.K. Le Page 4 of 4

You might also like