From f5441a09f8f0c20750b1f9762d361d6f1a2f19c8 Mon Sep 17 00:00:00 2001 From: matteo brancaleoni Date: Wed, 30 Sep 2015 12:43:42 +0200 Subject: [PATCH 01/93] FS-8248 put python binaries into site arch path --- libs/esl/python/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/esl/python/Makefile b/libs/esl/python/Makefile index eeeb2bdea7..51a5770520 100644 --- a/libs/esl/python/Makefile +++ b/libs/esl/python/Makefile @@ -1,6 +1,6 @@ LOCAL_CFLAGS=`python ./python-config --includes` LOCAL_LDFLAGS=`python ./python-config --ldflags` -SITE_DIR=$(DESTDIR)/`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"` +SITE_DIR=$(DESTDIR)/`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)"` all: _ESL.so From ea65a31e307755dfbaae4e65221417a1d4583e04 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 7 Oct 2015 11:34:35 -0400 Subject: [PATCH 02/93] FS-8313: mod_opus: show decoder stats at end of call (how many times it did PLC or FEC) --- src/mod/codecs/mod_opus/mod_opus.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index 29ec4bf588..70912fee58 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -84,6 +84,13 @@ static opus_codec_settings_t default_codec_settings_8k = { /*.samplerate*/ 0 }; +struct dec_stats { + uint32_t fec_counter; + uint32_t plc_counter; + uint32_t frame_counter; +}; +typedef struct dec_stats dec_stats_t; + struct opus_context { OpusEncoder *encoder_object; OpusDecoder *decoder_object; @@ -95,6 +102,7 @@ struct opus_context { opus_codec_settings_t codec_settings; int look_check; int look_ts; + dec_stats_t decoder_stats; }; struct { @@ -682,6 +690,11 @@ static switch_status_t switch_opus_destroy(switch_codec_t *codec) if (context) { if (context->decoder_object) { + switch_core_session_t *session = codec->session; + if (session) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Opus decoder stats: Frames[%d] PLC[%d] FEC[%d]\n", + context->decoder_stats.frame_counter, context->decoder_stats.plc_counter-context->decoder_stats.fec_counter, context->decoder_stats.fec_counter); + } opus_decoder_destroy(context->decoder_object); context->decoder_object = NULL; } @@ -831,6 +844,15 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec, !encoded_data ? "PLC correction" : fec ? "FEC correction" : "decode"); } + if (plc) { + context->decoder_stats.plc_counter++; + } + if (fec) { + context->decoder_stats.fec_counter++; + } + /* a frame for which we decode FEC will be counted twice */ + context->decoder_stats.frame_counter++; + samples = opus_decode(context->decoder_object, encoded_data, encoded_data_len, decoded_data, frame_size, fec); if (samples < 0) { @@ -974,7 +996,7 @@ static switch_status_t opus_load_config(switch_bool_t reload) opus_prefs.use_jb_lookahead = switch_true(val); } else if (!strcasecmp(key, "keep-fec-enabled")) { /* encoder */ opus_prefs.keep_fec = atoi(val); - } else if (!strcasecmp(key, "advertise_useinbandfec")) { /*decoder, has meaning only for FMTP: useinbandfec=1 by default */ + } else if (!strcasecmp(key, "advertise-useinbandfec")) { /*decoder, has meaning only for FMTP: useinbandfec=1 by default */ opus_prefs.fec_decode = atoi(val); } else if (!strcasecmp(key, "maxaveragebitrate")) { opus_prefs.maxaveragebitrate = atoi(val); From 65fd07923eb3d53931616fcd701a809e71f4243b Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 7 Oct 2015 17:18:23 -0400 Subject: [PATCH 03/93] FS-8319: mod_opus: fix and cleanup of switch_opus_has_fec() and switch_opus_info(). --- src/mod/codecs/mod_opus/mod_opus.c | 76 +++++++++--------------------- 1 file changed, 21 insertions(+), 55 deletions(-) diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index 29ec4bf588..6b036ccc8e 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -328,10 +328,17 @@ static char *gen_fmtp(opus_codec_settings_t *settings, switch_memory_pool_t *poo static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_length_bytes) { + /* nb_silk_frames: number of silk-frames (10 or 20 ms) in an opus frame: 0, 1, 2 or 3 */ + /* computed from the 5 MSB (configuration) of the TOC byte (payload[0]) */ + /* nb_opus_frames: number of opus frames in the packet */ + /* computed from the 2 LSB (p0p1) of the TOC byte */ + /* p0p1 = 0 => nb_opus_frames = 1 */ + /* p0p1 = 1 or 2 => nb_opus_frames = 2 */ + /* p0p1 = 3 => given by the 6 LSB of payload[1] */ + int nb_silk_frames, nb_opus_frames, n, i; opus_int16 frame_sizes[48]; const unsigned char *frame_data[48]; - int frames; if (payload == NULL || payload_length_bytes <= 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "corrupted packet (invalid size)\n"); @@ -343,7 +350,7 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng return SWITCH_FALSE; } - if ((nb_opus_frames = opus_packet_parse(payload, payload_length_bytes, NULL, frame_data, frame_sizes, NULL)) < 0 ) { + if ((nb_opus_frames = opus_packet_parse(payload, payload_length_bytes, NULL, frame_data, frame_sizes, NULL)) <= 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OPUS_INVALID_PACKET ! nb_opus_frames: %d\n", nb_opus_frames); return SWITCH_FALSE; } @@ -355,38 +362,24 @@ static switch_bool_t switch_opus_has_fec(const uint8_t* payload,int payload_leng if(nb_silk_frames == 0) { nb_silk_frames = 1; } - if (nb_silk_frames == 1) { - for (n = 0; n <= (payload[0]&0x4) ; n++) { /* mono or stereo */ + if ((nb_silk_frames == 1) && (nb_opus_frames == 1)) { + for (n = 0; n <= (payload[0]&0x4) ; n++) { /* mono or stereo: 10,20 ms */ if (frame_data[0][0] & (0x80 >> ((n + 1) * (nb_silk_frames + 1) - 1))) { - return SWITCH_TRUE; /* 1st 20ms (or 10 ms) frame has FEC */ + return SWITCH_TRUE; /* frame has FEC */ } } } else { opus_int16 LBRR_flag = 0 ; - for (i=0 ; i < nb_opus_frames; i++ ) { /* only mono */ + for (i=0 ; i < nb_opus_frames; i++ ) { /* only mono Opus frames */ LBRR_flag = (frame_data[i][0] >> (7 - nb_silk_frames)) & 0x1; if (LBRR_flag) { return SWITCH_TRUE; /* one of the silk frames has FEC */ } } } - } - frames = opus_packet_parse(payload, payload_length_bytes, NULL, frame_data, frame_sizes, NULL); - - if (frames < 0) { return SWITCH_FALSE; } - - if (frame_sizes[0] <= 1) { - return SWITCH_FALSE; - } - - for (n = 0; n <= (payload[0]&0x4);n++) { - if (frame_data[0][0] & (0x80 >> ((n + 1) * (frames + 1) - 1))) { - return SWITCH_TRUE; /*this works only for 20 ms frames now, it will return VAD for 40 ms or 60 ms*/ - } - } return SWITCH_FALSE; } @@ -420,21 +413,13 @@ static int switch_opus_get_fec_bitrate(int fs, int loss) static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint32_t samples_per_second, char *print_text) { - /* nb_silk_frames: number of silk-frames (10 or 20 ms) in an opus frame: 0, 1, 2 or 3 */ - /* computed from the 5 MSB (configuration) of the TOC byte (encoded_data[0]) */ - /* nb_opus_frames: number of opus frames in the packet */ - /* computed from the 2 LSB (p0p1) of the TOC byte */ - /* p0p1 = 0 => nb_opus_frames= 1 */ - /* p0p1 = 1 or 2 => nb_opus_frames= 2 */ - /* p0p1 = 3 => given by the 6 LSB of encoded_data[1] */ - - int nb_samples, nb_silk_frames, nb_opus_frames, n, i; + int nb_samples, nb_opus_frames, nb_channels; int audiobandwidth; char audiobandwidth_str[32] = {0}; opus_int16 frame_sizes[48]; const unsigned char *frame_data[48]; char has_fec = 0; - uint8_t * payload = encoded_data ; + uint8_t * payload = encoded_data; if (!encoded_data) { return SWITCH_STATUS_FALSE; @@ -446,38 +431,19 @@ static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint3 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: OPUS_INVALID_PACKET !\n", print_text); } - if ((nb_opus_frames = opus_packet_parse(encoded_data, len, NULL, frame_data, frame_sizes, NULL)) < 0 ) { + if ((nb_opus_frames = opus_packet_parse(encoded_data, len, NULL, frame_data, frame_sizes, NULL)) <= 0 ) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: OPUS_INVALID_PACKET ! frames: %d\n", print_text, nb_opus_frames); return SWITCH_STATUS_FALSE; } nb_samples = opus_packet_get_samples_per_frame(encoded_data, samples_per_second) * nb_opus_frames; - nb_silk_frames = 0; - if ((payload[0] >> 3 ) < 12) { /* config in silk-only : NB,MB,WB */ - nb_silk_frames = (payload[0] >> 3) & 0x3; - if(nb_silk_frames == 0) { - nb_silk_frames = 1; - } - if (nb_silk_frames == 1) { - for (n = 0; n <= (payload[0]&0x4) ; n++) { /* mono or stereo */ - if (frame_data[0][0] & (0x80 >> ((n + 1) * (nb_silk_frames + 1) - 1))){ - has_fec = 1 ; /* 1st 20ms (or 10 ms) frame has fec */ - } - } - } else { - opus_int16 LBRR_flag = 0 ; - for (i=0 ; i < nb_opus_frames; i++ ) { /* only mono */ - LBRR_flag = (frame_data[i][0] >> (7 - nb_silk_frames)) & 0x1; - if (LBRR_flag) { - has_fec = 1; - } - } - } - } + has_fec = switch_opus_has_fec(payload, len); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: nb_opus_frames [%d] nb_silk_frames [%d] samples [%d] audio bandwidth [%s] bytes [%d] FEC[%s]\n", - print_text, nb_opus_frames, nb_silk_frames, nb_samples, audiobandwidth_str, len, has_fec ? "yes" : "no" ); + nb_channels = opus_packet_get_nb_channels(payload); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s: opus_frames [%d] samples [%d] audio bandwidth [%s] bytes [%d] FEC[%s] channels[%d]\n", + print_text, nb_opus_frames, nb_samples, audiobandwidth_str, len, has_fec ? "yes" : "no", nb_channels); return SWITCH_STATUS_SUCCESS; } From d145111eed3505e11d9d0f0a891eab3945dddf36 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 13 Oct 2015 17:54:15 -0400 Subject: [PATCH 04/93] FS-8344: mod_opus: toggle FEC on the last frame which is to be packed, so that FEC will be only present on the first SILK frame of the next Opus frame (Opus repacketization). --- src/mod/codecs/mod_opus/mod_opus.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index 9b9ec670e0..c0e4222211 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -874,7 +874,6 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec, if (codec->implementation->microseconds_per_packet / 1000 == 100) { /* 100 ms = 20 ms * 5 . because there is no 50 ms frame in Opus */ nb_frames = 5; } - toggle_fec = 1; } frame_size = (decoded_data_len / 2) / nb_frames; if((frame_size * nb_frames) != context->enc_frame_size) { @@ -884,12 +883,19 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec, opus_repacketizer_init(rp); dec_ptr_buf = (int16_t *)decoded_data; for (i = 0; i < nb_frames; i++) { + /* set inband FEC ON or OFF for the next Opus frame */ + if (i == (nb_frames - 1) && want_fec) { + /* When FEC is enabled for Opus frame N, LBRR is stored during regular encoding of */ + /* this Opus frame N, and this LBRR data will be packed with the regular encoding */ + /* data of Opus frame N+1. We enable FEC on our last Opus frame which is to be packed, just */ + /* to actually have it stored in the first Opus frame, that is when switch_opus_encode_repacketize() */ + /* is called again to pack the next big 80,100 or 120 ms frame. */ + toggle_fec = 1; /* FEC ON for the last frame */ + } + + opus_encoder_ctl(context->encoder_object, OPUS_SET_INBAND_FEC(toggle_fec)); bytes = opus_encode(context->encoder_object, (opus_int16 *) dec_ptr_buf, frame_size, enc_ptr_buf, len); - /* set inband FEC off for the next frame to be packed, the current frame may contain FEC */ - if (toggle_fec == 1) { - toggle_fec = 0; - opus_encoder_ctl(context->encoder_object, OPUS_SET_INBAND_FEC(toggle_fec)); - } + if (bytes < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoder Error: %s Decoded Datalen %u Codec NumberChans %u" \ "Len %u DecodedDate %p EncodedData %p ContextEncoderObject %p enc_frame_size: %d\n", From adc8f9a119711b26615805f8ea8f7b2d6fe52b61 Mon Sep 17 00:00:00 2001 From: Niek Vlessert Date: Tue, 20 Oct 2015 23:21:50 +0200 Subject: [PATCH 05/93] FS-8369 Debian8/CentOS7 systemd installer additions After builing Freeswitch this makes actually run it easy by offering an installer script. * Changes to configure.ac to detect Debian8/CentOS 7 and create installer script * Changes to build/Makefile.am to display the option * Added init directory with templates and other files * Deleted outdated build/freeswitch.service and tmpfiles.conf * Unit file based on the latest systemd service file FS-8194 * Won't interfere with other platforms (afaik) * Supports ./configure --prefix= * Detects if Debian8/CentOS7 use systemd * Can be used with a user with sudo permissions --- build/Makefile.am | 8 +++++ build/freeswitch-tmpfiles.conf | 1 - build/freeswitch.service | 17 ---------- configure.ac | 28 +++++++++++++++ init/freeswitch.default | 2 ++ init/freeswitch.service.in | 31 +++++++++++++++++ init/freeswitch.tmpfile | 1 + init/install_systemd.sh.in | 62 ++++++++++++++++++++++++++++++++++ 8 files changed, 132 insertions(+), 18 deletions(-) delete mode 100644 build/freeswitch-tmpfiles.conf delete mode 100644 build/freeswitch.service create mode 100644 init/freeswitch.default create mode 100644 init/freeswitch.service.in create mode 100644 init/freeswitch.tmpfile create mode 100644 init/install_systemd.sh.in diff --git a/build/Makefile.am b/build/Makefile.am index 61ac412d42..38202826da 100644 --- a/build/Makefile.am +++ b/build/Makefile.am @@ -1,5 +1,6 @@ MK=`echo $(MAKE) | $(AWK) '{printf "%5s\n", $$0}' ` + all: @echo " +---------- FreeSWITCH Build Complete ----------+" @echo " + FreeSWITCH has been successfully built. +" @@ -54,6 +55,13 @@ install: @echo " + Install/Re-install default config: +" @echo " + ---------------------------------- +" @echo " + $(MK) samples +" +if KNOWN_INIT + @echo " + +" + @echo " + Install init scripts: +" + @echo " + --------------------- +" + @echo " + +" + @echo " + init/install_systemd.sh +" +endif @echo " + +" @echo " + +" @echo " + Additional resources: +" diff --git a/build/freeswitch-tmpfiles.conf b/build/freeswitch-tmpfiles.conf deleted file mode 100644 index 881873fb29..0000000000 --- a/build/freeswitch-tmpfiles.conf +++ /dev/null @@ -1 +0,0 @@ -d /run/freeswitch 0750 freeswitch daemon - diff --git a/build/freeswitch.service b/build/freeswitch.service deleted file mode 100644 index ae6921b4df..0000000000 --- a/build/freeswitch.service +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=FreeSWITCH -After=syslog.target network.target -After=postgresql.service postgresql-9.3.service postgresql-9.4.service mysqld.service httpd.service - -[Service] -User=freeswitch -EnvironmentFile=-/etc/sysconfig/freeswitch -# RuntimeDirectory is not yet supported in CentOS 7. A workaround is to use /etc/tmpfiles.d/freeswitch.conf -#RuntimeDirectory=/run/freeswitch -#RuntimeDirectoryMode=0750 -WorkingDirectory=/run/freeswitch -ExecStart=/usr/bin/freeswitch -nc -nf $FREESWITCH_PARAMS -ExecReload=/usr/bin/kill -HUP $MAINPID - -[Install] -WantedBy=multi-user.target diff --git a/configure.ac b/configure.ac index 10d13898b0..df050a0001 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,8 @@ default_certsdir="$prefix/certs" default_fontsdir="$prefix/fonts" default_imagesdir="$prefix/images" +bindir="$exec_prefix/bin" + if test "${enable_fhs}" = "yes"; then eval full_datadir="${datadir}/freeswitch" eval datadir=$full_datadir @@ -771,6 +773,32 @@ case "$host" in ;; *linux*) APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt]) + if test -f /etc/os-release; then + DISTRO="$(source /etc/os-release && echo $ID$VERSION_ID)" + case "$DISTRO" in + *debian8*) + environmentfilelocation="default" + ;;& + *centos7*) + environmentfilelocation="sysconfig" + ;;& + *debian8*|*centos7*) + knowninit=false + if test -d /run/systemd/system; then + knowninit=true + AC_SUBST(DISTRO) + AC_SUBST(rundir) + AC_SUBST(environmentfilelocation) + AC_CONFIG_FILES([init/install_systemd.sh], [chmod +x init/install_systemd.sh]) + AC_CONFIG_FILES([init/freeswitch.service]) + fi + ;; + *) + knowninit=false + ;; + esac + fi + AM_CONDITIONAL([KNOWN_INIT], [test x$knowninit = xtrue]) ;; esac diff --git a/init/freeswitch.default b/init/freeswitch.default new file mode 100644 index 0000000000..41cd0758c6 --- /dev/null +++ b/init/freeswitch.default @@ -0,0 +1,2 @@ +# /etc/default/freeswitch +DAEMON_OPTS="-nonat" diff --git a/init/freeswitch.service.in b/init/freeswitch.service.in new file mode 100644 index 0000000000..930c8c2b93 --- /dev/null +++ b/init/freeswitch.service.in @@ -0,0 +1,31 @@ +[Unit] +Description=freeswitch +After=syslog.target network.target local-fs.target + +[Service] +; service +Type=forking +PIDFile=@rundir@/freeswitch.pid +PermissionsStartOnly=true +Environment="DAEMON_OPTS=-nonat" +EnvironmentFile=-/etc/@environmentfilelocation@/freeswitch +ExecStart=@bindir@/freeswitch -u freeswitch -g freeswitch -ncwait -rp ${DAEMON_OPTS} +TimeoutSec=20s +Restart=on-failure +; exec +User=root +Group=daemon +LimitCORE=infinity +LimitNOFILE=100000 +LimitNPROC=60000 +;LimitSTACK=240 +LimitRTPRIO=infinity +LimitRTTIME=7000000 +IOSchedulingClass=realtime +IOSchedulingPriority=2 +CPUSchedulingPolicy=rr +CPUSchedulingPriority=89 +UMask=0007 + +[Install] +WantedBy=multi-user.target diff --git a/init/freeswitch.tmpfile b/init/freeswitch.tmpfile new file mode 100644 index 0000000000..baea7b8113 --- /dev/null +++ b/init/freeswitch.tmpfile @@ -0,0 +1 @@ +d /var/run/freeswitch 0755 freeswitch freeswitch - - diff --git a/init/install_systemd.sh.in b/init/install_systemd.sh.in new file mode 100644 index 0000000000..60253a141a --- /dev/null +++ b/init/install_systemd.sh.in @@ -0,0 +1,62 @@ +#!/bin/bash +# @DISTRO@ installer +# Niek Vlessert + +USER=`whoami` +DISTRO=@DISTRO@ +if [ $USER != "root" ] ; then + SUDO=`which sudo | awk -F"/" '{print $NF}'` + if [ -z $SUDO ] ; then + echo "No root and no sudo... please run this as root or install sudo and make sure your user has permissions to use it." + exit + else + read -p "The currently active user is not root but sudo is available... do you want to install using sudo? (y/n) " -n 1 -r + if ! [[ $REPLY =~ ^[yY]$ ]] + then + echo + exit + fi + fi +fi + +echo +echo "This will do several things on your @DISTRO@ installation:" +echo "- Create user freeswitch and add it to group freeswitch" +FSPATH=@prefix@ +if [[ $FSPATH == *"freeswitch"* ]] +then + echo "- Set permissions on @prefix@ and files in @bindir@" +fi +echo "- Install systemd unit file" +echo "- Install /etc/@environmentfilelocation@/freeswitch" +echo +read -p "Do you want to continue? (y/n) " -n 1 -r +if [[ $REPLY =~ ^[yY]$ ]] +then + echo + echo "Installing..." + $SUDO groupadd freeswitch + if DISTRO="debian8"; then + $SUDO adduser --disabled-password --quiet --system --home @confdir@ --gecos "FreeSWITCH open source softswitch" --ingroup freeswitch freeswitch + elif DISTRO="centos7"; then + $SUDO adduser --system --home @confdir@ -c "FreeSWITCH open source softswitch" -g freeswitch freeswitch + fi + if [[ $FSPATH == *"freeswitch"* ]] + then + $SUDO chown -R freeswitch:freeswitch @prefix@ + $SUDO chmod -R ug=rwX,o= @prefix@ + $SUDO chmod -R u=rwx,g=rx @bindir@/* + fi + $SUDO cp init/freeswitch.service /etc/systemd/system/ + $SUDO cp init/freeswitch.tmpfile /etc/tmpfiles.d/freeswitch.conf + $SUDO cp init/freeswitch.default /etc/@environmentfilelocation@/freeswitch + $SUDO systemd-tmpfiles --clean --create + $SUDO systemctl daemon-reload + echo + if [ -f @confdir@/vars.xml ] ; then + echo "You may now start Freeswitch using 'systemctl start freeswitch'" + else + echo "Make sure your config files are in place in @confdir@, if they are you can start Freeswitch using 'systemctl start freeswitch'" + fi + echo "Then start fs_cli by running @bindir@/fs_cli" +fi From c3a59c4b2261ae0b7e0b251057846af27dbf83f2 Mon Sep 17 00:00:00 2001 From: Bradley Jokinen Date: Wed, 21 Oct 2015 10:03:59 -0500 Subject: [PATCH 06/93] FS-8373 Improve quality of recordings when using fast encoding --- src/mod/applications/mod_av/avformat.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 3e60049915..ddadba4b0c 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -330,7 +330,6 @@ static switch_status_t add_stream(MediaStream *mst, AVFormatContext *fc, AVCodec break; case SWITCH_VIDEO_ENCODE_SPEED_FAST: av_opt_set(c->priv_data, "preset", "veryfast", 0); - av_opt_set(c->priv_data, "tune", "zerolatency", 0); break; default: break; From 216e79f799127155a15a75cbebbe67061c03cb06 Mon Sep 17 00:00:00 2001 From: Bradley Jokinen Date: Thu, 22 Oct 2015 12:15:11 -0500 Subject: [PATCH 07/93] FS-8380 Improve mod_av's handling of vw and vh core file params This allows for the core file params vw and vh to be used to modify the resolution of recordings. If the specified resolution does not match the resolution of the call being recorded, the video will be scaled. --- src/mod/applications/mod_av/avformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index 3e60049915..ac02247ee5 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -513,7 +513,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void * record_helper_t *eh = (record_helper_t *) obj; void *pop = NULL; switch_image_t *img = NULL, *tmp_img = NULL; - int d_w = 0, d_h = 0; + int d_w = eh->video_st->width, d_h = eh->video_st->height; int size = 0, skip = 0, skip_freq = 0, skip_count = 0, skip_total = 0, skip_total_count = 0; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "video thread start\n"); From 5b4c725963ee92e001bc20ec48d74f8907e81fe4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 23 Oct 2015 13:58:33 -0500 Subject: [PATCH 08/93] FS-8384 #resolve [Locking contention in mod_conference] --- src/mod/applications/mod_conference/conference_video.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index bf469577ca..d45bc853b4 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -554,8 +554,6 @@ mcu_layer_t *conference_video_get_layer_locked(conference_member_t *member) if (!member || member->canvas_id < 0 || member->video_layer_id < 0) return NULL; - switch_mutex_lock(member->conference->canvas_mutex); - canvas = member->conference->canvases[member->canvas_id]; if (!canvas) { @@ -571,10 +569,6 @@ mcu_layer_t *conference_video_get_layer_locked(conference_member_t *member) end: - if (!layer) { - switch_mutex_unlock(member->conference->canvas_mutex); - } - return layer; } @@ -592,8 +586,6 @@ void conference_video_release_layer(mcu_layer_t **layer) switch_assert(canvas->conference); - switch_mutex_unlock(canvas->conference->canvas_mutex); - *layer = NULL; } From 6b5b1a3d869e33674f9cc9fb86fa157d04ef05ad Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Mon, 26 Oct 2015 13:45:48 -0400 Subject: [PATCH 09/93] FS-8389: [build] Fix msvc 2015 build warnings --- src/include/switch_utils.h | 4 ++-- .../mod_conference/conference_video.c | 2 +- src/mod/codecs/mod_opus/mod_opus.c | 13 +++++++------ .../mod_skypopen/mod_skypopen.2015.vcxproj | 18 ++++++++++++------ src/mod/endpoints/mod_sofia/sofia.c | 2 +- .../mod_local_stream/mod_local_stream.c | 6 +++--- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 6f6ee6bef6..3ff7c286c4 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -859,7 +859,7 @@ static inline switch_bool_t switch_strstr(char *s, char *q) S = strdup(s); - assert(S != NULL); + switch_assert(S != NULL); for (p = S; p && *p; p++) { *p = (char) switch_toupper(*p); @@ -871,7 +871,7 @@ static inline switch_bool_t switch_strstr(char *s, char *q) } Q = strdup(q); - assert(Q != NULL); + switch_assert(Q != NULL); for (p = Q; p && *p; p++) { *p = (char) switch_toupper(*p); diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index d45bc853b4..a229cfc8c3 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -1483,7 +1483,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_ switch_time_t now = switch_time_now(); if (last) { - int delta = now - last; + int delta = (int)(now - last); if (delta > member->conference->video_fps.ms * 5000) { switch_core_session_request_video_refresh(member->session); } diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index 305986eebf..b327889072 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -858,8 +858,9 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec, int16_t *dec_ptr_buf = decoded_data; /* work inside the available buffer to avoid other buffer allocations. *encoded_data_len will be SWITCH_RECOMMENDED_BUFFER_SIZE */ unsigned char *enc_ptr_buf = (unsigned char *)encoded_data + (len / 2); - int nb_frames = codec->implementation->microseconds_per_packet / 20000 ; /* requested ptime: 20 ms * nb_frames */ - int frame_size, i, bytes = 0, want_fec = 0, toggle_fec = 0; + uint32_t nb_frames = codec->implementation->microseconds_per_packet / 20000 ; /* requested ptime: 20 ms * nb_frames */ + uint32_t frame_size, i; + int bytes = 0, want_fec = 0, toggle_fec = 0; opus_int32 ret = 0; opus_int32 total_len = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -879,7 +880,7 @@ static switch_status_t switch_opus_encode_repacketize(switch_codec_t *codec, } frame_size = (decoded_data_len / 2) / nb_frames; if((frame_size * nb_frames) != context->enc_frame_size) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Encoder Error: Decoded Datalen %u Number of frames: %d Encoder frame size: %d\n",decoded_data_len,nb_frames,context->enc_frame_size); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Encoder Error: Decoded Datalen %u Number of frames: %u Encoder frame size: %u\n",decoded_data_len,nb_frames,context->enc_frame_size); switch_goto_status(SWITCH_STATUS_GENERR, end); } opus_repacketizer_init(rp); @@ -1080,13 +1081,13 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, switch(cmd) { case SCC_CODEC_SPECIFIC: { - const char *cmd = (const char *)cmd_data; + const char *command = (const char *)cmd_data; const char *arg = (const char *)cmd_arg; switch_codec_control_type_t reply_type = SCCT_STRING; const char *reply = "ERROR INVALID COMMAND"; - if (!zstr(cmd)) { - if (!strcasecmp(cmd, "jb_lookahead")) { + if (!zstr(command)) { + if (!strcasecmp(command, "jb_lookahead")) { if (!zstr(arg)) { context->use_jb_lookahead = switch_true(arg); } diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.2015.vcxproj b/src/mod/endpoints/mod_skypopen/mod_skypopen.2015.vcxproj index bbadaa5a50..0a585149b3 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.2015.vcxproj +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.2015.vcxproj @@ -130,9 +130,12 @@ - /analyze:stacksize65535 - /analyze:stacksize65535 - /analyze:stacksize65535 + + + + + + @@ -141,9 +144,12 @@ 4305;4306;28193;4244;4267;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) 4305;4306;28193;4244;4267;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) 4305;4306;28193;4244;4267;4324;6340;6246;6011;6387;%(DisableSpecificWarnings) - /analyze:stacksize32768 - /analyze:stacksize32768 - /analyze:stacksize32768 + + + + + + diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 2a06e882ef..c4116b0a18 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5850,7 +5850,7 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu int ping_time = 0; if (sofia_private && sofia_private->ping_sent) { - ping_time = switch_time_now() - sofia_private->ping_sent; + ping_time = (int)(switch_time_now() - sofia_private->ping_sent); } sip_user_status.status = ping_status; diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index 0ff2b7cec3..68fc8eb8ed 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -493,7 +493,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void break; } - source->prebuf = source->samples * 2 * source->channels; + source->prebuf = (uint32_t)(source->samples * 2 * source->channels); if (!source->total) { flush_video_queue(source->video_q); @@ -806,8 +806,8 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle local_stream_context_t *context = handle->private_info; switch_status_t status; switch_time_t now; - int fps = (int)ceil(handle->mm.fps); - int min_qsize = fps; + unsigned int fps = (unsigned int)ceil(handle->mm.fps); + unsigned int min_qsize = fps; if (!(context->ready && context->source->ready)) { return SWITCH_STATUS_FALSE; From e299489cfc1ba56c78bb6282a08e156f156f40db Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 27 Oct 2015 10:58:04 -0500 Subject: [PATCH 10/93] FS-8391 #resolve [SDP parsing error for rtcp-fb] --- src/switch_core_media.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 06dc92ebaf..096edeb1d0 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -7173,24 +7173,12 @@ SWITCH_DECLARE(void)switch_core_media_set_local_sdp(switch_core_session_t *sessi static void add_fb(char *buf, uint32_t buflen, int pt, int fir, int nack, int pli, int tmmbr) { - const char *zfir = ""; - const char *ztmmbr = ""; - char *sp = ""; - if (fir) { - zfir = "fir"; + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtcp-fb:%d ccm fir\n", pt); } if (tmmbr) { - ztmmbr = "tmmbr"; - } - - if (fir && tmmbr) { - sp = " "; - } - - if (!zstr(zfir) || !zstr(ztmmbr)) { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtcp-fb:%d ccm %s%s%s\n", pt, zfir, sp, ztmmbr); + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtcp-fb:%d ccm tmmbr\n", pt); } if (nack) { From 0316fdfcf1d2a72d1bad5dc9646371159173f93f Mon Sep 17 00:00:00 2001 From: Corey Burke Date: Fri, 2 Oct 2015 06:56:51 -0700 Subject: [PATCH 11/93] FS-8281: Expose SRTP and SRTCP crypto keys as channel vars New vars are srtp_{local,remote}_crypto_key and srtcp_{local,remote}_crypto_key. Allows decrypting packet captured media streams for debugging. --- conf/vanilla/autoload_configs/switch.conf.xml | 6 +++++ src/switch_core.c | 8 ++++++- src/switch_rtp.c | 22 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/conf/vanilla/autoload_configs/switch.conf.xml b/conf/vanilla/autoload_configs/switch.conf.xml index 4ffe878563..345a16c19e 100644 --- a/conf/vanilla/autoload_configs/switch.conf.xml +++ b/conf/vanilla/autoload_configs/switch.conf.xml @@ -152,6 +152,12 @@ + + + + +
+
+
+
+

Setup your camera and microphone settings

+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+ + +
+
+ + +
+ + + + +
+ +
+
+
+
+
+
diff --git a/html5/verto/verto_communicator/src/storageService/services/storage.js b/html5/verto/verto_communicator/src/storageService/services/storage.js index f0b8bb1b80..2ac76532f6 100644 --- a/html5/verto/verto_communicator/src/storageService/services/storage.js +++ b/html5/verto/verto_communicator/src/storageService/services/storage.js @@ -21,6 +21,7 @@ userStatus: 'disconnected', mutedVideo: false, mutedMic: false, + preview: true, selectedVideo: null, selectedAudio: null, selectedShare: null, diff --git a/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js b/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js index 966a7c1f7e..2962301362 100644 --- a/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js +++ b/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js @@ -41,6 +41,11 @@ templateUrl: 'partials/incall.html', controller: 'InCallController' }). + when('/preview', { + title: 'Preview Video', + templateUrl: 'partials/preview.html', + controller: 'PreviewController' + }). when('/browser-upgrade', { title: '', templateUrl: 'partials/browser_upgrade.html', diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js index 2944cae46d..14a8846f45 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js @@ -7,9 +7,9 @@ '$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory', 'eventQueue', function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory, eventQueue) { console.debug('Executing DialPadController.'); - + eventQueue.process(); - + $scope.call_history = CallHistory.all(); $scope.history_control = CallHistory.all_control(); $scope.has_history = Object.keys($scope.call_history).length; @@ -55,6 +55,10 @@ $rootScope.dialpadNumber = number; }; + $scope.preview = function() { + $location.path('/preview'); + }; + $rootScope.transfer = function() { if (!$rootScope.dialpadNumber) { return false; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index 571558c780..7bd5cb6819 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -52,7 +52,10 @@ storage.data.email = verto.data.email; storage.data.login = verto.data.login; storage.data.password = verto.data.password; - if (redirect) { + if (redirect && storage.data.preview) { + $location.path('/preview'); + } + else if (redirect) { $location.path('/dialpad'); } } diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/PreviewController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/PreviewController.js new file mode 100644 index 0000000000..61fbc5f2e2 --- /dev/null +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/PreviewController.js @@ -0,0 +1,142 @@ +(function() { + 'use strict'; + + angular + .module('vertoControllers') + .controller('PreviewController', ['$rootScope', '$scope', + '$http', '$location', '$modal', '$timeout', 'toastr', 'verto', 'storage', 'prompt', 'Fullscreen', + function($rootScope, $scope, $http, $location, $modal, $timeout, toastr, + verto, storage, prompt, Fullscreen) { + + $scope.storage = storage; + console.debug('Executing PreviewController.'); + var localVideo = document.getElementById('videopreview'); + var volumes = document.querySelector('#mic-meter .volumes').children; + + $scope.localVideo = function() { + var constraints = { + mirrored: true, + audio: { + optional: [{ sourceId: storage.data.selectedAudio }] + } + }; + + if (storage.data.selectedVideo !== 'none') { + constraints.video = { + optional: [{ sourceId: storage.data.selectedVideo }] + }; + } + + navigator.getUserMedia(constraints, handleMedia, function(err, data) { + + }); + }; + + var audioContext = new AudioContext(); + var mediaStreamSource = null; + var meter; + var streamObj = {}; + + function handleMedia(stream) { + streamObj.stop ? streamObj.stop() : streamObj.active = false; + + streamObj = stream; + localVideo.src = window.URL.createObjectURL(stream); + + mediaStreamSource = audioContext.createMediaStreamSource(stream); + meter = createAudioMeter(audioContext); + mediaStreamSource.connect(meter); + + renderMic(); + } + + function renderMic() { + // meter.volume; + var n = Math.round(meter.volume * 25); + for(var i = volumes.length -1, j = 0; i >= 0; i--, j++) { + var el = angular.element(volumes[j]); + if (i >= n) el.removeClass('active'); + else el.addClass('active'); + } + + if(!verto.data.call) { + window.requestAnimationFrame(renderMic); + } + } + /** + * TODO: useless? + */ + + $scope.refreshDeviceList = function() { + return verto.refreshDevices(); + }; + + $scope.videoCall = function() { + prompt({ + title: 'Would you like to activate video for this call?', + message: 'Video will be active during the next calls.' + }).then(function() { + storage.data.videoCall = true; + $scope.callTemplate = 'partials/video_call.html'; + }); + }; + + $scope.cbMuteVideo = function(event, data) { + storage.data.mutedVideo = !storage.data.mutedVideo; + } + + $scope.cbMuteMic = function(event, data) { + storage.data.mutedMic = !storage.data.mutedMic; + } + + $scope.confChangeVideoLayout = function(layout) { + verto.data.conf.setVideoLayout(layout); + }; + + $scope.endPreview = function() { + localVideo.src = null; + meter.shutdown(); + meter.onaudioprocess = null; + streamObj.stop(); + $location.path('/dialpad'); + storage.data.preview = false; + }; + + $scope.screenshare = function() { + if(verto.data.shareCall) { + verto.screenshareHangup(); + return false; + } + verto.screenshare(storage.data.called_number); + }; + + $scope.call = function() { + if($rootScope.dialpadNumber) { + localVideo.src = null; + meter.shutdown(); + meter.onaudioprocess = null; + streamObj.stop(); + } + $rootScope.call($rootScope.dialpadNumber); + }; + + $scope.muteMic = verto.muteMic; + $scope.muteVideo = verto.muteVideo; + + $rootScope.$on('ScreenShareExtensionStatus', function(event, error) { + var pluginUrl = 'https://chrome.google.com/webstore/detail/screen-capturing/ajhifddimkapgcifgcodmmfdlknahffk'; + switch(error) { + case 'permission-denied': + toastr.info('Please allow the plugin in order to use Screen Share', 'Error'); break; + case 'not-installed': + toastr.warning('Please install the plugin in order to use Screen Share', 'Warning', { allowHtml: true }); break; + case 'installed-disabled': + toastr.info('Please enable the plugin in order to use Screen Share', 'Error'); break; + // case 'not-chrome' + // toastr.info('Chrome', 'Error'); + } + }); + $scope.localVideo(); + } + ]); +})(); diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js index fdc96efd59..6fd32f9de7 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js @@ -3,10 +3,10 @@ angular .module('vertoControllers') - .controller('SplashScreenController', ['$scope', '$rootScope', '$location', '$timeout', 'splashscreen', 'prompt', 'verto', - function($scope, $rootScope, $location, $timeout, splashscreen, prompt, verto) { + .controller('SplashScreenController', ['$scope', '$rootScope', '$location', '$timeout', 'storage', 'splashscreen', 'prompt', 'verto', + function($scope, $rootScope, $location, $timeout, storage, splashscreen, prompt, verto) { console.debug('Executing SplashScreenController.'); - + $scope.progress_percentage = splashscreen.progress_percentage; $scope.message = ''; $scope.interrupt_next = false; @@ -18,26 +18,26 @@ link = activity; } } - + $location.path(link); } var checkProgressState = function(current_progress, status, promise, activity, soft, interrupt, message) { - $scope.progress_percentage = splashscreen.calculate(current_progress); + $scope.progress_percentage = splashscreen.calculate(current_progress); $scope.message = message; if(interrupt && status == 'error') { $scope.errors.push(message); if(!soft) { - redirectTo('', activity); + redirectTo('', activity); return; } else { - message = message + '. Continue?'; + message = message + '. Continue?'; }; if(!confirm(message)) { - $scope.interrupt_next = true; - }; + $scope.interrupt_next = true; + }; }; if($scope.interrupt_next) { @@ -48,7 +48,7 @@ return true; }; - + $rootScope.$on('progress.next', function(ev, current_progress, status, promise, activity, soft, interrupt, message) { $timeout(function() { if(promise) { @@ -62,11 +62,11 @@ return; } - + if(!checkProgressState(current_progress, status, promise, activity, soft, interrupt, message)) { return; } - + splashscreen.next(); }, 400); }); @@ -74,7 +74,12 @@ $rootScope.$on('progress.complete', function(ev, current_progress) { $scope.message = 'Complete'; if(verto.data.connected) { - redirectTo('/dialpad'); + if (storage.data.preview) { + $location.path('/preview'); + } + else { + $location.path('/dialpad'); + } } else { redirectTo('/login'); $location.path('/login'); From 91e86ab352b2cbe403486fc271b78e284a4906ae Mon Sep 17 00:00:00 2001 From: Italo Rossi Date: Fri, 6 Nov 2015 16:38:15 -0300 Subject: [PATCH 31/93] FS-8400 [verto_communicator] Removing deprecated use of stream.stop(), removing unused code and making volume meter gray so we can see it in a white background --- .../verto_communicator/src/css/verto.css | 6 +-- .../src/partials/preview.html | 23 -------- .../controllers/PreviewController.js | 52 ++++++------------- 3 files changed, 19 insertions(+), 62 deletions(-) diff --git a/html5/verto/verto_communicator/src/css/verto.css b/html5/verto/verto_communicator/src/css/verto.css index c9694e15d3..84ca62e730 100644 --- a/html5/verto/verto_communicator/src/css/verto.css +++ b/html5/verto/verto_communicator/src/css/verto.css @@ -1488,7 +1488,7 @@ body:-webkit-full-screen #incall .video-footer { } #mic-meter .icon { margin-left: 3px; - color: white; + color: #CCC; } #mic-meter .volumes { width: 30px; @@ -1497,13 +1497,13 @@ body:-webkit-full-screen #incall .video-footer { height: 10px; width: 100%; border-radius: 5px; - border: 2px solid white; + border: 2px solid #CCC; display: block; margin-top: 1.5px; } #mic-meter .volumes .volume-segment.active { - background-color: white; + background-color: #CCC; } #preview .refresh { diff --git a/html5/verto/verto_communicator/src/partials/preview.html b/html5/verto/verto_communicator/src/partials/preview.html index 947b0afb04..76e3b68744 100644 --- a/html5/verto/verto_communicator/src/partials/preview.html +++ b/html5/verto/verto_communicator/src/partials/preview.html @@ -1,26 +1,3 @@ - -
diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/PreviewController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/PreviewController.js index 61fbc5f2e2..6a1d649430 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/PreviewController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/PreviewController.js @@ -37,8 +37,22 @@ var meter; var streamObj = {}; + function stopMedia(stream) { + if (typeof stream == 'function') { + stream.stop(); + } else { + if (stream.active) { + var tracks = stream.getTracks(); + tracks.forEach(function(track, index) { + track.stop(); + }) + } + } + } function handleMedia(stream) { - streamObj.stop ? streamObj.stop() : streamObj.active = false; + if (streamObj) { + stopMedia(streamObj); + } streamObj = stream; localVideo.src = window.URL.createObjectURL(stream); @@ -97,45 +111,11 @@ localVideo.src = null; meter.shutdown(); meter.onaudioprocess = null; - streamObj.stop(); + stopMedia(streamObj); $location.path('/dialpad'); storage.data.preview = false; }; - $scope.screenshare = function() { - if(verto.data.shareCall) { - verto.screenshareHangup(); - return false; - } - verto.screenshare(storage.data.called_number); - }; - - $scope.call = function() { - if($rootScope.dialpadNumber) { - localVideo.src = null; - meter.shutdown(); - meter.onaudioprocess = null; - streamObj.stop(); - } - $rootScope.call($rootScope.dialpadNumber); - }; - - $scope.muteMic = verto.muteMic; - $scope.muteVideo = verto.muteVideo; - - $rootScope.$on('ScreenShareExtensionStatus', function(event, error) { - var pluginUrl = 'https://chrome.google.com/webstore/detail/screen-capturing/ajhifddimkapgcifgcodmmfdlknahffk'; - switch(error) { - case 'permission-denied': - toastr.info('Please allow the plugin in order to use Screen Share', 'Error'); break; - case 'not-installed': - toastr.warning('Please install the plugin in order to use Screen Share', 'Warning', { allowHtml: true }); break; - case 'installed-disabled': - toastr.info('Please enable the plugin in order to use Screen Share', 'Error'); break; - // case 'not-chrome' - // toastr.info('Chrome', 'Error'); - } - }); $scope.localVideo(); } ]); From 828d6eaf0177caff9b60052be3c83b2008f85416 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 3 Oct 2015 02:36:28 -0500 Subject: [PATCH 32/93] first pass, add some funcs to conference and speed test features and fix bugs in ws.c for big payloads --- html5/verto/js/src/jquery.jsonrpcclient.js | 33 +++++ html5/verto/video_demo/index.html | 17 ++- html5/verto/video_demo/js/verto-min.js | 6 +- html5/verto/video_demo/verto.js | 27 +++- .../mod_conference/conference_video.c | 98 ++++++++++++-- .../mod_conference/mod_conference.c | 2 +- .../mod_conference/mod_conference.h | 4 + src/mod/endpoints/mod_verto/mod_verto.c | 39 +++++- src/mod/endpoints/mod_verto/ws.c | 125 +++++++++++++----- src/mod/endpoints/mod_verto/ws.h | 7 +- 10 files changed, 297 insertions(+), 61 deletions(-) diff --git a/html5/verto/js/src/jquery.jsonrpcclient.js b/html5/verto/js/src/jquery.jsonrpcclient.js index a02885e802..58d9986aec 100644 --- a/html5/verto/js/src/jquery.jsonrpcclient.js +++ b/html5/verto/js/src/jquery.jsonrpcclient.js @@ -91,6 +91,19 @@ /// The next JSON-RPC request id. $.JsonRpcClient.prototype._current_id = 1; + + $.JsonRpcClient.prototype.speedTest = function (bytes, cb) { + var socket = this.options.getSocket(this.wsOnMessage); + if (socket !== null) { + this.speedCB = cb; + this.speedBytes = bytes; + socket.send("#SPU"); + socket.send("#SPB\n" + new Array(bytes).join(".")); + } + }; + + + /** * @fn call * @memberof $.JsonRpcClient @@ -382,6 +395,26 @@ $.JsonRpcClient.prototype._wsOnMessage = function(event) { // Check if this could be a JSON RPC message. var response; + + // Special sub proto + if (event.data[0] == "#" && event.data[1] == "S" && event.data[2] == "P") { + if (event.data[3] == "U") { + this.up_dur = parseInt(event.data.substring(4)); + } else if (this.speedCB && event.data[3] == "D") { + this.down_dur = parseInt(event.data.substring(4)); + + var up_kps = (((this.speedBytes * 8) / (this.up_dur / 1000)) / 1024).toFixed(0); + var down_kps = (((this.speedBytes * 8) / (this.down_dur / 1000)) / 1024).toFixed(0); + + console.info("Speed Test: Up: " + up_kps + " Down: " + down_kps); + this.speedCB(event, { upDur: this.up_dur, downDur: this.down_dur, upKPS: up_kps, downKPS: down_kps }); + this.speedCB = null; + } + + return; + } + + try { response = $.parseJSON(event.data); diff --git a/html5/verto/video_demo/index.html b/html5/verto/video_demo/index.html index bd3d98fe4a..6c42ff1ad5 100644 --- a/html5/verto/video_demo/index.html +++ b/html5/verto/video_demo/index.html @@ -91,7 +91,7 @@ div#preload { display: none; }
@@ -108,6 +108,18 @@ div#preload { display: none; }
+
+ + +

Testing Network Connection

+ + + +
+ +