Commit Graph

5873 Commits

Author SHA1 Message Date
Anthony Minessale 6fcf2cc5a0 fix wrong len in ESL sendMSG method 2012-09-11 14:31:29 -04:00
Steve Underwood d2d7175908 Bring fax_modem handling in the fax_tester code into line with the upstream code 2012-09-11 14:31:29 -04:00
Steve Underwood fb7ee3a7ab This update brings the fax modem handling into line with the upstream code 2012-09-11 14:31:29 -04:00
Steve Underwood 7a2f2aeeb1 More cleanups of fax modem stuff 2012-09-11 14:31:29 -04:00
Jeff Lenk 648297aa27 spandsp windows build fix 2012-09-11 14:31:28 -04:00
Steve Underwood d986926d0e More tweaks to spandsp 2012-09-11 14:31:28 -04:00
Steve Underwood abbdb16173 Tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood 0d9e200144 Tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood 64541c08d2 More tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood 823d59f573 Tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood 48330d913d Tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood c560fe7fbe More tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood 116186a5e5 More tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood dfd4f70e98 More tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood 2a040e1d2c More tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood 8c6e2d20d5 More tweaks 2012-09-11 14:31:28 -04:00
Steve Underwood 308371c8e1 More fax modem tweaks 2012-09-11 14:31:27 -04:00
Steve Underwood 410a83bde1 Tweaks 2012-09-11 14:31:27 -04:00
Steve Underwood f26a4990d7 Various fax_modems.c related improvements 2012-09-11 14:31:27 -04:00
Stefan Knoblich 9ac3e78802 FreeTDM: Remove oz{rename,replace}.sh scripts.
Remnants from the olden days of the big OpenZAP migration.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-09-11 14:31:27 -04:00
Stefan Knoblich 705543c8b4 ftmod_misdn: Use a per-span I/O thread to handle B-channel data.
Move the B-channel message handling into a per-span I/O thread,
to solve most of the problems caused by the intermixed data + control
socket interface of mISDN, missing write poll() support on
mISDN B-channels and the FreeTDM I/O model. This eliminates most of
the audio problems (except for a few minor glitches).

A unix stream socket pair is used as a bi-directional pipe replacement
(the pipe code is still included in this commit, but will be removed later),
with the RX and TX buffer sizes carefully tuned to avoid excessive buffering
(= latency) and a deadlock situation between the write() call in ftdm_write()
and the code in misdn_span_run() that needs a minimum amount of data in the
TX buffer, before sending out a PH_DATA_REQ to the mISDN socket
(see misdn_span_run() comments for more details).

The minimum size for pipes is PAGE_SIZE (4k), which is ~500 ms worth of
audio. A socket pair RX/TX buffer size of 3k, seems to hold a maximum
amount of around 500 bytes data in practice, giving us a much lower
maximum latency than a unix pipe. (The socket pair might be replaced by a
custom ring buffer / fifo data structure to get even more fine grained
control of the maximum latency.)

The newly introduced span_start / span_stop callbacks in
ftdm_io_interface_t are used to start / stop the I/O thread. The callback
functions will wait up to 10 seconds for the thread to successfully
start up or shut down (using a mutex + condition var).

NOTE: Using any of the locking ftdm_span_() functions in the I/O will cause
      a deadlock between the I/O thread (trying to lock span->mutex) and the
      thread calling ftdm_start()/_stop() (holding the span->mutex).
      (The I/O thread currently uses direct span member access to avoid this.)

The I/O thread uses the epoll(7) family of functions for event handling.
An epoll context is created on startup and all B-channel sockets are
registered (READ, PRI and ERR). Before entering the event loop,
the I/O thread will send a signal on the condition variable, to
indicate it has completed the startup procedure.

Incoming b-channel and command pipe events are handled by the event loop.
Payload of incoming PH_DATA_IND frames (= audio data) is sent to the
rx_audio_pipe_in end of the b-channel's socket pair and, if enough data is
available, a PH_DATA_REQ of the same size is sent to the b-channel mISDN socket
to transmit audio.

