mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 09:12:25 +00:00
Merge branch 'master' of ssh://git.freeswitch.org:222/freeswitch
This commit is contained in:
commit
f08b96764a
@ -71,6 +71,7 @@ static char prompt_str[512] = "";
|
||||
static char prompt_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
||||
static char input_text_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
||||
static char output_text_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
||||
static int feature_level = 0;
|
||||
static cli_profile_t profiles[128] = {{{0}}};
|
||||
static cli_profile_t internal_profile = {{ 0 }};
|
||||
static int pcount = 0;
|
||||
@ -679,9 +680,10 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
|
||||
}
|
||||
#ifndef WIN32
|
||||
if (aok) {
|
||||
clear_line();
|
||||
if (feature_level) clear_line();
|
||||
printf("%s%s", colors[level], handle->last_event->body);
|
||||
redisplay();
|
||||
if (!feature_level) printf("%s", ESL_SEQ_DEFAULT_COLOR);
|
||||
if (feature_level) redisplay();
|
||||
}
|
||||
#else
|
||||
if (aok) {
|
||||
@ -1122,6 +1124,7 @@ int main(int argc, char *argv[])
|
||||
char dft_cfile[512] = "fs_cli.conf";
|
||||
#endif
|
||||
char *home = getenv("HOME");
|
||||
char *term = getenv("TERM");
|
||||
/* Vars for optargs */
|
||||
int opt;
|
||||
static struct option options[] = {
|
||||
@ -1156,6 +1159,17 @@ int main(int argc, char *argv[])
|
||||
int argv_quiet = 0;
|
||||
int loops = 2, reconnect = 0, timeout = 0;
|
||||
|
||||
if (!strncasecmp("screen", term, 6) ||
|
||||
!strncasecmp("vt100", term, 5)) {
|
||||
feature_level = 1;
|
||||
} else {
|
||||
feature_level = 0;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
feature_level = 0;
|
||||
#endif
|
||||
|
||||
strncpy(internal_profile.host, "127.0.0.1", sizeof(internal_profile.host));
|
||||
strncpy(internal_profile.pass, "ClueCon", sizeof(internal_profile.pass));
|
||||
strncpy(internal_profile.name, "internal", sizeof(internal_profile.name));
|
||||
@ -1289,11 +1303,11 @@ int main(int argc, char *argv[])
|
||||
snprintf(bare_prompt_str, sizeof(bare_prompt_str), "freeswitch@%s> ", profile->name);
|
||||
}
|
||||
bare_prompt_str_len = (int)strlen(bare_prompt_str);
|
||||
#ifdef WIN32
|
||||
snprintf(prompt_str, sizeof(prompt_str), "%s", bare_prompt_str); /* Not supporting this for now */
|
||||
#else
|
||||
snprintf(prompt_str, sizeof(prompt_str), "%s%s%s", prompt_color, bare_prompt_str, input_text_color);
|
||||
#endif
|
||||
if (feature_level) {
|
||||
snprintf(prompt_str, sizeof(prompt_str), "%s%s%s", prompt_color, bare_prompt_str, input_text_color);
|
||||
} else {
|
||||
snprintf(prompt_str, sizeof(prompt_str), "%s", bare_prompt_str);
|
||||
}
|
||||
connect:
|
||||
connected = 0;
|
||||
while (--loops > 0) {
|
||||
@ -1320,7 +1334,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (argv_exec) {
|
||||
const char *err = NULL;
|
||||
snprintf(cmd_str, sizeof(cmd_str), "api %s\n\n", argv_command);
|
||||
snprintf(cmd_str, sizeof(cmd_str), "api %s\nconsole_execute: true\n\n", argv_command);
|
||||
if (timeout) {
|
||||
esl_status_t status = esl_send_recv_timed(&handle, cmd_str, timeout);
|
||||
if (status != ESL_SUCCESS) {
|
||||
|
@ -184,9 +184,9 @@ endif
|
||||
if HAVE_LIBPRI
|
||||
mod_LTLIBRARIES += ftmod_libpri.la
|
||||
ftmod_libpri_la_SOURCES = $(SRC)/ftmod/ftmod_libpri/ftmod_libpri.c $(SRC)/ftmod/ftmod_libpri/lpwrap_pri.c
|
||||
ftmod_libpri_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS)
|
||||
ftmod_libpri_la_LDFLAGS = -shared -module -avoid-version -lpri
|
||||
ftmod_libpri_la_LIBADD = libfreetdm.la
|
||||
ftmod_libpri_la_CFLAGS = $(FTDM_CFLAGS) $(AM_CFLAGS) $(LIBPRI_CPPFLAGS)
|
||||
ftmod_libpri_la_LDFLAGS = -shared -module -avoid-version $(LIBPRI_LDFLAGS)
|
||||
ftmod_libpri_la_LIBADD = libfreetdm.la $(LIBPRI_LIBS)
|
||||
endif
|
||||
|
||||
if HAVE_PRITAP
|
||||
|
@ -194,28 +194,46 @@ AM_CONDITIONAL([HAVE_OPENR2], [test "${HAVE_OPENR2}" = "yes"])
|
||||
#
|
||||
HAVE_LIBPRI="no"
|
||||
AC_ARG_WITH([libpri],
|
||||
[AS_HELP_STRING([--with-libpri], [Install ftmod_libpri])],
|
||||
[AS_HELP_STRING([--with-libpri@<:@=PREFIX@:>@], [Install ftmod_libpri])],
|
||||
[case "${withval}" in
|
||||
no) enable_libpri="no" ;;
|
||||
*) enable_libpri="yes" ;;
|
||||
no|yes) with_libpri="${withval}" ;;
|
||||
*) AS_IF([test -d "${withval}"],
|
||||
[with_libpri="${withval}"],
|
||||
[AC_MSG_ERROR([Invalid argument for --with-libpri, \"${withval}\" is not a directory])]
|
||||
) ;;
|
||||
esac],
|
||||
[enable_libpri="no"]
|
||||
[with_libpri="no"]
|
||||
)
|
||||
if test "${enable_libpri}" != "no"
|
||||
if test "x${with_libpri}" != "xno"
|
||||
then
|
||||
save_LIBS="${LIBS}"
|
||||
save_CPPFLAGS="${CPPFLAGS}"
|
||||
save_LDFLAGS="${LDFLAGS}"
|
||||
|
||||
LIBPRI_CPPFLAGS=""
|
||||
LIBPRI_LDFLAGS=""
|
||||
|
||||
AC_MSG_RESULT([${as_nl}<<>> Digium libpri])
|
||||
|
||||
save_LIBS="${LIBS}"
|
||||
AS_IF([test "x${with_libpri}" != "xyes"],
|
||||
[LIBPRI_CPPFLAGS="-I${with_libpri}/include"
|
||||
LIBPRI_LDFLAGS="-L${with_libpri}/lib"],
|
||||
)
|
||||
|
||||
LDFLAGS="${save_LDFLAGS} ${LIBPRI_LDFLAGS}"
|
||||
CPPFLAGS="${save_CPPFLAGS} ${LIBPRI_CPPFLAGS}"
|
||||
LIBS="${LIBS} -lpri"
|
||||
|
||||
AC_MSG_CHECKING([whether libpri is usable])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <libpri.h>],
|
||||
[const char *version = pri_get_version();]
|
||||
)],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
HAVE_LIBPRI="yes"],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([libpri is not installed or unusable (see config.log for details)])]
|
||||
AC_MSG_ERROR([libpri not found or unusable (see config.log for details)])]
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([whether libpri has BRI support])
|
||||
@ -241,10 +259,17 @@ then
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for AOC event support])]
|
||||
)
|
||||
|
||||
# libpri is available, set variables for Makefile(.am)
|
||||
AC_SUBST([LIBPRI_LIBS], [-lpri])
|
||||
AC_SUBST([LIBPRI_LDFLAGS])
|
||||
AC_SUBST([LIBPRI_CPPFLAGS])
|
||||
|
||||
LIBS="${save_LIBS}"
|
||||
LDFLAGS="${save_LDFLAGS}"
|
||||
CPPFLAGS="${save_CPPFLAGS}"
|
||||
fi
|
||||
HAVE_LIBPRI="${enable_libpri}"
|
||||
AM_CONDITIONAL([HAVE_LIBPRI],[test "${enable_libpri}" = "yes"])
|
||||
AM_CONDITIONAL([HAVE_LIBPRI],[test "x${HAVE_LIBPRI}" = "xyes"])
|
||||
|
||||
##
|
||||
# Sangoma Wanpipe
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <switch.h>
|
||||
#define VALET_EVENT "valet_parking::info"
|
||||
#define VALET_PROTO "park"
|
||||
|
||||
#define TOKEN_FREQ 5
|
||||
|
||||
/* Prototypes */
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_valet_parking_load);
|
||||
@ -112,7 +112,7 @@ static void check_timeouts(void)
|
||||
now = switch_epoch_time_now(NULL);
|
||||
|
||||
switch_mutex_lock(globals.mutex);
|
||||
if (now - globals.last_timeout_check < 30) {
|
||||
if (now - globals.last_timeout_check < TOKEN_FREQ) {
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
return;
|
||||
}
|
||||
@ -137,6 +137,7 @@ static void check_timeouts(void)
|
||||
switch_hash_this(i_hi, &i_var, NULL, &i_val);
|
||||
i_ext = (char *) i_var;
|
||||
token = (valet_token_t *) i_val;
|
||||
|
||||
if (token->timeout > 0 && (token->timeout < now || token->timeout == 1)) {
|
||||
switch_core_hash_delete(lot->hash, i_ext);
|
||||
switch_safe_free(token);
|
||||
@ -393,6 +394,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
|
||||
|
||||
if (!(token = next_id(session, lot, min_i, max_i, in))) {
|
||||
switch_ivr_phrase_macro(session, in ? "valet_lot_full" : "valet_lot_empty", "", NULL, NULL);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s lot is %s.\n", switch_channel_get_name(channel), in ? "full" : "empty");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -520,7 +522,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
|
||||
switch_core_session_t *b_session;
|
||||
|
||||
if ((b_session = switch_core_session_locate(uuid))) {
|
||||
token->timeout = switch_epoch_time_now(NULL) + 10;
|
||||
token->timeout = switch_epoch_time_now(NULL) + TOKEN_FREQ;
|
||||
if (play_announce) {
|
||||
switch_ivr_sleep(session, 1500, SWITCH_TRUE, NULL);
|
||||
switch_ivr_phrase_macro(session, "valet_announce_ext", tmp, NULL, NULL);
|
||||
@ -554,8 +556,6 @@ SWITCH_STANDARD_APP(valet_parking_function)
|
||||
args.buf = dbuf;
|
||||
args.buflen = sizeof(dbuf);
|
||||
|
||||
|
||||
|
||||
while(switch_channel_ready(channel)) {
|
||||
switch_status_t pstatus = switch_ivr_play_file(session, NULL, music, &args);
|
||||
if (pstatus == SWITCH_STATUS_BREAK || pstatus == SWITCH_STATUS_TIMEOUT) {
|
||||
|
@ -1669,7 +1669,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
||||
}
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file %s\n", file);
|
||||
|
||||
if (read_impl.samples_per_second) {
|
||||
switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / read_impl.samples_per_second);
|
||||
|
Loading…
x
Reference in New Issue
Block a user