Merge branch 'master' of ssh://git.freeswitch.org/freeswitch

This commit is contained in:
Stefan Knoblich 2010-11-10 00:48:59 +01:00
commit cc8d790cfd
43 changed files with 2106 additions and 622 deletions

244
libs/freetdm/CMakeLists.txt Normal file
View File

@ -0,0 +1,244 @@
#
# cmake file that generate build files for freetdm.
# this automatically includes the tests and also
# mod_freetdm
#
# Arnaldo M Pereira <arnaldo@sangoma.com>
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(freetdm)
ADD_SUBDIRECTORY(sample)
ADD_SUBDIRECTORY(mod_freetdm)
# includes
SET(freetdm_INCLUDES
${PROJECT_SOURCE_DIR}/src/include
${PROJECT_SOURCE_DIR}/src/isdn/include
${PROJECT_SOURCE_DIR}/src/include/private
${PROJECT_SOURCE_DIR}/src/ftmod/ftmod_sangoma_boost
)
INCLUDE_DIRECTORIES(${freetdm_INCLUDES})
LINK_DIRECTORIES(${freetdm_BINARY_DIR})
# optional includes
IF(DEFINED SNGSS7)
SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_ss7)
ENDIF(DEFINED SNGSS7)
IF(DEFINED SNGISDN)
SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_isdn)
ENDIF(DEFINED SNGISDN)
# definitions / CFLAGS
ADD_DEFINITIONS(-DFTDM_CONFIG_DIR="/FIXME" -DFTDM_MOD_DIR="/FIXME")
IF(DEFINED WIN32)
ADD_DEFINITIONS(-DFREETDM_EXPORTS -DTELETONE_EXPORTS -DMOD_EXPORTS -DDLL_EXPORTS)
ENDIF(DEFINED WIN32)
IF(DEFINED SNGISDN)
SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_isdn)
ENDIF(DEFINED SNGISDN)
# lib sources
SET(freetdm_SOURCES
${PROJECT_SOURCE_DIR}/src/hashtable.c
${PROJECT_SOURCE_DIR}/src/hashtable_itr.c
${PROJECT_SOURCE_DIR}/src/ftdm_io.c
${PROJECT_SOURCE_DIR}/src/ftdm_queue.c
${PROJECT_SOURCE_DIR}/src/ftdm_sched.c
${PROJECT_SOURCE_DIR}/src/ftdm_call_utils.c
${PROJECT_SOURCE_DIR}/src/ftdm_config.c
${PROJECT_SOURCE_DIR}/src/ftdm_callerid.c
${PROJECT_SOURCE_DIR}/src/fsk.c
${PROJECT_SOURCE_DIR}/src/uart.c
${PROJECT_SOURCE_DIR}/src/g711.c
${PROJECT_SOURCE_DIR}/src/libteletone_detect.c
${PROJECT_SOURCE_DIR}/src/libteletone_generate.c
${PROJECT_SOURCE_DIR}/src/ftdm_buffer.c
${PROJECT_SOURCE_DIR}/src/ftdm_threadmutex.c
${PROJECT_SOURCE_DIR}/src/ftdm_dso.c
${PROJECT_SOURCE_DIR}/src/ftdm_cpu_monitor.c
)
# libfreetdm.so
ADD_LIBRARY(${PROJECT_NAME} SHARED ${freetdm_SOURCES})
IF(NOT DEFINED WIN32)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} m pthread dl)
ENDIF(NOT DEFINED WIN32)
REMOVE_DEFINITIONS(-DLL_EXPORTS)
# tools & tests
IF(NOT DEFINED WIN32)
FOREACH(TOOL testtones testpri testr2 testapp testcid)
ADD_EXECUTABLE(${TOOL} ${PROJECT_SOURCE_DIR}/src/${TOOL}.c)
TARGET_LINK_LIBRARIES(${TOOL} -l${PROJECT_NAME})
ADD_DEPENDENCIES(${TOOL} ${PROJECT_NAME})
ENDFOREACH(TOOL)
ADD_EXECUTABLE(detect_dtmf
${PROJECT_SOURCE_DIR}/src/detect_dtmf.c
${PROJECT_SOURCE_DIR}/src/libteletone_detect.c
)
TARGET_LINK_LIBRARIES(detect_dtmf ${PROJECT_NAME})
ADD_DEPENDENCIES(detect_dtmf ${PROJECT_NAME})
ADD_EXECUTABLE(detect_tones
${PROJECT_SOURCE_DIR}/src/detect_tones.c
${PROJECT_SOURCE_DIR}/src/libteletone_detect.c
)
TARGET_LINK_LIBRARIES(detect_tones ${PROJECT_NAME})
ADD_DEPENDENCIES(detect_tones ${PROJECT_NAME})
ADD_EXECUTABLE(testanalog
${PROJECT_SOURCE_DIR}/src/testanalog.c
)
TARGET_LINK_LIBRARIES(testanalog -l${PROJECT_NAME})
ADD_DEPENDENCIES(testanalog ${PROJECT_NAME})
# optional tests/tools
IF(HAVE_SCTP)
ADD_EXECUTABLE(testboost src/testboost.c)
TARGET_LINK_LIBRARIES(testboost ${PROJECT_NAME})
ENDIF(HAVE_SCTP)
ELSE(NOT DEFINED WIN32)
MESSAGE(WARNING "Not building tools/tests on WIN32 yet.")
ENDIF(NOT DEFINED WIN32)
#
# ftmod modules
#
SET(ftmod_DIR ${PROJECT_SOURCE_DIR}/src/ftmod)
IF(DEFINED WIN32)
SET(ftmod_ADDITIONAL_SOURCES
${PROJECT_SOURCE_DIR}/src/ftdm_io.c
${PROJECT_SOURCE_DIR}/src/ftdm_config.c
${PROJECT_SOURCE_DIR}/src/ftdm_queue.c
${PROJECT_SOURCE_DIR}/src/g711.c
)
SET(module_list skel analog analog_em)
ELSE(DEFINED WIN32)
SET(module_list skel analog analog_em zt)
ENDIF(DEFINED WIN32)
# build default modules
FOREACH(module ${module_list})
ADD_LIBRARY(ftmod_${module} MODULE ${ftmod_DIR}/ftmod_${module}/ftmod_${module}.c ${ftmod_ADDITIONAL_SOURCES})
TARGET_LINK_LIBRARIES(ftmod_${module} ${PROJECT_NAME})
ENDFOREACH(module)
# build isdn ftmod
IF(DEFINED BUILD_FTMOD_ISDN)
SET(ftmod_isdn_SOURCES
${PROJECT_SOURCE_DIR}/src/isdn/EuroISDNStateNT.c
${PROJECT_SOURCE_DIR}/src/isdn/EuroISDNStateTE.c
${PROJECT_SOURCE_DIR}/src/isdn/mfifo.c
${PROJECT_SOURCE_DIR}/src/isdn/Q921.c
${PROJECT_SOURCE_DIR}/src/isdn/Q931api.c
${PROJECT_SOURCE_DIR}/src/isdn/Q931.c
${PROJECT_SOURCE_DIR}/src/isdn/Q931ie.c
${PROJECT_SOURCE_DIR}/src/isdn/Q931mes.c
${PROJECT_SOURCE_DIR}/src/isdn/Q931StateNT.c
${PROJECT_SOURCE_DIR}/src/isdn/Q931StateTE.c
${PROJECT_SOURCE_DIR}/src/isdn/nationalmes.c
${PROJECT_SOURCE_DIR}/src/isdn/nationalStateNT.c
${PROJECT_SOURCE_DIR}/src/isdn/nationalStateTE.c
${PROJECT_SOURCE_DIR}/src/isdn/DMSmes.c
${PROJECT_SOURCE_DIR}/src/isdn/DMSStateNT.c
${PROJECT_SOURCE_DIR}/src/isdn/DMSStateTE.c
${PROJECT_SOURCE_DIR}/src/isdn/5ESSmes.c
${PROJECT_SOURCE_DIR}/src/isdn/5ESSStateNT.c
${PROJECT_SOURCE_DIR}/src/isdn/5ESSStateTE.c
${PROJECT_SOURCE_DIR}/src/isdn/Q932mes.c
${ftmod_DIR}/ftmod_isdn/ftmod_isdn.c
)
IF(NOT DEFINED WIN32)
ADD_DEFINITIONS(-D_GNU_SOURCE)
ENDIF(NOT DEFINED WIN32)
ADD_LIBRARY(ftmod_isdn MODULE ${ftmod_isdn_SOURCES})
TARGET_LINK_LIBRARIES(ftmod_isdn ${PROJECT_NAME})
ENDIF(DEFINED BUILD_FTMOD_ISDN)
# from now on, optionals
IF(DEFINED LIBSANGOMA)
ADD_LIBRARY(ftmod_wanpipe MODULE ${ftmod_DIR}/ftmod_wanpipe/ftmod_wanpipe.c)
IF(DEFINED WIN32)
MESSAGE(WARNING "FIXME: look for wanpipe headers on win32")
ELSE(DEFINED WIN32)
ADD_DEFINITIONS(-D__LINUX__)
INCLUDE_DIRECTORIES(/usr/include/wanpipe)
ENDIF(DEFINED WIN32)
TARGET_LINK_LIBRARIES(ftmod_wanpipe sangoma ${PROJECT_NAME})
ENDIF(DEFINED LIBSANGOMA)
IF(DEFINED HAVE_SCTP)
ADD_LIBRARY(ftmod_sangoma_boost MODULE
${ftmod_DIR}/ftmod_sangoma_boost/sangoma_boost_client.c
${ftmod_DIR}/ftmod_sangoma_boost/ftmod_sangoma_boost.c
)
TARGET_LINK_LIBRARIES(ftmod_sangoma_boost ${PROJECT_NAME})
ENDIF(DEFINED HAVE_SCTP)
IF(DEFINED LIBPRI)
ADD_LIBRARY(ftmod_libpri MODULE
${ftmod_DIR}/ftmod_libpri/libpri_client.c
${ftmod_DIR}/ftmod_libpri/ftmod_libpri.c
)
TARGET_LINK_LIBRARIES(ftmod_libpri ${PROJECT_NAME})
ENDIF(DEFINED LIBPRI)
IF(DEFINED PRITAP)
ADD_LIBRARY(ftmod_pritap MODULE
${ftmod_DIR}/ftmod_pritap/pritap_client.c
${ftmod_DIR}/ftmod_pritap/ftmod_pritap.c
)
TARGET_LINK_LIBRARIES(ftmod_pritap ${PROJECT_NAME} pri)
ENDIF(DEFINED PRITAP)
IF(DEFINED SNGSS7)
ADD_LIBRARY(ftmod_sangoma_ss7 MODULE
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c
${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c
)
IF(NOT DEFINED WIN32)
ADD_DEFINITIONS(-D_GNU_SOURCE)
ENDIF(NOT DEFINED WIN32)
TARGET_LINK_LIBRARIES(ftmod_sangoma_ss7 ${PROJECT_NAME} sng_ss7)
ENDIF(DEFINED SNGSS7)
IF(DEFINED SNGISDN)
ADD_LIBRARY(ftmod_sangoma_isdn MODULE
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c
${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c
)
IF(NOT DEFINED WIN32)
ADD_DEFINITIONS(-D_GNU_SOURCE)
ENDIF(NOT DEFINED WIN32)
TARGET_LINK_LIBRARIES(ftmod_sangoma_isdn ${PROJECT_NAME} sng_isdn)
ENDIF(DEFINED SNGISDN)
IF(DEFINED OPENR2)
ADD_LIBRARY(ftmod_r2 MODULE ${ftmod_DIR}/ftmod_r2/ftmod_r2.c)
TARGET_LINK_LIBRARIES(ftmod_r2 ${PROJECT_NAME} openr2)
ENDIF(DEFINED OPENR2)

View File

@ -7,7 +7,7 @@ cp Debug/mod/*.dll $fsdir/Debug/mod/
cp mod_freetdm/Debug/*.pdb $fsdir/Debug/mod/
cp Debug/*.dll $fsdir/Debug/
cp Debug/*.pdb $fsdir/Debug/
cp Debug/testsangomaboost.exe $fsdir/Debug/
#cp Debug/testsangomaboost.exe $fsdir/Debug/
echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS"
set +x

View File

@ -58,6 +58,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsangomaboost", "msvc\te
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\ftmod\ftmod_sangoma_isdn\ftmod_sangoma_isdn.2008.vcproj", "{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}"
ProjectSection(ProjectDependencies) = postProject
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.2008.vcproj", "{08C3EA27-A51D-47F8-B47D-B189C649CF30}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -119,6 +126,7 @@ Global
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32
{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|x64.ActiveCfg = Release|x64
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.Build.0 = Debug|Win32
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|x64.ActiveCfg = Debug|x64
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32
{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64
@ -146,6 +154,18 @@ Global
{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.Build.0 = Release|Win32
{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.ActiveCfg = Release|x64
{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64
{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32
{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.Build.0 = Debug|Win32
{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|Win32
{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32
{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32
{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32
{08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32
{08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.Build.0 = Debug|Win32
{08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|Win32
{08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32
{08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.Build.0 = Release|Win32
{08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,32 @@
#
# Arnaldo M Pereira <arnaldo@sangoma.com>
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(mod_freetdm)
IF(NOT DEFINED WIN32)
ADD_DEFINITIONS(-g -O2 -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0 -g -ggdb -DPACKAGE_NAME=\"freetdm\" -DPACKAGE_TARNAME=\"freetdm\" -DPACKAGE_VERSION=\"pre-alpha\" -DPACKAGE_STRING=\"freetdm\ pre-alpha\" -DPACKAGE_BUGREPORT=\"bugs@freeswitch.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"libfreetdm\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_LIBDL=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBM=1 -DSIZEOF_LONG=8 -DHAVE_NETINET_SCTP_H=1 -DHAVE_NETDB_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_GETHOSTBYNAME_R=1) # -DDEBUG=/\*\*/)
ENDIF(NOT DEFINED WIN32)
# includes
SET(mod_freetdm_INCLUDES
${PROJECT_SOURCE_DIR}/../src/include
${PROJECT_SOURCE_DIR}/../src/isdn/include
${PROJECT_SOURCE_DIR}/../../libteletone/src
${PROJECT_SOURCE_DIR}/../../../src/include
)
INCLUDE_DIRECTORIES(${mod_freetdm_INCLUDES})
LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/..)
ADD_LIBRARY(${PROJECT_NAME} SHARED mod_freetdm.c)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} freetdm -fPIC -Werror -fvisibility=hidden)
IF(DEFINED WIN32)
SET(EXT lib)
ELSE(DEFINED WIN32)
SET(EXT so)
ENDIF(DEFINED WIN32)
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E rename lib${PROJECT_NAME}.${EXT} ${PROJECT_NAME}.${EXT}
)

