BT Digital Voice to
Asterisk


Introduction
Rob Grant supplies information on connecting an Asterisk server to BT Digital Voice using SIP.  He originally had BT Home Hub 5 and then migrated to a Smart Hub 2.

Hopefully these notes will be useful to others going through the same process. These notes are not intended as a beginners guide and assume some Asterisk and home hub knowledge by the reader.

He is a BT Halo Broadband customer and until recently was using a BT Home Hub 5.  He has two RaspberryPi’s which are used as Asterisk servers. Asterisk1 for C*NET and Asterisk2 for various networks (PhreakNet, NPSTN & TandmX). The hostnames for the Raspberry Pi's are ‘asterisk1’ and ‘asterisk2’ respectively.

Also connected is a Linksys SPA2101 ATA with two FXS ports and a Cisco SPA525G2 VOIP phone with 5 lines (effectively 5 x FXS ports). There are also have various softphones on a laptop and an Android smartphone (Zoiper, 3CX, MicroSip, GS Wave).

 

Rob advises.....

Ports
In this scenario I have had to be careful about IAX, SIP and RTP port ranges, especially as far as the BT hubs are concerned.

SIP Ports

asterisk1 5067

asterisk2 5068

SPA2101/1 5065

SPA2101/2 5066

SPA525G2/1 5070

SPA525G2/2 5071

SPA525G2/3 5072
 

IAX Ports

asterisk1 4569

asterisk2 4570
 

RTP Ports

asterisk1 10000-20000

asterisk2 20001-30000


 

DDNS
BT give me a dynamic IP address and so whenever my hub is restarted a different IP address is assigned. This is not desirable for a VOIP service using Asterisk. When calls are placed from distant Asterisk servers, or from VOIP phones, they need to know which IP address to send the messages to. I use a Dynamic DNS (DDNS) service which gives me an internet hostname for my BT Hub. Now – instead of sending messages to an IP address the distant node sends the message to my hostname. The actual IP address of my hub on the DDNS server is updated by a small application running on my local servers. Every few minutes they tell the DDNS server what the current IP address is. You can read more here.

https://www.cloudns.net/blog/what-is-dynamic-dns/

My hostname is something like ‘telecom.ddns.net’.  The reason I have just mentioned that is because I use it in the examples that follow.

 

Port Forwarding
I have set up Port Forwarding in the BT Hub firewall to make sure that incoming IP packets are sent to the correct RPI/Asterisk. Even if you only have a single Asterisk you will need to do this. This is needed on any BT Hub. If you imagine a SIP invite arriving on the public side of my Hub destined for Port 5067 how will the hub know to send it over to ‘asterisk1’ (and not ‘asterisk2’ or even to my laptop?!). Port Forwarding solves this. Here are some examples – It’s kind of self explanatory once you see it…

Rule Name          Hostname  External Ports  Internal Ports   Protocol

Asterisk1-SIP      asterisk1   5067-5067     5067-5067      TCP/UDP

Asterisk2-SIP      asterisk2   5068-5068     5068-5068      TCP/UDP

Asterisk1-Media asterisk1   10000-20000  10000-20000  UDP

Asterisk2-Media asterisk2   20001-30000  20001-30000  UDP

Asterisk1-IAX    asterisk1   4569-4569      4569-4569     TCP/UDP

Asterisk2-IAX    asterisk2   4570-4570      4570-4570     TCP/UDP

There were some rules for an X-Box where a game required special settings.  You can also translate a port into a different one by having different External/Internal ranges.


 

Upgrade from BTHH5 to BTSH2

I recently upgraded my BT Home Hub 5 to a BT Smart Hub 2 after experiencing intermittent data loss and dropped connections on our broadband service.  The Smart Hub 2 has resolved those issues but it introduced new problems with my Asterisk setup. This was before I went over to Digital Voice.

I have a SIP softphone running in my Android smartphone. It is hosted on Asterisk1 and with the SH2 no longer worked.

After installing the smart hub I was no longer seeing any SIP messages arriving from the public Internet making their way through the hub into the local network and so the soft phone didn't work when I turned off the wi-fi on the Android smartphone.

This problem was solved by turning off 'Smart Setup' in the Smart Hub browser. Strangely I can no longer find a link to the ‘Smart Setup’ page in the SH2 menus. I now get to it using :-

http://192.168.1.254/smart_setup.htm


'SIP ALG' must be turned off which apparently tries to be clever with SIP messages passing through the Smart Hub and manipulates them for reasons only known to BT.

The Firewall is set to default - "Allow all outgoing connections and block all unsolicited incoming traffic. Games and application sharing is allowed".


Back to my soft phone...

After turning off 'Smart Setup' the external SIP messages could be seen arriving on the local network in the house and the Softphone was able to register with Asterisk.

Another problem was that whenever I made a call from the softphone the Asterisk CLI had some error messages before I saw the call setting up. Essentially they said "Address family for hostname not supported". It was suggested they were due to problems with IPv6. I turned IPv6 off in my Android phone (It was set to use either IPv4 or IPv6. I made it IPv4 only). Those error messages stopped.

I have since tried restoring IPv6 on my soft phone but the error messages started coming up again so it is still switched off.

 

SIP Options
I have had a new problem - if I leave my Android phone to time out then the soft phone goes into sleep mode. Then I start seeing these messages in Asterisk:-

