FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unl
Go to file
Stefan Knoblich 09a61f5025 [FreeTDM] Add (experimental) ftmod_misdn
Add I/O plugin for mISDN stack that is included in the linux kernel
since version 2.6.27.

The in-kernel mISDN stack uses a socket based interface (AF_ISDN),
data and control commands are exchanged via datagram messages.

This makes writing a driver that doesn't use a separate (per-span)
thread to handle all incoming events a bit tricky, because responses
to control messages and incoming data are mixed and interfacing
with the synchronous FreeTDM I/O API is problematic.

B(*)/D-channel handling:

The current version uses misdn_wait() to poll() for activity on
the non-blocking channel sockets and misdn_read() to receive and
handle all pending events up to the first PH_DATA_IND (data) message
(which is what the caller of the read method is actually after).

In case no data has been received, misdn_read() returns FTDM_SUCCESS
with *datalen = 0, which is OK for all the signalling modules tested
(ftmod_libpri and (out-of-tree) ftmod_isdn).

To send data, misdn_write() is called, which just sends a PH_DATA_REQ
message to the mISDN channel socket.

(*) B-channels use a per-channel timerfd as a timing reference for
'ready-for-write' poll()ing in misdn_wait().

This is a workaround for a limitation of mISDN sockets, which do not
support POLLOUT waiting on b-channel sockets (in a useful way).

Sending/receiving of data works the same way as on d-channels, otherwise.

The module has received some minimal testing using a beronet
single-port HFC E1 and a HFC4-S quad-port BRI card on linux-3.0.x.

--- Limitations ---

 - Only the most basic features have been implemented (alarms,
   sending/receiving data/audio).

 - Spans are limited to E1 and BRI/BRI_PTMP trunk types.

 - D-Channels only work on 16 for PRI and 3 for BRI.

 - NT/TE mode information is not available from freetdm.conf /
   at configure_span()-time so the module assumes TE mode,
   which should be only a problem for cards that can change
   the port configuration (pin-out) from software.

 - Current design (b-channel timerfd / misdn_wait()/_read()/_write())
   should be fine for most SoHo use-cases
   (scalability / cpu usage / timing precision).