View File

@ -2007,6 +2007,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal)
break;
case FTDM_SIGEVENT_PROGRESS:
case FTDM_SIGEVENT_PROGRESS_MEDIA:
{
if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) {
channel = switch_core_session_get_channel(session);

View File

@ -0,0 +1,8 @@
#
# Arnaldo M Pereira <arnaldo@sangoma.com>
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(sample)
ADD_SUBDIRECTORY(boost)
#ADD_SUBDIRECTORY(sched) FIXME: this code doesnt compile

View File

@ -0,0 +1,12 @@
#
# Arnaldo M Pereira <arnaldo@sangoma.com>
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(boost)
IF(NOT DEFINED WIN32)
INCLUDE_DIRECTORIES(/usr/local/freeswitch/include)
ADD_DEFINITIONS(-Wall)
ADD_EXECUTABLE(ftdmstart ftdmstart.c)
TARGET_LINK_LIBRARIES(ftdmstart freetdm)
ENDIF(NOT DEFINED WIN32)

View File

@ -0,0 +1,12 @@
#
# Arnaldo M Pereira <arnaldo@sangoma.com>
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(dso)
IF(NOT DEFINED WIN32)
INCLUDE_DIRECTORIES(/usr/local/freeswitch/include)
ADD_DEFINITIONS(-Wall)
ADD_EXECUTABLE(ftdmload ftdmload.c)
TARGET_LINK_LIBRARIES(ftdmload freetdm)
ENDIF(NOT DEFINED WIN32)

View File

@ -0,0 +1,12 @@
#
# Arnaldo M Pereira <arnaldo@sangoma.com>
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(sched)
IF(NOT DEFINED WIN32)
INCLUDE_DIRECTORIES(/usr/local/freeswitch/include)
ADD_DEFINITIONS(-Wall)
ADD_EXECUTABLE(ftdmsched ftdmsched.c)
TARGET_LINK_LIBRARIES(ftdmsched freetdm)
ENDIF(NOT DEFINED WIN32)

View File

@ -928,12 +928,12 @@ FT_DECLARE(ftdm_status_t) ftdm_span_find(uint32_t id, ftdm_span_t **span)
}
FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms)
FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms, short *poll_events)
{
assert(span->fio != NULL);
if (span->fio->poll_event) {
return span->fio->poll_event(span, ms);
return span->fio->poll_event(span, ms, poll_events);
} else {
ftdm_log(FTDM_LOG_ERROR, "poll_event method not implemented in module %s!", span->fio->name);
}

View File

@ -34,6 +34,40 @@
#include "private/ftdm_core.h"
#ifdef __WINDOWS__
struct ftdm_timezone {
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
int gettimeofday(struct timeval *tv, struct ftdm_timezone *tz)
{
FILETIME ft;
unsigned __int64 tmpres = 0;
static int tzflag;
if (NULL != tv) {
GetSystemTimeAsFileTime(&ft);
tmpres |= ft.dwHighDateTime;
tmpres <<= 32;
tmpres |= ft.dwLowDateTime;
/*converting file time to unix epoch */
tmpres /= 10; /*convert into microseconds */
tmpres -= DELTA_EPOCH_IN_MICROSECS;
tv->tv_sec = (long) (tmpres / 1000000UL);
tv->tv_usec = (long) (tmpres % 1000000UL);
}
if (NULL != tz) {
if (!tzflag) {
_tzset();
tzflag++;
}
tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight;
}
return 0;
}
#endif /* __WINDOWS__ */
typedef struct ftdm_timer ftdm_timer_t;
static struct {
@ -55,9 +89,7 @@ struct ftdm_sched {
struct ftdm_timer {
char name[80];
ftdm_timer_id_t id;
#if defined(__linux__) || defined(__FreeBSD__)
struct timeval time;
#endif
void *usrdata;
ftdm_sched_callback_t callback;
ftdm_timer_t *next;
@ -234,7 +266,6 @@ failed:
FT_DECLARE(ftdm_status_t) ftdm_sched_run(ftdm_sched_t *sched)
{
ftdm_status_t status = FTDM_FAIL;
#if defined(__linux__) || defined(__FreeBSD__)
ftdm_timer_t *runtimer;
ftdm_timer_t *timer;
ftdm_sched_callback_t callback;
@ -300,10 +331,6 @@ tryagain:
done:
ftdm_mutex_unlock(sched->mutex);
#else
ftdm_log(FTDM_LOG_CRIT, "Not implemented in this platform\n");
status = FTDM_NOTIMPL;
#endif
#ifdef __WINDOWS__
UNREFERENCED_PARAMETER(sched);
#endif
@ -315,7 +342,6 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name
int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_id_t *timerid)
{
ftdm_status_t status = FTDM_FAIL;
#if defined(__linux__) || defined(__FreeBSD__)
struct timeval now;
int rc = 0;
ftdm_timer_t *newtimer;
@ -378,10 +404,6 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name
done:
ftdm_mutex_unlock(sched->mutex);
#else
ftdm_log(FTDM_LOG_CRIT, "Not implemented in this platform\n");
status = FTDM_NOTIMPL;
#endif
#ifdef __WINDOWS__
UNREFERENCED_PARAMETER(sched);
UNREFERENCED_PARAMETER(name);
@ -396,7 +418,6 @@ done:
FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *sched, int32_t *timeto)
{
ftdm_status_t status = FTDM_FAIL;
#if defined(__linux__) || defined(__FreeBSD__)
int res = -1;
int ms = 0;
struct timeval currtime;
@ -445,10 +466,6 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *
done:
ftdm_mutex_unlock(sched->mutex);
#else
ftdm_log(FTDM_LOG_ERROR, "Implement me!\n");
status = FTDM_NOTIMPL;
#endif
#ifdef __WINDOWS__
UNREFERENCED_PARAMETER(timeto);
UNREFERENCED_PARAMETER(sched);

View File

@ -966,7 +966,7 @@ static void *ftdm_analog_run(ftdm_thread_t *me, void *obj)
int waitms = 1000;
ftdm_status_t status;
if ((status = ftdm_span_poll_event(span, waitms)) != FTDM_FAIL) {
if ((status = ftdm_span_poll_event(span, waitms, NULL)) != FTDM_FAIL) {
errs = 0;
}

View File

@ -657,7 +657,7 @@ static void *ftdm_analog_em_run(ftdm_thread_t *me, void *obj)
int waitms = 10;
ftdm_status_t status;
status = ftdm_span_poll_event(span, waitms);
status = ftdm_span_poll_event(span, waitms, NULL);
switch(status) {
case FTDM_SUCCESS:

View File

@ -1741,7 +1741,7 @@ static __inline__ void check_events(ftdm_span_t *span)
{
ftdm_status_t status;
status = ftdm_span_poll_event(span, 5);
status = ftdm_span_poll_event(span, 5, NULL);
switch(status) {
case FTDM_SUCCESS:

View File

@ -909,7 +909,11 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e
*/
static __inline__ void check_events(ftdm_span_t *span)
{
switch (ftdm_span_poll_event(span, 5)) {
ftdm_status_t status;
status = ftdm_span_poll_event(span, 5, NULL);
switch(status) {
case FTDM_SUCCESS:
{
ftdm_event_t *event;

View File

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ftmod_r2"
ProjectGUID="{08C3EA27-A51D-47F8-B47D-B189C649CF30}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;&quot;c:\Program Files\openr2\include\openr2&quot;;&quot;C:\Program Files\openr2\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_R2_EXPORTS;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="freetdm.lib openr2.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;C:\Program Files\openr2\lib&quot;;&quot;$(OutDir)&quot;"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\include;C:\Program Files\openr2\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_R2_EXPORTS;"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\ftmod_r2.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

View File

@ -1725,7 +1725,7 @@ static __inline__ ftdm_status_t check_events(ftdm_span_t *span, int ms_timeout)
ftdm_status_t status;
ftdm_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
status = ftdm_span_poll_event(span, ms_timeout);
status = ftdm_span_poll_event(span, ms_timeout, NULL);
switch(status) {
case FTDM_SUCCESS:

View File

@ -0,0 +1,241 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="ftmod_sangoma_isdn"
ProjectGUID="{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}"
RootNamespace="ftmod_sangoma_isdn"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;C:\Program Files\libsng_isdn\include&quot;;&quot;C:\Program Files\libsng_isdn\include\sng_isdn&quot;;../../include;&quot;C:\Program Files\Sangoma\include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="freetdm.lib libsng_isdn.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;C:\Program Files\libsng_isdn\lib&quot;;&quot;C:\Program Files\Sangoma\api\lib\x86&quot;"
GenerateDebugInformation="true"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\ftmod_sangoma_isdn.h"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_trace.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\ftmod_sangoma_isdn.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_cfg.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_cntrl.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_stack_cfg.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_stack_cntrl.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_stack_hndl.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_stack_out.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_stack_rcv.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_support.c"
>
</File>
<File
RelativePath=".\ftmod_sangoma_isdn_trace.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -300,7 +300,7 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj)
}
/* Poll for events, e.g HW DTMF */
ret_status = ftdm_span_poll_event(span, 0);
ret_status = ftdm_span_poll_event(span, 0, NULL);
switch(ret_status) {
case FTDM_SUCCESS:
{
@ -913,7 +913,8 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init)
}
/* initalize sng_isdn library */
sng_isdn_init(&g_sngisdn_event_interface);
ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n");
return FTDM_SUCCESS;
}
@ -1029,7 +1030,7 @@ static FIO_IO_LOAD_FUNCTION(ftdm_sangoma_isdn_io_init)
return FTDM_SUCCESS;
}
ftdm_module_t ftdm_module =
EX_DECLARE_DATA ftdm_module_t ftdm_module =
{
"sangoma_isdn", /* char name[256]; */
ftdm_sangoma_isdn_io_init, /* fio_io_load_t */

View File

@ -38,8 +38,12 @@
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include "private/ftdm_core.h"
@ -262,16 +266,16 @@ extern ftdm_sngisdn_data_t g_sngisdn_data;
ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span);
/* Support functions */
uint32_t get_unique_suInstId(uint8_t cc_id);
void clear_call_data(sngisdn_chan_data_t *sngisdn_info);
void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info);
FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id);
FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info);
FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info);
void stack_hdr_init(Header *hdr);
void stack_pst_init(Pst *pst);
ftdm_status_t get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data);
ftdm_status_t get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data);
ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail);
FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data);
FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data);
FT_DECLARE_INLINE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail);
/* Outbound Call Control functions */
void sngisdn_snd_setup(ftdm_channel_t *ftdmchan);

View File

@ -198,7 +198,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span)
L1Mngmt cfg;
Pst pst;
S32 d_channel_fd = -1;
int32_t d_channel_fd = -1;
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data;
/* initalize the post structure */
@ -227,7 +227,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span)
for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) {
ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr);
if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) {
d_channel_fd = ftdmchan->sockfd;
d_channel_fd = (int32_t)ftdmchan->sockfd;
break;
}
}

View File

@ -158,7 +158,7 @@ ftdm_status_t sng_isdn_deactivate_phy(ftdm_span_t *span)
ftdm_status_t sng_isdn_activate_cc(ftdm_span_t *span)
{
CcMngmt cntrl;;
CcMngmt cntrl;
Pst pst;
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data;
@ -239,7 +239,7 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra
ftdm_status_t sng_isdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction)
{
InMngmt cntrl;;
InMngmt cntrl;
Pst pst;
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data;

View File

@ -42,7 +42,6 @@ extern ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Displ
/* Remote side transmit a SETUP */
void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
unsigned i;
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
@ -54,6 +53,8 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data;
ConEvnt *conEvnt = &sngisdn_event->event.conEvnt;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n");
ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId);
@ -240,8 +241,6 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
/* Remote side transmit a CONNECT or CONNECT ACK */
void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -249,6 +248,8 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event)
sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info;
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from conStEvnt struct for now */
/* CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; */
@ -312,8 +313,6 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -327,6 +326,8 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event)
CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n");
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing %s (suId:%u suInstId:%u spInstId:%u ces:%d)\n",
@ -444,8 +445,6 @@ sngisdn_process_cnst_ind_end:
void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -454,6 +453,8 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event)
DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId);
ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n");
@ -501,7 +502,6 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -510,6 +510,8 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event)
RelEvnt *relEvnt = &sngisdn_event->event.relEvnt;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing RELEASE/RELEASE COMPLETE (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId);
ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n");
@ -596,7 +598,6 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -604,6 +605,8 @@ void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event)
sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info;
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from infoEvnt struct for now */
/* InfoEvnt *infoEvnt = &sngisdn_event->event.infoEvnt; */
@ -614,7 +617,6 @@ void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -622,6 +624,8 @@ void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event)
sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info;
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/* SsHlEvnt *ssHlEvnt = &sngisdn_event->event.ssHlEvnt; */
@ -632,14 +636,15 @@ void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_sshl_cfm (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info;
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/* SsHlEvnt *ssHlEvnt = &sngisdn_event->event.ssHlEvnt; */
@ -650,7 +655,6 @@ void sngisdn_process_sshl_cfm (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -658,6 +662,8 @@ void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event)
sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info;
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/* RmRtEvnt *rmRtEvnt = &sngisdn_event->event.rmRtEvnt; */
@ -668,7 +674,6 @@ void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -676,6 +681,8 @@ void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event)
sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info;
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/* RmRtEvnt *rmRtEvnt = &sngisdn_event->event.rmRtEvnt; */
@ -686,7 +693,6 @@ void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -694,6 +700,8 @@ void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event)
sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info;
ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/* StaEvnt *staEvnt = &sngisdn_event->event.staEvnt; */
@ -704,8 +712,6 @@ void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -716,6 +722,8 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event)
FacEvnt *facEvnt = &sngisdn_event->event.facEvnt;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId);
switch (ftdmchan->state) {
@ -757,8 +765,6 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -769,6 +775,8 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event)
uint8_t call_state = 0;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) {
call_state = staEvnt->callSte.callGlblSte.val;
}
@ -968,6 +976,18 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event)
//ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
break;
}
break;
case 25: /* Overlap receiving */
switch (ftdmchan->state) {
case FTDM_CHANNEL_STATE_COLLECT:
/* do nothing */
break;
default:
ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state));
//ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
break;
}
break;
default:
ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state));
//ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
@ -982,11 +1002,12 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_srv_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
int16_t dChan = sngisdn_event->dChan;
uint8_t ces = sngisdn_event->ces;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/*Srv *srvEvnt = &sngisdn_event->event.srvEvnt;*/
@ -997,11 +1018,12 @@ void sngisdn_process_srv_ind (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
int16_t dChan = sngisdn_event->dChan;
uint8_t ces = sngisdn_event->ces;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/*Srv *srvEvnt = &sngisdn_event->event.srvEvnt;*/
@ -1012,12 +1034,13 @@ void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
int16_t dChan = sngisdn_event->dChan;
uint8_t ces = sngisdn_event->ces;
uint8_t evntType = sngisdn_event->evntType;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/*Rst *rstEvnt = &sngisdn_event->event.rstEvnt;*/
@ -1029,12 +1052,13 @@ void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event)
void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
int16_t suId = sngisdn_event->suId;
int16_t dChan = sngisdn_event->dChan;
uint8_t ces = sngisdn_event->ces;
uint8_t evntType = sngisdn_event->evntType;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
/* Function does not require any info from ssHlEvnt struct for now */
/*Rst *rstEvnt = &sngisdn_event->event.rstEvnt;*/

