Uncategorized

Supporting 12.5 Pulses Per Second with Loop Disconect Phones

Old rotary dial telephones emit pulses to dial numbers.
Normally there are 10 pulses per second with a 33 millisecond part and a 66 millisecond part for each pulse.

But some phones have rotary diallers that turn faster than normal (and emit 12.5 pulses per second) and some turn slower (and emit 8 pulses per second);

Asterisk, the DAHDI drivers and Digium (or clone) PCI cards with FXS slots can handle phones at 8 pulses per second and 10 pulses per second. But they failed with phones that emitted pulses to quickly.

This is because the dahdi driver (wctdm.c) only checks the ‘hook status’ (ie on-hook or off-hook) every 16 milliseconds and requires a minimum of 2 readings with the same hook status before issuing a Confirmed On-Hook or a Confirmed Off-Hook event to Asterisk.

So I modified the dahdi driver source code (wctdm.c) so that the Hook Status is checked every 8 milliseconds.

This allows dahdi to cope with faster pulse trains and our phone set to 12.5 pulses per second now works with the FXS port on the Dahdi PCI card.

This opens the door to support phones on the railway where the rotary dial mechanism rotates slightly faster than normal.

 

I’m just glad that we have the dahdi source code and could dig into the device driver source code to resolve this problem.

 

Raspberry Pi FXO and FXS using the PiTDM from SwitchPi

I recently purchased a 2x FXO and 2x FXS adapter board that fits onto a Raspberry Pi.

It is called the PiTDM and is made in China by SwitchPi.com
Here is a photo of the board with 4 RJ11 ports, all configured as FXO ports using dual-port modules.


The PiTDM from SwitchPi uses standard FXO and FXS modules like the PCI or PCI-Express cards used on desktop PCs and there is a modified DAHDI driver so it works with Asterisk and with FreePBX

The FXO port works well. The dahdi driver accepts the pulsedial=yes command and the FXO port can be heard pulsing out phone number when I make the FXO dial out.
(For testing I connected the Pi’s FXO port to a Grandstream HT802 which was acting as the FXS interface of a Central Office PBX)
The Grandstream recognised the PiTDM’s Pulse Dial (Loop Disconnect dial) properly.
The FXO port also recognised incoming calls and the Pi detected the alarm state if the FXO port cable was disconnected.

Next step is to try this on the Strowger Exchange and have the Pi connected to a Strowger extension and make the Pi go off-hook and pulse dial Strowger extensions.

The PiTDM board also supports FXS ports which also work via their dahdi driver with Asterisk (and FreePBX)
The FXS port accepts DTMF dial tones properly and can also be configured to accept Loop Disconnect dialling (Pulse Dial).
To work with UK rotary dial phones, the file /etc/modprobe.d/dahdi.conf needs to be edited and the following line added

options wctdm dialdebounce=32

I believe the driver defaults to a 64 milliseconds debounce filter and does not work with UK phones. This changes the driver 32ms.

So the Good Points for the PiTDM (4xRJ11 port model)
– really compact FXS and FXO board supporting 4 x RJ11 ports and a mix of FXO and FXS modules. It is slightly larger than a Pi.
– One 9V 1Amp power supply powers the SwitchPi PiTDM board, the FXO and FXS modules and the Raspberry Pi too (that’s just 9 Watts)
– Works with DAHDI and Asterisk and FreePBX (or the Digium GUI)
– FXO supports Pulse Dial when dialling out with a config file setting (pulsedial=yes)
– FXS supports Pulse dialling from telephones with a config file setting (dialdebounce=32)
– They have been really helpful via email. Thank you Xin for all your help
– They have shared with me the driver source code which meant I could modify the driver to support rotary dial phones that were running fast (eg 12 pulses per second)

Bad Points
– No idea what the warranty is (I never asked)
– No certification documentation (like CE or approvals for connection to a PSTN) (but that’s OK for now as I’m using this on a private exchange)
– Would be nice if they sold a case too (and SwitchPi tell me they are looking into it)

Next steps it to take it over to the Strowger exchange and test the FXO module dialling Strowger extensions and to continue working with SwitchPi on the FXS Pulse Dial speed issue.

*updated with latest Pulse dial information – all working now.
*updated again to add that it was the PiTDM 4 Port model I was testing
*updated again with Source Code information which meant I could support faster pulse rates for pulse dial phones in the UK

