Well, I had my first proper encounter with Voice over IP today. I’m on Skype, of course, but people really mean SIP/IAX and RTP when they speak about VoIP…

I have to say I am absolutely stunned. At 11 ‘o’ clock this morning I had never knowingly made a VoIP call, and had no immediate plans to. At 4.30 I had a software PABX with two softphone extensions (but they could have been real phones if I’d had the hardware), both of which rang in response to someone dialling my new 0845 number, and either could pick up the call and speak. Both extensions could also make out-going calls, quite possibly at the same time.

By far the longest part of the process was getting my PBX up and running properly, and that only took a couple of hours. My friend (and SIP provider) Gordon Henderson, at Drogon, set me up with a trial SIP and IAX account and 0845 number in about 10 minutes flat – one download of ZoIPer and I was up and running making/receiving calls on my PC. It does caller-id and everything. You try getting BT (or anyone else) to install a phone line and get an 0845 number up and running 10 minutes after you say you’d like it! Needless to say Gordon can do other numbers besides 0845, but he had a spare one to lend me. 🙂

This wasn’t enough for me, oh no! I want to be able to get lots of calls in on my 0845 and let my minions squabble over who answers it. Well, ok, so I don’t have any minions, but by logging into another PC I could pretend to be two people. So, I downloaded and installed Asterisk (a software PBX that can handle VoIP, and physical lines with the appropriate hardware) onto one of our Linux servers. That’s another 10 minutes gone (literally download, make, make install). I set it up to handle my two extensions, and straight away they could register and dial one another.

This was as simple as about 10 lines in the config files, saying here’s user 1, here’s user 2 (in sip.conf), oh yes and user 1 is on this extension number, and user 2 is on this one (in extensions.conf). Throw in the time spent reading the manual, and that was about another 30 mins.

The last bit took a lot more effort, namely allowing incoming/outgoing calls via the IAX account from Gordon. I eventually got it to answer incoming calls on the 0845 with its demo app. Not quite what I was after, but a start. Short step later was to get it ring my extension instead, and even shorter step was to ring both and let the first to pick up have the call. I could have left it there, but I really wanted the outgoing calls to work as well. 🙂

After a lot more faffing I finally cracked it – incoming calls make both extensions ring, and both extensions can make outgoing calls. Probably took another couple of hours (although I was doing other things at the same time). Happy bunny. And again, you try and install a hardware PBX by yourself, having never done one before, with the incoming/outgoing functionality I was after, in less than 2 hours. Impossible.

Of course Gordon normally provides an entire package, including PBX if you need one, all properly configured and supported – but this was really an experiment (and learning exercise for me!)

Upshot? I’m enormously impressed. The setup was 1,000 times quicker and easier than I could have imagined. I set up a telephony solution for our company in half a day. Oh yes, and the call quality is the same or better as normal phones. The line rental would be a few quid, I think. Of course my install is particularly straightforward, with no hardware phone lines to worry about – although Asterisk seems to deal with those fairly easily too. In the end my 3 config files were very short and easy – I’ll pop them down below just in case anyone else is trying something similar.

I didn’t have to change my asterisk.conf

sip.conf is where I set up my internal extensions. There was no need to use SIP internally and IAX upstream, but there were a couple of good reasons. Firstly, SIP can be a bit twitchy through a firewall and NAT, which doesn’t matter for internal phones but does matter for the uplink. IAX is much happier with NAT. Secondly, IAX is meant to be more network efficient, and as it’s going over our ADSL it seemed liked a good idea to use that there. Again on our internal network the bandwidth VOIP uses wouldn’t even register. You also probably don’t need many of the directives I’ve left in.


[James]

type=friend

secret=password

nat=yes

host=dynamic

canreinvite=no

context=internal



[Ian]

type=friend

secret=password

nat=yes

host=dynamic

canreinvite=no

context=internal

iax.conf has my link to the outside world, from Drogon.

The important bits are to register with the IAX provider, and then indicate how incoming and outgoing calls are managed.

It’s quite possible that you don’t need two separate entries here – the top one is handling incoming calls (user type), and the bottom is for outgoing

(peer type). The friend type is meant to allow both – as in my extensions in sip.conf, but I had trouble getting it to play nicely, and to be honest I gave up as soon as it started working.


[general]



register => acc:pass@host



autokill=yes



[acc]

context=incoming

type=user

nat=yes



[acc]

type=peer

host=host

username=acc

secret=pass

quality=yes

Last of all then, is extentions.conf. This has the dialling rules, so tells Asterisk that if an internal phone dials 1, that should connect to my

extension.


[general]

clearglobalvars=no



[incoming]

exten => s,1,Dial(SIP/James&SIP/Ian)



[internal]

exten => 1,1,Dial(SIP/James)

exten => 2,1,Dial(SIP/Ian)

exten => _[*0-9]X.,1,Dial(IAX2/acc/${EXTEN})

This one says all numbers in the incoming context should dial both me and Ian (which is what the & does). It also says calls from the internal users should be handled such that calls to 1 go to me, to 2 go to Ian. Finally anything with two or more digits should go out on the IAX link.

I confess there’s some lines left it which I’m not entirely sure what they do, and could probably be deleted.. but as I said once it was working I was happy. In a production system I would probably want a stand-alone VoIP PBX, rather then running it on a server which is already doing enough, and I’d set up some QoS metrics on the switch (and router if I could) to prevent phone calls being destroyed by file uploads. If I was really exited I might put it on a VLAN.