View File

@ -43,11 +43,12 @@ extern void get_memory_info(void);
void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
uint8_t bchan_no = 0;
sngisdn_chan_data_t *sngisdn_info = NULL;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Ind on unconfigured cc\n");
ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Ind on unconfigured dchan\n");
@ -103,10 +104,11 @@ void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Co
void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info = NULL;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Cfm on unconfigured cc\n");
ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Cfm on unconfigured dchan\n");
@ -146,10 +148,11 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn
void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info = NULL;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Cnst Ind on unconfigured cc\n");
ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Cnst Ind on unconfigured dchan\n");
@ -196,10 +199,11 @@ void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, C
void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info = NULL;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id");
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
@ -231,9 +235,10 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D
void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info = NULL;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -264,10 +269,11 @@ void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Re
void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -296,9 +302,10 @@ void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, In
void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -329,9 +336,10 @@ void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, S
void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -361,9 +369,10 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S
}
void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -394,9 +403,10 @@ void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, R
void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -427,9 +437,10 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R
void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -460,9 +471,10 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St
void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -493,9 +505,10 @@ void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Fa
void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
sngisdn_chan_data_t *sngisdn_info;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) &&
!(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) {
@ -525,11 +538,12 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St
void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
unsigned i;
sngisdn_span_data_t *signal_data;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_log(FTDM_LOG_INFO, "Received SERVICE IND (dChan:%d ces:%u)\n", dChan, ces);
/* Enqueue the event to each span within the dChan */
@ -554,11 +568,12 @@ void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces
void sngisdn_rcv_srv_cfm (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
unsigned i;
sngisdn_span_data_t *signal_data = NULL;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_log(FTDM_LOG_INFO, "Received SERVICE CFM (dChan:%d ces:%u)\n", dChan, ces);
/* Enqueue the event to each span within the dChan */
@ -582,11 +597,12 @@ void sngisdn_rcv_srv_cfm (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces
void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
unsigned i;
sngisdn_span_data_t *signal_data = NULL;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_log(FTDM_LOG_INFO, "Received RESTART IND (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType);
/* Enqueue the event to each span within the dChan */
@ -612,11 +628,12 @@ void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces
void sngisdn_rcv_rst_cfm (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
unsigned i;
sngisdn_span_data_t *signal_data;
sngisdn_event_data_t *sngisdn_event = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
ftdm_log(FTDM_LOG_INFO, "Received RESTART CFM (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType);
/* Enqueue the event to each span within the dChan */

View File

@ -49,7 +49,7 @@ ftdm_status_t sngisdn_check_free_ids(void);
extern ftdm_sngisdn_data_t g_sngisdn_data;
void get_memory_info(void);
void __inline__ clear_call_data(sngisdn_chan_data_t *sngisdn_info)
FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info)
{
uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id;
@ -66,7 +66,7 @@ void __inline__ clear_call_data(sngisdn_chan_data_t *sngisdn_info)
return;
}
void __inline__ clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info)
FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info)
{
ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing glare data (suId:%d suInstId:%u spInstId:%u actv-suInstId:%u actv-spInstId:%u)\n",
sngisdn_info->glare.suId,
@ -91,9 +91,10 @@ void __inline__ clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info)
}
uint32_t __inline__ get_unique_suInstId(uint8_t cc_id)
FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id)
{
uint32_t suInstId;
ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n");
ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex);
suInstId = g_sngisdn_data.ccs[cc_id].last_suInstId;
@ -112,8 +113,9 @@ uint32_t __inline__ get_unique_suInstId(uint8_t cc_id)
return 0;
}
ftdm_status_t __inline__ get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data)
FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data)
{
ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n");
ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n");
if (g_sngisdn_data.ccs[cc_id].active_suInstIds[suInstId] == NULL) {
@ -123,8 +125,9 @@ ftdm_status_t __inline__ get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInst
return FTDM_SUCCESS;
}
ftdm_status_t __inline__ get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data)
FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data)
{
ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n");
ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n");
if (g_sngisdn_data.ccs[cc_id].active_spInstIds[spInstId] == NULL) {

View File

@ -100,7 +100,7 @@ uint8_t get_bits(uint8_t octet, uint8_t bitLo, uint8_t bitHi)
void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len)
{
int str_len;
int i;
uint32_t i;
uint8_t sapi, cr, ea, tei, ns, nr, pf, p, cmd;
uint8_t frame_format = 0;
@ -649,7 +649,7 @@ uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset
void print_hex_dump(char* str, uint32_t *str_len, uint8_t* data, uint32_t index_start, uint32_t index_end)
{
int k;
uint32_t k;
*str_len += sprintf(&str[*str_len], " [ ");
for(k=index_start; k <= index_end; k++) {
if (k && !(k%32)) {

View File

@ -216,8 +216,23 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val);
ftdm_channel_add_var(ftdmchan, "ss7_cld_nadi", nadi);
/* set the state of the channel to collecting...the rest is done by the chan monitor */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
/* check if a COT test is requested */
if ((siConEvnt->natConInd.eh.pres) &&
(siConEvnt->natConInd.contChkInd.pres) &&
(siConEvnt->natConInd.contChkInd.val)) {
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Found COT Request\n", sngss7_info->circuit->cic);
/* tell the core to loop the channel */
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL);
/* move to in loop state */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
} else {
/* set the state of the channel to collecting...the rest is done by the chan monitor */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
}
} /* if (channel is usable */
@ -256,6 +271,9 @@ handle_glare:
default: /* should not have gotten an IAM while in this state */
SS7_ERROR_CHAN(ftdmchan, "Got IAM on channel in invalid state(%s)...reset!\n", ftdm_channel_state2str (ftdmchan->state));
/* reset the cic */
sngss7_set_flag(sngss7_info, FLAG_RESET_TX);
/* move the state of the channel to RESTART to force a reset */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
@ -292,6 +310,7 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/**************************************************************************/
case (ADDRCMPLT):
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ACM\n", sngss7_info->circuit->cic);
switch (ftdmchan->state) {
/**********************************************************************/
case FTDM_CHANNEL_STATE_DIALING:
@ -315,14 +334,22 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
}
break;
break;
/**********************************************************************/
default: /* incorrect state...reset the CIC */
SS7_ERROR_CHAN(ftdmchan, "RX ACM in invalid state :%s...resetting CIC\n",
ftdm_channel_state2str (ftdmchan->state));
/* reset the cic */
sngss7_set_flag(sngss7_info, FLAG_RESET_TX);
/* go to RESTART */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS);
break;
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
break;
/**********************************************************************/
} /* switch (ftdmchan->state) */
break;
/**************************************************************************/
case (MODIFY):
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MODIFY\n", sngss7_info->circuit->cic);
@ -354,6 +381,34 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/**************************************************************************/
case (SUBSADDR):
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SAM\n", sngss7_info->circuit->cic);
/* check the channel state */
switch (ftdmchan->state) {
/**********************************************************************/
case (FTDM_CHANNEL_STATE_COLLECT):
/* confirm that the event contains the subsquent number field */
if (siCnStEvnt->subNum.eh.pres && siCnStEvnt->subNum.addrSig.pres) {
/* add the digits to the ftdm channel variable */
append_tknStr_from_sngss7(siCnStEvnt->subNum.addrSig,
ftdmchan->caller_data.dnis.digits,
siCnStEvnt->subNum.oddEven);
} else {
SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in SAM!%s\n", " ");
}
/* go to idle so that collect state is processed again */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
break;
/**********************************************************************/
default:
SS7_ERROR_CHAN(ftdmchan, "RX SAM in invalid state :%s...ignoring\n",
ftdm_channel_state2str (ftdmchan->state));
break;
/**********************************************************************/
} /* switch (ftdmchan->state) */
break;
/**************************************************************************/
case (EXIT):
@ -543,7 +598,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* this is a remote hangup request */
sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
/* move the state of the channel to CANCEL to end the call */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
@ -558,7 +613,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
if (siRelEvnt->causeDgn.causeVal.pres) {
ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val;
} else {
SS7_ERROR("REL does not have a cause code!\n");
SS7_ERROR("REL does not have a cause ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);code!\n");
ftdmchan->caller_data.hangup_cause = 0;
}
@ -570,6 +625,23 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
break;
/**************************************************************************/
case FTDM_CHANNEL_STATE_IN_LOOP:
/* inform the core to unloop the channel*/
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
/* since we need to acknowledge the hang up set the flag for remote release */
sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);
/* go to hangup complete to send the RLC */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
/* save the call info for the RLC */
sngss7_info->suInstId = get_unique_id();
sngss7_info->spInstId = spInstId;
break;
/**************************************************************************/
default:
/* throw the reset flag */
@ -830,7 +902,7 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
break;
/**************************************************************************/
case SIT_STA_CONTCHK: /* continuity check */
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx COT start\n", sngss7_info->circuit->cic);
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CCR start\n", sngss7_info->circuit->cic);
handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);
break;
/**************************************************************************/
@ -840,7 +912,7 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
break;
/**************************************************************************/
case SIT_STA_STPCONTIN: /* stop continuity */
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx COT stop\n", sngss7_info->circuit->cic);
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CCR stop\n", sngss7_info->circuit->cic);
handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);
break;
/**************************************************************************/
@ -1225,7 +1297,7 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci
/* open the channel if it is not open */
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) {
if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) {
SS7_ERROR("Failed to open CIC %d for COT test!\n", sngss7_info->circuit->cic);
SS7_ERROR("Failed to open CIC %d for CCR test!\n", sngss7_info->circuit->cic);
/* KONRAD FIX ME */
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return FTDM_FAIL;
@ -1238,15 +1310,6 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci
/* switch to the IN_LOOP state */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
/* store the sngss7 ids */
if (suInstId == 0) {
sngss7_info->suInstId = get_unique_id();
} else {
sngss7_info->suInstId = suInstId;
}
sngss7_info->spInstId = spInstId;
sngss7_info->globalFlg = globalFlg;
/* unlock the channel again before we exit */
ftdm_mutex_unlock(ftdmchan->mutex);
@ -1290,6 +1353,38 @@ ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit,
{
SS7_FUNC_TRACE_ENTER(__FUNCTION__);
sngss7_chan_data_t *sngss7_info = NULL;
ftdm_channel_t *ftdmchan = NULL;
/* get the ftdmchan and ss7_chan_data from the circuit */
if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) {
SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return FTDM_FAIL;
}
/* lock the channel */
ftdm_mutex_lock(ftdmchan->mutex);
switch (ftdmchan->state) {
/**************************************************************************/
case (FTDM_CHANNEL_STATE_IN_LOOP):
/* tell the core to stop looping the channel */
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
/* exit out of the LOOP state and go to collect */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
break;
/**************************************************************************/
default:
/* exit out of the LOOP state to the last state */
ftdm_set_state_locked(ftdmchan, ftdmchan->last_state);
break;
/**************************************************************************/
} /* switch (ftdmchan->state) */
if ( (siStaEvnt->contInd.eh.pres > 0) && (siStaEvnt->contInd.contInd.pres > 0)) {
SS7_INFO("Continuity Test result for CIC = %d (span %d, chan %d) is: \"%s\"\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
@ -1300,13 +1395,13 @@ ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit,
SS7_ERROR("Recieved Continuity report containing no results!\n");
}
/* unlock the channel again before we exit */
ftdm_mutex_unlock(ftdmchan->mutex);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return FTDM_SUCCESS;
}
/******************************************************************************/
/******************************************************************************/
ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt)
{
@ -1575,7 +1670,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP);
/* go to DOWN */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
/*ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/
break;
/**********************************************************************/

