Merge branch 'netborder' of git.sangoma.com:smg_freeswitch into netborder
This commit is contained in:
commit
4551ae51c3
|
@ -49,6 +49,7 @@ if HAVE_SNG_ISDN
|
|||
INCS += -I/usr/include/sng_isdn
|
||||
endif
|
||||
|
||||
# we needed to separate CFLAGS in FTDM_COMPAT_CFLAGS and FTDM_CFLAGS due to -c99 which causes problems with wanpipe headers
|
||||
FTDM_COMPAT_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_COMPAT_CFLAGS@ @DEFS@
|
||||
FTDM_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@
|
||||
COMPILE = $(CC) $(FTDM_CFLAGS)
|
||||
|
@ -183,8 +184,8 @@ ftmod_analog_em_la_LIBADD = libfreetdm.la
|
|||
if HAVE_LIBSANGOMA
|
||||
mod_LTLIBRARIES += ftmod_wanpipe.la
|
||||
ftmod_wanpipe_la_SOURCES = $(SRC)/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
|
||||
#some structures within Wanpipe drivers are not c99 compatible, so we need to compile ftmod_wanpipe
|
||||
#without c99 flags
|
||||
# some structures within Wanpipe drivers are not c99 compatible, so we need to compile ftmod_wanpipe
|
||||
# without c99 flags, use FTDM_COMPAT_CFLAGS instead
|
||||
ftmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(FTDM_COMPAT_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe
|
||||
ftmod_wanpipe_la_LDFLAGS = -shared -module -avoid-version -lsangoma
|
||||
ftmod_wanpipe_la_LIBADD = libfreetdm.la
|
||||
|
|
|
@ -82,7 +82,7 @@ sun)
|
|||
fi
|
||||
;;
|
||||
*)
|
||||
COMP_VENDOR_COMPAT_CFLAGS="-Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
|
||||
COMP_VENDOR_COMPAT_CFLAGS="-Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
|
||||
COMP_VENDOR_CFLAGS="-std=c99 $COMP_VENDOR_COMPAT_CFLAGS"
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
FreeTDM can both notify and set signaling status changes in the different protocols thru a unified interface. More
|
||||
specific details on the C data types and function prototypes are found in freetdm.h
|
||||
|
||||
The API provides the following functions and data types to do it:
|
||||
|
||||
The signaling status in any channel/span is represented thru ftdm_signaling_status_t
|
||||
|
||||
/* The signaling link is down (no d-chans up in the span/group, MFC-R2 bit pattern unidentified) */
|
||||
FTDM_SIG_STATE_DOWN,
|
||||
/* The signaling link is suspended (MFC-R2 bit pattern blocked, PRI maintenance, ss7 blocked?) */
|
||||
FTDM_SIG_STATE_SUSPENDED,
|
||||
/* The signaling link is ready and calls can be placed (ie: d-chan up, MFC-R2 both rx and tx in IDLE) */
|
||||
FTDM_SIG_STATE_UP,
|
||||
/* Invalid status */
|
||||
FTDM_SIG_STATE_INVALID
|
||||
|
||||
Changes in the signaling status are notified to the user using the standard callback notification function provided
|
||||
during configuration using the sigevent type FTDM_SIGEVENT_SIGSTATUS_CHANGED which is sent when the line status changes.
|
||||
|
||||
On startup the signalling status default is FTDM_SIG_STATE_DOWN, and no notification is provided until the state change,
|
||||
so applications must assume the status is down unless told otherwise.
|
||||
|
||||
When ftdm_span_start is called, the signaling stack takes care of attempting to bring the status to UP
|
||||
but it will ultimately depend on the other side too.
|
||||
|
||||
== Setting the signaling status ==
|
||||
|
||||
Users can set the signaling status on a given channel/span thru FreeTDM the following API functions:
|
||||
|
||||
ftdm_channel_set_sig_status
|
||||
ftdm_span_set_sig_status
|
||||
|
||||
If the user calls ftdm_channel_set_sig_status(chan, FTDM_SIG_STATE_SUSPENDED), the signaling stack will try to set
|
||||
the status of the line to the one requested, if successful, it will result in a SIGEVENT_SIGSTATUS_CHANGED notification
|
||||
being sent with status FTDM_SIG_STATE_SUSPENDED.
|
||||
|
||||
** MFC-R2 Signaling Notes **
|
||||
For MFC-R2, calling ftdm_span_start() results in setting the tx CAS bits to IDLE. However, if the rx bits are in BLOCKED state
|
||||
the signaling status will be reported as SUSPENDED.
|
||||
|
||||
If the user calls ftdm_channel_set_sig_status(chan, SUSPENDED), the tx CAS bits will be set to BLOCKED and, if, the current rx bits
|
||||
are IDLE then a SIGEVENT_SIGSTATUS_CHANGED with state SUSPENDED will be sent. If the rx bits are already in blocked then no further
|
||||
SIGEVENT_SIGSTATUS_CHANGED notification is needed (because it was already sent when the rx bits were initially detected as BLOCKED).
|
||||
|
||||
If the user calls ftdm_channel_set_sig_status(chan, UP), the tx CAS bits will be set to IDLE and, if, the current rx bits
|
||||
are IDLE, then SIGEVENT_SIGSTATUS_CHANGED with state UP will be sent. If the rx bits are BLOCKED, then no notification is
|
||||
sent at all until the rx bits change.
|
||||
|
||||
Bottom line is, for MFC-R2, SIGEVENT_SIGSTATUS_CHANGED UP is only sent to the user when both the rx and tx bits are in IDLE, and
|
||||
SIGEVENT_SIGSTATUS_CHANGED SUSPENDED is only sent to the user when any of the rx or tx bits are in BLOCKED.
|
||||
|
||||
== Getting the signaling status ==
|
||||
Users can get the signaling status on a given channel/span thru FreeTDM the following API functions:
|
||||
|
||||
ftdm_channel_get_sig_status
|
||||
ftdm_span_get_sig_status
|
||||
|
||||
The line status returned should be the same as the last time a SIGEVENT_SIGSTATUS_CHANGED was reported.
|
||||
|
|
@ -5117,9 +5117,16 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const
|
|||
FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span)
|
||||
{
|
||||
if (span->start) {
|
||||
/* check the alarms again before starting the signaling module
|
||||
this works-around some I/O modules (netborder I/O module) that cannot
|
||||
check the alarm status before during configuration because the spans are
|
||||
not really started yet at the I/O level */
|
||||
if (ftdm_set_channels_alarms(span, 0) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "%d: Failed to set channel alarms\n", span->span_id);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
return span->start(span);
|
||||
}
|
||||
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -468,6 +468,7 @@ static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status)
|
|||
ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
ftdm_r2_set_chan_sig_status(ftdmchan, status);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -528,6 +529,7 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status)
|
|||
openr2_chan_set_idle(r2chan);
|
||||
ftdm_log_chan_msg(fchan, FTDM_LOG_NOTICE, "Channel idle\n");
|
||||
}
|
||||
ftdm_r2_set_chan_sig_status(fchan, status);
|
||||
}
|
||||
ftdm_iterator_free(chaniter);
|
||||
return FTDM_SUCCESS;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include "private/ftdm_core.h"
|
||||
#include "ftmod_zt.h"
|
||||
|
||||
|
|
|
@ -367,6 +367,7 @@ typedef struct ftdm_channel_config {
|
|||
|
||||
/*!
|
||||
\brief Signaling status on a given span or specific channel on protocols that support it
|
||||
\note see docs/sigstatus.txt for more extensive documentation on signaling status
|
||||
*/
|
||||
typedef enum {
|
||||
/* The signaling link is down (no d-chans up in the span/group, MFC-R2 bit pattern unidentified) */
|
||||
|
|
|
@ -39,9 +39,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(__USE_BSD)
|
||||
#define __USE_BSD
|
||||
#endif
|
||||
|
||||
#include "ftdm_declare.h"
|
||||
#include "ftdm_threadmutex.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
|
|
|
@ -49,12 +49,6 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(__linux__) && !defined(__USE_BSD)
|
||||
#define __USE_BSD
|
||||
#endif
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "freetdm.h"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue