Merge branch 'master' into v1.4.beta

This commit is contained in:
Ken Rice
2013-12-11 09:50:10 -06:00
41 changed files with 683 additions and 540 deletions
+5 -1
View File
@@ -649,7 +649,7 @@ pristine:
git clean -fdx
git reset --hard
update-clean: clean libs/openzap/Makefile python-reconf
update-clean: clean libs/openzap/Makefile python-reconf lua-reconf
cd libs/sofia-sip && $(MAKE) clean
cd libs/openzap && $(MAKE) clean
cd libs/portaudio && $(MAKE) clean
@@ -708,6 +708,10 @@ sofia-reconf:
cd libs/sofia-sip && $(MAKE) clean
cd libs/sofia-sip && ./configure --prefix=$(prefix) --with-pic --with-glib=no --disable-shared
lua-reconf:
cd src/mod/languages/mod_lua/lua && make clean
cd src/mod/languages/mod_lua && make clean
cluecon:
@clear
@echo Thank you for updating. This is going to take a while so relax.
@@ -1,10 +0,0 @@
<configuration name="distributor.conf" description="Distributor Configuration">
<lists>
<!-- every 10 calls to test you will get foo1 once and foo2 9 times...yes NINE TIMES! -->
<!-- this is not the same as 100 with 10 and 90 that would do foo1 10 times in a row then foo2 90 times in a row -->
<list name="test" total-weight="10">
<node name="foo1" weight="1"/>
<node name="foo2" weight="9"/>
</list>
</lists>
</configuration>
-6
View File
@@ -1,6 +0,0 @@
<configuration name="hash.conf" description="Hash Configuration">
<remotes>
<!-- List of hosts from where to pull usage data -->
<!-- <remote name="Test1" host="10.0.0.10" port="8021" password="ClueCon" interval="1000" /> -->
</remotes>
</configuration>
-30
View File
@@ -1,30 +0,0 @@
<configuration name="lua.conf" description="LUA Configuration">
<settings>
<!--
Specify local directories that will be searched for LUA modules
These entries will be pre-pended to the LUA_CPATH environment variable
-->
<!-- <param name="module-directory" value="/usr/lib/lua/5.1/?.so"/> -->
<!-- <param name="module-directory" value="/usr/local/lib/lua/5.1/?.so"/> -->
<!--
Specify local directories that will be searched for LUA scripts
These entries will be pre-pended to the LUA_PATH environment variable
-->
<!-- <param name="script-directory" value="/usr/local/lua/?.lua"/> -->
<!-- <param name="script-directory" value="$${base_dir}/scripts/?.lua"/> -->
<!--<param name="xml-handler-script" value="/dp.lua"/>-->
<!--<param name="xml-handler-bindings" value="dialplan"/>-->
<!--
The following options identifies a lua script that is launched
at startup and may live forever in the background.
You can define multiple lines, one for each script you
need to run.
-->
<!--<param name="startup-script" value="startup_script_1.lua"/>-->
<!--<param name="startup-script" value="startup_script_2.lua"/>-->
</settings>
</configuration>
@@ -1,6 +0,0 @@
<configuration name="memcache.conf" description="memcache Configuration">
<settings>
<!-- comma sep list of servers: eg: localhost,otherhost:port,anotherone -->
<param name="memcache-servers" value="localhost"/>
</settings>
</configuration>
+2 -5
View File
@@ -18,8 +18,6 @@
<load module="mod_conference"/>
<load module="mod_dptools"/>
<load module="mod_expr"/>
<load module="mod_hash"/>
<!--<load module="mod_distributor"/>-->
<load module="mod_esf"/>
<load module="mod_fsv"/>
<load module="mod_http_cache"/>
@@ -33,6 +31,8 @@
<load module="mod_speex"/>
<load module="mod_opus"/>
<load module="mod_ilbc"/>
<load module="mod_h26x"/>
<load module="mod_vp8"/>
<!-- File Format Interfaces -->
<load module="mod_sndfile"/>
@@ -45,9 +45,6 @@
<load module="mod_tone_stream"/>
<load module="mod_ssml"/>
<!-- Languages -->
<load module="mod_lua"/>
<!-- ASR /TTS -->
<load module="mod_flite"/>
<load module="mod_pocketsphinx"/>
+2 -1
View File
@@ -7,8 +7,9 @@
foo/server:port,server:port SET
-->
<param name="connection-string" value="127.0.0.1:27017"/>
<param name="min-connections" value="10"/>
<param name="max-connections" value="100"/>
<!-- Timeout in seconds. 0 means no timeout -->
<param name="socket-timeout" value="0"/>
<!--
<param name="map" value="function() { emit(this.a, 1); }"/>
-1
View File
@@ -23,4 +23,3 @@ Thanks-to: Steven Ayre <steveayre@gmail.com>
Thanks-to: William King <william.king@quentustech.com>
# for moral support and small tweaks
+113 -12
View File
@@ -46,6 +46,33 @@ avoid_mods_squeeze=(
formats/mod_vlc
languages/mod_managed
)
manual_pkgs=(
freeswitch-all
freeswitch
libfreeswitch1
freeswitch-meta-bare
freeswitch-meta-default
freeswitch-meta-vanilla
freeswitch-meta-sorbet
freeswitch-meta-all
freeswitch-meta-codecs
freeswitch-meta-conf
freeswitch-meta-lang
freeswitch-meta-mod-say
freeswitch-all-dbg
freeswitch-dbg
libfreeswitch1-dbg
libfreeswitch-dev
freeswitch-doc
freeswitch-init
freeswitch-sysvinit
freeswitch-systemd
freeswitch-lang
freeswitch-music
freeswitch-sounds
freeswitch-sounds-en
freeswitch-sounds-en-us
)
err () {
echo "$0 error: $1" >&2
@@ -61,6 +88,31 @@ xread () {
return $ret
}
intersperse () {
local sep="$1"
awk "
BEGIN {
first=1;
sep=\"${sep}\";
}"'
/.*/ {
if (first == 0) {
printf "%s%s", sep, $0;
} else {
printf "%s", $0;
}
first=0;
}
END { printf "\n"; }'
}
postfix () {
local px="$1"
awk "
BEGIN { px=\"${px}\"; }"'
/.*/ { printf "%s%s\n", $0, px; }'
}
avoid_mod_filter () {
local x="avoid_mods_$codename[@]"
local -a mods=("${avoid_mods[@]}" "${!x}")
@@ -168,6 +220,60 @@ map_langs () {
done
}
map_pkgs () {
local fsx="$1"
for x in "${manual_pkgs[@]}"; do
$fsx $x
done
map_pkgs_confs () { $fsx "freeswitch-conf-${conf//_/-}"; }
map_confs map_pkgs_confs
map_pkgs_langs () { $fsx "freeswitch-lang-${lang//_/-}"; }
map_langs map_pkgs_langs
map_pkgs_mods () {
$fsx "freeswitch-mod-${module//_/-}"
$fsx "freeswitch-mod-${module//_/-}-dbg"; }
map_modules map_pkgs_mods
}
list_pkgs () {
list_pkgs_thunk () { printf '%s\n' "$1"; }
map_pkgs list_pkgs_thunk
}
list_freeswitch_all_pkgs () {
list_pkgs \
| grep -v '^freeswitch-all$' \
| grep -v -- '-dbg$'
}
list_freeswitch_all_provides () {
list_freeswitch_all_pkgs \
| intersperse ',\n '
}
list_freeswitch_all_replaces () {
list_freeswitch_all_pkgs \
| postfix ' (<= ${binary:Version})' \
| intersperse ',\n '
}
list_freeswitch_all_dbg_pkgs () {
list_pkgs \
| grep -v '^freeswitch-all-dbg$' \
| grep -- '-dbg$'
}
list_freeswitch_all_dbg_provides () {
list_freeswitch_all_dbg_pkgs \
| intersperse ',\n '
}
list_freeswitch_all_dbg_replaces () {
list_freeswitch_all_dbg_pkgs \
| postfix ' (<= ${binary:Version})' \
| intersperse ',\n '
}
print_source_control () {
cat <<EOF
Source: freeswitch
@@ -207,17 +313,9 @@ print_core_control () {
cat <<EOF
Package: freeswitch-all
Architecture: any
Provides: freeswitch, libfreeswitch1, freeswitch-doc, freeswitch-init
Replaces: freeswitch (<= \${binary:Version}),
libfreeswitch1 (<= \${binary:Version}),
freeswitch-doc (<= \${binary:Version}),
freeswitch-sysvinit (<= \${binary:Version}),
freeswitch-systemd (<= \${binary:Version})
Breaks: freeswitch (<= \${binary:Version}),
libfreeswitch1 (<= \${binary:Version}),
freeswitch-doc (<= \${binary:Version}),
freeswitch-sysvinit (<= \${binary:Version}),
freeswitch-systemd (<= \${binary:Version})
Provides: $(list_freeswitch_all_provides)
Replaces: $(list_freeswitch_all_replaces)
Conflicts: $(list_freeswitch_all_replaces)
Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends},
freeswitch-music-default (>= 1.0.8),
freeswitch-sounds-en-us-callie (>= 1.0.25) | freeswitch-sounds,
@@ -647,6 +745,9 @@ Package: freeswitch-all-dbg
Section: debug
Priority: extra
Architecture: any
Provides: $(list_freeswitch_all_dbg_provides)
Replaces: $(list_freeswitch_all_dbg_replaces)
Breaks: $(list_freeswitch_all_dbg_replaces)
Depends: \${misc:Depends}, freeswitch (= \${binary:Version})
Description: debugging symbols for FreeSWITCH
$(debian_wrap "${fs_description}")
@@ -917,7 +1018,7 @@ print_edit_warning () {
}
gencontrol_per_mod () {
print_mod_control "$module_name" "$description" "$long_description" >> control
print_mod_control "$module_name" "$description" "$long_description" >> control
}
gencontrol_per_cat () {
-1
View File
@@ -700,4 +700,3 @@ Description: mod_xml_rpc
Module: xml_int/mod_xml_scgi
Description: mod_xml_scgi
Adds mod_xml_scgi.
+2 -2
View File
@@ -1427,7 +1427,7 @@ Files: libs/js/nsprpub/pr/tests/tmocon.c
libs/js/nsprpub/pr/src/md/unix/os_ReliantUNIX.s
libs/js/nsprpub/pr/src/md/unix/os_Darwin_ppc.s
libs/js/nsprpub/pr/src/md/unix/os_SunOS_ultrasparc.s
libs/js/nsprpub/pr/src/md/unix/os_Linux_ia64.s
libs/js/nsprpub/pr/src/md/unix/os_Linux_ia64.s
libs/js/nsprpub/pr/tests/testfile.c
libs/js/nsprpub/pr/src/md/unix/os_Darwin_x86.s
libs/js/nsprpub/pr/src/md/unix/os_AIX.s
@@ -1958,7 +1958,7 @@ License: LGPL
Files: libs/libwebsockets/win32port/zlib/*
Copyright: 1995-2010 Jean-loup Gailly
1995-2010 Mark Adler
1995-2010 Mark Adler
1995-2010 Jean-loup Gailly and Mark Adler
1995-2010 Jean-loup Gailly and Mark Adler ";
License: zlib/libpng
-1
View File
@@ -32,4 +32,3 @@ UMask=0007
[Install]
WantedBy=multi-user.target
+6 -1
View File
@@ -106,6 +106,12 @@ override_dh_installinit:
dh_installinit -pfreeswitch-sysvinit --name=freeswitch
dh_installinit -pfreeswitch-all --name=freeswitch
override_dh_makeshlibs:
dh_makeshlibs
sed \
-e '/^libfreeswitch 1/{s/freeswitch-all/libfreeswitch1/g}' \
-i debian/freeswitch-all/DEBIAN/shlibs
debian-bootstrap: debian/.stamp-bootstrap
debian/.stamp-bootstrap:
(cd debian && ./bootstrap.sh)
@@ -127,4 +133,3 @@ binary-quicktest:
echo "applications/mod_commands" > debian/modules.conf
(cd debian && ./bootstrap.sh)
dh binary
-1
View File
@@ -455,4 +455,3 @@ case "$cmd" in
create-orig) create_orig "$@" ;;
*) usage ;;
esac
+1 -2
View File
@@ -108,10 +108,9 @@ submitted to JIRA.
You can also reach us on freenode.net at:
> #freeswitch-dev
Finally, feel free to join us in our weekly conference call. Many of
the core developers are often on the call and you'll have an
opportunity at the beginning or end of the call to ask your questions:
> http://wiki.freeswitch.org/wiki/Weekly_Conference_Call
+179
View File
@@ -0,0 +1,179 @@
######################################################################################################################
#
# freeswitch-config-rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
# Copyright (C) 2013, 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 freeswitch-config-rayo 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):
# Chris Rienzo <crienzo@grasshopper.com>
#
# freeswitch-rayo-config -- RPM packaging for Rayo Server configuration
#
######################################################################################################################
%define version %{VERSION_NUMBER}
%define release %{BUILD_NUMBER}
%define fsname freeswitch
%define PREFIX %{_prefix}
%define EXECPREFIX %{_exec_prefix}
%define BINDIR %{_bindir}
%define SBINDIR %{_sbindir}
%define LIBEXECDIR %{_libexecdir}/%fsname
%define SYSCONFDIR %{_sysconfdir}/%fsname
%define SHARESTATEDIR %{_sharedstatedir}/%fsname
%define LOCALSTATEDIR %{_localstatedir}/lib/%fsname
%define LIBDIR %{_libdir}
%define INCLUDEDIR %{_includedir}
%define _datarootdir %{_prefix}/share
%define DATAROOTDIR %{_datarootdir}
%define DATADIR %{_datadir}
%define INFODIR %{_infodir}
%define LOCALEDIR %{_datarootdir}/locale
%define MANDIR %{_mandir}
%define DOCDIR %{_defaultdocdir}/%fsname
%define HTMLDIR %{_defaultdocdir}/%fsname/html
%define DVIDIR %{_defaultdocdir}/%fsname/dvi
%define PDFDIR %{_defaultdocdir}/%fsname/pdf
%define PSDIR %{_defaultdocdir}/%fsname/ps
%define LOGFILEDIR /var/log/%fsname
%define MODINSTDIR %{_libdir}/%fsname/mod
%define RUNDIR %{_localstatedir}/run/%fsname
%define DBDIR %{LOCALSTATEDIR}/db
%define HTDOCSDIR %{_datarootdir}/%fsname/htdocs
%define SOUNDSDIR %{_datarootdir}/%fsname/sounds
%define GRAMMARDIR %{_datarootdir}/%fsname/grammar
%define SCRIPTDIR %{_datarootdir}/%fsname/scripts
%define RECORDINGSDIR %{LOCALSTATEDIR}/recordings
%define PKGCONFIGDIR %{_datarootdir}/%fsname/pkgconfig
%define HOMEDIR %{LOCALSTATEDIR}
Name: freeswitch-config-rayo
Version: %{version}
Release: %{release}%{?dist}
License: MPL1.1
Summary: Rayo configuration for the FreeSWITCH Open Source telephone platform.
Group: System/Libraries
Packager: Chris Rienzo
URL: http://www.freeswitch.org/
Source0: freeswitch-%{version}.tar.bz2
Requires: freeswitch = %{version}
Requires: freeswitch-application-conference
Requires: freeswitch-application-esf
Requires: freeswitch-application-expr
Requires: freeswitch-application-fsv
Requires: freeswitch-application-http-cache
Requires: freeswitch-asrtts-flite
Requires: freeswitch-asrtts-pocketsphinx
Requires: freeswitch-codec-celt
Requires: freeswitch-codec-h26x
Requires: freeswitch-codec-ilbc
Requires: freeswitch-codec-opus
Requires: freeswitch-codec-speex
Requires: freeswitch-codec-vp8
Requires: freeswitch-event-rayo
Requires: freeswitch-format-local-stream
Requires: freeswitch-format-mod-shout
Requires: freeswitch-format-shell-stream
Requires: freeswitch-format-ssml
Requires: freeswitch-sounds-music-8000
Requires: freeswitch-sounds-music-16000
Requires: freeswitch-sounds-music-32000
Requires: freeswitch-sounds-music-48000
Requires: freeswitch-lang-en
Requires: freeswitch-sounds-en-us-callie-8000
Requires: freeswitch-sounds-en-us-callie-16000
Requires: freeswitch-sounds-en-us-callie-32000
Requires: freeswitch-sounds-en-us-callie-48000
BuildRequires: bash
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
FreeSWITCH rayo server implementation.
%prep
%setup -b0 -q -n freeswitch-%{version}
%build
%install
%{__rm} -rf %{buildroot}
%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}
%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}/autoload_configs
%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}/dialplan
%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}/sip_profiles
%{__install} -d -m 0750 %{buildroot}/%{SYSCONFDIR}/directory
%{__cp} -prv ./conf/rayo/*.{xml,types,pem} %{buildroot}/%{SYSCONFDIR}/
%{__cp} -prv ./conf/rayo/{autoload_configs,dialplan} %{buildroot}/%{SYSCONFDIR}/
%{__cp} -prv ./conf/rayo/sip_profiles/external.xml %{buildroot}/%{SYSCONFDIR}/sip_profiles
%{__cp} -prv ./conf/rayo/sip_profiles/external %{buildroot}/%{SYSCONFDIR}/sip_profiles
%{__cp} -prv ./conf/rayo/directory %{buildroot}/%{SYSCONFDIR}/
%postun
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-,freeswitch,daemon)
%dir %attr(0750, freeswitch, daemon) %{SYSCONFDIR}
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/cacert.pem
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/mime.types
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/acl.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/cdr_csv.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/conference.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/console.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/event_socket.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/http_cache.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/local_stream.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/logfile.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/modules.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/pocketsphinx.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/post_load_modules.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/presence_map.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/rayo.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/shout.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/sofia.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/spandsp.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/ssml.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/switch.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/autoload_configs/timezones.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/dialplan/public.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/directory/default.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/directory/default/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/sip_profiles/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{SYSCONFDIR}/sip_profiles/external/*.xml
### END OF config-rayo
######################################################################################################################
#
# Changelog
#
######################################################################################################################
%changelog
* Mon Jun 03 2013 - crienzo@grasshopper.com
- Added users and internal profile for softphone testing
* Wed May 08 2013 - crienzo@grasshopper.com
- Initial revision
+50 -5
View File
@@ -22,6 +22,7 @@
# Marc Olivier Chouinard
# Raymond Chandler
# Ken Rice <krice@freeswitch.org>
# Chris Rienzo <crienzo@grasshopper.com>
#
# Maintainer(s): Ken Rice <krice@freeswitch.org>
#
@@ -33,6 +34,8 @@
%define build_py26_esl 0
%define build_timerfd 0
%define build_mod_esl 0
%define build_mod_rayo 1
%define build_mod_ssml 1
%{?with_sang_tc:%define build_sng_tc 1 }
%{?with_sang_isdn:%define build_sng_isdn 1 }
@@ -112,8 +115,8 @@ Vendor: http://www.freeswitch.org/
######################################################################################################################
Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2
Source1: http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz
Source2: http://files.freeswitch.org/downloads/libs/flite-1.5.1-current.tar.bz2
Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz
Source2: http://files.freeswitch.org/downloads/libs/flite-1.5.4-current.tar.bz2
Source3: http://files.freeswitch.org/downloads/libs/lame-3.98.4.tar.gz
Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
Source5: http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz
#Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
@@ -123,7 +126,7 @@ Source8: http://files.freeswitch.org/downloads/libs/sphinxbase-0.7.tar.gz
Source9: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
Source10: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz
Source11: http://files.freeswitch.org/downloads/libs/json-c-0.9.tar.gz
Source12: http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz
Source12: http://files.freeswitch.org/downloads/libs/opus-1.0.3.tar.gz
Prefix: %{prefix}
@@ -977,6 +980,17 @@ Requires: %{name} = %{version}-%{release}
%description event-json-cdr
JSON CDR Logger for FreeSWITCH.
%if %{build_mod_rayo}
%package event-rayo
Summary: Rayo (XMPP 3PCC) server for the FreeSWITCH open source telephony platform
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description event-rayo
Rayo 3PCC for FreeSWITCH. http://rayo.org http://xmpp.org/extensions/xep-0327.html
Rayo is an XMPP protocol extension for third-party control of telephone calls.
%endif
%package event-snmp
Summary: SNMP stats reporter for the FreeSWITCH open source telephony platform
Group: System/Libraries
@@ -1040,6 +1054,16 @@ Requires: %{name} = %{version}-%{release}
Mod Shout is a FreeSWITCH module to allow you to stream audio from MP3s or a i
shoutcast stream.
%if %{build_mod_ssml}
%package format-ssml
Summary: Adds Speech Synthesis Markup Language (SSML) parser format for the FreeSWITCH open source telephony platform
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description format-ssml
mod_ssml is a FreeSWITCH module that renders SSML into audio. This module requires a text-to-speech module for speech synthesis.
%endif
%package format-tone-stream
Summary: Implements TGML Tone Generation for the FreeSWITCH open source telephony platform
Group: System/Libraries
@@ -1376,6 +1400,9 @@ EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_pg_csv
event_handlers/mod_cdr_mongodb event_handlers/mod_erlang_event event_handlers/mod_event_multicast \
event_handlers/mod_event_socket event_handlers/mod_json_cdr \
event_handlers/mod_snmp"
%if %{build_mod_rayo}
EVENT_HANDLERS_MODULES+=" event_handlers/mod_rayo"
%endif
#### BUILD ISSUES NET RESOLVED FOR RELEASE event_handlers/mod_event_zmq
######################################################################################################################
@@ -1385,6 +1412,9 @@ EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_pg_csv
######################################################################################################################
FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \
formats/mod_shell_stream formats/mod_shout formats/mod_sndfile formats/mod_tone_stream"
%if %{build_mod_ssml}
FORMATS_MODULES+=" formats/mod_ssml"
%endif
######################################################################################################################
#
@@ -1704,8 +1734,7 @@ fi
%{LIBDIR}/*.a
%{LIBDIR}/*.la
%{PKGCONFIGDIR}/*
%{MODINSTDIR}/*.a
%{MODINSTDIR}/*.la
%{MODINSTDIR}/*.*a
%{INCLUDEDIR}/*.h
@@ -1743,6 +1772,7 @@ fi
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/event_socket.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/fax.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/fifo.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/format_cdr.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/hash.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/httapi.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/http_cache.conf.xml
@@ -2189,6 +2219,12 @@ fi
%defattr(-, freeswitch, daemon)
%{MODINSTDIR}/mod_json_cdr.so*
%if %{build_mod_rayo}
%files event-rayo
%defattr(-, freeswitch, daemon)
%{MODINSTDIR}/mod_rayo.so*
%endif
%files event-snmp
%defattr(-, freeswitch, daemon)
%{MODINSTDIR}/mod_snmp.so*
@@ -2219,6 +2255,12 @@ fi
%defattr(-, freeswitch, daemon)
%{MODINSTDIR}/mod_shout.so*
%if %{build_mod_ssml}
%files format-ssml
%defattr(-, freeswitch, daemon)
%{MODINSTDIR}/mod_ssml.so*
%endif
%files format-tone-stream
%defattr(-, freeswitch, daemon)
%{MODINSTDIR}/mod_tone_stream.so*
@@ -2385,6 +2427,9 @@ fi
#
######################################################################################################################
%changelog
* Mon Dec 09 2013 - crienzo@grasshopper.com
- Add mod_ssml, mod_rayo
- Fix build on master
* Thu Jun 28 2013 - krice@freeswitch.org
- Add module for VP8
* Thu Jun 19 2013 - krice@freeswitch.org
Executable → Regular
View File
+1 -1
View File
@@ -152,7 +152,7 @@ SPAN_DECLARE(const char *) fax_modem_to_str(int modem)
/*- End of function --------------------------------------------------------*/
//static void fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
SPAN_DECLARE(void) fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
SPAN_DECLARE_NONSTD(void) fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
{
fax_modems_state_t *s;
+1 -1
View File
@@ -84,7 +84,7 @@ static __inline__ void normalise_history(plc_state_t *s)
if (s->buf_ptr == 0)
return;
memcpy(tmp, s->history, sizeof(int16_t)*s->buf_ptr);
memcpy(s->history, s->history + s->buf_ptr, sizeof(int16_t)*(PLC_HISTORY_LEN - s->buf_ptr));
memmove(s->history, s->history + s->buf_ptr, sizeof(int16_t)*(PLC_HISTORY_LEN - s->buf_ptr));
memcpy(s->history + PLC_HISTORY_LEN - s->buf_ptr, tmp, sizeof(int16_t)*s->buf_ptr);
s->buf_ptr = 0;
}
+1 -1
View File
@@ -59,7 +59,7 @@ extern "C"
{
#endif
SPAN_DECLARE(void) fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok);
SPAN_DECLARE_NONSTD(void) fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok);
/*! Convert a FAX modem type to a short text description.
\brief Convert a FAX modem type to a short text description.
+1 -1
View File
@@ -108,7 +108,7 @@ set_fs_ver () {
if [ -n "$rev" ]; then
[ -n "$hrev" ] || hrev="$rev"
sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, \[\).*\(\])\)|\1$hrev\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, \[\).*\(\])\)|\1'$hrev'\2|" \
-e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
-e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN\)|\1|" \
configure.in > configure.in.$$
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
src_repo="$(pwd)"
if [ ! -d .git ]; then
echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
exit 1;
fi
rpmbuild --define "VERSION_NUMBER $1" \
--define "BUILD_NUMBER $2" \
--define "_topdir %(pwd)/rpmbuild" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
-ba freeswitch-config-rayo.spec
mkdir $src_repo/RPMS
mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
cat 1>&2 <<EOF
----------------------------------------------------------------------
The Rayo configuration RPMs have been rolled
----------------------------------------------------------------------
EOF
+3 -2
View File
@@ -6,12 +6,13 @@ MONGO_CXX_DRIVER_TARBALL=mongodb-linux-x86_64-$(MONGO_CXX_DRIVER_VERSION)-latest
MONGO_CXX_DRIVER_SRC=$(BASE)/libs/mongo-cxx-driver-$(MONGO_CXX_DRIVER_VERSION)
LIBMONGOCLIENT_A =$(MONGO_CXX_DRIVER_SRC)/libmongoclient.a
LOCAL_SOURCES=mongo_conn.cpp
LOCAL_OBJS=mongo_conn.o
LOCAL_SOURCES=
LOCAL_OBJS=
LOCAL_CFLAGS=-I$(MONGO_CXX_DRIVER_SRC)/src
LOCAL_LIBADD=$(LIBMONGOCLIENT_A)
LOCAL_LDFLAGS=-lboost_thread -lboost_filesystem-mt -lboost_system-mt
#LOCAL_LDFLAGS=-lboost_thread-mt -lboost_filesystem-mt -lboost_system-mt
MODDIR=$(shell pwd)
@@ -7,8 +7,9 @@
foo/server:port,server:port SET
-->
<param name="connection-string" value="127.0.0.1:27017"/>
<param name="min-connections" value="10"/>
<param name="max-connections" value="100"/>
<!-- Timeout in seconds. 0 means no timeout -->
<param name="socket-timeout" value="0"/>
<!--
<param name="map" value="function() { emit(this.a, 1); }"/>
+95 -63
View File
@@ -31,17 +31,20 @@
*/
#include <switch.h>
#include "mod_mongo.h"
#include <mongo/client/dbclient.h>
using namespace mongo;
#define DELIMITER ';'
#define FIND_ONE_SYNTAX "mongo_find_one ns; query; fields; options"
#define MAPREDUCE_SYNTAX "mongo_mapreduce ns; query"
static struct {
mongo_connection_pool_t *conn_pool;
char *map;
char *reduce;
char *finalize;
const char *map;
const char *reduce;
const char *finalize;
const char *conn_str;
double socket_timeout;
} globals;
static int parse_query_options(char *query_options_str)
@@ -86,6 +89,7 @@ SWITCH_STANDARD_API(mongo_mapreduce_function)
if (!zstr(ns) && !zstr(json_query)) {
try {
scoped_ptr<ScopedDbConnection> conn(ScopedDbConnection::getScopedDbConnection(string(globals.conn_str, globals.socket_timeout)));
BSONObj query = fromjson(json_query);
BSONObj out;
BSONObjBuilder cmd;
@@ -105,20 +109,19 @@ SWITCH_STANDARD_API(mongo_mapreduce_function)
}
cmd.append("out", BSON("inline" << 1));
conn = mongo_connection_pool_get(globals.conn_pool);
if (conn) {
conn->runCommand(nsGetDB(ns), cmd.done(), out);
mongo_connection_pool_put(globals.conn_pool, conn, SWITCH_FALSE);
try {
conn->get()->runCommand(nsGetDB(ns), cmd.done(), out);
stream->write_function(stream, "-OK\n%s\n", out.jsonString().c_str());
} else {
stream->write_function(stream, "-ERR\nNo connection\n");
} catch (DBException &e) {
stream->write_function(stream, "-ERR\n%s\n", e.toString().c_str());
} catch (...) {
stream->write_function(stream, "-ERR\nUnknown exception!\n");
}
conn->done();
} catch (DBException &e) {
if (conn) {
mongo_connection_pool_put(globals.conn_pool, conn, SWITCH_TRUE);
}
stream->write_function(stream, "-ERR\n%s\n", e.toString().c_str());
} catch (...) {
stream->write_function(stream, "-ERR\nUnknown exception!\n");
}
} else {
stream->write_function(stream, "-ERR\n%s\n", MAPREDUCE_SYNTAX);
@@ -134,7 +137,7 @@ SWITCH_STANDARD_API(mongo_find_one_function)
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *ns = NULL, *json_query = NULL, *json_fields = NULL, *query_options_str = NULL;
int query_options = 0;
ns = strdup(cmd);
switch_assert(ns != NULL);
@@ -152,29 +155,24 @@ SWITCH_STANDARD_API(mongo_find_one_function)
}
if (!zstr(ns) && !zstr(json_query) && !zstr(json_fields)) {
DBClientBase *conn = NULL;
try {
scoped_ptr<ScopedDbConnection> conn(ScopedDbConnection::getScopedDbConnection(string(globals.conn_str), globals.socket_timeout));
BSONObj query = fromjson(json_query);
BSONObj fields = fromjson(json_fields);
conn = mongo_connection_pool_get(globals.conn_pool);
if (conn) {
BSONObj res = conn->findOne(ns, Query(query), &fields, query_options);
mongo_connection_pool_put(globals.conn_pool, conn, SWITCH_FALSE);
try {
BSONObj res = conn->get()->findOne(ns, Query(query), &fields, query_options);
stream->write_function(stream, "-OK\n%s\n", res.jsonString().c_str());
} else {
stream->write_function(stream, "-ERR\nNo connection\n");
} catch (DBException &e) {
stream->write_function(stream, "-ERR\n%s\n", e.toString().c_str());
} catch (...) {
stream->write_function(stream, "-ERR\nUnknown exception!\n");
}
conn->done();
} catch (DBException &e) {
if (conn) {
mongo_connection_pool_put(globals.conn_pool, conn, SWITCH_TRUE);
}
stream->write_function(stream, "-ERR\n%s\n", e.toString().c_str());
} catch (...) {
stream->write_function(stream, "-ERR\nUnknown exception!\n");
}
} else {
stream->write_function(stream, "-ERR\n%s\n", FIND_ONE_SYNTAX);
}
@@ -184,13 +182,18 @@ SWITCH_STANDARD_API(mongo_find_one_function)
return status;
}
static switch_status_t config(void)
static switch_status_t config(switch_memory_pool_t *pool)
{
const char *cf = "mongo.conf";
switch_xml_t cfg, xml, settings, param;
switch_status_t status = SWITCH_STATUS_SUCCESS;
const char *conn_str = "127.0.0.1";
switch_size_t min_connections = 1, max_connections = 1;
/* set defaults */
globals.map = "";
globals.reduce = "";
globals.finalize = "";
globals.conn_str = "";
globals.socket_timeout = 0.0;
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
@@ -201,38 +204,71 @@ static switch_status_t config(void)
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
int tmp;
if (!strcmp(var, "host")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "'host' is deprecated. use 'connection-string'\n");
conn_str = val;
} else if (!strcmp(var, "connection-string")) {
conn_str = val;
} else if (!strcmp(var, "min-connections")) {
if ((tmp = atoi(val)) > 0) {
min_connections = tmp;
}
} else if (!strcmp(var, "max-connections")) {
if ((tmp = atoi(val)) > 0) {
max_connections = tmp;
if (!strcmp(var, "connection-string")) {
if (zstr(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "missing connection-string value\n");
status = SWITCH_STATUS_GENERR;
} else {
try {
string errmsg;
ConnectionString cs = ConnectionString::parse(string(val), errmsg);
if (!cs.isValid()) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "connection-string \"%s\" is not valid: %s\n", val, errmsg.c_str());
status = SWITCH_STATUS_GENERR;
} else {
globals.conn_str = switch_core_strdup(pool, val);
}
} catch (DBException &e) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "connection-string \"%s\" is not valid: %s\n", val, e.toString().c_str());
status = SWITCH_STATUS_GENERR;
} catch (...) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "connection-string \"%s\" is not valid\n", val);
status = SWITCH_STATUS_GENERR;
}
}
} else if (!strcmp(var, "map")) {
globals.map = strdup(val);
if (!zstr(val)) {
globals.map = switch_core_strdup(pool, val);
}
} else if (!strcmp(var, "reduce")) {
globals.reduce = strdup(val);
if (!zstr(val)) {
globals.reduce = switch_core_strdup(pool, val);
}
} else if (!strcmp(var, "finalize")) {
globals.finalize = strdup(val);
if (!zstr(val)) {
globals.finalize = switch_core_strdup(pool, val);
}
} else if (!strcmp(var, "socket-timeout")) {
if (!zstr(val)) {
if (switch_is_number(val)) {
double timeout = atof(val);
if (timeout >= 0.0) {
globals.socket_timeout = timeout;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "socket-timeout \"%s\" is not valid\n", val);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "socket-timeout \"%s\" is not valid\n", val);
}
}
} else if (!strcmp(var, "max-connections")) {
if (!zstr(val)) {
if (switch_is_number(val)) {
int max_connections = atoi(val);
if (max_connections > 0) {
PoolForHost::setMaxPerHost(max_connections);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "max-connections \"%s\" is not valid\n", val);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "max-connections \"%s\" is not valid\n", val);
}
}
}
}
}
if (mongo_connection_pool_create(&globals.conn_pool, min_connections, max_connections, conn_str) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Can't create connection pool\n");
status = SWITCH_STATUS_GENERR;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Mongo connection pool created [%s %d/%d]\n", conn_str, (int)min_connections, (int)max_connections);
}
switch_xml_free(xml);
return status;
@@ -255,7 +291,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_mongo_load)
memset(&globals, 0, sizeof(globals));
if (config() != SWITCH_STATUS_SUCCESS) {
if (config(pool) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_TERM;
}
@@ -267,11 +303,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_mongo_load)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mongo_shutdown)
{
mongo_connection_pool_destroy(&globals.conn_pool);
switch_safe_free(globals.map);
switch_safe_free(globals.reduce);
switch_safe_free(globals.finalize);
ScopedDbConnection::clearPool();
return SWITCH_STATUS_SUCCESS;
}
@@ -1,75 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2013, 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):
*
* Tamas Cseke <cstomi.levlist@gmail.com>
*
* mod_mongo.h -- API for MongoDB
*
*/
#ifndef MOD_MONGO_H
#define MOD_MONGO_H
#include <mongo/client/dbclient.h>
using namespace mongo;
typedef struct {
char *conn_str;
switch_size_t min_connections;
switch_size_t max_connections;
switch_size_t size;
switch_queue_t *connections;
switch_mutex_t *mutex;
switch_memory_pool_t *pool;
} mongo_connection_pool_t;
switch_status_t mongo_connection_create(DBClientBase **connection, const char *conn_str);
void mongo_connection_destroy(DBClientBase **conn);
switch_status_t mongo_connection_pool_create(mongo_connection_pool_t **conn_pool, switch_size_t min_connections, switch_size_t max_connections,
const char *conn_str);
void mongo_connection_pool_destroy(mongo_connection_pool_t **conn_pool);
DBClientBase *mongo_connection_pool_get(mongo_connection_pool_t *conn_pool);
switch_status_t mongo_connection_pool_put(mongo_connection_pool_t *conn_pool, DBClientBase *conn, switch_bool_t destroy);
#endif
/* 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
*/
@@ -1,211 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2013, 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):
*
* Tamas Cseke <cstomi.levlist@gmail.com>
*
* mongo_conn.cpp -- MongoDB connection pool
*
*/
#include <switch.h>
#include "mod_mongo.h"
/*
we could use the driver's connection pool,
if we could set the max connections (PoolForHost::setMaxPerHost)
ScopedDbConnection scoped_conn("host");
DBClientConnection *conn = dynamic_cast< DBClientConnection* >(&scoped_conn.conn());
scoped_conn.done();
*/
switch_status_t mongo_connection_create(DBClientBase **connection, const char *conn_str)
{
DBClientBase *conn = NULL;
string conn_string(conn_str), err_msg;
ConnectionString cs = ConnectionString::parse(conn_string, err_msg);
switch_status_t status = SWITCH_STATUS_FALSE;
if (!cs.isValid()) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't parse url: %s\n", err_msg.c_str());
return status;
}
try {
conn = cs.connect(err_msg);
} catch (DBException &e) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't connect to mongo [%s]: %s\n", conn_str, err_msg.c_str());
return status;
}
if (conn) {
*connection = conn;
status = SWITCH_STATUS_SUCCESS;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected to mongo [%s]\n", conn_str);
}
return status;
}
void mongo_connection_destroy(DBClientBase **conn)
{
switch_assert(*conn != NULL);
delete *conn;
*conn = NULL;
}
switch_status_t mongo_connection_pool_create(mongo_connection_pool_t **conn_pool, switch_size_t min_connections, switch_size_t max_connections,
const char *conn_str)
{
switch_memory_pool_t *pool = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
mongo_connection_pool_t *cpool = NULL;
DBClientBase *conn = NULL;
if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) {
return status;
}
if (!(cpool = (mongo_connection_pool_t *)switch_core_alloc(pool, sizeof(mongo_connection_pool_t)))) {
switch_goto_status(SWITCH_STATUS_MEMERR, done);
}
if ((status = switch_mutex_init(&cpool->mutex, SWITCH_MUTEX_NESTED, pool)) != SWITCH_STATUS_SUCCESS) {
goto done;
}
if ((status = switch_queue_create(&cpool->connections, max_connections, pool)) != SWITCH_STATUS_SUCCESS) {
goto done;
}
cpool->min_connections = min_connections;
cpool->max_connections = max_connections;
cpool->conn_str = switch_core_strdup(pool, conn_str);
cpool->pool = pool;
for (cpool->size = 0; cpool->size < min_connections; cpool->size++) {
if (mongo_connection_create(&conn, conn_str) == SWITCH_STATUS_SUCCESS) {
mongo_connection_pool_put(cpool, conn, SWITCH_FALSE);
} else {
break;
}
}
done:
if (status == SWITCH_STATUS_SUCCESS) {
*conn_pool = cpool;
} else {
switch_core_destroy_memory_pool(&pool);
}
return status;
}
void mongo_connection_pool_destroy(mongo_connection_pool_t **conn_pool)
{
mongo_connection_pool_t *cpool = *conn_pool;
void *data = NULL;
switch_assert(cpool != NULL);
while (switch_queue_trypop(cpool->connections, &data) == SWITCH_STATUS_SUCCESS) {
mongo_connection_destroy((DBClientBase **)&data);
}
switch_mutex_destroy(cpool->mutex);
switch_core_destroy_memory_pool(&cpool->pool);
*conn_pool = NULL;
}
DBClientBase *mongo_connection_pool_get(mongo_connection_pool_t *conn_pool)
{
DBClientBase *conn = NULL;
void *data = NULL;
switch_assert(conn_pool != NULL);
switch_mutex_lock(conn_pool->mutex);
if (switch_queue_trypop(conn_pool->connections, &data) == SWITCH_STATUS_SUCCESS) {
conn = (DBClientBase *) data;
} else if (mongo_connection_create(&conn, conn_pool->conn_str) == SWITCH_STATUS_SUCCESS) {
if (++conn_pool->size > conn_pool->max_connections) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Connection pool is empty. You may want to increase 'max-connections'\n");
}
}
switch_mutex_unlock(conn_pool->mutex);
#ifdef MONGO_POOL_DEBUG
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "POOL get: size %d conn: %p\n", (int) switch_queue_size(conn_pool->connections), conn);
#endif
return conn;
}
switch_status_t mongo_connection_pool_put(mongo_connection_pool_t *conn_pool, DBClientBase *conn, switch_bool_t destroy)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_assert(conn_pool != NULL);
switch_assert(conn != NULL);
switch_mutex_lock(conn_pool->mutex);
if (destroy || conn_pool->size > conn_pool->max_connections) {
#ifdef MONGO_POOL_DEBUG
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "POOL: Destroy connection %p\n", conn);
#endif
mongo_connection_destroy(&conn);
conn_pool->size--;
} else {
#ifdef MONGO_POOL_DEBUG
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "POOL: push connection %p\n", conn);
#endif
status = switch_queue_push(conn_pool->connections, conn);
}
switch_mutex_unlock(conn_pool->mutex);
#ifdef MONGO_POOL_DEBUG
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "POOL: put size %d conn: %p\n", (int) switch_queue_size(conn_pool->connections), conn);
#endif
return status;
}
/* 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
*/
@@ -1346,16 +1346,16 @@ static int listen_callback(void *pArg, int argc, char **argv, char **columnNames
static char *resolve_id(const char *myid, const char *domain_name, const char *action)
{
switch_xml_t xx_user, xx_domain, xx_domain_root;
switch_xml_t xx_user;
switch_event_t *params;
char *ret = (char *) myid;
switch_event_create(&params, SWITCH_EVENT_GENERAL);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", action);
if (switch_xml_locate_user("id", myid, domain_name, NULL, &xx_domain_root, &xx_domain, &xx_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
if (switch_xml_locate_user_merged("id:number-alias", myid, domain_name, NULL, &xx_user, params) == SWITCH_STATUS_SUCCESS) {
ret = strdup(switch_xml_attr(xx_user, "id"));
switch_xml_free(xx_domain_root);
switch_xml_free(xx_user);
}
switch_event_destroy(&params);
@@ -39,6 +39,10 @@
/*****************************************************************************/
/* SKINNY TYPES */
/*****************************************************************************/
/* Hardcode ptime in one place until we make it dynamic */
#define SKINNY_PTIME 20
typedef enum {
SKINNY_CODEC_NONE = 0,
SKINNY_CODEC_NONSTANDARD = 1,
+22 -4
View File
@@ -788,7 +788,7 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
send_open_receive_channel(listener,
tech_pvt->call_id, /* uint32_t conference_id, */
tech_pvt->call_id, /* uint32_t pass_thru_party_id, */
20, /* uint32_t ms_per_packet, */
SKINNY_PTIME, /* uint32_t ms_per_packet, */
SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
0, /* uint32_t echo_cancel_type, */
0, /* uint32_t g723_bitrate, */
@@ -849,7 +849,25 @@ switch_status_t skinny_session_unhold_line(switch_core_session_t *session, liste
send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id);
send_set_speaker_mode(listener, SKINNY_SPEAKER_ON);
send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_RING_OUT, 0xffff);
skinny_session_start_media(session, listener, line_instance);
send_stop_tone(listener, line_instance, tech_pvt->call_id);
send_open_receive_channel(listener,
tech_pvt->call_id, /* uint32_t conference_id, */
tech_pvt->call_id, /* uint32_t pass_thru_party_id, */
SKINNY_PTIME, /* uint32_t ms_per_packet, */
SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
0, /* uint32_t echo_cancel_type, */
0, /* uint32_t g723_bitrate, */
0, /* uint32_t conference_id2, */
0 /* uint32_t reserved[10] */
);
skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_CONNECTED);
send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_CONNECTED, 0xffff);
send_display_prompt_status_textid(listener, 0, SKINNY_TEXTID_CONNECTED, line_instance, tech_pvt->call_id);
skinny_session_send_call_info(session, listener, line_instance);
return SWITCH_STATUS_SUCCESS;
}
@@ -1812,7 +1830,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
/* Codec */
tech_pvt->iananame = "PCMU"; /* TODO */
tech_pvt->codec_ms = 20; /* TODO */
tech_pvt->codec_ms = SKINNY_PTIME; /* TODO */
tech_pvt->rm_rate = 8000; /* TODO */
tech_pvt->rm_fmtp = NULL; /* TODO */
tech_pvt->agreed_pt = (switch_payload_t) 0; /* TODO */
@@ -1861,7 +1879,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
addr.s_addr, /* uint32_t remote_ip, */
tech_pvt->local_sdp_audio_port, /* uint32_t remote_port, */
20, /* uint32_t ms_per_packet, */
SKINNY_PTIME, /* uint32_t ms_per_packet, */
SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
184, /* uint32_t precedence, */
0, /* uint32_t silence_suppression, */
+1 -1
View File
@@ -164,7 +164,6 @@ typedef struct sofia_dispatch_event_s {
struct sofia_private {
char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
sofia_gateway_t *gateway;
char gateway_name[256];
char auth_gateway_name[256];
char *call_id;
@@ -422,6 +421,7 @@ typedef enum {
struct sofia_gateway_subscription {
sofia_gateway_t *gateway;
sofia_private_t *sofia_private;
nua_handle_t *nh;
char *expires_str;
char *event; /* eg, 'message-summary' to subscribe to MWI events */
+44 -16
View File
@@ -337,6 +337,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
switch_event_t *s_event = NULL;
sofia_gateway_subscription_t *gw_sub_ptr;
int sub_state;
sofia_gateway_t *gateway = NULL;
tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
@@ -445,19 +446,25 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
}
}
if (!sofia_private || !sofia_private->gateway) {
if (!sofia_private || zstr(sofia_private->gateway_name)) {
if (profile->debug) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Gateway information missing Subscription Event: %s\n",
sip->sip_event->o_type);
}
goto error;
}
if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
goto error;
}
/* find the corresponding gateway subscription (if any) */
if (!(gw_sub_ptr = sofia_find_gateway_subscription(sofia_private->gateway, sip->sip_event->o_type))) {
if (!(gw_sub_ptr = sofia_find_gateway_subscription(gateway, sip->sip_event->o_type))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"Could not find gateway subscription. Gateway: %s. Subscription Event: %s\n",
sofia_private->gateway->name, sip->sip_event->o_type);
gateway->name, sip->sip_event->o_type);
goto error;
}
@@ -466,17 +473,28 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
goto error;
}
if (sip->sip_subscription_state && sip->sip_subscription_state->ss_expires) {
int delta = atoi(sip->sip_subscription_state->ss_expires);
delta /= 2;
if (delta < 1) {
delta = 1;
}
gw_sub_ptr->expires = switch_epoch_time_now(NULL) + delta;
}
/* dispatch freeswitch event */
if (switch_event_create(&s_event, SWITCH_EVENT_NOTIFY_IN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event", sip->sip_event->o_type);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "pl_data", sip->sip_payload ? sip->sip_payload->pl_data : "");
if ( sip->sip_content_type != NULL )
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "sip_content_type", sip->sip_content_type->c_type);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "port", "%d", sofia_private->gateway->profile->sip_port);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "port", "%d", gateway->profile->sip_port);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "module_name", "mod_sofia");
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", sofia_private->gateway->profile->name);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_uri", sofia_private->gateway->profile->url);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "gateway_name", sofia_private->gateway->name);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", gateway->profile->name);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_uri", gateway->profile->url);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "gateway_name", gateway->name);
if ( sip->sip_call_info != NULL ) {
sip_call_info_t *call_info = sip->sip_call_info;
int cur_len = 0;
@@ -565,12 +583,16 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
end:
if (sub_state == nua_substate_terminated && sofia_private && sofia_private != &mod_sofia_globals.destroy_private &&
if (!gateway && sub_state == nua_substate_terminated && sofia_private && sofia_private != &mod_sofia_globals.destroy_private &&
sofia_private != &mod_sofia_globals.keep_private) {
sofia_private->destroy_nh = 1;
sofia_private->destroy_me = 1;
}
if (gateway) {
sofia_reg_release_gateway(gateway);
}
}
void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
@@ -1049,9 +1071,9 @@ static void our_sofia_event_callback(nua_event_t event,
if (sofia_private && sofia_private != &mod_sofia_globals.destroy_private && sofia_private != &mod_sofia_globals.keep_private) {
if ((gateway = sofia_private->gateway)) {
/* Released in sofia_reg_release_gateway() */
if (sofia_reg_gateway_rdlock(gateway) != SWITCH_STATUS_SUCCESS) {
if (!zstr(sofia_private->gateway_name)) {
if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) {
return;
}
} else if (!zstr(sofia_private->uuid)) {
@@ -1499,9 +1521,16 @@ static void our_sofia_event_callback(nua_event_t event,
case nua_r_authenticate:
if (status >= 500) {
if (sofia_private && sofia_private->gateway) {
nua_handle_destroy(sofia_private->gateway->nh);
sofia_private->gateway->nh = NULL;
if (sofia_private && !zstr(sofia_private->gateway_name)) {
sofia_gateway_t *gateway = NULL;
if ((gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) {
nua_handle_bind(gateway->nh, NULL);
gateway->sofia_private = NULL;
nua_handle_destroy(gateway->nh);
gateway->nh = NULL;
sofia_reg_release_gateway(gateway);
}
} else {
nua_handle_destroy(nh);
}
@@ -2325,10 +2354,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
if (++gateway_loops >= GATEWAY_SECONDS) {
sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL));
sofia_sub_check_gateway(profile, switch_epoch_time_now(NULL));
gateway_loops = 0;
}
sofia_sub_check_gateway(profile, time(NULL));
}
switch_yield(1000000);
+24 -13
View File
@@ -4285,6 +4285,7 @@ void sofia_presence_handle_sip_r_subscribe(int status,
{
sip_event_t const *o = NULL;
sofia_gateway_subscription_t *gw_sub_ptr;
sofia_gateway_t *gateway = NULL;
if (!sip) {
return;
@@ -4297,18 +4298,25 @@ void sofia_presence_handle_sip_r_subscribe(int status,
return;
}
if (!sofia_private || !sofia_private->gateway) {
if (!sofia_private || zstr(sofia_private->gateway_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
return;
}
/* Find the subscription if one exists */
if (!(gw_sub_ptr = sofia_find_gateway_subscription(sofia_private->gateway, o->o_type))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find gateway subscription. Gateway: %s. Subscription Event: %s\n",
sofia_private->gateway->name, o->o_type);
if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
return;
}
/* Find the subscription if one exists */
if (!(gw_sub_ptr = sofia_find_gateway_subscription(gateway, o->o_type))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find gateway subscription. Gateway: %s. Subscription Event: %s\n",
gateway->name, o->o_type);
goto end;
}
/* Update the subscription status for the subscription */
switch (status) {
case 200:
@@ -4326,19 +4334,22 @@ void sofia_presence_handle_sip_r_subscribe(int status,
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "status (%d) != 200, updated state to SUB_STATE_FAILED.\n", status);
gw_sub_ptr->state = SUB_STATE_FAILED;
gw_sub_ptr->expires = switch_epoch_time_now(NULL);
gw_sub_ptr->retry = switch_epoch_time_now(NULL);
if (sofia_private) {
if (gw_sub_ptr->nh) {
nua_handle_bind(gw_sub_ptr->nh, NULL);
nua_handle_destroy(gw_sub_ptr->nh);
gw_sub_ptr->nh = NULL;
}
} else {
if (!sofia_private) {
nua_handle_destroy(nh);
}
break;
}
end:
if (gateway) {
sofia_reg_release_gateway(gateway);
}
}
+59 -40
View File
@@ -47,7 +47,7 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach)
nua_handle_bind(gateway_ptr->nh, NULL);
nua_handle_destroy(gateway_ptr->nh);
gateway_ptr->nh = NULL;
sofia_private_free(gateway_ptr->sofia_private);
gateway_ptr->sofia_private = NULL;
}
gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
@@ -56,23 +56,24 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach)
NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
if (attach) {
if (!gateway_ptr->sofia_private) {
gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
gateway_ptr->sofia_private = su_alloc(gateway_ptr->nh->nh_home, sizeof(*gateway_ptr->sofia_private));
switch_assert(gateway_ptr->sofia_private);
}
memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
gateway_ptr->sofia_private->gateway = gateway_ptr;
switch_set_string(gateway_ptr->sofia_private->gateway_name, gateway_ptr->name);
nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
}
}
static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr, int attach)
static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr)
{
sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway;
char *user_via = NULL;
char *register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy);
int ss_state = nua_callstate_authenticating;
/* check for NAT and place a Via header if necessary (hostname or non-local IP) */
if (register_host && sofia_glue_check_nat(gateway_ptr->profile, register_host)) {
user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
@@ -82,7 +83,7 @@ static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr, i
nua_handle_bind(gw_sub_ptr->nh, NULL);
nua_handle_destroy(gw_sub_ptr->nh);
gw_sub_ptr->nh = NULL;
sofia_private_free(gateway_ptr->sofia_private);
gw_sub_ptr->sofia_private = NULL;
}
gw_sub_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
@@ -90,16 +91,14 @@ static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr, i
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
SIPTAG_TO_STR(gateway_ptr->register_to),
NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
if (attach) {
if (!gateway_ptr->sofia_private) {
gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
switch_assert(gateway_ptr->sofia_private);
}
memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
gateway_ptr->sofia_private->gateway = gateway_ptr;
nua_handle_bind(gw_sub_ptr->nh, gateway_ptr->sofia_private);
if (!gw_sub_ptr->sofia_private) {
gw_sub_ptr->sofia_private = su_alloc(gw_sub_ptr->nh->nh_home, sizeof(*gw_sub_ptr->sofia_private));
switch_assert(gw_sub_ptr->sofia_private);
}
memset(gw_sub_ptr->sofia_private, 0, sizeof(*gw_sub_ptr->sofia_private));
switch_set_string(gw_sub_ptr->sofia_private->gateway_name, gateway_ptr->name);
nua_handle_bind(gw_sub_ptr->nh, gw_sub_ptr->sofia_private);
switch_safe_free(register_host);
switch_safe_free(user_via);
@@ -109,6 +108,8 @@ static void sofia_reg_kill_sub(sofia_gateway_subscription_t *gw_sub_ptr)
{
sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway;
gw_sub_ptr->sofia_private = NULL;
if (gw_sub_ptr->nh) {
nua_handle_bind(gw_sub_ptr->nh, NULL);
}
@@ -141,6 +142,7 @@ static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Destroying registration handle for %s\n", gateway_ptr->name);
}
gateway_ptr->sofia_private = NULL;
nua_handle_bind(gateway_ptr->nh, NULL);
nua_handle_destroy(gateway_ptr->nh);
gateway_ptr->nh = NULL;
@@ -175,20 +177,18 @@ void sofia_reg_unregister(sofia_profile_t *profile)
nua_handle_bind(gateway_ptr->nh, NULL);
}
if (gateway_ptr->sofia_private) {
sofia_private_free(gateway_ptr->sofia_private);
}
if (gateway_ptr->state == REG_STATE_REGED) {
sofia_reg_kill_reg(gateway_ptr);
}
for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) {
if (gw_sub_ptr->state == SUB_STATE_SUBED) {
sofia_reg_kill_sub(gw_sub_ptr);
}
}
gateway_ptr->subscriptions = NULL;
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
}
@@ -229,7 +229,7 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
break;
case SUB_STATE_UNSUBED:
sofia_reg_new_sub_handle(gw_sub_ptr, 1);
sofia_reg_new_sub_handle(gw_sub_ptr);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
@@ -2184,17 +2184,27 @@ void sofia_reg_handle_sip_r_register(int status,
sofia_dispatch_event_t *de,
tagi_t tags[])
{
sofia_gateway_t *gateway = NULL;
if (sofia_private && !zstr(sofia_private->gateway_name)) {
gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
}
if (status >= 500) {
if (sofia_private && sofia_private->gateway) {
nua_handle_destroy(sofia_private->gateway->nh);
sofia_private->gateway->nh = NULL;
if (sofia_private && gateway) {
nua_handle_bind(gateway->nh, NULL);
gateway->sofia_private = NULL;
nua_handle_destroy(gateway->nh);
gateway->nh = NULL;
} else {
nua_handle_destroy(nh);
}
}
if (sofia_private && sofia_private->gateway) {
reg_state_t ostate = sofia_private->gateway->state;
if (sofia_private && gateway) {
reg_state_t ostate = gateway->state;
switch (status) {
case 200:
if (sip && sip->sip_contact) {
@@ -2206,7 +2216,7 @@ void sofia_reg_handle_sip_r_register(int status,
for (; contact; contact = contact->m_next) {
if ((full = sip_header_as_string(nh->nh_home, (void *) contact))) {
if (switch_stristr(sofia_private->gateway->register_contact, full)) {
if (switch_stristr(gateway->register_contact, full)) {
break;
}
@@ -2223,37 +2233,42 @@ void sofia_reg_handle_sip_r_register(int status,
new_expires = contact->m_expires;
expi = (uint32_t) atoi(new_expires);
if (expi > 0 && expi != sofia_private->gateway->freq) {
//sofia_private->gateway->freq = expi;
//sofia_private->gateway->expires_str = switch_core_sprintf(sofia_private->gateway->pool, "%d", expi);
if (expi > 0 && expi != gateway->freq) {
//gateway->freq = expi;
//gateway->expires_str = switch_core_sprintf(gateway->pool, "%d", expi);
if (expi > 60) {
sofia_private->gateway->expires = switch_epoch_time_now(NULL) + (expi - 15);
gateway->expires = switch_epoch_time_now(NULL) + (expi - 15);
} else {
sofia_private->gateway->expires = switch_epoch_time_now(NULL) + (expi - 2);
gateway->expires = switch_epoch_time_now(NULL) + (expi - 2);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Changing expire time to %d by request of proxy %s\n", expi, sofia_private->gateway->register_proxy);
"Changing expire time to %d by request of proxy %s\n", expi, gateway->register_proxy);
}
}
}
sofia_private->gateway->state = REG_STATE_REGISTER;
gateway->state = REG_STATE_REGISTER;
break;
case 100:
break;
default:
sofia_private->gateway->state = REG_STATE_FAILED;
sofia_private->gateway->failure_status = status;
gateway->state = REG_STATE_FAILED;
gateway->failure_status = status;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Registration Failed with status %s [%d]. failure #%d\n",
sofia_private->gateway->name, switch_str_nil(phrase), status, ++sofia_private->gateway->failures);
gateway->name, switch_str_nil(phrase), status, ++gateway->failures);
break;
}
if (ostate != sofia_private->gateway->state) {
sofia_reg_fire_custom_gateway_state_event(sofia_private->gateway, status, phrase);
if (ostate != gateway->state) {
sofia_reg_fire_custom_gateway_state_event(gateway, status, phrase);
}
}
if (gateway) {
sofia_reg_release_gateway(gateway);
}
}
void sofia_reg_handle_sip_r_challenge(int status,
@@ -2282,8 +2297,12 @@ void sofia_reg_handle_sip_r_challenge(int status,
sip_auth_password = switch_channel_get_variable(channel, "sip_auth_password");
}
if (sofia_private && *sofia_private->auth_gateway_name) {
gw_name = sofia_private->auth_gateway_name;
if (sofia_private) {
if (*sofia_private->auth_gateway_name) {
gw_name = sofia_private->auth_gateway_name;
} else if (*sofia_private->gateway_name) {
gw_name = sofia_private->gateway_name;
}
}
if (session) {
@@ -2407,7 +2426,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
tl_gets(tags, NUTAG_CALLSTATE_REF(ss_state), SIPTAG_WWW_AUTHENTICATE_REF(authenticate), TAG_END());
nua_authenticate(nh,
TAG_IF(sofia_private && sofia_private->gateway, SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")),
TAG_IF(gateway, SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")),
NUTAG_AUTH(authentication), TAG_END());
goto end;
@@ -12741,9 +12741,9 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_monotonic(int jarg1) {
SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_timerfd(int jarg1) {
switch_bool_t arg1 ;
int arg1 ;
arg1 = (switch_bool_t)jarg1;
arg1 = (int)jarg1;
switch_time_set_timerfd(arg1);
}
@@ -14209,6 +14209,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ice_direction(void * jarg1) {
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_debug_pool(void * jarg1) {
switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
arg1 = (switch_stream_handle_t *)jarg1;
switch_core_session_debug_pool(arg1);
}
SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) {
switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ;
char *arg2 = (char *) 0 ;
@@ -35686,7 +35694,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_MAX_CAND_get() {
int jresult ;
int result;
result = (int)(25);
result = (int)(50);
jresult = result;
return jresult;
}
@@ -35702,7 +35710,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_ice_t_cands_set(void * jarg1, void * jarg2) {
icand_t (*inp)[2] = (icand_t (*)[2])(arg2);
icand_t (*dest)[2] = (icand_t (*)[2])(arg1->cands);
size_t ii = 0;
for (; ii < 25; ++ii) {
for (; ii < 50; ++ii) {
icand_t *ip = inp[ii];
icand_t *dp = dest[ii];
size_t jj = 0;
@@ -2763,8 +2763,8 @@ public class freeswitch {
freeswitchPINVOKE.switch_time_set_monotonic((int)enable);
}
public static void switch_time_set_timerfd(switch_bool_t enable) {
freeswitchPINVOKE.switch_time_set_timerfd((int)enable);
public static void switch_time_set_timerfd(int enable) {
freeswitchPINVOKE.switch_time_set_timerfd(enable);
}
public static void switch_time_set_nanosleep(switch_bool_t enable) {
@@ -3160,6 +3160,10 @@ public class freeswitch {
return ret;
}
public static void switch_core_session_debug_pool(switch_stream_handle stream) {
freeswitchPINVOKE.switch_core_session_debug_pool(switch_stream_handle.getCPtr(stream));
}
public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload);
return ret;
@@ -10723,6 +10727,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_ice_direction")]
public static extern int switch_ice_direction(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_debug_pool")]
public static extern void switch_core_session_debug_pool(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")]
public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2);
@@ -26726,6 +26733,7 @@ public enum switch_channel_flag_t {
CF_VIDEO_ECHO,
CF_SLA_INTERCEPT,
CF_VIDEO_BREAK,
CF_MEDIA_PAUSE,
CF_FLAG_MAX
}
@@ -35305,6 +35313,8 @@ public enum switch_rtp_flag_t {
SWITCH_RTP_FLAG_KILL_JB,
SWITCH_RTP_FLAG_VIDEO_BREAK,
SWITCH_RTP_FLAG_PAUSE,
SWITCH_RTP_FLAG_FIR,
SWITCH_RTP_FLAG_PLI,
SWITCH_RTP_FLAG_INVALID
}
+2 -1
View File
@@ -467,7 +467,8 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
switch_channel_set_running_state(session->channel, state);
switch_channel_clear_flag(session->channel, CF_TRANSFER);
switch_channel_clear_flag(session->channel, CF_REDIRECT);
switch_ivr_parse_all_messages(session);
if (session->endpoint_interface->io_routines->state_run) {
rstatus = session->endpoint_interface->io_routines->state_run(session);
}
+8 -13
View File
@@ -389,31 +389,26 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
const char *prefix, *var;
if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
prefix = switch_channel_get_variable(channel, "sound_prefix");
if (!prefix) {
prefix = SWITCH_GLOBAL_dirs.sounds_dir;
}
if (!switch_channel_media_ready(channel)) {
return SWITCH_STATUS_FALSE;
}
switch_core_session_get_read_impl(session, &read_impl);
if (!(divisor = read_impl.actual_samples_per_second / 8000)) {
divisor = 1;
}
if (!switch_channel_ready(channel)) {
return SWITCH_STATUS_FALSE;
}
if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
if (!switch_channel_media_ready(channel)) {
return SWITCH_STATUS_FALSE;
}
arg_recursion_check_start(args);
if (!fh) {
+1 -1
View File
@@ -2067,7 +2067,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_merged(const char *key, c
switch_xml_merge_user(x_user_dup, domain, group);
cacheable = switch_xml_attr(x_user_dup, "cacheable");
if (switch_true(cacheable)) {
if (!zstr(cacheable)) {
switch_time_t expires = 0;
switch_time_t time_now = 0;
+1 -1
View File
@@ -6,7 +6,7 @@
;(setq cperl-hairy t)
(global-unset-key "\C-h")
(global-set-key "\C-h" 'delete-backward-char)
(load "/usr/share/emacs/site-lisp/rng-auto.el")
;(load "/usr/share/emacs/site-lisp/rng-auto.el")
(require 'cc-mode)
(defun my-build-tab-stop-list (width)