Asterisk Notes

From ITCwiki
Jump to navigation Jump to search

What is Asterisk?

Astrerisk is free open source software that works as a call processor that can be customized. It provides support for cards like T1 - it acts like a gateway, or you can employ a service (server to act as the card or gateway) It has become much better over the last five years and has been aroud for 7 or 8 but was no very stable in beginning. You will find it built into most open source services. Many small businesses use asterisk, it is built into other products, often the engine is asterisk. You can get asterisk to work on windows but it is not designed for that. It was designed for Linux but runs on different operating systems like Mac OS X, Solaris, NetBSD, OpenBSD, FreeBSD and a for Microsoft Windows there is a port known as AsteriskWin32. The 7900 series of cisco phones work well with asterisk.

Here are some add-ons and things you can do with Asterisk:

•Drivers for various VoIP protocols.
•Drivers for PSTN interface cards and devices.
•Routing and call handling for incoming calls.
•Outbound call generation and routing.
•Media management functions (record, play, generate tone, etc.).
•Call detail recording for accounting and billing.
•Transcoding (conversion from one media format to another).
•Protocol conversion (conversion from one protocol to another).
•Database integration for accessing information on relational databases.
•Web services integration for accessing data using standard internet protocols.
•LDAP integration for accessing corporate directory systems.
•Single and mult-party call bridging.
•Call recording and monitoring functions.
•Integrated "Dialplan" scripting language for call processing.
•External call management in any programming or scripting language through Asterisk Gateway Interface (AGI)
•Event notification and CTI integration via the Asterisk Manager Interface (AMI).
•Speech synthesis (aka "text-to-speech") in various languages and dialects using third party engines.
•Speech recognition in various languages using third party recognition engines.

How to downlaod and update Asterisk

We will be using Oracle's VirtualBox to download Asterisk to. You will need to create a storage space on your D drive and make a new folder with your name and semester "Name-FA11" then close.

Open up VirtualBox settings and under general in the default box find the folder you just made and click ok. Your information will now be saved there.

Create a new virtual machine by clicking on new machine under OS click on Linux, click next, under RAM use 768 , click next, create new hard disk, click next, VDI, next, Dynammically allocated, next location Astersiks server, default, next, then click create. You should now see that your VM has been created.

You will now nee to change the settings under the network by simply clicking on Network and under network click on adapter and on attatched and change to bridged.

    • Next under storage CD/DVD Drive: click icon beside arrow change to choose a virtual disk CNT files under Linux then Ubuntu 10.10. asterisk tty1

You will get a couple of warnings, click on through them. Under language choose your language (English is the only one Franske will have support for) US, enter, under keyboard click no, enter, enter, it will the start to load. Under hostname use Asterisk, enter, yes, enter, enter, under partition move to yes click continue. Make changes to disks move to yes, continue. The base system will now be installed. enter your name in lowercase, password cisco, cisco again yes, no for encrypting and down arrow for no http proxy continue and it will continue installing choose no automatic updates. Under software selection leave them all blank by using tab key to tab through to select continue after installation select yes to install bootloader. Finish by clicking on devices and click on CD/DVD and make sure there is no check mark beside ubuntu. then click continue

Type your name and password that you entered You are not automatically the administrator to become the admin you have to enter: sudo bash You will see a # to confirm that you are now admin. We will now edit a file by typing:

nano /etc/apt/sources.list 

(nano is the text editor and etc is the file) Click control W US. archive.ubuntu.com Under replace with: enter mirror .rit.edu then repeat control w and change security.ubuntu.com with the mirror.RIT.edu Update by typing aptitude update, enter aptitude full-upgrade, enter, click enter for yes and update starts. After update it will say Current Staus: 0 updates [-94] We will the type:

aptitude install asterisk atfpd dhcp3-server 

enter 001 for USA country code and click continue If there are errors (and ther will be) type:

aptitude update
enter
install aptitude update
enter

to restart type:

shutdown -r now

and try reinstalling if there are still errors, you will need to log back in and refollow steps to update

We should be able to program settings for 7960 phone

nano sip.com
nano extensions.com

