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
2012-03-24 04:52:58 +00:00
2009-02-11 02:53:31 +00:00
2012-03-19 18:05:44 +01:00
2012-03-14 19:00:26 +00:00
2009-02-13 23:33:36 +00:00
2008-05-14 20:39:43 +00:00
2009-12-17 18:33:45 +00:00
2012-03-28 16:00:11 -05:00
2010-04-01 21:00:45 -04:00
2012-03-16 04:14:21 +00:00
2011-08-31 17:08:11 +02:00
2009-10-02 14:44:16 +00:00
2012-03-24 04:52:58 +00:00
2010-01-23 20:19:18 +00:00
2011-07-12 14:35:53 -05:00
2009-11-18 19:42:00 +00:00
2012-03-06 13:41:40 -06:00
2006-12-17 01:01:09 +00:00
2012-03-26 10:45:43 -05:00
add
2011-10-21 10:15:15 -05:00
Description
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
Multiple Licenses 268 MiB
Languages
C 64.4%
C++ 21.8%
JavaScript 4.7%
Assembly 2%
Makefile 1%
Other 5.4%