Installation Configuration Testing of Asterisk



Lab 2

Installation Configuration Testing of Asterisk

Running On Debian Linux in an Oracle VirtualBox Virtual Machine

Preliminary Discussion

As we have seen in another lab conventional PBXs are dedicated, standalone hardware devices running propriety operating systems. An alternative to these is to use an open source, software based PBX running on a computer. In this lab we will use the Asterisk soft PBX configured from the command line.

Startup

Make sure that the computer has an active connection to the network.

Launch the VirtualBox manager from the desktop of the DeVry lab computer.

The virtual machine that you installed in a the previous lab will probably NOT appear as an option in the manager due to the computers being reimaged each night. Recall, we coped these vitual machines to the E: drive or wherever else you put it. Now, we just need to reconnect to it.

Select New from the menu bar of the VirtualBox manager. Click the Next button from the opening window and when you arrive at the Create New Virtual Machine window, enter the name of the Linux installation that you created in a previous experiment. If you have forgotten what you named it, browse to the E: drive and locate the vch file. Make sure that you have selected the correct OS and Version as Linux and Debian. Click Next to continue the reconnection process. If you cannot locate your previous installation you will need to restore it from your flash drive backup.

[pic]

Take the defaults on the next screen about memory size and just click Next to continue.

When you get to the Virtual Hard Disk page click the Use existing hard disk radio button as seen below.

[pic]

Notice that there is a little folder icon on the right. Click on it and browse to your VM on drive E:

Highlight your VM file on drive E: and click Open. The file name should now appear on the Virtual Hard Disk page. Again, click Next to continue.

[pic]

Verify that the correct file name is listed on the Summary page and click Create to complete the reconnection process.

The VM should appear in the list of available virtual machines. Before we can begin we need to make sure that your VM is getting an address from the DHCP server.

Highlight your VM and scroll down to the Network heading on the right. If it says NAT we need to change it.

[pic]

Change it by clicking the Network heading and then clicking the drop down menu arrow and selecting bridged as seen below.

[pic]

Now you can start your virtual machine and continue.

When the Linux system comes up, login as the user, root with a password of password or whatever you made it during the Debian installation.

Enter the command ifconfig at the prompt. Study the screen output carefully. Do you have an active Ethernet interface with an assigned IP address? If so, you can skip to the installation section.

If you didn’t have an active Ethernet interface, enter the command ifconfig –a to identify all of the Ethernet interfaces in the computer whether they are active or not. Note the name of your Ethernet device. It will be something like ethx. The last character will be a number.

Now enter the command dhclient ethx. Substitute the number of your particular interface for the x in the example. This command should activate the specific IP address and have it retrieve an IP address from the network’s DHCP server.

Verify that the interface now has an IP address by entering the command ifconfig.

Installation

From the command prompt in Linux, enter the command apt-get install asterisk.

Your system should respond by telling you how much space will be needed by the new application and dependencies.

When prompted about continuing the installation process, enter Y to continue.

When presented with the ITU-T country code configuration, replace the suggested value with 01, as seen in the figure below.

[pic]

Click Ok to continue the installation process.

When the installation is complete you will be returned to the command prompt.

Launch Asterisk by entering asterisk -cvvv

To switch to the Asterisk console enter asterisk -r

The Asterisk system is ready to go if you can see this prompt:

CLI>

Have your instructor verify your installation. It should like similar to this.

[pic]

Basic Configuration

In this lab we will just do the minimal entries required to make calls.

First, change directories to the Asterisk directory by entering the command.

cd /etc/asterisk

We need to place entries into two files. The two files already exist and contain a large amount of information and some default configuration information that while interesting to read isn’t needed at the moment. To keep from losing the file contents we are going to copy these two files so we have still have the originals, and then create new ones.

Enter the following commands to copy the sip.conf file and allow us to work with a blank sip.conf

cp sip.conf sip.

mv sip.conf sip.conf.copy

