Month: July 2018

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
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.