freeswitch/libs
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
..
apr 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
apr-util unimrcp vs2010 upgrade with revert of incorrect 2008 changes - still not working 2011-06-16 23:26:53 -05:00
broadvoice FS-287: fix bsd shell incompatibility 2010-10-03 05:02:58 -04:00
curl FS-3803 --resolve 2012-01-12 14:17:23 -06:00
esl opps missed an include 2012-03-27 14:24:58 -05:00
freetdm ftmod_misdn: More reworking of b-channel audio tx handling. 2012-03-28 23:49:55 +02:00
iksemel add pkg-config macro 2012-01-11 20:14:17 -05:00
ilbc fix iLBC under windows 2011-02-03 23:46:19 -06:00
js http://jira.freeswitch.org/browse/FS-2976 2011-01-13 09:55:55 -06:00
ldns Tweaks 2011-12-06 22:47:22 +08:00
libcodec2 [3/6] codec2: Rename AUTOMAKE_OPTS to AUTOMAKE_OPTIONS 2011-11-04 14:20:13 +01:00
libdingaling FS-3612 --resolve 2012-01-05 21:27:03 -06:00
libedit fs_cli: make enhanced fs_cli features work on all TERMs 2012-01-31 18:42:47 +00:00
libg722_1 fix basops32.c make the file contain something even if ifdefs fail (which makes suncc fail) 2011-01-03 13:06:25 +01:00
libnatpmp FS-3833 try this 2012-01-24 08:17:17 -06:00
libsndfile remove ignored file from tree 2010-11-24 03:58:22 +00:00
libteletone [5/6] libteletone: Rename AUTOMAKE_OPTS to AUTOMAKE_OPTIONS 2011-11-04 14:21:37 +01:00
miniupnpc try to fix miniwget on suse (FSBUILD-258) 2010-03-08 17:14:04 +00:00
openzap better version of last patch 2011-09-16 13:27:38 -05:00
pcre FS-3766 --resolve 2011-12-16 07:35:05 -05:00
portaudio FS-3472 --resolve 2011-12-15 21:23:19 -05:00
silk [2/6] silk: Rename AUTOMAKE_OPTS to AUTOMAKE_OPTIONS 2011-11-04 14:19:10 +01:00
sofia-sip FS-3957 --resolve 2012-03-01 10:04:07 -06:00
spandsp Various updates to spandsp tests 2012-03-28 23:36:30 +08:00
speex VS2010 add missing project filters 2010-08-19 10:38:54 -05:00
sqlite force an update on sqlite build 2011-08-02 13:05:45 -05:00
srtp [6/6] srtp: Rename AUTOMAKE_OPTS to AUTOMAKE_OPTIONS 2011-11-04 14:22:28 +01:00
stfu FS-3672 --resolve 2011-11-07 10:33:38 -06:00
tiff-3.8.2 add empty dir 2010-03-30 14:25:13 -04:00
unimrcp FS-3648 --resolve 2011-12-15 16:55:10 -05:00
win32 FS-3997 --resolve 2012-03-14 09:26:32 -05:00
xmlrpc-c merge code from xml-rpc trunk - fix xml-rpc not terminating on windows on fs unload - only effect windows build 2011-01-11 09:40:59 -06:00
yaml FSBUILD-249 2010-02-23 22:56:54 +00:00
.gitignore revert patch that breaks build. 2011-11-03 12:28:18 -04:00