ftdm_mutex_lock(span->mutex);
/* stop the signaling */
+
+ /* This is a forced stopped */
+ ftdm_clear_flag(span, FTDM_SPAN_NON_STOPPABLE);
+
ftdm_span_stop(span);
/* destroy the channels */
ftdm_status_t status = FTDM_SUCCESS;
ftdm_mutex_lock(span->mutex);
+
+ if (ftdm_test_flag(span, FTDM_SPAN_NON_STOPPABLE)) {
+ status = FTDM_NOTIMPL;
+ goto done;
+ }
if (!ftdm_test_flag(span, FTDM_SPAN_STARTED)) {
status = FTDM_EINVAL;
ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE);
ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE);
ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES);
+ ftdm_set_flag(span, FTDM_SPAN_NON_STOPPABLE);
if (span->trunk_type == FTDM_TRUNK_BRI_PTMP ||
span->trunk_type == FTDM_TRUNK_BRI) {
/* If this flag is set, the signalling module supports jumping directly to state up, without
going through PROGRESS/PROGRESS_MEDIA */
FTDM_SPAN_USE_SKIP_STATES = (1 << 12),
+ /* If this flag is set, then this span cannot be stopped individually, it can only be stopped
+ on freetdm unload */
+ FTDM_SPAN_NON_STOPPABLE = (1 << 13),
} ftdm_span_flag_t;
/*! \brief Channel supported features */