mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 20:50:41 +00:00
Merge branch 'master' into v1.4
This commit is contained in:
commit
db111f6a29
92
build/Makefile.centos5
Normal file
92
build/Makefile.centos5
Normal file
@ -0,0 +1,92 @@
|
||||
#
|
||||
# FreeSWITCH auto-build Makefile (CentOS 5.10 Wingardium Leviosa Edition)
|
||||
# http://www.freeswitch.org
|
||||
# put this file anywhere and type make to
|
||||
# create a fully-built freeswitch.git from scratch
|
||||
# in that same directory.
|
||||
#
|
||||
# Brian West <brian@freeswitch.org>
|
||||
#
|
||||
FSPREFIX=/usr/local/freeswitch
|
||||
PREFIX=/opt/fs-libs
|
||||
JPEG=v8d
|
||||
OPENSSL=1.0.1g
|
||||
SQLITE=autoconf-3080403
|
||||
PCRE=8.35
|
||||
CURL=7.36.0
|
||||
SPEEX=1.2rc1
|
||||
LIBEDIT=20140213-3.1
|
||||
LDNS=1.6.17
|
||||
|
||||
freeswitch: deps has-git freeswitch.git/Makefile
|
||||
cd freeswitch.git && make
|
||||
|
||||
freeswitch.git/Makefile: freeswitch.git/configure
|
||||
cd freeswitch.git && PKG_CONFIG_PATH=$(PREFIX)/lib/pkgconfig ./configure LDFLAGS='-L$(PREFIX)/lib -Wl,-rpath=$(PREFIX)/lib' CFLAGS='-I$(PREFIX)/include' --prefix=$(FSPREFIX)
|
||||
|
||||
freeswitch.git/configure: freeswitch.git/bootstrap.sh
|
||||
cd freeswitch.git && sh bootstrap.sh
|
||||
|
||||
freeswitch.git/bootstrap.sh: has-git
|
||||
test -d freeswitch.git || git clone git://git.freeswitch.org/freeswitch.git freeswitch.git
|
||||
|
||||
install: freeswitch
|
||||
cd freeswitch.git && make install
|
||||
|
||||
install-git:
|
||||
rpm -i http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
|
||||
yum update -y
|
||||
yum install -y git gcc-c++ wget ncurses-devel zlib-devel e2fsprogs-devel libtool automake autoconf
|
||||
|
||||
has-git:
|
||||
@git --version || (echo "please install git by running 'make install-git'" && false)
|
||||
|
||||
libjpeg: jpeg-8d/Makefile
|
||||
|
||||
jpeg-8d/Makefile:
|
||||
(test -d jpeg-8d) || (wget -4 -O jpegsrc.$(JPEG).tar.gz http://www.ijg.org/files/jpegsrc.$(JPEG).tar.gz && tar zxfv jpegsrc.$(JPEG).tar.gz)
|
||||
(cd jpeg-8d && ./configure --prefix=$(PREFIX) && make && sudo make install)
|
||||
|
||||
openssl: openssl-$(OPENSSL)
|
||||
|
||||
openssl-$(OPENSSL):
|
||||
(test -d $@) || (wget -4 -O $@.tar.gz http://www.openssl.org/source/$@.tar.gz && tar zxfv $@.tar.gz)
|
||||
(cd $@ && ./Configure --prefix=$(PREFIX) linux-x86_64 shared && make && sudo make install)
|
||||
|
||||
sqlite: sqlite-$(SQLITE)
|
||||
|
||||
sqlite-$(SQLITE):
|
||||
(test -d $@) || (wget -4 -O $@.tar.gz http://www.sqlite.org/2014/$@.tar.gz && tar zxfv $@.tar.gz)
|
||||
(cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install)
|
||||
|
||||
pcre: pcre-$(PCRE)
|
||||
|
||||
pcre-$(PCRE):
|
||||
(test -d $@) || (wget -4 -O $@.tar.gz http://downloads.sourceforge.net/project/pcre/pcre/$(PCRE)/$@.tar.gz && tar zxfv $@.tar.gz)
|
||||
(cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install)
|
||||
|
||||
curl: curl-$(CURL)
|
||||
|
||||
curl-$(CURL):
|
||||
(test -d $@) || (wget -4 -O $@.tar.gz http://curl.haxx.se/download/$@.tar.gz && tar zxfv $@.tar.gz)
|
||||
(cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install)
|
||||
|
||||
speex: speex-$(SPEEX)
|
||||
|
||||
speex-$(SPEEX):
|
||||
(test -d $@) || (wget -4 -O $@.tar.gz http://downloads.xiph.org/releases/speex/$@.tar.gz && tar zxfv $@.tar.gz)
|
||||
(cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install)
|
||||
|
||||
libedit: libedit-$(LIBEDIT)
|
||||
|
||||
libedit-$(LIBEDIT):
|
||||
(test -d $@) || (wget -4 -O $@.tar.gz http://thrysoee.dk/editline/$@.tar.gz && tar zxfv $@.tar.gz)
|
||||
(cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install)
|
||||
|
||||
ldns: ldns-$(LDNS)
|
||||
|
||||
ldns-$(LDNS): openssl
|
||||
(test -d $@) || (wget -4 -O $@.tar.gz http://www.nlnetlabs.nl/downloads/ldns/$@.tar.gz && tar zxfv $@.tar.gz)
|
||||
(cd $@ && ./configure --with-ssl=$(PREFIX) --prefix=$(PREFIX) && make && sudo make install)
|
||||
|
||||
deps: libjpeg openssl sqlite pcre curl speex libedit ldns
|
34
build/Makefile.centos6
Normal file
34
build/Makefile.centos6
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# FreeSWITCH auto-build Makefile (CentOS 6.5/Debian 7 Nike Edition, JUST DO IT!)
|
||||
# http://www.freeswitch.org
|
||||
# put this file anywhere and type make to
|
||||
# create a fully-built freeswitch.git from scratch
|
||||
# in that same directory.
|
||||
#
|
||||
#
|
||||
RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel
|
||||
DEBS=git build-essential automake autoconf libtool wget python zlib1g-dev libjpeg-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev
|
||||
|
||||
freeswitch: deps has-git freeswitch.git/Makefile
|
||||
cd freeswitch.git && make
|
||||
|
||||
freeswitch.git/Makefile: freeswitch.git/configure
|
||||
cd freeswitch.git && ./configure
|
||||
|
||||
freeswitch.git/configure: freeswitch.git/bootstrap.sh
|
||||
cd freeswitch.git && sh bootstrap.sh
|
||||
|
||||
freeswitch.git/bootstrap.sh: has-git
|
||||
test -d freeswitch.git || git clone git://git.freeswitch.org/freeswitch.git freeswitch.git
|
||||
|
||||
rpmforge:
|
||||
(which rpm && rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm) || true
|
||||
|
||||
install:
|
||||
cd freeswitch.git && make install
|
||||
|
||||
has-git:
|
||||
@git --version || (echo "please install git" && false)
|
||||
|
||||
deps: rpmforge
|
||||
((which yum && yum -y install $(RPMS)) || (which apt-get && apt-get -y install $(DEBS))) || true
|
47
build/coverity_model.c
Normal file
47
build/coverity_model.c
Normal file
@ -0,0 +1,47 @@
|
||||
/* Coverity Scan model
|
||||
*
|
||||
* This is a modelling file for Coverity Scan. Modelling helps to avoid false
|
||||
* positives.
|
||||
*
|
||||
* - A model file can't import any header files.
|
||||
* - Therefore only some built-in primitives like int, char and void are
|
||||
* available but not NULL etc.
|
||||
* - Modelling doesn't need full structs and typedefs. Rudimentary structs
|
||||
* and similar types are sufficient.
|
||||
* - An uninitialised local pointer is not an error. It signifies that the
|
||||
* variable could be either NULL or have some data.
|
||||
*
|
||||
* Coverity Scan doesn't pick up modifications automatically. The model file
|
||||
* must be uploaded by an admin in the analysis.
|
||||
*
|
||||
* Based on:
|
||||
* http://hg.python.org/cpython/file/tip/Misc/coverity_model.c
|
||||
* Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
* 2011, 2012, 2013 Python Software Foundation; All Rights Reserved
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Useful references:
|
||||
* https://scan.coverity.com/models
|
||||
*/
|
||||
|
||||
typedef unsigned int switch_status_t;
|
||||
|
||||
struct pthread_mutex_t {};
|
||||
|
||||
struct switch_mutex
|
||||
{
|
||||
struct pthread_mutex_t lock;
|
||||
};
|
||||
typedef struct switch_mutex switch_mutex_t;
|
||||
|
||||
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
|
||||
{
|
||||
__coverity_recursive_lock_acquire__(&lock->lock);
|
||||
}
|
||||
|
||||
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
|
||||
{
|
||||
__coverity_recursive_lock_release__(&lock->lock);
|
||||
}
|
@ -68,7 +68,7 @@ codecs/mod_vp8
|
||||
#codecs/mod_ilbc
|
||||
#codecs/mod_isac
|
||||
#codecs/mod_mp4v
|
||||
#codecs/mod_opus
|
||||
codecs/mod_opus
|
||||
#codecs/mod_sangoma_codec
|
||||
#codecs/mod_silk
|
||||
#codecs/mod_siren
|
||||
@ -82,6 +82,7 @@ dialplans/mod_dialplan_xml
|
||||
#endpoints/mod_gsmopen
|
||||
#endpoints/mod_h323
|
||||
#endpoints/mod_khomp
|
||||
endpoints/mod_rtc
|
||||
endpoints/mod_loopback
|
||||
#endpoints/mod_opal
|
||||
#endpoints/mod_portaudio
|
||||
@ -121,6 +122,7 @@ languages/mod_lua
|
||||
#languages/mod_v8
|
||||
#languages/mod_yaml
|
||||
loggers/mod_console
|
||||
#loggers/mod_graylog2
|
||||
loggers/mod_logfile
|
||||
loggers/mod_syslog
|
||||
#say/mod_say_de
|
||||
|
@ -3,6 +3,7 @@
|
||||
<!-- Don't change these unless you are insane -->
|
||||
<!--<param name="decoder" value="i586"/>-->
|
||||
<!--<param name="volume" value=".1"/>-->
|
||||
<!--<param name="outscale" value="8192"/>-->
|
||||
<!-- mod_shout sets output amplitude scale to 8192 by default - preserve mpg123 default of 32768 -->
|
||||
<param name="outscale" value="32768"/>
|
||||
</settings>
|
||||
</configuration>
|
||||
|
@ -90,7 +90,7 @@
|
||||
<!--<load module="mod_siren"/>-->
|
||||
<!--<load module="mod_isac"/>-->
|
||||
<!--<load module="mod_celt"/>-->
|
||||
<!--<load module="mod_opus"/>-->
|
||||
<load module="mod_opus"/>
|
||||
|
||||
<!-- File Format Interfaces -->
|
||||
<load module="mod_sndfile"/>
|
||||
|
@ -243,7 +243,7 @@
|
||||
127 - BV32
|
||||
|
||||
-->
|
||||
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=G722,PCMU,PCMA,GSM"/>
|
||||
<X-PRE-PROCESS cmd="set" data="global_codec_prefs=OPUS,G722,PCMU,PCMA,GSM"/>
|
||||
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,GSM"/>
|
||||
|
||||
<!--
|
||||
|
@ -1499,6 +1499,7 @@ AC_CONFIG_FILES([Makefile
|
||||
src/mod/endpoints/mod_skypopen/Makefile
|
||||
src/mod/endpoints/mod_sofia/Makefile
|
||||
src/mod/endpoints/mod_unicall/Makefile
|
||||
src/mod/endpoints/mod_rtc/Makefile
|
||||
src/mod/event_handlers/mod_cdr_csv/Makefile
|
||||
src/mod/event_handlers/mod_cdr_mongodb/Makefile
|
||||
src/mod/event_handlers/mod_cdr_pg_csv/Makefile
|
||||
@ -1533,6 +1534,7 @@ AC_CONFIG_FILES([Makefile
|
||||
src/mod/legacy/languages/mod_lua/Makefile
|
||||
src/mod/legacy/languages/mod_spidermonkey/Makefile
|
||||
src/mod/loggers/mod_console/Makefile
|
||||
src/mod/loggers/mod_graylog2/Makefile
|
||||
src/mod/loggers/mod_logfile/Makefile
|
||||
src/mod/loggers/mod_syslog/Makefile
|
||||
src/mod/say/mod_say_de/Makefile
|
||||
|
4
debian/control-modules
vendored
4
debian/control-modules
vendored
@ -588,6 +588,10 @@ Module: loggers/mod_logfile
|
||||
Description: mod_logfile
|
||||
Adds mod_logfile.
|
||||
|
||||
Module: loggers/mod_graylog2
|
||||
Description: mod_graylog2
|
||||
Adds mod_greylog2.
|
||||
|
||||
Module: loggers/mod_syslog
|
||||
Description: mod_syslog
|
||||
Adds mod_syslog.
|
||||
|
@ -17,7 +17,7 @@ endif
|
||||
|
||||
$(MYLIB): libesl.la
|
||||
|
||||
bin_PROGRAMS = fs_cli ivrd
|
||||
bin_PROGRAMS = fs_cli fs_ivrd
|
||||
noinst_PROGRAMS = testclient testserver testserver_fork
|
||||
|
||||
fs_cli_SOURCES = fs_cli.c
|
||||
@ -40,10 +40,10 @@ testserver_fork_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include
|
||||
testserver_fork_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS) $(LIBS)
|
||||
testserver_fork_LDADD = libesl.la
|
||||
|
||||
ivrd_SOURCES = ivrd.c
|
||||
ivrd_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include
|
||||
ivrd_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS) $(LIBS)
|
||||
ivrd_LDADD = libesl.la
|
||||
fs_ivrd_SOURCES = ivrd.c
|
||||
fs_ivrd_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include
|
||||
fs_ivrd_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS) $(LIBS)
|
||||
fs_ivrd_LDADD = libesl.la
|
||||
|
||||
reswig: swigclean
|
||||
$(MAKE) -C perl reswig
|
||||
|
@ -645,6 +645,7 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool
|
||||
\brief Allocate memory directly from a memory pool
|
||||
\param _pool the memory pool to allocate from
|
||||
\param _mem the number of bytes to allocate
|
||||
\remark the memory returned has been memset to zero
|
||||
\return a void pointer to the allocated memory
|
||||
*/
|
||||
#define switch_core_alloc(_pool, _mem) switch_core_perform_alloc(_pool, _mem, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@ if ISMAC
|
||||
mod_cepstral_la_LDFLAGS += -framework swift
|
||||
mod_cepstral_la_CFLAGS += -I/Library/Frameworks/swift.framework/Versions/5/Headers/
|
||||
else
|
||||
mod_cepstral_la_LDFLAGS += -L$(SWIFT_HOME)/lib -L/opt/swift/lib -lswift -lm
|
||||
mod_cepstral_la_LDFLAGS += -Wl,-rpath -Wl,/opt/swift/lib -L$(SWIFT_HOME)/lib -L/opt/swift/lib -lswift -lm
|
||||
mod_cepstral_la_CFLAGS += -I$(SWIFT_HOME)/include -I/opt/swift/include
|
||||
endif
|
||||
|
||||
|
8
src/mod/endpoints/mod_rtc/Makefile.am
Normal file
8
src/mod/endpoints/mod_rtc/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
include $(top_srcdir)/build/modmake.rulesam
|
||||
MODNAME=mod_rtc
|
||||
|
||||
mod_LTLIBRARIES = mod_rtc.la
|
||||
mod_rtc_la_SOURCES = mod_rtc.c
|
||||
mod_rtc_la_CFLAGS = $(AM_CFLAGS)
|
||||
mod_rtc_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||
mod_rtc_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
463
src/mod/endpoints/mod_rtc/mod_rtc.c
Normal file
463
src/mod/endpoints/mod_rtc/mod_rtc.c
Normal file
@ -0,0 +1,463 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, 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
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
*
|
||||
* mod_rtc.c -- RTC Endpoint
|
||||
*
|
||||
*/
|
||||
|
||||
/* Best viewed in a 160 x 60 VT100 Terminal or so the line below at least fits across your screen*/
|
||||
/*************************************************************************************************************************************************************/
|
||||
#include <switch.h>
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_rtc_load);
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rtc_shutdown);
|
||||
SWITCH_MODULE_DEFINITION(mod_rtc, mod_rtc_load, mod_rtc_shutdown, NULL);
|
||||
|
||||
|
||||
switch_endpoint_interface_t *rtc_endpoint_interface;
|
||||
|
||||
#define STRLEN 15
|
||||
|
||||
static switch_status_t rtc_on_init(switch_core_session_t *session);
|
||||
|
||||
static switch_status_t rtc_on_exchange_media(switch_core_session_t *session);
|
||||
static switch_status_t rtc_on_soft_execute(switch_core_session_t *session);
|
||||
static switch_call_cause_t rtc_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
|
||||
switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
|
||||
switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
|
||||
static switch_status_t rtc_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t rtc_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t rtc_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t rtc_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t rtc_kill_channel(switch_core_session_t *session, int sig);
|
||||
|
||||
typedef struct {
|
||||
switch_channel_t *channel;
|
||||
switch_core_session_t *session;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
switch_media_handle_t *media_handle;
|
||||
switch_core_media_params_t mparams;
|
||||
} private_object_t;
|
||||
|
||||
static struct {
|
||||
switch_memory_pool_t *pool;
|
||||
switch_mutex_t *mutex;
|
||||
int running;
|
||||
} mod_rtc_globals;
|
||||
|
||||
|
||||
/* BODY OF THE MODULE */
|
||||
/*************************************************************************************************************************************************************/
|
||||
|
||||
/*
|
||||
State methods they get called when the state changes to the specific state
|
||||
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
||||
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
||||
*/
|
||||
static switch_status_t rtc_on_init(switch_core_session_t *session)
|
||||
{
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t rtc_on_routing(switch_core_session_t *session)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RTC ROUTING\n",
|
||||
switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t rtc_on_reset(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RTC RESET\n",
|
||||
switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t rtc_on_hibernate(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RTC HIBERNATE\n",
|
||||
switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t rtc_on_execute(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RTC EXECUTE\n",
|
||||
switch_channel_get_name(switch_core_session_get_channel(session)));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
switch_status_t rtc_on_destroy(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RTC DESTROY\n", switch_channel_get_name(channel));
|
||||
switch_media_handle_destroy(session);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
switch_status_t rtc_on_hangup(switch_core_session_t *session)
|
||||
{
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t rtc_on_exchange_media(switch_core_session_t *session)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RTC EXCHANGE_MEDIA\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t rtc_on_soft_execute(switch_core_session_t *session)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RTC SOFT_EXECUTE\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t rtc_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
return switch_core_media_read_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_VIDEO);
|
||||
}
|
||||
|
||||
static switch_status_t rtc_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
if (SWITCH_STATUS_SUCCESS == switch_core_media_write_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_VIDEO)) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static switch_status_t rtc_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
|
||||
status = switch_core_media_read_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_AUDIO);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static switch_status_t rtc_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
status = switch_core_media_write_frame(session, frame, flags, stream_id, SWITCH_MEDIA_TYPE_AUDIO);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static switch_status_t rtc_kill_channel(switch_core_session_t *session, int sig)
|
||||
{
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
if (!tech_pvt) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
switch (sig) {
|
||||
case SWITCH_SIG_BREAK:
|
||||
if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
|
||||
switch_core_media_break(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO);
|
||||
}
|
||||
if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO)) {
|
||||
switch_core_media_break(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO);
|
||||
}
|
||||
break;
|
||||
case SWITCH_SIG_KILL:
|
||||
default:
|
||||
|
||||
if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
|
||||
switch_core_media_kill_socket(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO);
|
||||
}
|
||||
if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO)) {
|
||||
switch_core_media_kill_socket(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t rtc_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
|
||||
{
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t rtc_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
const char *var;
|
||||
|
||||
if (switch_channel_down(channel) || !tech_pvt) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
/* ones that do not need to lock rtp mutex */
|
||||
switch (msg->message_id) {
|
||||
|
||||
case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS:
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
||||
{
|
||||
|
||||
if (((var = switch_channel_get_variable(channel, "rtp_secure_media"))) &&
|
||||
(switch_true(var) || switch_core_media_crypto_str2type(var) != CRYPTO_INVALID)) {
|
||||
switch_channel_set_flag(tech_pvt->channel, CF_SECURE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t rtc_receive_event(switch_core_session_t *session, switch_event_t *event)
|
||||
{
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
switch_io_routines_t rtc_io_routines = {
|
||||
/*.outgoing_channel */ rtc_outgoing_channel,
|
||||
/*.read_frame */ rtc_read_frame,
|
||||
/*.write_frame */ rtc_write_frame,
|
||||
/*.kill_channel */ rtc_kill_channel,
|
||||
/*.send_dtmf */ rtc_send_dtmf,
|
||||
/*.receive_message */ rtc_receive_message,
|
||||
/*.receive_event */ rtc_receive_event,
|
||||
/*.state_change */ NULL,
|
||||
/*.read_video_frame */ rtc_read_video_frame,
|
||||
/*.write_video_frame */ rtc_write_video_frame,
|
||||
/*.state_run*/ NULL,
|
||||
/*.get_jb*/ NULL
|
||||
};
|
||||
|
||||
switch_state_handler_table_t rtc_event_handlers = {
|
||||
/*.on_init */ rtc_on_init,
|
||||
/*.on_routing */ rtc_on_routing,
|
||||
/*.on_execute */ rtc_on_execute,
|
||||
/*.on_hangup */ rtc_on_hangup,
|
||||
/*.on_exchange_media */ rtc_on_exchange_media,
|
||||
/*.on_soft_execute */ rtc_on_soft_execute,
|
||||
/*.on_consume_media */ NULL,
|
||||
/*.on_hibernate */ rtc_on_hibernate,
|
||||
/*.on_reset */ rtc_on_reset,
|
||||
/*.on_park */ NULL,
|
||||
/*.on_reporting */ NULL,
|
||||
/*.on_destroy */ rtc_on_destroy
|
||||
};
|
||||
|
||||
|
||||
void rtc_set_name(private_object_t *tech_pvt, const char *channame)
|
||||
{
|
||||
char name[256];
|
||||
|
||||
switch_snprintf(name, sizeof(name), "rtc/%s", channame);
|
||||
switch_channel_set_name(tech_pvt->channel, name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void rtc_attach_private(switch_core_session_t *session, private_object_t *tech_pvt, const char *channame)
|
||||
{
|
||||
|
||||
switch_assert(session != NULL);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
|
||||
tech_pvt->session = session;
|
||||
tech_pvt->channel = switch_core_session_get_channel(session);
|
||||
switch_core_media_check_dtmf_type(session);
|
||||
switch_channel_set_cap(tech_pvt->channel, CC_JITTERBUFFER);
|
||||
switch_channel_set_cap(tech_pvt->channel, CC_FS_RTP);
|
||||
switch_media_handle_create(&tech_pvt->media_handle, session, &tech_pvt->mparams);
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
|
||||
if (channame) {
|
||||
rtc_set_name(tech_pvt, channame);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private_object_t *rtc_new_pvt(switch_core_session_t *session)
|
||||
{
|
||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t));
|
||||
return tech_pvt;
|
||||
}
|
||||
|
||||
static switch_call_cause_t rtc_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
|
||||
switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
|
||||
switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
|
||||
{
|
||||
switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
switch_core_session_t *nsession = NULL;
|
||||
switch_caller_profile_t *caller_profile = NULL;
|
||||
private_object_t *tech_pvt = NULL;
|
||||
switch_channel_t *nchannel;
|
||||
const char *hval = NULL;
|
||||
|
||||
*new_session = NULL;
|
||||
|
||||
|
||||
if (!(nsession = switch_core_session_request_uuid(rtc_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND,
|
||||
flags, pool, switch_event_get_header(var_event, "origination_uuid")))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
tech_pvt = rtc_new_pvt(nsession);
|
||||
|
||||
nchannel = switch_core_session_get_channel(nsession);
|
||||
|
||||
if (outbound_profile) {
|
||||
caller_profile = switch_caller_profile_clone(nsession, outbound_profile);
|
||||
switch_channel_set_caller_profile(nchannel, caller_profile);
|
||||
}
|
||||
|
||||
if ((hval = switch_event_get_header(var_event, "media_webrtc")) && switch_true(hval)) {
|
||||
switch_channel_set_variable(nchannel, "rtc_secure_media", SWITCH_RTP_CRYPTO_KEY_80);
|
||||
}
|
||||
|
||||
if ((hval = switch_event_get_header(var_event, "rtc_secure_media"))) {
|
||||
switch_channel_set_variable(nchannel, "rtc_secure_media", hval);
|
||||
}
|
||||
|
||||
rtc_attach_private(nsession, tech_pvt, NULL);
|
||||
|
||||
|
||||
if (switch_channel_get_state(nchannel) == CS_NEW) {
|
||||
switch_channel_set_state(nchannel, CS_INIT);
|
||||
}
|
||||
|
||||
tech_pvt->caller_profile = caller_profile;
|
||||
*new_session = nsession;
|
||||
cause = SWITCH_CAUSE_SUCCESS;
|
||||
|
||||
|
||||
if (session) {
|
||||
switch_ivr_transfer_variable(session, nsession, "rtc_video_fmtp");
|
||||
}
|
||||
|
||||
goto done;
|
||||
|
||||
error:
|
||||
|
||||
if (nsession) {
|
||||
switch_core_session_destroy(&nsession);
|
||||
}
|
||||
|
||||
if (pool) {
|
||||
*pool = NULL;
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
return cause;
|
||||
}
|
||||
|
||||
static int rtc_recover_callback(switch_core_session_t *session)
|
||||
{
|
||||
private_object_t *tech_pvt = rtc_new_pvt(session);
|
||||
rtc_attach_private(session, tech_pvt, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_rtc_load)
|
||||
{
|
||||
memset(&mod_rtc_globals, 0, sizeof(mod_rtc_globals));
|
||||
mod_rtc_globals.pool = pool;
|
||||
switch_mutex_init(&mod_rtc_globals.mutex, SWITCH_MUTEX_NESTED, mod_rtc_globals.pool);
|
||||
|
||||
switch_mutex_lock(mod_rtc_globals.mutex);
|
||||
mod_rtc_globals.running = 1;
|
||||
switch_mutex_unlock(mod_rtc_globals.mutex);
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
|
||||
rtc_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
|
||||
rtc_endpoint_interface->interface_name = "rtc";
|
||||
rtc_endpoint_interface->io_routines = &rtc_io_routines;
|
||||
rtc_endpoint_interface->state_handler = &rtc_event_handlers;
|
||||
rtc_endpoint_interface->recover_callback = rtc_recover_callback;
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rtc_shutdown)
|
||||
{
|
||||
switch_mutex_lock(mod_rtc_globals.mutex);
|
||||
if (mod_rtc_globals.running == 1) {
|
||||
mod_rtc_globals.running = 0;
|
||||
}
|
||||
switch_mutex_unlock(mod_rtc_globals.mutex);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
|
||||
*/
|
||||
|
@ -5464,10 +5464,8 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
||||
tech_pvt->mparams.last_sdp_str = NULL;
|
||||
if (sip->sip_payload && sip->sip_payload->pl_data) {
|
||||
switch_core_media_set_sdp_codec_string(session, sip->sip_payload->pl_data, SDP_TYPE_RESPONSE);
|
||||
|
||||
if (!sofia_use_soa(tech_pvt)) {
|
||||
tech_pvt->mparams.last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
|
||||
}
|
||||
|
||||
tech_pvt->mparams.last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
|
||||
}
|
||||
|
||||
|
||||
@ -6152,7 +6150,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
}
|
||||
}
|
||||
|
||||
if (status > 100 && status < 300 && tech_pvt && !sofia_use_soa(tech_pvt) && !r_sdp && tech_pvt->mparams.last_sdp_str) {
|
||||
if (tech_pvt && (status > 100 || switch_channel_test_flag(channel, CF_ANSWERED)) && status < 300 && !r_sdp && tech_pvt->mparams.last_sdp_str) {
|
||||
r_sdp = tech_pvt->mparams.last_sdp_str;
|
||||
}
|
||||
|
||||
@ -8193,9 +8191,11 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session,
|
||||
{
|
||||
char *call_info = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
private_object_t *tech_pvt = NULL;
|
||||
|
||||
if (session) {
|
||||
channel = switch_core_session_get_channel(session);
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
}
|
||||
|
||||
if (session && profile && sip && sofia_test_pflag(profile, PFLAG_TRACK_CALLS)) {
|
||||
@ -8236,8 +8236,10 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session,
|
||||
}
|
||||
|
||||
if (channel) {
|
||||
tech_pvt->mparams.last_sdp_str = NULL;
|
||||
if (sip->sip_payload && sip->sip_payload->pl_data) {
|
||||
switch_channel_set_variable(channel, "sip_reinvite_sdp", sip->sip_payload->pl_data);
|
||||
tech_pvt->mparams.last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
|
||||
}
|
||||
switch_channel_execute_on(channel, "execute_on_sip_reinvite");
|
||||
}
|
||||
|
@ -2680,7 +2680,6 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP);
|
||||
contact_str = profile->url;
|
||||
}
|
||||
}
|
||||
|
@ -200,9 +200,6 @@ static iks *start_sendfax_component(struct rayo_actor *call, struct rayo_message
|
||||
switch_channel_set_variable(channel, "fax_local_station_id", NULL);
|
||||
switch_channel_set_variable(channel, "fax_remote_station_id", NULL);
|
||||
|
||||
/* clear fax interrupt variable */
|
||||
switch_channel_set_variable(switch_core_session_get_channel(session), "rayo_read_frame_interrupt", NULL);
|
||||
|
||||
rayo_call_set_faxing(RAYO_CALL(call), 1);
|
||||
|
||||
/* execute txfax APP */
|
||||
@ -306,9 +303,6 @@ static iks *start_receivefax_component(struct rayo_actor *call, struct rayo_mess
|
||||
switch_channel_set_variable(channel, "fax_local_station_id", NULL);
|
||||
switch_channel_set_variable(channel, "fax_remote_station_id", NULL);
|
||||
|
||||
/* clear fax interrupt variable */
|
||||
switch_channel_set_variable(switch_core_session_get_channel(session), "rayo_read_frame_interrupt", NULL);
|
||||
|
||||
rayo_call_set_faxing(RAYO_CALL(call), 1);
|
||||
|
||||
/* execute rxfax APP */
|
||||
@ -383,7 +377,7 @@ static void insert_fax_metadata(switch_event_t *event, const char *name, iks *re
|
||||
static void on_execute_complete_event(switch_event_t *event)
|
||||
{
|
||||
const char *application = switch_event_get_header(event, "Application");
|
||||
|
||||
|
||||
if (!zstr(application) && (!strcmp(application, "rxfax") || !strcmp(application, "txfax"))) {
|
||||
int is_rxfax = !strcmp(application, "rxfax");
|
||||
const char *uuid = switch_event_get_header(event, "Unique-ID");
|
||||
@ -394,26 +388,19 @@ static void on_execute_complete_event(switch_event_t *event)
|
||||
iks *complete;
|
||||
iks *fax;
|
||||
int have_fax_document = 1;
|
||||
switch_core_session_t *session;
|
||||
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "Got result for %s\n", fax_jid);
|
||||
|
||||
/* clean up channel */
|
||||
session = switch_core_session_locate(uuid);
|
||||
if (session) {
|
||||
switch_channel_set_variable(switch_core_session_get_channel(session), "rayo_read_frame_interrupt", NULL);
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
|
||||
/* RX only: transfer HTTP document and delete local copy */
|
||||
if (is_rxfax && RECEIVEFAX_COMPONENT(component)->http_put_after_receive && switch_file_exists(RECEIVEFAX_COMPONENT(component)->local_filename, RAYO_POOL(component)) == SWITCH_STATUS_SUCCESS) {
|
||||
char *cmd = switch_core_sprintf(RAYO_POOL(component), "%s %s", RECEIVEFAX_COMPONENT(component)->filename, RECEIVEFAX_COMPONENT(component)->local_filename);
|
||||
switch_stream_handle_t stream = { 0 };
|
||||
SWITCH_STANDARD_STREAM(stream);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s PUT fax to %s\n", RAYO_JID(component), RECEIVEFAX_COMPONENT(component)->filename);
|
||||
switch_api_execute("http_put", RECEIVEFAX_COMPONENT(component)->filename, NULL, &stream);
|
||||
switch_api_execute("http_put", cmd, NULL, &stream);
|
||||
/* check if successful */
|
||||
if (!zstr(stream.data) && strncmp(stream.data, "+OK", 3)) {
|
||||
/* PUT failed */
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s PUT fax to %s failed: %s\n", RAYO_JID(component), RECEIVEFAX_COMPONENT(component)->filename, (char *)stream.data);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s PUT fax %s to %s failed: %s\n", RAYO_JID(component), RECEIVEFAX_COMPONENT(component)->local_filename, RECEIVEFAX_COMPONENT(component)->filename, (char *)stream.data);
|
||||
have_fax_document = 0;
|
||||
}
|
||||
switch_safe_free(stream.data)
|
||||
|
@ -4,11 +4,14 @@ MODNAME=mod_java
|
||||
mod_LTLIBRARIES = mod_java.la
|
||||
mod_java_la_SOURCES = mod_java.cpp freeswitch_java.cpp switch_swig_wrap.cpp modjava.c
|
||||
mod_java_la_CFLAGS = $(AM_CFLAGS)
|
||||
mod_java_la_CPPFLAGS = -I/usr/lib/jvm/java-gcj/include
|
||||
mod_java_la_CPPFLAGS+= -I/usr/lib/jvm/java-gcj/include/linux
|
||||
mod_java_la_CPPFLAGS+= $(AM_CPPFLAGS)
|
||||
mod_java_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||
mod_java_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
||||
|
||||
# Without -fno-strict-aliasing, g++ generates invalid code for Java_org_freeswitch_freeswitchJNI_SWIGJavaSessionUpcast, which segfaults
|
||||
mod_java_la_CFLAGS += $(JAVA_FLAGS) -fno-strict-aliasing -I/usr/lib/jvm/java-gcj/include -I/usr/lib/jvm/java-gcj/include/linux
|
||||
mod_java_la_CFLAGS += $(JAVA_FLAGS) -fno-strict-aliasing
|
||||
|
||||
CLASSES=src/org/freeswitch/Launcher.java \
|
||||
src/org/freeswitch/HangupHook.java \
|
||||
|
8
src/mod/loggers/mod_graylog2/Makefile.am
Normal file
8
src/mod/loggers/mod_graylog2/Makefile.am
Normal file
@ -0,0 +1,8 @@
|
||||
include $(top_srcdir)/build/modmake.rulesam
|
||||
MODNAME=mod_graylog2
|
||||
|
||||
mod_LTLIBRARIES = mod_graylog2.la
|
||||
mod_graylog2_la_SOURCES = mod_graylog2.c
|
||||
mod_graylog2_la_CFLAGS = $(AM_CFLAGS)
|
||||
mod_graylog2_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||
mod_graylog2_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
@ -0,0 +1,15 @@
|
||||
<configuration name="graylog2.conf" description="Graylog2 Logger">
|
||||
<!-- emerg - system is unusable -->
|
||||
<!-- alert - action must be taken immediately -->
|
||||
<!-- crit - critical conditions -->
|
||||
<!-- err - error conditions -->
|
||||
<!-- warning - warning conditions -->
|
||||
<!-- notice - normal, but significant, condition -->
|
||||
<!-- info - informational message -->
|
||||
<!-- debug - debug-level message -->
|
||||
<settings>
|
||||
<param name="server-host" value="192.168.0.69"/>
|
||||
<param name="server-port" value="12201"/>
|
||||
<param name="loglevel" value="warning"/>
|
||||
</settings>
|
||||
</configuration>
|
347
src/mod/loggers/mod_graylog2/mod_graylog2.c
Normal file
347
src/mod/loggers/mod_graylog2/mod_graylog2.c
Normal file
@ -0,0 +1,347 @@
|
||||
/*
|
||||
* mod_graylog2 for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2014, Grasshopper
|
||||
*
|
||||
* 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 mod_graylog2 for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is Grasshopper
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Christopher Rienzo <crienzo@grasshopper.com>
|
||||
*
|
||||
* mod_graylog2.c -- Graylog2 GELF logger
|
||||
*
|
||||
*/
|
||||
#include <switch.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_graylog2_load);
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_graylog2_shutdown);
|
||||
SWITCH_MODULE_DEFINITION(mod_graylog2, mod_graylog2_load, mod_graylog2_shutdown, NULL);
|
||||
|
||||
static struct {
|
||||
/** memory pool for this module */
|
||||
switch_memory_pool_t *pool;
|
||||
/** graylog2 server address */
|
||||
const char *server_host;
|
||||
/** graylog2 server port */
|
||||
switch_port_t server_port;
|
||||
/** minimum log level to allow */
|
||||
switch_log_level_t log_level;
|
||||
/** shutdown flag */
|
||||
int shutdown;
|
||||
/** prevents context shutdown until all threads are finished */
|
||||
switch_thread_rwlock_t *shutdown_rwlock;
|
||||
/** log delivery queue */
|
||||
switch_queue_t *log_queue;
|
||||
} globals;
|
||||
|
||||
/**
|
||||
* Convert log level to graylog2 log level
|
||||
*/
|
||||
static int to_graylog2_level(switch_log_level_t level)
|
||||
{
|
||||
switch (level) {
|
||||
case SWITCH_LOG_DEBUG: return 7;
|
||||
case SWITCH_LOG_INFO: return 6;
|
||||
case SWITCH_LOG_NOTICE: return 5;
|
||||
case SWITCH_LOG_WARNING: return 4;
|
||||
case SWITCH_LOG_ERROR: return 3;
|
||||
case SWITCH_LOG_CRIT: return 2;
|
||||
case SWITCH_LOG_ALERT: return 1;
|
||||
default: return 8;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode log as GELF
|
||||
*/
|
||||
static char *to_gelf(const switch_log_node_t *node, switch_log_level_t log_level)
|
||||
{
|
||||
char *gelf_text = NULL;
|
||||
cJSON *gelf = cJSON_CreateObject();
|
||||
char *hostname;
|
||||
char timestamp[32];
|
||||
char *full_message = node->content;
|
||||
char short_message[151];
|
||||
char *short_message_end = NULL;
|
||||
|
||||
cJSON_AddItemToObject(gelf, "version", cJSON_CreateString("1.1"));
|
||||
if ((hostname = switch_core_get_variable("hostname")) && !zstr(hostname)) {
|
||||
cJSON_AddItemToObject(gelf, "host", cJSON_CreateString(hostname));
|
||||
} else if ((hostname = switch_core_get_variable("local_ip_v4")) && !zstr(hostname)) {
|
||||
cJSON_AddItemToObject(gelf, "host", cJSON_CreateString(hostname));
|
||||
}
|
||||
switch_snprintf(timestamp, 32, "%"SWITCH_UINT64_T_FMT".%d", (uint64_t)(node->timestamp / 1000000), node->timestamp % 1000000);
|
||||
cJSON_AddItemToObject(gelf, "timestamp", cJSON_CreateString(timestamp));
|
||||
cJSON_AddItemToObject(gelf, "level", cJSON_CreateNumber(to_graylog2_level(log_level)));
|
||||
cJSON_AddItemToObject(gelf, "_ident", cJSON_CreateString("freeswitch"));
|
||||
cJSON_AddItemToObject(gelf, "_pid", cJSON_CreateNumber((int)getpid()));
|
||||
if (!zstr(node->userdata)) {
|
||||
cJSON_AddItemToObject(gelf, "_uuid", cJSON_CreateString(node->userdata));
|
||||
}
|
||||
if (!zstr_buf(node->file)) {
|
||||
cJSON_AddItemToObject(gelf, "_file", cJSON_CreateString(node->file));
|
||||
cJSON_AddItemToObject(gelf, "_line", cJSON_CreateNumber(node->line));
|
||||
}
|
||||
if (!zstr_buf(node->func)) {
|
||||
cJSON_AddItemToObject(gelf, "_function", cJSON_CreateString(node->func));
|
||||
}
|
||||
|
||||
/* skip initial space and new line */
|
||||
if (*full_message == ' ') {
|
||||
full_message++;
|
||||
}
|
||||
if (*full_message == '\n') {
|
||||
full_message++;
|
||||
}
|
||||
|
||||
cJSON_AddItemToObject(gelf, "full_message", cJSON_CreateString(full_message));
|
||||
|
||||
switch_snprintf(short_message, sizeof(short_message) - 1, "%s", full_message);
|
||||
if ((short_message_end = strchr(short_message, '\n'))) {
|
||||
*short_message_end = '\0';
|
||||
}
|
||||
cJSON_AddItemToObject(gelf, "short_message", cJSON_CreateString(short_message));
|
||||
|
||||
gelf_text = cJSON_PrintUnformatted(gelf);
|
||||
cJSON_Delete(gelf);
|
||||
return gelf_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open connection to graylog2 server
|
||||
*/
|
||||
static switch_socket_t *open_graylog2_socket(const char *host, switch_port_t port, switch_memory_pool_t *pool)
|
||||
{
|
||||
switch_sockaddr_t *graylog2_addr = NULL;
|
||||
switch_socket_t *graylog2_sock = NULL;
|
||||
|
||||
if (switch_sockaddr_info_get(&graylog2_addr, host, SWITCH_UNSPEC, port, 0, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad address: %s:%d\n", host, port);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (switch_socket_create(&graylog2_sock, switch_sockaddr_get_family(graylog2_addr), SOCK_DGRAM, 0, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open UDP socket\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (switch_socket_connect(graylog2_sock, graylog2_addr) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to connect to: %s:%d\n", host, port);
|
||||
switch_socket_close(graylog2_sock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return graylog2_sock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Thread that delivers logs to graylog2 server
|
||||
* @param thread this thread
|
||||
* @param obj unused
|
||||
* @return NULL
|
||||
*/
|
||||
static void *SWITCH_THREAD_FUNC deliver_graylog2_thread(switch_thread_t *thread, void *obj)
|
||||
{
|
||||
switch_socket_t *graylog2_sock = NULL;
|
||||
char *log;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "graylog2 delivery thread started\n");
|
||||
|
||||
switch_thread_rwlock_rdlock(globals.shutdown_rwlock);
|
||||
|
||||
graylog2_sock = open_graylog2_socket(globals.server_host, globals.server_port, globals.pool);
|
||||
if (graylog2_sock) {
|
||||
while (!globals.shutdown) {
|
||||
if (switch_queue_pop(globals.log_queue, (void *)&log) == SWITCH_STATUS_SUCCESS) {
|
||||
if (!zstr(log)) {
|
||||
switch_size_t len = strlen(log);
|
||||
if (len <= 8192) {
|
||||
switch_socket_send_nonblock(graylog2_sock, (void *)log, &len);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Skipping log with length > 8192 bytes\n");
|
||||
}
|
||||
}
|
||||
switch_safe_free(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
globals.shutdown = 1;
|
||||
|
||||
/* clean up remaining logs */
|
||||
while(switch_queue_trypop(globals.log_queue, (void *)&log) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_safe_free(log);
|
||||
}
|
||||
|
||||
if (graylog2_sock) {
|
||||
switch_socket_close(graylog2_sock);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "graylog2 delivery thread finished\n");
|
||||
switch_thread_rwlock_unlock(globals.shutdown_rwlock);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new graylog2 delivery thread
|
||||
* @param pool to use
|
||||
*/
|
||||
static void start_deliver_graylog2_thread(switch_memory_pool_t *pool)
|
||||
{
|
||||
switch_thread_t *thread;
|
||||
switch_threadattr_t *thd_attr = NULL;
|
||||
switch_threadattr_create(&thd_attr, pool);
|
||||
switch_threadattr_detach_set(thd_attr, 1);
|
||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||
switch_thread_create(&thread, thd_attr, deliver_graylog2_thread, NULL, pool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop graylog2 delivery thread
|
||||
*/
|
||||
static void stop_deliver_graylog2_thread(void)
|
||||
{
|
||||
globals.shutdown = 1;
|
||||
switch_queue_interrupt_all(globals.log_queue);
|
||||
switch_thread_rwlock_wrlock(globals.shutdown_rwlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle log from core
|
||||
* @param node the log
|
||||
* @param level the log level
|
||||
*/
|
||||
static switch_status_t mod_graylog2_logger(const switch_log_node_t *node, switch_log_level_t level)
|
||||
{
|
||||
if (!globals.shutdown && level <= globals.log_level && level != SWITCH_LOG_CONSOLE) {
|
||||
if (!zstr(node->content) && !zstr(node->content + 1)) {
|
||||
char *log = to_gelf(node, level);
|
||||
if (switch_queue_trypush(globals.log_queue, log) != SWITCH_STATUS_SUCCESS) {
|
||||
free(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure module
|
||||
*/
|
||||
static switch_status_t do_config(void)
|
||||
{
|
||||
switch_xml_t cfg, xml, settings;
|
||||
|
||||
if (!(xml = switch_xml_open_cfg("graylog2.conf", &cfg, NULL))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of graylog2.conf failed\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
/* set defaults */
|
||||
globals.log_level = SWITCH_LOG_WARNING;
|
||||
globals.server_host = "127.0.0.1";
|
||||
globals.server_port = 12201;
|
||||
|
||||
if ((settings = switch_xml_child(cfg, "settings"))) {
|
||||
switch_xml_t param;
|
||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||
char *name = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *value = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
||||
if (zstr(name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring empty param\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (zstr(value)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring empty value for param \"%s\"\n", name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(name, "server-host")) {
|
||||
globals.server_host = switch_core_strdup(globals.pool, value);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
|
||||
} else if (!strcasecmp(name, "server-port")) {
|
||||
int port = -1;
|
||||
if (switch_is_number(value)) {
|
||||
port = atoi(value);
|
||||
}
|
||||
if (port > 0 && port <= 65535) {
|
||||
globals.server_port = port;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid port: \"%s\"\n", value);
|
||||
}
|
||||
} else if (!strcasecmp(name, "loglevel")) {
|
||||
switch_log_level_t log_level = switch_log_str2level(value);
|
||||
if (log_level == SWITCH_LOG_INVALID) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring invalid log level: \"%s\"\n", value);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\" = \"%s\"\n", name, value);
|
||||
globals.log_level = log_level;
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param: \"%s\"\n", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch_xml_free(xml);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_graylog2_load)
|
||||
{
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
globals.pool = pool;
|
||||
|
||||
if (do_config() != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
switch_thread_rwlock_create(&globals.shutdown_rwlock, pool);
|
||||
switch_queue_create(&globals.log_queue, 25000, pool);
|
||||
|
||||
start_deliver_graylog2_thread(globals.pool);
|
||||
switch_log_bind_logger(mod_graylog2_logger, SWITCH_LOG_DEBUG, SWITCH_FALSE);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_graylog2_shutdown)
|
||||
{
|
||||
switch_log_unbind_logger(mod_graylog2_logger);
|
||||
stop_deliver_graylog2_thread();
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
|
||||
*/
|
@ -479,7 +479,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
|
||||
if ( GLOBAL_TIME_FORMAT == 1 ) {
|
||||
av_value = switch_mprintf("%02u:%02u:%02u.%03u %s %s %s %02u %04u",
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec/1000,
|
||||
GLOBAL_TIME_FORMAT, radattrdays[tm.tm_wday], radattrmonths[tm.tm_mon],
|
||||
GLOBAL_TIME_ZONE, radattrdays[tm.tm_wday], radattrmonths[tm.tm_mon],
|
||||
tm.tm_mday, tm.tm_year + 1900);
|
||||
} else {
|
||||
av_value = switch_mprintf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
|
||||
|
@ -1547,11 +1547,11 @@ SWITCH_DECLARE(void) switch_core_session_enable_heartbeat(switch_core_session_t
|
||||
|
||||
session->track_duration = seconds;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) ||
|
||||
if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || !switch_channel_media_ready(session->channel) ||
|
||||
switch_true(switch_channel_get_variable_dup(session->channel, "heartbeat_use_scheduler", SWITCH_FALSE, -1)) ||
|
||||
switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media", SWITCH_FALSE, -1)) ||
|
||||
switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_after_bridge", SWITCH_FALSE, -1))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s using scheduler due to bypass_media mode\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s using scheduler due to bypass media or media is not established.\n",
|
||||
switch_channel_get_name(session->channel));
|
||||
switch_core_session_sched_heartbeat(session, seconds);
|
||||
return;
|
||||
|
@ -1699,6 +1699,9 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_destroy(switch_sql_queu
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push(switch_sql_queue_manager_t *qm, const char *sql, uint32_t pos, switch_bool_t dup)
|
||||
{
|
||||
char *sqlptr = NULL;
|
||||
switch_status_t status;
|
||||
int x = 0;
|
||||
|
||||
if (sql_manager.paused || qm->thread_running != 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "DROP [%s]\n", sql);
|
||||
@ -1716,10 +1719,20 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push(switch_sql_queue_m
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
switch_mutex_lock(qm->mutex);
|
||||
switch_queue_push(qm->sql_queue[pos], dup ? strdup(sql) : (char *)sql);
|
||||
switch_mutex_unlock(qm->mutex);
|
||||
sqlptr = dup ? strdup(sql) : (char *)sql;
|
||||
|
||||
do {
|
||||
switch_mutex_lock(qm->mutex);
|
||||
status = switch_queue_trypush(qm->sql_queue[pos], sqlptr);
|
||||
switch_mutex_unlock(qm->mutex);
|
||||
if (status != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Delay %d sending sql\n", x);
|
||||
if (x++) {
|
||||
switch_yield(1000000 * x);
|
||||
}
|
||||
}
|
||||
} while(status != SWITCH_STATUS_SUCCESS);
|
||||
|
||||
qm_wake(qm);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@ -2256,8 +2269,8 @@ static void core_event_handler(switch_event_t *event)
|
||||
break;
|
||||
}
|
||||
case SWITCH_EVENT_CHANNEL_CREATE:
|
||||
new_sql() = switch_mprintf("insert into channels (uuid,direction,created,created_epoch, name,state,callstate,dialplan,context,hostname) "
|
||||
"values('%q','%q','%q','%ld','%q','%q','%q','%q','%q','%q')",
|
||||
new_sql() = switch_mprintf("insert into channels (uuid,direction,created,created_epoch, name,state,callstate,dialplan,context,hostname,initial_cid_name,initial_cid_num,initial_ip_addr,initial_dest,initial_dialplan,initial_context) "
|
||||
"values('%q','%q','%q','%ld','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
|
||||
switch_event_get_header_nil(event, "unique-id"),
|
||||
switch_event_get_header_nil(event, "call-direction"),
|
||||
switch_event_get_header_nil(event, "event-date-local"),
|
||||
@ -2266,7 +2279,13 @@ static void core_event_handler(switch_event_t *event)
|
||||
switch_event_get_header_nil(event, "channel-state"),
|
||||
switch_event_get_header_nil(event, "channel-call-state"),
|
||||
switch_event_get_header_nil(event, "caller-dialplan"),
|
||||
switch_event_get_header_nil(event, "caller-context"), switch_core_get_switchname()
|
||||
switch_event_get_header_nil(event, "caller-context"), switch_core_get_switchname(),
|
||||
switch_event_get_header_nil(event, "caller-caller-id-name"),
|
||||
switch_event_get_header_nil(event, "caller-caller-id-number"),
|
||||
switch_event_get_header_nil(event, "caller-network-addr"),
|
||||
switch_event_get_header_nil(event, "caller-destination-number"),
|
||||
switch_event_get_header_nil(event, "caller-dialplan"),
|
||||
switch_event_get_header_nil(event, "caller-context")
|
||||
);
|
||||
break;
|
||||
case SWITCH_EVENT_CHANNEL_ANSWER:
|
||||
@ -2653,7 +2672,13 @@ static char create_channels_sql[] =
|
||||
" callee_direction VARCHAR(5),\n"
|
||||
" call_uuid VARCHAR(256),\n"
|
||||
" sent_callee_name VARCHAR(1024),\n"
|
||||
" sent_callee_num VARCHAR(256)\n"
|
||||
" sent_callee_num VARCHAR(256),\n"
|
||||
" initial_cid_name VARCHAR(1024),\n"
|
||||
" initial_cid_num VARCHAR(256),\n"
|
||||
" initial_ip_addr VARCHAR(256),\n"
|
||||
" initial_dest VARCHAR(1024),\n"
|
||||
" initial_dialplan VARCHAR(128),\n"
|
||||
" initial_context VARCHAR(128)\n"
|
||||
");\n";
|
||||
|
||||
static char create_calls_sql[] =
|
||||
@ -3372,7 +3397,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
|
||||
char *err;
|
||||
int result = 0;
|
||||
|
||||
switch_cache_db_test_reactive(sql_manager.dbh, "select call_uuid, read_bit_rate, sent_callee_name from channels", "DROP TABLE channels", create_channels_sql);
|
||||
switch_cache_db_test_reactive(sql_manager.dbh, "select call_uuid, read_bit_rate, sent_callee_name, initial_cid_name, initial_cid_num, initial_ip_addr, initial_dest, initial_dialplan, initial_context from channels", "DROP TABLE channels", create_channels_sql);
|
||||
switch_cache_db_test_reactive(sql_manager.dbh, "select * from detailed_calls where sent_callee_name=''", "DROP VIEW detailed_calls", detailed_calls_sql);
|
||||
switch_cache_db_test_reactive(sql_manager.dbh, "select * from basic_calls where sent_callee_name=''", "DROP VIEW basic_calls", basic_calls_sql);
|
||||
switch_cache_db_test_reactive(sql_manager.dbh, "select call_uuid from calls", "DROP TABLE calls", create_calls_sql);
|
||||
|
@ -585,6 +585,7 @@ SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t po
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
switch_event_t *event = NULL;
|
||||
|
||||
if (!initialized || !nat_globals.nat_type) return status;
|
||||
if (!nat_globals.mapping) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT port mapping disabled\n");
|
||||
return status;
|
||||
|
Loading…
x
Reference in New Issue
Block a user