Project

General

Profile

Trunkdev-S0-Adapter » History » Version 4

manawyrm, 08/13/2022 10:41 AM

1 1 manawyrm
h1. Trunkdev-S0-Adapter
2
3
Using osmo-e1d's trunkdev functionality, osmo-e1d can provide OCTOI as a virtual E1 / PRI line to DAHDI on a Linux machine.
4
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.
5
6
h3. Experimental test setup - Hardware
7
8
Fujitsu Futro S900 thin client with CologneChip HFC-S PCI ISDN card (NT mode capable)
9 3 manawyrm
10
!{width:40%}IMG_4900.JPG!
11
12 1 manawyrm
The HFC-S card needs numerous mods: 
13
- External clock input
14
- 100 ohm termination
15
- NT/TE selection (aka RX/TX flip)
16
17
100 ohm termination could be achieved directly on the card by soldering 100 Ohm resistors to the 0603 footprints next to the RJ45 connector.
18
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. 
19
This (as well as the termination) doesn't need to be done on the card, but it's very convenient. 
20
21
!{width:40%}IMG_3554.JPG!
22
23
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. 
24
_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.
25 2 manawyrm
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. 
26
27
h3. Experimental test setup - Software
28
29
mISDN kernel modules need to be blacklisted (hfcpci, etc.)
30
https://gitea.osmocom.org/retronetworking/dahdi-linux needs to be installed, *laforge/trunkdev branch* !
31
https://gitea.osmocom.org/retronetworking/dahdi-tools needs to be installed.
32
https://gitea.osmocom.org/retronetworking/osmo-e1d/ needs to be installed, *laforge/trunkdev branch* !
33
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!)
34
35
zaphfc driver needs to be loaded with nt_modes=0 parameter to force NT mode:
36
<pre><code class="bash">
37
modprobe zaphfc nt_modes=0
38
modprobe dahdi-trunkdev
39
</code></pre>
40
41
Then, the trunkdev needs to be created manually (for now):
42
<pre><code class="shell">
43 4 manawyrm
dahdi_trunkdev create octoi
44 2 manawyrm
</code></pre> 
45
46
47
osmo-e1d.cfg: 
48
<pre><code class="bash">
49
octoi-client 123.123.123.123 10013
50
 local-bind 0.0.0.0 3333
51
 account username
52
  mode dahdi-trunkdev
53
  dahdi-trunkdev name octoi
54
  dahdi-trunkdev line-number 0
55
e1d
56
 interface 0 dahdi-trunkdev
57
  trunkdev-name octoi
58
  line 0
59
   mode e1oip
60
</code></pre>
61
62
/etc/dahdi/system.conf: 
63
<pre><code class="ini">
64
# Span 1: ZTHFC1 "HFC-S PCI A ISDN card 0 [NT] " (MASTER)
65
span=1,0,0,ccs,ami
66
# termtype: nt
67
bchan=1-2
68
hardhdlc=3
69
70
# Span 2: trunkdev/octoi/0 "Virtual trunk octoi span 0"
71
span=2,1,0,ccs,hdb3,crc4
72
# termtype: te
73
bchan=4-18,20-34
74
dchan=19
75
76
# Global data
77
78
loadzone        = de
79
defaultzone     = de
80
</code></pre>
81
82
/etc/asterisk/chan_dahdi.conf:
83
<pre><code class="r">
84
[trunkgroups]
85
86
[channels]
87
language=de
88
switchtype=euroisdn
89
90
91
echocancel=no
92
echocancelwhenbridged=no
93
94
95
pridialplan=unknown
96
prilocaldialplan=unknown
97
internationalprefix = 00
98
nationalprefix = 0
99
100
overlapdial=yes
101
102
#include dahdi-channels.conf
103
</code></pre>
104
105
/etc/asterisk/dahdi-channels.conf:
106
<pre><code class="r">
107
; Span 1: ZTHFC1 "HFC-S PCI A ISDN card 0 [NT] " (MASTER) AMI/CCS
108
group=0,11
109
context=from-hfc
110
switchtype = euroisdn
111
signalling = bri_net_ptmp
112
channel => 1-2
113
context = default
114
group = 63
115
116
group=0,12
117
context=from-octoi
118
switchtype = euroisdn
119
signalling = pri_cpe
120
channel => 4-18,20-33
121
context = default
122
group = 63
123
</code></pre>
124
125
/etc/asterisk/extensions.lua (remember to change your phone prefix in the CALLERID, otherwise the PortMaster won't like you):
126
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!
127
<pre><code class="lua">
128
extensions = {
129
	["from-hfc"] = {
130
		["_X."] = function(context, extension)
131
			app.dumpChan()
132
			channel.CALLERID("all"):set(string.format("%s <%s>", "HFC", '0306503' .. 1234))
133
			app.dial("Dahdi/g12/"..extension, 100, "tkTK")
134
		end;
135
	};
136
	["from-octoi"] = {
137
		["_X."] = function(context, extension)
138
			app.dumpChan()
139
			app.dial("Dahdi/g11/"..extension, 100, "tkTK")
140
		end;
141
	};
142
	hangup = {
143
		s = function(context, extension)
144
			app.verbose("WARNING: Unknown call!")
145
			app.hangup()
146
		end;
147
148
	};
149
	default = {
150
		include = {"hangup"};
151
	};
152
153
	public = {
154
		-- ATTENTION: If your Asterisk is connected to the internet and you do
155
		-- not have allowguest=no in sip.conf, everybody out there may use your
156
		-- public context without authentication.  In that case you want to
157
		-- double check which services you offer to the world.
158
		include = {"hangup"};
159
	};
160
}
161
162
hints = {
163
	default = {
164
		["1234"] = "SIP/1234";
165
	};
166
}
167
</code></pre>
168 3 manawyrm
169
h3. Experimental test setup - Results
170
171
Seems to be working well, X.75, PPP over ISDN (2 B-channel bonding/MLPPP) and voice calls all work very well:  
172
!{width:40%}IMG_4904.JPG!
173
More testing (bit error rate, signalling, modem calls, video calls) needs to be done.
Add picture from clipboard (Maximum size: 48.8 MB)