Enter the following commands to copy the extensions.conf file and allow us to work with a blank extensions.conf

cp extensions.conf extensions.

mv extensions.conf extensions.conf.copy

From the /etc/asterisk directory prompt enter

nano sip.conf

and press Enter.

When the blank sip.conf file is on the screen, place the following entries in the file.

[general]

[1000]

type=friend

host=dynamic

context=default

secret=1000

[1001]

type=friend

host=dynamic

context=default

secret=1001

To save the file and exit nano, follow the instructions at the bottom of the screen. To save the file, hold down the CTRL key and press the O key. Once the file has been saved, you can exit the nano editor by pressing CTRL X. The extension numbers of the two phones in this example are 1000 and 1001.

Next, create the extensions.conf file using the same method. Here are the entries for that file.

[default]

exten=>100,1,Answer()

exten=>100,n,Playback(hello-world)

exten=>100,n,Hangup()

exten=>1000,1,Dial(SIP/1000,20)

exten=>1001,1,Dial(SIP/1001,20)

After you have completed the editing of the two files above, go back to the Asterisk prompt by holding down the Alt key and pressing F1 and then, from the Asterisk prompt, enter the command

service asterisk restart

Telephone Setup

Any type of compatible telephone can be used for this lab. There are two forms of SIP telephones, softphone and hardphone and softphone. . A softphone is a program that runs on a computer. Either one or both of these can be used. A hardphone is a physical device that looks like a standard telephone

Let’s look at both methods. First, the softphone and then the hardphone.

Softphone Setup

If softphones are used you may use anyone you wish. I have had the best results with the one from 3CX when running them in virtual machines. The commonly recommended X-Lite phone does not seem to get along well with virtual machines or Windows User Account control.

To do this create two new Windows 7 virtual machines by cloning one of the existing ones. To do this in the VirtualBox Manager highlight one of the Windows 7 virtual machines that already exists and click on the Machine link on the menu bar at the top of the screen and then select the Clone option by clicking on it.

Select the, Reinitialize MAC option and name it anything that you would like.

[pic]

Leave the default to create a Full Clone and click the Clone button.

[pic]

It will now create the clone. It takes a few minutes to create that clone.

The clone has been created on the primary hard drive and so will be deleted during the next initialization cycle. To keep the clone for the duration of the session we will need to move our clone to drive E: The first thing that we need to do is to locate the directory on the C: drive that contains the clone.

To discover where the clone files are located, highlight you newly created clone and select the Settings icon on the menu bar. Select Storage on the left side of the window and highlight the clone’s vdi file. Notice that the location of the file will be shown in the information block on the right. Note the file’s location. If you can’t read all of it expand the window to the right.

[pic]

Navigate to the directory that contains the files and then copy the folder with the same name as your clone to the E: drive.

[pic]

Once you have completed the copy process, you will need to remove the original clone and all of its associated files. To do this return to the VirtualBox manager and highlight the icon of your clone and click Settings menu item. From the drop down menu select Remove.

[pic]

Click on the Delete all files button.

[pic]

Close the VirtualBox manager.

Navigate to the new location of your clone’s file and double click on the vbox file. The VirtualBox manager will launch showing your clone at its new location.

Start the new Windows clone.

From within each clone go to here to download the phone.



Download it to each of the Windows 7 virtual machines.

Once it is downloaded, install it.

Once the phone is running a profile must be entered to enable it to register with the Asterisk server. By default when you first run 3CX it will require this. Click on Create Profile. Select New. This screen will appear. Use these settings for the first Windows 7 virtual machine. The **** is 1000 for this one and 1001 for the other one. The IP address is the IP address of the Asterisk virtual machine.

[pic]

And these for the second one.

[pic]

When one of the phones attempts to contact an extension, Asterisk will check the dialing plan to discover how to handle the call. The dialing plan is contained in the extensions.conf file. There are three defined extensions in the extensions.conf file. These are the only extensions that be contacted.