Raspberry Pi Asterisk Update

We have now deployed a Raspberry Pi running Asterisk and FreePBX at Parkend.
This uses the RaspPBX build to make installation easier.

The Pi is linked via Ethernet to 6 x Grandstream HT802 ATAs. These are dual port ATAs that accept DTMF and Pulse Dialling so can be used with new phones and old heritage phones.
The Pi also connects to some Avaya Desktop SIP phones over the network.
Finally the Pi has an IAX2 trunk to the main Asterisk Server in Norchard which is running over broadband internet.

The Pi is a tiny little thing, but it works very well.
The FreePBX GUI was fine adding extensions. It needed some lower level knowledge to get the IAX2 trunk working.
Calls between local extensions stay local to Parkend (so it all works if the broadband internet is down).
Calls to other extensions are forwarded to Norchard for the Asterisk box there to work out what to do. This means Parkend can call local SIP numbers, Norchard SIP Numbers or any of the Stronger Exchange numbers (routing via Norchard’s Asterisk<->Strowger link)

A PBX that fits in the palm of your hand. Amazing.

Upgrading Avaya 4602SW, 4610SW with SIP Firmware

The railway came by a load of Avaya 4602SW, 4602SW+ and 4610SW phones. All came with the standard H323 firmware and we have upgraded some to the Avaya SIP firmware and linked them to our Asterisk server.

The upgrade to SIP firmware needs a standard HTTP server (you can use TFTP if you wish) and does not require any special Avaya software or tools.

The Avaya phones use DHCP for their IP address and if the DHCP does not deliver a ‘FileServer’ address (i.e. the HTTP server address) they ask the user to enter the IP address of the HTTP server from the numeric keypad.

After doing this the phone goes to Command Mode where you can tell it that you want SIP signalling firmware. To do this press Mute-S-I-G-#   (that’s Mute-7-4-4-#) to go into the Signal Type setting and select SIP.

The phone now restarts and fetches various files from the HTTP server.
First the phone requests 46xxupgrade.scr from the HTTP server which is a script processed by the phone which allows the phone to work out what firmware images it needs based on the phone’s model, the phone’s current firmware and most importantly the ‘SIG’ Signal Type setting we just changed via Mute-S-I-G#. Then the phone requests the latest boot firmware (if needed) from the HTTP server and then request the latest application firmware from the HTTP server.
It takes a few reboots as each part is upgraded and once the firmware is upgraded the phone requests 46xxsettings.txt from the HTTP server. This is a config file where you put the SIP Server’s IP address. This was set to point to our Asterisk machine.
Our 46xxsettings.txt looks like this

SET DIALPLAN     xxxx
SET SIG 2
SET SIPDOMAIN    avaya.phone
SET SIPPROXYSRVR 192.168.1.68
SET SIPREGISTRAR 192.168.1.68
SET SIPSIGNAL 0

Some of these may not actually be needed.

 

Once 46xxsettings.txt has been loaded the phone asks for the SIP Extension Number and Password which have to match the entries in the Asterisk sip.conf file. Note that the password is digits only and limited to 8 digits.

The phone then registers with Asterisk and can start making and receiving calls.

 

 

Footnote – Avaya stopped doing firmware updates for these phones back in 2011 and they are all End-Of-Life. The support.avaya.com site does have excellent manuals and tutorials on what put in 46xxsettings.txt
The Avaya support page that describe the latest firmware download is broken. It tells you what the firmware versions are but the download link points to a folder on their FTP server that does not exist any more. Drop us a line if you need a copy.

Ethernet over Mains test

I tested some Ethernet over Mains adapters at Parkend today and used the TP Link PA-411 adapters which follow the Homeplug AV500 standard.
There are 3 buildings on site (Station, Goods Shed and Signal Box) and the site is 3 phase (each building is on a different mains phase) but the Neutral wire that Homeplug uses is common to all 3 phases so this was not a problem.

Testing was carried out by accessing the web based speedtest.net service from a laptop.

When connecting the laptop directly to the broadband router my laptop had the full 80Mbps download and 20Mbps upload. (The FTTC broadband cabinet is less than 100 metres)

From the Goods Shed (where the telephone exchange is) I got a download speed of 25 Mbps.
From the Signal Box I got a download speed of 37 Mbps.

The adapters deliver a good throughput over the 3 phase mains to allow internet access and VoIP data.