A MISDN_CMD_STOP command on the event pipe will wake up the I/O thread and
cause it to shut down. All b-channels will be unregistered from the epoll context
and the epoll fd closed. The I/O thread terminates itself after signalling the
successfull shutdown on the condition variable.

TODOs:
    - Move D-Channel into I/O thread too

    - Custom FIFO/ring buffer for data (even lower latency)

    - Improve epoll() code (per-channel struct w/ callback, for epfd.data.ptr)

    - Use mISDN DSP for audio (e.g. tone generator, dtmf detector, echo cancel)

    - Use a per-port / span control socket to execute channel commands
      synchronously, or add misdn_commands (queue?) that can be used that way

    - Name I/O threads 'mISDN-%SPAN_NAME%', e.g. 'mISDN-M_BRI1'
      (= add ftdm_thread_set_namef(thread, fmt, ...) / ftdm_thread_set_name(thread, name))

TL;DR: "tweak", solves "booboo" with audio

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-09-11 14:31:27 -04:00
Jeff Lenk 24813534f0 FS-4219 --resolve 2012-09-11 14:31:27 -04:00
Stefan Knoblich e8d0845376 ftmod_libpri: Implement channel hunting in NT-mode.
Hunt for a free channel for incoming calls that do not
preselect a channel (pevent->ring.channel == -1).

Verify the preselected channel for calls that do specify a channel
and in case the channel is already taken, hunt for a free one,
or abort with an error message (if the preselection was exclusive).

TE-mode channel selection is the same as before
(there's still room for improvement, though, but i'll save that for later).

The MSN/DDI filter code is moved into the TE-mode section (only useful there).

The duplicate ring detection had to be reworked. We now store the
call reference (CRV) in caller_data->call_reference of the selected channel
and do a CRV -> channel look up with find_channel_by_cref()
at the top of on_ring().

NOTE: This is only lightly tested (NT/TE mode), i'd either have to
      write a lot of custom code to check it toroughly or the need for
      a scriptable ISDN stack...

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-09-11 14:31:27 -04:00
Stefan Knoblich f3eb7ef05c ftmod_libpri: Check for '#' key to leave overlap receiving state.
Same as ftmod_isdn, '#' key ends overlap receive and moves the incoming
call to RING state.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-09-11 14:31:27 -04:00
Steve Underwood ddf85356e3 A line got deleted somewhere along the line. I didn't do it, honest.
Its them damn gremlins.
2012-09-11 14:30:50 -04:00
Jeff Lenk f273fc1b9f FS-4526 --resolve 2012-09-11 14:29:58 -04:00
Jeff Lenk 6f2c1d7627 FS-4543 --resolve thanks Peter 2012-09-11 14:29:58 -04:00
Steve Underwood a82b28c37f Fixed a typo in the fixed point image translate code 2012-09-11 14:29:58 -04:00
Anthony Minessale ad1f0a1288 fix color coding to be OS appropriate 2012-09-11 14:29:58 -04:00
Robert Jongbloed bfe4c17743 Updated mod_opal to latest stable OPAL version.
Enhancements to trace logging, include threads and context ID.

Changed default opal_conf.xml to allow more than just G.711 uLaw and not to clutter log file with debug logs.

Added to opal_conf.xml item for "disable-transcoding".

Updated build/buildopal.sh to use correct ./configure items for PTLib, allow for something other than standard install directory for PTLib/OPAL and be able to easily bind to a specific release of PTLib/OPAL.
2012-09-11 14:29:57 -04:00
Anthony Minessale a7fadffc16 FS-4079 FS-4540 please update to this version 2012-09-11 14:29:57 -04:00
Stefan Knoblich c1f4e7f719 FreeTDM: Add span start/stop callbacks to ftdm_io_interface.
Callbacks are invoked from ftdm_span_start/_stop().
I/O is started before SIG and shut down in reverse order.

This is needed for ftmod_misdn, to move the mISDN message handling
into a separate thread (solving the mISDN socket vs. FreeTDM API issues).

With these callbacks, the I/O thread can be started after the span I/O configuration
has been (successfully) completed and stopped before destroying the span.

