Merge branch 'master' into v1.8
This commit is contained in:
commit
b1ea213a6a
|
@ -141,5 +141,6 @@ enum AVColorRange {
|
|||
|
||||
<configuration name="avformat.conf" description="AVFormat Config">
|
||||
<settings>
|
||||
<param name="colorspace" value="1"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
|
|
|
@ -624,6 +624,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
|||
freeswitch-mod-png (= \${binary:Version}),
|
||||
freeswitch-mod-redis (= \${binary:Version}),
|
||||
freeswitch-mod-rss (= \${binary:Version}),
|
||||
freeswitch-mod-signalwire (= \${binary:Version}),
|
||||
freeswitch-mod-shout (= \${binary:Version}),
|
||||
freeswitch-mod-sms (= \${binary:Version}),
|
||||
freeswitch-mod-snapshot (= \${binary:Version}),
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
[Unit]
|
||||
Description=freeswitch
|
||||
Wants=network-online.target
|
||||
Requires=syslog.socket network.target local-fs.target
|
||||
After=syslog.socket network.target local-fs.target
|
||||
After=syslog.socket network.target network-online.target local-fs.target
|
||||
|
||||
[Service]
|
||||
; service
|
||||
|
@ -11,6 +12,7 @@ Type=forking
|
|||
PIDFile=/run/freeswitch/freeswitch.pid
|
||||
Environment="DAEMON_OPTS=-nonat"
|
||||
EnvironmentFile=-/etc/default/freeswitch
|
||||
ExecStartPre=/bin/chown -R freeswitch:freeswitch /var/lib/freeswitch /var/log/freeswitch /etc/freeswitch /usr/share/freeswitch /var/run/freeswitch
|
||||
ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait $DAEMON_OPTS
|
||||
TimeoutSec=45s
|
||||
Restart=always
|
||||
|
@ -28,6 +30,7 @@ IOSchedulingPriority=2
|
|||
CPUSchedulingPolicy=rr
|
||||
CPUSchedulingPriority=89
|
||||
UMask=0007
|
||||
NoNewPrivileges=false
|
||||
|
||||
; alternatives which you can enforce by placing a unit drop-in into
|
||||
; /etc/systemd/system/freeswitch.service.d/*.conf:
|
||||
|
|
|
@ -11,7 +11,18 @@
|
|||
}
|
||||
}
|
||||
preRoute();
|
||||
|
||||
|
||||
var name = $location.search().name;
|
||||
var email = $location.search().email;
|
||||
var skipPreview = $location.search().skipPreview;
|
||||
|
||||
if (name && email) {
|
||||
verto.data.name = name;
|
||||
verto.data.email = email;
|
||||
$scope.login(true, skipPreview);
|
||||
return;
|
||||
}
|
||||
|
||||
verto.data.name = $scope.storage.data.name;
|
||||
verto.data.email = $scope.storage.data.email;
|
||||
|
||||
|
|
|
@ -77,10 +77,15 @@
|
|||
* Login the user to verto server and
|
||||
* redirects him to dialpad page.
|
||||
*/
|
||||
$scope.login = function(redirect) {
|
||||
$rootScope.login = function(redirect, skipPreview) {
|
||||
if(redirect == undefined) {
|
||||
redirect = true;
|
||||
}
|
||||
|
||||
if(skipPreview == undefined) {
|
||||
skipPreview = false;
|
||||
}
|
||||
|
||||
var connectCallback = function(v, connected) {
|
||||
$scope.$apply(function() {
|
||||
verto.data.connecting = false;
|
||||
|
@ -97,7 +102,7 @@
|
|||
verto.testSpeed();
|
||||
}
|
||||
|
||||
if (redirect && storage.data.preview) {
|
||||
if (redirect && storage.data.preview && !skipPreview) {
|
||||
$location.path('/loading');
|
||||
} else if (redirect) {
|
||||
$location.path('/dialpad');
|
||||
|
|
|
@ -1420,8 +1420,10 @@ int main(int argc, char *argv[])
|
|||
const char *line = NULL;
|
||||
char cmd_str[2048] = "";
|
||||
cli_profile_t *profile = NULL;
|
||||
#ifdef HAVE_LIBEDIT
|
||||
int argv_use_history_file = 1;
|
||||
int use_history_file = 0;
|
||||
#endif
|
||||
#ifndef WIN32
|
||||
char hfile[512] = "/tmp/fs_cli_history";
|
||||
char cfile[512] = "/etc/fs_cli.conf";
|
||||
|
@ -1581,7 +1583,9 @@ int main(int argc, char *argv[])
|
|||
argv_batch = 1;
|
||||
break;
|
||||
case 'Q':
|
||||
#ifdef HAVE_LIBEDIT
|
||||
argv_use_history_file = 0;
|
||||
#endif
|
||||
break;
|
||||
case 'i':
|
||||
allow_ctl_c = 1;
|
||||
|
@ -1645,9 +1649,11 @@ int main(int argc, char *argv[])
|
|||
profile->batch_mode = 1;
|
||||
feature_level=0;
|
||||
}
|
||||
#ifdef HAVE_LIBEDIT
|
||||
if (argv_use_history_file && profile->use_history_file) {
|
||||
use_history_file = 1;
|
||||
}
|
||||
#endif
|
||||
if (*argv_loglevel) {
|
||||
esl_set_string(profile->loglevel, argv_loglevel);
|
||||
profile->quiet = 0;
|
||||
|
|
|
@ -150,7 +150,7 @@ static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen)
|
|||
*/
|
||||
|
||||
do {
|
||||
if(!strncmp(p,name,strlen(name)) && *(p+strlen(name))==':') break;
|
||||
if(!strncasecmp(p,name,strlen(name)) && *(p+strlen(name))==':') break;
|
||||
} while((p = (strstr(p,"\n")+1))!=(char *)1);
|
||||
|
||||
|
||||
|
|
|
@ -1992,7 +1992,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handl
|
|||
\param flags flags in/out for fine tuning
|
||||
\return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags);
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, const char *text, switch_speech_flag_t *flags);
|
||||
|
||||
/*!
|
||||
\brief Flush TTS audio on a given handle
|
||||
|
|
|
@ -292,7 +292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_start_input_timers(swit
|
|||
\param fh file handle to use (NULL for builtin one)
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, const char *file, uint32_t limit, switch_file_handle_t *fh);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_transfer_recordings(switch_core_session_t *orig_session, switch_core_session_t *new_session);
|
||||
|
||||
|
||||
|
@ -471,7 +471,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
|
|||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session,
|
||||
switch_speech_handle_t *sh,
|
||||
switch_codec_t *codec, switch_timer_t *timer, char *text, switch_input_args_t *args);
|
||||
switch_codec_t *codec, switch_timer_t *timer, const char *text, switch_input_args_t *args);
|
||||
SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *session);
|
||||
/*!
|
||||
\brief Speak given text with given tts engine
|
||||
|
@ -483,7 +483,7 @@ SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *sessio
|
|||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
|
||||
const char *tts_name, const char *voice_name, char *text, switch_input_args_t *args);
|
||||
const char *tts_name, const char *voice_name, const char *text, switch_input_args_t *args);
|
||||
|
||||
/*!
|
||||
\brief Make an outgoing call
|
||||
|
|
|
@ -302,7 +302,7 @@ SWITCH_DECLARE(switch_status_t) switch_json_api_execute(cJSON *json, switch_core
|
|||
\param err pointer to error message
|
||||
\return the status
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, char *fname, switch_bool_t runtime, const char **err);
|
||||
SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(const char *dir, const char *fname, switch_bool_t runtime, const char **err);
|
||||
|
||||
/*!
|
||||
\brief Check if a module is loaded
|
||||
|
|
|
@ -259,6 +259,15 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_priority(switch_stun_pa
|
|||
SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
|
||||
switch_port_t *port, char *stunip, switch_port_t stunport, char **err, switch_memory_pool_t *pool);
|
||||
|
||||
/*!
|
||||
\brief Perform a stun ip lookup
|
||||
\param external_ip replaced with stun results
|
||||
\param sourceip stun:, host: or an ip
|
||||
\param external_pool the memory pool to use
|
||||
\return SUCCESS or FAIL
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_stun_ip_lookup(char **external_ip, const char *sourceip, switch_memory_pool_t *external_pool);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Obtain the padded length of an attribute's value
|
||||
|
|
|
@ -50,6 +50,7 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||
#define AVUTIL_TIMESTAMP_H
|
||||
|
||||
#define AV_TS_MAX_STRING_SIZE 32
|
||||
#define UINTVAL(v) (v > 0 ? v : 0);
|
||||
|
||||
// Compatibility with old libav on Debian Jessie
|
||||
// Not required if libavcodec version > 56.34.1
|
||||
|
@ -59,6 +60,12 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE CODEC_CAP_VARIABLE_FRAME_SIZE
|
||||
#endif
|
||||
|
||||
struct avformat_globals {
|
||||
enum AVColorSpace colorspace;
|
||||
};
|
||||
|
||||
struct avformat_globals avformat_globals = { 0 };
|
||||
|
||||
/* App interface */
|
||||
|
||||
// a wrapper around a single output AVStream
|
||||
|
@ -119,6 +126,7 @@ struct av_file_context {
|
|||
AVFormatContext *fc;
|
||||
AVCodec *audio_codec;
|
||||
AVCodec *video_codec;
|
||||
enum AVColorSpace colorspace;
|
||||
|
||||
int has_audio;
|
||||
int has_video;
|
||||
|
@ -566,8 +574,9 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||
|
||||
// av_opt_set_int(c->priv_data, "slice-max-size", SWITCH_DEFAULT_VIDEO_SIZE, 0);
|
||||
|
||||
c->colorspace = AVCOL_SPC_RGB;
|
||||
c->colorspace = context->colorspace;
|
||||
c->color_range = AVCOL_RANGE_JPEG;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "colorspace = %d\n", c->colorspace);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
@ -1598,7 +1607,8 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
|
|||
context->offset = DFT_RECORD_OFFSET;
|
||||
context->handle = handle;
|
||||
context->audio_timer = 1;
|
||||
|
||||
context->colorspace = avformat_globals.colorspace;
|
||||
|
||||
if (handle->params) {
|
||||
if ((tmp = switch_event_get_header(handle->params, "av_video_offset"))) {
|
||||
context->offset = atoi(tmp);
|
||||
|
@ -1608,6 +1618,14 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
|
|||
context->audio_timer = 0;
|
||||
}
|
||||
}
|
||||
if ((tmp = switch_event_get_header(handle->params, "colorspace"))) {
|
||||
int value = atoi(tmp);
|
||||
enum AVColorSpace colorspace = UINTVAL(value);
|
||||
|
||||
if (colorspace <= AVCOL_SPC_NB) {
|
||||
context->colorspace = colorspace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch_mutex_init(&context->mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
|
||||
|
@ -2626,11 +2644,45 @@ static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
|
|||
|
||||
static const char modname[] = "mod_av";
|
||||
|
||||
static switch_status_t load_config()
|
||||
{
|
||||
char *cf = "avformat.conf";
|
||||
switch_xml_t cfg, xml, param, settings;
|
||||
|
||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if ((settings = switch_xml_child(cfg, "settings"))) {
|
||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
if (!strcasecmp(var, "colorspace")) {
|
||||
int value = atoi(val);
|
||||
|
||||
avformat_globals.colorspace = UINTVAL(value);
|
||||
|
||||
if (avformat_globals.colorspace > AVCOL_SPC_NB) {
|
||||
avformat_globals.colorspace = AVCOL_SPC_RGB;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch_xml_free(xml);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load)
|
||||
{
|
||||
switch_file_interface_t *file_interface;
|
||||
int i = 0;
|
||||
|
||||
memset(&avformat_globals, 0, sizeof(struct avformat_globals));
|
||||
load_config();
|
||||
|
||||
supported_formats[i++] = "av";
|
||||
supported_formats[i++] = "rtmp";
|
||||
supported_formats[i++] = "rtsp";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
bin_PROGRAMS = test_mod_av
|
||||
bin_PROGRAMS = test_mod_av test_avformat
|
||||
AM_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(AVRESAMPLE_CFALGS)
|
||||
AM_LDFLAGS = $(switch_builddir)/libfreeswitch.la $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(AVRESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) ../mod_av.la
|
||||
TESTS = $(bin_PROGRAMS)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 209 KiB |
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2018, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Seven Du <seven@signalwire.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* test_avformat -- avformat tests
|
||||
*
|
||||
*/
|
||||
|
||||
#include <test/switch_test.h>
|
||||
|
||||
#define SAMPLES 160
|
||||
|
||||
FST_CORE_BEGIN("conf")
|
||||
{
|
||||
FST_MODULE_BEGIN(mod_av, mod_av_test)
|
||||
{
|
||||
FST_SETUP_BEGIN()
|
||||
{
|
||||
fst_requires_module("mod_av");
|
||||
}
|
||||
FST_SETUP_END()
|
||||
|
||||
FST_TEST_BEGIN(avformat_test_colorspace_RGB)
|
||||
{
|
||||
switch_status_t status;
|
||||
switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1);
|
||||
switch_file_handle_t fh = { 0 };
|
||||
uint8_t data[SAMPLES * 2] = { 0 };
|
||||
switch_frame_t frame = { 0 };
|
||||
switch_size_t len = SAMPLES;
|
||||
uint32_t flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO;
|
||||
int i = 0;
|
||||
|
||||
fst_requires(img);
|
||||
|
||||
status = switch_core_file_open(&fh, "{colorspace=0}./test_RGB.mp4", 1, 8000, flags, fst_pool);
|
||||
fst_requires(status == SWITCH_STATUS_SUCCESS);
|
||||
fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN));
|
||||
|
||||
status = switch_core_file_write(&fh, data, &len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "status: %d len: %d\n", status, (int)len);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
// fst_requires(len == SAMPLES);
|
||||
|
||||
frame.img = img;
|
||||
status = switch_core_file_write_video(&fh, &frame);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
|
||||
switch_image_t *ccimg = switch_img_read_png("./cluecon.png", SWITCH_IMG_FMT_ARGB);
|
||||
fst_requires(ccimg);
|
||||
|
||||
switch_rgb_color_t color = {0};
|
||||
color.a = 255;
|
||||
|
||||
for (i = 0; i < 30; i++) {
|
||||
len = SAMPLES;
|
||||
|
||||
if (i == 10) {
|
||||
color.r = 255;
|
||||
} else if (i == 20) {
|
||||
color.r = 0;
|
||||
color.b = 255;
|
||||
}
|
||||
|
||||
switch_img_fill(img, 0, 0, img->d_w, img->d_h, &color);
|
||||
switch_img_patch(img, ccimg, i * 10, i * 10);
|
||||
|
||||
status = switch_core_file_write(&fh, data, &len);
|
||||
status = switch_core_file_write_video(&fh, &frame);
|
||||
switch_yield(100000);
|
||||
}
|
||||
|
||||
switch_core_file_close(&fh);
|
||||
switch_img_free(&img);
|
||||
switch_img_free(&ccimg);
|
||||
}
|
||||
FST_TEST_END()
|
||||
|
||||
FST_TEST_BEGIN(avformat_test_colorspace_BT7)
|
||||
{
|
||||
switch_status_t status;
|
||||
switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1);
|
||||
switch_file_handle_t fh = { 0 };
|
||||
uint8_t data[SAMPLES * 2] = { 0 };
|
||||
switch_frame_t frame = { 0 };
|
||||
switch_size_t len = SAMPLES;
|
||||
uint32_t flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO;
|
||||
int i = 0;
|
||||
|
||||
fst_requires(img);
|
||||
|
||||
status = switch_core_file_open(&fh, "{colorspace=1}./test_BT7.mp4", 1, 8000, flags, fst_pool);
|
||||
fst_requires(status == SWITCH_STATUS_SUCCESS);
|
||||
fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN));
|
||||
|
||||
status = switch_core_file_write(&fh, data, &len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "status: %d len: %d\n", status, (int)len);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
// fst_requires(len == SAMPLES);
|
||||
|
||||
frame.img = img;
|
||||
status = switch_core_file_write_video(&fh, &frame);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
|
||||
switch_image_t *ccimg = switch_img_read_png("./cluecon.png", SWITCH_IMG_FMT_ARGB);
|
||||
fst_requires(ccimg);
|
||||
|
||||
switch_rgb_color_t color = {0};
|
||||
color.a = 255;
|
||||
|
||||
for (i = 0; i < 30; i++) {
|
||||
len = SAMPLES;
|
||||
|
||||
if (i == 10) {
|
||||
color.r = 255;
|
||||
} else if (i == 20) {
|
||||
color.r = 0;
|
||||
color.b = 255;
|
||||
}
|
||||
|
||||
switch_img_fill(img, 0, 0, img->d_w, img->d_h, &color);
|
||||
switch_img_patch(img, ccimg, i * 10, i * 10);
|
||||
|
||||
status = switch_core_file_write(&fh, data, &len);
|
||||
status = switch_core_file_write_video(&fh, &frame);
|
||||
switch_yield(100000);
|
||||
}
|
||||
|
||||
switch_core_file_close(&fh);
|
||||
switch_img_free(&img);
|
||||
switch_img_free(&ccimg);
|
||||
}
|
||||
FST_TEST_END()
|
||||
|
||||
FST_TEARDOWN_BEGIN()
|
||||
{
|
||||
const char *err = NULL;
|
||||
switch_sleep(1000000);
|
||||
//fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_av", SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS);
|
||||
}
|
||||
FST_TEARDOWN_END()
|
||||
}
|
||||
FST_MODULE_END()
|
||||
}
|
||||
FST_CORE_END()
|
|
@ -1708,7 +1708,7 @@ static switch_status_t http_cache_file_open(switch_file_handle_t *handle, const
|
|||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
struct http_context *context = switch_core_alloc(handle->memory_pool, sizeof(*context));
|
||||
int file_flags = SWITCH_FILE_DATA_SHORT;
|
||||
int file_flags = SWITCH_FILE_DATA_SHORT | (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) ? SWITCH_FILE_FLAG_VIDEO : 0);
|
||||
|
||||
if (handle->params) {
|
||||
context->profile = url_cache_http_profile_find(&gcache, switch_event_get_header(handle->params, "profile"));
|
||||
|
|
|
@ -7,9 +7,9 @@ if HAVE_SIGNALWIRE_CLIENT
|
|||
mod_LTLIBRARIES = mod_signalwire.la
|
||||
mod_signalwire_la_SOURCES = mod_signalwire.c
|
||||
mod_signalwire_la_CFLAGS = $(AM_CFLAGS)
|
||||
mod_signalwire_la_CFLAGS += $(KS_CFLAGS) $(SIGNALWIRE_CLIENT_CFLAGS)
|
||||
mod_signalwire_la_CFLAGS += $(CURL_CFLAGS) $(KS_CFLAGS) $(SIGNALWIRE_CLIENT_CFLAGS)
|
||||
mod_signalwire_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||
mod_signalwire_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(KS_LIBS) $(SIGNALWIRE_CLIENT_LIBS)
|
||||
mod_signalwire_la_LDFLAGS = $(CURL_LIBS) -avoid-version -module -no-undefined -shared $(KS_LIBS) $(SIGNALWIRE_CLIENT_LIBS)
|
||||
|
||||
else
|
||||
install: error
|
||||
|
|
|
@ -831,7 +831,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
|||
if (switch_test_flag(frame, SFF_CNG) ||
|
||||
(switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) {
|
||||
switch_core_timer_sync(&tech_pvt->timer);
|
||||
switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer);
|
||||
if (tech_pvt->other_tech_pvt) switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -991,10 +991,10 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||
|
||||
done = 1;
|
||||
switch_set_flag(tech_pvt, TFLAG_CLEAR);
|
||||
switch_set_flag(tech_pvt->other_tech_pvt, TFLAG_CLEAR);
|
||||
if (tech_pvt->other_tech_pvt) switch_set_flag(tech_pvt->other_tech_pvt, TFLAG_CLEAR);
|
||||
|
||||
switch_core_timer_sync(&tech_pvt->timer);
|
||||
switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer);
|
||||
if (tech_pvt->other_tech_pvt) switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -502,6 +502,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
|||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
|
||||
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
|
||||
nua_bye(tech_pvt->nh,
|
||||
TAG_IF(tech_pvt->record_route, NUTAG_PROXY(tech_pvt->record_route)),
|
||||
SIPTAG_CONTACT(SIP_NONE),
|
||||
TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)),
|
||||
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
*/
|
||||
#include <switch.h>
|
||||
#include <switch_json.h>
|
||||
#include <switch_stun.h>
|
||||
|
||||
|
||||
/* Prototypes */
|
||||
|
@ -4824,7 +4825,7 @@ static switch_status_t parse_config(const char *cf)
|
|||
if (zstr(val)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid External RTP IP.\n");
|
||||
} else {
|
||||
profile->extrtpip = switch_core_strdup(profile->pool, val);
|
||||
switch_stun_ip_lookup(&profile->extrtpip, val, profile->pool);
|
||||
}
|
||||
} else if (!strcasecmp(var, "debug")) {
|
||||
if (val) {
|
||||
|
|
|
@ -150,7 +150,7 @@ static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen)
|
|||
*/
|
||||
|
||||
do {
|
||||
if(!strncmp(p,name,strlen(name)) && *(p+strlen(name))==':') break;
|
||||
if(!strncasecmp(p,name,strlen(name)) && *(p+strlen(name))==':') break;
|
||||
} while((p = (strstr(p,"\n")+1))!=(char *)1);
|
||||
|
||||
|
||||
|
|
|
@ -1530,11 +1530,23 @@ JS_SESSION_GET_PROPERTY_IMPL(GetProperty)
|
|||
info.GetReturnValue().Set(Integer::New(info.GetIsolate(), this->_cause));
|
||||
}
|
||||
} else if (!strcmp(prop, "name")) {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_get_name(channel)));
|
||||
if (channel) {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_get_name(channel)));
|
||||
} else {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), ""));
|
||||
}
|
||||
} else if (!strcmp(prop, "uuid")) {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_get_uuid(channel)));
|
||||
if (channel) {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_get_uuid(channel)));
|
||||
} else {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), ""));
|
||||
}
|
||||
} else if (!strcmp(prop, "state")) {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_state_name(switch_channel_get_state(channel))));
|
||||
if (channel) {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_state_name(switch_channel_get_state(channel))));
|
||||
} else {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), ""));
|
||||
}
|
||||
} else if (!strcmp(prop, "dialplan")) {
|
||||
if (caller_profile) {
|
||||
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), caller_profile->dialplan));
|
||||
|
|
|
@ -119,7 +119,7 @@ static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen)
|
|||
*/
|
||||
|
||||
do {
|
||||
if(!strncmp(p,name,strlen(name)) && *(p+strlen(name))==':') break;
|
||||
if(!strncasecmp(p,name,strlen(name)) && *(p+strlen(name))==':') break;
|
||||
} while((p = (strstr(p,"\n")+1))!=(char *)1);
|
||||
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *
|
|||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, const char *text, switch_speech_flag_t *flags)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
char *param_string = NULL;
|
||||
|
|
|
@ -2538,7 +2538,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
|
|||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh)
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, const char *file, uint32_t limit, switch_file_handle_t *fh)
|
||||
{
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const char *p;
|
||||
|
|
|
@ -2644,7 +2644,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
|
|||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session,
|
||||
switch_speech_handle_t *sh,
|
||||
switch_codec_t *codec, switch_timer_t *timer, char *text, switch_input_args_t *args)
|
||||
switch_codec_t *codec, switch_timer_t *timer, const char *text, switch_input_args_t *args)
|
||||
{
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
short abuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
|
@ -2656,8 +2656,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
|
|||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
|
||||
switch_size_t extra = 0;
|
||||
char *p, *tmp = NULL;
|
||||
const char *star, *pound;
|
||||
char *tmp = NULL;
|
||||
const char *star, *pound, *p;
|
||||
switch_size_t starlen, poundlen;
|
||||
|
||||
if (!sh) {
|
||||
|
@ -2940,7 +2940,7 @@ SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *sessio
|
|||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
|
||||
const char *tts_name, const char *voice_name, char *text, switch_input_args_t *args)
|
||||
const char *tts_name, const char *voice_name, const char *text, switch_input_args_t *args)
|
||||
{
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
uint32_t rate = 0;
|
||||
|
|
|
@ -95,7 +95,7 @@ struct switch_loadable_module_container {
|
|||
static struct switch_loadable_module_container loadable_modules;
|
||||
static switch_status_t do_shutdown(switch_loadable_module_t *module, switch_bool_t shutdown, switch_bool_t unload, switch_bool_t fail_if_busy,
|
||||
const char **err);
|
||||
static switch_status_t switch_loadable_module_load_module_ex(char *dir, char *fname, switch_bool_t runtime, switch_bool_t global, const char **err);
|
||||
static switch_status_t switch_loadable_module_load_module_ex(const char *dir, const char *fname, switch_bool_t runtime, switch_bool_t global, const char **err);
|
||||
|
||||
static void *SWITCH_THREAD_FUNC switch_loadable_module_exec(switch_thread_t *thread, void *obj)
|
||||
{
|
||||
|
@ -1544,12 +1544,12 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, char *fname, switch_bool_t runtime, const char **err)
|
||||
SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(const char *dir, const char *fname, switch_bool_t runtime, const char **err)
|
||||
{
|
||||
return switch_loadable_module_load_module_ex(dir, fname, runtime, SWITCH_FALSE, err);
|
||||
}
|
||||
|
||||
static switch_status_t switch_loadable_module_load_module_ex(char *dir, char *fname, switch_bool_t runtime, switch_bool_t global, const char **err)
|
||||
static switch_status_t switch_loadable_module_load_module_ex(const char *dir, const char *fname, switch_bool_t runtime, switch_bool_t global, const char **err)
|
||||
{
|
||||
switch_size_t len = 0;
|
||||
char *path;
|
||||
|
@ -1902,7 +1902,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo
|
|||
if (path && zstr(path)) {
|
||||
path = SWITCH_GLOBAL_dirs.mod_dir;
|
||||
}
|
||||
if (switch_loadable_module_load_module_ex((char *) path, (char *) val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_GENERR) {
|
||||
if (switch_loadable_module_load_module_ex(path, val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_GENERR) {
|
||||
if (critical && switch_true(critical)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load critical module '%s', abort()\n", val);
|
||||
abort();
|
||||
|
@ -1935,7 +1935,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo
|
|||
if (path && zstr(path)) {
|
||||
path = SWITCH_GLOBAL_dirs.mod_dir;
|
||||
}
|
||||
switch_loadable_module_load_module_ex((char *) path, (char *) val, SWITCH_FALSE, global, &err);
|
||||
switch_loadable_module_load_module_ex(path, val, SWITCH_FALSE, global, &err);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -1975,7 +1975,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo
|
|||
continue;
|
||||
}
|
||||
|
||||
switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) fname, SWITCH_FALSE, &err);
|
||||
switch_loadable_module_load_module(SWITCH_GLOBAL_dirs.mod_dir, fname, SWITCH_FALSE, &err);
|
||||
}
|
||||
apr_dir_close(module_dir_handle);
|
||||
}
|
||||
|
|
|
@ -1933,7 +1933,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session)
|
|||
if (pkt_seq < max_seq) {
|
||||
stats->cycle++;
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats:[cycle change] pkt_seq[%d] cycle[%d] max_seq[%d] stats_ssrc[%u] local_ts[%u]\n",
|
||||
pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->write_timer.samplecount);
|
||||
pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->timer.samplecount);
|
||||
}
|
||||
pkt_extended_seq = stats->cycle << 16 | pkt_seq; /* getting the extended packet extended sequence ID */
|
||||
if (pkt_extended_seq > stats->high_ext_seq_recv) {
|
||||
|
@ -1963,7 +1963,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session)
|
|||
stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->write_timer.samplecount);
|
||||
#endif
|
||||
/* Interarrival jitter calculation */
|
||||
pkt_tsdiff = abs((int32_t)(rtp_session->write_timer.samplecount - ntohl(hdr->ts))); /* relative transit times for this packet */
|
||||
pkt_tsdiff = abs((int32_t)(rtp_session->timer.samplecount - ntohl(hdr->ts))); /* relative transit times for this packet */
|
||||
if (stats->pkt_count < 2) { /* Can not compute Jitter with only one packet */
|
||||
stats->last_pkt_tsdiff = pkt_tsdiff;
|
||||
} else {
|
||||
|
@ -1976,7 +1976,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session)
|
|||
|
||||
#ifdef DEBUG_RTCP
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: pkt_ts[%d]local_ts[%d]diff[%d]pkt_spacing[%d]inter_jitter[%f]seq[%d]stats_ssrc[%d]",
|
||||
ntohl(hdr->ts), rtp_session->write_timer.samplecount, pkt_tsdiff, packet_spacing_diff, stats->inter_jitter, ntohs(hdr->seq), stats->ssrc);
|
||||
ntohl(hdr->ts), rtp_session->timer.samplecount, pkt_tsdiff, packet_spacing_diff, stats->inter_jitter, ntohs(hdr->seq), stats->ssrc);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -851,6 +851,79 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
|
|||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_stun_ip_lookup(char **external_ip, const char *sourceip, switch_memory_pool_t *external_pool)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
char *stun_ip = NULL;
|
||||
switch_port_t stun_port = (switch_port_t)SWITCH_STUN_DEFAULT_PORT;
|
||||
char *p;
|
||||
char ip_buf[256] = "";
|
||||
char *ip = NULL;
|
||||
switch_port_t port = 0;
|
||||
switch_memory_pool_t *local_pool = NULL;
|
||||
char *error = "";
|
||||
|
||||
if (!sourceip || !external_pool) {
|
||||
*external_ip = NULL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
ip = ip_buf;
|
||||
|
||||
if (!strncasecmp(sourceip, "host:", 5)) {
|
||||
status = (*external_ip = switch_stun_host_lookup(sourceip + 5, external_pool)) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
|
||||
}
|
||||
else if (!strncasecmp(sourceip, "stun:", 5)) {
|
||||
|
||||
switch_core_new_memory_pool(&local_pool);
|
||||
|
||||
stun_ip = switch_core_strdup(local_pool, sourceip + 5);
|
||||
|
||||
switch_assert(stun_ip);
|
||||
|
||||
if ((p = strchr(stun_ip, ':'))) {
|
||||
int iport;
|
||||
*p++ = '\0';
|
||||
iport = atoi(p);
|
||||
if (iport > 0 && iport < 0xFFFF) {
|
||||
stun_port = (switch_port_t)iport;
|
||||
}
|
||||
}
|
||||
else {
|
||||
p = stun_ip;
|
||||
}
|
||||
|
||||
switch_find_local_ip(ip_buf, sizeof(ip_buf), NULL, AF_INET);
|
||||
|
||||
if (zstr(stun_ip)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "STUN Failed! NO STUN SERVER\n");
|
||||
}
|
||||
else {
|
||||
if ((switch_stun_lookup(&ip, &port, stun_ip, stun_port, &error, local_pool)) == SWITCH_STATUS_SUCCESS && ip && port) {
|
||||
*external_ip = switch_core_strdup(external_pool, ip);
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "External ip address detected using STUN: %s\n", ip);
|
||||
}
|
||||
else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "STUN Failed! [%s]\n", error);
|
||||
}
|
||||
}
|
||||
|
||||
if (status != SWITCH_STATUS_SUCCESS) {
|
||||
*external_ip = "";
|
||||
}
|
||||
|
||||
switch_core_destroy_memory_pool(&local_pool);
|
||||
}
|
||||
else {
|
||||
*external_ip = switch_core_strdup(external_pool, sourceip);
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -692,7 +692,6 @@ static switch_status_t timer_init(switch_timer_t *timer)
|
|||
timer->start = switch_micro_time_now();
|
||||
|
||||
if (timer->interval == 1) {
|
||||
runtime.microseconds_per_tick = 10000;
|
||||
switch_mutex_lock(globals.mutex);
|
||||
globals.timer_count++;
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <switch_stun.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/wait.h>
|
||||
#include <switch_private.h>
|
||||
|
@ -141,6 +142,46 @@ static void preprocess_exec_set(char *keyval)
|
|||
}
|
||||
}
|
||||
|
||||
static void preprocess_stun_set(char *keyval)
|
||||
{
|
||||
char *key = keyval;
|
||||
char *val = strchr(key, '=');
|
||||
|
||||
if (val) {
|
||||
char *ve = val++;
|
||||
while (*val && *val == ' ') {
|
||||
val++;
|
||||
}
|
||||
*ve-- = '\0';
|
||||
while (*ve && *ve == ' ') {
|
||||
*ve-- = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (key && val) {
|
||||
char *external_ip = NULL;
|
||||
switch_memory_pool_t *pool;
|
||||
|
||||
switch_core_new_memory_pool(&pool);
|
||||
|
||||
if (switch_stun_ip_lookup(&external_ip, val, pool) == SWITCH_STATUS_SUCCESS) {
|
||||
if (!zstr(external_ip)) {
|
||||
char *tmp = external_ip;
|
||||
tmp = &tmp[strlen(tmp) - 1];
|
||||
while (tmp >= external_ip && (tmp[0] == ' ' || tmp[0] == '\n')) {
|
||||
tmp[0] = '\0'; /* remove trailing spaces and newlines */
|
||||
tmp--;
|
||||
}
|
||||
switch_core_set_variable(key, external_ip);
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "stun-set failed.\n");
|
||||
}
|
||||
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
}
|
||||
}
|
||||
|
||||
static void preprocess_env_set(char *keyval)
|
||||
{
|
||||
char *key = keyval;
|
||||
|
@ -1487,6 +1528,8 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle
|
|||
|
||||
} else if (!strcasecmp(tcmd, "exec-set")) {
|
||||
preprocess_exec_set(targ);
|
||||
} else if (!strcasecmp(tcmd, "stun-set")) {
|
||||
preprocess_stun_set(targ);
|
||||
} else if (!strcasecmp(tcmd, "env-set")) {
|
||||
preprocess_env_set(targ);
|
||||
} else if (!strcasecmp(tcmd, "include")) {
|
||||
|
@ -1549,6 +1592,8 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle
|
|||
|
||||
} else if (!strcasecmp(cmd, "exec-set")) {
|
||||
preprocess_exec_set(arg);
|
||||
} else if (!strcasecmp(cmd, "stun-set")) {
|
||||
preprocess_stun_set(arg);
|
||||
} else if (!strcasecmp(cmd, "include")) {
|
||||
preprocess_glob(cwd, arg, write_fd, rlevel + 1);
|
||||
} else if (!strcasecmp(cmd, "exec")) {
|
||||
|
|
|
@ -27,7 +27,7 @@ FST_TEST_BEGIN(benchmark)
|
|||
int rc = 0, loops = 10, x = 0;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
char **index = NULL;
|
||||
unsigned long long micro_total = 0;
|
||||
uint64_t micro_total = 0;
|
||||
double micro_per = 0;
|
||||
double rate_per_sec = 0;
|
||||
|
||||
|
@ -63,7 +63,7 @@ FST_TEST_BEGIN(benchmark)
|
|||
micro_total = small_end_ts - small_start_ts;
|
||||
micro_per = micro_total / (double) loops;
|
||||
rate_per_sec = 1000000 / micro_per;
|
||||
printf("switch_event add_header: Total %ldus / %ld loops, %.2f us per loop, %.0f loops per second\n",
|
||||
printf("switch_event add_header: Total %" SWITCH_UINT64_T_FMT "us / %d loops, %.2f us per loop, %.0f loops per second\n",
|
||||
micro_total, loops, micro_per, rate_per_sec);
|
||||
#endif
|
||||
|
||||
|
@ -84,7 +84,7 @@ FST_TEST_BEGIN(benchmark)
|
|||
micro_total = small_end_ts - small_start_ts;
|
||||
micro_per = micro_total / (double) loops;
|
||||
rate_per_sec = 1000000 / micro_per;
|
||||
printf("switch_event get_header: Total %ldus / %ld loops, %.2f us per loop, %.0f loops per second\n",
|
||||
printf("switch_event get_header: Total %" SWITCH_UINT64_T_FMT "us / %d loops, %.2f us per loop, %.0f loops per second\n",
|
||||
micro_total, loops, micro_per, rate_per_sec);
|
||||
#endif
|
||||
|
||||
|
@ -101,7 +101,7 @@ FST_TEST_BEGIN(benchmark)
|
|||
micro_total = end_ts - start_ts;
|
||||
micro_per = micro_total / (double) loops;
|
||||
rate_per_sec = 1000000 / micro_per;
|
||||
printf("switch_event Total %ldus / %d loops, %.2f us per loop, %.0f loops per second\n",
|
||||
printf("switch_event Total %" SWITCH_UINT64_T_FMT "us / %d loops, %.2f us per loop, %.0f loops per second\n",
|
||||
micro_total, loops, micro_per, rate_per_sec);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ FST_TEST_BEGIN(benchmark)
|
|||
switch_bool_t verbose = SWITCH_TRUE;
|
||||
const char *err = NULL;
|
||||
switch_time_t start_ts, end_ts;
|
||||
unsigned long long micro_total = 0;
|
||||
uint64_t micro_total = 0;
|
||||
double micro_per = 0;
|
||||
double rate_per_sec = 0;
|
||||
int x = 0;
|
||||
|
@ -131,7 +131,7 @@ FST_TEST_BEGIN(benchmark)
|
|||
micro_total = end_ts - start_ts;
|
||||
micro_per = micro_total / (double) loops;
|
||||
rate_per_sec = 1000000 / micro_per;
|
||||
printf("switch_hash Total %ldus / %d loops, %.2f us per loop, %.0f loops per second\n",
|
||||
printf("switch_hash Total %" SWITCH_UINT64_T_FMT "us / %d loops, %.2f us per loop, %.0f loops per second\n",
|
||||
micro_total, loops, micro_per, rate_per_sec);
|
||||
}
|
||||
FST_TEST_END()
|
||||
|
|
|
@ -42,6 +42,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
|
|||
switch_assert(session);
|
||||
reporting++;
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "session reporting %d\n", reporting);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t my_on_destroy(switch_core_session_t *session)
|
||||
|
@ -49,6 +51,8 @@ static switch_status_t my_on_destroy(switch_core_session_t *session)
|
|||
switch_assert(session);
|
||||
destroy++;
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "session destroy %d\n", destroy);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_state_handler_table_t state_handlers = {
|
||||
|
|
Loading…
Reference in New Issue