提交 6d75c36f authored 作者: Anthony Minessale's avatar Anthony Minessale

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

......@@ -2249,6 +2249,7 @@ static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e)
ftdm_log(FTDM_LOG_INFO, "AOC-E:\n%s", tmp);
return 0;
}
#endif
/**
* \brief Handler for libpri facility events
......@@ -2275,6 +2276,7 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev
int res = -1;
switch (sub->cmd) {
#ifdef HAVE_LIBPRI_AOC
case PRI_SUBCMD_AOC_S: /* AOC-S: Start of call */
res = handle_facility_aoc_s(&sub->u.aoc_s);
break;
......@@ -2293,6 +2295,7 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev
sub->u.aoc_request_response.charging_request,
sub->u.aoc_request_response.charging_response);
break;
#endif
default:
ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d is not implemented, ignoring\n", sub->cmd);
}
......@@ -2303,7 +2306,6 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev
ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type));
return 0;
}
#endif
/**
* \brief Handler for libpri dchan up event
......
......@@ -182,7 +182,7 @@ int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *
#define timeval_to_ms(x) \
(((ftdm_time_t)(x)->tv_sec * 1000) + (ftdm_time_t)((x)->tv_usec / 1000))
(ftdm_time_t)(((x)->tv_sec * 1000) + ((x)->tv_usec / 1000))
int lpwrap_start_timer(struct lpwrap_pri *spri, struct lpwrap_timer *timer, const uint32_t timeout_ms, timeout_handler callback)
{
......
......@@ -200,7 +200,7 @@ AC_CHECK_HEADERS([audiofile.h])
AC_LANG([C])
if test "${build}" == "${host}"
if test "${build}" = "${host}"
then
case "${host}" in
x86_64-*)
......
......@@ -11,7 +11,7 @@
usage()
{
test X$1 == X0 || exec >&2
test X$1 = X0 || exec >&2
cat << EOF
usage: coverage-report OPTIONS
where OPTIONS are
......
......@@ -11,7 +11,7 @@
usage()
{
test X$1 == X0 || exec >&2
test X$1 = X0 || exec >&2
cat <<EOF
usage: uncovered OPTIONS
where OPTIONS are
......
......@@ -199,7 +199,7 @@ AC_CHECK_HEADERS([fenv.h])
AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])])
AC_CHECK_HEADERS([pcap.h])
AC_CHECK_HEADERS([pthread.h])
if test "${build}" == "${host}"
if test "${build}" = "${host}"
then
AC_CHECK_HEADERS([X11/X.h])
fi
......@@ -243,7 +243,7 @@ AC_CHECK_HEADERS([FL/Fl_Audio_Meter.H])
AC_LANG([C])
if test "${build}" == "${host}"
if test "${build}" = "${host}"
then
case "${host}" in
x86_64-*)
......
......@@ -53,7 +53,7 @@ else
cd gsm0610
fi
if [ $1x == --no-exe-runx ]
if [ $1x = --no-exe-runx ]
then
# Run the .exe files, which should be here
./FR_A.EXE
......@@ -77,7 +77,7 @@ rm -rf READ_FRA.TXT
rm -rf ACTION
rm -rf unpacked
if [ $1x == --no-exex ]
if [ $1x = --no-exex ]
then
# We need to prepare the .exe files to be run separately
rm -rf *.INP
......
......@@ -777,7 +777,7 @@ AC_ARG_WITH(jpeg12-lib,
AS_HELP_STRING([--with-jpeg12-lib=LIBRARY],
[path to libjpeg 12bit library]),,)
if test "x$enable_jpeg12" == "xyes" ; then
if test "x$enable_jpeg12" = "xyes" ; then
if test "x$with_jpeg12_lib" != "x" ; then
LIBS="$with_jpeg12_lib $LIBS"
......
......@@ -39,6 +39,7 @@ SWITCH_BEGIN_EXTERN_C
/*! \brief Type of value to parse */
typedef enum {
SWITCH_CONFIG_INT, /*< (ptr=int* default=int data=NULL) Integer */
SWITCH_CONFIG_ATOMIC, /*< (ptr=switch_atomic_t* default=uint32_t data=NULL) Integer */
SWITCH_CONFIG_STRING, /*< (ptr=[char* or char ** (for alloc)] default=char* data=switch_xml_config_string_options_t*) Zero-terminated C-string */
SWITCH_CONFIG_BOOL, /*< (ptr=switch_bool_t* default=switch_bool_t data=NULL) Yes and no */
SWITCH_CONFIG_CUSTOM, /*< (ptr=<custom function data> default=<custom function data> data=switch_xml_config_callback_t) Custom, get value through function pointer */
......@@ -70,6 +71,13 @@ typedef struct {
int max;
} switch_xml_config_int_options_t;
typedef struct {
switch_bool_t enforce_min;
uint32_t min;
switch_bool_t enforce_max;
uint32_t max;
} switch_xml_config_atomic_options_t;
struct switch_xml_config_item;
typedef struct switch_xml_config_item switch_xml_config_item_t;
......
......@@ -305,6 +305,11 @@ int ei_decode_string_or_binary(char *buf, int *index, int maxlen, char *dst)
ei_get_type(buf, index, &type, &size);
if (type == ERL_NIL_EXT || size == 0) {
dst[0] = '\0';
return 0;
}
if (type != ERL_STRING_EXT && type != ERL_BINARY_EXT) {
return -1;
} else if (size > maxlen) {
......
......@@ -1634,6 +1634,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
}
switch_channel_clear_flag(channel, CF_MEDIA_TRANS);
switch_core_session_rwunlock(session);
}
......
......@@ -536,32 +536,32 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_exec_string(switch_pgs
SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_exec_base(switch_pgsql_handle_t *handle, const char *sql, char **err)
{
#ifdef SWITCH_HAVE_PGSQL
char *err_str = NULL;
char *err_str = NULL, *er = NULL;
handle->affected_rows = 0;
if (!db_is_up(handle)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not up!\n");
er = strdup("Database is not up!");
goto error;
}
if (handle->auto_commit == SWITCH_FALSE && handle->in_txn == SWITCH_FALSE) {
if (switch_pgsql_send_query(handle, "BEGIN") != SWITCH_PGSQL_SUCCESS) {
er = strdup("Error sending BEGIN!");
switch_pgsql_finish_results(handle);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error sending BEGIN!\n");
goto error;
}
if (switch_pgsql_finish_results(handle) != SWITCH_PGSQL_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error sending BEGIN!\n");
er = strdup("Error sending BEGIN!");
goto error;
}
handle->in_txn = SWITCH_TRUE;
}
if (switch_pgsql_send_query(handle, sql) != SWITCH_PGSQL_SUCCESS) {
er = strdup("Error sending query!");
switch_pgsql_finish_results(handle);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error sending query!\n");
goto error;
}
......@@ -571,7 +571,15 @@ SWITCH_DECLARE(switch_pgsql_status_t) switch_pgsql_handle_exec_base(switch_pgsql
err_str = switch_pgsql_handle_get_error(handle);
if (zstr(err_str)) {
err_str = strdup((char *)"SQL ERROR!");
if (zstr(er)) {
err_str = strdup((char *)"SQL ERROR!");
} else {
err_str = er;
}
} else {
if (!zstr(er)) {
free(er);
}
}
if (err_str) {
......
......@@ -36,6 +36,7 @@ SWITCH_DECLARE_DATA switch_xml_config_string_options_t switch_config_string_strd
static switch_xml_config_enum_item_t switch_config_types_enum[] = {
{"int", SWITCH_CONFIG_INT},
{"switch_atomic_t", SWITCH_CONFIG_INT},
{"string", SWITCH_CONFIG_STRING},
{"bool", SWITCH_CONFIG_BOOL},
{"custom", SWITCH_CONFIG_CUSTOM},
......@@ -203,6 +204,48 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *ev
}
}
break;
case SWITCH_CONFIG_ATOMIC:
{
switch_xml_config_atomic_options_t *atomic_options = (switch_xml_config_atomic_options_t *) item->data;
switch_atomic_t *dest = (switch_atomic_t *) ptr;
uint32_t uintval;
if (value) {
if (switch_is_number(value)) {
uintval = (uint32_t) strtol(value, NULL, 10);
} else {
uintval = (uint32_t) (uintptr_t) item->defaultvalue;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%u]\n",
value, item->key, uintval);
}
if (atomic_options) {
/* Enforce validation options */
if ((atomic_options->enforce_min && !(uintval >= atomic_options->min)) || (atomic_options->enforce_max && !(uintval <= atomic_options->max))) {
/* Validation failed, set default */
uintval = (uint32_t) (uintptr_t) item->defaultvalue;
/* Then complain */
if (atomic_options->enforce_min && atomic_options->enforce_max) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Invalid value [%s] for parameter [%s], should be between [%u] and [%u], setting default [%u]\n", value,
item->key, atomic_options->min, atomic_options->max, uintval);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Invalid value [%s] for parameter [%s], should be %s [%u], setting default [%u]\n", value, item->key,
atomic_options->enforce_min ? "at least" : "at max",
atomic_options->enforce_min ? atomic_options->min : atomic_options->max, uintval);
}
}
}
} else {
uintval = (uint32_t) (uintptr_t) item->defaultvalue;
}
if (switch_atomic_read(dest) != uintval) {
switch_atomic_set(dest, uintval);
changed = SWITCH_TRUE;
}
}
break;
case SWITCH_CONFIG_STRING:
{
switch_xml_config_string_options_t string_options_default = { 0 };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论