Asterisk, Voip and IP Telephony.

I’ve spent the weekend playing with some VoIP technologies, in the hopes that eventually I’ll be able to fully automate my home telephone system. It all started a while back when I obtained a “BT Voyager 10V” combined, router, VoIP, hub type thing..  ( I use the term Thing loosely here.. Tongue out ) and being the type of person I am, I thought why should i be tied to only using this thing with BT?

To put you in the frame, the 10V is a lot like the home hub, it’s limited to the British Telecom network, it’s firmware locked so that it can only serve BT-Broadband connections, BT VoIP accounts and BT Standard telephone lines.  However, after a bit of research I discovered some other enterprising young chaps on the interweb that had managed to reprogram their V10’s for use with sipgate, one of the UK’s other VoIP service providers.

This got me thinking, so I tinkered around and managed to get the 10V talking to my Asterisk server, to do this was a simple matter of telnet-ing into the 10V and issuing the following commands:

sip set reg_srv <ip address of your asterisk box>
sip set domain <your local private domain, blank if you don't have one>
sip set outbound_pxy <ip address of your outbound sip proxy, in my case the same asterisk box>
sip set reg_mode 1 (1 means register always)
net set nat 0 (0 = don't traverse NAT, i think ...)
net set dnsmode 1 (1 = Perform DNS lookups, means you can use addesses rather than IP's, i recomend using IP's though)

Then for each line ( The 10V has 2 FXS/Analoge phone sockets)

sip set tel_num [1/2] <Name or number to assign to this extension>
sip set reg_id [1/2] <Registration ID to assign to this number>
sip set reg_pwd [1/2] <Registration Password to assign to this number>
sip set tel_name [1/2] <Textual label to assign to this connection, may be used as caller ID>

where there is [1/2] use 1 for line 1, and 2 for line 2.

Once you’ve set these values, exit the telnet console, then using a browser, browse to the 10V’s control panel at the same address as you telnet into, then click on “Quick setup”, select ADSL, click Next, Select High bandwidth, then click apply.  This must be done to save the configuration you just set up, make absolutley sure that you logged out of the telnet session before doing this.  If you did not log out the reset will hang and your changes will NOT be saved.

On the asterisk server itself it was then a simple case of adding the following configuration:

File: sip.conf

callerid="BT 10V L1"

callerid="BT 10V L2"

The label in the square brackets, should match the value entered into reg_id in the 10V, and to avoid problems with asterisk should also match the tel_num, so:

tel_num=10VL1 = reg_id = [10VL1]

if that makes sense 🙂

Type = friend means the device can make and receive calls, see the asterisk docs for other values, context is the dialplan (defined in extensions.conf) to handle this phone when it dials in, host=dynamic means that it’s a dynamic address, EG: assigned via DHCP.

A little note on using dynamic…   I have my 10V set up with a static IP address, but I still set the handsets as dynamic.  The reason for this is it makes the handsets re-register with the server every so many seconds, ‘3600’ I think is the default.  This basically means you can unplug one of the phones, and or the 10V and the server will cleanly disconnect the extension and flag it as unreachable, which will subsequently be reactivated when you plug the 10V back in,  this is great for testing beacuse it means you can move the devices round your network without constantly having to set ‘’ and reloading the sip conf in asterisk.

The remaining tokens, secret=<password> where password should be as assigned to reg_pwd in the 10V config, dtmfmode just leave as is… trust me it’s a good thing.. 🙂 and callerid is a text string that will be presented to any extension you call.

The second file to configure on your asterisk box is:



exten => 123,1,Answer
exten => 123,n,Background(hello-world)
exten => 123,n,WaitExten(10)

exten => 1,1,Dial(${LINE1},10)
exten => 1,n,VoiceMail(${VMLINE1}@default,u)
exten => 1,n,Hangup()

exten => 2,1,Dial(${LINE2},10)
exten => 2,n,VoiceMail(${VMLINE2}@default,u)
exten => 2,n,Hangup()

exten => 3,1,Playback(vm-goodbye)
exten => 3,n,Hangup()

exten => i,1,Playback(pbx-invalid)
exten => i,n,Goto(dialplan1,123,1)

exten => t,1,Playback(vm-goodbye)
exten => t,n,Hangup()

exten => 888,1,Answer()
exten => 888,n,VoiceMailMain()
exten => 888,n,Hangup()

The globals part sets some global variables that make it easy to reference other extensions in your plan, i would always recommend doing this, then you only ever have to change one entry in your dialplan if you rename a sip connection.

The [dialplan1] part is the dialplan name, and if you look back at sip conf, you’ll see this is the entry placed in the context token.

The first entry 123, answers the line, plays the asterisk sound file “hello-world” then waits 10 seconds for another number to be pressed, if no number is pressed in this time, it jumps to the extension marked ‘t’ (Timeout) plays the sound “vm-goodbye” then hangs up.

If you press a 1 or a 2, then the appropriate line is dialled, if the call is unanswered then the voice mail system is activated to record a voicemail message, the voice mail id’s are in the globals, and are defined in the file ‘voicemail.conf’, the line is then hungup once the VM has been exited.

If you press an unknown extension number, the extension marked ‘i’ (Invalid) is executed, and the sound “pbx-invalid” is played, followed by the dialplan looping back to the very beginning, at the entry following the answer.

Picking up the phone and dialling 888, will allow you to access and read the voicemail messages left, these are defined in voicemail.conf as follows:

100 => 1111,Line1 Voicemail,line1@mydomain.local
101 => 2222,Line2 Voicemail,line2@mydomain.local

Each line takes the form of:

VMID (As used in extensions.conf) => VM_Pincode,VM Description,VM_notification email.

There are other parameters also, in ALL 3 files, I’ve just put in the basics, note also you WILL need to substitute things like IP’s, email addresses etc as required.  Particularly in the voicemail file, unless your asterisk server is able to pass email out to your ISP for delivery, then you will NOT be able to use your public email address, unless you have your own DNS server along with access to the public MX record for said email.

I’m assuming that if your building your own asterisk voip server, then your quite likley to be fairly ok with linux/networking and other topics.  The samples I’ve shown here are exactly that, samples.  If you copy and paste the configs as is, you will need to alter them to some extent they won’t work as is.

Since I got my 10V working, I’ve now also bought an SPA-2000 and an SPA-3000 from ebay, both of which work perfectly.  The 3000 will allow me to route inbound BT calls into my VoIP system, and route outbound calls over my standard BT line, as well as routing my calls via any VoIP/Sip provider I choose to partner with, in this case a friend of mine who lives approx 30 miles away is going to set up his own asterisk server, so we can then make VoIP calls directly to each other using our existing BT phones and it won’t cost a penny, not even a voip charge 😀

Once i get the SPA-3000 working, I’ll document that too…


2 thoughts on “Asterisk, Voip and IP Telephony.

  1. Hi Patrick, yes from what I can remember it does. However that was quite some time ago when I did that, over 2 years!! SInce then, I’ve kitted things out properly with an SPA3000, and CIsco Voip IP phones, along with a correctly partitioned (VLAN wise) managed switch.

    When I first used the 10V, i can’t remember if I had the caller ID turned on or not on my line, but I certainly didn’t have any difficulty getting it to work with asterisk, once I’d done a bit of research and fiddling around with it.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s