freeswitch/libs/freetdm
Stefan Knoblich a856d81a06 ftmod_misdn: More reworking of b-channel audio tx handling.
Use the amount of audio data received in misdn_read() to determine how many
bytes we need to send to the b-channel (= how much free space is left
in the b-channel tx queue). (This is how libosmo-abis and LCR handle it too.)

A pipe is used as a poll()-able audio tx buffer (filled in misdn_write()):
FTDM_WRITE wait requests are currently poll()-ed on the input side of the pipe,
whereas FTDM_READ and _EVENT requests are poll()-ed on the b-channel socket itself.

For every N-bytes of audio data read from the b-channel in misdn_read(),
we try to get as much out of the tx pipe, convert it into the ISDN_P_B_RAW
format and send it to the b-channel socket.

If there's less than N-bytes left in the pipe, we fill the remaining buffer
with silence to avoid buffer underflows.

B-Channel handling overview:

  - misdn_wait(FTDM_WRITE) on audio pipe

  - misdn_write() put audio data into pipe

  - misdn_wait(FTDM_READ) for next incoming mISDN
    message on b-channel socket

  - misdn_read() handle mISDN event, for PH_DATA_IND:

      - Write data into channel buffer and convert
        to a/u-law using misdn_convert_audio_bits()

      - Try to fetch N-bytes from audio pipe

      - If not enough bytes in pipe: fill remaining space with silence

      - Convert audio to raw format

      - Send to b-channel (PH_DATA_REQ)

Known problems / bugs / further investigation:

   1. Bridge aborted by "Write Buffer 0 bytes Failed!" error from switch_core_io.c.
      This is "fixed" by _not_ setting the b-channel sockfd to non-blocking mode.

   2. Audio glitches (maybe caused by FTDM_WRITE misdn_wait() handling or blocking I/O on sockfd?)

   3. misdn_read() EBUSY error messages from sending data to b-channel sockfd after enabling channel.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-03-28 23:49:55 +02:00
..
build FreeTDM: Buildsystem cleanup 2010-11-01 02:13:27 +01:00
conf freetdm - ISDN added Q.931 timers 2012-01-03 14:11:47 -05:00
docs freetdm: added documentation regarding ftdm open known issues 2011-08-27 00:19:09 -04:00
mod_freetdm freetdm: Try to resolve OPENZAP-173 2012-03-19 09:20:44 -04:00
msvc Merge remote branch 'smgfs/master' 2011-03-06 22:11:39 -05:00
sample freetdm: remove remaining references to boost (sample code, visual studio project references) 2011-02-24 19:26:40 -05:00
src ftmod_misdn: More reworking of b-channel audio tx handling. 2012-03-28 23:49:55 +02:00
.gitignore JANITOR-10 - Thanks Peter 2011-03-17 08:34:00 -05:00
.update commenting this out completely until a better solution is implemented. also FYI you should be refreshing .update on each commit that changes the lib or any of its mods to force a rebuild from the top level 2012-02-03 15:23:46 -06:00
AUTHORS convert to automake (still not really using automake in a useful way) 2009-02-03 04:51:53 +00:00
CMakeLists.txt created cmake files for freetdm 2010-10-06 17:51:29 -03:00
ChangeLog convert to automake (still not really using automake in a useful way) 2009-02-03 04:51:53 +00:00
Makefile.am FreeTDM: Rework libpri detection code to accept a custom installation prefix. 2011-10-26 19:41:07 +02:00
NEWS convert to automake (still not really using automake in a useful way) 2009-02-03 04:51:53 +00:00
README freetdm: add mkrelease.sh script 2010-09-30 17:58:25 -04:00
TODO freetdm: added threaded media to the TODO 2011-01-21 10:51:34 -05:00
acinclude.m4 FreeTDM: Add ax_compiler_vendor.m4 to acinclude.m4 2011-11-01 15:37:51 +01:00
bootstrap freetdm: use /bin/sh and not /bin/bash in the bootstrap script 2011-01-06 09:51:17 -05:00
configure.ac FreeTDM: Rework libpri detection code to accept a custom installation prefix. 2011-10-26 19:41:07 +02:00
configure.gnu fix configure --srcdir for freetdm 2010-12-10 14:56:29 -05:00
cyginstall.sh freetdm: add WIN32_LEAN_AND_MEAN fix 2011-01-27 17:27:50 -05:00
freetdm.2008.sln freetdm: remove remaining references to boost (sample code, visual studio project references) 2011-02-24 19:26:40 -05:00
freetdm.2010.sln freetdm: remove remaining references to boost (sample code, visual studio project references) 2011-02-24 19:26:40 -05:00
freetdm.pc.in [FreeTDM] Add modulesdir to freetdm.pc.in 2010-07-05 23:54:33 +02:00
mkrelease.sh freetdm: fixes to mkrelease.sh 2011-03-11 17:36:42 -05:00
ozrename.sh Linux renaming from openzap to freetdm 2010-01-15 19:22:49 +00:00
ozreplace.sh added ozreplace.sh handy script 2010-02-09 19:25:26 +00:00

README

FreeTDM
http://wiki.freeswitch.org/wiki/FreeTDM