View File

@ -79,7 +79,7 @@ ftdm_state_map_t sangoma_ss7_state_map = {
ZSD_INBOUND,
ZSM_UNACCEPTABLE,
{FTDM_CHANNEL_STATE_IDLE, FTDM_END},
{FTDM_CHANNEL_STATE_RESTART, FTDM_END}
{FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_COLLECT, FTDM_END}
},
{
ZSD_INBOUND,
@ -93,14 +93,16 @@ ftdm_state_map_t sangoma_ss7_state_map = {
ZSM_UNACCEPTABLE,
{FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END},
{FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART,
FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN, FTDM_END}
FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN,
FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}
},
{
ZSD_INBOUND,
ZSM_UNACCEPTABLE,
{FTDM_CHANNEL_STATE_COLLECT, FTDM_END},
{FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART,
FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_RING, FTDM_END}
FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_RING,
FTDM_CHANNEL_STATE_IDLE, FTDM_END}
},
{
ZSD_INBOUND,
@ -526,29 +528,32 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING);
} else {
SS7_INFO_CHAN(ftdmchan,"Received %d out of %d so far: %s...starting T35\n",
i,
g_ftdm_sngss7_data.min_digits,
ftdmchan->caller_data.dnis.digits);
/* start ISUP t35 */
if (ftdm_sched_timer (sngss7_info->t35.sched,
"t35",
sngss7_info->t35.beat,
sngss7_info->t35.callback,
&sngss7_info->t35,
&sngss7_info->t35.hb_timer_id)) {
SS7_ERROR ("Unable to schedule timer, hanging up call!\n");
ftdmchan->caller_data.hangup_cause = 41;
/* set the flag to indicate this hangup is started from the local side */
sngss7_set_flag (sngss7_info, FLAG_LOCAL_REL);
/* end the call */
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
} /* if (ftdm_sched_timer(sngss7_info->t35.sched, */
/* if we are coming from idle state then we have already been here once before */
if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) {
SS7_INFO_CHAN(ftdmchan,"Received %d out of %d so far: %s...starting T35\n",
i,
g_ftdm_sngss7_data.min_digits,
ftdmchan->caller_data.dnis.digits);
/* start ISUP t35 */
if (ftdm_sched_timer (sngss7_info->t35.sched,
"t35",
sngss7_info->t35.beat,
sngss7_info->t35.callback,
&sngss7_info->t35,
&sngss7_info->t35.hb_timer_id)) {
SS7_ERROR ("Unable to schedule timer, hanging up call!\n");
ftdmchan->caller_data.hangup_cause = 41;
/* set the flag to indicate this hangup is started from the local side */
sngss7_set_flag (sngss7_info, FLAG_LOCAL_REL);
/* end the call */
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
} /* if (ftdm_sched_timer(sngss7_info->t35.sched, */
} /* if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) */
} /* checking ST/#digits */
break;
@ -966,6 +971,14 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
ftdm_set_state_locked (ftdmchan, ftdmchan->last_state);
break;
/******************************************************************/
case (FTDM_CHANNEL_STATE_IN_LOOP):
/* we screwed up in a COT/CCR, remove the loop */
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
/* go to down */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
break;
/******************************************************************/
default:
/* KONRAD: find out what the cause code should be */
ftdmchan->caller_data.hangup_cause = 41;

