asterisk

Asterisk

Asterisk PBX in a software takes dedication to get working at a level comparable to professional PBX systems. here are some tips.

You want to avoid QOS (Quality Of Service) issues due to hardware processing and line connections, hissing, delays, weird sounds, noise and echo. Go the extra mile to ensure because VoIP is highly dependent on bandwidth.

  • 1000Mbps NICs
  • 1000Mbps Switches
  • Category 6 Cabling
  • Dedicated Internet Connection
  • Router QOS

VoIP Needs Power. Unlike the digital and analogue handsets the VOIP handset needs to be plugged into a power outlet.

  • POE Adapter for handsets (bypass requirements for powerpoint)
  • UPS

One must determine capacity to hardware requirements for the enterprise and load test the final server to ensure no issues with the operation due to exceeding capacity. Asterisk is resource intensive and FPU intensive, hardware performance & performance tuning is important and may resolve capacity related quality issues. Very large implementations may require several systems linked using Dundi protocol. Well performed concurrent DSP tasks requires a fast FPU and motherboards chipsets should not have issues with IRQ latencies. Multi-core CPUs are better and external NICs are better in case of fault. Priority is raised for asterisk and lowered for all other processes. Building redundancy into the system to improve and even fail-safe the setup including redundant power supplies and UPS as well as power-conditioned UPS and grounding systems to 0v.

Purpose                                Number of channels Minimum recommended
--------------------------------------------------------------------------------------
Hobby system                           No more than 5     400 MHz x86, 256 MB RAM
SOHO system (small office/home office— 5 to 10            1 GHz x86, 512 MB RAM
less than three lines and five sets)
Small business system                  Up to 25           3 GHz x86, 1 GB RAM
Medium to large system                 More than 25       Dual CPUs, possibly also multiple servers in a 
                                                          distributed architecture. Dedicate one unit to 
                                                          call processing, one to voice mail etc using 
                                                          Dundi protocol.

* Use SSD instead of hard-drive better CPU utilization,

In this day and age you will VOIP. Using Asterisk for analogue, digital conversion with defunct cards is a non solution. PSTN hardware includes analog Interface cards, digital Interface cards + BRI ISN Cards, Channel Bank for interfacing digital to analog, VOIP Gateway to PSTN.

*Important Note: All interface cards require echo cancellation module but software based echo cancellation is available

*Note: ztdummy kernel module is required for music on hold and conferencing, software based hardware timing source (no sure if this still the case)

* For fax machines you need an extra adapter. Analog Terminal Adapter. At the time of this writing faxing via Asterisk had issues, determine a solution based on email to fax, fax to email via a scanner or get a fax that is known to work without issue.

All SIP or IAX based phones work with Asterisk and depending on VOIP Service Provider will offer SIP and IAX, IP Phones, Soft Phones & possibly a telephone adapters to convert signal such as for use with fax machines.

Handset comparable to pty system requires some work, Something like the Thomson ST 20 or 30 at $100 per handset or the Astra 57 i at $300 per handset, call quality, system wide B.L.F, flexible keys and DSS consoles for reception. Softphones are software handsets and can be generally found online these turn your PC into a more central telephony station, incorperated with a good quality headset for that call centre experience, and they even come with wireless via an wearable earpiece liberates an employee from the desk. Asterisk can call, hold, transfer, park, forward, snoop, record. With professional programming Asterisk has the ppotential to including Day Night Lunch Mode. Music On Hold. Voice Mail. Automated attendant and Hotel Call Accounting.

Command Line

X-Windows and Asterisk do not mix dues to CPU time, and you will simply use the distribution that allows for the easiest installation, OpenBSD and other distribution have a one command setup.

Perhaps Require:

  1. Asterisk
  2. Zaptel Drivers - ztdummy
  3. PIR libraris -libpri - analog and digital devices not required for voip
  4. Core Sound & Extra Sound packages
for i in *.tar.gz; do tar zxvf $i; done

Create The Asterisk User

It is not a very good idea to run Asterisk as root so we'll create a non-privileged user and run under it.

