Re: Using mISDN with recent asterisk and Debian

Thomas Hilber <i4l-usr-O/[email protected]> Tue, 22 Aug 2017 16:19:48 +0200
Newsgroups gmane.linux.isdn.i4l.user
Message-ID <[email protected]>
Hi, 

On Fri, Aug 18, 2017 at 01:30:04PM +0200, Simone Piccardi wrote:
> I'm searching some info on how to use mISDN with recent version of Asterisk
> (14.6.0) and Debian (stretch). I have a supported HFC card (that is working
> with the old mISDN before 2.6).

I've just upgraded my DAHDI based PBX (running 2 TE and 2 NT ports flawlessly
for years) from Debian Wheezy (7.11) to now run Debian Stretch (9.1). 
ISDN hardware is a HFC-4S (Swyx 4xS0 SX2 QuadBri PCI). Even with the standard 
packages/ sources provided by Stretch it's relatively easy to get your 
equipment running in either TE or NT mode. At least on my type of hardware.
 
What I basically did is:

- install some minimal Debian (I prefer debootstrap for this as provided by [1])
- after this continue with:

apt-get build-dep dahdi-source
apt-get install dahdi-source
apt-get install asterisk-dahdi
m-a -t a-i dahdi

- this automatically pulls all packages needed for a working DAHDI system
- including compilation of all required kernel drivers 
- don't forget to manually blacklist some drivers:

blacklist hfcpci
blacklist hfcsusb
blacklist hfcmulti
blacklist mISDN_dsp
blacklist mISDN_core
blacklist mISDN_dsp_oslec
blacklist zaphfc 

- reboot
- check the correct driver has been loaded (wcb4xxp in my case)
- after this continue with:

dahdi_hardware -v 
dahdi_genconf -v
[...]

dependent on your particular HFC-card you eventually must patch the wcb4xxp
driver to allow manual NT/TE mode configuration. Some cards obviously don't
offer the jumper positions to the software for autoprobing.

The maintainers of the driver did not manage to integrate the well known 
patch into the upstream version until today. Don't ask me why. 
Older versions of the patch are found in [2]. A version directly
applicable to the Debian Stretch standard driver source (from above) is 
attached.

Generating a working setup (in particular setting up some key config files)
including:

/etc/dahdi/assigned-spans.conf
/etc/dahdi/system.conf
/etc/asterisk/dahdi-channels.conf

could be a bit tricky. Probably this is not the right mailing list to
discuss this. My new system runs quite well after a few hours of
testing. I think it will take over the work of my old Wheezy HFC system soon.

Cheers
  Thomas

1: http://wiki.debian.org/Debootstrap
2: https://issues.asterisk.org/jira/browse/DAHLIN-203

_______________________________________________
isdn4linux mailing list
[email protected]
https://www.isdn4linux.de/mailman/listinfo/isdn4linux
te_nt_override.2111.patch (text/x-diff, 1.9 KB)
--- drivers/dahdi/wcb4xxp/base.c	2016-09-21 20:55:56.000000000 +0200
+++ drivers/dahdi/wcb4xxp/base.c	2017-08-22 11:38:04.503915133 +0200
@@ -85,6 +85,7 @@
 
 static int debug = 0;
 static int spanfilter = 0xFF; /* Bitmap for ports 1-8 */
+static int te_nt_override = 0xFFFF;
 #ifdef LOOPBACK_SUPPORTED
 static int loopback = 0;
 #endif
@@ -1887,7 +1888,9 @@
 		 * jumper is the oposite of how other HFC-4S cards do:
 		 * - In B410P: GPIO=0: NT
 		 * - In Junghanns: GPIO=0: TE
+         * - Set NT/TE mode manually if software can't determine jumper position
 		 */
+if (te_nt_override == 0xFFFF) {
 		if (IS_B410P(b4)) {
 			nt = ((gpio & (1 << (i + 4))) == 0);
 		} else if (IS_GEN2(b4)) {
@@ -1907,12 +1910,15 @@
 		} else {
 			nt = ((gpio & (1 << (i + 4))) != 0);
 		}
-
-		s->te_mode = !nt;
-
 		dev_info(&b4->pdev->dev,
 			 "Port %d: %s mode\n", i + 1, (nt ? "NT" : "TE"));
-
+} else {
+        nt = !((te_nt_override >> i) & 1);
+        dev_info(&b4->pdev->dev,
+                 "Port %d: %s mode manually set\n",
+                 i + 1, (nt ? "NT" : "TE"));
+}
+		s->te_mode = !nt;
 	}
 }
 
@@ -3728,6 +3734,7 @@
 module_param(vpmsupport, int, S_IRUGO);
 module_param(timer_1_ms, int, S_IRUGO | S_IWUSR);
 module_param(timer_3_ms, int, S_IRUGO | S_IWUSR);
+module_param(te_nt_override, int, S_IRUGO | S_IWUSR);
 module_param(companding, charp, S_IRUGO);
 module_param(persistentlayer1, int, S_IRUGO | S_IWUSR);
 
@@ -3743,6 +3750,7 @@
 MODULE_PARM_DESC(vpmsupport, "1=enable hardware EC, 0=disable hardware EC");
 MODULE_PARM_DESC(timer_1_ms, "NT: msec to wait for link activation, TE: unused.");
 MODULE_PARM_DESC(timer_3_ms, "TE: msec to wait for link activation, NT: unused.");
+MODULE_PARM_DESC(te_nt_override, "TE/NT mode override bitmap for spans. 1 - TE, 0 - NT");
 MODULE_PARM_DESC(companding, "Change the companding to \"alaw\" or \"ulaw\""\
 				"(alaw by default)");