gateway buy VOIP service from service provider on internet

   connects over network to provider with actual gateway
   install on linux  (install linux, then install asterisk
   Cisco 7960 phones popular with asterisk


Step by Step Settings for Virtual Box

create folder on D drive with username, semester, and year update default folder in virtualbox general

   virtualbox settings -- general
   New
       asterisk server
       linux
       ubuntu
       768 MB ram
       Create new hard disk
       VDI (default)
       Dynamically allocated
       8 GB is enough for virtual disk
       Confirm that drive is installed in expected folder
       Create
       Create
   Change Network Setting   (click on Network)
       Attached to:  Bridged Adapter
       (connects virtual machine directly to network card of computer)
   ubuntu server file is already on system
   Click on Storage
       click on IDE Controller / Empty
       click on disk on far right side (next ot IDE Secondary Master)
           Choose Virtual CD Disk File
           D:\\CNT Files\Linux Install CDs\
               ubuntu-10.10-server-i386.iso
   Click Start to start the virtual machine
       OK through warning about keyboard capture
       OK through virtual colors
       OK through audio problems
       English
   Enter
   Install Ubuntu Server
       OK through mouse pointer
       OK through color
   Enter through English
   Enter through United States
   no for detect keyboard
   USA
   Standard USA keyboard
   hostname   asterisk
   America/Chicago time zone
   Guided  - use entire disk adn set up LVM
   Select Disk -- SCSI3
   select YES
   use default, 8.3 GB
   YES - Write changes to disk
       lower corner of screen will show activity to hard disk, CD, 
           and other devices.
   Create User Accounts
       Full Name
       username   
       password:  cisco
              cisco
       Yes -- accept weak password
       NO  -- do not encrypt home directory
       empty -- no http proxy
   NO automatic updates
   Software to Install
       Leave blank
       TAB to reach Continue button
           the distribution is Oct 2010
           current Oct2011 server edition is the same
           
   Yes -- install GRUB boot loader to master boot record

Remove virtual CD before

   Pull down Devices to --> CD/DVD Devices

Login using name and password that we specified

become administrator

   sudo bash 
   cisco
   nano /etc/apt/soruces.list
   ctrl-w
   ctrl-r
   search for us.archive.ubuntu.com
   replace with mirror.rit.edu
       In vi this is :1,$s/us.archive.ubuntu.com/mirror.rit.edu/g
       14 lines are changed
   search for security.ubuntu.com
   replace with mirror.rit.edu
       :1,$s/security.ubuntu.com/mirror.rit.edu/g
       6 lines change
   ctrl-o
   enter
   ctrl-x  to exit


Upgrade Ubuntu OS

The problem with the asterisk install was the age of the operating system. The fix is to upgrade the Ubuntu OS to a later version that is compatible with the current asterisk distribution.

The upgrade process includes the following. 1. login 2. become root via the command

   sudo bash

3. Edit the file, /etc/apt/sources.list. Change the phrase, maverick, to the phrase, nantty, on every line.

   The vi command phrase is :1,$s/maverick/nantty/g

4. Update via the command

   aptitude update

5. Install the upgrade via the command

   aptitude full-upgrade
     Accept this solution:   Answer Y to every prompt
     Click OK for the openbsd-inetd cron atd upgrade
     Click OK for the cron atd upgrade

Login w/: sudo bash Finished updating with replacing the maverick file with natty and updated again

Aptitude update
Aptitude full-upgrade

At the Configuring libc6 screen: enter, enter After updating type in:

asterisk
cd/etc/asterisk
ls

We then will go to the file tftp file editor

nano /etc/default/atftpd 

A file should come up with [Read 2 lines] if not update tftp

aptitude install atftpd

add to the beginnng:

--daemon --port69

Add to the end:

/tftpboot
mkdir  /tftpboot
;------------------------------------------------------------------------------
; Settings  for Phone 1 Line 1
;
[phone1line1]
type=friend
context=local_pod
calleride=”Phone 1 Line 1 <5001>
host=dynamic
dtmfmode=rfc2833
secret=phone1line1
mailbox=5001
disallow=all
allow=ulaw
allow=alaw
nano /etc/dhcp3/dhcp/.conf

(if your are missing the dhcp server do an update: aptitude install dhcp3-server)

DHCP for IP Phones
subnet  172.16.(use your cp # for this 3rd octet) .0 netmask 255.255.255.0 {
option routers 172.16.99.1;
option cisco-etherboot-server 172.16.99.1;
option tftp-server-name “172.16.99.1” ;
authoritative
range 172.16.99.50 172.16.99.254;
}

Exit and save by cntrl O cntrl X

‘’eth0”

Exit and save (CntrlO cntrlW)

nano /etc/network/interfaces
iface eth0 inet dhcp
iface eth0 inet static
	address  172.16.8.1
	netmask 255.255.255.0

Exit & save

ifconfig
ifdown eth0
ifup eth0
ifconfig
ping 172.16.99.1

(ping will keep on until you enter cntrl c)

cd /tftpboot/
OS79XX.txt

Then import file for OS79xx.txt or type in the config file.

shutdown  -h now


2011 12 05

  • ! exclamation marks = enter
  • nano = edit

Unhook ethernet & login

cd/tftpboot
tftpboot#wget ftp://10.1.11.36/tftpboot/*
ls    (to show listing)
etc/network/interfaces
cp/etc/dhcp3/dhcpd.conf /etc/dhcpd.conf    (to copy config file from dhcpd3 to dhcpd)


Once your plugged back in and have pc and phone plugged into a poe switch


ifup eth0
ifconfig

Use the following command to see what is happening in real time and control c to get back

tail -f /var/log/syslog
cntrl c
/etc/init.d/isc-dhcp-server start

If you encounter any errors with your configuration file you can edit it by going to:

nano /etc/dhcp/dhcpd.conf
tail /var/log/syslog   (To show tail end of the log


Anytime you need to make a change on the phone you will need to unplug and go through the start up process again

/etc/default/atftpd
/etc/inetd.conf


Go to the line that starts with tftp go to end of line that and change /srvtftp to tftpboot


ps aux | grep tftp
/etc/init.d/openbsd-inetd restart 
ps aux | grep tftp


If the srv is still up you have kill the line


nano XMLDefault.cnf.xml    (for editing)

Phone will "Phone Unprovisioned" when it is requesting configuration

cd/tftpboot
tail/var/syslog

make a copy of the SIPmacaddress.cnf

cp SIPmacaddress.cnf SIP(insert mac address here)
nano /etc/asterisk/sip.conf

Edit file:

[phone2line1]
type=friend
context=local_pod
callerid="phone2line1" <5002>
host=dynamic
dtmfmode=rfc2833
nano SIP(insert mac address here and use all capital letters).cnf
nano SIPDCefault.cnf

Change the proxy addresses to your computer address Unplug phone and let configuration files reload and reconnect with the following command

asterisk -rcvvvvvvvvvvvvv
sip show peers
cp SIPmacaddress.cnf

Edit file by changing phone1 to phone2 on all instances:

"phone2line1"
"phone 2"

Unplug phone and plug back in, after you make changes in asterisk you need it to reread the configuration

asterisk -rcvvvvvvvvvvvvv
reload
sip show peers   (to show neighbors) 


Setting up Dial Plan

Now we need to set up a dial plan that allows the phones to communicate A key file is called extensions.conf where all kinds of config files are stored, one of the files is called [demo] which we will try to get to work.

nano /etc/asterisk/extensions.conf
[local_pod]
exten => 5001,1,Dial(SIP/phone1line1)
exten => 5002,1,Dial(SIP/phone2line1)
asterisk -rcvvvvvvvvvvvvv
reload

Now can pick up phone and check for dialtone

nano /etc/asterisk/extensions.conf

[demo] to ring a "dummy" line

exten =>6001,1,Goto(Demo,s,1)

You can create another extension and change the caller id by going back to the exten file and entering commands:

exten =>6001,1,Doto(demo,s,1)
exten =>6002,


Setting up Voicemail

For a quick install guide follow the bottom link:

voice-info.com
http://fonality.com/trixbox/wiki/trixbox-quick-install-guide