Trunkdev-S0-Adapter » History » Revision 5

« Previous | Revision 5/7 (diff) | Next »
manawyrm, 08/13/2022 11:55 AM


Using osmo-e1d's trunkdev functionality, osmo-e1d can provide OCTOI as a virtual E1 / PRI line to DAHDI on a Linux machine.
This can then be used in conjunction with a software PBX to switch between the virtual E1 line going to/from OCTOI and a physical ISDN interface, for example a more common S0 / BRI interface.

Experimental test setup - Hardware

Fujitsu Futro S900 thin client with CologneChip HFC-S PCI ISDN card (NT mode capable)

The HFC-S card needs numerous mods:
- External clock input
- 100 ohm termination
- NT/TE selection (aka RX/TX flip)

100 ohm termination could be achieved directly on the card by soldering 100 Ohm resistors to the 0603 footprints next to the RJ45 connector.
The card was permanently modded for NT mode by cutting all 4 traces going to the RJ45 line (but after the transformer) and flipping the RX/TX pairs with enameled copper wire.
This (as well as the termination) doesn't need to be done on the card, but it's very convenient.

This external clock input is terminated with a 50 ohm resistor (actually 51 ohm) in parallel, which is then fed through a 100n AC coupling ceramic capacitor into the CLKIN pin on the chip. It's accessible on one side of the crystal oscillator.
This mod loads the crystal oscillator so much, that the card will stop working without external clock input attached! Detaching the 100n cap from the crystal oscillator will make it start again.
A high-quality, low phase noise (low jitter), high precision time source with 12.288 MHz (12288000 Hz) is required. The "Mini Precision GPS Reference Clock" from Leo Bodnar has shown to be pretty reliable so far.

Experimental test setup - Software

mISDN kernel modules need to be blacklisted (hfcpci, etc.) needs to be installed, laforge/trunkdev branch ! needs to be installed, laforge/trunkdev branch ! needs to be installed, laforge/trunkdev branch !
asterisk and asterisk-dahdi need to be installed (be careful, the latter will install dahdi via DKMS, you'll need to disable that and/or reinstall dahdi-linux from retronetworking!)

zaphfc driver needs to be loaded with nt_modes=0 parameter to force NT mode:

modprobe zaphfc nt_modes=0
modprobe dahdi-trunkdev

Then, the trunkdev needs to be created manually (for now):

dahdi_trunkdev create octoi


octoi-client 10013
 local-bind 3333
 account username
  mode dahdi-trunkdev
  dahdi-trunkdev name octoi
  dahdi-trunkdev line-number 0
 interface 0 dahdi-trunkdev
  trunkdev-name octoi
  line 0
   mode e1oip


# Span 1: ZTHFC1 "HFC-S PCI A ISDN card 0 [NT] " (MASTER)
# termtype: nt

# Span 2: trunkdev/octoi/0 "Virtual trunk octoi span 0" 
# termtype: te

# Global data

loadzone        = de
defaultzone     = de





internationalprefix = 00
nationalprefix = 0


#include dahdi-channels.conf


; Span 1: ZTHFC1 "HFC-S PCI A ISDN card 0 [NT] " (MASTER) AMI/CCS
switchtype = euroisdn
signalling = bri_net_ptmp
channel => 1-2
context = default
group = 63

switchtype = euroisdn
signalling = pri_cpe
channel => 4-18,20-33
context = default
group = 63

/etc/asterisk/extensions.lua (remember to change your phone prefix in the CALLERID, otherwise the PortMaster won't like you):
Asterisk has a strange data corruption issue when not using "tkTK" flags, which will prohibit bridging (because those flags force DTMF reception). Needs further investigation!

extensions = {
    ["from-hfc"] = {
        ["_X."] = function(context, extension)
            channel.CALLERID("all"):set(string.format("%s <%s>", "HFC", '0306503' .. 1234))
            app.dial("Dahdi/g12/"..extension, 100, "tkTK")
    ["from-octoi"] = {
        ["_X."] = function(context, extension)
            app.dial("Dahdi/g11/"..extension, 100, "tkTK")
    hangup = {
        s = function(context, extension)
            app.verbose("WARNING: Unknown call!")

    default = {
        include = {"hangup"};

    public = {
        -- ATTENTION: If your Asterisk is connected to the internet and you do
        -- not have allowguest=no in sip.conf, everybody out there may use your
        -- public context without authentication.  In that case you want to
        -- double check which services you offer to the world.
        include = {"hangup"};

hints = {
    default = {
        ["1234"] = "SIP/1234";

Experimental test setup - Results

Seems to be working well, X.75, PPP over ISDN (2 B-channel bonding/MLPPP) and voice calls all work very well:

More testing (bit error rate, signalling, modem calls, video calls) needs to be done.

Files (3)
IMG_3554.JPG View IMG_3554.JPG 2.89 MB manawyrm, 08/13/2022 01:07 AM
IMG_4904.JPG View IMG_4904.JPG 4.54 MB manawyrm, 08/13/2022 01:23 AM
IMG_4900.JPG View IMG_4900.JPG 2.84 MB manawyrm, 08/13/2022 01:24 AM

Updated by manawyrm over 1 year ago · 5 revisions

Add picture from clipboard (Maximum size: 48.8 MB)