Watch the console of the Asterisk server for an indication that both of the telephones have registered.

Let's test the setup.

From the first softphone

Call 100. You should hear the playback of the voice file hello-world

Call 1000. It should ring on line 2 of this phone.

Call 1001. It should ring on the phone in the other virtual machine

From the second softphone

Call 100. You should hear the playback of the voice file hello-world

Call 1001. It should ring on line 2 of this phone.

Call 1000. It should ring on the phone in the other virtual machine

Hardphone Setup

Next, let’s use a hardohone. Here is how to setup the Grandstream GXP1405 telephones.

Each telephone is set by default to receive an IP address form a DHCP server. We setup such a server on the router. The IP addresses of the two phones should be

192.168.1.6

192.168.1.7

To enter the configuration for each telephone enter these addresses in a tab in a web browser, and then login using

admin

as the password.

The Status screen will appear.

[pic]

Click on the Accounts page. This screen will appear.

[pic]

Enter the following for the first telephone.

SIP Server: 192.168.1.1

SIP User ID: 1000

Authenticate ID: 1000

Authenticate Password: 100

Even though you just entered the Authenticate password and you are the administrator, the box will appear to be empty. It is not.

Scroll to the bottom of the screen and click Update and then Reboot.

The telephone will restart. Once it does so, it is ready for use.

Do the same thing for the second telephone using these settings.

SIP Server: 192.168.1.1

SIP User ID: 1001

Authenticate ID: 1001

Authenticate Password: 1001

[pic]

Since the Grandstream telephones are not on the approved list from 3CX for this PBX, on the Extension Status screen they will appear as Not Registered. This is not important as they will still work for what we need to do.

Connecting to an Outside Telephone Line

To call an outside telephone number, not just call between the two extensions, the computer running the Asterisk PBX will be connected to a router. In this case a Cisco 2911 router with a VIC2-2FXO interface card that connects to an analog telephone line of some type. This is a two part process.

Here is what the VIC2-2FXO interface card looks like installed in the router. This card goes in an EHWIC slot. It has two FXO ports, but only one will be used. These ports are pink in color. The board looks like this:

[pic]

[pic]

To configure the VIC2-2FXO use these commands after changing the MAC addresses to conform to the MAC addresses of the telephones being used. This example is for the Grandstream hardphones. If the 3CX softphones are used the MAC addresses must be changed/ Copy and paste these to Notepad, and then to the router.

enable

configure terminal

!Name the router

hostname VoiceRouter

!activate the interface for the voice traffic

interface gi0/0

ip address 192.168.1.1 255.255.255.0

no shutdown

!Setup DHCP for the telephones

ip dhcp excluded-address 192.168.1.1 192.168.1.5

ip dhcp pool Voice

network 192.168.1.0 255.255.255.0

option 150 ip 192.168.1.1

default-router 192.168.1.1

!Turn in the voice service

voice service voipallow-connections h323 to h323

allow-connections h323 to SIP

allow-connections SIP to SIP

sip

!Allow the telephones to register with the voice service

registrar server expires max 600 min 60

voice register global

!Turn on abd configure Callmanager Express

mode cme

source-address 192.168.1.1 port 5060

max-pool 10

max-dn 20

exit

!Define the telephones

voice register dn 1

number 1000

voice register dn 2

number 1001

exit

voice register pool 1

!This must be the MAC address of the telephone used

id mac 000B.823E.77BE

number 1 dn 1

username 1000 password 1000

codec g711ulaw

voice register pool 2

!This must be the MAC address of the telephone used

id mac 000B.823E.77C4

number 1 dn 2

username 1001 password 1001

codec g711ulaw

!Activate the VIC2-2FXO interface and link calls to extension 1000

voice-port 0/1/0

connection plar opx 1000

caller-id enable

!Setup calling out

dial-peer voice 1 pots

destination-pattern 9.T

port 0/1/0

!Setup calling in

