Project

General

Profile

Trunkdev-S0-Adapter » History » Revision 5

Revision 4 (manawyrm, 08/13/2022 10:41 AM) → Revision 5/7 (manawyrm, 08/13/2022 11:55 AM)

h1. Trunkdev-S0-Adapter 

 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. 

 h3. Experimental test setup - Hardware 

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

 !{width:40%}IMG_4900.JPG! 

 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.  

 !{width:40%}IMG_3554.JPG! 

 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.  

 h3. Experimental test setup - Software 

 mISDN kernel modules need to be blacklisted (hfcpci, etc.) 
 https://gitea.osmocom.org/retronetworking/dahdi-linux needs to be installed, *laforge/trunkdev branch* ! 
 https://gitea.osmocom.org/retronetworking/dahdi-tools needs to be installed, *laforge/trunkdev branch* ! installed. 
 https://gitea.osmocom.org/retronetworking/osmo-e1d/ 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: 
 <pre><code class="bash"> 
 modprobe zaphfc nt_modes=0 
 modprobe dahdi-trunkdev 
 </code></pre> 

 Then, the trunkdev needs to be created manually (for now): 
 <pre><code class="shell"> 
 dahdi_trunkdev create octoi 
 </code></pre>  


 osmo-e1d.cfg:  
 <pre><code class="bash"> 
 octoi-client 123.123.123.123 10013 
  local-bind 0.0.0.0 3333 
  account username 
   mode dahdi-trunkdev 
   dahdi-trunkdev name octoi 
   dahdi-trunkdev line-number 0 
 e1d 
  interface 0 dahdi-trunkdev 
   trunkdev-name octoi 
   line 0 
    mode e1oip 
 </code></pre> 

 /etc/dahdi/system.conf:  
 <pre><code class="ini"> 
 # Span 1: ZTHFC1 "HFC-S PCI A ISDN card 0 [NT] " (MASTER) 
 span=1,0,0,ccs,ami 
 # termtype: nt 
 bchan=1-2 
 hardhdlc=3 

 # Span 2: trunkdev/octoi/0 "Virtual trunk octoi span 0" 
 span=2,1,0,ccs,hdb3,crc4 
 # termtype: te 
 bchan=4-18,20-34 
 dchan=19 

 # Global data 

 loadzone          = de 
 defaultzone       = de 
 </code></pre> 

 /etc/asterisk/chan_dahdi.conf: 
 <pre><code class="r"> 
 [trunkgroups] 

 [channels] 
 language=de 
 switchtype=euroisdn 


 echocancel=no 
 echocancelwhenbridged=no 


 pridialplan=unknown 
 prilocaldialplan=unknown 
 internationalprefix = 00 
 nationalprefix = 0 

 overlapdial=yes 

 #include dahdi-channels.conf 
 </code></pre> 

 /etc/asterisk/dahdi-channels.conf: 
 <pre><code class="r"> 
 ; Span 1: ZTHFC1 "HFC-S PCI A ISDN card 0 [NT] " (MASTER) AMI/CCS 
 group=0,11 
 context=from-hfc 
 switchtype = euroisdn 
 signalling = bri_net_ptmp 
 channel => 1-2 
 context = default 
 group = 63 

 group=0,12 
 context=from-octoi 
 switchtype = euroisdn 
 signalling = pri_cpe 
 channel => 4-18,20-33 
 context = default 
 group = 63 
 </code></pre> 

 /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! 
 <pre><code class="lua"> 
 extensions = { 
	 ["from-hfc"] = { 
		 ["_X."] = function(context, extension) 
			 app.dumpChan() 
			 channel.CALLERID("all"):set(string.format("%s <%s>", "HFC", '0306503' .. 1234)) 
			 app.dial("Dahdi/g12/"..extension, 100, "tkTK") 
		 end; 
	 }; 
	 ["from-octoi"] = { 
		 ["_X."] = function(context, extension) 
			 app.dumpChan() 
			 app.dial("Dahdi/g11/"..extension, 100, "tkTK") 
		 end; 
	 }; 
	 hangup = { 
		 s = function(context, extension) 
			 app.verbose("WARNING: Unknown call!") 
			 app.hangup() 
		 end; 

	 }; 
	 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"; 
	 }; 
 } 
 </code></pre> 

 h3. 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:   
 !{width:40%}IMG_4904.JPG! 
 More testing (bit error rate, signalling, modem calls, video calls) needs to be done. 
Add picture from clipboard (Maximum size: 48.8 MB)