Commit Graph

5895 Commits

Author SHA1 Message Date
Anthony Minessale 0bd1f0fa6f forgot one 2012-09-11 14:31:34 -04:00
Anthony Minessale 511df4bf2e make tiff work on older automistake 2012-09-11 14:31:34 -04:00
Anthony Minessale 55dc6eb492 fix build (need make spandsp-reconf) 2012-09-11 14:31:34 -04:00
Jeff Lenk dd5046257a tiff add missing file required by makefile.am 2012-09-11 14:31:34 -04:00
David Yat Sin 33e7cb060d freetdm - ISDN:Fix for invalidating logical span id = 0 for nfas 2012-09-11 14:31:33 -04:00
Steve Underwood a2bb0dea4e Added a free space function to the T.31 modem in spandsp, so the app doesn't
need to probe around inside the modem.
2012-09-11 14:31:33 -04:00
Stefan Knoblich 3a4440ee68 ftmod_libpri: Major rework of runtime thread, lpwrap event loop, restart b-channel handling and some new features.
Add per b-channel private data (ftdm_libpri_b_data_t), move the q.931 libpri
call pointer into it and use channel->call_data to make it accessible.

Use ftdm_channel_wait() instead of select() to wait for I/O events on
the D-Channel and rewrite the timeout handling, adding support for custom
timers that can be added to the b-channel private data and started/stopped
with lpwrap_timer_start()/_stop().

The (sorted) list of active lpwrap timers is protected by the timer_mutex,
which is initialized in the now unified lpwrap_init_pri() (see below) and
destroyed in the new lpwrap_destroy_pri() function.

Unify lpwrap_init_pri() and lpwrap_init_bri(). Use the span type to select
BRI/PRI and Point-to-Point vs. Multipoint settings.

Use the new custom lpwrap timer API to implement T302 (aka overlap receiving
digit timeout). The default T302 timeout is 3000 miliseconds and can be set
via the "digit_timeout" or "t302" span configuration parameter
(0 = disable timer, valid range = 3000 ... 30000 miliseconds).

The lpwrap_pri_init() changes made it neccessarry to rewrite the span runtime
thread event loop. The d-channel initialization and libpri event handler
registration have been moved out of the event loop. The b-channel restart
handling in the event loop has been left as-is, pending a further clean up in
the future.

Rename on_info() to on_information() and add a new on_keypad_digit() event
handler to convert incoming KEYPAD DIGIT messages to channel DTMF events
(only useful on BRI PTMP NT-mode).

The channel restart handling has been improved to distinguish between locally
triggered and restarts caused by the remote end (= incoming RESTART messages).
Restarts on the D-Channel now use pri_restart(), causing a Q.921 reset on
the span.

Large patch, i'd have loved to split this into smaller pieces and actually
test some of the bits more toroughly (restart handling), but some people
are f*cking annoying, so here it is.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
2012-09-11 14:31:33 -04:00
Steve Underwood 95081e1e5c Tweak 2012-09-11 14:31:33 -04:00
Steve Underwood 3cbcf9edf6 Changed tiff-4.0.2 to demand autoconf 2.63 or later (which is common) rather
than 2.64 (which is currently a lot less common). This change seems to have
no negative effect, but allows builds to succeed on things like Centos.
2012-09-11 14:31:33 -04:00
Jeff Lenk c5e33e7951 FS-4566 --resolve Show fs_cli banner in color(windows) 2012-09-11 14:31:33 -04:00
Steve Underwood 45baa4459a tiffconf.h is generated by a build, so it shouldn't have been put in the repo. 2012-09-11 14:31:33 -04:00
Steve Underwood b93e53fa9f Start introducing some meaningful TIFF/FX stuff 2012-09-11 14:31:33 -04:00
Steve Underwood 6cd47a92da Handle the TIFF/FX better now we have tiff-4.0.2 in the repo. 2012-09-11 14:31:33 -04:00
Steve Underwood 69fc6e8ffe The tiff-4.0.2 distribution's configure.ac seems to have two lines missing
AC_PROG_LIBTOOL
m4_include(m4/acinclude.m4)
Adding these and taking out all the Makefile.in files from the tiff-4.0.2
directory seems to sort out the build issues.
2012-09-11 14:31:33 -04:00
Steve Underwood 9cd04b2e1d None of the tiff-4.0.2 Makefile.in files were added before, and it built OK for
me. That's not happening for everyone, so let's add them all, just like the
tiff-4.0.2 distribution package.
2012-09-11 14:31:33 -04:00
Jeff Lenk 55409dcbb6 windows fix for libtiff on last commit 2012-09-11 14:31:33 -04:00
Steve Underwood f70e58d7df Those damn tiff-3.8.2 entries seem to be everywhere 2012-09-11 14:31:33 -04:00
Steve Underwood b10aeca36c Patched the new libtiff-4.0.2 code to support TIFF/FX tags and the extra
compression and colour profile codes that go with them.
2012-09-11 14:31:32 -04:00
Steve Underwood 7aadf1d392 Added missing .update file for tiff-4.0.2
Hopefully made the last of the tiff-3.8.2 -> tiff-4.0.2 changes in the build files
2012-09-11 14:31:32 -04:00
Steve Underwood db994a48bc This should have moved us from tiff-3.8.2 to tiff-4.0.2 . The windows builds
will need rechecking.
2012-09-11 14:31:32 -04:00
Steve Underwood cf73591858 Added tiff-4.0.2 as the first step in moving from libtiff 3.8.2 to libtiff 4.0.2 2012-09-11 14:31:32 -04:00
Steve Underwood 4a1ddf0e4c More cleanups of the FAX modems 2012-09-11 14:31:29 -04:00
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