dial-peer voice 2 voip

session target ipv4:192.168.1.134

end

The configuration shown above uses the MAC addresses of the two Grandstream GXP1405 telephones. If some other device is used, the MAC addresses must be changed before this configuration is copied to the router.

With the router configured and the telephones booted, we will know that the telephones have registered with the Callmanager as this will appear.

[pic]

Now that the router is ready we need to connect the analog port on the interface card to a PSTN POTS line. There are several ways to connect this interface card to the outside world so that calls can be made from the telephones to outside telephone numbers and to the telephones from outside lines.

The easiest method, if there is a standard analog PSTN type telephone landline connection available, is to connect the right RJ-11 port on the router’s voice card to the PSTN demarc using a standard RJ-11 cable.

If the building’s telephone system is an all VOIP system, arrange to have an analog line, such as for a fax machine, installed where the router will be.

If an analog line cannot be installed an ATA can be installed in between the router and a standard Ethernet LAN connection. As a network device with a MAC address the ATA can be assigned an IP address. The ATA will appear to the VOIP system as a VOIP telephone. The ATA will need to be registered with the VOIP system so that it can be assigned a telephone number just as is done with any VOIP telephone.

A VOIP service provider account can be created, and then the ATA used to connect to the Internet and then to the VOIP service provider.

The last method, which we will use here, is to insert a Bluetooth Cellular Gateway between the router and a cellular telephone. For example, an XLink BTTN can be used as seen below with the router in place of the telephone on the right.

[pic]

Here is the layout.

[pic]

In this type of connection attach the cellular gateway’s top RJ-11 port – DO NOT USE THE BOTTOM PORT AND DO NOT CONNECT THIS DEVICE TO AN ACTIVE PSTN ANALOG TELEPHONE DEMARC - to the right side voice port of the voice card in the router using a standard analog PSTN telephone cable. Power up the cellular gateway by connecting it to electrical power. There is no power switch. Pair the cellular gateway to a Bluetooth enabled cell phone by pressing the button with one dot beside it until the button begins to flash, then activate the Bluetooth pairing function on the cell phone. When the two devices find each other, complete the pairing as required by the cell phone. If the cell phone requires a pairing code use 0000.

Alter Asterisk

We need to add some entries to the sip.conf and extensions.conf files.

Make the sip.conf file look like this where the IP address shown as 192.168.1.1 is the address used for the Cisco router.

[general]

bindport=5060

bindaddr=192.168.1.1

context=out

[callsin]

context=in

type=friend

host=192.168.1.1

dtmfmode=rfc2833

insecure=port

[1000]

type=friend

host=dynamic

context=default

secret=1000

[1001]

type=friend

host=dynamic

context=default

secret=1001

The extensions.conf file should be changed to look like this:

[default]

exten=>100,1,Answer()

exten=>100,n,Playback(hello-world)

exten=>100,n,Hangup()

exten=>1000,1,Dial(SIP/1000,20)

exten=>1001,1,Dial(SIP/1001,20)

[out]

exten=>_NXXNXXXXXX,1,Dial(SIP/${EXTEN}@2911)

[callsin]

exten=>1000,1,Dial(SIP/192.168.1.134:5060,60)

Test the Configuration

Let's test the setup.

From the first telephone that has extension 1000

Call 100. You should hear the playback of the voice file hello-world

Call 1001. It should ring on the phone in the other virtual machine

From the second softphone that has extension 1001

Call 100. You should hear the playback of the voice file hello-world

Call 1000. It should ring on the phone in the other virtual machine

From the 1000 softphone call an outside line, such as someone’s cell phone.

End the Lab

To stop the Asterisk program enter the command

core stop gracefully

at the Asterisk prompt.

To shut down the Linux system, enter the command

init 0

or

shutdown now –h

or

poweroff

at the command prompt.

Move the virtual machines to the E: drive or copy all of these virtual machines to a USB drive or a computer you have control over.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches