Moving to open source IP Phones (Asterisk)

Moving to open source IP Phones (Asterisk)
Moving to open source IP Phones (Asterisk)
Who am I and how did I get here?
I started playing with MSDOS in 1985 or so and was introduced to some UNIX variant
running on an IBM PC at about the same time. Somehow or another I fell into dBase and then
Clipper which saw me making money from computers and programming from 1988 to the
present. Christmas eve 2005 I joined the Asterisk users mailing list and in January 2006 I
wrote to Aastra tech support so I guess my Asterisk box has been running for about 5 years
now.
In 2005 I came to the conclusion that I needed 4 or more phone lines and I really wanted a 4
line cordless phone to go with them. There seemed to be no reasonably priced systems and
the only one that seemed like it might work was $2500. Somehow I stumble upon Asterisk
and decided to gamble $1000 and see if it would work. $400 or so for an analog interface
card and $300 each for some really fancy IP business phones. I chose the Aastra 480i-CT for
their integrated cordless handsets which solved my 4 line cordless phone problem. I started
using whatever came before TrixBox and gave it up about 1 week later and learned to hand
code Asterisk dial plans. A few years later my Brother-in–law bought an off the shelf TrixBox
solution and has been happily using it ever since. The canned solution was easy enough he
set it up with hardly a call to me.
Opening crowd questions
How many people here have installed an IP-PBX on a Linux box in your home or office?
How many of those have gotten it up and running and use it on a daily basis?
How many people have a Linux box that’s on 24/7
What new words and acronyms do you have to learn?
POTS - Plain Old Telephone Service
POTS’ describes the phones we use in our houses. Two wires that run directly to the central
office, though more correctly in our world, it describes that 2 wire interface. The phone jacks
on a Vonage box are a POTS interface, as is the phone jack on a MagicJack. It’s important to
understand as if you want to connect your Vonage or MagicJack lines to your Asterisk box you’ll
likely need an analog interface card for your Asterisk box. Make sure to research first, as there
are people who’ve spent a lot of time trying to connect them directly and you may find a
solution on the internet. I’m almost certain there is a solution for MagicJack, less so about
anything else.
FXO - Foreign Exchange Office or Phone
An FXO jack acts like a telephone handset. It would normally be connected to a wall jack, Vonage
Box, MagicJack or any similar device.
FXS - Foreign Exchange Station
An FXS jack looks like the plug in the wall you connect a telephone handset to. You’ll need one of
these if you expect to connect an analog phone to your Asterisk box.
FXS cards require the availability of a lot of power because they need to be able to ring one or more
phones
SIP, IAX2
The 2 most common protocols for VOIP
SIP is the almost universal VOIP protocol
IAX2 is mostly used for Asterisk to Asterisk trunks
AEL stands for Asterisk Extension Language
AEL is the language supported by a C like pre-compiler for the Asterisk dial plan language.
DAHDI stands for Digium Asterisk Hardware Device Interface
DAHDI is the driver that supports hardware telephony interface boards. It’s needed if you have
an interface board to connect to an old fashioned telephone line.
Zaptel is what DAHDI was called before it became DAHDI
Wanpipe – The equivalent of DAHDI drivers for Sangoma telephony interface cards.
A Codec describes the method used to convert analog to digital. The traditional standard in
the US is ULAW which uses 64K/second of bandwidth in each direction. There are other
codecs that use less bandwidth with various penalties in sound quality. There are also a few
higher bandwidth codecs that have improved sound quality. The best supported seems to be
ULAW if you can afford the bandwidth, I would suggest you start here and move to a different
codec when there is a reason or when you’re bored.
DTMF describes the tones your phone makes when you push the number keys
Registration
In order for calls to get sent over the internet, the end making the call needs to know where to
send them. If both ends have fixed IPs it’s easy, but most of us don’t live in that world. Outgoing
calls are easy as your provider most likely has a fixed IP or domain. Their calling you is harder
as most likely you won’t have a fixed IP. Registration is a process where you tell your provider
where you are. You’ll need their address, sip.teliax.com or something similar, and Asterisk will
send them a message containing your name, password and location so they know where you
are.
NAT - Network address translation
NAT is a service that translates your public IP to your local IP. Most routers do this
automatically but some VOIP protocols don’t work so well across NATed connections. Also,
some routers do this better than others. I’ve used Linksys routers running various firmware
versions and currently use a Syswan router because it matches the one at my wife’s office and
does hardware VPN.
Line Presence describes an available line on a business phone. It does not connect to a
particular pair of wires; it can just carry a call.
What to do first?
Read the O'Reilly book, Asterisk: The Future of Telephony, 2nd Edition will walk
you through the process of configuring your first Asterisk system. This is a must
read if you want to understand Asterisk.
You can buy it on Amazon or other book stores or you can download it using the link I
provided below. If you read this book before or at least while you’re getting started you will
be likely have a much smoother experience.
Why?
Money
Today for my most recent SIP lines I spend just under a penny per minute for outgoing phone
calls and a bit over a penny for each incoming minute. A phone number anywhere in the USA
costs $5 to set up and $1.29/month. My cost to call New Zealand land lines is 2.2 cents/minute. I
don’t call New Zealand cell phones because my cost is 25 cents/minute
Features
At some level, if you can think of it, Asterisk can do it.
My phones don’t ring before 9:00AM or after 11:00PM unless I want a call from you
People I really don’t want to talk to go directly to voicemail
I have 4 lines coming in and they all ring on the same lines presences but I’ve manipulated the
dial plan so that they all ring different and I modify the caller ID so I know for sure.
With Asterisk and most of its descendants you can makes as complicated an IVR as you like.
Some public examples include torture for salesman and Zork
Your voicemail messages can be automatically emailed
Limit what calls can be made. I’ve tried to make it so calls to expensive destinations can’t be
made.
Entertainment
Well, if you like solving problems and think a computer is a toy, a user programmable PBX
makes a really cool toy.
Why Not?
Wife Acceptance Factor!
You need to have a computer on 24/7, and you should have it on a decent sized UPS. Both of
those cost money as does the electricity it takes to keep it on.
Risk
Computers fail
Let me count the ways. When I turned off my Asterisk box for the first time in years it wouldn’t start
again. A mad scramble finding a new power supply I hoped would solve the problem and ½ hour
later it was up again.
Now the darn thing won’t reboot unless I unplug the USB drive I use for backups. Not such a big
deal as the more knowledgeable I get, the less I need to reboot, but a rather serious problem if no
one’s home and the power goes out long enough for the UPS to die.
I build Asterisk and DAHDI from source and DAHDI is tightly linked to the kernel version so the first
time I did “yum update” and the kernel was updated I was in for a surprise. The next time I
restarted the machine DAHDI would not start and I had no idea why. Eventually I re-built and reinstalled Asterisk and DAHDI and all was well again but at first I had no clue what had gone wrong.
It had been weeks since I’d done what caused the problem and I was lost.
Computers get hacked
There’s a tool out there called SIPVicious that was written to test the security of Asterisk
installations but sadly, is being misused to find insecure extensions on Asterisk boxes and use them
to make “free” calls. Free for them, but if they’re using your box to call a premium service in
Romania at $5/minute it will be far from free for you.
Downtime
Computers fail
The internet fails
When the internet goes down, you have no phones. I believe all the providers I’ve used allowed me
to forward calls if my box was not registered which can help for a home or small business. If that’s
important to you, makes sure the provider you choose offers that option.
Your provider fails
This one really sucks. If it’s the outgoing call provider, that’s really easy to fix and you might be out
your deposit. I think in 5 years I’m out about $14.
It’s way worse if it’s the incoming call provider as then your phones stop ringing.
You fail
Last week I upgraded my copy of Asterisk. The upgrade went fine but in my constant quest to make
the install as small as possible I removed some Format Interpreters and Codec Translators I was
sure I didn’t use in my installation. The next evening my wife wondered why she’d missed two
voicemails from her boss. Turns out I needed some of the missing pieces to save voicemails.
Bandwidth
Each internet phone call takes bandwidth, commonly 64K each way, if it’s not there the call
sounds bad or fails
Reliability
Once upon a time when there was just ATT, phones basically never failed. Sometimes a pole
was knocked down, but it was reasonable to assume that your phone would always work and if
not, ATT would be there post haste to solve the problem.
One you go pure VOIP the number of failure points increases dramatically. Every piece of the
network in your home or business
The computer hosting the PBX
All the network wiring
Any and all switches, hubs, routers and modems
The wiring between your modem and your internet provider
Your internet provider
Your VOIP provider
On the other side, in 5 years of using Asterisk we’ve probably had less than 12 hours of outages
and only a very small amount of that affected our business and probably more than half of it
was my fault.
911
If you have your own PBX using an IP number you need to figure out what happens when you
dial 911. In my case I still have a few POTS landline and 911 calls on my PBX automatically use
that line no matter what, but if your only line is an IP line you need to think about that. Today,
most IP providers have a way to provide 911 services, but it’s vitally important to know the
answer to that question.
Echo
Echo can be the bane of an IP PBX.
True IP has no echo but echo created by an interface between IP and analog can be dreadfully
annoying. I’ve used Digium’s HPEC, High Performance Echo Canceller, which was free because
of my Digium analog interface board. I understand OSLEC, Open Source Line Echo Canceller, is
just as good. Neither existed when I started and until I installed HPEC, echo was occasionally a
serious annoyance.
Today echo should no longer be a problem, but if you have it you will spend a bit of time trying
to cure it. You can learn to live with it, but it’s likely the people who use it will complain loudly.
Invalid IVR Responses to key presses.
DTMF tones can be transmitted in multiple ways, the best is as a command, tell the other end
you pressed “2” and it sees it as the sound made by the 2 key. It can also been sent as the
sound. If you don’t choose the right method your users and or your callers will find the key
presses get lost or doubled. Solving it is not difficult, but will likely seem so until you figure it
out.
Complication
Definition of a SIP extension
[CallWithUs]
type=friend
context=mystery_sip
host=sip.callwithus.com
nat=yes
qualify=55000
defaultuser=UserName
secret=PassWord
insecure=invite ; very
disallow=all
allow=ulaw
canreinvite=no
dtmfmode=rfc2833 ; auto
Code to answer a phone:
[camaro]
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
exten
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
6314098389,1,goto(s,1)
13106945051,1,goto(s,1)
13109190999,1,goto(s,1)
100,1,goto(s,1)
199,1,goto(s,1)
s,1,verbose(1)
s,n,gosub(check-blacklist,s,1)
s,n,SIPAddHeader(Alert-Info:<Bellcore-dr3>)
s,n,GoToIf($["${CALLERID(num):0:2}" != "+1"]?going2)
s,n,set(CALLERID(num)=${CALLERID(num):2})
s,n(going2),gotoif($["${CALLERID(num)}" = "3106229323"]?fixcid:okcid)
s,n(fixcid),set(tempcid=${CALLERID(num)})
s,n,set(CALLERID(num)=${CALLERID(name)})
s,n,set(CALLERID(name)=${tempcid})
s,n(okcid),verbose("${CALLERID(num)}")
s,n,GoToIf($["${CALLERID(num)}" = "3109804092"]?ira_calling,s,1)
s,n,GoToIf($["${CALLERID(num)}" = "3109809926"]?robyn_calling,s,1)
s,n,GoToIf($["${CALLERID(num)}" = "2134343188"]?donna_calling,s,1)
s,n,GoToIf($["${CALLERID(num)}" = "3109809926"]?home,s,starthere)
s,n,gosub(answer-business,s,1(CamaroElectronics,103,CE,${RING_TIME},Camaro))
Figuring out what to install
When you install Asterisk from Source there is a configuration tool you should probably run before
you build it. Here are some screens from that tool. As you can see, some of choices are a bit cryptic.
At least to start, I’d highly recommend changing nothing but the Sounds sections and then just
adding the languages you need and matching the codecs you’ll be using.
What do you need to get started
Smallest lowest power possible PC
The smallest Atom based computer will easily handle 10 lines and 20 phones. The smaller the
computer the less it costs to run and a phone computer needs to run 24/7
Asterisk can also be run on various Linksys routers, a Seagate DockStar and numerous other
small Linux boxes.
A UPS big enough to keep the phone system, modem, switches and phones alive through the
longest power outage.
With the advent of cell phones this becomes less critical. All of my IP phone numbers forward to
my cell if my phone system goes down. But it still means voice mail ends up in the wrong mail
box and I get calls for my wife that I don’t want.
Software
You need to pick an Asterisk install.
Source
Always the newest version
You can modify it if you like
Must be rebuilt if the kernel changes
Yum
Easy
Updates automatically and is in sync with the kernel
Trixbox or Asterisk Now
One disk install
Lots of features
GUI front end
AstLinux
Special build for really small computers
Phones soft or hard, analog or IP
There are 3 kinds of phones you can use with Asterisk
Soft phones: IP phones that are just software running on a computer. At a minimum they exist
for PC’s, Macs, iPhones and Android phones. Skype is probably the most well known soft phone
though it’s not useful for this.
Hard phones: A normal looking office phone that has an Ethernet port instead of a phone jack. I
personally consider hard phones the best solution for replacing a traditional phone, but they
cost significantly more. But they tend to natively support things like transfer, hold, conference,
park and more. Hard phones require power, either from a wall wart or from a POE switch.
My Aastra phones have nine line presences which is way more than any home should need, but it
means I can in theory handle nine calls at once. Incoming SIP calls just show up as an additional line
presence, so I get Caller-ID, not just a beep and a third call is just a third line presence, not a busy or
direct to voicemail. I would suggest that if you go hard phones that you get one with at least two
and if you can, four is probably better. And if I need more, some phones have sidecars so you can
see 20 or more. Something the receptionist might want
Snom.
Linksys/Cisco
Aastra
Grandstream
Yealink
Analog phones: The same phones you have now. All you need is an interface device to connect
them to the computer.
I’ve used hard and soft phones with my PBX, but never an analog phone so I can’t say much about
how they work.
Most people on the mailing list try to avoid this solution. Usually only make sense when the phones
and wiring are already in place, there are a really large quantity of phones and you’re replacing a
very old PBX.
Phone number
Well, if you want normal people to call you, you’ll need one. There are hundreds of providers.
I’ve listed a couple I’ve had luck with. As a very small user I pre-pay $20 at a time which gets
me about 1800 minutes and lasts me and my wife 4-8 weeks. If you needs are significantly
greater than that I’ve been offered $0.001/minute with a minimum of $150/month. That’s
150,000 minutes! If only I remembered who it was, as it’s just become reasonable to split that
with a friend.
Interface hardware
What does FXO and FXS mean
dyndns.com
Resources – A list of links to web sites I’ve found useful or I think you might
find useful when getting started with Asterisk.
The O'Reilly book, Asterisk: The Future of Telephony, 2nd Edition will walk you
through the process of configuring your first Asterisk system. This is a must read
if you want to understand Asterisk.
http://Google.com – a place to look before asking embarrassingly simple questions
Hardware for Asterisk
http://digium.com - a manufacturer of telephony interface cards and the mother of Asterisk.
http://sangoma.com – a manufacturer of telephony interface cards
Asterisk distributions
http://trixbox.com – A “friendly” distribution of Asterisk
http://elastix.org – A “friendly” distribution of Asterisk
http://asterisknow.org – A “friendly” distribution of Asterisk
http://www.astlinux.org – A distribution of Asterisk for embedded and very low power
computers
http://adhearsion.com - A Ruby framework for Asterisk?
Sources of information about Asterisk
http://voip-info.com – Maybe the best source of answers on VOIP and Asterisk
http://asterisk.org – the home of Asterisk
http://wiki.asterisk.org – the official Asterisk wiki
http://www.asterisk.org/support/mailing-lists
Join #asterisk, port 6667, on the FreeNode IRC network (freenode.net).
http://forums.digium.com/
http://downloads.oreilly.com/books/9780596510480.pdf - Second edition PDF
http://astbook.asteriskdocs.org/ - Third edition preview
http://www.asteriskguru.com - Articles about installing and using Asterisk
http://www.astricon.net/2009/astricon/videoPresentations.aspx
Softphones
http://www.counterpath.com/x-lite.html X-Lite softphone
http://blog.voipsupply.com/free-sip-softphone-roundup - A list of free softphones
SIP Providers
http://www.flowroute.com SIP provider
http://www.callwithus.com SIP Provider
http://www.Telasip.com SIP Provider
http://www.Ipcomms.net Get a free incoming number.
You can make calls from it, but this company and probably a few others will give you a free
incoming phone number with the only restriction being you have to use it, if you don’t they take it
away. Mine is in upstate New York, but people with cell phones don’t care and it’s SIP which means
you can have more than one call happening at a time.
http://www.voip-info.org/wiki/view/VOIP+Service+Providers+B2B
I have found most or all of the providers I’ve used on this list. Some of them have been good, some
have gone bankrupt. Some will refund your money if you’re not happy, some will tell you to “take a
hike.” I try to start by spending little enough money that if it goes south I can just write it off to
experience. No one checks the list, so some of the entries are likely scams, so be cautious.
Interesting Asterisk coding examples
http://uc.org/read/ZoIP - Zork on Asterisk
http://www.voip-info.org/wiki/view/Asterisk+Telemarketer+Torture - Telemarketer Torture
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising