Introduction to VoIP with Asterisk Labs

Topology Diagram

Netlab Asterisk Basic Topology

IP Addressing & Phone Extensions

These are the IP addresses and phone extension numbers assigned to your pod which you can use for your pod.

Pod Asterisk ens192 IP Pod Router Fa0/0 IP Phone Extension Range Classroom Switch Asterisk Port

Pod A

172.17.219.11/24

172.17.144.11/24

2100-2199

Gi1/0/31

Pod B

172.17.219.12/24

172.17.144.12/24

2200-2299

Gi1/0/32

Pod C

172.17.219.13/24

172.17.144.13/24

2300-2399

Gi1/0/33

Pod D

172.17.219.14/24

172.17.144.14/24

2400-2499

Gi1/0/34

Pod E

172.17.219.15/24

172.17.144.15/24

2500-2599

Gi1/0/35

Pod F

172.17.219.16/24

172.17.144.16/24

2600-2699

Gi1/0/36

Pod G

172.17.219.17/24

172.17.144.17/24

2700-2799

Gi1/0/37

Pod H

172.17.219.18/24

172.17.144.18/24

2800-2899

Gi1/0/38

Pod I

172.17.219.19/24

172.17.144.19/24

2900-2999

Gi1/0/39

Pod J

172.17.219.20/24

172.17.144.20/24

3000-3099

Gi1/0/40

Asterisk Server ens192 Interface:

The ens192 interface on your Asterisk server is used to connect with other pods, the Internet, and your SIP PSTN provider.
  • Default Gateway: 172.17.219.1

  • DNS Server: 172.17.139.11

Asterisk Server ens224 Interface:

The ens224 interface on your Asterisk server is used to connect with your IP phones on the same layer 2 network as the phones and without going through NAT which simplifies the configuration.
  • IP Address (same for all pods because it’s inside behind your NAT): 192.168.10.3/24

  • No default gateway or DNS servers for this interface

Pod Router:

  • Default Gateway: 172.17.144.1

  • DNS Server: 172.17.139.11

The XX99 extension will be used for future voicemail capability so that one should not be used for a regular phone/line.

Work you can do remotely

Important information to read

The VoIP labs in this class use a bit of an unusual network setup. In particular the Asterisk server has two NICs, one of which is connected directly out to the "Internet" outside of your company (ens192) and the other is connected inside your company directly to your pod switch (ens224). You would probably never use such as setup in real world applications and there would be additional security implications if you did. Normally, the Asterisk server would be fully behind your firewall/router and you would do port forwarding to make the ports needed for SIP signalling and RTP audio available from the outside. In the case of "hosted" or "cloud" PBX servers the entire server would be on the outside network. The unusal part we do is to have the server straddle the line with one outside and one inside interface.