--- Requirements ---

 - mISDNif.h header (/usr/include/mISDN/mISDNif.h), provided by mISDNuser
   (http://isdn.eversberg.eu/download/lcr-1.7/mISDNuser-20100525.tar.gz).

 - Linux kernel with mISDN and timerfd enabled (>= 2.6.27)
   and libc with timerfd support.

mISDN options can be found in the:

"Device Drivers" -> "ISDN support" -> "Modular ISDN driver"

section of make menuconfig. Timerfd is usually enabled by default.

The FreeTDM configure script will check for missing mISDNif.h
header and timerfd support and print a message.

You should see the following in the summary screen on success:

	ftmod_misdn........................ yes

NOTE: Forcing mISDN support using the "--with-misdn" configure option,
      will cause the configure script to fail on the first missing
      dependency.

--- Usage ---

To use the module, make sure you have mISDN support in the kernel
(kernel modules loaded or kernel with built-in mISDN running),
the "misdn_info" application shipped with mISDNuser will output
a list of available mISDN ports on your system, e.g.:

Found 5 ports
  Port  0 'hfc-4s.1-1':      TE/NT-mode BRI S/T (for phone lines & phones)
                              2 B-channels: 1-2
                                B-protocols: RAW HDLC X75slp
  ...

  Port  4 'hfc-e1.2':        TE/NT-mode PRI E1  (for phone lines & E1 devices)
                             30 B-channels: 1-15 17-31
                                B-protocols: RAW HDLC X75slp

NOTE: ftmod_misdn will print an error message if mISDN support is not available,
      or if there are no ports installed.

- Example freetdm.conf settings

[span misdn BRI_1]
trunk_type => BRI_PTMP
b-channel => 0:1,2
d-channel => 0:3

[span misdn PRI_1]
trunk_type => E1
b-channel => hfc-e1.2:1-15,17-31
d-channel => hfc-e1.2:16

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2011-09-08 00:16:02 +02:00
build add config file and tweak modules.conf.in for mod_cdr_mongodb 2011-09-07 23:57:44 +02:00
clients/flex The new jquery.tmpl wants tmpl() instead of render() 2011-08-22 16:14:23 +02:00
cmake_modules Initial CMAKE file commit 2009-02-11 02:53:31 +00:00
conf add config file and tweak modules.conf.in for mod_cdr_mongodb 2011-09-07 23:57:44 +02:00
debian typo 2011-05-30 16:55:24 +02:00
docs Update ChangeLog through Aug 11 2011-08-31 16:36:51 -07:00
dtd xmllint --dtdvalid freeswitch_dialplan.dtd /usr/local/freeswitch/conf/default_context.xml >>/dev/null 2007-11-01 14:59:32 +00:00
freeswitch.xcodeproj cmake updates 2009-02-13 23:33:36 +00:00
fscomm fix possible bad pointer in global vars (please test) 2011-02-02 16:22:43 -06:00
htdocs add this from CtRiX -- Thanks. 2008-05-14 20:39:43 +00:00
libs [FreeTDM] Add (experimental) ftmod_misdn 2011-09-08 00:16:02 +02:00
patches zrtp tweaks, more coming 2009-12-17 18:33:45 +00:00
scripts Add sound_test.lua utility script (lets you listen to all the sound files in a particular rate/type combo 2011-05-09 16:36:35 -07:00
src add MongoDB CDR module 2011-09-07 23:50:25 +02:00
support-d add 'info threads' to fscore_pb 2011-08-24 15:00:01 -05:00
w32 FS-3378 --resolve Compile FS Core with /O2 flag in VS2010 2011-07-02 16:03:49 -05:00
web add back empty dirs 2010-04-01 21:00:45 -04:00
.gitignore JANITOR-10 - Thanks Peter 2011-03-17 08:34:00 -05:00
.version.in make sure .version is populated on builds from non svn working copies 2009-12-07 10:33:28 +00:00
CMakeLists.txt FSBUILD-192 2009-10-02 14:44:16 +00:00
Freeswitch.2005.unsupported.sln bye bye iax 2010-01-23 20:19:18 +00:00
Freeswitch.2008.express.sln FS-3414 --resolve 2011-07-12 14:35:53 -05:00
Freeswitch.2008.sln FS-3355 --resolve mod_rtmp for windows 2011-06-20 10:03:56 -05:00
Freeswitch.2008.sln.debug.bat merge some changes from joshrivers branch 2009-11-18 15:29:19 +00:00
Freeswitch.2008.sln.release.bat rename 2009-11-18 19:42:00 +00:00
Freeswitch.2010.express.sln VS2010 Express build fixes and remove mod_file_string 2011-03-29 22:22:56 -06:00
Freeswitch.2010.sln FS-3355 --resolve mod_rtmp for windows 2011-06-20 10:03:56 -05:00
INSTALL build progress break everything 2006-12-17 01:01:09 +00:00
Makefile.am Tweak link order of some libs to fix build on gcc platforms that have ld flag "--as-needed" as default. Fixes FS-2873 and FS-2874 2011-09-01 16:42:00 +02:00
acinclude.m4 FS-3182: fix mod_dingaling/iksemel/gnutls link error when using newer autotools 2011-03-25 12:17:25 -05:00
bootstrap.sh final fix to bootstrap.sh 2011-08-31 17:08:11 +02:00
configure.in The format string for size_t is always %zu, don't #error when not able to find it 2011-07-15 11:42:48 -04:00
devel-bootstrap.sh Changed permissions for devel-bootstrap.sh 2010-10-13 14:18:38 -07:00
freeswitch-sounds-en-us-callie.spec bump up sounds version in rpm script 2011-05-22 22:37:50 +02:00
freeswitch-sounds-ru-RU-elena.spec adding spec file for russian soundfiles 2011-07-12 00:00:12 +02:00
freeswitch.spec fedora fixes 2011-08-31 17:09:16 +02:00