View File

@ -581,6 +581,8 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
int check_for_state_change(ftdm_channel_t *ftdmchan);
int check_cics_in_range(sngss7_chan_data_t *sngss7_info);
int check_for_reset(sngss7_chan_data_t *sngss7_info);

View File

@ -335,15 +335,35 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF;
acm.bckCallInd.isdnAccInd.val = ISDNACC_NONISDN;
acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF;
acm.bckCallInd.echoCtrlDevInd.val = 0x1; /* ec device present */
switch (ftdmchan->caller_data.bearer_capability) {
/**********************************************************************/
case (FTDM_BEARER_CAP_SPEECH):
acm.bckCallInd.echoCtrlDevInd.val = 0x1;
break;
/**********************************************************************/
case (FTDM_BEARER_CAP_64K_UNRESTRICTED):
acm.bckCallInd.echoCtrlDevInd.val = 0x0;
break;
/**********************************************************************/
case (FTDM_BEARER_CAP_3_1KHZ_AUDIO):
acm.bckCallInd.echoCtrlDevInd.val = 0x1;
break;
/**********************************************************************/
default:
SS7_ERROR_CHAN(ftdmchan, "Unknown Bearer capability falling back to speech%s\n", " ");
acm.bckCallInd.echoCtrlDevInd.val = 0x1;
break;
/**********************************************************************/
} /* switch (ftdmchan->caller_data.bearer_capability) */
acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF;
acm.bckCallInd.sccpMethInd.val = SCCPMTH_NOIND;
/* fill in any optional parameters */
if (sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA)) {
SS7_DEBUG_CHAN(ftdmchan, "Found ACM_OBCI_BITA flag:0x%X\n", isup_intf->options);
acm.optBckCalInd.eh.pres = PRSNT_NODEF;
acm.optBckCalInd.inbndInfoInd.pres = PRSNT_NODEF;
acm.optBckCalInd.inbndInfoInd.val = sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA);
acm.optBckCalInd.inbndInfoInd.val = 0x1;
acm.optBckCalInd.caFwdMayOcc.pres = PRSNT_DEF;
acm.optBckCalInd.simpleSegmInd.pres = PRSNT_DEF;
acm.optBckCalInd.mlppUserInd.pres = PRSNT_DEF;

View File

@ -44,6 +44,7 @@ uint32_t sngss7_id;
/* PROTOTYPES *****************************************************************/
uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);
uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
@ -131,7 +132,8 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
tmp[0] = ftdm->cid_num.digits[k];
/* check if the digit is a number and that is not null */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
/* move on to the next value */
k++;
tmp[0] = ftdm->cid_num.digits[k];
@ -140,14 +142,15 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
/* check if tmp is null or a digit */
if (tmp[0] != '\0') {
/* push it into the lower nibble */
lower = atoi(&tmp[0]);
lower = strtol(&tmp[0], (char **)NULL, 16);
/* move to the next digit */
k++;
/* grab a digit from the ftdm digits */
tmp[0] = ftdm->cid_num.digits[k];
/* check if the digit is a number and that is not null */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
k++;
tmp[0] = ftdm->cid_num.digits[k];
} /* while(!(isdigit(tmp))) */
@ -155,7 +158,7 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
/* check if tmp is null or a digit */
if (tmp[0] != '\0') {
/* push the digit into the upper nibble */
upper = (atoi(&tmp[0])) << 4;
upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4;
} else {
/* there is no upper ... fill in 0 */
upper = 0x0;
@ -242,7 +245,8 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
tmp[0] = ftdm->dnis.digits[k];
/* check if the digit is a number and that is not null */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
/* move on to the next value */
k++;
tmp[0] = ftdm->dnis.digits[k];
@ -251,14 +255,15 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
/* check if tmp is null or a digit */
if (tmp[0] != '\0') {
/* push it into the lower nibble */
lower = atoi(&tmp[0]);
lower = strtol(&tmp[0], (char **)NULL, 16);
/* move to the next digit */
k++;
/* grab a digit from the ftdm digits */
tmp[0] = ftdm->dnis.digits[k];
/* check if the digit is a number and that is not null */
while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) {
while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
k++;
tmp[0] = ftdm->dnis.digits[k];
} /* while(!(isdigit(tmp))) */
@ -266,7 +271,7 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
/* check if tmp is null or a digit */
if (tmp[0] != '\0') {
/* push the digit into the upper nibble */
upper = (atoi(&tmp[0])) << 4;
upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4;
} else {
/* there is no upper ... fill in ST */
upper = 0xF0;
@ -343,6 +348,49 @@ uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
return 0;
}
/******************************************************************************/
uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
{
int i = 0;
int j = 0;
/* check if the token string is present */
if (str.pres == 1) {
/* find the length of the digits so far */
j = strlen(ftdm);
/* confirm that we found an acceptable length */
if ( j > 25 ) {
SS7_ERROR("string length exceeds maxium value...aborting append!\n");
return 1;
} /* if ( j > 25 ) */
/* copy in digits */
for (i = 0; i < str.len; i++) {
/* convert 4 bit integer to char and copy into lower nibblet*/
sprintf(&ftdm[j], "%X", (str.val[i] & 0x0F));
/* move along */
j++;
/* convert 4 bit integer to char and copy into upper nibblet */
sprintf(&ftdm[j], "%X", ((str.val[i] & 0xF0) >> 4));
/* move along */
j++;
} /* for (i = 0; i < str.len; i++) */
/* if the odd flag is up the last digit is a fake "0" */
if ((oddEven.pres == 1) && (oddEven.val == 1)) {
ftdm[j-1] = '\0';
} else {
ftdm[j] = '\0';
} /* if ((oddEven.pres == 1) && (oddEven.val == 1)) */
} else {
SS7_ERROR("Asked to copy tknStr that is not present!\n");
return 1;
} /* if (str.pres == 1) */
return 0;
}
/******************************************************************************/
int check_for_state_change(ftdm_channel_t *ftdmchan)
{
@ -940,6 +988,7 @@ ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int ty
/* confirm it is a digit */
if (!isdigit(tmp[0])) {
SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
/* move to the next character in subAddr */
x++;
@ -1024,6 +1073,7 @@ ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int typ
/* confirm it is a hex digit */
while ((!isxdigit(tmp[0])) && (tmp[0] != '\0')) {
SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
/* move to the next character in subAddr */
x++;
tmp[0] = subAddr[x];
@ -1040,6 +1090,7 @@ ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int typ
/* check if the digit is a hex digit and that is not null */
while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) {
SS7_INFO("Dropping invalid digit: %c\n", tmp[0]);
x++;
tmp[0] = subAddr[x];
} /* while(!(isdigit(tmp))) */

View File

@ -626,6 +626,10 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t *
mtpLink->mtp3.ssf = SSF_NAT;
} else if (!strcasecmp(parm->val, "int")) {
mtpLink->mtp3.ssf = SSF_INTL;
} else if (!strcasecmp(parm->val, "spare")) {
mtpLink->mtp3.ssf = SSF_SPARE;
} else if (!strcasecmp(parm->val, "res")) {
mtpLink->mtp3.ssf = SSF_RES;
} else {
SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val);
return FTDM_FAIL;
@ -1050,6 +1054,12 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)
} else if (!strcasecmp(parm->val, "int")) {
sng_isup.ssf = SSF_INTL;
sng_isap.ssf = SSF_INTL;
} else if (!strcasecmp(parm->val, "spare")) {
sng_isup.ssf = SSF_SPARE;
sng_isap.ssf = SSF_SPARE;
} else if (!strcasecmp(parm->val, "res")) {
sng_isup.ssf = SSF_RES;
sng_isap.ssf = SSF_RES;
} else {
SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val);
return FTDM_FAIL;