Even with putting a VoIP server behind your firewall and opening only the required ports there are a lot of attempts at VoIP fraud online by hackers looking to take advantage of SIP ports open to the Internet so if you were do that you would need to use appropriate security features to blacklist IPs which are making failed connection attempts (attempted brute forcing SIP credentials) along with other precautions within your dialplan to prevent hopping through your PBX (and either impersonating your company or racking up charges.

The reason for this unusual network setup in our case is to simplify the amount of network configuration you need to do for this course. We are able to avoid dealing with NAT forwarding rules which are cumbersome on Cisco routers (and which do not allow just port forwarding). This also allows us to give you SSH and Filezilla access to your Asterisk server over the ITCnet VPN which makes transferring configuration files much easier when working on them remotely.

Install Debian Linux

  1. Start the Debian Linux non-graphical installer

  2. Choose the appropriate language, country, and keymap

  3. Set the hostname of the system to podX-asterisk where X is replaced by your pod ID letter.

  4. Set the domain name to podX.local where X is replaced by your pod ID letter.

  5. Set the root password to something you will not forget. It is suggested you write it down and/or use the password itc2300#voip

  6. Create a new user with a username of your choice and password of your choice which you will not forget. Write these down somewhere.

  7. Select the correct timezone

  8. Use guided partitioning entire disk with all files in one partition and write the changes to disk to begin the installation

  9. There is no extra installation media for you to scan

  10. Select the US Debian Archive mirror deb.debian.org from the list with no HTTP proxy

  11. Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.

  12. On the software selection screen unselect "Debian desktop environment" and "GNOME" and make sure that "SSH server" and "Standard system utilities" are the only two selected options.

    To select and unselect options move your cursor over the option and press the space bar do not press the enter key until after you have selected the correct options or you will move to the next screen and begin installing incorrect things. You will need to ask your instructor to reset your system and start over again if you do this.
  13. Choose Yes that you want to install GRUB on your primary drive which is /dev/sda.

  14. Choose Continue to reboot into your new installation of Debian

  15. Log in with the username root and password you set.

    If you are not continuing past this point be sure to safely shutdown your Linux server with the shutdown -h now command. Otherwise you can continue on but be sure to safely shutdown your system every time before your reservation ends or you may corrupt the data on your system and need to start over.

Install the Asterisk PBX Server and Other Software

  1. Log in to your Debian server with the username root and password you set if you are not already logged in.

  2. Update the package manager with the latest software lists on your Debian server by running apt update

  3. Install the sudo package with apt install sudo

  4. Add your user to the sudo group with a command like adduser YOURUSERNAMEHERE sudo

  5. Install the asterisk and tftpd-hpa packages in a similar manner to how you installed sudo.

  6. Download the chan-sccp plugin to your Debian system like wget https://info.ihitc.net/franske-courses/current/itc-2300/_attachments/chan-sccp_4.3.4-1_amd64.deb

    To save time and reduce complexity in our lab I have built this packaged version of the chan-sccp-b plugin which works with our Debian systems and version of Asterisk. The actual plugin and normal installation instructions are at https://github.com/chan-sccp/chan-sccp
  7. Install the gettext package which is required by chan-sccp

  8. Install chap-sccp with dpkg -i chan-sccp_4.3.4-1_amd64.deb

    The reason this package is installed with dpkg instead of with apt is that we have manually downloaded the package from an independent website instead of automatically downloading it from the official Debian repository we selected during the installation process. We need to do this because Debian does not have an official chan-sccp package.
  9. Edit the /etc/asterisk/modules.conf file and disable loading of chan_skinny.so and enable loading of chan_sccp.so

    Changes to which modules are loaded and not loaded need to be in the [modules] section of this file and not the [global] section
  10. Restart the Asterisk software to change the loaded modules. This can be done with the systemctl restart asterisk command.

  11. Set the IP address on your Debian server’s outside ens192 interface to the static address for your pod indicated in the table at the top of this lab. These changes should be made in your /etc/network/interfaces file.

  12. Set the IP address on your Debian server’s inside ens224 interface to the static address indicated at the top of this lab. Note that all pods use the same IP address on the inside interface and do not need a gateway or DNS server on this interface. These changes should be made in your /etc/network/interfaces file.

  13. Apply the new network addresses by rebooting your server then verify it is set correctly by using the ip address show command and ping google.com

  14. This is about all you can reasonably do from off campus. Be sure to safely shutdown your Linux server with the shutdown -h now command. Otherwise you can continue on but be sure to safely shutdown your system every time before your reservation ends or you may corrupt the data on your system and need to start over.

Work you need to do on campus

Network device configuration and testing connectivity

  1. In order to connect your IP phones to your Asterisk server you will need to setup a LAN with a router and switch.

  2. Use the sample switch and router configurations (need to be modified with correct IP addressing for your pod) to configure the router as a NAT device and DHCP server for your pod LAN.

  3. Connect port Fa0/0 on your pod router to an available port on the B144 ITCnet classroom switch.

  4. Connect for Fa0/1 on your pod router to port Gi1/0/24 on your pod switch.

  5. Connect for port Gi1/0/23 on your pod switch to the correct port on the classroom switch identified in the table at the top of the lab. This connection will make a layer 2 connection from your Asterisk server’s ens224 interface to your internal pod network (the 192.168.10.0/24 subnet).

  6. Sign in to a second PC in the classroom. After you have successfully signed in connect that PC to port Gi1/0/1 on your pod switch.

  7. Because of our NAT and DHCP setup on the router even after connecting to the pod LAN the second PC should still have working Internet access. It should also be able to now ping both the inside and outside IP addresses of your pod’s Asterisk server and access the server using PuTTY (SSH) and Filezilla (SCP).

    Of course, make sure that your Asterisk server is up and running!
    It’s strongly suggested you connect to and work on your Asterisk server over SSH from this point on instead of trying to use the Netlab console. Cut and paste support works in PuTTY which it does not in the Netlab console and can transfer files in and out of your server using Filezilla.

Asterisk confgiuration

  1. Create a file XMLDefault.cnf.xml on your lab PC following the template and instructions here and transfer it to the /srv/tftp/XMLDefault.cnf.xml location on your Asterisk server. The transfer can be done using the Filezilla software which will allow you to create and edit the file in Notepad on your lab PC first.

  2. Open the Asterisk console on your Debian system asterisk -rvvvvvc

  3. Connect two Cisco IP phones to ports Gi1/0/2 & Gi1/0/3 of your switch

  4. After the phones boot and attempt to connect to your Asterisk server (you should see notifications of this in your Asterisk console window) use the sccp show devices Asterisk CLI command to see a list of the phones.

    If one or more of your phones does not register it may be locked to a previous sever see the instructions for clearing Cisco IP phone security files
  5. Configure your two IP phones in the SCCP configuration file see the example sccp.conf file.

  6. Setup one line button on each phone with an extension number for your pod (xx01 and xx02) based on the chart at the beginning of this lab. Assign these lines to the default context.

    This requires putting a button line in for the phone device section as well as creating a line configuration section in the sccp.conf file.
It is suggested that you create fresh phone device sections and line sections in the sccp.conf file with only the required items instead of modifying the existing samples. Putting in more configuration than needed can cause things not to work or work in unexpected ways.
  1. Connect to the Asterisk CLI and issue the reload command

  2. Verify you can successfully place a call to extension 1000 from the phones. This is a pre-built demo extension.

  3. Modify your extensions.conf file to add the two phone extensions and allow calling between phones

  4. Test calling between phones

  5. Safely shutdown your Debian system, erase your switch/router configuration, and put away all equipment and cables. Be sure to note which phones you have so that next week you’ll be able to get the same two phones.


Document Build Time: 2024-10-30 23:55:41 UTC
Page Version: 2024.01
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License