echo “asterisk:x:104:104:Asterisk PBX daemon,,,:/var/lib/asterisk:/bin/false” » /etc/passwd echo “asterisk:x:104:” » /etc/group

Now edit /etc/init.d/asterisk and uncomment:

#AST_USER=“asterisk” #AST_GROUP=“asterisk”

Since the asterisk user can't write to /var/run (and we don't want it to) we'll create a place for it's process id file. Edit /etc/asterisk/asterisk.conf and change:

astrundir => /var/run

to:

astrundir => /var/run/asterisk

Create the new directory and change the owner to the asterisk users:

mkdir /var/run/asterisk && chown asterisk:asterisk /var/run/asterisk

We also have to fix the file ownship on the rest of the places the asterisk user needs to write to:

chown -R asterisk:asterisk /var/log/asterisk
chown -R asterisk:asterisk /var/spool/asterisk
chown -R asterisk:asterisk /var/lib/asterisk/
chown -R asterisk:asterisk /dev/zap/pseudo

You'll also need to add asterisk to the audio group:

adduser asterisk audio

You can now fire it up and see if all is well.

asterisk -U asterisk -G asterisk -cvv

Configuring Asterisk

asterisk -vc  - run asterisk foreground verbose & console vvv more verbose
asertisk      - run background
asterisk -r   - connect to running asterisk remote
?             - lists commands
<command> ? or help <command> or help  - extended help
quit         - detach from background asterisk without stopping it
stop now - stops asterisk
sip show users  - what asterisk knows about its extensions
sip reload   - just reload sip.conf
reload       - re-read all teh configuration files
restart when conveinant  - restarts the system when no calls are in progress
/etc/sip.conf  - register extensions

(sample.sip.conf list most of the available commands)

Sample working extension construct sip.conf

[1000]               # extension must match in asterisk and the phone
type=friend          # friend can make and receive calls other options user & peer 
context=phones
host=dynamic         # or ip address the phone must configured to sent a register packet to asterisk 
                     # secret=password for security

# this means if an office changes seating arrangements the phone can be swapped and the extension changed or the two phone reprogrammed on the sip handset side.

Dial Plan - /etc/extension.conf

[general]
   static=yes
   writeprotect=yes
   autofallthrough=yes
   clearglobalvars=no
   priorityjumping=no 
[globals]
   ; Which extensions shall we ring when an incoming call comes in?
   INCOMING => Zap/3&Zap/4
   ; How long shall we ring those extensions before going to voicemail instead?
   RINGTIME => 3
   ; What sound file will we play as a voicemail announcement?
   VMANNOUNCE => mysounds/my-vm-announce
   ; Define the channels our extensions are connected on
   KITCHEN => Zap/3
   STUDY => Zap/4
   HALL => Zap/5
   ; When we want to make an outgoing call, what line(s) can we use?
   OUTGOING => Zap/1&Zap/2 
[incoming]                       //can be anything must be defined in sip.conf channel defines
exten => s,1,Answer()          //extension => extension number, priority, task
exten => s,2,Hangup()           // s is built in stands for no extension specified incoming call
some cool things
Playback(/home/john/sounds/filename)  //plays back a file
#sample for outbound calls
[globals]
JOHN=Zap/1
JANE=SIP/Jane
OUTBOUNDTRUNK=Zap/4
[outbound-local]
exten => _9NXXXXXX,1,Dial(${OUTBOUNDTRUNK}/${EXTEN:1})
exten => _9NXXXXXX,n,Congestion()
exten => _9NXXXXXX,n,Hangup()
//9 causes the dial tone to stop after picking up the phone
exten => 000,1,Dial(${OUTBOUNDTRUNK}/000)
exten => 9000,1,Dial(${OUTBOUNDTRUNK}/000)  //emergency numbers
[outbound-long-distance]
exten => _91NXXNXXXXXX,1,Dial(${OUTBOUNDTRUNK}/${EXTEN:1})
exten => _91NXXNXXXXXX,n,Playtones(congestion)
exten => _91NXXNXXXXXX,n,Hangup()

extensions.conf another example

asterisk.txt · Last modified: 2014/07/18 11:09 (external edit)