View File

@ -899,11 +899,11 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event)
continue; /* should never happen but happens when shutting down */
}
pfds[j] = ftdmchan->mod_data;
inflags[j] = POLLPRI;
inflags[j] = poll_events ? poll_events[j] : POLLPRI;
#else
memset(&pfds[j], 0, sizeof(pfds[j]));
pfds[j].fd = span->channels[i]->sockfd;
pfds[j].events = POLLPRI;
pfds[j].events = poll_events ? poll_events[j] : POLLPRI;
#endif
/* The driver probably should be able to do this wink/flash/ringing by itself this is sort of a hack to make it work! */
@ -1011,6 +1011,16 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms)
}
alarms = tdm_api.wp_tdm_cmd.fe_alarms;
#endif
#if 1
/* DAVIDY - Temporary fix: in the current trunk of libsangoma, for BRI,
WAN_TE_BIT_ALARM_RED bit is set if the card is in disconnected state, but this has
not been ported to Windows-libsangoma yet */
if (alarms) {
ftdmchan->alarm_flags |= FTDM_ALARM_RED;
alarms = 0;
}
#endif
ftdmchan->alarm_flags = FTDM_ALARM_NONE;
if (alarms & WAN_TE_BIT_ALARM_RED) {

View File

@ -459,7 +459,7 @@ struct ftdm_memory_handler {
#define FIO_CHANNEL_GET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status)
#define FIO_SPAN_SET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t status)
#define FIO_SPAN_GET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t *status)
#define FIO_SPAN_POLL_EVENT_ARGS (ftdm_span_t *span, uint32_t ms)
#define FIO_SPAN_POLL_EVENT_ARGS (ftdm_span_t *span, uint32_t ms, short *poll_events)
#define FIO_SPAN_NEXT_EVENT_ARGS (ftdm_span_t *span, ftdm_event_t **event)
#define FIO_SIGNAL_CB_ARGS (ftdm_sigmsg_t *sigmsg)
#define FIO_EVENT_CB_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t *event)
@ -817,12 +817,13 @@ FT_DECLARE(void) ftdm_channel_flush_dtmf(ftdm_channel_t *ftdmchan);
*
* \param span The span to wait events for
* \param ms Milliseconds timeout
* \param poll_events Array of events to poll for, for each channel on the span
*
* \retval FTDM_SUCCESS success (at least one event available)
* \retval FTDM_TIMEOUT Timed out waiting for events
* \retval FTDM_FAIL failure
*/
FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms);
FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms, short *poll_events);
/*!
* \brief Find a span by its id

View File

@ -70,6 +70,7 @@ extern "C" {
#define FT_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
#define FT_DECLARE_DATA __declspec(dllimport)
#endif
#define FT_DECLARE_INLINE(type) extern __inline__ type /* why extern? see http://support.microsoft.com/kb/123768 */
#define EX_DECLARE_DATA __declspec(dllexport)
#else
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY)
@ -81,6 +82,7 @@ extern "C" {
#define FT_DECLARE_NONSTD(type) type
#define FT_DECLARE_DATA
#endif
#define FT_DECLARE_INLINE(type) __inline__ type
#define EX_DECLARE_DATA
#endif
@ -156,7 +158,12 @@ typedef __int64 int64_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif /* _MSC_VER */
#else /* __WINDOWS__ */
#define FTDM_INVALID_SOCKET -1
typedef int ftdm_socket_t;
#include <stdio.h>

View File

@ -38,7 +38,6 @@ struct stfu_queue {
uint32_t array_size;
uint32_t array_len;
uint32_t wr_len;
uint32_t last_index;
};
typedef struct stfu_queue stfu_queue_t;
@ -47,10 +46,12 @@ struct stfu_instance {
struct stfu_queue b_queue;
struct stfu_queue *in_queue;
struct stfu_queue *out_queue;
uint32_t last_ts;
struct stfu_frame *last_frame;
uint32_t last_wr_ts;
uint32_t last_rd_ts;
uint32_t interval;
uint32_t miss_count;
uint8_t running;
uint32_t max_plc;
};
@ -112,7 +113,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen)
return s;
}
stfu_instance_t *stfu_n_init(uint32_t qlen)
stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc)
{
struct stfu_instance *i;
@ -125,6 +126,13 @@ stfu_instance_t *stfu_n_init(uint32_t qlen)
stfu_n_init_aqueue(&i->b_queue, qlen);
i->in_queue = &i->a_queue;
i->out_queue = &i->b_queue;
if (max_plc) {
i->max_plc = max_plc;
} else {
i->max_plc = qlen / 2;
}
return i;
}
@ -135,10 +143,9 @@ void stfu_n_reset(stfu_instance_t *i)
i->in_queue->array_len = 0;
i->out_queue->array_len = 0;
i->out_queue->wr_len = 0;
i->out_queue->last_index = 0;
i->last_frame = NULL;
i->miss_count = 0;
i->last_ts = 0;
i->running = 0;
i->last_wr_ts = 0;
i->miss_count = 0;
i->interval = 0;
}
@ -197,7 +204,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void
i->in_queue->array_len = 0;
i->out_queue->wr_len = 0;
i->out_queue->last_index = 0;
i->last_frame = NULL;
i->miss_count = 0;
if (stfu_n_process(i, i->out_queue) < 0) {
@ -222,6 +229,8 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void
cplen = sizeof(frame->data);
}
i->last_rd_ts = ts;
memcpy(frame->data, data, cplen);
frame->pt = pt;
frame->ts = ts;
@ -231,88 +240,71 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void
return STFU_IT_WORKED;
}
static int stfu_n_find_frame(stfu_queue_t *queue, uint32_t ts, stfu_frame_t **r_frame, uint32_t *index)
{
uint32_t i = 0;
stfu_frame_t *frame = NULL;
assert(r_frame);
assert(index);
*r_frame = NULL;
for(i = 0; i < queue->array_len; i++) {
frame = &queue->array[i];
if (frame->ts == ts) {
*r_frame = frame;
*index = i;
frame->was_read = 1;
return 1;
}
}
return 0;
}
stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i)
{
uint32_t index, index2;
uint32_t index;
uint32_t should_have = 0;
stfu_frame_t *frame = NULL, *rframe = NULL;
stfu_frame_t *rframe = NULL;
if (((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) {
return NULL;
}
if (i->running) {
should_have = i->last_ts + i->interval;
if (i->last_wr_ts) {
should_have = i->last_wr_ts + i->interval;
} else {
should_have = i->out_queue->array[0].ts;
}
for(index = 0; index < i->out_queue->array_len; index++) {
if (i->out_queue->array[index].was_read) {
continue;
}
frame = &i->out_queue->array[index];
if (frame->ts != should_have) {
unsigned int tried = 0;
for (index2 = 0; index2 < i->out_queue->array_len; index2++) {
if (i->out_queue->array[index2].was_read) {
continue;
}
tried++;
if (i->out_queue->array[index2].ts == should_have) {
rframe = &i->out_queue->array[index2];
i->out_queue->last_index = index2;
goto done;
}
}
for (index2 = 0; index2 < i->in_queue->array_len; index2++) {
if (i->in_queue->array[index2].was_read) {
continue;
}
tried++;
if (i->in_queue->array[index2].ts == should_have) {
rframe = &i->in_queue->array[index2];
goto done;
}
}
i->miss_count++;
if (i->miss_count > 10 || (i->in_queue->array_len == i->in_queue->array_size) ||
tried >= (i->in_queue->array_size + i->out_queue->array_size)) {
i->running = 0;
i->interval = 0;
i->out_queue->wr_len = i->out_queue->array_size;
return NULL;
}
i->last_ts = should_have;
rframe = &i->out_queue->int_frame;
rframe->dlen = i->out_queue->array[i->out_queue->last_index].dlen;
/* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */
memcpy(rframe->data, i->out_queue->array[i->out_queue->last_index].data, rframe->dlen);
rframe->ts = should_have;
i->out_queue->wr_len++;
i->running = 1;
return rframe;
} else {
rframe = &i->out_queue->array[index];
i->out_queue->last_index = index;
goto done;
}
}
done:
if (rframe) {
if (stfu_n_find_frame(i->out_queue, should_have, &rframe, &index) || stfu_n_find_frame(i->in_queue, should_have, &rframe, &index)) {
i->last_frame = rframe;
i->out_queue->wr_len++;
i->last_ts = rframe->ts;
i->last_wr_ts = rframe->ts;
rframe->was_read = 1;
i->running = 1;
i->miss_count = 0;
}
} else {
i->last_wr_ts = should_have;
rframe = &i->out_queue->int_frame;
if (i->last_frame && i->last_frame != rframe) {
rframe->dlen = i->last_frame->dlen;
/* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */
memcpy(rframe->data, i->last_frame->data, rframe->dlen);
}
rframe->ts = should_have;
if (++i->miss_count > i->max_plc) {
i->interval = 0;
i->out_queue->wr_len = i->out_queue->array_size;
i->last_wr_ts = 0;
rframe = NULL;
}
}
return rframe;
}

View File

@ -96,7 +96,7 @@ typedef struct {
void stfu_n_report(stfu_instance_t *i, stfu_report_t *r);
void stfu_n_destroy(stfu_instance_t **i);
stfu_instance_t *stfu_n_init(uint32_t qlen);
stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc);
stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen);
stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last);
stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i);