[Feb 1 20:02:48] NOTICE[15298]: chan_sip.c:30531 sip_poke_noanswer: Peer '4427238' is now UNREACHABLE! Last qualify: 254

[Feb 1 20:03:12] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:03:26] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:03:40] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:03:54] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:04:08] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:04:22] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:04:36] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:04:50] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:05:04] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:05:18] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:05:32] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:05:46] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:06:00] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:06:14] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:06:28] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:06:42] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:06:56] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:07:10] ERROR[15298]: chan_sip.c:4345 __sip_reliable_xmit: Serious Network Trouble; __sip_xmit returns error for pkt data

[Feb 1 20:07:18] -- Registered SIP '4427238' at 213.205.240.31:47520

[Feb 1 20:07:18] NOTICE[18990]: chan_sip.c:24999 handle_response_peerpoke: Peer '4427238' is now Reachable. (68ms / 2000ms)

Then I switch the smart phone back on and the soft phone makes contact with Asterisk and the errors stop.

I've just turned off SIP OPTIONS for that extension (by putting qualify=no in the context in sip.conf) and the error messages haven't appeared since.


 

BT Digital Voice Activated
All of the above was pre activation of Digital Voice.

After Digital Voice was activated I had no problems with my landline. I simply plugged the phone into the green socket on the back of the router and all worked fine.

I did however have a problem with SIP softphones connected via the public Internet.  They stopped working.  IAX phones were fine. Outgoing SIP and IAX calls from my Asterisks were fine.  The problem (again!) was that SIP messages coming into my SH2 from the public Internet were not traversing the hub into the local network.  I suspected that some of the settings I had changed previously had been changed during the upgrade – but on checking found that this was not the case. Here they are:-

There is an event log within the SH2 admin facility and I looked in there – I could see SIP messages from when I’d tried the landline earlier – here are some for you to see:-

15:20:29, 05 Jun.
SIP 36226523 SEND 200 NOTIFY

15:20:29, 05 Jun.
SIP 36226523 RECV NOTIFY

15:20:23, 05 Jun.
SIP 1dbdb503 RECV 200 BYE

15:20:23, 05 Jun.
SIP 1dbdb503 SEND BYE

15:20:23, 05 Jun.
Phone 1 onhook, dsp underruns : 37,peak dsp underruns : 16

15:20:20, 05 Jun.
SIP 1dbdb503 SEND ACK

15:20:20, 05 Jun.
SIP 1dbdb503 RECV 200 INVITE

15:20:19, 05 Jun.
SIP 1dbdb503 RECV 200 PRACK

15:20:19, 05 Jun.
SIP 1dbdb503 SEND PRACK

15:20:19, 05 Jun.
SIP 1dbdb503 RECV 180 INVITE

15:20:19, 05 Jun.
SIP 1dbdb503 RECV 200 PRACK

15:20:19, 05 Jun.
SIP 1dbdb503 SEND PRACK

15:20:19, 05 Jun.
SIP 1dbdb503 RECV 183 INVITE

15:20:19, 05 Jun.
SIP 1dbdb503 RECV 181 INVITE

15:20:19, 05 Jun.
SIP p65539t1 RECV ACK

This got me thinking – what ports are BT using for SIP? Maybe they’ve hijacked the ones I’m using to get to my Asterisks (5067 & 5068)? So I decided to change mine… 5067 to 5180 and 5068 to 5181.

At first I just added a new Port Forwarding rule in the SH2 and forwarded 5181 to ‘asterisk2’. Then I changed the server setting in one of my softphones from ‘telecom.ddns.net:5068’ to ‘telecom.ddns.net:5181’. Then I tried making a call from that softphone and now I could see the SIP message coming into ‘asterisk2’ and failing because of course Asterisk2 still thought it was 5068.

The tasks needed to make all the changes on Asterisk 1 were as follows:-

1) Edit Asterisk config file ‘sip.conf’.

[general]

‘change the port below from old 5067 to new 5180

bindport=5180
 

2) Add a new Port Forwarding rule in your BT SH2

Rule Name              Hostname External Ports Internal Ports Protocol

Asterisk1-SIP-5180 asterisk1 5180-5180 5180-5180 TCP/UDP
 

3) Cisco SPA525G2 & LinkSys SPA 2101

Change the Port number of Proxy for lines hosted on my Asterisks from 5067 to 5180.

 

4) Softphones

Change server address from telecom.ddns.net:5067 to telecom.ddns.net:5180

I guess if you’re hosting SIP lines for other folks then you will need to tell them to do the same!

Obviously I had to repeat all of this for my Asterisk2.

 

Current SH2 settings
Here are the settings I currently have now that Digital Voice is working.

Firewall Configuration
Firewall - Default
UpnP - Off
Extended UpnP Security - Off
DMZ - Off
Enable SIP ALG - No


 

Network Settings

IPv4 Configuration
DHCP - Server
Enabled - Yes
Authoritative DHCP - On
 

IPv6
ULA Enabled - No
Allocation Mode - Stateless
Pinholes - None (although I did experiment with these)


Finally
Fortunately these problems only seem to have affected SIP. IAX works fine. This is good because all of my trunks to other Asterisk nodes (owned by other enthusiasts) us IAX protocol and I do not have to tell anybody about these changes.

Please note: Many of the host names and new port numbers are fictitious for security reasons.


 

 
 
BACK Home page BT/GPO Telephones Search the Site Glossary of Telecom Terminology Quick Find All Telephone Systems

Last revised: June 06, 2022

FM