mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
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>
This commit is contained in:
@@ -760,11 +760,16 @@ FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Stop SIG */
|
||||
status = span->stop(span);
|
||||
if (FTDM_SUCCESS == status) {
|
||||
if (status == FTDM_SUCCESS) {
|
||||
ftdm_clear_flag(span, FTDM_SPAN_STARTED);
|
||||
}
|
||||
|
||||
/* Stop I/O */
|
||||
if (span->fio && span->fio->span_stop) {
|
||||
status = span->fio->span_stop(span);
|
||||
}
|
||||
done:
|
||||
ftdm_mutex_unlock(span->mutex);
|
||||
|
||||
@@ -5309,6 +5314,14 @@ FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Start I/O */
|
||||
if (span->fio && span->fio->span_start) {
|
||||
status = span->fio->span_start(span);
|
||||
if (status != FTDM_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Start SIG */
|
||||
status = ftdm_report_initial_channels_alarms(span);
|
||||
if (status != FTDM_SUCCESS) {
|
||||
goto done;
|
||||
|
Reference in New Issue
Block a user