NOTE: Both SIG and I/O callbacks are called with the span mutex locked,
so threads created or destroyed synchronously in either of the custom
start/stop functions, can not use ftdm_span_*() functions that lock
the span mutex (e.g. ftdm_span_get_channel_count()).

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-09-11 14:29:57 -04:00
Stefan Knoblich 400e6b6447 spandsp: Fix libjpeg checks for --enable-builtin-tiff builds.
The --enable-builtin-tiff option appends libs/tiff-3.8.2/libtiff/libtiff.la
to LIBS, causing the AC_CHECK_LIB([jpeg]...) check to fail, because
libtiff.la does not exist at configure time.

Temporarily store tiff and jpeg libs in TIFF_-/JPEG_LIBS variables and
append them to LIBS after all library checks have run.

Example error output:
    configure:20049: checking for jpeg_start_compress in -ljpeg
    configure:20074: cc -o conftest -O2 -pipe -fno-strict-aliasing    -L/usr/local/lib conftest.c -ljpeg  -lm  /usr/home/ports/net/freeswitch-core-devel/work/freeswitch-1.2.1/libs/tiff-3.8.2/libtiff/libtiff.la >&5
    cc: /usr/home/ports/net/freeswitch-core-devel/work/freeswitch-1.2.1/libs/tiff-3.8.2/libtiff/libtiff.la: No such file or directory

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-09-11 14:29:57 -04:00
Steve Underwood afbdb08fec Improvements to image translation 2012-09-11 14:29:56 -04:00
Anthony Minessale b140bfbf9c stub for mod_html5 2012-09-11 14:29:56 -04:00
Anthony Minessale 35e6368602 libwebsocket inline configure 2012-09-11 14:29:56 -04:00
Anthony Minessale 5a6d3cf43e fix libwebsocket build 2012-09-11 14:29:56 -04:00
Jeff Lenk ffebc6ac9c FS-4504 vs2010 only - plus mod_sofia fix - anybody want to help with 2008 2012-09-11 14:29:56 -04:00
Michael Jerris c920135658 add ws 2012-09-11 14:28:22 -04:00
David Yat Sin 83d0f5055e Fix for NFAS when one of the d-channels are down 2012-09-11 14:25:07 -04:00
Jeff Lenk cdc614a48f FS-4517 --resolve 2012-08-14 00:26:29 -05:00
Jeff Lenk ab6e36283b FS-4219 --resolve 2012-08-14 00:26:24 -05:00
Steve Underwood 790c4d6eaa Improvements to T.4 end of image handling, and the related tests.
A lot of tiny tidy up edits
2012-08-14 00:25:50 -05:00
Steve Underwood 812dacfb5c Various little tweaks
A bug in end of image handling fixed, which could mean some T.85 images would
screw up.
2012-08-14 00:25:22 -05:00
Stefan Knoblich 8a98baa696 ftmod_isdn: Avoid stack smashing buffer overflow in isdn_tones_run().
The len variable can, in certain situations (large burst of incoming non-SLIN audio),
exceed the size of the on-stack frame buffer, which causes ftdm_buffer_read_loop() to
overwrite the dt_buffer pointer.

Use ftdm_min() to make sure len (after conversion to SLIN units) isn't larger
than the frame buffer size.

Also adds are couple more code comments.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-08-14 00:25:07 -05:00
Jeff Lenk d1db17b486 FS-4219 -- resolve windows version string. thanks Peter 2012-08-14 00:25:02 -05:00
Jeff Lenk 3a478a61aa FS-4504 vs2008 pro still need express 2012-08-14 00:24:42 -05:00
Steve Underwood adece695cd Fixed a misplaced #endif that only causes trouble when you hit the right
combination
2012-08-14 00:24:02 -05:00
Steve Underwood ae321660d9 A couple of typos in spandsp
Improvements to image flattening in spandsp's image translate code
2012-08-14 00:23:56 -05:00
Jeff Lenk f11d471ff6 FS-4504 - tweak 2012-08-14 00:23:26 -05:00