mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-12 12:37:05 +00:00
Merge branch 'releases.3.5' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3
Conflicts: .gitignore conf/insideout/autoload_configs/modules.conf.xml conf/vanilla/autoload_configs/modules.conf.xml src/mod/endpoints/mod_sofia/mod_sofia.h src/switch_rtp.c
This commit is contained in:
commit
8b0fbe605c
798 files changed
+62919
-81329
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2007, Anthony Minessale II
|
||||
# Copyright (c) 2007-2012, Anthony Minessale II
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -250,6 +250,14 @@ ftmod_r2_la_LDFLAGS = -shared -module -avoid-version -lopenr2
|
||||
ftmod_r2_la_LIBADD = libfreetdm.la
|
||||
endif
|
||||
|
||||
if HAVE_WAT
|
||||
mod_LTLIBRARIES += ftmod_gsm.la
|
||||
ftmod_gsm_la_SOURCES = $(SRC)/ftmod/ftmod_gsm/ftmod_gsm.c
|
||||
ftmod_gsm_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS)
|
||||
ftmod_gsm_la_LDFLAGS = -shared -module -avoid-version -lwat
|
||||
ftmod_gsm_la_LIBADD = libfreetdm.la
|
||||
endif
|
||||
|
||||
if HAVE_MISDN
|
||||
mod_LTLIBRARIES += ftmod_misdn.la
|
||||
ftmod_misdn_la_SOURCES = $(SRC)/ftmod/ftmod_misdn/ftmod_misdn.c
|
||||
|
||||
+26
-11
@@ -189,6 +189,14 @@ AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [HAVE_OPENR2="yes"])
|
||||
AC_MSG_RESULT([checking whether to build ftmod_r2... ${HAVE_OPENR2}])
|
||||
AM_CONDITIONAL([HAVE_OPENR2], [test "${HAVE_OPENR2}" = "yes"])
|
||||
|
||||
##
|
||||
# WAT GSM stack
|
||||
#
|
||||
HAVE_WAT="no"
|
||||
AC_CHECK_LIB([wat], [wat_version], [HAVE_WAT="yes"])
|
||||
AC_MSG_RESULT([checking whether to build ftmod_wat... ${HAVE_WAT}])
|
||||
AM_CONDITIONAL([HAVE_WAT], [test "${HAVE_WAT}" = "yes"])
|
||||
|
||||
##
|
||||
# Digium libpri (TODO: add checks)
|
||||
#
|
||||
@@ -236,6 +244,21 @@ then
|
||||
AC_MSG_ERROR([libpri not found or unusable (see config.log for details)])]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([whether libpri is too old])
|
||||
AC_PREPROC_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <libpri.h>],
|
||||
[#if !defined(PRI_IO_FUNCS)
|
||||
#error "libpri is lacking PRI_IO_FUNCS"
|
||||
#elif !defined(PRI_NEW_SET_API)
|
||||
#error "libpri is lacking PRI_NEW_SET_API"
|
||||
#endif]
|
||||
)],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_MSG_ERROR([Your version of libpri is too old (pre 1.2), please update!])]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([whether libpri has BRI support])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
@@ -407,22 +430,13 @@ AC_ARG_WITH([misdn],
|
||||
)
|
||||
AS_IF([test "${with_misdn}" != "no"],
|
||||
[AC_MSG_RESULT([${as_nl}<<>> ftmod_misdn (Linux mISDN I/O plugin)])
|
||||
AC_CHECK_FUNCS([timerfd_create],,
|
||||
[AS_IF([test "${with_misdn}" = "yes"],
|
||||
[AC_MSG_ERROR([no timerfd support in libc])],
|
||||
[AC_MSG_NOTICE([no timerfd support in libc])]
|
||||
)]
|
||||
)
|
||||
AC_CHECK_HEADER([mISDN/mISDNif.h],,
|
||||
AC_CHECK_HEADER([mISDN/mISDNif.h],
|
||||
[HAVE_MISDN="yes"],
|
||||
[AS_IF([test "${with_misdn}" = "yes"],
|
||||
[AC_MSG_ERROR([mISDN/mISDNif.h not found])],
|
||||
[AC_MSG_NOTICE([mISDN/mISDNif.h not found])]
|
||||
)],
|
||||
[#include <sys/socket.h>]
|
||||
)
|
||||
AS_IF([test "${ac_cv_func_timerfd_create}" = "yes" -a "${ac_cv_header_mISDN_mISDNif_h}" = "yes"],
|
||||
[HAVE_MISDN="yes"],
|
||||
[AC_MSG_NOTICE([Some required dependencies are missing, module disabled])]
|
||||
)]
|
||||
)
|
||||
AM_CONDITIONAL([HAVE_MISDN], [test "${HAVE_MISDN}" = "yes"])
|
||||
@@ -450,6 +464,7 @@ AC_MSG_RESULT([
|
||||
ftmod_sangoma_isdn................. ${HAVE_SNG_ISDN}
|
||||
ftmod_sangoma_ss7.................. ${HAVE_SNG_SS7}
|
||||
ftmod_r2........................... ${HAVE_OPENR2}
|
||||
ftmod_gsm.......................... ${HAVE_WAT}
|
||||
ftmod_pritap....................... ${HAVE_PRITAP}
|
||||
I/O:
|
||||
ftmod_wanpipe...................... ${HAVE_LIBSANGOMA}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
@@ -27,7 +27,7 @@
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
* David Yat Sin <dyatsin@sangoma.com>
|
||||
* James Zhang <jzhang@sangoma.com>
|
||||
*
|
||||
* Gideon Sadan <gsadan@sangoma.com>
|
||||
*
|
||||
* mod_freetdm.c -- FreeTDM Endpoint Module
|
||||
*
|
||||
@@ -293,7 +293,7 @@ static void cycle_foreground(ftdm_channel_t *ftdmchan, int flash, const char *bc
|
||||
const char *buuid;
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
buuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
|
||||
buuid = switch_channel_get_partner_uuid(channel);
|
||||
|
||||
|
||||
if (tokencnt == 1 && flash) {
|
||||
@@ -2104,6 +2104,24 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal)
|
||||
|
||||
switch (sigmsg->event_id) {
|
||||
|
||||
case FTDM_SIGEVENT_SMS:
|
||||
{
|
||||
ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel);
|
||||
ftdm_sms_data_t *sms = (ftdm_sms_data_t*) caller_data->priv;
|
||||
|
||||
|
||||
ftdm_log(FTDM_LOG_INFO,"FTDM_SIGEVENT_SMS from %s: %s", sms->from, sms->body);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_TRAP) != SWITCH_STATUS_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "failed to create SMS event\n");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", sms->from);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "body", sms->body);
|
||||
alarmbits = 0;
|
||||
}
|
||||
//return FTDM_BREAK;
|
||||
break;
|
||||
|
||||
case FTDM_SIGEVENT_ALARM_CLEAR:
|
||||
case FTDM_SIGEVENT_ALARM_TRAP:
|
||||
{
|
||||
@@ -2153,6 +2171,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal)
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
break;
|
||||
|
||||
case FTDM_SIGEVENT_RELEASED:
|
||||
case FTDM_SIGEVENT_INDICATION_COMPLETED:
|
||||
case FTDM_SIGEVENT_DIALING:
|
||||
@@ -2181,6 +2200,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal)
|
||||
}
|
||||
|
||||
if (event) {
|
||||
|
||||
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-name", "%s", ftdm_channel_get_span_name(sigmsg->channel));
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "span-number", "%d", ftdm_channel_get_span_id(sigmsg->channel));
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "chan-number", "%d", ftdm_channel_get_id(sigmsg->channel));
|
||||
@@ -2338,19 +2359,19 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
||||
|
||||
if ((session_a = switch_core_session_locate(ftdm_channel_get_token(sigmsg->channel, 0)))) {
|
||||
channel_a = switch_core_session_get_channel(session_a);
|
||||
br_a_uuid = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE);
|
||||
br_a_uuid = switch_channel_get_partner_uuid(channel_a);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session_a);
|
||||
stop_hold(session_a, switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE));
|
||||
stop_hold(session_a, switch_channel_get_partner_uuid(channel_a));
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_HOLD);
|
||||
}
|
||||
|
||||
if ((session_b = switch_core_session_locate(ftdm_channel_get_token(sigmsg->channel, 1)))) {
|
||||
channel_b = switch_core_session_get_channel(session_b);
|
||||
br_b_uuid = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE);
|
||||
br_b_uuid = switch_channel_get_partner_uuid(channel_b);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session_b);
|
||||
stop_hold(session_a, switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE));
|
||||
stop_hold(session_a, switch_channel_get_partner_uuid(channel_b));
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_HOLD);
|
||||
}
|
||||
|
||||
@@ -2418,7 +2439,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal)
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
buuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
|
||||
buuid = switch_channel_get_partner_uuid(channel);
|
||||
ftdm_channel_call_unhold(sigmsg->channel);
|
||||
stop_hold(session, buuid);
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_HOLD);
|
||||
@@ -3176,6 +3197,95 @@ static int add_profile_parameters(switch_xml_t cfg, const char *profname, ftdm_c
|
||||
return paramindex;
|
||||
}
|
||||
|
||||
static void parse_gsm_spans(switch_xml_t cfg, switch_xml_t spans)
|
||||
{
|
||||
switch_xml_t myspan, param;
|
||||
|
||||
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
||||
ftdm_status_t zstatus = FTDM_FAIL;
|
||||
const char *context = "default";
|
||||
const char *dialplan = "XML";
|
||||
ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS];
|
||||
char *id = (char *) switch_xml_attr(myspan, "id");
|
||||
char *name = (char *) switch_xml_attr(myspan, "name");
|
||||
char *configname = (char *) switch_xml_attr(myspan, "cfgprofile");
|
||||
ftdm_span_t *span = NULL;
|
||||
uint32_t span_id = 0;
|
||||
unsigned paramindex = 0;
|
||||
|
||||
if (!name && !id) {
|
||||
CONFIG_ERROR("GSM span missing required attribute 'id' or 'name', skipping ...\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (name) {
|
||||
zstatus = ftdm_span_find_by_name(name, &span);
|
||||
} else {
|
||||
if (switch_is_number(id)) {
|
||||
span_id = atoi(id);
|
||||
zstatus = ftdm_span_find(span_id, &span);
|
||||
}
|
||||
|
||||
if (zstatus != FTDM_SUCCESS) {
|
||||
zstatus = ftdm_span_find_by_name(id, &span);
|
||||
}
|
||||
}
|
||||
|
||||
if (zstatus != FTDM_SUCCESS) {
|
||||
CONFIG_ERROR("Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!span_id) {
|
||||
span_id = ftdm_span_get_id(span);
|
||||
}
|
||||
|
||||
memset(spanparameters, 0, sizeof(spanparameters));
|
||||
paramindex = 0;
|
||||
|
||||
if (configname) {
|
||||
paramindex = add_profile_parameters(cfg, configname, spanparameters, ftdm_array_len(spanparameters));
|
||||
if (paramindex) {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Added %d parameters from profile %s for span %d\n", paramindex, configname, span_id);
|
||||
}
|
||||
}
|
||||
|
||||
for (param = switch_xml_child(myspan, "param"); param; param = param->next) {
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
if (ftdm_array_len(spanparameters) - 1 == paramindex) {
|
||||
CONFIG_ERROR("Too many parameters for GSM span, ignoring any parameter after %s\n", var);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!strcasecmp(var, "context")) {
|
||||
context = val;
|
||||
} else if (!strcasecmp(var, "dialplan")) {
|
||||
dialplan = val;
|
||||
} else {
|
||||
spanparameters[paramindex].var = var;
|
||||
spanparameters[paramindex].val = val;
|
||||
paramindex++;
|
||||
}
|
||||
}
|
||||
|
||||
if (ftdm_configure_span_signaling(span,
|
||||
"gsm",
|
||||
on_clear_channel_signal,
|
||||
spanparameters) != FTDM_SUCCESS) {
|
||||
CONFIG_ERROR("Error configuring Sangoma GSM FreeTDM span %d\n", span_id);
|
||||
continue;
|
||||
}
|
||||
SPAN_CONFIG[span_id].span = span;
|
||||
switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context));
|
||||
switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan));
|
||||
switch_copy_string(SPAN_CONFIG[span_id].type, "GSM", sizeof(SPAN_CONFIG[span_id].type));
|
||||
ftdm_log(FTDM_LOG_DEBUG, "Configured GSM FreeTDM span %d\n", span_id);
|
||||
ftdm_span_start(span);
|
||||
}
|
||||
}
|
||||
|
||||
static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans)
|
||||
{
|
||||
switch_xml_t myspan, param;
|
||||
@@ -3184,7 +3294,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans)
|
||||
ftdm_status_t zstatus = FTDM_FAIL;
|
||||
const char *context = "default";
|
||||
const char *dialplan = "XML";
|
||||
ftdm_conf_parameter_t spanparameters[30];
|
||||
ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS];
|
||||
char *id = (char *) switch_xml_attr(myspan, "id");
|
||||
char *name = (char *) switch_xml_attr(myspan, "name");
|
||||
char *configname = (char *) switch_xml_attr(myspan, "cfgprofile");
|
||||
@@ -3353,13 +3463,17 @@ static switch_status_t load_config(void)
|
||||
parse_bri_pri_spans(cfg, spans);
|
||||
}
|
||||
|
||||
if ((spans = switch_xml_child(cfg, "gsm_spans"))) {
|
||||
parse_gsm_spans(cfg, spans);
|
||||
}
|
||||
|
||||
switch_core_hash_init(&globals.ss7_configs, module_pool);
|
||||
if ((spans = switch_xml_child(cfg, "sangoma_ss7_spans"))) {
|
||||
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
||||
ftdm_status_t zstatus = FTDM_FAIL;
|
||||
const char *context = "default";
|
||||
const char *dialplan = "XML";
|
||||
ftdm_conf_parameter_t spanparameters[30];
|
||||
ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS];
|
||||
char *id = (char *) switch_xml_attr(myspan, "id");
|
||||
char *name = (char *) switch_xml_attr(myspan, "name");
|
||||
char *configname = (char *) switch_xml_attr(myspan, "cfgprofile");
|
||||
@@ -3767,7 +3881,7 @@ static switch_status_t load_config(void)
|
||||
if ((spans = switch_xml_child(cfg, "pri_spans"))) {
|
||||
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
||||
char *name = (char *) switch_xml_attr(myspan, "name");
|
||||
ftdm_conf_parameter_t spanparameters[10];
|
||||
ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS];
|
||||
ftdm_status_t zstatus = FTDM_FAIL;
|
||||
const char *context = "default";
|
||||
const char *dialplan = "XML";
|
||||
@@ -3835,7 +3949,7 @@ static switch_status_t load_config(void)
|
||||
|
||||
ftdm_status_t zstatus = FTDM_FAIL;
|
||||
unsigned paramindex = 0;
|
||||
ftdm_conf_parameter_t spanparameters[10];
|
||||
ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS];
|
||||
const char *context = "default";
|
||||
const char *dialplan = "XML";
|
||||
ftdm_span_t *span = NULL;
|
||||
@@ -3893,7 +4007,7 @@ static switch_status_t load_config(void)
|
||||
if ((spans = switch_xml_child(cfg, "libpri_spans"))) {
|
||||
for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) {
|
||||
char *name = (char *) switch_xml_attr(myspan, "name");
|
||||
ftdm_conf_parameter_t spanparameters[10];
|
||||
ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS];
|
||||
ftdm_status_t zstatus = FTDM_FAIL;
|
||||
const char *context = "default";
|
||||
const char *dialplan = "XML";
|
||||
@@ -3968,7 +4082,7 @@ static switch_status_t load_config(void)
|
||||
uint32_t span_id = 0;
|
||||
ftdm_span_t *span = NULL;
|
||||
|
||||
ftdm_conf_parameter_t spanparameters[30];
|
||||
ftdm_conf_parameter_t spanparameters[FTDM_MAX_SIG_PARAMETERS];
|
||||
unsigned paramindex = 0;
|
||||
|
||||
if (!name) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -6030,7 +6030,7 @@ done:
|
||||
|
||||
static ftdm_status_t ftdm_cpu_monitor_start(void)
|
||||
{
|
||||
if (ftdm_interrupt_create(&globals.cpu_monitor.interrupt, FTDM_INVALID_SOCKET) != FTDM_SUCCESS) {
|
||||
if (ftdm_interrupt_create(&globals.cpu_monitor.interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS) != FTDM_SUCCESS) {
|
||||
ftdm_log(FTDM_LOG_CRIT, "Failed to create CPU monitor interrupt\n");
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ static ftdm_status_t ftdm_std_queue_create(ftdm_queue_t **outqueue, ftdm_size_t
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (ftdm_interrupt_create(&queue->interrupt, FTDM_INVALID_SOCKET) != FTDM_SUCCESS) {
|
||||
if (ftdm_interrupt_create(&queue->interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS) != FTDM_SUCCESS) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ static ftdm_status_t ftdm_core_set_state(const char *file, const char *func, int
|
||||
}
|
||||
|
||||
if (!ftdmchan->state_completed_interrupt) {
|
||||
status = ftdm_interrupt_create(&ftdmchan->state_completed_interrupt, FTDM_INVALID_SOCKET);
|
||||
status = ftdm_interrupt_create(&ftdmchan->state_completed_interrupt, FTDM_INVALID_SOCKET, FTDM_NO_FLAGS);
|
||||
if (status != FTDM_SUCCESS) {
|
||||
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_CRIT,
|
||||
"Failed to create state change interrupt when moving from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
|
||||
|
||||
@@ -73,6 +73,8 @@ struct ftdm_mutex {
|
||||
|
||||
struct ftdm_interrupt {
|
||||
ftdm_socket_t device;
|
||||
ftdm_wait_flag_t device_input_flags;
|
||||
ftdm_wait_flag_t device_output_flags;
|
||||
#ifdef WIN32
|
||||
/* for generic interruption */
|
||||
HANDLE event;
|
||||
@@ -323,7 +325,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(const char *file, int line, const c
|
||||
}
|
||||
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device)
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device, ftdm_wait_flag_t device_flags)
|
||||
{
|
||||
ftdm_status_t status = FTDM_SUCCESS;
|
||||
ftdm_interrupt_t *interrupt = NULL;
|
||||
@@ -340,6 +342,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt,
|
||||
}
|
||||
|
||||
interrupt->device = device;
|
||||
interrupt->device_input_flags = device_flags;
|
||||
#ifdef WIN32
|
||||
interrupt->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (!interrupt->event) {
|
||||
@@ -389,15 +392,16 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int m
|
||||
char pipebuf[255];
|
||||
#endif
|
||||
|
||||
ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Condition is null!\n");
|
||||
|
||||
ftdm_assert_return(interrupt != NULL, FTDM_FAIL, "Interrupt is null!\n");
|
||||
|
||||
interrupt->device_output_flags = FTDM_NO_FLAGS;
|
||||
/* start implementation */
|
||||
#ifdef WIN32
|
||||
ints[0] = interrupt->event;
|
||||
if (interrupt->device != FTDM_INVALID_SOCKET) {
|
||||
num++;
|
||||
ints[1] = interrupt->device;
|
||||
ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_output_flags member!)\n");
|
||||
}
|
||||
res = WaitForMultipleObjects(num, ints, FALSE, ms >= 0 ? ms : INFINITE);
|
||||
switch (res) {
|
||||
@@ -422,7 +426,7 @@ pollagain:
|
||||
if (interrupt->device != FTDM_INVALID_SOCKET) {
|
||||
num++;
|
||||
ints[1].fd = interrupt->device;
|
||||
ints[1].events = POLLIN;
|
||||
ints[1].events = interrupt->device_input_flags;
|
||||
ints[1].revents = 0;
|
||||
}
|
||||
|
||||
@@ -446,7 +450,17 @@ pollagain:
|
||||
ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
if (interrupt->device != FTDM_INVALID_SOCKET) {
|
||||
if (ints[1].revents & POLLIN) {
|
||||
interrupt->device_output_flags |= FTDM_READ;
|
||||
}
|
||||
if (ints[1].revents & POLLOUT) {
|
||||
interrupt->device_output_flags |= FTDM_WRITE;
|
||||
}
|
||||
if (ints[1].revents & POLLPRI) {
|
||||
interrupt->device_output_flags |= FTDM_EVENTS;
|
||||
}
|
||||
}
|
||||
return FTDM_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
@@ -515,10 +529,12 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
ints[i] = interrupts[i]->event;
|
||||
interrupts[i]->device_output_flags = FTDM_NO_FLAGS;
|
||||
if (interrupts[i]->device != FTDM_INVALID_SOCKET) {
|
||||
|
||||
/* WARNING: if the device is ready for data we must implement for Windows the device_output_flags member */
|
||||
ints[size+numdevices] = interrupts[i]->device;
|
||||
numdevices++;
|
||||
ftdm_log(FTDM_LOG_CRIT, "implement me! (Windows support for device_data_ready member!)\n", size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,17 +564,16 @@ pollagain:
|
||||
ints[i].events = POLLIN;
|
||||
ints[i].revents = 0;
|
||||
ints[i].fd = interrupts[i]->readfd;
|
||||
interrupts[i]->device_output_flags = FTDM_NO_FLAGS;
|
||||
if (interrupts[i]->device != FTDM_INVALID_SOCKET) {
|
||||
ints[size+numdevices].events = POLLIN;
|
||||
ints[size+numdevices].events = interrupts[i]->device_input_flags;
|
||||
ints[size+numdevices].revents = 0;
|
||||
ints[size+numdevices].fd = interrupts[i]->device;
|
||||
|
||||
numdevices++;
|
||||
}
|
||||
}
|
||||
|
||||
res = poll(ints, size + numdevices, ms);
|
||||
|
||||
if (res == -1) {
|
||||
if (errno == EINTR) {
|
||||
goto pollagain;
|
||||
@@ -571,7 +586,8 @@ pollagain:
|
||||
return FTDM_TIMEOUT;
|
||||
}
|
||||
|
||||
/* check for events in the pipes, NOT in the devices */
|
||||
/* check for events in the pipes and in the devices, but service only the pipes */
|
||||
numdevices = 0;
|
||||
for (i = 0; i < size; i++) {
|
||||
if (ints[i].revents & POLLIN) {
|
||||
res = read(ints[i].fd, pipebuf, sizeof(pipebuf));
|
||||
@@ -579,6 +595,18 @@ pollagain:
|
||||
ftdm_log(FTDM_LOG_CRIT, "reading interrupt descriptor failed (%s)\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
if (interrupts[i]->device != FTDM_INVALID_SOCKET) {
|
||||
if (ints[size+numdevices].revents & POLLIN) {
|
||||
interrupts[i]->device_output_flags |= FTDM_READ;
|
||||
}
|
||||
if (ints[size+numdevices].revents & POLLOUT) {
|
||||
interrupts[i]->device_output_flags |= FTDM_WRITE;
|
||||
}
|
||||
if (ints[size+numdevices].revents & POLLPRI) {
|
||||
interrupts[i]->device_output_flags |= FTDM_EVENTS;
|
||||
}
|
||||
numdevices++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* for MacOS compilation, unused vars */
|
||||
@@ -587,6 +615,15 @@ pollagain:
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
FT_DECLARE(ftdm_wait_flag_t) ftdm_interrupt_device_ready(ftdm_interrupt_t *interrupt)
|
||||
{
|
||||
#if defined(__WINDOWS__)
|
||||
/* device output flags are not currently filled for Windows upon returning from a wait function */
|
||||
ftdm_log(FTDM_LOG_CRIT, "IMPLEMENT ME!\n");
|
||||
#endif
|
||||
return interrupt->device_output_flags;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Anthony Minessale II
|
||||
* Copyright (c) 2008-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, Anthony Minessale II
|
||||
* Copyright (c) 2008-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
Executable
+1329
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* Copyright (c) 2010, Stefan Knoblich <s.knoblich@axsentis.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -114,42 +114,40 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request)
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/**
|
||||
* \brief Logs a libpri error
|
||||
* \param s Error string
|
||||
*/
|
||||
static void s_pri_error(char *s)
|
||||
#else
|
||||
/**
|
||||
* \brief Logs a libpri error
|
||||
* \param pri libpri structure (unused)
|
||||
* \param s Error string
|
||||
*/
|
||||
static void s_pri_error(struct pri *pri, char *s)
|
||||
#endif
|
||||
{
|
||||
ftdm_log(FTDM_LOG_ERROR, "%s", s);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/**
|
||||
* \brief Logs a libpri message
|
||||
* \param s Message string
|
||||
*/
|
||||
static void s_pri_message(char *s)
|
||||
#else
|
||||
/**
|
||||
* \brief Logs a libpri message
|
||||
* \param pri libpri structure (unused)
|
||||
* \param s Message string
|
||||
* \param pri libpri structure
|
||||
* \param s Message string
|
||||
*/
|
||||
static void s_pri_message(struct pri *pri, char *s)
|
||||
#endif
|
||||
{
|
||||
ftdm_log(FTDM_LOG_DEBUG, "%s", s);
|
||||
struct lpwrap_pri *spri = pri_get_userdata(pri);
|
||||
|
||||
if (spri && spri->dchan) {
|
||||
ftdm_log_chan(spri->dchan, FTDM_LOG_DEBUG, "%s", s);
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_DEBUG, "%s", s);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Logs a libpri error
|
||||
* \param pri libpri structure
|
||||
* \param s Error string
|
||||
*/
|
||||
static void s_pri_error(struct pri *pri, char *s)
|
||||
{
|
||||
struct lpwrap_pri *spri = pri_get_userdata(pri);
|
||||
|
||||
if (spri && spri->dchan) {
|
||||
ftdm_log_chan(spri->dchan, FTDM_LOG_ERROR, "%s", s);
|
||||
} else {
|
||||
ftdm_log(FTDM_LOG_ERROR, "%s", s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE)
|
||||
#define PRI_DEBUG_Q931_ALL (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* Copyright (c) 2009-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* Copyright (c) 2009-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Anthony Minessale II
|
||||
* Copyright (c) 2009-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <sys/timerfd.h>
|
||||
|
||||
/* this is how it should have been...
|
||||
#ifdef HAVE_FREETDM_FREETDM_H
|
||||
#include <freetdm/freetdm.h>
|
||||
@@ -256,7 +254,6 @@ struct misdn_chan_private {
|
||||
/* */
|
||||
int state;
|
||||
int debugfd;
|
||||
int timerfd;
|
||||
int active;
|
||||
|
||||
/* hw addr of channel */
|
||||
@@ -941,36 +938,7 @@ static FIO_OPEN_FUNCTION(misdn_open)
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "mISDN channel activation request sent\n");
|
||||
|
||||
switch (ftdmchan->type) {
|
||||
case FTDM_CHAN_TYPE_B: {
|
||||
#if 0
|
||||
struct itimerspec its = {
|
||||
.it_interval = { 0, 0 },
|
||||
.it_value = { 0, 0 },
|
||||
};
|
||||
|
||||
its.it_interval.tv_nsec = (ftdmchan->effective_interval * 1000000);
|
||||
its.it_value.tv_nsec = (ftdmchan->effective_interval * 1000000);
|
||||
|
||||
/* create tx timerfd */
|
||||
chan_priv->timerfd = timerfd_create(CLOCK_MONOTONIC, O_NONBLOCK);
|
||||
if (chan_priv->timerfd < 0) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN failed to create b-channel tx interval timer: %s\n",
|
||||
strerror(errno));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/* start tx timerfd */
|
||||
ret = timerfd_settime(chan_priv->timerfd, 0, &its, NULL);
|
||||
if (ret < 0) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "mISDN failed to start b-channel tx interval timer: %s\n",
|
||||
strerror(errno));
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN created tx interval (%d ms) timer\n",
|
||||
ftdmchan->effective_interval);
|
||||
#endif
|
||||
}
|
||||
case FTDM_CHAN_TYPE_B:
|
||||
case FTDM_CHAN_TYPE_DQ921:
|
||||
chan_priv->state = MISDN_CHAN_STATE_OPEN;
|
||||
break;
|
||||
@@ -998,15 +966,6 @@ static FIO_CLOSE_FUNCTION(misdn_close)
|
||||
|
||||
/* deactivate b-channels on close */
|
||||
if (ftdm_channel_get_type(ftdmchan) == FTDM_CHAN_TYPE_B) {
|
||||
#if 0
|
||||
/*
|
||||
* Stop tx timerfd
|
||||
*/
|
||||
if (chan_priv->timerfd >= 0) {
|
||||
close(chan_priv->timerfd);
|
||||
chan_priv->timerfd = -1;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Send deactivation request (don't wait for answer)
|
||||
*/
|
||||
@@ -1570,7 +1529,6 @@ static ftdm_status_t misdn_open_range(ftdm_span_t *span, ftdm_chan_type_t type,
|
||||
|
||||
priv->addr = addr;
|
||||
priv->debugfd = -1;
|
||||
priv->timerfd = -1;
|
||||
|
||||
/*
|
||||
* Create event queue
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -953,6 +953,12 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event)
|
||||
break;
|
||||
case 2: /* overlap sending */
|
||||
switch (ftdmchan->state) {
|
||||
case FTDM_CHANNEL_STATE_COLLECT:
|
||||
/* T302 Timeout reached */
|
||||
/* Send the call to user, and see if they accept it */
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T302 Timer expired, proceeding with call\n");
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
break;
|
||||
case FTDM_CHANNEL_STATE_PROCEED:
|
||||
case FTDM_CHANNEL_STATE_PROGRESS:
|
||||
case FTDM_CHANNEL_STATE_RINGING:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
Regular → Executable
+38
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -36,9 +36,9 @@
|
||||
* David Yat Sin <davidy@sangoma.com>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Arnaldo Pereira <arnaldo@sangoma.com>
|
||||
* Gideon Sadan <gsadan@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
||||
*/
|
||||
#ifdef WP_DEBUG_IO
|
||||
#define _BSD_SOURCE
|
||||
#include <syscall.h>
|
||||
@@ -121,6 +121,16 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event);
|
||||
FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event);
|
||||
FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event);
|
||||
|
||||
static void wp_swap16(char *data, int datalen)
|
||||
{
|
||||
int i = 0;
|
||||
uint16_t *samples = data;
|
||||
for (i = 0; i < datalen/2; i++) {
|
||||
uint16_t sample = ((samples[i] & 0x00FF) << 8) | ((samples[i] & 0xFF00) >> 8);
|
||||
samples[i] = sample;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Poll for event on a wanpipe socket
|
||||
* \param fd Wanpipe socket descriptor
|
||||
@@ -305,11 +315,20 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
|
||||
|
||||
err = sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api);
|
||||
|
||||
|
||||
|
||||
if (tdm_api.wp_tdm_cmd.hw_tdm_coding) {
|
||||
chan->native_codec = chan->effective_codec = FTDM_CODEC_ALAW;
|
||||
} else {
|
||||
chan->native_codec = chan->effective_codec = FTDM_CODEC_ULAW;
|
||||
}
|
||||
|
||||
|
||||
if ((span->trunk_type == FTDM_TRUNK_GSM) && (chan->type == FTDM_CHAN_TYPE_B)) {
|
||||
chan->native_codec = FTDM_CODEC_SLIN;
|
||||
chan->native_interval = 20;
|
||||
chan->packet_len = 320;
|
||||
}
|
||||
|
||||
err = sangoma_tdm_get_hw_dtmf(chan->sockfd, &tdm_api);
|
||||
if (err > 0) {
|
||||
@@ -580,8 +599,9 @@ static FIO_OPEN_FUNCTION(wanpipe_open)
|
||||
|
||||
ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL);
|
||||
ftdmchan->effective_interval = ftdmchan->native_interval = wp_globals.codec_ms;
|
||||
ftdmchan->packet_len = ftdmchan->native_interval * 8;
|
||||
|
||||
|
||||
/* The packet len will depend on the codec and interval */
|
||||
ftdmchan->packet_len = ftdmchan->native_interval * ((ftdmchan->native_codec==FTDM_CODEC_SLIN) ? 16 : 8);
|
||||
if (wp_globals.txqueue_size > 0) {
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &wp_globals.txqueue_size);
|
||||
}
|
||||
@@ -772,6 +792,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
|
||||
case FTDM_COMMAND_SET_INTERVAL:
|
||||
{
|
||||
err=sangoma_tdm_set_usr_period(ftdmchan->sockfd, &tdm_api, FTDM_COMMAND_OBJ_INT);
|
||||
|
||||
ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8);
|
||||
}
|
||||
break;
|
||||
@@ -793,7 +814,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
|
||||
FTDM_COMMAND_OBJ_INT = wanpipe_swap_bits(rbsbits);
|
||||
}
|
||||
#else
|
||||
// does sangoma_tdm_read_rbs is available here?
|
||||
/* is sangoma_tdm_read_rbs available here? */
|
||||
FTDM_COMMAND_OBJ_INT = ftdmchan->rx_cas_bits;
|
||||
#endif
|
||||
}
|
||||
@@ -969,12 +990,15 @@ static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx
|
||||
* \param datalen Size of data buffer
|
||||
* \return Success, failure or timeout
|
||||
*/
|
||||
|
||||
|
||||
static FIO_READ_FUNCTION(wanpipe_read)
|
||||
{
|
||||
int rx_len = 0;
|
||||
int rq_len = (int)*datalen;
|
||||
wp_tdm_api_rx_hdr_t hdrframe;
|
||||
|
||||
|
||||
#ifdef WP_DEBUG_IO
|
||||
wp_channel_t *wchan = ftdmchan->io_data;
|
||||
ftdm_time_t time_diff = 0;
|
||||
@@ -1034,6 +1058,10 @@ static FIO_READ_FUNCTION(wanpipe_read)
|
||||
wanpipe_read_stats(ftdmchan, &hdrframe);
|
||||
}
|
||||
|
||||
if ((ftdmchan->type == FTDM_CHAN_TYPE_B) && (ftdmchan->span->trunk_type == FTDM_TRUNK_GSM)) {
|
||||
wp_swap16(data, *datalen);
|
||||
}
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1050,6 +1078,10 @@ static FIO_WRITE_FUNCTION(wanpipe_write)
|
||||
int err = 0;
|
||||
wp_tdm_api_tx_hdr_t hdrframe;
|
||||
|
||||
if ((ftdmchan->type == FTDM_CHAN_TYPE_B) && (ftdmchan->span->trunk_type == FTDM_TRUNK_GSM)) {
|
||||
wp_swap16(data, *datalen);
|
||||
}
|
||||
|
||||
/* Do we even need the headerframe here? on windows, we don't even pass it to the driver */
|
||||
memset(&hdrframe, 0, sizeof(hdrframe));
|
||||
if (*datalen == 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -561,7 +561,7 @@ static FIO_CONFIGURE_FUNCTION(zt_configure)
|
||||
}
|
||||
} else if (!strcasecmp(var, "echo_cancel_level")) {
|
||||
num = atoi(val);
|
||||
if (num < 0 || num > 256) {
|
||||
if (num < 0 || num > 1024) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "invalid echo can val at line %d\n", lineno);
|
||||
} else {
|
||||
zt_globals.eclevel = num;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -61,6 +61,9 @@
|
||||
/*! \brief Max number of groups */
|
||||
#define FTDM_MAX_GROUPS_INTERFACE FTDM_MAX_SPANS_INTERFACE
|
||||
|
||||
/*! \brief Max number of key=value pairs to be sent as signaling stack parameters */
|
||||
#define FTDM_MAX_SIG_PARAMETERS 30
|
||||
|
||||
#define FTDM_INVALID_INT_PARM 0xFF
|
||||
|
||||
/*! \brief Thread/Mutex OS abstraction API. */
|
||||
@@ -342,6 +345,11 @@ typedef struct {
|
||||
uint8_t plan;
|
||||
} ftdm_number_t;
|
||||
|
||||
typedef struct {
|
||||
char from[FTDM_MAX_NUMBER_STR_SZ];
|
||||
char body[FTDM_MAX_NAME_STR_SZ];
|
||||
} ftdm_sms_data_t;
|
||||
|
||||
/*! \brief Caller information */
|
||||
typedef struct ftdm_caller_data {
|
||||
char cid_date[8]; /*!< Caller ID date */
|
||||
@@ -453,12 +461,13 @@ typedef enum {
|
||||
FTDM_SIGEVENT_INDICATION_COMPLETED, /*!< Last requested indication was completed */
|
||||
FTDM_SIGEVENT_DIALING, /*!< Outgoing call just started */
|
||||
FTDM_SIGEVENT_TRANSFER_COMPLETED, /*!< Transfer request is completed */
|
||||
FTDM_SIGEVENT_SMS,
|
||||
FTDM_SIGEVENT_INVALID, /*!<Invalid */
|
||||
} ftdm_signal_event_t;
|
||||
#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "RINGING", "PROGRESS", \
|
||||
"PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \
|
||||
"COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "FACILITY", \
|
||||
"TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "DIALING", "TRANSFER_COMPLETED", "INVALID"
|
||||
"TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "DIALING", "TRANSFER_COMPLETED", "SMS", "INVALID"
|
||||
/*! \brief Move from string to ftdm_signal_event_t and viceversa */
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t)
|
||||
|
||||
@@ -472,9 +481,10 @@ typedef enum {
|
||||
FTDM_TRUNK_FXO,
|
||||
FTDM_TRUNK_FXS,
|
||||
FTDM_TRUNK_EM,
|
||||
FTDM_TRUNK_GSM,
|
||||
FTDM_TRUNK_NONE
|
||||
} ftdm_trunk_type_t;
|
||||
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "NONE"
|
||||
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "GSM", "NONE"
|
||||
|
||||
/*! \brief Move from string to ftdm_trunk_type_t and viceversa */
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_trunk_type, ftdm_trunk_type2str, ftdm_trunk_type_t)
|
||||
@@ -622,14 +632,6 @@ typedef enum {
|
||||
FTDM_CRASH_ON_ASSERT
|
||||
} ftdm_crash_policy_t;
|
||||
|
||||
/*! \brief I/O waiting flags */
|
||||
typedef enum {
|
||||
FTDM_NO_FLAGS = 0,
|
||||
FTDM_READ = (1 << 0),
|
||||
FTDM_WRITE = (1 << 1),
|
||||
FTDM_EVENTS = (1 << 2)
|
||||
} ftdm_wait_flag_t;
|
||||
|
||||
/*! \brief Signaling configuration parameter for the stacks (variable=value pair) */
|
||||
typedef struct ftdm_conf_parameter {
|
||||
const char *var;
|
||||
|
||||
@@ -203,6 +203,14 @@ typedef enum {
|
||||
FTDM_TRUE
|
||||
} ftdm_bool_t;
|
||||
|
||||
/*! \brief I/O waiting flags */
|
||||
typedef enum {
|
||||
FTDM_NO_FLAGS = 0,
|
||||
FTDM_READ = (1 << 0),
|
||||
FTDM_WRITE = (1 << 1),
|
||||
FTDM_EVENTS = (1 << 2)
|
||||
} ftdm_wait_flag_t;
|
||||
|
||||
/*!
|
||||
* \brief FreeTDM channel.
|
||||
* This is the basic data structure used to place calls and I/O operations
|
||||
|
||||
@@ -52,11 +52,12 @@ FT_DECLARE(ftdm_status_t) _ftdm_mutex_trylock(const char *file, int line, const
|
||||
#define ftdm_mutex_unlock(_x) _ftdm_mutex_unlock(__FILE__, __LINE__, __FUNCTION__, _x)
|
||||
FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(const char *file, int line, const char *func, ftdm_mutex_t *mutex);
|
||||
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device, ftdm_wait_flag_t device_flags);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **cond);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *cond);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *cond, int ms);
|
||||
FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms);
|
||||
FT_DECLARE(ftdm_wait_flag_t) ftdm_interrupt_device_ready(ftdm_interrupt_t *interrupt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Anthony Minessale II
|
||||
* Copyright (c) 2007-2012, Anthony Minessale II
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -163,7 +163,8 @@ typedef enum {
|
||||
FTDM_SIGTYPE_SANGOMABOOST,
|
||||
FTDM_SIGTYPE_M3UA,
|
||||
FTDM_SIGTYPE_R2,
|
||||
FTDM_SIGTYPE_SS7
|
||||
FTDM_SIGTYPE_SS7,
|
||||
FTDM_SIGTYPE_GSM
|
||||
} ftdm_signal_type_t;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* libteletone
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Author(s): Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2005 Anthony Minessale II
|
||||
* Copyright: (c) 2005-2012 Anthony Minessale II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Author(s): Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2005 Anthony Minessale II
|
||||
* Copyright: (c) 2005-2012 Anthony Minessale II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Author(s): Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2005 Anthony Minessale II
|
||||
* Copyright: (c) 2005-2012 Anthony Minessale II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
||||
Reference in new issue
Block a user