View File

@ -4324,7 +4324,7 @@ SWITCH_STANDARD_API(uuid_loglevel)
#define SQL_ESCAPE_SYNTAX "<string>"
SWITCH_STANDARD_API(sql_escape)
{
if (zstr(cmd)) {
if (!cmd) {
stream->write_function(stream, "-USAGE: %s\n", SQL_ESCAPE_SYNTAX);
} else {
stream->write_function(stream, "%q", cmd);

View File

@ -308,6 +308,8 @@ struct fifo_node {
int outbound_per_cycle;
char *outbound_name;
outbound_strategy_t outbound_strategy;
int ring_timeout;
int default_lag;
};
typedef struct fifo_node fifo_node_t;
@ -1213,7 +1215,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void
switch_event_create_brackets(h->originate_string, '{', '}', ',', &ovars, &parsed);
switch_event_del_header(ovars, "fifo_outbound_uuid");
if (!h->timeout) h->timeout = 60;
if (!h->timeout) h->timeout = node->ring_timeout;
if (timeout < h->timeout) timeout = h->timeout;
stream.write_function(&stream, "[leg_timeout=%d,fifo_outbound_uuid=%s,fifo_name=%s]%s,",
@ -3518,6 +3520,12 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve
switch_snprintf(tmp, sizeof(buffer), "%u", node->outbound_per_cycle);
switch_xml_set_attr_d(x_fifo, "outbound_per_cycle", tmp);
switch_snprintf(tmp, sizeof(buffer), "%u", node->ring_timeout);
switch_xml_set_attr_d(x_fifo, "ring_timeout", tmp);
switch_snprintf(tmp, sizeof(buffer), "%u", node->default_lag);
switch_xml_set_attr_d(x_fifo, "default_lag", tmp);
switch_snprintf(tmp, sizeof(buffer), "%u", node->outbound_priority);
switch_xml_set_attr_d(x_fifo, "outbound_priority", tmp);
@ -3928,6 +3936,8 @@ static switch_status_t load_config(int reload, int del_all)
int taking_calls_i = 1;
int timeout_i = 60;
int lag_i = 10;
int ring_timeout = 60;
int default_lag = 30;
name = switch_xml_attr(fifo, "name");
@ -3981,11 +3991,29 @@ static switch_status_t load_config(int reload, int del_all)
node->has_outbound = 1;
}
if ((val = switch_xml_attr(fifo, "outbound_ring_timeout"))) {
int tmp = atoi(val);
if (tmp > 10) {
ring_timeout = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid ring_timeout: must be > 10 for queue %s\n", node->name);
}
}
if ((val = switch_xml_attr(fifo, "outbound_default_lag"))) {
int tmp = atoi(val);
if (tmp > 10) {
default_lag = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid default_lag: must be > 10 for queue %s\n", node->name);
}
}
node->ring_timeout = ring_timeout;
node->outbound_per_cycle = outbound_per_cycle;
node->outbound_priority = outbound_priority;
node->default_lag = default_lag;
if (outbound_strategy) {
node->outbound_strategy = parse_strat(outbound_strategy);
node->has_outbound = 1;
@ -4017,14 +4045,14 @@ static switch_status_t load_config(int reload, int del_all)
if (timeout) {
if ((timeout_i = atoi(timeout)) < 10) {
timeout_i = 60;
timeout_i = ring_timeout;
}
}
if (lag) {
if ((lag_i = atoi(lag)) < 0) {
lag_i = 10;
lag_i = default_lag;
}
}

View File

@ -98,6 +98,7 @@ vocallo_codec_t g_codec_map[] =
/* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */
{ SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 },
#endif
{ SNGTC_CODEC_AMR_1220, 96, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 0},
{ -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1 },
};
@ -1227,12 +1228,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
/* Now add as many codec implementations as needed, just up to 40ms for now */
if (g_codec_map[c].autoinit) {
int ms = 0;
for (i = 1; i <= 4; i++) {
if ((g_codec_map[c].maxms/10) < i) {
continue;
ms = i * 10;
if (g_codec_map[c].maxms < ms) {
break;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %dms implementation of codec %s\n", ms, g_codec_map[c].fs_name);
switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */
SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */
@ -1253,7 +1256,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */
}
} else {
/* custom implementation for some codecs */
@ -1369,6 +1371,27 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load)
switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */
break;
case SNGTC_CODEC_AMR_1220:
switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */
SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */
g_codec_map[c].iana_name, /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */
8000, /* samples transferred per second */
8000, /* actual samples transferred per second */
g_codec_map[c].bps, /* bits transferred per second */
g_codec_map[c].mpf, /* microseconds per frame */
g_codec_map[c].spf, /* samples per frame */
g_codec_map[c].bpfd, /* number of bytes per frame decompressed */
g_codec_map[c].bpfc, /* number of bytes per frame compressed */
1, /* number of channels represented */
g_codec_map[c].spf, /* number of frames per network packet (I dont think this is used at all) */
switch_sangoma_init, /* function to initialize a codec session using this implementation */
switch_sangoma_encode, /* function to encode slinear data into encoded data */
switch_sangoma_decode, /* function to decode encoded data into slinear data */
switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */
break;
default:
break;
}

View File

@ -2190,7 +2190,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3
qlen = delay_ms / (interval);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen);
jb = stfu_n_init(qlen);
jb = stfu_n_init(qlen, 0);
write_frame.codec = switch_core_session_get_read_codec(session);

View File

@ -1616,7 +1616,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames)
{
rtp_session->jb = stfu_n_init(queue_frames);
rtp_session->jb = stfu_n_init(queue_frames, 0);
return SWITCH_STATUS_SUCCESS;
}