Manufacturer refurbished PA-411’s are £11 on eBay at the current time so are very cheap.

 

 

Netgear DGN2200v4 Disable SIP ALG to make ringing stop

I had to disable SIP ALG on my Netgear DGN2200v4 ADSL Router to fix a SIP problem.

In my office I have a Grandstream HT802 ATA. This is a 2 port (2xFSX) ATA.
It connects to the internet via a Netgear DGN2200v4 ADSL router. Elsewhere across the internet is our Asterisk server, also behind a NAT broadband router.

Both FSX ports have SIP accounts linked to the Asterisk box and I had a phone on each FSX port. I’ll call these extension 401 and extension 402.

If ext 401 calls ext 402 then extension 402 will start ringing. (OK so far),
My problem was that if 401 then hung up the call before 402 answered, 402 would keep ringing and ringing so something was going wrong.

If I did this test the other way around then everything was fine.
i.e. Ext 402 calls Ext 401 and 401 starts to ring. If I then hangup on ext 402 the call clears down properly and ext 401 stops ringing.

The fix turned out to be disabling the SIP ALG support in the Netgear DGN2200 v4.
It is found in Advanced -> Settings -> WAN Setup

 

Grandstream HT802 ATA – Pulse Dialling and Hook Flash

HT802
I’ve been looking at the Grandstream HT800 series ATAs to allow analogue telephones to connect to the asterisk server. Based on cost ‘per FXS port’ we settled on the HT802 which is a 2 port ATA (2xFXS ports). They are about £35 (so £17.50 per port) and a couple were ordered.

The HT802 is a fairly new ATA which is still being manufactured and still receives firmware updates and has technical support.

HT802

HT802

Pulse Dialling (Loop Disconnect Dialling)
Firmware 1.0.5.11 for the HT802 adds “Enable Pause Dialing:” to the web config page. We have tested it with an old BT phone with the ‘rotary dial’ and some newer phones that support DTMF and Pulse Dial (Loop Disconnect Dial) with a MF/LD switch. It all worked well and we can make calls from all the old analogue phones we tried to the asterisk extensions.
Pulse Dialling needs to be enabled on each FXS port in the web config page

Hook Flash
Also in the web config menu is “Enable Hook Flash:”
Then it is enabled you can flash the hook (press the hook button down and let it go quickly, putting your first call on hold and allowing you to make a 2nd call. This is handy as it allows you to use call holding and do call transfers. But in practice users just end up having two active calls without realising.
Hook Flash can be disabled on each FXS port in the web config page.

Other Settings
There are settings for SLIC (which we set to UK) and settings for “Enable High Power Ring” which we have not tested yet but may help with long lines.

Back online…

Well that was an effort.

We’re back online, it seems my port forwarding documentation is accurate – but our dynamic dns provider is being “less than perfect” at the moment.

To cut a long story short, they were claiming we hadn’t changed our IP when we had (even when I tried to force an update) so weren’t propagating the changes.

All sorted for now, but I’m going to have to find another way around this DDNS issue.

New monitoring

Since we went static IP for our broadband, I can no longer infer the state of the Norchard broadband from the number of times we change IP address per hour (previously every time the broadband connection went down it would come up on a different IP address)

So I’ve put some better monitoring in place, and http://dfrvoip.org.uk/blog/status/ now tracks our connection to the outside world by pinging the google DNS servers.

Due to the way they’re hosted – the graphs on that page might not be visible on every interenet connection. I’ve got a few ideas about how to change that, but they’ll have to wait for another day as life is somewhat hectic at the moment!

The technology I’m using is pretty basic network monitoring software called smokeping. It’s not my monitoring tool of choice, but it’s easy to install and get going – and for something as simple as monitoring a single internet link it’s pretty good.

The gratifying results of this are that our current broadband looks a lot more stable than the previous broadband!

Level 0 – Special Services

The new “Level 0” relay set currently only has one line connected to it, for test purposes. It was pointed out to me last night that we hadn’t added it to the dialplan, so Level 0 services weren’t available from SIP phones.

I’ve now rectified that, and we’re currently matching 0X and 0XX numbers as being destined for Norchard special services.

If we deem any of the special services “inappropriate to dial from SIP phones” (as we have with the fire alarm number) I’ll bar them individually, but for now everything on 0X and 0XX is available from the asterisk.

I’ve also updated the directory listing over in the sidebar, to include the level 0 services.