Compare commits
108 Commits
1.10.1
...
core_fixes
Author | SHA1 | Date |
---|---|---|
Anthony Minessale | 47c5c8f3e8 | |
Anthony Minessale | 7ce50c8bd0 | |
Andrey Volk | b93eea73ef | |
Andrey Volk | bae7c3eae0 | |
Dragos Oancea | b124b607d7 | |
Andrey Volk | 5274dd1f9c | |
Andrey Volk | 329edd0133 | |
Andrey Volk | a124937f0c | |
lazedo | ac77de715b | |
Andrey Volk | 1435577eaf | |
lazedo | 731b0eb8fd | |
Andrey Volk | 4de6afc9d6 | |
lazedo | 1afad3413b | |
Andrey Volk | b337e77258 | |
Andrey Volk | 4c434aef1f | |
Andrey Volk | 2865603ad2 | |
Ítalo Rossi | 3de3ec3b1a | |
Andrey Volk | 5836b9652b | |
Andrey Volk | ff65104c03 | |
Andrey Volk | 0bd676db32 | |
Andrey Volk | a4f0b2f2a0 | |
Seven Du | 724868fa08 | |
Seven Du | 254fda292a | |
Andrey Volk | 66aa064588 | |
Andrey Volk | f8dc87bd18 | |
Piotr Gregor | b0f09fcff2 | |
Dragos Oancea | a2b46bcf10 | |
Andrey Volk | a288c3d969 | |
Dragos Oancea | 60746cc07c | |
Vallimamod Abdullah | 7f63483138 | |
lazedo | 3c6d47c293 | |
Areski Belaid | 647ed310e5 | |
Andrey Volk | 7861ec937e | |
Andrey Volk | 55afe220d3 | |
Andrey Volk | 00cbf0ea37 | |
lazedo | 998e322f46 | |
Andrey Volk | aa2df4f3f8 | |
Andrey Volk | 5705290f8d | |
Andrey Volk | 2ace196aa6 | |
lazedo | 506bcd280d | |
lazedo | b4373c6666 | |
lazedo | f77484b96d | |
lazedo | 8d2174d707 | |
Andrey Volk | c76a8c5458 | |
Chris Rienzo | 1442186cee | |
Seven Du | 8aafff281b | |
Dragos Oancea | 45219aef6f | |
Andrey Volk | 31d6676706 | |
Andrey Volk | 0e3d8c00ba | |
Mike Jerris | 07c6ad5e1a | |
Andrey Volk | 311a20af63 | |
Andrey Volk | 284d67738a | |
cdosoftei | 5244a64d4e | |
Mike Jerris | 6a900a90a3 | |
cdosoftei | 5f628c0090 | |
Andrey Volk | 7fdf8584e4 | |
cdosoftei | 7e91927278 | |
Pelle Mattsson | 77cd699000 | |
Ciprian | 696814cb26 | |
Andrey Volk | cec8f3b1ca | |
lazedo | 318e5d0d6d | |
Andrey Volk | f6c10f8622 | |
Andrey Volk | 93691c60ce | |
Andrey Volk | 8a80e3ad0c | |
Andrey Volk | db64a08b02 | |
Andrey Volk | c96479bfd6 | |
Sebastian Kemper | 8919d581fe | |
Sebastian Kemper | fc41980f19 | |
Andrey Volk | ea2c31f0c8 | |
Chris Rienzo | 9d4f480335 | |
Andrew Savchenko | c4ec06dc23 | |
cdosoftei | d60193c1ae | |
Andrey Volk | 6f8d65c348 | |
Mitch Capper | 1b04ffe535 | |
Mike Jerris | dbec998873 | |
Andrey Volk | 34075172eb | |
Andrey Volk | 4a60911228 | |
David VILLAUME | 9de281133a | |
Andrey Volk | 65c4ca072d | |
Anthony Minessale | 285cb60926 | |
Andrey Volk | 1711450e98 | |
Andrey Volk | 15ad4c23e2 | |
Andrey Volk | 5123b00426 | |
Sergey Safarov | 6704d3aabe | |
Andrey Volk | 75cfacf4c2 | |
Andrey Volk | 583bf0441d | |
Andrey Volk | 6f62194af7 | |
Andrey Volk | 70831a7140 | |
Andrey Volk | fc925a273b | |
Andrey Volk | 20a893fd06 | |
Christopher Rienzo | 8880c4f469 | |
Andrey Volk | 7ee53a6ec1 | |
Christopher Rienzo | 468e2e06d1 | |
Andrey Volk | f00d285b5e | |
Andrey Volk | d0c6b30c15 | |
Andrey Volk | d45e9df883 | |
Dragos Oancea | 4d4afbeb5d | |
Andrey Volk | eee07bd95f | |
Andrey Volk | 1583740133 | |
Christopher Rienzo | 6a6b8ac350 | |
Dragos Oancea | aaacaa19de | |
Dragos Oancea | 44199e91b5 | |
Andrey Volk | e1c6786a50 | |
Andrey Volk | fd2f12cf94 | |
David Grant | 7a4a988dcb | |
Ítalo Rossi | 759783532d | |
Mike Jerris | 8c1697b9b2 | |
Andrey Volk | b8e14cb9b5 |
|
@ -0,0 +1,47 @@
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: unit-tests
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: run-tests
|
||||||
|
image: signalwire/freeswitch-public-base
|
||||||
|
pull: true
|
||||||
|
commands:
|
||||||
|
- ./bootstrap.sh -j
|
||||||
|
- echo "applications/mod_test" >> modules.conf
|
||||||
|
- ./configure
|
||||||
|
- echo "#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=\${PIPESTATUS[0]}\necho \$exitstatus > ./build-status.txt\nmake install\n" > build.sh
|
||||||
|
- chmod +x build.sh
|
||||||
|
- ./build.sh
|
||||||
|
- cd tests/unit
|
||||||
|
- ./run-tests.sh
|
||||||
|
- mkdir logs && (mv log_run-tests_*.html logs || true)
|
||||||
|
- echo 0 > run-tests-status.txt
|
||||||
|
- ./collect-test-logs.sh && exit 0 || echo 'Some tests failed'
|
||||||
|
- echo 1 > run-tests-status.txt
|
||||||
|
- cd logs && ls -la
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: signalwire/unit-tests-notify
|
||||||
|
pull: true
|
||||||
|
environment:
|
||||||
|
GITHUB_CI_APP_PEM:
|
||||||
|
from_secret: github_ci_app_pem
|
||||||
|
SSH_KEY:
|
||||||
|
from_secret: ssh_key
|
||||||
|
SLACK_WEBHOOK_URL:
|
||||||
|
from_secret: slack_webhook_url
|
||||||
|
commands:
|
||||||
|
- /root/notify.sh
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
- push
|
||||||
|
---
|
||||||
|
kind: signature
|
||||||
|
hmac: a34718dd1e2b9468a845962219ff05cac0c922ddf90d885af557a937a9e412e0
|
||||||
|
|
||||||
|
...
|
|
@ -586,7 +586,7 @@ libs/libzrtp/libzrtp.a:
|
||||||
cd libs/libzrtp && $(MAKE)
|
cd libs/libzrtp && $(MAKE)
|
||||||
|
|
||||||
libs/libvpx/Makefile: libs/libvpx/.update
|
libs/libvpx/Makefile: libs/libvpx/.update
|
||||||
cd libs/libvpx && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --size-limit=16384x16384 --extra-cflags="$(VISIBILITY_FLAG)"
|
cd libs/libvpx && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS) $(VISIBILITY_FLAG)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --size-limit=16384x16384
|
||||||
|
|
||||||
libs/libvpx/libvpx.a: libs/libvpx/Makefile libs/libvpx/.update
|
libs/libvpx/libvpx.a: libs/libvpx/Makefile libs/libvpx/.update
|
||||||
@cd libs/libvpx && $(MAKE)
|
@cd libs/libvpx && $(MAKE)
|
||||||
|
@ -684,7 +684,7 @@ is-scm:
|
||||||
echo ; echo ; \
|
echo ; echo ; \
|
||||||
echo "*****************************************************************************************************" ; \
|
echo "*****************************************************************************************************" ; \
|
||||||
echo "You cannot update a release tarball without a git tree. Please clone FreeSWITCH as so: " ; \
|
echo "You cannot update a release tarball without a git tree. Please clone FreeSWITCH as so: " ; \
|
||||||
echo " git clone https://freeswitch.org/stash/scm/fs/freeswitch.git " ; \
|
echo " git clone https://github.com/signalwire/freeswitch.git " ; \
|
||||||
echo "*****************************************************************************************************" ; \
|
echo "*****************************************************************************************************" ; \
|
||||||
echo ; echo ; \
|
echo ; echo ; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
# FreeSWITCH
|
||||||
|
|
||||||
|
FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device. Combined with our hosted cloud platform, SignalWire, FreeSWITCH can interconnect with the outside world and scale to any size.
|
||||||
|
|
||||||
|
Visit [https://signalwire.com](https://signalwire.com/) or https://github.com/signalwire for more info.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
FreeSWITCH is available on [Github](https://github.com/signalwire/freeswitch) in source code format. You can checkout the development branch and build for many poplular platforms including Linux, Windows, MacOSX and BSD. There is an issue tracker and pull request system available as part of the repo online.
|
||||||
|
|
||||||
|
See [https://freeswitch.com/#getting-started](https://freeswitch.com/#getting-started) for more detailed instructions.
|
||||||
|
|
||||||
|
## Additional Help
|
||||||
|
|
||||||
|
If you need assistance or have an interest in using a commercially supported build, you can contact coreteam@freeswitch.com to learn about professional services to support your project.
|
||||||
|
|
||||||
|
## Voice-over-IP services - SIP / SMS - App Integrations
|
||||||
|
|
||||||
|
[SignalWire](https://signalwire.com) is the primary sponsor of the FreeSWITCH project and was founded by the original developers of FreeSWITCH. SignalWire provides scalable services to enhance and scale your project such as SMS, SIP, Serverless Application hosting as well as programmable telecom. mod_signalwire which is distributed in this code base allows you to instantly pair with SignalWire and extend your FreeSWITCH.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
The main index for documentation is available at:
|
||||||
|
|
||||||
|
* https://freeswitch.org/confluence/
|
||||||
|
|
||||||
|
### Release notes:
|
||||||
|
|
||||||
|
* https://freeswitch.org/confluence/display/FREESWITCH/Release+Notes
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
Step by step tutorials to install FreeSWITCH from packages or source code are available at:
|
||||||
|
|
||||||
|
* [Debian 10 Buster](https://freeswitch.org/confluence/display/FREESWITCH/Debian+10+Buster) [<b>Recommended</b>]
|
||||||
|
* [Raspberry Pi](https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi)
|
||||||
|
* [CentOS 7](https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7)
|
||||||
|
|
||||||
|
## Downloads
|
||||||
|
|
||||||
|
* [Tarballs](https://files.freeswitch.org/releases/freeswitch/)
|
||||||
|
* [Windows Installer](http://files.freeswitch.org/windows/installer/x64/)
|
||||||
|
* [Windows Sound Packages](http://files.freeswitch.org/windows/installer/x64/sounds/)
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
|
GitHub pull requests are the recommended way to contribute to the FreeSWITCH source code:
|
||||||
|
|
||||||
|
* https://github.com/signalwire/freeswitch/pulls
|
||||||
|
|
||||||
|
## Community
|
||||||
|
|
||||||
|
Slack is our chat system where the developers, the FreeSWITCH team, and the most active users are present.
|
||||||
|
This is the place to get answers faster and chat with other users in real time. All you need to do is enter your email and verify it on the Slack signup page and you are ready to join in the discussion!
|
||||||
|
|
||||||
|
Slack Community:
|
||||||
|
* https://signalwire.community/
|
||||||
|
|
||||||
|
Mailing list:
|
||||||
|
|
||||||
|
* http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
|
||||||
|
|
||||||
|
**Thank you for using FreeSWITCH!**
|
|
@ -29,7 +29,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh
|
||||||
cd freeswitch.git && sh bootstrap.sh
|
cd freeswitch.git && sh bootstrap.sh
|
||||||
|
|
||||||
freeswitch.git/bootstrap.sh: has-git
|
freeswitch.git/bootstrap.sh: has-git
|
||||||
test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
|
test -d freeswitch.git || git clone https://github.com/signalwire/freeswitch.git freeswitch.git
|
||||||
|
|
||||||
install: freeswitch
|
install: freeswitch
|
||||||
cd freeswitch.git && make install cd-sounds-install cd-moh-install
|
cd freeswitch.git && make install cd-sounds-install cd-moh-install
|
||||||
|
|
|
@ -19,7 +19,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh
|
||||||
cd freeswitch.git && sh bootstrap.sh
|
cd freeswitch.git && sh bootstrap.sh
|
||||||
|
|
||||||
freeswitch.git/bootstrap.sh: has-git
|
freeswitch.git/bootstrap.sh: has-git
|
||||||
test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
|
test -d freeswitch.git || git clone https://github.com/signalwire/freeswitch.git freeswitch.git
|
||||||
|
|
||||||
rpmforge:
|
rpmforge:
|
||||||
(which rpm && rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm) || true
|
(which rpm && rpm -i http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm) || true
|
||||||
|
|
|
@ -24,7 +24,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh
|
||||||
cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize sh bootstrap.sh
|
cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize sh bootstrap.sh
|
||||||
|
|
||||||
freeswitch.git/bootstrap.sh: has-git
|
freeswitch.git/bootstrap.sh: has-git
|
||||||
test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
|
test -d freeswitch.git || git clone https://github.com/signalwire/freeswitch.git freeswitch.git
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize gmake install cd-sounds-install cd-moh-install
|
cd freeswitch.git && AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.14 LIBTOOL=/usr/local/bin/libtoolize gmake install cd-sounds-install cd-moh-install
|
||||||
|
|
|
@ -31,7 +31,7 @@ freeswitch.git/configure: freeswitch.git/bootstrap.sh
|
||||||
cd freeswitch.git && sh bootstrap.sh
|
cd freeswitch.git && sh bootstrap.sh
|
||||||
|
|
||||||
freeswitch.git/bootstrap.sh: has-git
|
freeswitch.git/bootstrap.sh: has-git
|
||||||
test -d freeswitch.git || git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
|
test -d freeswitch.git || git clone https://github.com/signalwire/freeswitch.git freeswitch.git
|
||||||
|
|
||||||
install: freeswitch
|
install: freeswitch
|
||||||
cd freeswitch.git && gmake install cd-sounds-install cd-moh-install
|
cd freeswitch.git && gmake install cd-sounds-install cd-moh-install
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1.10.1-dev
|
1.10.2-dev
|
||||||
|
|
|
@ -57,6 +57,10 @@
|
||||||
<param name="exchange-name" value="TAP.Commands"/>
|
<param name="exchange-name" value="TAP.Commands"/>
|
||||||
<param name="binding_key" value="commandBindingKey"/>
|
<param name="binding_key" value="commandBindingKey"/>
|
||||||
<param name="reconnect_interval_ms" value="1000"/>
|
<param name="reconnect_interval_ms" value="1000"/>
|
||||||
|
<param name="queue-passive" value="false"/>
|
||||||
|
<param name="queue-durable" value="false"/>
|
||||||
|
<param name="queue-exclusive" value="false"/>
|
||||||
|
<param name="queue-auto-delete" value="true"/>
|
||||||
</params>
|
</params>
|
||||||
</profile>
|
</profile>
|
||||||
</commands>
|
</commands>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<configuration name="msrp.conf" description="MSRP">
|
<configuration name="msrp.conf" description="MSRP">
|
||||||
<settings>
|
<settings>
|
||||||
<param name="listen-ip" value="$${local_ip_v4}"/>
|
<param name="listen-ip" value="$${local_ip_v4}"/>
|
||||||
<param name="listen-port" value="2855"/>
|
<!-- <param name="listen-port" value="2855"/> -->
|
||||||
<param name="listen-ssl-port" value="2856"/>
|
<!-- <param name="listen-ssl-port" value="2856"/> -->
|
||||||
<!-- <param name="message-buffer-size" value="50"/> -->
|
<!-- <param name="message-buffer-size" value="50"/> -->
|
||||||
<!-- <param name="debug" value="true"/> -->
|
<!-- <param name="debug" value="true"/> -->
|
||||||
<!-- <param name="secure-cert" value="$${certs_dir}/wss.pem"/> -->
|
<!-- <param name="secure-cert" value="$${certs_dir}/wss.pem"/> -->
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
# Must change all of the below together
|
# Must change all of the below together
|
||||||
# For a release, set revision for that tagged release as well and uncomment
|
# For a release, set revision for that tagged release as well and uncomment
|
||||||
AC_INIT([freeswitch], [1.10.1-dev], bugs@freeswitch.org)
|
AC_INIT([freeswitch], [1.10.2-dev], bugs@freeswitch.org)
|
||||||
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
|
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
|
||||||
AC_SUBST(SWITCH_VERSION_MINOR, [10])
|
AC_SUBST(SWITCH_VERSION_MINOR, [10])
|
||||||
AC_SUBST(SWITCH_VERSION_MICRO, [1-dev])
|
AC_SUBST(SWITCH_VERSION_MICRO, [2-dev])
|
||||||
AC_SUBST(SWITCH_VERSION_REVISION, [])
|
AC_SUBST(SWITCH_VERSION_REVISION, [])
|
||||||
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
|
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
|
||||||
|
|
||||||
|
@ -1052,14 +1052,17 @@ fi
|
||||||
CFLAGS="$saved_CFLAGS"
|
CFLAGS="$saved_CFLAGS"
|
||||||
|
|
||||||
if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
|
if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
|
||||||
|
saved_CFLAGS="$CFLAGS"
|
||||||
# Next check added for Xcode 5 and systems with clang 5 llvm 3.3 or above, extended offset must be off
|
# Next check added for Xcode 5 and systems with clang 5 llvm 3.3 or above, extended offset must be off
|
||||||
AC_CACHE_CHECK([whether compiler supports -Wextended-offsetof], [ac_cv_clang_extended_offsetof], [
|
AC_CACHE_CHECK([whether compiler supports -Wextended-offsetof], [ac_cv_clang_extended_offsetof], [
|
||||||
|
CFLAGS="$CFLAGS -Wno-extended-offsetof"
|
||||||
AC_TRY_COMPILE([],[return 0;],[ac_cv_clang_extended_offsetof=yes],[ac_cv_clang_extended_offsetof=no])
|
AC_TRY_COMPILE([],[return 0;],[ac_cv_clang_extended_offsetof=yes],[ac_cv_clang_extended_offsetof=no])
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT($ac_cv_clang_extended_offsetof)
|
AC_MSG_RESULT($ac_cv_clang_extended_offsetof)
|
||||||
if test x"$ac_cv_clang_extended_offsetof" = xyes; then
|
if test x"$ac_cv_clang_extended_offsetof" = xyes; then
|
||||||
APR_ADDTO(CFLAGS, -Wno-extended-offsetof)
|
APR_ADDTO(CFLAGS, -Wno-extended-offsetof)
|
||||||
fi
|
fi
|
||||||
|
CFLAGS="$saved_CFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready
|
# Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready
|
||||||
|
@ -1661,7 +1664,7 @@ if test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"; then
|
||||||
PHP=php
|
PHP=php
|
||||||
PHP_CONFIG=php-config
|
PHP_CONFIG=php-config
|
||||||
PHP_LDFLAGS="`$PHP_CONFIG --ldflags`"
|
PHP_LDFLAGS="`$PHP_CONFIG --ldflags`"
|
||||||
PHP_LIBS="`$PHP_CONFIG --libs | sed -r 's/ ?-l(bz2|pcre|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto)//g'`"
|
PHP_LIBS="`$PHP_CONFIG --libs | sed -r 's/ ?-l(bz2|pcre2-8|xml2|gssapi_krb5|krb5|k5crypto|com_err|history|z|readline|gmp|ssl|crypto|argon2|sodium)//g'`"
|
||||||
PHP_EXT_DIR="`$PHP_CONFIG --extension-dir`"
|
PHP_EXT_DIR="`$PHP_CONFIG --extension-dir`"
|
||||||
PHP_INC_DIR="`$PHP -r 'echo ini_get("include_path");' | cut -d: -f2`"
|
PHP_INC_DIR="`$PHP -r 'echo ini_get("include_path");' | cut -d: -f2`"
|
||||||
PHP_INI_DIR="`$PHP_CONFIG --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=`"
|
PHP_INI_DIR="`$PHP_CONFIG --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=`"
|
||||||
|
|
|
@ -18,7 +18,7 @@ of a FreeSWITCH git repository. You can achieve this with:
|
||||||
|
|
||||||
aptitude update && aptitude install -y git
|
aptitude update && aptitude install -y git
|
||||||
mkdir -p /usr/src/freeswitch
|
mkdir -p /usr/src/freeswitch
|
||||||
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git /usr/src/freeswitch/src
|
git clone https://github.com/signalwire/freeswitch.git /usr/src/freeswitch/src
|
||||||
cd /usr/src/freeswitch/src
|
cd /usr/src/freeswitch/src
|
||||||
|
|
||||||
Ensuring you have a clean build directory
|
Ensuring you have a clean build directory
|
||||||
|
|
|
@ -338,8 +338,8 @@ Build-Depends:
|
||||||
$(debian_wrap "${mod_build_depends}")
|
$(debian_wrap "${mod_build_depends}")
|
||||||
Standards-Version: 3.9.3
|
Standards-Version: 3.9.3
|
||||||
Homepage: https://freeswitch.org/
|
Homepage: https://freeswitch.org/
|
||||||
Vcs-Git: https://freeswitch.org/stash/scm/fs/freeswitch.git
|
Vcs-Git: https://github.com/signalwire/freeswitch.git
|
||||||
Vcs-Browser: https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse
|
Vcs-Browser: https://github.com/signalwire/freeswitch
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ The container exposes the following ports:
|
||||||
|
|
||||||
If you wish to help improve these please submit a pull request at:
|
If you wish to help improve these please submit a pull request at:
|
||||||
|
|
||||||
https://freeswitch.org/jira
|
https://github.com/signalwire/freeswitch
|
||||||
|
|
||||||
Thanks,
|
Thanks,
|
||||||
/b
|
/b
|
|
@ -85,7 +85,7 @@ apt-get install freeswitch-conf-vanilla
|
||||||
```
|
```
|
||||||
2) clone freeswitch repo
|
2) clone freeswitch repo
|
||||||
```sh
|
```sh
|
||||||
git clone https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse
|
git clone https://github.com/signalwire/freeswitch.git
|
||||||
```
|
```
|
||||||
3) execute ```make_min_archive.sh``` script
|
3) execute ```make_min_archive.sh``` script
|
||||||
```sh
|
```sh
|
||||||
|
@ -100,4 +100,4 @@ docker build -t freeswitch_custom .
|
||||||
Read more
|
Read more
|
||||||
---------
|
---------
|
||||||
|
|
||||||
[Dockerfile of official FreeSwitch container](https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse/docker/release)
|
[Dockerfile of official FreeSwitch container](https://github.com/signalwire/freeswitch/tree/master/docker/release)
|
||||||
|
|
|
@ -4,7 +4,7 @@ How to Contribute Patches to FreeSWITCH
|
||||||
Download the Source Code
|
Download the Source Code
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git
|
git clone https://github.com/signalwire/freeswitch.git
|
||||||
cd freeswitch
|
cd freeswitch
|
||||||
|
|
||||||
Ensure Git is Setup
|
Ensure Git is Setup
|
||||||
|
@ -42,18 +42,18 @@ Create a Pull Request
|
||||||
|
|
||||||
# create an account in JIRA and create a new issue
|
# create an account in JIRA and create a new issue
|
||||||
|
|
||||||
# navigate to FreeSWITCH Stash
|
# navigate to FreeSWITCH github
|
||||||
chromium https://freeswitch.org/stash
|
chromium https://github.com/signalwire/freeswitch
|
||||||
|
|
||||||
# Using the same credentials as Jira, login to Stash; create a forked FS repository; read
|
# Using your github credentials, login to github; create a forked FS repository; read
|
||||||
# the details here:
|
# the details here:
|
||||||
chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests
|
chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests
|
||||||
|
|
||||||
# add your repository as a remote (change to your username)
|
# add your repository as a remote (change to your username)
|
||||||
git remote add stash ssh://git@freeswitch.org:7999/~johndoe/freeswitch.git
|
git remote add fs git@github.com:signalwire/freeswitch.git
|
||||||
|
|
||||||
# push your changes to a branch
|
# push your changes to a branch
|
||||||
git push stash +HEAD:myfeature
|
git push fs +HEAD:myfeature
|
||||||
|
|
||||||
# create a pull request as described here:
|
# create a pull request as described here:
|
||||||
chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests
|
chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests
|
||||||
|
|
|
@ -35,6 +35,6 @@
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://freeswitch.org/stash/scm/fs/freeswitch.git"
|
"url": "https://github.com/signalwire/freeswitch.git"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -674,7 +674,7 @@ static void redisplay(void)
|
||||||
esl_mutex_lock(MUTEX);
|
esl_mutex_lock(MUTEX);
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBEDIT
|
#ifdef HAVE_LIBEDIT
|
||||||
#ifdef XHAVE_DECL_EL_REFRESH
|
#ifdef HAVE_DECL_EL_REFRESH
|
||||||
#ifdef HAVE_EL_WSET
|
#ifdef HAVE_EL_WSET
|
||||||
/* Current libedit versions don't implement EL_REFRESH in eln.c so
|
/* Current libedit versions don't implement EL_REFRESH in eln.c so
|
||||||
* use the wide version instead. */
|
* use the wide version instead. */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
* Version 3.0.2
|
* Version 3.0.12
|
||||||
*
|
*
|
||||||
* This file is not intended to be easily readable and contains a number of
|
* This file is not intended to be easily readable and contains a number of
|
||||||
* coding conventions designed to improve portability and efficiency. Do not make
|
* coding conventions designed to improve portability and efficiency. Do not make
|
||||||
|
|
|
@ -3,7 +3,7 @@ WRAP_GCC_WARNING_SILENCE=-Wno-unused-label -Wno-unused-function
|
||||||
all: ESL.so
|
all: ESL.so
|
||||||
|
|
||||||
esl_wrap.cpp:
|
esl_wrap.cpp:
|
||||||
swig3.0 -module ESL -php5 -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
|
swig3.0 -module ESL -php7 -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
|
||||||
sed -e 's/ char \*type_name;/ const char \*type_name;/' -i esl_wrap.cpp
|
sed -e 's/ char \*type_name;/ const char \*type_name;/' -i esl_wrap.cpp
|
||||||
|
|
||||||
esl_wrap.o: esl_wrap.cpp
|
esl_wrap.o: esl_wrap.cpp
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
* Version 3.0.2
|
* Version 3.0.12
|
||||||
*
|
*
|
||||||
* This file is not intended to be easily readable and contains a number of
|
* This file is not intended to be easily readable and contains a number of
|
||||||
* coding conventions designed to improve portability and efficiency. Do not make
|
* coding conventions designed to improve portability and efficiency. Do not make
|
||||||
|
@ -20,16 +20,6 @@ extern zend_module_entry ESL_module_entry;
|
||||||
# define PHP_ESL_API
|
# define PHP_ESL_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ZTS
|
|
||||||
#include "TSRM.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PHP_MINIT_FUNCTION(ESL);
|
|
||||||
PHP_MSHUTDOWN_FUNCTION(ESL);
|
|
||||||
PHP_RINIT_FUNCTION(ESL);
|
|
||||||
PHP_RSHUTDOWN_FUNCTION(ESL);
|
|
||||||
PHP_MINFO_FUNCTION(ESL);
|
|
||||||
|
|
||||||
ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_set);
|
ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_set);
|
||||||
ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_get);
|
ZEND_NAMED_FUNCTION(_wrap_ESLevent_event_get);
|
||||||
ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_set);
|
ZEND_NAMED_FUNCTION(_wrap_ESLevent_serialized_string_set);
|
||||||
|
@ -69,4 +59,6 @@ ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setAsyncExecute);
|
||||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setEventLock);
|
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_setEventLock);
|
||||||
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_disconnect);
|
ZEND_NAMED_FUNCTION(_wrap_ESLconnection_disconnect);
|
||||||
ZEND_NAMED_FUNCTION(_wrap_eslSetLogLevel);
|
ZEND_NAMED_FUNCTION(_wrap_eslSetLogLevel);
|
||||||
|
PHP_MINIT_FUNCTION(ESL);
|
||||||
|
|
||||||
#endif /* PHP_ESL_H */
|
#endif /* PHP_ESL_H */
|
||||||
|
|
|
@ -757,6 +757,18 @@ process_common_toolchain() {
|
||||||
tgt_isa=x86_64
|
tgt_isa=x86_64
|
||||||
tgt_os=darwin16
|
tgt_os=darwin16
|
||||||
;;
|
;;
|
||||||
|
*darwin17*)
|
||||||
|
tgt_isa=x86_64
|
||||||
|
tgt_os=darwin17
|
||||||
|
;;
|
||||||
|
*darwin18*)
|
||||||
|
tgt_isa=x86_64
|
||||||
|
tgt_os=darwin18
|
||||||
|
;;
|
||||||
|
*darwin19*)
|
||||||
|
tgt_isa=x86_64
|
||||||
|
tgt_os=darwin19
|
||||||
|
;;
|
||||||
x86_64*mingw32*)
|
x86_64*mingw32*)
|
||||||
tgt_os=win64
|
tgt_os=win64
|
||||||
;;
|
;;
|
||||||
|
@ -885,6 +897,18 @@ process_common_toolchain() {
|
||||||
add_cflags "-mmacosx-version-min=10.12"
|
add_cflags "-mmacosx-version-min=10.12"
|
||||||
add_ldflags "-mmacosx-version-min=10.12"
|
add_ldflags "-mmacosx-version-min=10.12"
|
||||||
;;
|
;;
|
||||||
|
*-darwin17-*)
|
||||||
|
add_cflags "-mmacosx-version-min=10.13"
|
||||||
|
add_ldflags "-mmacosx-version-min=10.13"
|
||||||
|
;;
|
||||||
|
*-darwin18-*)
|
||||||
|
add_cflags "-mmacosx-version-min=10.14"
|
||||||
|
add_ldflags "-mmacosx-version-min=10.14"
|
||||||
|
;;
|
||||||
|
*-darwin19-*)
|
||||||
|
add_cflags "-mmacosx-version-min=10.15"
|
||||||
|
add_ldflags "-mmacosx-version-min=10.15"
|
||||||
|
;;
|
||||||
*-iphonesimulator-*)
|
*-iphonesimulator-*)
|
||||||
add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
|
add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
|
||||||
add_ldflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
|
add_ldflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
|
||||||
|
|
|
@ -35,8 +35,8 @@ ARM_TARGETS="arm64-darwin-gcc
|
||||||
armv7s-darwin-gcc"
|
armv7s-darwin-gcc"
|
||||||
SIM_TARGETS="x86-iphonesimulator-gcc
|
SIM_TARGETS="x86-iphonesimulator-gcc
|
||||||
x86_64-iphonesimulator-gcc"
|
x86_64-iphonesimulator-gcc"
|
||||||
OSX_TARGETS="x86-darwin16-gcc
|
OSX_TARGETS="x86-darwin18-gcc
|
||||||
x86_64-darwin16-gcc"
|
x86_64-darwin18-gcc"
|
||||||
TARGETS="${ARM_TARGETS} ${SIM_TARGETS}"
|
TARGETS="${ARM_TARGETS} ${SIM_TARGETS}"
|
||||||
|
|
||||||
# Configures for the target specified by $1, and invokes make with the dist
|
# Configures for the target specified by $1, and invokes make with the dist
|
||||||
|
@ -271,7 +271,7 @@ cat << EOF
|
||||||
--help: Display this message and exit.
|
--help: Display this message and exit.
|
||||||
--enable-shared: Build a dynamic framework for use on iOS 8 or later.
|
--enable-shared: Build a dynamic framework for use on iOS 8 or later.
|
||||||
--extra-configure-args <args>: Extra args to pass when configuring libvpx.
|
--extra-configure-args <args>: Extra args to pass when configuring libvpx.
|
||||||
--macosx: Uses darwin16 targets instead of iphonesimulator targets for x86
|
--macosx: Uses darwin18 targets instead of iphonesimulator targets for x86
|
||||||
and x86_64. Allows linking to framework when builds target MacOSX
|
and x86_64. Allows linking to framework when builds target MacOSX
|
||||||
instead of iOS.
|
instead of iOS.
|
||||||
--preserve-build-output: Do not delete the build directory.
|
--preserve-build-output: Do not delete the build directory.
|
||||||
|
|
|
@ -129,6 +129,8 @@ all_platforms="${all_platforms} x86-darwin13-gcc"
|
||||||
all_platforms="${all_platforms} x86-darwin14-gcc"
|
all_platforms="${all_platforms} x86-darwin14-gcc"
|
||||||
all_platforms="${all_platforms} x86-darwin15-gcc"
|
all_platforms="${all_platforms} x86-darwin15-gcc"
|
||||||
all_platforms="${all_platforms} x86-darwin16-gcc"
|
all_platforms="${all_platforms} x86-darwin16-gcc"
|
||||||
|
all_platforms="${all_platforms} x86-darwin17-gcc"
|
||||||
|
all_platforms="${all_platforms} x86-darwin18-gcc"
|
||||||
all_platforms="${all_platforms} x86-iphonesimulator-gcc"
|
all_platforms="${all_platforms} x86-iphonesimulator-gcc"
|
||||||
all_platforms="${all_platforms} x86-linux-gcc"
|
all_platforms="${all_platforms} x86-linux-gcc"
|
||||||
all_platforms="${all_platforms} x86-linux-icc"
|
all_platforms="${all_platforms} x86-linux-icc"
|
||||||
|
@ -149,6 +151,9 @@ all_platforms="${all_platforms} x86_64-darwin13-gcc"
|
||||||
all_platforms="${all_platforms} x86_64-darwin14-gcc"
|
all_platforms="${all_platforms} x86_64-darwin14-gcc"
|
||||||
all_platforms="${all_platforms} x86_64-darwin15-gcc"
|
all_platforms="${all_platforms} x86_64-darwin15-gcc"
|
||||||
all_platforms="${all_platforms} x86_64-darwin16-gcc"
|
all_platforms="${all_platforms} x86_64-darwin16-gcc"
|
||||||
|
all_platforms="${all_platforms} x86_64-darwin17-gcc"
|
||||||
|
all_platforms="${all_platforms} x86_64-darwin18-gcc"
|
||||||
|
all_platforms="${all_platforms} x86_64-darwin19-gcc"
|
||||||
all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
|
all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
|
||||||
all_platforms="${all_platforms} x86_64-linux-gcc"
|
all_platforms="${all_platforms} x86_64-linux-gcc"
|
||||||
all_platforms="${all_platforms} x86_64-linux-icc"
|
all_platforms="${all_platforms} x86_64-linux-icc"
|
||||||
|
|
|
@ -119,6 +119,12 @@
|
||||||
*/
|
*/
|
||||||
#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN
|
#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN
|
||||||
|
|
||||||
|
#elif defined(__e2k__)
|
||||||
|
/*
|
||||||
|
* Elbrus, little endian
|
||||||
|
*/
|
||||||
|
#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN
|
||||||
|
|
||||||
#endif /* Automatic byte order detection */
|
#endif /* Automatic byte order detection */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Mon Aug 19 16:25:57 CDT 2019
|
Mon Sep 09 11:45:57 CDT 2019
|
||||||
|
|
|
@ -904,7 +904,7 @@ sres_sip_log_answers(sres_sip_t *srs,
|
||||||
SU_DEBUG_5(("srs(%p): %s IN CNAME %s\n", (void *)srs, domain, cname));
|
SU_DEBUG_5(("srs(%p): %s IN CNAME %s\n", (void *)srs, domain, cname));
|
||||||
}
|
}
|
||||||
#if SU_HAVE_IN6
|
#if SU_HAVE_IN6
|
||||||
else if (type == sres_type_cname) {
|
else if (type == sres_type_aaaa) {
|
||||||
sres_aaaa_record_t const *aaaa = sr->sr_aaaa;
|
sres_aaaa_record_t const *aaaa = sr->sr_aaaa;
|
||||||
su_inet_ntop(AF_INET6, &aaaa->aaaa_addr, addr, sizeof(addr));
|
su_inet_ntop(AF_INET6, &aaaa->aaaa_addr, addr, sizeof(addr));
|
||||||
SU_DEBUG_5(("srs(%p): %s IN AAAA %s\n", (void *)srs, domain, addr));
|
SU_DEBUG_5(("srs(%p): %s IN AAAA %s\n", (void *)srs, domain, addr));
|
||||||
|
|
|
@ -133,10 +133,10 @@ config_fs_repos() {
|
||||||
curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
|
curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
|
||||||
if [ "$FS_REV" = "master" ]; then
|
if [ "$FS_REV" = "master" ]; then
|
||||||
echo "deb http://files.freeswitch.org/repo/deb/debian-unstable/ jessie main" >/etc/apt/sources.list.d/freeswitch.list
|
echo "deb http://files.freeswitch.org/repo/deb/debian-unstable/ jessie main" >/etc/apt/sources.list.d/freeswitch.list
|
||||||
REPO="https://freeswitch.org/stash/scm/fs/freeswitch.git"
|
REPO="https://github.com/signalwire/freeswitch.git"
|
||||||
elif [ "$FS_REV" = "1.6" ]; then
|
elif [ "$FS_REV" = "1.6" ]; then
|
||||||
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
|
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
|
||||||
REPO="-b v1.6 https://silik0n@freeswitch.org/stash/scm/fs/freeswitch.git"
|
REPO="-b v1.6 https://github.com/signalwire/freeswitch.git"
|
||||||
fi
|
fi
|
||||||
apt-get update 2>&1 >/dev/null
|
apt-get update 2>&1 >/dev/null
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ apt-get update && apt-get install -y libtool libjpeg62-turbo-dev ntpdate libfree
|
||||||
|
|
||||||
cd /usr/src
|
cd /usr/src
|
||||||
|
|
||||||
git clone https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch.git
|
git clone https://github.com/signalwire/freeswitch.git freeswitch.git
|
||||||
|
|
||||||
cd freeswitch.git
|
cd freeswitch.git
|
||||||
|
|
||||||
|
|
|
@ -1424,6 +1424,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(_Out_ switch_hash_t *
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t **hash);
|
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t **hash);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Insert data into a hash and set flags so the value is automatically freed on delete
|
||||||
|
\param hash the hash to add data to
|
||||||
|
\param key the name of the key to add the data to
|
||||||
|
\param data the data to add
|
||||||
|
\return SWITCH_STATUS_SUCCESS if the data is added
|
||||||
|
\note the string key must be a constant or a dynamic string
|
||||||
|
*/
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t *hash, const char *key, const void *data);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Insert data into a hash
|
\brief Insert data into a hash
|
||||||
\param hash the hash to add data to
|
\param hash the hash to add data to
|
||||||
|
|
|
@ -1052,8 +1052,9 @@ SWITCH_DECLARE(int) switch_dial_handle_get_peers(switch_dial_handle_t *handle, i
|
||||||
SWITCH_DECLARE(int) switch_dial_handle_get_vars(switch_dial_handle_t *handle, int idx, switch_event_t **array, int max);
|
SWITCH_DECLARE(int) switch_dial_handle_get_vars(switch_dial_handle_t *handle, int idx, switch_event_t **array, int max);
|
||||||
SWITCH_DECLARE(switch_event_t *) switch_dial_handle_get_global_vars(switch_dial_handle_t *handle);
|
SWITCH_DECLARE(switch_event_t *) switch_dial_handle_get_global_vars(switch_dial_handle_t *handle);
|
||||||
SWITCH_DECLARE(switch_event_t *) switch_dial_leg_get_vars(switch_dial_leg_t *leg);
|
SWITCH_DECLARE(switch_event_t *) switch_dial_leg_get_vars(switch_dial_leg_t *leg);
|
||||||
|
SWITCH_DECLARE(const char *) switch_dial_leg_get_var(switch_dial_leg_t *leg, const char *key);
|
||||||
SWITCH_DECLARE(int) switch_dial_handle_get_total(switch_dial_handle_t *handle);
|
SWITCH_DECLARE(int) switch_dial_handle_get_total(switch_dial_handle_t *handle);
|
||||||
SWITCH_DECLARE(void) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh);
|
SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause);
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_session_t *session,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_session_t *session,
|
||||||
const char *prompt,
|
const char *prompt,
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
#define MSRP_LISTEN_PORT 2855
|
|
||||||
#define MSRP_SSL_LISTEN_PORT 2856
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSRP_ST_WAIT_HEADER,
|
MSRP_ST_WAIT_HEADER,
|
||||||
MSRP_ST_PARSE_HEADER,
|
MSRP_ST_PARSE_HEADER,
|
||||||
|
|
|
@ -387,7 +387,9 @@ typedef enum {
|
||||||
SCF_DIALPLAN_TIMESTAMPS = (1 << 24),
|
SCF_DIALPLAN_TIMESTAMPS = (1 << 24),
|
||||||
SCF_CPF_SOFT_PREFIX = (1 << 25),
|
SCF_CPF_SOFT_PREFIX = (1 << 25),
|
||||||
SCF_CPF_SOFT_LOOKUP = (1 << 26),
|
SCF_CPF_SOFT_LOOKUP = (1 << 26),
|
||||||
SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27)
|
SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY = (1 << 27),
|
||||||
|
SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE = (1 << 28),
|
||||||
|
SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON = (1 << 29)
|
||||||
} switch_core_flag_enum_t;
|
} switch_core_flag_enum_t;
|
||||||
typedef uint32_t switch_core_flag_t;
|
typedef uint32_t switch_core_flag_t;
|
||||||
|
|
||||||
|
@ -1935,7 +1937,8 @@ typedef enum {
|
||||||
SWITCH_FILE_NOMUX = (1 << 17),
|
SWITCH_FILE_NOMUX = (1 << 17),
|
||||||
SWITCH_FILE_BREAK_ON_CHANGE = (1 << 18),
|
SWITCH_FILE_BREAK_ON_CHANGE = (1 << 18),
|
||||||
SWITCH_FILE_FLAG_VIDEO = (1 << 19),
|
SWITCH_FILE_FLAG_VIDEO = (1 << 19),
|
||||||
SWITCH_FILE_FLAG_VIDEO_EOF = (1 << 20)
|
SWITCH_FILE_FLAG_VIDEO_EOF = (1 << 20),
|
||||||
|
SWITCH_FILE_PRE_CLOSED = (1 << 21)
|
||||||
} switch_file_flag_enum_t;
|
} switch_file_flag_enum_t;
|
||||||
typedef uint32_t switch_file_flag_t;
|
typedef uint32_t switch_file_flag_t;
|
||||||
|
|
||||||
|
|
|
@ -3663,9 +3663,12 @@ with. If we fail a setup up, then we go directly to a teardown mode. */
|
||||||
fct_ts__add_test( \
|
fct_ts__add_test( \
|
||||||
fctkern_ptr__->ns.ts_curr, fctkern_ptr__->ns.curr_test \
|
fctkern_ptr__->ns.ts_curr, fctkern_ptr__->ns.curr_test \
|
||||||
); \
|
); \
|
||||||
|
} else { \
|
||||||
|
fct_test__del(fctkern_ptr__->ns.curr_test); \
|
||||||
|
fctkern_ptr__->ns.curr_test = NULL; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
switch_assert("invalid condition for fct_req!"); \
|
switch_assert("invalid condition for fct_req!"); \
|
||||||
_fct_req((_CNDTN_)); \
|
_fct_req((_CNDTN_)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
|
||||||
switch_core_set_globals();
|
switch_core_set_globals();
|
||||||
|
|
||||||
if (!minimal) {
|
if (!minimal) {
|
||||||
status = switch_core_init_and_modload(0, SWITCH_TRUE, &err);
|
status = switch_core_init_and_modload(SCF_USE_SQL, SWITCH_TRUE, &err);
|
||||||
switch_sleep(1 * 1000000);
|
switch_sleep(1 * 1000000);
|
||||||
switch_core_set_variable("sound_prefix", "." SWITCH_PATH_SEPARATOR);
|
switch_core_set_variable("sound_prefix", "." SWITCH_PATH_SEPARATOR);
|
||||||
if (status != SWITCH_STATUS_SUCCESS && err) {
|
if (status != SWITCH_STATUS_SUCCESS && err) {
|
||||||
|
@ -308,7 +308,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
|
||||||
/**
|
/**
|
||||||
* Minimal FS core load
|
* Minimal FS core load
|
||||||
*/
|
*/
|
||||||
#define FST_MINCORE_BEGIN() \
|
#define FST_MINCORE_BEGIN(confdir) \
|
||||||
FCT_BGN() \
|
FCT_BGN() \
|
||||||
{ \
|
{ \
|
||||||
int fst_core = 0; \
|
int fst_core = 0; \
|
||||||
|
@ -317,7 +317,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
|
||||||
switch_memory_pool_t *fst_pool = NULL; \
|
switch_memory_pool_t *fst_pool = NULL; \
|
||||||
int fst_timer_started = 0; \
|
int fst_timer_started = 0; \
|
||||||
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
|
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
|
||||||
if (fst_init_core_and_modload(".", NULL, 1) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \
|
if (fst_init_core_and_modload(confdir, NULL, 1) == SWITCH_STATUS_SUCCESS) { /* minimal load */ \
|
||||||
fst_core = 1; \
|
fst_core = 1; \
|
||||||
} else { \
|
} else { \
|
||||||
fprintf(stderr, "Failed to load FS core\n"); \
|
fprintf(stderr, "Failed to load FS core\n"); \
|
||||||
|
|
|
@ -1836,15 +1836,13 @@ static char get_media_type_char(enum AVMediaType type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev,
|
static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev, void **index,
|
||||||
int encoder)
|
int encoder)
|
||||||
{
|
{
|
||||||
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,10,100))
|
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,10,100))
|
||||||
while ((prev = av_codec_next(prev))) {
|
while ((prev = av_codec_next(prev))) {
|
||||||
#else
|
#else
|
||||||
void *i;
|
while ((prev = av_codec_iterate(index))) {
|
||||||
|
|
||||||
while ((prev = av_codec_iterate(&i))) {
|
|
||||||
#endif
|
#endif
|
||||||
if (prev->id == id &&
|
if (prev->id == id &&
|
||||||
(encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev)))
|
(encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev)))
|
||||||
|
@ -1887,10 +1885,11 @@ static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs)
|
||||||
static void print_codecs_for_id(switch_stream_handle_t *stream, enum AVCodecID id, int encoder)
|
static void print_codecs_for_id(switch_stream_handle_t *stream, enum AVCodecID id, int encoder)
|
||||||
{
|
{
|
||||||
const AVCodec *codec = NULL;
|
const AVCodec *codec = NULL;
|
||||||
|
void *index = 0;
|
||||||
|
|
||||||
stream->write_function(stream, " (%s: ", encoder ? "encoders" : "decoders");
|
stream->write_function(stream, " (%s: ", encoder ? "encoders" : "decoders");
|
||||||
|
|
||||||
while ((codec = next_codec_for_id(id, codec, encoder))) {
|
while ((codec = next_codec_for_id(id, codec, &index, encoder))) {
|
||||||
stream->write_function(stream, "%s ", codec->name);
|
stream->write_function(stream, "%s ", codec->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1916,6 +1915,7 @@ void show_codecs(switch_stream_handle_t *stream)
|
||||||
for (i = 0; i < nb_codecs; i++) {
|
for (i = 0; i < nb_codecs; i++) {
|
||||||
const AVCodecDescriptor *desc = codecs[i];
|
const AVCodecDescriptor *desc = codecs[i];
|
||||||
const AVCodec *codec = NULL;
|
const AVCodec *codec = NULL;
|
||||||
|
void *index = 0;
|
||||||
|
|
||||||
stream->write_function(stream, " ");
|
stream->write_function(stream, " ");
|
||||||
stream->write_function(stream, avcodec_find_decoder(desc->id) ? "D" : ".");
|
stream->write_function(stream, avcodec_find_decoder(desc->id) ? "D" : ".");
|
||||||
|
@ -1930,14 +1930,14 @@ void show_codecs(switch_stream_handle_t *stream)
|
||||||
|
|
||||||
/* print decoders/encoders when there's more than one or their
|
/* print decoders/encoders when there's more than one or their
|
||||||
* names are different from codec name */
|
* names are different from codec name */
|
||||||
while ((codec = next_codec_for_id(desc->id, codec, 0))) {
|
while ((codec = next_codec_for_id(desc->id, codec, &index, 0))) {
|
||||||
if (strcmp(codec->name, desc->name)) {
|
if (strcmp(codec->name, desc->name)) {
|
||||||
print_codecs_for_id(stream ,desc->id, 0);
|
print_codecs_for_id(stream ,desc->id, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
codec = NULL;
|
codec = NULL; index = 0;
|
||||||
while ((codec = next_codec_for_id(desc->id, codec, 1))) {
|
while ((codec = next_codec_for_id(desc->id, codec, &index, 1))) {
|
||||||
if (strcmp(codec->name, desc->name)) {
|
if (strcmp(codec->name, desc->name)) {
|
||||||
print_codecs_for_id(stream, desc->id, 1);
|
print_codecs_for_id(stream, desc->id, 1);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1029,7 +1029,7 @@ void show_formats(switch_stream_handle_t *stream) {
|
||||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58,9,100))
|
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58,9,100))
|
||||||
while ((ofmt = av_oformat_next(ofmt))) {
|
while ((ofmt = av_oformat_next(ofmt))) {
|
||||||
#else
|
#else
|
||||||
void *i;
|
void *i = 0;
|
||||||
|
|
||||||
while ((ofmt = av_muxer_iterate(&i))) {
|
while ((ofmt = av_muxer_iterate(&i))) {
|
||||||
#endif
|
#endif
|
||||||
|
@ -1047,6 +1047,7 @@ void show_formats(switch_stream_handle_t *stream) {
|
||||||
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58,9,100))
|
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58,9,100))
|
||||||
while ((ifmt = av_iformat_next(ifmt))) {
|
while ((ifmt = av_iformat_next(ifmt))) {
|
||||||
#else
|
#else
|
||||||
|
i = 0;
|
||||||
while ((ifmt = av_demuxer_iterate(&i))) {
|
while ((ifmt = av_demuxer_iterate(&i))) {
|
||||||
#endif
|
#endif
|
||||||
is_dev = is_device(ifmt->priv_class);
|
is_dev = is_device(ifmt->priv_class);
|
||||||
|
|
|
@ -1403,6 +1403,7 @@ SWITCH_STANDARD_APP(avmd_start_app) {
|
||||||
avmd_session_t *avmd_session = NULL;
|
avmd_session_t *avmd_session = NULL;
|
||||||
switch_core_media_flag_t flags = 0;
|
switch_core_media_flag_t flags = 0;
|
||||||
const char *direction = "NO DIRECTION";
|
const char *direction = "NO DIRECTION";
|
||||||
|
uint8_t report = 0;
|
||||||
|
|
||||||
if (session == NULL) {
|
if (session == NULL) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "BUGGG. FreeSWITCH session is NULL! Please report to developers\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "BUGGG. FreeSWITCH session is NULL! Please report to developers\n");
|
||||||
|
@ -1447,6 +1448,8 @@ SWITCH_STANDARD_APP(avmd_start_app) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
report = avmd_session->settings.report_status;
|
||||||
|
|
||||||
status = init_avmd_session_data(avmd_session, session, avmd_globals.mutex);
|
status = init_avmd_session_data(avmd_session, session, avmd_globals.mutex);
|
||||||
if (status != SWITCH_STATUS_SUCCESS) {
|
if (status != SWITCH_STATUS_SUCCESS) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
|
@ -1508,7 +1511,10 @@ SWITCH_STANDARD_APP(avmd_start_app) {
|
||||||
status = switch_core_media_bug_add(session, "avmd", NULL, avmd_callback, avmd_session, 0, flags, &bug); /* Add a media bug that allows me to intercept the audio stream */
|
status = switch_core_media_bug_add(session, "avmd", NULL, avmd_callback, avmd_session, 0, flags, &bug); /* Add a media bug that allows me to intercept the audio stream */
|
||||||
if (status != SWITCH_STATUS_SUCCESS) { /* If adding a media bug fails exit */
|
if (status != SWITCH_STATUS_SUCCESS) { /* If adding a media bug fails exit */
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to add media bug!\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to add media bug!\n");
|
||||||
goto end_unlock;
|
|
||||||
|
switch_mutex_unlock(avmd_session->mutex);
|
||||||
|
avmd_session_close(avmd_session);
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_mutex_lock(avmd_globals.mutex);
|
switch_mutex_lock(avmd_globals.mutex);
|
||||||
|
@ -1526,7 +1532,7 @@ end_unlock:
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (status != SWITCH_STATUS_SUCCESS) {
|
if (status != SWITCH_STATUS_SUCCESS) {
|
||||||
if (avmd_session == NULL || avmd_session->settings.report_status == 1) {
|
if (avmd_session == NULL || report) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Avmd on channel [%s] NOT started\n", switch_channel_get_name(channel));
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Avmd on channel [%s] NOT started\n", switch_channel_get_name(channel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4010,7 +4010,7 @@ SWITCH_STANDARD_API(cc_break_api_function)
|
||||||
const char *uuid = NULL;
|
const char *uuid = NULL;
|
||||||
switch_core_session_t *break_session = NULL;
|
switch_core_session_t *break_session = NULL;
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
switch_bool_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
if (!zstr(cmd)) {
|
if (!zstr(cmd)) {
|
||||||
mydata = strdup(cmd);
|
mydata = strdup(cmd);
|
||||||
|
@ -4208,12 +4208,19 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load)
|
||||||
switch_json_api_interface_t *json_api_interface;
|
switch_json_api_interface_t *json_api_interface;
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
|
|
||||||
|
/* create/register custom event message type */
|
||||||
if (switch_event_reserve_subclass(CALLCENTER_EVENT) != SWITCH_STATUS_SUCCESS) {
|
if (switch_event_reserve_subclass(CALLCENTER_EVENT) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", CALLCENTER_EVENT);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", CALLCENTER_EVENT);
|
||||||
return SWITCH_STATUS_TERM;
|
return SWITCH_STATUS_TERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Subscribe to presence request events */
|
||||||
|
if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY,
|
||||||
|
cc_presence_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to subscribe for presence events!\n");
|
||||||
|
return SWITCH_STATUS_GENERR;
|
||||||
|
}
|
||||||
|
|
||||||
memset(&globals, 0, sizeof(globals));
|
memset(&globals, 0, sizeof(globals));
|
||||||
globals.pool = pool;
|
globals.pool = pool;
|
||||||
|
|
||||||
|
@ -4221,15 +4228,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load)
|
||||||
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
|
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
|
||||||
|
|
||||||
if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
|
if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_event_unbind(&globals.node);
|
||||||
|
switch_event_free_subclass(CALLCENTER_EVENT);
|
||||||
|
switch_core_hash_destroy(&globals.queue_hash);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY,
|
|
||||||
cc_presence_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to subscribe for presence events!\n");
|
|
||||||
return SWITCH_STATUS_GENERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_mutex_lock(globals.mutex);
|
switch_mutex_lock(globals.mutex);
|
||||||
globals.running = 1;
|
globals.running = 1;
|
||||||
switch_mutex_unlock(globals.mutex);
|
switch_mutex_unlock(globals.mutex);
|
||||||
|
@ -4242,7 +4246,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load)
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_ADD_APP(app_interface, "callcenter", "CallCenter", CC_DESC, callcenter_function, CC_USAGE, SAF_NONE);
|
SWITCH_ADD_APP(app_interface, "callcenter", "CallCenter", CC_DESC, callcenter_function, CC_USAGE, SAF_NONE);
|
||||||
SWITCH_ADD_APP(app_interface, "callcenter_track", "CallCenter Track Call", "Track external mod_callcenter calls to avoid place new calls", callcenter_track, CC_USAGE, SAF_NONE);
|
SWITCH_ADD_APP(app_interface, "callcenter_track", "CallCenter Track Call", "Track external mod_callcenter calls to avoid place new calls", callcenter_track, CC_USAGE, SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_API(api_interface, "callcenter_config", "Config of callcenter", cc_config_api_function, CC_CONFIG_API_SYNTAX);
|
SWITCH_ADD_API(api_interface, "callcenter_config", "Config of callcenter", cc_config_api_function, CC_CONFIG_API_SYNTAX);
|
||||||
SWITCH_ADD_API(api_interface, "callcenter_break", "Stop watching an uuid and release agent", cc_break_api_function, "callcenter_break agent <uuid>");
|
SWITCH_ADD_API(api_interface, "callcenter_break", "Stop watching an uuid and release agent", cc_break_api_function, "callcenter_break agent <uuid>");
|
||||||
|
|
||||||
|
|
|
@ -1193,7 +1193,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
|
||||||
|
|
||||||
member->last_score = member->score;
|
member->last_score = member->score;
|
||||||
|
|
||||||
if (member->id == member->conference->floor_holder) {
|
if ((switch_channel_test_flag(channel, CF_VIDEO) || member->avatar_png_img) && (member->id == member->conference->floor_holder)) {
|
||||||
if (member->id != member->conference->video_floor_holder &&
|
if (member->id != member->conference->video_floor_holder &&
|
||||||
(member->floor_packets > member->conference->video_floor_packets || member->energy_level == 0)) {
|
(member->floor_packets > member->conference->video_floor_packets || member->energy_level == 0)) {
|
||||||
conference_video_set_floor_holder(member->conference, member, SWITCH_FALSE);
|
conference_video_set_floor_holder(member->conference, member, SWITCH_FALSE);
|
||||||
|
|
|
@ -468,10 +468,10 @@ static switch_status_t load_config(switch_bool_t reload)
|
||||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||||
|
|
||||||
if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
|
if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
|
||||||
if (switch_database_available(val)) {
|
if (switch_database_available(val) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_set_string(globals.odbc_dsn, val);
|
switch_set_string(globals.odbc_dsn, val);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DATABASE IS NOT AVAILABLE!\n");
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(var, "dbname") && !zstr(val)) {
|
} else if (!strcasecmp(var, "dbname") && !zstr(val)) {
|
||||||
globals.dbname = switch_core_strdup(globals.pool, val);
|
globals.dbname = switch_core_strdup(globals.pool, val);
|
||||||
|
|
|
@ -4392,10 +4392,10 @@ static switch_status_t read_config_file(switch_xml_t *xml, switch_xml_t *cfg) {
|
||||||
if (!strcasecmp(var, "outbound-strategy") && !zstr(val)) {
|
if (!strcasecmp(var, "outbound-strategy") && !zstr(val)) {
|
||||||
globals.default_strategy = parse_strategy(val);
|
globals.default_strategy = parse_strategy(val);
|
||||||
} else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
|
} else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
|
||||||
if (switch_database_available(val)) {
|
if (switch_database_available(val) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_set_string(globals.odbc_dsn, val);
|
switch_set_string(globals.odbc_dsn, val);
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DATABASE IS NOT AVAILABLE!\n");
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(var, "dbname") && !zstr(val)) {
|
} else if (!strcasecmp(var, "dbname") && !zstr(val)) {
|
||||||
globals.dbname = switch_core_strdup(globals.pool, val);
|
globals.dbname = switch_core_strdup(globals.pool, val);
|
||||||
|
|
|
@ -3004,7 +3004,8 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *path,
|
||||||
handle->seekable = context->fh.seekable;
|
handle->seekable = context->fh.seekable;
|
||||||
handle->speed = context->fh.speed;
|
handle->speed = context->fh.speed;
|
||||||
handle->interval = context->fh.interval;
|
handle->interval = context->fh.interval;
|
||||||
handle->channels = context->fh.real_channels;
|
handle->channels = context->fh.channels;
|
||||||
|
handle->cur_channels = context->fh.real_channels;
|
||||||
handle->flags |= SWITCH_FILE_NOMUX;
|
handle->flags |= SWITCH_FILE_NOMUX;
|
||||||
|
|
||||||
if (switch_test_flag((&context->fh), SWITCH_FILE_NATIVE)) {
|
if (switch_test_flag((&context->fh), SWITCH_FILE_NATIVE)) {
|
||||||
|
|
|
@ -273,7 +273,7 @@ static void parse_domain(const char *url, char *domain_buf, int domain_buf_len)
|
||||||
if (!*start) {
|
if (!*start) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strncpy(domain_buf, start, domain_buf_len);
|
snprintf(domain_buf, domain_buf_len, "%s", start);
|
||||||
end = strchr(domain_buf, '/');
|
end = strchr(domain_buf, '/');
|
||||||
if (end) {
|
if (end) {
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
|
@ -985,7 +985,7 @@ static char *cached_url_filename_create(url_cache_t *cache, const char *url, cha
|
||||||
/* filename is constructed from UUID and is stored in cache dir (first 2 characters of UUID) */
|
/* filename is constructed from UUID and is stored in cache dir (first 2 characters of UUID) */
|
||||||
switch_uuid_get(&uuid);
|
switch_uuid_get(&uuid);
|
||||||
switch_uuid_format(uuid_str, &uuid);
|
switch_uuid_format(uuid_str, &uuid);
|
||||||
strncpy(uuid_dir, uuid_str, 2);
|
snprintf(uuid_dir, sizeof(uuid_dir), "%.2s", uuid_str);
|
||||||
dirname = switch_mprintf("%s%s%s", cache->location, SWITCH_PATH_SEPARATOR, uuid_dir);
|
dirname = switch_mprintf("%s%s%s", cache->location, SWITCH_PATH_SEPARATOR, uuid_dir);
|
||||||
|
|
||||||
/* create sub-directory if it doesn't exist */
|
/* create sub-directory if it doesn't exist */
|
||||||
|
@ -1754,6 +1754,7 @@ static switch_status_t http_cache_file_open(switch_file_handle_t *handle, const
|
||||||
handle->speed = context->fh.speed;
|
handle->speed = context->fh.speed;
|
||||||
handle->interval = context->fh.interval;
|
handle->interval = context->fh.interval;
|
||||||
handle->channels = context->fh.channels;
|
handle->channels = context->fh.channels;
|
||||||
|
handle->cur_channels = context->fh.real_channels;
|
||||||
handle->flags |= SWITCH_FILE_NOMUX;
|
handle->flags |= SWITCH_FILE_NOMUX;
|
||||||
handle->pre_buffer_datalen = 0;
|
handle->pre_buffer_datalen = 0;
|
||||||
|
|
||||||
|
|
|
@ -459,7 +459,7 @@ SWITCH_STANDARD_API(mod_signalwire_api_function)
|
||||||
" /____/_/\\__, /_/ /_/\\__,_/_/ |__/|__/_/_/ \\___/\n"
|
" /____/_/\\__, /_/ /_/\\__,_/_/ |__/|__/_/_/ \\___/\n"
|
||||||
" /____/\n"
|
" /____/\n"
|
||||||
"\n /=====================================================================\\\n"
|
"\n /=====================================================================\\\n"
|
||||||
"| Connection Token: %s |\n"
|
" Connection Token: %s\n"
|
||||||
" \\=====================================================================/\n"
|
" \\=====================================================================/\n"
|
||||||
" Go to https://signalwire.com to set up your Connector now!\n", globals.adoption_token);
|
" Go to https://signalwire.com to set up your Connector now!\n", globals.adoption_token);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -485,7 +485,7 @@ static void destroy_descriptor(void *ptr)
|
||||||
{
|
{
|
||||||
tone_descriptor_t *d = (tone_descriptor_t *) ptr;
|
tone_descriptor_t *d = (tone_descriptor_t *) ptr;
|
||||||
|
|
||||||
super_tone_rx_free_descriptor(d->spandsp_tone_descriptor);
|
tone_descriptor_destroy(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_status_t load_configuration(switch_bool_t reload)
|
switch_status_t load_configuration(switch_bool_t reload)
|
||||||
|
|
|
@ -133,6 +133,7 @@ typedef struct tone_descriptor tone_descriptor_t;
|
||||||
|
|
||||||
|
|
||||||
switch_status_t tone_descriptor_create(tone_descriptor_t **descriptor, const char *name, switch_memory_pool_t *memory_pool);
|
switch_status_t tone_descriptor_create(tone_descriptor_t **descriptor, const char *name, switch_memory_pool_t *memory_pool);
|
||||||
|
void tone_descriptor_destroy(tone_descriptor_t *descriptor);
|
||||||
int tone_descriptor_add_tone(tone_descriptor_t *descriptor, const char *name);
|
int tone_descriptor_add_tone(tone_descriptor_t *descriptor, const char *name);
|
||||||
switch_status_t tone_descriptor_add_tone_element(tone_descriptor_t *descriptor, int tone_id, int freq1, int freq2, int min, int max);
|
switch_status_t tone_descriptor_add_tone_element(tone_descriptor_t *descriptor, int tone_id, int freq1, int freq2, int min, int max);
|
||||||
|
|
||||||
|
|
|
@ -637,6 +637,20 @@ switch_status_t tone_descriptor_create(tone_descriptor_t **descriptor, const cha
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy the tone descriptor
|
||||||
|
*
|
||||||
|
* @param descriptor the descriptor to create
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void tone_descriptor_destroy(tone_descriptor_t *descriptor)
|
||||||
|
{
|
||||||
|
if (descriptor->spandsp_tone_descriptor) {
|
||||||
|
super_tone_rx_free_descriptor(descriptor->spandsp_tone_descriptor);
|
||||||
|
descriptor->spandsp_tone_descriptor = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a tone to the tone descriptor
|
* Add a tone to the tone descriptor
|
||||||
*
|
*
|
||||||
|
@ -711,6 +725,48 @@ static void tone_segment_callback(void *user_data, int f1, int f2, int duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duplicate the tone descriptor
|
||||||
|
*
|
||||||
|
* @param descriptor the descriptor to use
|
||||||
|
* @param memory_pool the pool to use
|
||||||
|
* @return pointer to a copy of descriptor
|
||||||
|
*/
|
||||||
|
static tone_descriptor_t *tone_descriptor_dup(tone_descriptor_t *descriptor, switch_memory_pool_t *pool)
|
||||||
|
{
|
||||||
|
tone_descriptor_t *desc = NULL;
|
||||||
|
int t = 0, s = 0, tone_count = 0;
|
||||||
|
|
||||||
|
if (descriptor && pool) {
|
||||||
|
if (tone_descriptor_create(&desc, descriptor->name, pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
tone_count = descriptor->idx + 1;
|
||||||
|
|
||||||
|
for (t = 0; t < tone_count; t++) {
|
||||||
|
int tone_id = tone_descriptor_add_tone(desc, descriptor->tone_keys[t]);
|
||||||
|
if (-1 != tone_id) {
|
||||||
|
int step = descriptor->spandsp_tone_descriptor->tone_segs[tone_id];
|
||||||
|
for (s = 0; s < step; s++) {
|
||||||
|
super_tone_rx_segment_t segment = descriptor->spandsp_tone_descriptor->tone_list[tone_id][s];
|
||||||
|
int f1 = (segment.f1 == -1 ? 0 : descriptor->spandsp_tone_descriptor->pitches[segment.f1][0]);
|
||||||
|
int f2 = (segment.f2 == -1 ? 0 : descriptor->spandsp_tone_descriptor->pitches[segment.f2][0]);
|
||||||
|
int min = segment.min_duration / 8;
|
||||||
|
int max = (segment.max_duration == 0x7FFFFFFF ? 0 : segment.max_duration / 8);
|
||||||
|
tone_descriptor_add_tone_element(desc, tone_id, f1, f2, min, max);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tone_descriptor_destroy(desc);
|
||||||
|
desc = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate the tone detector
|
* Allocate the tone detector
|
||||||
*
|
*
|
||||||
|
@ -723,11 +779,8 @@ static void tone_segment_callback(void *user_data, int f1, int f2, int duration)
|
||||||
static switch_status_t tone_detector_create(switch_core_session_t *session, tone_detector_t **detector, tone_descriptor_t *descriptor)
|
static switch_status_t tone_detector_create(switch_core_session_t *session, tone_detector_t **detector, tone_descriptor_t *descriptor)
|
||||||
{
|
{
|
||||||
tone_detector_t *ldetector = switch_core_session_alloc(session, sizeof(tone_detector_t));
|
tone_detector_t *ldetector = switch_core_session_alloc(session, sizeof(tone_detector_t));
|
||||||
tone_descriptor_t *desc = switch_core_session_alloc(session, sizeof(tone_descriptor_t));
|
|
||||||
|
|
||||||
memcpy(desc, descriptor, sizeof(tone_descriptor_t));
|
ldetector->descriptor = tone_descriptor_dup(descriptor, switch_core_session_get_pool(session));
|
||||||
|
|
||||||
ldetector->descriptor = desc;
|
|
||||||
ldetector->debug = spandsp_globals.tonedebug;
|
ldetector->debug = spandsp_globals.tonedebug;
|
||||||
ldetector->session = session;
|
ldetector->session = session;
|
||||||
*detector = ldetector;
|
*detector = ldetector;
|
||||||
|
@ -777,6 +830,10 @@ static void tone_detector_destroy(tone_detector_t *detector)
|
||||||
super_tone_rx_free(detector->spandsp_detector);
|
super_tone_rx_free(detector->spandsp_detector);
|
||||||
detector->spandsp_detector = NULL;
|
detector->spandsp_detector = NULL;
|
||||||
}
|
}
|
||||||
|
if (detector->descriptor) {
|
||||||
|
tone_descriptor_destroy(detector->descriptor);
|
||||||
|
detector->descriptor = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
include $(top_srcdir)/build/modmake.rulesam
|
include $(top_srcdir)/build/modmake.rulesam
|
||||||
MODNAME=mod_test
|
MODNAME=mod_test
|
||||||
|
|
||||||
|
noinst_LTLIBRARIES = libtestmod.la
|
||||||
|
libtestmod_la_SOURCES = mod_test.c
|
||||||
|
|
||||||
mod_LTLIBRARIES = mod_test.la
|
mod_LTLIBRARIES = mod_test.la
|
||||||
mod_test_la_SOURCES = mod_test.c
|
|
||||||
mod_test_la_CFLAGS = $(AM_CFLAGS)
|
mod_test_la_CFLAGS = $(AM_CFLAGS)
|
||||||
mod_test_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
mod_test_la_SOURCES =
|
||||||
mod_test_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
mod_test_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SOFIALA) libtestmod.la
|
||||||
|
mod_test_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
||||||
|
|
||||||
SUBDIRS=. test
|
SUBDIRS=. test
|
||||||
|
|
||||||
|
|
|
@ -257,8 +257,6 @@ static switch_status_t test_asr_get_results(switch_asr_handle_t *ah, char **resu
|
||||||
{
|
{
|
||||||
test_asr_t *context = (test_asr_t *) ah->private_info;
|
test_asr_t *context = (test_asr_t *) ah->private_info;
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
switch_stream_handle_t result = { 0 };
|
|
||||||
SWITCH_STANDARD_STREAM(result);
|
|
||||||
|
|
||||||
if (switch_test_flag(context, ASRFLAG_RETURNED_RESULT) || switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
if (switch_test_flag(context, ASRFLAG_RETURNED_RESULT) || switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
include $(top_srcdir)/build/modmake.rulesam
|
include $(top_srcdir)/build/modmake.rulesam
|
||||||
noinst_PROGRAMS = test_asr
|
noinst_PROGRAMS = test_asr
|
||||||
test_asr_CFLAGS = $(AM_CFLAGS) -I../
|
test_asr_CFLAGS = $(AM_CFLAGS) -I../
|
||||||
test_asr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) ../mod_test.la $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
test_asr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||||
|
test_asr_LDADD = ../libtestmod.la
|
||||||
TESTS = $(noinst_PROGRAMS)
|
TESTS = $(noinst_PROGRAMS)
|
||||||
|
|
|
@ -186,13 +186,17 @@ static switch_status_t tts_commandline_speech_read_tts(switch_speech_handle_t *s
|
||||||
assert(info != NULL);
|
assert(info != NULL);
|
||||||
|
|
||||||
if (switch_core_file_read(info->fh, data, &my_datalen) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_file_read(info->fh, data, &my_datalen) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_core_file_close(info->fh);
|
if (switch_test_flag(info->fh, SWITCH_FILE_OPEN)) {
|
||||||
|
switch_core_file_close(info->fh);
|
||||||
|
}
|
||||||
unlink(info->file);
|
unlink(info->file);
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
*datalen = my_datalen * 2;
|
*datalen = my_datalen * 2;
|
||||||
if (datalen == 0) {
|
if (datalen == 0) {
|
||||||
switch_core_file_close(info->fh);
|
if (switch_test_flag(info->fh, SWITCH_FILE_OPEN)) {
|
||||||
|
switch_core_file_close(info->fh);
|
||||||
|
}
|
||||||
unlink(info->file);
|
unlink(info->file);
|
||||||
return SWITCH_STATUS_BREAK;
|
return SWITCH_STATUS_BREAK;
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,7 +209,7 @@ static void tts_commandline_speech_flush_tts(switch_speech_handle_t *sh)
|
||||||
tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
|
tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
|
||||||
assert(info != NULL);
|
assert(info != NULL);
|
||||||
|
|
||||||
if (info->fh != NULL && info->fh->file_interface != NULL) {
|
if (info->fh != NULL && info->fh->file_interface != NULL && switch_test_flag(info->fh, SWITCH_FILE_OPEN)) {
|
||||||
switch_core_file_close(info->fh);
|
switch_core_file_close(info->fh);
|
||||||
}
|
}
|
||||||
if (switch_file_exists(info->file, NULL) == SWITCH_STATUS_SUCCESS) {
|
if (switch_file_exists(info->file, NULL) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
|
|
@ -360,7 +360,6 @@ switch_status_t sofia_on_destroy(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
char *uuid;
|
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA DESTROY\n", switch_channel_get_name(channel));
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA DESTROY\n", switch_channel_get_name(channel));
|
||||||
|
|
||||||
|
@ -376,13 +375,7 @@ switch_status_t sofia_on_destroy(switch_core_session_t *session)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zstr(tech_pvt->call_id)) {
|
if (!zstr(tech_pvt->call_id)) {
|
||||||
switch_mutex_lock(tech_pvt->profile->flag_mutex);
|
switch_core_hash_delete_locked(tech_pvt->profile->chat_hash, tech_pvt->call_id, tech_pvt->profile->flag_mutex);
|
||||||
if ((uuid = switch_core_hash_find(tech_pvt->profile->chat_hash, tech_pvt->call_id))) {
|
|
||||||
free(uuid);
|
|
||||||
uuid = NULL;
|
|
||||||
switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->call_id);
|
|
||||||
}
|
|
||||||
switch_mutex_unlock(tech_pvt->profile->flag_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -461,7 +454,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||||
switch_channel_get_name(channel), switch_channel_cause2str(cause));
|
switch_channel_get_name(channel), switch_channel_cause2str(cause));
|
||||||
|
|
||||||
if (tech_pvt->hash_key && !sofia_test_pflag(tech_pvt->profile, PFLAG_DESTROY)) {
|
if (tech_pvt->hash_key && !sofia_test_pflag(tech_pvt->profile, PFLAG_DESTROY)) {
|
||||||
switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->hash_key);
|
switch_core_hash_delete_locked(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt->profile->flag_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session && tech_pvt->profile->pres_type) {
|
if (session && tech_pvt->profile->pres_type) {
|
||||||
|
|
|
@ -821,8 +821,13 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
|
||||||
while ((call_info = call_info->ci_next) != NULL) {
|
while ((call_info = call_info->ci_next) != NULL) {
|
||||||
char *tmp = sip_header_as_string(nua_handle_home(nh), (void *) call_info);
|
char *tmp = sip_header_as_string(nua_handle_home(nh), (void *) call_info);
|
||||||
size_t tmp_len = strlen(tmp);
|
size_t tmp_len = strlen(tmp);
|
||||||
hold = realloc(hold, cur_len + tmp_len + 2);
|
char *tmp_hold = realloc(hold, cur_len + tmp_len + 2);
|
||||||
switch_assert(hold);
|
if (!tmp_hold) {
|
||||||
|
/* Avoid leak if realloc failed */
|
||||||
|
free(hold);
|
||||||
|
}
|
||||||
|
switch_assert(tmp_hold);
|
||||||
|
hold = tmp_hold;
|
||||||
strncpy(hold + cur_len, ",", 2);
|
strncpy(hold + cur_len, ",", 2);
|
||||||
strncpy(hold + cur_len + 1, tmp, tmp_len +1);
|
strncpy(hold + cur_len + 1, tmp, tmp_len +1);
|
||||||
su_free(nua_handle_home(nh), tmp);
|
su_free(nua_handle_home(nh), tmp);
|
||||||
|
@ -2430,7 +2435,7 @@ void sofia_event_callback(nua_event_t event,
|
||||||
tech_pvt->nh = NULL;
|
tech_pvt->nh = NULL;
|
||||||
sofia_set_flag(tech_pvt, TFLAG_BYE);
|
sofia_set_flag(tech_pvt, TFLAG_BYE);
|
||||||
switch_mutex_lock(profile->flag_mutex);
|
switch_mutex_lock(profile->flag_mutex);
|
||||||
switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session)));
|
switch_core_hash_insert_auto_free(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session)));
|
||||||
switch_mutex_unlock(profile->flag_mutex);
|
switch_mutex_unlock(profile->flag_mutex);
|
||||||
nua_handle_destroy(nh);
|
nua_handle_destroy(nh);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2519,10 +2524,11 @@ void sofia_event_callback(nua_event_t event,
|
||||||
|
|
||||||
|
|
||||||
if (sip->sip_call_id && sip->sip_call_id->i_id) {
|
if (sip->sip_call_id && sip->sip_call_id->i_id) {
|
||||||
char *uuid;
|
char *uuid = NULL, *tmp;
|
||||||
|
|
||||||
switch_mutex_lock(profile->flag_mutex);
|
switch_mutex_lock(profile->flag_mutex);
|
||||||
if ((uuid = (char *) switch_core_hash_find(profile->chat_hash, sip->sip_call_id->i_id))) {
|
if ((tmp = (char *) switch_core_hash_find(profile->chat_hash, sip->sip_call_id->i_id))) {
|
||||||
|
uuid = strdup(tmp);
|
||||||
switch_core_hash_delete(profile->chat_hash, sip->sip_call_id->i_id);
|
switch_core_hash_delete(profile->chat_hash, sip->sip_call_id->i_id);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(profile->flag_mutex);
|
switch_mutex_unlock(profile->flag_mutex);
|
||||||
|
@ -10125,6 +10131,7 @@ switch_status_t sofia_locate_user(char* user, switch_core_session_t *session, si
|
||||||
for (un = sip->sip_unknown; un; un = un->un_next) {
|
for (un = sip->sip_unknown; un; un = un->un_next) {
|
||||||
switch_event_add_header_string(v_event, SWITCH_STACK_BOTTOM, un->un_name, un->un_value);
|
switch_event_add_header_string(v_event, SWITCH_STACK_BOTTOM, un->un_name, un->un_value);
|
||||||
};
|
};
|
||||||
|
switch_channel_event_set_data(switch_core_session_get_channel(session), v_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = switch_xml_locate_user_merged("id", username, domain, NULL, x_user, v_event);
|
result = switch_xml_locate_user_merged("id", username, domain, NULL, x_user, v_event);
|
||||||
|
@ -11321,7 +11328,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
||||||
switch_channel_set_variable(channel, "sip_geolocation_error", un->un_value);
|
switch_channel_set_variable(channel, "sip_geolocation_error", un->un_value);
|
||||||
} else if (!strcasecmp(un->un_name, "userLocation")) {
|
} else if (!strcasecmp(un->un_name, "userLocation")) {
|
||||||
switch_channel_set_variable(channel, "sip_user_location", un->un_value);
|
switch_channel_set_variable(channel, "sip_user_location", un->un_value);
|
||||||
} else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2) || !strcasecmp(un->un_name, "User-to-User") || !strncasecmp(un->un_name, "On", 2)) {
|
} else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2) || !strcasecmp(un->un_name, "User-to-User") || !strncasecmp(un->un_name, "On", 2) || !strncasecmp(un->un_name, "K-", 2)) {
|
||||||
if (!zstr(un->un_value)) {
|
if (!zstr(un->un_value)) {
|
||||||
char new_name[512] = "";
|
char new_name[512] = "";
|
||||||
int reps = 0;
|
int reps = 0;
|
||||||
|
|
|
@ -852,7 +852,7 @@ char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char
|
||||||
|
|
||||||
stripped = sofia_glue_get_url_from_contact(stripped, 0);
|
stripped = sofia_glue_get_url_from_contact(stripped, 0);
|
||||||
|
|
||||||
/* remove our params so we don't make any whiny moronic device piss it's pants and forget who it is for a half-hour */
|
/* remove our params so we don't make any whiny moronic device piss its pants and forget who it is for a half-hour */
|
||||||
if ((p = (char *) switch_stristr(";fs_", stripped))) {
|
if ((p = (char *) switch_stristr(";fs_", stripped))) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
@ -5000,7 +5000,7 @@ void sofia_presence_handle_sip_i_message(int status,
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT) && (tech_pvt = (private_object_t *) switch_core_hash_find(profile->chat_hash, hash_key))) {
|
if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT) && (tech_pvt = (private_object_t *) switch_core_hash_find_locked(profile->chat_hash, hash_key, profile->flag_mutex))) {
|
||||||
switch_core_session_queue_event(tech_pvt->session, &event);
|
switch_core_session_queue_event(tech_pvt->session, &event);
|
||||||
} else {
|
} else {
|
||||||
switch_core_chat_send(proto, event);
|
switch_core_chat_send(proto, event);
|
||||||
|
|
|
@ -2929,7 +2929,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||||
if (switch_xml_locate_user_merged("id", zstr(username) ? "nobody" : username, domain_name, ip, &user, params) != SWITCH_STATUS_SUCCESS) {
|
if (switch_xml_locate_user_merged("id", zstr(username) ? "nobody" : username, domain_name, ip, &user, params) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s] from %s\n"
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s] from %s\n"
|
||||||
"You must define a domain called '%s' in your directory and add a user with the id=\"%s\" attribute\n"
|
"You must define a domain called '%s' in your directory and add a user with the id=\"%s\" attribute\n"
|
||||||
"and you must configure your device to use the proper domain in it's authentication credentials.\n", username, domain_name,
|
"and you must configure your device to use the proper domain in its authentication credentials.\n", username, domain_name,
|
||||||
ip, domain_name, username);
|
ip, domain_name, username);
|
||||||
|
|
||||||
ret = AUTH_FORBIDDEN;
|
ret = AUTH_FORBIDDEN;
|
||||||
|
@ -2937,7 +2937,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||||
} else {
|
} else {
|
||||||
const char *type = switch_xml_attr(user, "type");
|
const char *type = switch_xml_attr(user, "type");
|
||||||
if (type && !strcasecmp(type, "pointer")) {
|
if (type && !strcasecmp(type, "pointer")) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant register a pointer.\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't register a pointer.\n");
|
||||||
ret = AUTH_FORBIDDEN;
|
ret = AUTH_FORBIDDEN;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <test/switch_test.h>
|
#include <test/switch_test.h>
|
||||||
#include "../mod_sofia.c"
|
#include "../mod_sofia.c"
|
||||||
|
|
||||||
FST_MINCORE_BEGIN()
|
FST_MINCORE_BEGIN("./conf")
|
||||||
|
|
||||||
FST_SUITE_BEGIN(switch_hash)
|
FST_SUITE_BEGIN(switch_hash)
|
||||||
|
|
||||||
|
|
|
@ -1922,7 +1922,7 @@ static void client_run(jsock_t *jsock)
|
||||||
int rem = 0;
|
int rem = 0;
|
||||||
int dur = 0, j = 0;
|
int dur = 0, j = 0;
|
||||||
|
|
||||||
if (!(size = atoi(p))) {
|
if ((size = atoi(p)) <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,12 @@ typedef struct {
|
||||||
char *queue;
|
char *queue;
|
||||||
char *binding_key;
|
char *binding_key;
|
||||||
|
|
||||||
|
/* Queue properties */
|
||||||
|
switch_bool_t passive;
|
||||||
|
switch_bool_t durable;
|
||||||
|
switch_bool_t exclusive;
|
||||||
|
switch_bool_t auto_delete;
|
||||||
|
|
||||||
/* Note: The AMQP channel is not reentrant this MUTEX serializes sending events. */
|
/* Note: The AMQP channel is not reentrant this MUTEX serializes sending events. */
|
||||||
mod_amqp_connection_t *conn_root;
|
mod_amqp_connection_t *conn_root;
|
||||||
mod_amqp_connection_t *conn_active;
|
mod_amqp_connection_t *conn_active;
|
||||||
|
|
|
@ -121,6 +121,12 @@ switch_status_t mod_amqp_command_create(char *name, switch_xml_t cfg)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Default queue properties, set to match formerly hardcoded values */
|
||||||
|
profile->passive = SWITCH_FALSE;
|
||||||
|
profile->durable = SWITCH_FALSE;
|
||||||
|
profile->exclusive = SWITCH_FALSE;
|
||||||
|
profile->auto_delete = SWITCH_TRUE;
|
||||||
|
|
||||||
if ((params = switch_xml_child(cfg, "params")) != NULL) {
|
if ((params = switch_xml_child(cfg, "params")) != NULL) {
|
||||||
for (param = switch_xml_child(params, "param"); param; param = param->next) {
|
for (param = switch_xml_child(params, "param"); param; param = param->next) {
|
||||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||||
|
@ -147,6 +153,14 @@ switch_status_t mod_amqp_command_create(char *name, switch_xml_t cfg)
|
||||||
queue = mod_amqp_expand_header(profile->pool, event, val);
|
queue = mod_amqp_expand_header(profile->pool, event, val);
|
||||||
} else if (!strncmp(var, "binding_key", 11)) {
|
} else if (!strncmp(var, "binding_key", 11)) {
|
||||||
binding_key = mod_amqp_expand_header(profile->pool, event, val);
|
binding_key = mod_amqp_expand_header(profile->pool, event, val);
|
||||||
|
} else if (!strncmp(var, "queue-passive", 13)) {
|
||||||
|
profile->passive = switch_true(val);
|
||||||
|
} else if (!strncmp(var, "queue-durable", 13)) {
|
||||||
|
profile->durable = switch_true(val);
|
||||||
|
} else if (!strncmp(var, "queue-exclusive", 15)) {
|
||||||
|
profile->exclusive = switch_true(val);
|
||||||
|
} else if (!strncmp(var, "queue-auto-delete", 17)) {
|
||||||
|
profile->auto_delete = switch_true(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,8 +322,10 @@ void * SWITCH_THREAD_FUNC mod_amqp_command_thread(switch_thread_t *thread, void
|
||||||
recv_queue = amqp_queue_declare(profile->conn_active->state, // state
|
recv_queue = amqp_queue_declare(profile->conn_active->state, // state
|
||||||
1, // channel
|
1, // channel
|
||||||
profile->queue ? amqp_cstring_bytes(profile->queue) : amqp_empty_bytes, // queue name
|
profile->queue ? amqp_cstring_bytes(profile->queue) : amqp_empty_bytes, // queue name
|
||||||
0, 0, // passive, durable
|
profile->passive,
|
||||||
0, 1, // exclusive, auto-delete
|
profile->durable,
|
||||||
|
profile->exclusive,
|
||||||
|
profile->auto_delete,
|
||||||
amqp_empty_table); // args
|
amqp_empty_table); // args
|
||||||
|
|
||||||
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring queue\n")) {
|
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring queue\n")) {
|
||||||
|
|
|
@ -220,7 +220,7 @@ switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_
|
||||||
if (interval && interval > 0) {
|
if (interval && interval > 0) {
|
||||||
port = interval;
|
port = interval;
|
||||||
}
|
}
|
||||||
} else if (!strncmp(var, "heartbeat", 4)) {
|
} else if (!strncmp(var, "heartbeat", 9)) {
|
||||||
int interval = atoi(val);
|
int interval = atoi(val);
|
||||||
if (interval && interval > 0) {
|
if (interval && interval > 0) {
|
||||||
heartbeat = interval;
|
heartbeat = interval;
|
||||||
|
|
|
@ -238,34 +238,7 @@ switch_status_t mod_amqp_logging_create(char *name, switch_xml_t cfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
profile->conn_active = NULL;
|
profile->conn_active = NULL;
|
||||||
|
/* We are not going to open the logging queue connection on create, but instead wait for the running thread to open it */
|
||||||
if ( mod_amqp_connection_open(profile->conn_root, &(profile->conn_active), profile->name, profile->custom_attr) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] was unable to connect to any connection\n", profile->name);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR >= 6
|
|
||||||
amqp_exchange_declare(profile->conn_active->state, 1,
|
|
||||||
amqp_cstring_bytes(profile->exchange),
|
|
||||||
amqp_cstring_bytes(profile->exchange_type),
|
|
||||||
0, /* passive */
|
|
||||||
profile->exchange_durable,
|
|
||||||
profile->exchange_auto_delete,
|
|
||||||
0,
|
|
||||||
amqp_empty_table);
|
|
||||||
#else
|
|
||||||
amqp_exchange_declare(profile->conn_active->state, 1,
|
|
||||||
amqp_cstring_bytes(profile->exchange),
|
|
||||||
amqp_cstring_bytes(profile->exchange_type),
|
|
||||||
0, /* passive */
|
|
||||||
profile->exchange_durable,
|
|
||||||
amqp_empty_table);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring exchange")) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] failed to create exchange\n", profile->name);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a bounded FIFO queue for sending messages */
|
/* Create a bounded FIFO queue for sending messages */
|
||||||
if (switch_queue_create(&(profile->send_queue), profile->send_queue_size, profile->pool) != SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_create(&(profile->send_queue), profile->send_queue_size, profile->pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
|
|
@ -325,33 +325,7 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
profile->conn_active = NULL;
|
profile->conn_active = NULL;
|
||||||
|
/* We are not going to open the producer queue connection on create, but instead wait for the running thread to open it */
|
||||||
if ( mod_amqp_connection_open(profile->conn_root, &(profile->conn_active), profile->name, profile->custom_attr) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] was unable to connect to any connection\n", profile->name);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
#if AMQP_VERSION_MAJOR == 0 && AMQP_VERSION_MINOR >= 6
|
|
||||||
amqp_exchange_declare(profile->conn_active->state, 1,
|
|
||||||
amqp_cstring_bytes(profile->exchange),
|
|
||||||
amqp_cstring_bytes(profile->exchange_type),
|
|
||||||
0, /* passive */
|
|
||||||
profile->exchange_durable,
|
|
||||||
profile->exchange_auto_delete,
|
|
||||||
0,
|
|
||||||
amqp_empty_table);
|
|
||||||
#else
|
|
||||||
amqp_exchange_declare(profile->conn_active->state, 1,
|
|
||||||
amqp_cstring_bytes(profile->exchange),
|
|
||||||
amqp_cstring_bytes(profile->exchange_type),
|
|
||||||
0, /* passive */
|
|
||||||
profile->exchange_durable,
|
|
||||||
amqp_empty_table);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mod_amqp_log_if_amqp_error(amqp_get_rpc_reply(profile->conn_active->state), "Declaring exchange\n")) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile[%s] failed to create exchange\n", profile->name);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a bounded FIFO queue for sending messages */
|
/* Create a bounded FIFO queue for sending messages */
|
||||||
if (switch_queue_create(&(profile->send_queue), profile->send_queue_size, profile->pool) != SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_create(&(profile->send_queue), profile->send_queue_size, profile->pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
|
|
@ -324,7 +324,7 @@ static void event_handler(switch_event_t *event)
|
||||||
&tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC));
|
&tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC));
|
||||||
outlen += tmplen;
|
outlen += tmplen;
|
||||||
EVP_EncryptFinal(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen);
|
EVP_EncryptFinal(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen);
|
||||||
EVP_CIPHER_CTX_cleanup(ctx);
|
EVP_CIPHER_CTX_free(ctx);
|
||||||
#else
|
#else
|
||||||
EVP_CIPHER_CTX_init(&ctx);
|
EVP_CIPHER_CTX_init(&ctx);
|
||||||
EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
|
EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
|
||||||
|
@ -577,7 +577,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime)
|
||||||
EVP_DecryptInit(ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str);
|
EVP_DecryptInit(ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str);
|
||||||
EVP_DecryptUpdate(ctx, (unsigned char *) tmp, &outl, (unsigned char *) packet, (int) len);
|
EVP_DecryptUpdate(ctx, (unsigned char *) tmp, &outl, (unsigned char *) packet, (int) len);
|
||||||
EVP_DecryptFinal(ctx, (unsigned char *) tmp + outl, &tmplen);
|
EVP_DecryptFinal(ctx, (unsigned char *) tmp + outl, &tmplen);
|
||||||
EVP_CIPHER_CTX_cleanup(ctx);
|
EVP_CIPHER_CTX_free(ctx);
|
||||||
#else
|
#else
|
||||||
EVP_CIPHER_CTX_init(&ctx);
|
EVP_CIPHER_CTX_init(&ctx);
|
||||||
EVP_DecryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
|
EVP_DecryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
|
||||||
|
|
|
@ -375,6 +375,9 @@ static void event_handler(switch_event_t *event)
|
||||||
if (!uuid || (l->session && strcmp(uuid, switch_core_session_get_uuid(l->session)))) {
|
if (!uuid || (l->session && strcmp(uuid, switch_core_session_get_uuid(l->session)))) {
|
||||||
send = 0;
|
send = 0;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(switch_core_session_get_uuid(l->session), switch_event_get_header_nil(event, "Job-Owner-UUID"))) {
|
||||||
|
send = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (send) {
|
if (send) {
|
||||||
|
@ -1499,6 +1502,7 @@ struct api_command_struct {
|
||||||
listener_t *listener;
|
listener_t *listener;
|
||||||
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||||
int bg;
|
int bg;
|
||||||
|
char bg_owner_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||||
int ack;
|
int ack;
|
||||||
int console_execute;
|
int console_execute;
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
|
@ -1557,6 +1561,7 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
|
||||||
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_BACKGROUND_JOB) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_BACKGROUND_JOB) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-UUID", acs->uuid_str);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-UUID", acs->uuid_str);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Owner-UUID", acs->bg_owner_uuid_str);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command", acs->api_cmd);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command", acs->api_cmd);
|
||||||
if (acs->arg) {
|
if (acs->arg) {
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command-Arg", acs->arg);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command-Arg", acs->arg);
|
||||||
|
@ -2357,6 +2362,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
|
||||||
switch_uuid_get(&uuid);
|
switch_uuid_get(&uuid);
|
||||||
switch_uuid_format(acs->uuid_str, &uuid);
|
switch_uuid_format(acs->uuid_str, &uuid);
|
||||||
}
|
}
|
||||||
|
switch_copy_string(acs->bg_owner_uuid_str, switch_core_session_get_uuid(listener->session), sizeof(acs->bg_owner_uuid_str));
|
||||||
switch_snprintf(reply, reply_len, "~Reply-Text: +OK Job-UUID: %s\nJob-UUID: %s\n\n", acs->uuid_str, acs->uuid_str);
|
switch_snprintf(reply, reply_len, "~Reply-Text: +OK Job-UUID: %s\nJob-UUID: %s\n\n", acs->uuid_str, acs->uuid_str);
|
||||||
switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
|
switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
|
||||||
sanity = 2000;
|
sanity = 2000;
|
||||||
|
@ -2631,11 +2637,18 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
|
||||||
|
|
||||||
if ((session = listener->session)) {
|
if ((session = listener->session)) {
|
||||||
if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unable to lock session!\n");
|
||||||
locked = 0;
|
locked = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!listener->sock) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Listener socket is null!\n");
|
||||||
|
switch_clear_flag_locked(listener, LFLAG_RUNNING);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE);
|
switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE);
|
||||||
switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
|
switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
|
||||||
|
|
||||||
|
@ -2928,8 +2941,10 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
|
||||||
|
|
||||||
while (!prefs.done) {
|
while (!prefs.done) {
|
||||||
rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_UNSPEC, prefs.port, 0, pool);
|
rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_UNSPEC, prefs.port, 0, pool);
|
||||||
if (rv)
|
if (rv) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot get information about IP address %s\n", prefs.ip);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
rv = switch_socket_create(&listen_list.sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, pool);
|
rv = switch_socket_create(&listen_list.sock, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, pool);
|
||||||
if (rv)
|
if (rv)
|
||||||
goto sock_fail;
|
goto sock_fail;
|
||||||
|
|
|
@ -516,8 +516,9 @@ SWITCH_STANDARD_API(exec_api_cmd)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_cli_api(switch_loadable_module_interface_t **module_interface, switch_api_interface_t *api_interface)
|
void add_cli_api(switch_loadable_module_interface_t **module_interface)
|
||||||
{
|
{
|
||||||
|
switch_api_interface_t *api_interface = NULL;
|
||||||
SWITCH_ADD_API(api_interface, "erlang", KAZOO_DESC, exec_api_cmd, KAZOO_SYNTAX);
|
SWITCH_ADD_API(api_interface, "erlang", KAZOO_DESC, exec_api_cmd, KAZOO_SYNTAX);
|
||||||
switch_console_set_complete("add erlang status");
|
switch_console_set_complete("add erlang status");
|
||||||
switch_console_set_complete("add erlang event_filter");
|
switch_console_set_complete("add erlang event_filter");
|
||||||
|
|
|
@ -104,7 +104,8 @@ static void process_history_item(char* value, cJSON *json)
|
||||||
switch_safe_free(item);
|
switch_safe_free(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_STANDARD_API(kz_json_history) {
|
SWITCH_STANDARD_API(kz_json_history)
|
||||||
|
{
|
||||||
char *mycmd = NULL, *argv[MAX_HISTORY] = { 0 };
|
char *mycmd = NULL, *argv[MAX_HISTORY] = { 0 };
|
||||||
int n, argc = 0;
|
int n, argc = 0;
|
||||||
cJSON *json = cJSON_CreateObject();
|
cJSON *json = cJSON_CreateObject();
|
||||||
|
@ -145,7 +146,8 @@ SWITCH_STANDARD_API(kz_json_history) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_STANDARD_API(kz_first_of) {
|
SWITCH_STANDARD_API(kz_first_of)
|
||||||
|
{
|
||||||
char delim = '|';
|
char delim = '|';
|
||||||
char *mycmd = NULL, *argv[MAX_FIRST_OF] = { 0 };
|
char *mycmd = NULL, *argv[MAX_FIRST_OF] = { 0 };
|
||||||
int n, argc = 0;
|
int n, argc = 0;
|
||||||
|
@ -498,7 +500,20 @@ done:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_kz_commands(switch_loadable_module_interface_t **module_interface, switch_api_interface_t *api_interface) {
|
SWITCH_STANDARD_API(kz_expand_api)
|
||||||
|
{
|
||||||
|
if (!zstr(cmd)) {
|
||||||
|
char * val = kz_expand(cmd);
|
||||||
|
stream->write_function(stream, "+OK %s", val);
|
||||||
|
switch_safe_free(val);
|
||||||
|
} else {
|
||||||
|
stream->write_function(stream, "ERR invalid input");
|
||||||
|
}
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void add_kz_commands(switch_loadable_module_interface_t **module_interface) {
|
||||||
|
switch_api_interface_t *api_interface = NULL;
|
||||||
SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi", UUID_SET_DESC, uuid_setvar_multi_function, UUID_MULTISET_SYNTAX);
|
SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi", UUID_SET_DESC, uuid_setvar_multi_function, UUID_MULTISET_SYNTAX);
|
||||||
SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi_encoded", UUID_SET_DESC, uuid_setvar_multi_encoded_function, UUID_MULTISET_SYNTAX);
|
SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi_encoded", UUID_SET_DESC, uuid_setvar_multi_encoded_function, UUID_MULTISET_SYNTAX);
|
||||||
switch_console_set_complete("add kz_uuid_setvar_multi ::console::list_uuid");
|
switch_console_set_complete("add kz_uuid_setvar_multi ::console::list_uuid");
|
||||||
|
@ -510,5 +525,6 @@ void add_kz_commands(switch_loadable_module_interface_t **module_interface, swit
|
||||||
SWITCH_ADD_API(api_interface, "kz_http_put", KZ_HTTP_PUT_DESC, kz_http_put, KZ_HTTP_PUT_SYNTAX);
|
SWITCH_ADD_API(api_interface, "kz_http_put", KZ_HTTP_PUT_DESC, kz_http_put, KZ_HTTP_PUT_SYNTAX);
|
||||||
SWITCH_ADD_API(api_interface, "first-of", KZ_FIRST_OF_DESC, kz_first_of, KZ_FIRST_OF_SYNTAX);
|
SWITCH_ADD_API(api_interface, "first-of", KZ_FIRST_OF_DESC, kz_first_of, KZ_FIRST_OF_SYNTAX);
|
||||||
SWITCH_ADD_API(api_interface, "kz_json_history", KZ_FIRST_OF_DESC, kz_json_history, KZ_FIRST_OF_SYNTAX);
|
SWITCH_ADD_API(api_interface, "kz_json_history", KZ_FIRST_OF_DESC, kz_json_history, KZ_FIRST_OF_SYNTAX);
|
||||||
|
SWITCH_ADD_API(api_interface, "kz_expand", KZ_FIRST_OF_DESC, kz_expand_api, KZ_FIRST_OF_SYNTAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef KAZOO_DEFS_H_
|
||||||
|
#define KAZOO_DEFS_H_
|
||||||
|
|
||||||
|
#define INTERACTION_VARIABLE "Call-Interaction-ID"
|
||||||
|
|
||||||
|
#define UNIX_EPOCH_IN_GREGORIAN 62167219200
|
||||||
|
#define UNIX_EPOCH_IN_GREGORIAN_STR "62167219200"
|
||||||
|
|
||||||
|
#endif /* KAZOO_DEFS_H_ */
|
|
@ -891,7 +891,8 @@ SWITCH_STANDARD_APP(kz_att_xfer_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_kz_dptools(switch_loadable_module_interface_t **module_interface, switch_application_interface_t *app_interface) {
|
void add_kz_dptools(switch_loadable_module_interface_t **module_interface) {
|
||||||
|
switch_application_interface_t *app_interface = NULL;
|
||||||
SWITCH_ADD_APP(app_interface, "kz_set", SET_SHORT_DESC, SET_LONG_DESC, set_function, SET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
|
SWITCH_ADD_APP(app_interface, "kz_set", SET_SHORT_DESC, SET_LONG_DESC, set_function, SET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
|
||||||
SWITCH_ADD_APP(app_interface, "kz_set_encoded", SET_SHORT_DESC, SET_LONG_DESC, set_encoded_function, SET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
|
SWITCH_ADD_APP(app_interface, "kz_set_encoded", SET_SHORT_DESC, SET_LONG_DESC, set_encoded_function, SET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
|
||||||
SWITCH_ADD_APP(app_interface, "kz_multiset", MULTISET_SHORT_DESC, MULTISET_LONG_DESC, multiset_function, MULTISET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
|
SWITCH_ADD_APP(app_interface, "kz_multiset", MULTISET_SHORT_DESC, MULTISET_LONG_DESC, multiset_function, MULTISET_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#define VERSION "mod_kazoo v1.5.0-1 community"
|
#define VERSION "mod_kazoo v1.5.0-1 community"
|
||||||
|
|
||||||
#define KZ_MAX_SEPARATE_STRINGS 10
|
#define KZ_MAX_SEPARATE_STRINGS 10
|
||||||
|
#define HOSTNAME_MAX 1024
|
||||||
|
#define NODENAME_MAX 1024
|
||||||
|
|
||||||
typedef enum {KAZOO_FETCH_PROFILE, KAZOO_EVENT_PROFILE} kazoo_profile_type;
|
typedef enum {KAZOO_FETCH_PROFILE, KAZOO_EVENT_PROFILE} kazoo_profile_type;
|
||||||
|
|
||||||
|
@ -139,25 +141,7 @@ struct ei_xml_agent_s {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
struct kz_globals_s {
|
||||||
KZ_TWEAK_INTERACTION_ID,
|
|
||||||
KZ_TWEAK_EXPORT_VARS,
|
|
||||||
KZ_TWEAK_SWITCH_URI,
|
|
||||||
KZ_TWEAK_REPLACES_CALL_ID,
|
|
||||||
KZ_TWEAK_LOOPBACK_VARS,
|
|
||||||
KZ_TWEAK_CALLER_ID,
|
|
||||||
KZ_TWEAK_TRANSFERS,
|
|
||||||
KZ_TWEAK_BRIDGE,
|
|
||||||
KZ_TWEAK_BRIDGE_REPLACES_ALEG,
|
|
||||||
KZ_TWEAK_BRIDGE_REPLACES_CALL_ID,
|
|
||||||
KZ_TWEAK_BRIDGE_VARIABLES,
|
|
||||||
KZ_TWEAK_RESTORE_CALLER_ID_ON_BLIND_XFER,
|
|
||||||
|
|
||||||
/* No new flags below this line */
|
|
||||||
KZ_TWEAK_MAX
|
|
||||||
} kz_tweak_t;
|
|
||||||
|
|
||||||
struct globals_s {
|
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
switch_atomic_t threads;
|
switch_atomic_t threads;
|
||||||
switch_socket_t *acceptor;
|
switch_socket_t *acceptor;
|
||||||
|
@ -180,6 +164,7 @@ struct globals_s {
|
||||||
int ei_compat_rel;
|
int ei_compat_rel;
|
||||||
char *ip;
|
char *ip;
|
||||||
char *hostname;
|
char *hostname;
|
||||||
|
struct hostent* hostname_ent;
|
||||||
char *ei_cookie;
|
char *ei_cookie;
|
||||||
char *ei_nodename;
|
char *ei_nodename;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
@ -209,8 +194,8 @@ struct globals_s {
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
typedef struct globals_s globals_t;
|
typedef struct kz_globals_s kz_globals_t;
|
||||||
extern globals_t kazoo_globals;
|
extern kz_globals_t kazoo_globals;
|
||||||
|
|
||||||
/* kazoo_event_stream.c */
|
/* kazoo_event_stream.c */
|
||||||
ei_event_stream_t *find_event_stream(ei_event_stream_t *event_streams, const erlang_pid *from);
|
ei_event_stream_t *find_event_stream(ei_event_stream_t *event_streams, const erlang_pid *from);
|
||||||
|
@ -253,7 +238,7 @@ void fetch_config();
|
||||||
|
|
||||||
switch_status_t kazoo_load_config();
|
switch_status_t kazoo_load_config();
|
||||||
void kazoo_destroy_config();
|
void kazoo_destroy_config();
|
||||||
|
void kz_set_hostname();
|
||||||
|
|
||||||
#define _ei_x_encode_string(buf, string) { ei_x_encode_binary(buf, string, strlen(string)); }
|
#define _ei_x_encode_string(buf, string) { ei_x_encode_binary(buf, string, strlen(string)); }
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,19 @@ static int read_cookie_from_file(char *filename) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void kz_set_hostname()
|
||||||
|
{
|
||||||
|
if (kazoo_globals.hostname == NULL) {
|
||||||
|
char hostname[NODENAME_MAX];
|
||||||
|
memcpy(hostname, switch_core_get_hostname(), NODENAME_MAX);
|
||||||
|
kazoo_globals.hostname_ent = gethostbyname(hostname);
|
||||||
|
if(kazoo_globals.hostname_ent != NULL) {
|
||||||
|
kazoo_globals.hostname = switch_core_strdup(kazoo_globals.pool, kazoo_globals.hostname_ent->h_name);
|
||||||
|
} else {
|
||||||
|
kazoo_globals.hostname = switch_core_strdup(kazoo_globals.pool, hostname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch_status_t kazoo_ei_config(switch_xml_t cfg) {
|
switch_status_t kazoo_ei_config(switch_xml_t cfg) {
|
||||||
switch_xml_t child, param;
|
switch_xml_t child, param;
|
||||||
|
@ -211,11 +224,18 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((child = switch_xml_child(cfg, "tweaks"))) {
|
if ((child = switch_xml_child(cfg, "tweaks"))) {
|
||||||
|
char *default_tweaks = (char *) switch_xml_attr_soft(param, "default");
|
||||||
|
if (default_tweaks) {
|
||||||
|
int i, v = switch_true(default_tweaks) ? 1 : 0;
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set tweak default : %s\n", default_tweaks);
|
||||||
|
for (i = 0; i < KZ_TWEAK_MAX; i++) kazoo_globals.tweaks[i] = v;
|
||||||
|
}
|
||||||
for (param = switch_xml_child(child, "tweak"); param; param = param->next) {
|
for (param = switch_xml_child(child, "tweak"); param; param = param->next) {
|
||||||
kz_tweak_t tweak = KZ_TWEAK_MAX;
|
kz_tweak_t tweak = KZ_TWEAK_MAX;
|
||||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||||
if(var && val && kz_name_tweak(var, &tweak) == SWITCH_STATUS_SUCCESS) {
|
if(var && val && kz_name_tweak(var, &tweak) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set tweak %s : %s\n", var, val);
|
||||||
if(switch_true(val)) {
|
if(switch_true(val)) {
|
||||||
kz_set_tweak(tweak);
|
kz_set_tweak(tweak);
|
||||||
} else {
|
} else {
|
||||||
|
@ -230,6 +250,7 @@ switch_status_t kazoo_ei_config(switch_xml_t cfg) {
|
||||||
char *var = (char *) switch_xml_attr_soft(param, "name");
|
char *var = (char *) switch_xml_attr_soft(param, "name");
|
||||||
char *val = (char *) switch_xml_attr_soft(param, "value");
|
char *val = (char *) switch_xml_attr_soft(param, "value");
|
||||||
if(var && val) {
|
if(var && val) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Set core variable %s : %s\n", var, val);
|
||||||
switch_core_set_variable(var, val);
|
switch_core_set_variable(var, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,8 +332,6 @@ switch_socket_t *create_socket_with_port(switch_memory_pool_t *pool, switch_port
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_getnameinfo(&kazoo_globals.hostname, sa, 0);
|
|
||||||
|
|
||||||
if (kazoo_globals.nat_map && switch_nat_get_type()) {
|
if (kazoo_globals.nat_map && switch_nat_get_type()) {
|
||||||
switch_nat_add_mapping(port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE);
|
switch_nat_add_mapping(port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -347,10 +345,9 @@ switch_socket_t *create_socket(switch_memory_pool_t *pool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei_cnode_s *ei_cnode) {
|
switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei_cnode_s *ei_cnode) {
|
||||||
char hostname[EI_MAXHOSTNAMELEN + 1] = "";
|
char hostname[EI_MAXHOSTNAMELEN + 1];
|
||||||
char nodename[MAXNODELEN + 1];
|
char nodename[MAXNODELEN + 1];
|
||||||
char cnodename[EI_MAXALIVELEN + 1];
|
char cnodename[EI_MAXALIVELEN + 1];
|
||||||
//EI_MAX_COOKIE_SIZE+1
|
|
||||||
char *atsign;
|
char *atsign;
|
||||||
|
|
||||||
/* copy the erlang interface nodename into something we can modify */
|
/* copy the erlang interface nodename into something we can modify */
|
||||||
|
@ -358,17 +355,13 @@ switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei
|
||||||
|
|
||||||
if ((atsign = strchr(cnodename, '@'))) {
|
if ((atsign = strchr(cnodename, '@'))) {
|
||||||
/* we got a qualified node name, don't guess the host/domain */
|
/* we got a qualified node name, don't guess the host/domain */
|
||||||
snprintf(nodename, MAXNODELEN + 1, "%s", kazoo_globals.ei_nodename);
|
snprintf(nodename, MAXNODELEN + 1, "%s", name);
|
||||||
/* truncate the alivename at the @ */
|
/* truncate the alivename at the @ */
|
||||||
*atsign = '\0';
|
*atsign++ = '\0';
|
||||||
|
strncpy(hostname, atsign, EI_MAXHOSTNAMELEN);
|
||||||
} else {
|
} else {
|
||||||
if (zstr(kazoo_globals.hostname) || !strncasecmp(kazoo_globals.ip, "0.0.0.0", 7) || !strncasecmp(kazoo_globals.ip, "::", 2)) {
|
strncpy(hostname, kazoo_globals.hostname, EI_MAXHOSTNAMELEN);
|
||||||
memcpy(hostname, switch_core_get_hostname(), EI_MAXHOSTNAMELEN);
|
snprintf(nodename, MAXNODELEN + 1, "%s@%s", name, hostname);
|
||||||
} else {
|
|
||||||
memcpy(hostname, kazoo_globals.hostname, EI_MAXHOSTNAMELEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(nodename, MAXNODELEN + 1, "%s@%s", kazoo_globals.ei_nodename, hostname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kazoo_globals.ei_shortname) {
|
if (kazoo_globals.ei_shortname) {
|
||||||
|
@ -378,6 +371,8 @@ switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "creating nodename: %s\n", nodename);
|
||||||
|
|
||||||
/* init the ec stuff */
|
/* init the ec stuff */
|
||||||
if (ei_connect_xinit(ei_cnode, hostname, cnodename, nodename, (Erl_IpAddr) ip_addr, kazoo_globals.ei_cookie, 0) < 0) {
|
if (ei_connect_xinit(ei_cnode, hostname, cnodename, nodename, (Erl_IpAddr) ip_addr, kazoo_globals.ei_cookie, 0) < 0) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to initialize the erlang interface connection structure\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to initialize the erlang interface connection structure\n");
|
||||||
|
@ -866,7 +861,8 @@ static void fetch_config_filters(switch_memory_pool_t *pool)
|
||||||
|
|
||||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) {
|
if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open configuration file %s\n", cf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open configuration file %s\n", cf);
|
||||||
} else if ((child = switch_xml_child(cfg, "event-filter"))) {
|
} else {
|
||||||
|
if ((child = switch_xml_child(cfg, "event-filter"))) {
|
||||||
switch_hash_t *filter;
|
switch_hash_t *filter;
|
||||||
switch_hash_t *old_filter;
|
switch_hash_t *old_filter;
|
||||||
|
|
||||||
|
@ -881,9 +877,10 @@ static void fetch_config_filters(switch_memory_pool_t *pool)
|
||||||
if (old_filter) {
|
if (old_filter) {
|
||||||
switch_core_hash_destroy(&old_filter);
|
switch_core_hash_destroy(&old_filter);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
kazoo_globals.config_fetched = 1;
|
kazoo_globals.config_fetched = 1;
|
||||||
switch_xml_free(xml);
|
switch_xml_free(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,34 +32,75 @@
|
||||||
*/
|
*/
|
||||||
#include "mod_kazoo.h"
|
#include "mod_kazoo.h"
|
||||||
|
|
||||||
|
#define INTERACTION_VARIABLE "Call-Interaction-ID"
|
||||||
|
|
||||||
|
static const char *x_bridge_variables[] = {
|
||||||
|
"Call-Control-Queue",
|
||||||
|
"Call-Control-PID",
|
||||||
|
"Call-Control-Node",
|
||||||
|
INTERACTION_VARIABLE,
|
||||||
|
"ecallmgr_Ecallmgr-Node",
|
||||||
|
"sip_h_k-cid",
|
||||||
|
"Switch-URI",
|
||||||
|
"Switch-URL",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static void kz_tweaks_variables_to_event(switch_core_session_t *session, switch_event_t *event)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
for(i = 0; x_bridge_variables[i] != NULL; i++) {
|
||||||
|
const char *val = switch_channel_get_variable_dup(channel, x_bridge_variables[i], SWITCH_FALSE, -1);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, x_bridge_variables[i], val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* kazoo endpoint */
|
/* kazoo endpoint */
|
||||||
switch_endpoint_interface_t *kz_endpoint_interface;
|
switch_endpoint_interface_t *kz_endpoint_interface;
|
||||||
static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *session,
|
static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *session,
|
||||||
switch_event_t *var_event,
|
switch_event_t *var_event,
|
||||||
switch_caller_profile_t *outbound_profile,
|
switch_caller_profile_t *outbound_profile,
|
||||||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
|
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 *cancel_cause);
|
||||||
switch_io_routines_t kz_endpoint_io_routines = {
|
switch_io_routines_t kz_endpoint_io_routines = {
|
||||||
/*.outgoing_channel */ kz_endpoint_outgoing_channel
|
/*.outgoing_channel */ kz_endpoint_outgoing_channel
|
||||||
};
|
};
|
||||||
|
|
||||||
static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *session,
|
static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *session,
|
||||||
switch_event_t *var_event,
|
switch_event_t *var_event,
|
||||||
switch_caller_profile_t *outbound_profile,
|
switch_caller_profile_t *outbound_profile,
|
||||||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
|
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 *cancel_cause)
|
||||||
{
|
{
|
||||||
switch_xml_t x_user = NULL, x_param, x_params;
|
switch_xml_t x_user = NULL, x_param, x_params, x_callfwd;
|
||||||
char *user = NULL, *domain = NULL, *dup_domain = NULL, *dialed_user = NULL;
|
char *user = NULL, *domain = NULL, *dup_domain = NULL, *dialed_user = NULL;
|
||||||
const char *dest = NULL;
|
char *dest = NULL;
|
||||||
switch_call_cause_t cause = SWITCH_CAUSE_NONE;
|
switch_call_cause_t cause = SWITCH_CAUSE_NONE;
|
||||||
unsigned int timelimit = SWITCH_DEFAULT_TIMEOUT;
|
unsigned int timelimit = SWITCH_DEFAULT_TIMEOUT;
|
||||||
switch_channel_t *new_channel = NULL;
|
switch_channel_t *new_channel = NULL;
|
||||||
switch_event_t *params = NULL, *var_event_orig = var_event;
|
switch_event_t *params = NULL, *var_event_orig = var_event;
|
||||||
char stupid[128] = "";
|
char stupid[128] = "";
|
||||||
const char *skip = NULL, *var = NULL;
|
const char *skip = NULL, *var = NULL;
|
||||||
|
switch_core_session_t *a_session = NULL, *e_session = NULL;
|
||||||
|
cJSON * ctx = NULL;
|
||||||
|
const char *endpoint_dial = NULL;
|
||||||
|
const char *callforward_dial = NULL;
|
||||||
|
const char *failover_dial = NULL;
|
||||||
|
char *b_failover_dial = NULL;
|
||||||
|
const char *endpoint_separator = NULL;
|
||||||
|
const char *varval = NULL;
|
||||||
|
char *d_dest = NULL;
|
||||||
|
switch_channel_t *channel = NULL;
|
||||||
|
switch_originate_flag_t myflags = SOF_NONE;
|
||||||
|
char *cid_name_override = NULL;
|
||||||
|
char *cid_num_override = NULL;
|
||||||
|
switch_event_t *event = NULL;
|
||||||
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
|
||||||
if (zstr(outbound_profile->destination_number)) {
|
if (zstr(outbound_profile->destination_number)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "NO DESTINATION NUMBER\n");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +125,9 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s
|
||||||
switch_assert(params);
|
switch_assert(params);
|
||||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "as_channel", "true");
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "as_channel", "true");
|
||||||
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "user_call");
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "user_call");
|
||||||
|
if (session) {
|
||||||
|
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));
|
||||||
|
}
|
||||||
|
|
||||||
if (var_event) {
|
if (var_event) {
|
||||||
switch_event_merge(params, var_event);
|
switch_event_merge(params, var_event);
|
||||||
|
@ -102,162 +146,308 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (var_event) {
|
||||||
|
const char * str_ctx = switch_event_get_header(var_event, "kz-endpoint-runtime-context");
|
||||||
|
if ( str_ctx ) {
|
||||||
|
ctx = cJSON_Parse(str_ctx);
|
||||||
|
if (ctx) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "call context parsed => %s\n", str_ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((x_params = switch_xml_child(x_user, "variables"))) {
|
||||||
|
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
|
||||||
|
const char *pvar = switch_xml_attr_soft(x_param, "name");
|
||||||
|
const char *val = switch_xml_attr(x_param, "value");
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding variable to var_event => %s = %s\n", pvar, val);
|
||||||
|
if (!var_event) {
|
||||||
|
switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
|
||||||
|
} else {
|
||||||
|
switch_event_del_header(var_event, pvar);
|
||||||
|
}
|
||||||
|
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((x_params = switch_xml_child(x_user, "params"))) {
|
if ((x_params = switch_xml_child(x_user, "params"))) {
|
||||||
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
|
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
|
||||||
const char *pvar = switch_xml_attr_soft(x_param, "name");
|
const char *pvar = switch_xml_attr_soft(x_param, "name");
|
||||||
const char *val = switch_xml_attr(x_param, "value");
|
const char *val = switch_xml_attr(x_param, "value");
|
||||||
|
|
||||||
if (!strcasecmp(pvar, "dial-string")) {
|
if (!strcasecmp(pvar, "endpoint-dial-string")) {
|
||||||
dest = val;
|
endpoint_dial = val;
|
||||||
|
} else if (!strcasecmp(pvar, "callforward-dial-string")) {
|
||||||
|
callforward_dial = val;
|
||||||
|
} else if (!strcasecmp(pvar, "endpoint-separator")) {
|
||||||
|
endpoint_separator = val;
|
||||||
} else if (!strncasecmp(pvar, "dial-var-", 9)) {
|
} else if (!strncasecmp(pvar, "dial-var-", 9)) {
|
||||||
if (!var_event) {
|
if (!var_event) {
|
||||||
switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
|
switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
|
||||||
} else {
|
} else {
|
||||||
switch_event_del_header(var_event, pvar + 9);
|
switch_event_del_header(var_event, pvar + 9);
|
||||||
}
|
}
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "adding variable to var_event => %s = %s\n", pvar + 9, val);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding dialog var to var_event => %s = %s\n", pvar + 9, val);
|
||||||
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
|
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x_callfwd = switch_xml_child(x_user, "call-forward");
|
||||||
|
if (x_callfwd) {
|
||||||
|
switch_bool_t call_fwd_is_substitute = SWITCH_FALSE,
|
||||||
|
call_fwd_is_failover = SWITCH_FALSE,
|
||||||
|
call_fwd_direct_calls_only = SWITCH_FALSE,
|
||||||
|
call_fwd_is_valid = SWITCH_TRUE;
|
||||||
|
for (x_param = switch_xml_child(x_callfwd, "variable"); x_param; x_param = x_param->next) {
|
||||||
|
const char *var = switch_xml_attr_soft(x_param, "name");
|
||||||
|
const char *val = switch_xml_attr(x_param, "value");
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "cfw %s => %s\n", var, val);
|
||||||
|
if (!strcasecmp(var, "Is-Substitute")) {
|
||||||
|
call_fwd_is_substitute = switch_true(val);
|
||||||
|
} else if (!strcasecmp(var, "Is-Failover")) {
|
||||||
|
call_fwd_is_failover = switch_true(val);
|
||||||
|
} else if (!strcasecmp(var, "Direct-Calls-Only")) {
|
||||||
|
call_fwd_direct_calls_only = switch_true(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (call_fwd_direct_calls_only) {
|
||||||
|
call_fwd_is_valid = SWITCH_FALSE;
|
||||||
|
if (ctx ) {
|
||||||
|
cJSON *json_flags = cJSON_GetObjectItem(ctx, "Flags");
|
||||||
|
if (json_flags && json_flags->type == cJSON_Array) {
|
||||||
|
cJSON *item;
|
||||||
|
cJSON_ArrayForEach(item, json_flags) {
|
||||||
|
if (!strcmp(item->valuestring, "direct_call")) {
|
||||||
|
call_fwd_is_valid = SWITCH_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!call_fwd_is_valid) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "call fwd requires direct_call and it was not found\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!call_fwd_is_valid) {
|
||||||
|
dest = strdup(endpoint_dial);
|
||||||
|
} else if (call_fwd_is_failover) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting failover => %s\n", callforward_dial);
|
||||||
|
dest = strdup(endpoint_dial);
|
||||||
|
failover_dial = callforward_dial;
|
||||||
|
} else if (call_fwd_is_substitute) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd substitute => %s\n", callforward_dial);
|
||||||
|
dest = strdup(callforward_dial);
|
||||||
|
} else {
|
||||||
|
dest = switch_mprintf("%s%s%s", endpoint_dial ? endpoint_dial : "", (endpoint_dial ? endpoint_separator ? endpoint_separator : "," : ""), callforward_dial);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "setting call fwd append => %s => %s\n", callforward_dial, dest);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dest = strdup(endpoint_dial);
|
||||||
|
}
|
||||||
|
|
||||||
dialed_user = (char *)switch_xml_attr(x_user, "id");
|
dialed_user = (char *)switch_xml_attr(x_user, "id");
|
||||||
|
|
||||||
if (var_event) {
|
if (var_event) {
|
||||||
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_user", dialed_user);
|
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_user", dialed_user);
|
||||||
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
|
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
|
||||||
if (!zstr(dest) && !strstr(dest, "presence_id=")) {
|
|
||||||
switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, "presence_id", "%s@%s", dialed_user, domain);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dest) {
|
if (!dest) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No dial-string available, please check your user directory.\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No dial-string available, please check your user directory.\n");
|
||||||
cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
|
cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
|
||||||
} else {
|
goto done;
|
||||||
const char *varval;
|
}
|
||||||
char *d_dest = NULL;
|
|
||||||
switch_channel_t *channel;
|
|
||||||
switch_originate_flag_t myflags = SOF_NONE;
|
|
||||||
char *cid_name_override = NULL;
|
|
||||||
char *cid_num_override = NULL;
|
|
||||||
|
|
||||||
if (var_event) {
|
if (var_event) {
|
||||||
cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
|
cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
|
||||||
cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
|
cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session) {
|
if(session) {
|
||||||
switch_event_t *event = NULL;
|
a_session = session;
|
||||||
switch_event_create(&event, SWITCH_EVENT_GENERAL);
|
} else if(var_event) {
|
||||||
channel = switch_core_session_get_channel(session);
|
const char* uuid_e_session = switch_event_get_header(var_event, "ent_originate_aleg_uuid");
|
||||||
if ((varval = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHECKING ORIGINATE-UUID : %s\n", uuid_e_session);
|
||||||
|| (var_event && (varval = switch_event_get_header(var_event, "leg_timeout")))) {
|
if (uuid_e_session && (e_session = switch_core_session_force_locate(uuid_e_session)) != NULL) {
|
||||||
timelimit = atoi(varval);
|
a_session = e_session;
|
||||||
}
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FOUND ORIGINATE-UUID : %s\n", uuid_e_session);
|
||||||
switch_channel_event_set_data(channel, event);
|
|
||||||
if(var_event) {
|
|
||||||
switch_event_merge(event, var_event);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_channel_set_variable(channel, "dialed_user", dialed_user);
|
|
||||||
switch_channel_set_variable(channel, "dialed_domain", domain);
|
|
||||||
|
|
||||||
d_dest = switch_event_expand_headers(event, dest);
|
|
||||||
|
|
||||||
switch_event_destroy(&event);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
switch_event_t *event = NULL;
|
|
||||||
|
|
||||||
if (var_event) {
|
|
||||||
switch_event_dup(&event, var_event);
|
|
||||||
switch_event_del_header(event, "dialed_user");
|
|
||||||
switch_event_del_header(event, "dialed_domain");
|
|
||||||
if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
|
|
||||||
(varval = switch_event_get_header(var_event, "leg_timeout"))) {
|
|
||||||
timelimit = atoi(varval);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
|
|
||||||
switch_assert(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", dialed_user);
|
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
|
|
||||||
d_dest = switch_event_expand_headers(event, dest);
|
|
||||||
switch_event_destroy(&event);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((flags & SOF_NO_LIMITS)) {
|
|
||||||
myflags |= SOF_NO_LIMITS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((flags & SOF_FORKED_DIAL)) {
|
|
||||||
myflags |= SOF_NOBLOCK;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_snprintf(stupid, sizeof(stupid), "kz/%s", dialed_user);
|
|
||||||
if (switch_stristr(stupid, d_dest)) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n",
|
|
||||||
stupid);
|
|
||||||
cause = SWITCH_CAUSE_INVALID_IE_CONTENTS;
|
|
||||||
} else if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
|
|
||||||
cid_name_override, cid_num_override, outbound_profile, var_event, myflags,
|
|
||||||
cancel_cause, NULL) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
const char *context;
|
|
||||||
switch_caller_profile_t *cp;
|
|
||||||
|
|
||||||
if (var_event) {
|
|
||||||
switch_event_del_header(var_event, "origination_uuid");
|
|
||||||
}
|
|
||||||
|
|
||||||
new_channel = switch_core_session_get_channel(*new_session);
|
|
||||||
|
|
||||||
if ((context = switch_channel_get_variable(new_channel, "user_context"))) {
|
|
||||||
if ((cp = switch_channel_get_caller_profile(new_channel))) {
|
|
||||||
cp->context = switch_core_strdup(cp->pool, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((x_params = switch_xml_child(x_user, "variables"))) {
|
|
||||||
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
|
|
||||||
const char *pvar = switch_xml_attr(x_param, "name");
|
|
||||||
const char *val = switch_xml_attr(x_param, "value");
|
|
||||||
switch_channel_set_variable(new_channel, pvar, val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "CHECKING CALLER-ID\n");
|
|
||||||
if ((x_params = switch_xml_child(x_user, "profile-variables"))) {
|
|
||||||
switch_caller_profile_t *cp = NULL;
|
|
||||||
const char* val = NULL;
|
|
||||||
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
|
|
||||||
const char *pvar = switch_xml_attr(x_param, "name");
|
|
||||||
const char *val = switch_xml_attr(x_param, "value");
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "setting profile var %s = %s\n", pvar, val);
|
|
||||||
switch_channel_set_profile_var(new_channel, pvar, val);
|
|
||||||
}
|
|
||||||
cp = switch_channel_get_caller_profile(new_channel);
|
|
||||||
if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Name"))) {
|
|
||||||
cp->callee_id_name = val;
|
|
||||||
cp->orig_caller_id_name = val;
|
|
||||||
}
|
|
||||||
if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Number"))) {
|
|
||||||
cp->callee_id_number = val;
|
|
||||||
cp->orig_caller_id_number = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch_core_session_rwunlock(*new_session);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d_dest != dest) {
|
|
||||||
switch_safe_free(d_dest);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (a_session) {
|
||||||
|
switch_event_create(&event, SWITCH_EVENT_GENERAL);
|
||||||
|
channel = switch_core_session_get_channel(a_session);
|
||||||
|
if ((varval = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))
|
||||||
|
|| (var_event && (varval = switch_event_get_header(var_event, "leg_timeout")))) {
|
||||||
|
timelimit = atoi(varval);
|
||||||
|
}
|
||||||
|
switch_channel_event_set_data(channel, event);
|
||||||
|
|
||||||
|
switch_channel_set_variable(channel, "dialed_user", dialed_user);
|
||||||
|
switch_channel_set_variable(channel, "dialed_domain", domain);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (var_event) {
|
||||||
|
switch_event_dup(&event, var_event);
|
||||||
|
switch_event_del_header(event, "dialed_user");
|
||||||
|
switch_event_del_header(event, "dialed_domain");
|
||||||
|
if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
|
||||||
|
(varval = switch_event_get_header(var_event, "leg_timeout"))) {
|
||||||
|
timelimit = atoi(varval);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
|
||||||
|
switch_assert(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", dialed_user);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((x_params = switch_xml_child(x_user, "profile-variables"))) {
|
||||||
|
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
|
||||||
|
const char *pvar = switch_xml_attr_soft(x_param, "name");
|
||||||
|
const char *val = switch_xml_attr(x_param, "value");
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding profile variable to event => %s = %s\n", pvar, val);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((x_params = switch_xml_child(x_user, "variables"))) {
|
||||||
|
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
|
||||||
|
const char *pvar = switch_xml_attr_soft(x_param, "name");
|
||||||
|
const char *val = switch_xml_attr(x_param, "value");
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding variable to event => %s = %s\n", pvar, val);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((x_params = switch_xml_child(x_user, "params"))) {
|
||||||
|
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
|
||||||
|
const char *pvar = switch_xml_attr_soft(x_param, "name");
|
||||||
|
const char *val = switch_xml_attr(x_param, "value");
|
||||||
|
|
||||||
|
if (!strncasecmp(pvar, "dial-var-", 9)) {
|
||||||
|
switch_event_del_header(event, pvar + 9);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "adding dialog var to event => %s = %s\n", pvar + 9, val);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, pvar + 9, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add runtime vars to event for expand
|
||||||
|
if (ctx) {
|
||||||
|
kz_expand_json_to_event(ctx, event, "kz_ctx");
|
||||||
|
}
|
||||||
|
|
||||||
|
d_dest = kz_event_expand_headers(event, dest);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "dialing %s => %s\n", dest, d_dest);
|
||||||
|
|
||||||
|
if(failover_dial) {
|
||||||
|
b_failover_dial = kz_event_expand_headers(event, failover_dial);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (var_event) {
|
||||||
|
kz_expand_headers(event, var_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_event_destroy(&event);
|
||||||
|
|
||||||
|
|
||||||
|
if ((flags & SOF_NO_LIMITS)) {
|
||||||
|
myflags |= SOF_NO_LIMITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((flags & SOF_FORKED_DIAL)) {
|
||||||
|
myflags |= SOF_NOBLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( a_session ) {
|
||||||
|
if(var_event) {
|
||||||
|
kz_tweaks_variables_to_event(a_session, var_event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e_session) {
|
||||||
|
switch_core_session_rwunlock(e_session);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_snprintf(stupid, sizeof(stupid), "kz/%s", dialed_user);
|
||||||
|
if (switch_stristr(stupid, d_dest)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", stupid);
|
||||||
|
cause = SWITCH_CAUSE_INVALID_IE_CONTENTS;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
|
||||||
|
cid_name_override, cid_num_override, outbound_profile, var_event, myflags,
|
||||||
|
cancel_cause, NULL);
|
||||||
|
|
||||||
|
if (status != SWITCH_STATUS_SUCCESS && b_failover_dial) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "trying failover => %s\n", failover_dial);
|
||||||
|
status = switch_ivr_originate(session, new_session, &cause, b_failover_dial, timelimit, NULL,
|
||||||
|
cid_name_override, cid_num_override, outbound_profile, var_event, myflags,
|
||||||
|
cancel_cause, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == SWITCH_STATUS_SUCCESS) {
|
||||||
|
const char *context;
|
||||||
|
switch_caller_profile_t *cp;
|
||||||
|
|
||||||
|
if (var_event) {
|
||||||
|
switch_event_del_header(var_event, "origination_uuid");
|
||||||
|
}
|
||||||
|
|
||||||
|
new_channel = switch_core_session_get_channel(*new_session);
|
||||||
|
|
||||||
|
if ((context = switch_channel_get_variable(new_channel, "user_context"))) {
|
||||||
|
if ((cp = switch_channel_get_caller_profile(new_channel))) {
|
||||||
|
cp->context = switch_core_strdup(cp->pool, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "CHECKING CALLER-ID\n");
|
||||||
|
if ((x_params = switch_xml_child(x_user, "profile-variables"))) {
|
||||||
|
switch_caller_profile_t *cp = NULL;
|
||||||
|
const char* val = NULL;
|
||||||
|
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
|
||||||
|
const char *pvar = switch_xml_attr(x_param, "name");
|
||||||
|
const char *val = switch_xml_attr(x_param, "value");
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG1, "setting profile var %s = %s\n", pvar, val);
|
||||||
|
switch_channel_set_profile_var(new_channel, pvar, val);
|
||||||
|
}
|
||||||
|
cp = switch_channel_get_caller_profile(new_channel);
|
||||||
|
if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Name"))) {
|
||||||
|
cp->callee_id_name = val;
|
||||||
|
cp->orig_caller_id_name = val;
|
||||||
|
}
|
||||||
|
if((val=switch_caller_get_field_by_name(cp, "Endpoint-Caller-ID-Number"))) {
|
||||||
|
cp->callee_id_number = val;
|
||||||
|
cp->orig_caller_id_number = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch_core_session_rwunlock(*new_session);
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
if (d_dest && d_dest != dest) {
|
||||||
|
switch_safe_free(d_dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(b_failover_dial && b_failover_dial != failover_dial) {
|
||||||
|
switch_safe_free(b_failover_dial);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_safe_free(dest);
|
||||||
|
|
||||||
|
if (ctx) {
|
||||||
|
cJSON_Delete(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
if (x_user) {
|
if (x_user) {
|
||||||
switch_xml_free(x_user);
|
switch_xml_free(x_user);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +462,6 @@ static switch_call_cause_t kz_endpoint_outgoing_channel(switch_core_session_t *s
|
||||||
|
|
||||||
switch_safe_free(user);
|
switch_safe_free(user);
|
||||||
switch_safe_free(dup_domain);
|
switch_safe_free(dup_domain);
|
||||||
|
|
||||||
return cause;
|
return cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,9 @@ cJSON * kazoo_event_add_field_to_json(cJSON *dst, switch_event_t *src, kazoo_fie
|
||||||
expanded = kz_event_expand_headers(src, field->value);
|
expanded = kz_event_expand_headers(src, field->value);
|
||||||
if(expanded != NULL && !zstr(expanded)) {
|
if(expanded != NULL && !zstr(expanded)) {
|
||||||
item = kazoo_event_add_json_value(dst, field, field->as ? field->as : field->name, expanded);
|
item = kazoo_event_add_json_value(dst, field, field->as ? field->as : field->name, expanded);
|
||||||
free(expanded);
|
if(expanded != field->value) {
|
||||||
|
free(expanded);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -325,6 +327,21 @@ static switch_status_t kazoo_event_add_fields_to_json(kazoo_logging_ptr logging,
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define EVENT_TIMESTAMP_FIELD "Event-Date-Timestamp"
|
||||||
|
#define JSON_TIMESTAMP_FIELD "Event-Timestamp"
|
||||||
|
|
||||||
|
static switch_status_t kazoo_event_add_timestamp(switch_event_t* evt, cJSON* JObj)
|
||||||
|
{
|
||||||
|
switch_event_header_t *header;
|
||||||
|
cJSON *item = NULL;
|
||||||
|
if((header = switch_event_get_header_ptr(evt, EVENT_TIMESTAMP_FIELD)) != NULL) {
|
||||||
|
if ((item = kazoo_event_json_value(JSON_NUMBER, header->value)) != NULL) {
|
||||||
|
kazoo_cJSON_AddItemToObject(JObj, JSON_TIMESTAMP_FIELD, item);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SWITCH_STATUS_NOTFOUND;
|
||||||
|
}
|
||||||
|
|
||||||
kazoo_message_ptr kazoo_message_create_event(switch_event_t* evt, kazoo_event_ptr event, kazoo_event_profile_ptr profile)
|
kazoo_message_ptr kazoo_message_create_event(switch_event_t* evt, kazoo_event_ptr event, kazoo_event_profile_ptr profile)
|
||||||
{
|
{
|
||||||
|
@ -366,6 +383,8 @@ kazoo_message_ptr kazoo_message_create_event(switch_event_t* evt, kazoo_event_pt
|
||||||
|
|
||||||
kazoo_event_init_json(profile->fields, event ? event->fields : NULL, evt, &JObj);
|
kazoo_event_init_json(profile->fields, event ? event->fields : NULL, evt, &JObj);
|
||||||
|
|
||||||
|
kazoo_event_add_timestamp(evt, JObj);
|
||||||
|
|
||||||
if(profile->fields)
|
if(profile->fields)
|
||||||
kazoo_event_add_fields_to_json(&logging, JObj, evt, profile->fields->head);
|
kazoo_event_add_fields_to_json(&logging, JObj, evt, profile->fields->head);
|
||||||
|
|
||||||
|
@ -402,6 +421,8 @@ kazoo_message_ptr kazoo_message_create_fetch(switch_event_t* evt, kazoo_fetch_pr
|
||||||
|
|
||||||
kazoo_event_init_json(profile->fields, NULL, evt, &JObj);
|
kazoo_event_init_json(profile->fields, NULL, evt, &JObj);
|
||||||
|
|
||||||
|
kazoo_event_add_timestamp(evt, JObj);
|
||||||
|
|
||||||
if(profile->fields)
|
if(profile->fields)
|
||||||
kazoo_event_add_fields_to_json(&logging, JObj, evt, profile->fields->head);
|
kazoo_event_add_fields_to_json(&logging, JObj, evt, profile->fields->head);
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,6 @@
|
||||||
*/
|
*/
|
||||||
#include "mod_kazoo.h"
|
#include "mod_kazoo.h"
|
||||||
|
|
||||||
#define INTERACTION_VARIABLE "Call-Interaction-ID"
|
|
||||||
#define BRIDGE_INTERCEPT_VARIABLE "Bridge-Intercepted"
|
|
||||||
|
|
||||||
static char *TWEAK_NAMES[] = {
|
static char *TWEAK_NAMES[] = {
|
||||||
"interaction-id",
|
"interaction-id",
|
||||||
"export-vars",
|
"export-vars",
|
||||||
|
@ -69,7 +66,6 @@ static switch_status_t kz_tweaks_signal_bridge_on_hangup(switch_core_session_t *
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak signal bridge on hangup: %s , %s\n", switch_core_session_get_uuid(session), peer_uuid);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak signal bridge on hangup: %s , %s\n", switch_core_session_get_uuid(session), peer_uuid);
|
||||||
|
|
||||||
|
|
||||||
if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session));
|
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session));
|
||||||
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid);
|
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid);
|
||||||
|
@ -106,7 +102,6 @@ static void kz_tweaks_handle_bridge_variables(switch_event_t *event)
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak bridge event handler: variables : %s , %s\n", a_leg, b_leg);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak bridge event handler: variables : %s , %s\n", a_leg, b_leg);
|
||||||
|
|
||||||
|
|
||||||
if (a_leg && (a_session = switch_core_session_force_locate(a_leg)) != NULL) {
|
if (a_leg && (a_session = switch_core_session_force_locate(a_leg)) != NULL) {
|
||||||
switch_channel_t *a_channel = switch_core_session_get_channel(a_session);
|
switch_channel_t *a_channel = switch_core_session_get_channel(a_session);
|
||||||
if(switch_channel_get_variable_dup(a_channel, bridge_variables[0], SWITCH_FALSE, -1) == NULL) {
|
if(switch_channel_get_variable_dup(a_channel, bridge_variables[0], SWITCH_FALSE, -1) == NULL) {
|
||||||
|
@ -137,56 +132,91 @@ static void kz_tweaks_handle_bridge_variables(switch_event_t *event)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kz_tweaks_handle_bridge_intercepted(switch_event_t *event)
|
static void kz_tweaks_handle_bridge_replaces_aleg(switch_event_t *event)
|
||||||
{
|
{
|
||||||
switch_event_t *my_event;
|
switch_event_t *my_event;
|
||||||
switch_core_session_t *a_session = NULL;
|
|
||||||
switch_core_session_t *b_session = NULL;
|
|
||||||
|
|
||||||
const char *uuid = switch_event_get_header(event, "Unique-ID");
|
const char *replaced_call_id = switch_event_get_header(event, "variable_sip_replaces_call_id");
|
||||||
const char *a_leg = switch_event_get_header(event, "Bridge-A-Unique-ID");
|
const char *a_leg_call_id = switch_event_get_header(event, "variable_sip_replaces_a-leg");
|
||||||
const char *b_leg = switch_event_get_header(event, "Bridge-B-Unique-ID");
|
const char *peer_uuid = switch_event_get_header(event, "Unique-ID");
|
||||||
const char *bridge_intercepted = NULL;
|
int processed = 0;
|
||||||
|
|
||||||
if (!kz_test_tweak(KZ_TWEAK_BRIDGE_REPLACES_ALEG)) return;
|
if (!kz_test_tweak(KZ_TWEAK_BRIDGE_REPLACES_ALEG)) return;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak bridge event handler: intercepted : %s , %s, %s\n", uuid, a_leg, b_leg);
|
|
||||||
|
|
||||||
|
if(a_leg_call_id && replaced_call_id) {
|
||||||
|
const char *call_id = switch_event_get_header(event, "Bridge-B-Unique-ID");
|
||||||
|
switch_core_session_t *session = NULL;
|
||||||
|
if ((session = switch_core_session_locate(peer_uuid)) != NULL) {
|
||||||
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
processed = switch_true(switch_channel_get_variable_dup(channel, "Bridge-Event-Processed", SWITCH_FALSE, -1));
|
||||||
|
switch_channel_set_variable(channel, "Bridge-Event-Processed", "true");
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
}
|
||||||
|
|
||||||
if ((a_session = switch_core_session_locate(a_leg)) != NULL) {
|
if(processed) {
|
||||||
switch_channel_t *a_channel = switch_core_session_get_channel(a_session);
|
if(call_id) {
|
||||||
bridge_intercepted = switch_channel_get_variable_dup(a_channel, BRIDGE_INTERCEPT_VARIABLE, SWITCH_TRUE, -1);
|
if((session = switch_core_session_locate(call_id)) != NULL) {
|
||||||
switch_channel_set_variable(a_channel, BRIDGE_INTERCEPT_VARIABLE, NULL);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
if (bridge_intercepted && switch_true(bridge_intercepted)) {
|
switch_channel_set_variable(channel, "Bridge-Event-Processed", "true");
|
||||||
switch_channel_set_variable(a_channel, "Bridge-B-Unique-ID", b_leg);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "creating channel_bridge event A - %s , B - %s\n", switch_core_session_get_uuid(session), peer_uuid);
|
||||||
switch_channel_add_state_handler(a_channel, &kz_tweaks_signal_bridge_state_handlers);
|
if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(session));
|
||||||
if ((b_session = switch_core_session_locate(b_leg)) != NULL) {
|
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid);
|
||||||
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
|
switch_channel_event_set_data(channel, my_event);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "creating channel_bridge event A - %s , B - %s\n", switch_core_session_get_uuid(b_session), uuid);
|
switch_event_fire(&my_event);
|
||||||
if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
}
|
||||||
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(b_session));
|
switch_channel_set_variable(channel, "Bridge-B-Unique-ID", peer_uuid);
|
||||||
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", uuid);
|
switch_channel_add_state_handler(channel, &kz_tweaks_signal_bridge_state_handlers);
|
||||||
switch_channel_event_set_data(b_channel, my_event);
|
switch_core_session_rwunlock(session);
|
||||||
switch_event_fire(&my_event);
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "invalid session : %s\n", call_id);
|
||||||
|
DUMP_EVENT(event);
|
||||||
}
|
}
|
||||||
switch_core_session_rwunlock(b_session);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch_core_session_rwunlock(a_session);
|
|
||||||
}
|
}
|
||||||
switch_safe_strdup(bridge_intercepted);
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void kz_tweaks_handle_bridge_replaces_call_id(switch_event_t *event)
|
||||||
|
{
|
||||||
|
switch_event_t *my_event;
|
||||||
|
|
||||||
|
const char *replaced_call_id = switch_event_get_header(event, "variable_sip_replaces_call_id");
|
||||||
|
const char *a_leg_call_id = switch_event_get_header(event, "variable_sip_replaces_a-leg");
|
||||||
|
const char *peer_uuid = switch_event_get_header(event, "Unique-ID");
|
||||||
|
|
||||||
|
if (!kz_test_tweak(KZ_TWEAK_BRIDGE_REPLACES_CALL_ID)) return;
|
||||||
|
|
||||||
|
if(a_leg_call_id && replaced_call_id) {
|
||||||
|
switch_core_session_t *call_session = NULL;
|
||||||
|
const char *call_id = switch_event_get_header(event, "Bridge-B-Unique-ID");
|
||||||
|
if (call_id && (call_session = switch_core_session_force_locate(call_id)) != NULL) {
|
||||||
|
switch_channel_t *call_channel = switch_core_session_get_channel(call_session);
|
||||||
|
if (switch_event_create(&my_event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-A-Unique-ID", switch_core_session_get_uuid(call_session));
|
||||||
|
switch_event_add_header_string(my_event, SWITCH_STACK_BOTTOM, "Bridge-B-Unique-ID", peer_uuid);
|
||||||
|
switch_channel_event_set_data(call_channel, my_event);
|
||||||
|
switch_event_fire(&my_event);
|
||||||
|
}
|
||||||
|
switch_channel_set_variable(call_channel, "Bridge-B-Unique-ID", peer_uuid);
|
||||||
|
switch_channel_add_state_handler(call_channel, &kz_tweaks_signal_bridge_state_handlers);
|
||||||
|
switch_core_session_rwunlock(call_session);
|
||||||
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "NOT FOUND : %s\n", call_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kz_tweaks_channel_bridge_event_handler(switch_event_t *event)
|
static void kz_tweaks_channel_bridge_event_handler(switch_event_t *event)
|
||||||
{
|
{
|
||||||
const char *uuid = switch_event_get_header(event, "Unique-ID");
|
|
||||||
|
|
||||||
if (!kz_test_tweak(KZ_TWEAK_BRIDGE)) return;
|
if (!kz_test_tweak(KZ_TWEAK_BRIDGE)) return;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak bridge event handler: %s\n", uuid);
|
kz_tweaks_handle_bridge_replaces_call_id(event);
|
||||||
|
kz_tweaks_handle_bridge_replaces_aleg(event);
|
||||||
kz_tweaks_handle_bridge_intercepted(event);
|
|
||||||
kz_tweaks_handle_bridge_variables(event);
|
kz_tweaks_handle_bridge_variables(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,21 +234,12 @@ static void kz_tweaks_channel_replaced_event_handler(switch_event_t *event)
|
||||||
|
|
||||||
static void kz_tweaks_channel_intercepted_event_handler(switch_event_t *event)
|
static void kz_tweaks_channel_intercepted_event_handler(switch_event_t *event)
|
||||||
{
|
{
|
||||||
switch_core_session_t *uuid_session = NULL;
|
|
||||||
const char *uuid = switch_event_get_header(event, "Unique-ID");
|
const char *uuid = switch_event_get_header(event, "Unique-ID");
|
||||||
const char *peer_uuid = switch_event_get_header(event, "intercepted_by");
|
const char *peer_uuid = switch_event_get_header(event, "intercepted_by");
|
||||||
|
|
||||||
if (!kz_test_tweak(KZ_TWEAK_TRANSFERS)) return;
|
if (!kz_test_tweak(KZ_TWEAK_TRANSFERS)) return;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tweak intercepted handler : %s was intercepted by %s\n", uuid, peer_uuid);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INTERCEPTED : %s => %s\n", uuid, peer_uuid);
|
||||||
|
|
||||||
if ((uuid_session = switch_core_session_force_locate(peer_uuid)) != NULL) {
|
|
||||||
switch_channel_t *uuid_channel = switch_core_session_get_channel(uuid_session);
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "marking %s for channel_bridge handling\n", peer_uuid);
|
|
||||||
switch_channel_set_variable(uuid_channel, BRIDGE_INTERCEPT_VARIABLE, "true");
|
|
||||||
switch_core_session_rwunlock(uuid_session);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kz_tweaks_channel_transferor_event_handler(switch_event_t *event)
|
static void kz_tweaks_channel_transferor_event_handler(switch_event_t *event)
|
||||||
|
@ -423,30 +444,6 @@ static void kz_tweaks_handle_caller_id(switch_core_session_t *session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
static switch_status_t kz_tweaks_handle_auth_token(switch_core_session_t *session)
|
|
||||||
{
|
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
|
||||||
switch_event_t *event;
|
|
||||||
const char *token = switch_channel_get_variable(channel, "sip_h_X-FS-Auth-Token");
|
|
||||||
if(token) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Authenticating user for nightmare xfer %s\n", token);
|
|
||||||
if (switch_ivr_set_user(session, token) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_channel_event_set_data(channel, event);
|
|
||||||
switch_event_fire(&event);
|
|
||||||
}
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Authenticated user from nightmare xfer %s\n", token);
|
|
||||||
} else {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Error Authenticating user for nightmare xfer %s\n", token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static switch_status_t kz_tweaks_handle_nightmare_xfer_interaction_id(switch_core_session_t *session)
|
static switch_status_t kz_tweaks_handle_nightmare_xfer_interaction_id(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
if (kz_test_tweak(KZ_TWEAK_INTERACTION_ID)) {
|
if (kz_test_tweak(KZ_TWEAK_INTERACTION_ID)) {
|
||||||
|
@ -525,16 +522,26 @@ static switch_status_t kz_tweaks_handle_switch_uri(switch_core_session_t *sessio
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char * kz_tweaks_new_interaction_id()
|
||||||
|
{
|
||||||
|
long int first = (switch_micro_time_now() / 1000000) + UNIX_EPOCH_IN_GREGORIAN;
|
||||||
|
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||||
|
switch_uuid_t uuid;
|
||||||
|
switch_uuid_get(&uuid);
|
||||||
|
switch_uuid_format(uuid_str, &uuid);
|
||||||
|
uuid_str[8] = '\0';
|
||||||
|
return switch_mprintf("%ld-%s", first, uuid_str);
|
||||||
|
}
|
||||||
|
|
||||||
static void kz_tweaks_handle_interaction_id(switch_core_session_t *session)
|
static void kz_tweaks_handle_interaction_id(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
const char *expr = "${expr(ceil((${Event-Date-Timestamp} / 1000000) + $${UNIX_EPOCH_IN_GREGORIAN}))}-${regex(${create_uuid()}|^([^-]*)|%1)}";
|
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
char * val = NULL;
|
char * val = NULL;
|
||||||
switch_core_session_t *peer_session = NULL;
|
switch_core_session_t *peer_session = NULL;
|
||||||
const char* peer_interaction_id = NULL;
|
const char* peer_interaction_id = NULL;
|
||||||
|
|
||||||
if (kz_test_tweak(KZ_TWEAK_INTERACTION_ID)) {
|
if (kz_test_tweak(KZ_TWEAK_INTERACTION_ID)) {
|
||||||
val = kz_expand(expr);
|
val = kz_tweaks_new_interaction_id();
|
||||||
if (val) {
|
if (val) {
|
||||||
switch_channel_set_variable(channel, "Original-"INTERACTION_VARIABLE, val);
|
switch_channel_set_variable(channel, "Original-"INTERACTION_VARIABLE, val);
|
||||||
if(switch_core_session_get_partner(session, &peer_session) == SWITCH_STATUS_SUCCESS) {
|
if(switch_core_session_get_partner(session, &peer_session) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
@ -583,32 +590,6 @@ static switch_status_t kz_tweaks_register_handle_blind_xfer(switch_core_session_
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static switch_status_t kz_tweaks_set_export_vars(switch_core_session_t *session)
|
|
||||||
{
|
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
|
||||||
const char *exports;
|
|
||||||
char *var, *new_exports, *new_exports_d = NULL;
|
|
||||||
|
|
||||||
if (kz_test_tweak(KZ_TWEAK_EXPORT_VARS)) {
|
|
||||||
exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE);
|
|
||||||
var = switch_core_session_strdup(session, "Switch-URI,Switch-URL");
|
|
||||||
|
|
||||||
if (exports) {
|
|
||||||
new_exports_d = switch_mprintf("%s,%s", exports, var);
|
|
||||||
new_exports = new_exports_d;
|
|
||||||
} else {
|
|
||||||
new_exports = var;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_channel_set_variable(channel, SWITCH_EXPORT_VARS_VARIABLE, new_exports);
|
|
||||||
|
|
||||||
switch_safe_free(new_exports_d);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static switch_status_t kz_tweaks_on_init(switch_core_session_t *session)
|
static switch_status_t kz_tweaks_on_init(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
@ -618,12 +599,10 @@ static switch_status_t kz_tweaks_on_init(switch_core_session_t *session)
|
||||||
kz_tweaks_handle_interaction_id(session);
|
kz_tweaks_handle_interaction_id(session);
|
||||||
kz_tweaks_handle_switch_uri(session);
|
kz_tweaks_handle_switch_uri(session);
|
||||||
kz_tweaks_handle_caller_id(session);
|
kz_tweaks_handle_caller_id(session);
|
||||||
// kz_tweaks_handle_auth_token(session);
|
|
||||||
kz_tweaks_handle_nightmare_xfer_interaction_id(session);
|
kz_tweaks_handle_nightmare_xfer_interaction_id(session);
|
||||||
kz_tweaks_handle_replaces_call_id(session);
|
kz_tweaks_handle_replaces_call_id(session);
|
||||||
kz_tweaks_handle_loopback(session);
|
kz_tweaks_handle_loopback(session);
|
||||||
kz_tweaks_register_handle_blind_xfer(session);
|
kz_tweaks_register_handle_blind_xfer(session);
|
||||||
kz_tweaks_set_export_vars(session);
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -693,7 +672,7 @@ static void kz_tweaks_unbind_events()
|
||||||
|
|
||||||
void kz_tweaks_add_core_variables()
|
void kz_tweaks_add_core_variables()
|
||||||
{
|
{
|
||||||
switch_core_set_variable("UNIX_EPOCH_IN_GREGORIAN", "62167219200");
|
switch_core_set_variable("UNIX_EPOCH_IN_GREGORIAN", UNIX_EPOCH_IN_GREGORIAN_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void kz_tweaks_start()
|
void kz_tweaks_start()
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <switch.h>
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
KZ_TWEAK_INTERACTION_ID,
|
||||||
|
KZ_TWEAK_EXPORT_VARS,
|
||||||
|
KZ_TWEAK_SWITCH_URI,
|
||||||
|
KZ_TWEAK_REPLACES_CALL_ID,
|
||||||
|
KZ_TWEAK_LOOPBACK_VARS,
|
||||||
|
KZ_TWEAK_CALLER_ID,
|
||||||
|
KZ_TWEAK_TRANSFERS,
|
||||||
|
KZ_TWEAK_BRIDGE,
|
||||||
|
KZ_TWEAK_BRIDGE_REPLACES_ALEG,
|
||||||
|
KZ_TWEAK_BRIDGE_REPLACES_CALL_ID,
|
||||||
|
KZ_TWEAK_BRIDGE_VARIABLES,
|
||||||
|
KZ_TWEAK_RESTORE_CALLER_ID_ON_BLIND_XFER,
|
||||||
|
|
||||||
|
/* No new flags below this line */
|
||||||
|
KZ_TWEAK_MAX
|
||||||
|
} kz_tweak_t;
|
||||||
|
|
||||||
|
void kz_tweaks_start();
|
||||||
|
void kz_tweaks_stop();
|
||||||
|
SWITCH_DECLARE(const char *) kz_tweak_name(kz_tweak_t tweak);
|
||||||
|
SWITCH_DECLARE(switch_status_t) kz_name_tweak(const char *name, kz_tweak_t *type);
|
||||||
|
|
||||||
|
|
||||||
|
#define kz_test_tweak(flag) (kazoo_globals.tweaks[flag] ? 1 : 0)
|
||||||
|
#define kz_set_tweak(flag) kazoo_globals.tweaks[flag] = 1
|
||||||
|
#define kz_clear_tweak(flag) kazoo_globals.tweaks[flag] = 0
|
||||||
|
|
|
@ -90,15 +90,11 @@ SWITCH_DECLARE(switch_status_t) kz_expand_api_execute(const char *cmd, const cha
|
||||||
switch_assert(stream->data != NULL);
|
switch_assert(stream->data != NULL);
|
||||||
switch_assert(stream->write_function != NULL);
|
switch_assert(stream->write_function != NULL);
|
||||||
|
|
||||||
if (strcasecmp(cmd, "console_complete")) {
|
cmd_used = switch_strip_whitespace(cmd);
|
||||||
cmd_used = switch_strip_whitespace(cmd);
|
arg_used = switch_strip_whitespace(arg);
|
||||||
arg_used = switch_strip_whitespace(arg);
|
|
||||||
} else {
|
|
||||||
cmd_used = (char *) cmd;
|
|
||||||
arg_used = (char *) arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd_used && (api = switch_loadable_module_get_api_interface(cmd_used)) != 0) {
|
if (cmd_used && (api = switch_loadable_module_get_api_interface(cmd_used)) != 0) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "executing [%s] => [%s]\n", cmd_used, arg_used);
|
||||||
if ((status = api->function(arg_used, session, stream)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = api->function(arg_used, session, stream)) != SWITCH_STATUS_SUCCESS) {
|
||||||
stream->write_function(stream, "COMMAND RETURNED ERROR!\n");
|
stream->write_function(stream, "COMMAND RETURNED ERROR!\n");
|
||||||
}
|
}
|
||||||
|
@ -148,6 +144,7 @@ SWITCH_DECLARE(char *) kz_event_expand_headers_check(switch_event_t *event, cons
|
||||||
nv = 0;
|
nv = 0;
|
||||||
olen = strlen(in) + 1;
|
olen = strlen(in) + 1;
|
||||||
indup = strdup(in);
|
indup = strdup(in);
|
||||||
|
switch_assert(indup);
|
||||||
endof_indup = end_of_p(indup) + 1;
|
endof_indup = end_of_p(indup) + 1;
|
||||||
|
|
||||||
if ((data = malloc(olen))) {
|
if ((data = malloc(olen))) {
|
||||||
|
@ -342,46 +339,37 @@ SWITCH_DECLARE(char *) kz_event_expand_headers_check(switch_event_t *event, cons
|
||||||
} else {
|
} else {
|
||||||
switch_stream_handle_t stream = { 0 };
|
switch_stream_handle_t stream = { 0 };
|
||||||
char *expanded = NULL;
|
char *expanded = NULL;
|
||||||
|
char *expanded_vname = NULL;
|
||||||
|
|
||||||
SWITCH_STANDARD_STREAM(stream);
|
SWITCH_STANDARD_STREAM(stream);
|
||||||
|
|
||||||
if (stream.data) {
|
if ((expanded_vname = kz_event_expand_headers_check(event, (char *) vname, var_list, api_list, recur+1)) == vname) {
|
||||||
char *expanded_vname = NULL;
|
expanded_vname = NULL;
|
||||||
|
|
||||||
if ((expanded_vname = kz_event_expand_headers_check(event, (char *) vname, var_list, api_list, recur+1)) == vname) {
|
|
||||||
expanded_vname = NULL;
|
|
||||||
} else {
|
|
||||||
vname = expanded_vname;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((expanded = kz_event_expand_headers_check(event, vval, var_list, api_list, recur+1)) == vval) {
|
|
||||||
expanded = NULL;
|
|
||||||
} else {
|
|
||||||
vval = expanded;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) {
|
|
||||||
func_val = NULL;
|
|
||||||
sub_val = "<API execute Permission Denied>";
|
|
||||||
} else {
|
|
||||||
stream.param_event = event;
|
|
||||||
if (kz_expand_api_execute(vname, vval, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
func_val = stream.data;
|
|
||||||
sub_val = func_val;
|
|
||||||
} else {
|
|
||||||
free(stream.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_safe_free(expanded);
|
|
||||||
switch_safe_free(expanded_vname);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
|
vname = expanded_vname;
|
||||||
free(data);
|
|
||||||
free(indup);
|
|
||||||
return (char *) in;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((expanded = kz_event_expand_headers_check(event, vval, var_list, api_list, recur+1)) == vval) {
|
||||||
|
expanded = NULL;
|
||||||
|
} else {
|
||||||
|
vval = expanded;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!switch_core_test_flag(SCF_API_EXPANSION) || (api_list && !switch_event_check_permission_list(api_list, vname))) {
|
||||||
|
func_val = NULL;
|
||||||
|
sub_val = "<API execute Permission Denied>";
|
||||||
|
} else {
|
||||||
|
stream.param_event = event;
|
||||||
|
if (kz_expand_api_execute(vname, vval, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
func_val = stream.data;
|
||||||
|
sub_val = func_val;
|
||||||
|
} else {
|
||||||
|
free(stream.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_safe_free(expanded);
|
||||||
|
switch_safe_free(expanded_vname);
|
||||||
}
|
}
|
||||||
if ((nlen = sub_val ? strlen(sub_val) : 0)) {
|
if ((nlen = sub_val ? strlen(sub_val) : 0)) {
|
||||||
if (len + nlen >= olen) {
|
if (len + nlen >= olen) {
|
||||||
|
@ -435,6 +423,21 @@ SWITCH_DECLARE(char *) kz_event_expand_headers(switch_event_t *event, const char
|
||||||
return kz_event_expand_headers_check(event, in, NULL, NULL, 0);
|
return kz_event_expand_headers_check(event, in, NULL, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(char *) kz_event_expand_headers_pool(switch_memory_pool_t *pool, switch_event_t *event, char *val)
|
||||||
|
{
|
||||||
|
char *expanded;
|
||||||
|
char *dup = NULL;
|
||||||
|
|
||||||
|
expanded = kz_event_expand_headers(event, val);
|
||||||
|
dup = switch_core_strdup(pool, expanded);
|
||||||
|
|
||||||
|
if (expanded != val) {
|
||||||
|
free(expanded);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dup;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(char *) kz_event_expand(const char *in)
|
SWITCH_DECLARE(char *) kz_event_expand(const char *in)
|
||||||
{
|
{
|
||||||
switch_event_t *event = NULL;
|
switch_event_t *event = NULL;
|
||||||
|
@ -513,6 +516,32 @@ SWITCH_DECLARE(switch_status_t) kz_switch_event_add_variable_name_printf(switch_
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) kz_expand_json_to_event(cJSON *json, switch_event_t *event, char * prefix)
|
||||||
|
{
|
||||||
|
char * fmt = switch_mprintf("%s%s%%s", prefix ? prefix : "", prefix ? "_" : "");
|
||||||
|
if (event) {
|
||||||
|
cJSON *item = NULL;
|
||||||
|
char *response = NULL;
|
||||||
|
cJSON_ArrayForEach(item, json) {
|
||||||
|
if (item->type == cJSON_String) {
|
||||||
|
response = strdup(item->valuestring);
|
||||||
|
} else if (item->type == cJSON_Object) {
|
||||||
|
char * fmt1 = switch_mprintf(fmt, item->string);
|
||||||
|
kz_expand_json_to_event(item, event, fmt1);
|
||||||
|
switch_safe_free(fmt1);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
response = cJSON_PrintUnformatted(item);
|
||||||
|
}
|
||||||
|
kz_switch_event_add_variable_name_printf(event, SWITCH_STACK_BOTTOM, response, fmt, item->string);
|
||||||
|
switch_safe_free(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_safe_free(fmt);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_xml_t) kz_xml_child(switch_xml_t xml, const char *name)
|
SWITCH_DECLARE(switch_xml_t) kz_xml_child(switch_xml_t xml, const char *name)
|
||||||
{
|
{
|
||||||
xml = (xml) ? xml->child : NULL;
|
xml = (xml) ? xml->child : NULL;
|
||||||
|
@ -565,6 +594,35 @@ void kz_event_decode(switch_event_t *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void kz_expand_headers(switch_event_t *resolver, switch_event_t *event) {
|
||||||
|
switch_event_t *clone = NULL;
|
||||||
|
switch_event_header_t *header = NULL;
|
||||||
|
switch_event_create_plain(&clone, event->event_id);
|
||||||
|
|
||||||
|
for(header = event->headers; header; header = header->next) {
|
||||||
|
char *expanded = kz_event_expand_headers(resolver, header->value);
|
||||||
|
if (expanded != header->value) {
|
||||||
|
switch_event_add_header_string(clone, SWITCH_STACK_BOTTOM, header->name, expanded);
|
||||||
|
switch_safe_free(expanded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we don't want to force unique headers
|
||||||
|
* so we delete and then merge
|
||||||
|
*/
|
||||||
|
for(header = clone->headers; header; header = header->next) {
|
||||||
|
switch_event_del_header(event, header->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_event_merge(event, clone);
|
||||||
|
|
||||||
|
switch_event_destroy(&clone);
|
||||||
|
}
|
||||||
|
|
||||||
|
void kz_expand_headers_self(switch_event_t *event) {
|
||||||
|
kz_expand_headers(event, event);
|
||||||
|
}
|
||||||
|
|
||||||
char * kz_expand_vars(char *xml_str) {
|
char * kz_expand_vars(char *xml_str) {
|
||||||
return kz_expand_vars_pool(xml_str, NULL);
|
return kz_expand_vars_pool(xml_str, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <switch.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define KZ_BEGIN_EXTERN_C extern "C" {
|
||||||
|
#define KZ_END_EXTERN_C }
|
||||||
|
#else
|
||||||
|
#define KZ_BEGIN_EXTERN_C
|
||||||
|
#define KZ_END_EXTERN_C
|
||||||
|
#endif
|
||||||
|
|
||||||
|
KZ_BEGIN_EXTERN_C
|
||||||
|
|
||||||
|
void kz_check_set_profile_var(switch_channel_t *channel, char* var, char *val);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) kz_switch_core_merge_variables(switch_event_t *event);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) kz_switch_core_base_headers_for_expand(switch_event_t **event);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) kz_expand_api_execute(const char *cmd, const char *arg, switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(char *) kz_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(char *) kz_event_expand_headers(switch_event_t *event, const char *in);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(char *) kz_event_expand_headers_pool(switch_memory_pool_t *pool, switch_event_t *event, char *val);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(char *) kz_event_expand(const char *in);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(char *) kz_expand(const char *in);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(char *) kz_expand_pool(switch_memory_pool_t *pool, const char *in);
|
||||||
|
|
||||||
|
char* kz_switch_event_get_first_of(switch_event_t *event, const char *list[]);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) kz_switch_event_add_variable_name_printf(switch_event_t *event, switch_stack_t stack, const char *val, const char *fmt, ...);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_xml_t) kz_xml_child(switch_xml_t xml, const char *name);
|
||||||
|
|
||||||
|
void kz_xml_process(switch_xml_t cfg);
|
||||||
|
void kz_event_decode(switch_event_t *event);
|
||||||
|
|
||||||
|
char * kz_expand_vars(char *xml_str);
|
||||||
|
void kz_expand_headers(switch_event_t *resolver, switch_event_t *event);
|
||||||
|
void kz_expand_headers_self(switch_event_t *event);
|
||||||
|
|
||||||
|
char * kz_expand_vars_pool(char *xml_str, switch_memory_pool_t *pool);
|
||||||
|
switch_status_t kz_json_api(const char * command, cJSON *args, cJSON **res);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) kz_expand_json_to_event(cJSON *json, switch_event_t *event, char * prefix);
|
||||||
|
|
||||||
|
KZ_END_EXTERN_C
|
|
@ -86,6 +86,6 @@ SWITCH_STANDARD_JSON_API(kz_node_info_json_function)
|
||||||
|
|
||||||
void add_kz_node(switch_loadable_module_interface_t **module_interface)
|
void add_kz_node(switch_loadable_module_interface_t **module_interface)
|
||||||
{
|
{
|
||||||
switch_json_api_interface_t *json_api_interface = NULL;
|
switch_json_api_interface_t *json_api_interface = NULL;
|
||||||
SWITCH_ADD_JSON_API(json_api_interface, "node.info", "JSON node API", kz_node_info_json_function, "");
|
SWITCH_ADD_JSON_API(json_api_interface, "node.info", "JSON node API", kz_node_info_json_function, "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,23 +32,17 @@
|
||||||
*/
|
*/
|
||||||
#include "mod_kazoo.h"
|
#include "mod_kazoo.h"
|
||||||
|
|
||||||
globals_t kazoo_globals = {0};
|
kz_globals_t kazoo_globals = {0};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MODULE_DEFINITION(mod_kazoo, mod_kazoo_load, mod_kazoo_shutdown, mod_kazoo_runtime);
|
SWITCH_MODULE_DEFINITION(mod_kazoo, mod_kazoo_load, mod_kazoo_shutdown, mod_kazoo_runtime);
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) {
|
SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) {
|
||||||
switch_api_interface_t *api_interface = NULL;
|
|
||||||
switch_application_interface_t *app_interface = NULL;
|
|
||||||
|
|
||||||
memset(&kazoo_globals, 0, sizeof(kazoo_globals));
|
memset(&kazoo_globals, 0, sizeof(kazoo_globals));
|
||||||
|
|
||||||
kazoo_globals.pool = pool;
|
kazoo_globals.pool = pool;
|
||||||
kazoo_globals.ei_nodes = NULL;
|
kz_set_hostname();
|
||||||
|
|
||||||
// ensure epmd is running
|
|
||||||
|
|
||||||
if(kazoo_load_config() != SWITCH_STATUS_SUCCESS) {
|
if(kazoo_load_config() != SWITCH_STATUS_SUCCESS) {
|
||||||
// TODO: what would we need to clean up here?
|
// TODO: what would we need to clean up here?
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Improper configuration!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Improper configuration!\n");
|
||||||
|
@ -66,13 +60,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_kazoo_load) {
|
||||||
bind_fetch_agents();
|
bind_fetch_agents();
|
||||||
|
|
||||||
/* create an api for cli debug commands */
|
/* create an api for cli debug commands */
|
||||||
add_cli_api(module_interface, api_interface);
|
add_cli_api(module_interface);
|
||||||
|
|
||||||
/* add our modified commands */
|
/* add our modified commands */
|
||||||
add_kz_commands(module_interface, api_interface);
|
add_kz_commands(module_interface);
|
||||||
|
|
||||||
/* add our modified dptools */
|
/* add our modified dptools */
|
||||||
add_kz_dptools(module_interface, app_interface);
|
add_kz_dptools(module_interface);
|
||||||
|
|
||||||
/* add our endpoints */
|
/* add our endpoints */
|
||||||
add_kz_endpoints(module_interface);
|
add_kz_endpoints(module_interface);
|
||||||
|
|
|
@ -17,8 +17,11 @@
|
||||||
extern const char kz_default_config[];
|
extern const char kz_default_config[];
|
||||||
extern const int kz_default_config_size;
|
extern const int kz_default_config_size;
|
||||||
|
|
||||||
|
#include "kazoo_defs.h"
|
||||||
|
#include "kazoo_tweaks.h"
|
||||||
#include "kazoo_ei.h"
|
#include "kazoo_ei.h"
|
||||||
#include "kazoo_message.h"
|
#include "kazoo_message.h"
|
||||||
|
#include "kazoo_utils.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LFLAG_RUNNING = (1 << 0)
|
LFLAG_RUNNING = (1 << 0)
|
||||||
|
@ -26,16 +29,17 @@ typedef enum {
|
||||||
|
|
||||||
|
|
||||||
/* kazoo_commands.c */
|
/* kazoo_commands.c */
|
||||||
void add_kz_commands(switch_loadable_module_interface_t **module_interface, switch_api_interface_t *api_interface);
|
void add_kz_commands(switch_loadable_module_interface_t **module_interface);
|
||||||
|
|
||||||
/* kazoo_dptools.c */
|
/* kazoo_dptools.c */
|
||||||
void add_kz_dptools(switch_loadable_module_interface_t **module_interface, switch_application_interface_t *app_interface);
|
void add_kz_dptools(switch_loadable_module_interface_t **module_interface);
|
||||||
|
|
||||||
/* kazoo_api.c */
|
/* kazoo_api.c */
|
||||||
void add_cli_api(switch_loadable_module_interface_t **module_interface, switch_api_interface_t *api_interface);
|
void add_cli_api(switch_loadable_module_interface_t **module_interface);
|
||||||
void remove_cli_api();
|
void remove_cli_api();
|
||||||
|
|
||||||
/* kazoo_utils.c */
|
/* kazoo_utils.c */
|
||||||
|
/*
|
||||||
SWITCH_DECLARE(switch_status_t) kz_switch_core_merge_variables(switch_event_t *event);
|
SWITCH_DECLARE(switch_status_t) kz_switch_core_merge_variables(switch_event_t *event);
|
||||||
SWITCH_DECLARE(switch_status_t) kz_switch_core_base_headers_for_expand(switch_event_t **event);
|
SWITCH_DECLARE(switch_status_t) kz_switch_core_base_headers_for_expand(switch_event_t **event);
|
||||||
void kz_check_set_profile_var(switch_channel_t *channel, char* var, char *val);
|
void kz_check_set_profile_var(switch_channel_t *channel, char* var, char *val);
|
||||||
|
@ -49,6 +53,7 @@ SWITCH_DECLARE(char *) kz_event_expand_headers(switch_event_t *event, const char
|
||||||
SWITCH_DECLARE(char *) kz_expand(const char *in);
|
SWITCH_DECLARE(char *) kz_expand(const char *in);
|
||||||
SWITCH_DECLARE(char *) kz_expand_pool(switch_memory_pool_t *pool, const char *in);
|
SWITCH_DECLARE(char *) kz_expand_pool(switch_memory_pool_t *pool, const char *in);
|
||||||
switch_status_t kz_json_api(const char * command, cJSON *args, cJSON **res);
|
switch_status_t kz_json_api(const char * command, cJSON *args, cJSON **res);
|
||||||
|
*/
|
||||||
|
|
||||||
/* kazoo_endpoints.c */
|
/* kazoo_endpoints.c */
|
||||||
void add_kz_endpoints(switch_loadable_module_interface_t **module_interface);
|
void add_kz_endpoints(switch_loadable_module_interface_t **module_interface);
|
||||||
|
|
|
@ -112,15 +112,15 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) {
|
||||||
strncpy( (char *)req_b->address_range, gateway->host, sizeof(req_b->address_range));
|
strncpy( (char *)req_b->address_range, gateway->host, sizeof(req_b->address_range));
|
||||||
|
|
||||||
if ( gateway->system_id ) {
|
if ( gateway->system_id ) {
|
||||||
strncpy((char *)req_b->system_id, gateway->system_id, sizeof(req_b->system_id));
|
snprintf((char *)req_b->system_id, sizeof(req_b->system_id), "%s", gateway->system_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( gateway->password ) {
|
if ( gateway->password ) {
|
||||||
strncpy((char *)req_b->password, gateway->password, sizeof(req_b->password));
|
snprintf((char *)req_b->password, sizeof(req_b->password), "%s", gateway->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( gateway->system_type ) {
|
if ( gateway->system_type ) {
|
||||||
strncpy((char *)req_b->system_type, gateway->system_type, sizeof(req_b->system_type));
|
snprintf((char *)req_b->system_type, sizeof(req_b->system_type), "%s", gateway->system_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
req_b->interface_version = SMPP_VERSION;
|
req_b->interface_version = SMPP_VERSION;
|
||||||
|
|
|
@ -117,21 +117,19 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha
|
||||||
context->sfinfo.format |= map->format;
|
context->sfinfo.format |= map->format;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(ext, "r8") || !strcmp(ext, "raw")) {
|
if (!strcmp(ext, "raw")) {
|
||||||
|
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
|
||||||
|
} else if (!strcmp(ext, "r8")) {
|
||||||
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
|
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
|
||||||
context->sfinfo.channels = 1;
|
|
||||||
context->sfinfo.samplerate = 8000;
|
context->sfinfo.samplerate = 8000;
|
||||||
} else if (!strcmp(ext, "r16")) {
|
} else if (!strcmp(ext, "r16")) {
|
||||||
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
|
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
|
||||||
context->sfinfo.channels = 1;
|
|
||||||
context->sfinfo.samplerate = 16000;
|
context->sfinfo.samplerate = 16000;
|
||||||
} else if (!strcmp(ext, "r24")) {
|
} else if (!strcmp(ext, "r24")) {
|
||||||
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_24;
|
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_24;
|
||||||
context->sfinfo.channels = 1;
|
|
||||||
context->sfinfo.samplerate = 24000;
|
context->sfinfo.samplerate = 24000;
|
||||||
} else if (!strcmp(ext, "r32")) {
|
} else if (!strcmp(ext, "r32")) {
|
||||||
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_32;
|
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_32;
|
||||||
context->sfinfo.channels = 1;
|
|
||||||
context->sfinfo.samplerate = 32000;
|
context->sfinfo.samplerate = 32000;
|
||||||
} else if (!strcmp(ext, "gsm")) {
|
} else if (!strcmp(ext, "gsm")) {
|
||||||
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_GSM610;
|
context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_GSM610;
|
||||||
|
@ -269,7 +267,9 @@ static switch_status_t sndfile_file_close(switch_file_handle_t *handle)
|
||||||
{
|
{
|
||||||
sndfile_context *context = handle->private_info;
|
sndfile_context *context = handle->private_info;
|
||||||
|
|
||||||
sf_close(context->handle);
|
if (context) {
|
||||||
|
sf_close(context->handle);
|
||||||
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||||
* Version 3.0.10
|
* Version 3.0.12
|
||||||
*
|
*
|
||||||
* This file is not intended to be easily readable and contains a number of
|
* This file is not intended to be easily readable and contains a number of
|
||||||
* coding conventions designed to improve portability and efficiency. Do not make
|
* coding conventions designed to improve portability and efficiency. Do not make
|
||||||
|
@ -9923,7 +9923,7 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t_xml_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t__event_set___(void * jarg1, void * jarg2) {
|
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t_event__set___(void * jarg1, void * jarg2) {
|
||||||
device_uuid_node_s *arg1 = (device_uuid_node_s *) 0 ;
|
device_uuid_node_s *arg1 = (device_uuid_node_s *) 0 ;
|
||||||
switch_event_t *arg2 = (switch_event_t *) 0 ;
|
switch_event_t *arg2 = (switch_event_t *) 0 ;
|
||||||
|
|
||||||
|
@ -9933,7 +9933,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t__event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t__event_get___(void * jarg1) {
|
SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_device_node_t_event__get___(void * jarg1) {
|
||||||
void * jresult ;
|
void * jresult ;
|
||||||
device_uuid_node_s *arg1 = (device_uuid_node_s *) 0 ;
|
device_uuid_node_s *arg1 = (device_uuid_node_s *) 0 ;
|
||||||
switch_event_t *result = 0 ;
|
switch_event_t *result = 0 ;
|
||||||
|
@ -14573,6 +14573,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_destroy___(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_auto_free___(void * jarg1, char * jarg2, void * jarg3) {
|
||||||
|
int jresult ;
|
||||||
|
switch_hash_t *arg1 = (switch_hash_t *) 0 ;
|
||||||
|
char *arg2 = (char *) 0 ;
|
||||||
|
void *arg3 = (void *) 0 ;
|
||||||
|
switch_status_t result;
|
||||||
|
|
||||||
|
arg1 = (switch_hash_t *)jarg1;
|
||||||
|
arg2 = (char *)jarg2;
|
||||||
|
arg3 = (void *)jarg3;
|
||||||
|
result = (switch_status_t)switch_core_hash_insert_auto_free(arg1,(char const *)arg2,(void const *)arg3);
|
||||||
|
jresult = (int)result;
|
||||||
|
return jresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_destructor___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) {
|
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_hash_insert_destructor___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) {
|
||||||
int jresult ;
|
int jresult ;
|
||||||
switch_hash_t *arg1 = (switch_hash_t *) 0 ;
|
switch_hash_t *arg1 = (switch_hash_t *) 0 ;
|
||||||
|
@ -18603,6 +18619,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_session_start_te
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_core_get_event_channel_key_separator___() {
|
||||||
|
char * jresult ;
|
||||||
|
char *result = 0 ;
|
||||||
|
|
||||||
|
result = (char *)switch_core_get_event_channel_key_separator();
|
||||||
|
jresult = SWIG_csharp_string_callback((const char *)result);
|
||||||
|
return jresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_loadable_module_interface_module_name_set___(void * jarg1, char * jarg2) {
|
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_loadable_module_interface_module_name_set___(void * jarg1, char * jarg2) {
|
||||||
switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ;
|
switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ;
|
||||||
char *arg2 = (char *) 0 ;
|
char *arg2 = (char *) 0 ;
|
||||||
|
@ -28639,7 +28665,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_max_sampl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle__params_set___(void * jarg1, void * jarg2) {
|
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_params__set___(void * jarg1, void * jarg2) {
|
||||||
switch_file_handle *arg1 = (switch_file_handle *) 0 ;
|
switch_file_handle *arg1 = (switch_file_handle *) 0 ;
|
||||||
switch_event_t *arg2 = (switch_event_t *) 0 ;
|
switch_event_t *arg2 = (switch_event_t *) 0 ;
|
||||||
|
|
||||||
|
@ -28649,7 +28675,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle__params_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle__params_get___(void * jarg1) {
|
SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_params__get___(void * jarg1) {
|
||||||
void * jresult ;
|
void * jresult ;
|
||||||
switch_file_handle *arg1 = (switch_file_handle *) 0 ;
|
switch_file_handle *arg1 = (switch_file_handle *) 0 ;
|
||||||
switch_event_t *result = 0 ;
|
switch_event_t *result = 0 ;
|
||||||
|
@ -43480,6 +43506,20 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_leg_get_vars_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_leg_get_var___(void * jarg1, char * jarg2) {
|
||||||
|
char * jresult ;
|
||||||
|
switch_dial_leg_t *arg1 = (switch_dial_leg_t *) 0 ;
|
||||||
|
char *arg2 = (char *) 0 ;
|
||||||
|
char *result = 0 ;
|
||||||
|
|
||||||
|
arg1 = (switch_dial_leg_t *)jarg1;
|
||||||
|
arg2 = (char *)jarg2;
|
||||||
|
result = (char *)switch_dial_leg_get_var(arg1,(char const *)arg2);
|
||||||
|
jresult = SWIG_csharp_string_callback((const char *)result);
|
||||||
|
return jresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_get_total___(void * jarg1) {
|
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_get_total___(void * jarg1) {
|
||||||
int jresult ;
|
int jresult ;
|
||||||
switch_dial_handle_t *arg1 = (switch_dial_handle_t *) 0 ;
|
switch_dial_handle_t *arg1 = (switch_dial_handle_t *) 0 ;
|
||||||
|
@ -43492,15 +43532,21 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_dial_handle_get_total
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge___(void * jarg1, char * jarg2, void * jarg3) {
|
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_ivr_orig_and_bridge___(void * jarg1, char * jarg2, void * jarg3, void * jarg4) {
|
||||||
|
int jresult ;
|
||||||
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
|
||||||
char *arg2 = (char *) 0 ;
|
char *arg2 = (char *) 0 ;
|
||||||
switch_dial_handle_t *arg3 = (switch_dial_handle_t *) 0 ;
|
switch_dial_handle_t *arg3 = (switch_dial_handle_t *) 0 ;
|
||||||
|
switch_call_cause_t *arg4 = (switch_call_cause_t *) 0 ;
|
||||||
|
switch_status_t result;
|
||||||
|
|
||||||
arg1 = (switch_core_session_t *)jarg1;
|
arg1 = (switch_core_session_t *)jarg1;
|
||||||
arg2 = (char *)jarg2;
|
arg2 = (char *)jarg2;
|
||||||
arg3 = (switch_dial_handle_t *)jarg3;
|
arg3 = (switch_dial_handle_t *)jarg3;
|
||||||
switch_ivr_orig_and_bridge(arg1,(char const *)arg2,arg3);
|
arg4 = (switch_call_cause_t *)jarg4;
|
||||||
|
result = (switch_status_t)switch_ivr_orig_and_bridge(arg1,(char const *)arg2,arg3,arg4);
|
||||||
|
jresult = (int)result;
|
||||||
|
return jresult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -119,7 +119,7 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c || ((ftdNumber == 1 && (a || b || c)) && (a && (b || c)))) {
|
if (c || ((ftdNumber == 1 && (a || b || c)) && (a && (b || c))) || (a == 0 && b == 1 && c == 0) ) {
|
||||||
/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "a=%d b=[%d] c=%d\n",a, b,c);*/
|
/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "a=%d b=[%d] c=%d\n",a, b,c);*/
|
||||||
int fVal = c;
|
int fVal = c;
|
||||||
if (ftdNumber == 1)
|
if (ftdNumber == 1)
|
||||||
|
|
|
@ -2369,6 +2369,20 @@ static void switch_load_core_config(const char *file)
|
||||||
} else {
|
} else {
|
||||||
switch_clear_flag((&runtime), SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY);
|
switch_clear_flag((&runtime), SCF_EVENT_CHANNEL_ENABLE_HIERARCHY_DELIVERY);
|
||||||
}
|
}
|
||||||
|
} else if (!strcasecmp(var, "event-channel-hierarchy-deliver-once") && !zstr(val)) {
|
||||||
|
int v = switch_true(val);
|
||||||
|
if (v) {
|
||||||
|
switch_set_flag((&runtime), SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE);
|
||||||
|
} else {
|
||||||
|
switch_clear_flag((&runtime), SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE);
|
||||||
|
}
|
||||||
|
} else if (!strcasecmp(var, "event-channel-log-undeliverable-json") && !zstr(val)) {
|
||||||
|
int v = switch_true(val);
|
||||||
|
if (v) {
|
||||||
|
switch_set_flag((&runtime), SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON);
|
||||||
|
} else {
|
||||||
|
switch_clear_flag((&runtime), SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,10 @@ SWITCH_DECLARE(void) switch_ssl_destroy_ssl_locks(void)
|
||||||
OPENSSL_free(ssl_mutexes);
|
OPENSSL_free(ssl_mutexes);
|
||||||
ssl_count--;
|
ssl_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ssl_pool) {
|
||||||
|
switch_core_destroy_memory_pool(&ssl_pool);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const EVP_MD *get_evp_by_name(const char *name)
|
static const EVP_MD *get_evp_by_name(const char *name)
|
||||||
|
|
|
@ -915,6 +915,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_pre_close(switch_file_handle_t
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_clear_flag_locked(fh, SWITCH_FILE_OPEN);
|
switch_clear_flag_locked(fh, SWITCH_FILE_OPEN);
|
||||||
|
switch_set_flag_locked(fh, SWITCH_FILE_PRE_CLOSED);
|
||||||
|
|
||||||
if (fh->file_interface->file_pre_close) {
|
if (fh->file_interface->file_pre_close) {
|
||||||
status = fh->file_interface->file_pre_close(fh);
|
status = fh->file_interface->file_pre_close(fh);
|
||||||
|
@ -929,8 +930,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
|
||||||
|
|
||||||
if (switch_test_flag(fh, SWITCH_FILE_OPEN)) {
|
if (switch_test_flag(fh, SWITCH_FILE_OPEN)) {
|
||||||
status = switch_core_file_pre_close(fh);
|
status = switch_core_file_pre_close(fh);
|
||||||
|
} else if (!switch_test_flag(fh, SWITCH_FILE_PRE_CLOSED)) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_clear_flag_locked(fh, SWITCH_FILE_PRE_CLOSED);
|
||||||
|
|
||||||
fh->file_interface->file_close(fh);
|
fh->file_interface->file_close(fh);
|
||||||
|
|
||||||
if (fh->params) {
|
if (fh->params) {
|
||||||
|
|
|
@ -55,6 +55,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t **hash)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t *hash, const char *key, const void *data)
|
||||||
|
{
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
|
r = switch_hashtable_insert_destructor(hash, strdup(key), (void *)data, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE | HASHTABLE_DUP_CHECK, NULL);
|
||||||
|
|
||||||
|
return r ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(switch_hash_t *hash, const char *key, const void *data, hashtable_destructor_t destructor)
|
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(switch_hash_t *hash, const char *key, const void *data, hashtable_destructor_t destructor)
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
|
@ -1127,6 +1127,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
|
||||||
int i, argc;
|
int i, argc;
|
||||||
char *argv[256];
|
char *argv[256];
|
||||||
int dur_total = 0;
|
int dur_total = 0;
|
||||||
|
int rate_mult = 8;
|
||||||
|
|
||||||
|
switch_codec_implementation_t write_impl = { 0 };
|
||||||
|
|
||||||
switch_assert(session != NULL);
|
switch_assert(session != NULL);
|
||||||
|
|
||||||
|
@ -1156,13 +1159,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
|
||||||
switch_channel_pre_answer(session->channel);
|
switch_channel_pre_answer(session->channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_core_session_get_write_impl(session, &write_impl);
|
||||||
|
rate_mult = (write_impl.actual_samples_per_second / 1000);
|
||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
dtmf.duration = switch_core_default_dtmf_duration(0);
|
dtmf.duration = switch_core_default_dtmf_duration(0);
|
||||||
dur = switch_core_default_dtmf_duration(0) / 8;
|
dur = switch_core_default_dtmf_duration(0) / rate_mult;
|
||||||
if ((p = strchr(argv[i], '@'))) {
|
if ((p = strchr(argv[i], '@'))) {
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
if ((dur = atoi(p)) > (int)switch_core_min_dtmf_duration(0) / 8) {
|
if ((dur = atoi(p)) > (int)switch_core_min_dtmf_duration(0) / rate_mult) {
|
||||||
dtmf.duration = dur * 8;
|
dtmf.duration = dur * rate_mult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1192,14 +1198,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
|
||||||
switch_channel_get_name(session->channel), dtmf.digit, dur, dtmf.duration);
|
switch_channel_get_name(session->channel), dtmf.digit, dur, dtmf.duration);
|
||||||
sent++;
|
sent++;
|
||||||
dur_total += dtmf.duration + 2000; /* account for 250ms pause */
|
dur_total += dtmf.duration + (250 * rate_mult); /* account for 250ms pause */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dur_total) {
|
if (dur_total) {
|
||||||
char tmp[32] = "";
|
char tmp[32] = "";
|
||||||
switch_snprintf(tmp, sizeof(tmp), "%d", dur_total / 8);
|
switch_snprintf(tmp, sizeof(tmp), "%d", dur_total / rate_mult);
|
||||||
switch_channel_set_variable(session->channel, "last_dtmf_duration", tmp);
|
switch_channel_set_variable(session->channel, "last_dtmf_duration", tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14069,7 +14069,9 @@ SWITCH_DECLARE(void) switch_core_media_init(void)
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_core_media_deinit(void)
|
SWITCH_DECLARE(void) switch_core_media_deinit(void)
|
||||||
{
|
{
|
||||||
switch_core_destroy_memory_pool(&video_globals.pool);
|
if (video_globals.pool) {
|
||||||
|
switch_core_destroy_memory_pool(&video_globals.pool);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int payload_number(const char *name)
|
static int payload_number(const char *name)
|
||||||
|
|
|
@ -3822,6 +3822,14 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
|
||||||
skip:
|
skip:
|
||||||
|
|
||||||
if (sql_manager.manage) {
|
if (sql_manager.manage) {
|
||||||
|
/* Initiate switch_sql_queue_manager */
|
||||||
|
switch_threadattr_create(&thd_attr, sql_manager.memory_pool);
|
||||||
|
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||||
|
switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME);
|
||||||
|
switch_core_sqldb_start_thread();
|
||||||
|
switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool);
|
||||||
|
|
||||||
|
/* switch_sql_queue_manager initiated, now we can bind to core_event_handler */
|
||||||
#ifdef SWITCH_SQL_BIND_EVERY_EVENT
|
#ifdef SWITCH_SQL_BIND_EVERY_EVENT
|
||||||
switch_event_bind("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
|
switch_event_bind("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
|
||||||
#else
|
#else
|
||||||
|
@ -3851,13 +3859,6 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
|
||||||
switch_event_bind("core_db", SWITCH_EVENT_NAT, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
|
switch_event_bind("core_db", SWITCH_EVENT_NAT, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
|
||||||
switch_event_bind("core_db", SWITCH_EVENT_CODEC, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
|
switch_event_bind("core_db", SWITCH_EVENT_CODEC, SWITCH_EVENT_SUBCLASS_ANY, core_event_handler, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch_threadattr_create(&thd_attr, sql_manager.memory_pool);
|
|
||||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
|
||||||
switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME);
|
|
||||||
switch_core_sqldb_start_thread();
|
|
||||||
switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_cache_db_release_db_handle(&sql_manager.dbh);
|
switch_cache_db_release_db_handle(&sql_manager.dbh);
|
||||||
|
|
|
@ -2934,17 +2934,21 @@ static void ecd_deliver(event_channel_data_t **ecdP)
|
||||||
const char *sep = switch_core_get_event_channel_key_separator();
|
const char *sep = switch_core_get_event_channel_key_separator();
|
||||||
char *x_argv[SWITCH_CHANNEL_DISPATCH_MAX_KEY_PARTS] = { 0 };
|
char *x_argv[SWITCH_CHANNEL_DISPATCH_MAX_KEY_PARTS] = { 0 };
|
||||||
int x_argc = switch_separate_string_string(key, (char*) sep, x_argv, SWITCH_CHANNEL_DISPATCH_MAX_KEY_PARTS);
|
int x_argc = switch_separate_string_string(key, (char*) sep, x_argv, SWITCH_CHANNEL_DISPATCH_MAX_KEY_PARTS);
|
||||||
char buf[512];
|
char buf[1024];
|
||||||
int i;
|
int i, r;
|
||||||
for(i=x_argc - 1; i > 0; i--) {
|
for(i=x_argc - 1; i > 0; i--) {
|
||||||
int z;
|
int z;
|
||||||
memset(buf, 0, 512);
|
memset(buf, 0, 1024);
|
||||||
sprintf(buf, "%s", x_argv[0]);
|
sprintf(buf, "%s", x_argv[0]);
|
||||||
for(z=1; z < i; z++) {
|
for(z=1; z < i; z++) {
|
||||||
strcat(buf, sep);
|
strcat(buf, sep);
|
||||||
strcat(buf, x_argv[z]);
|
strcat(buf, x_argv[z]);
|
||||||
}
|
}
|
||||||
t += _switch_event_channel_broadcast(buf, ecd->event_channel, ecd->json, ecd->key, ecd->id);
|
r = _switch_event_channel_broadcast(buf, ecd->event_channel, ecd->json, ecd->key, ecd->id);
|
||||||
|
t += r;
|
||||||
|
if (r && switch_core_test_flag(SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
@ -2958,7 +2962,13 @@ static void ecd_deliver(event_channel_data_t **ecdP)
|
||||||
t += _switch_event_channel_broadcast(SWITCH_EVENT_CHANNEL_GLOBAL, ecd->event_channel, ecd->json, ecd->key, ecd->id);
|
t += _switch_event_channel_broadcast(SWITCH_EVENT_CHANNEL_GLOBAL, ecd->event_channel, ecd->json, ecd->key, ecd->id);
|
||||||
|
|
||||||
if(t == 0) {
|
if(t == 0) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no subscribers for %s , %s\n", ecd->event_channel, ecd->key);
|
if (switch_core_test_flag(SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON)) {
|
||||||
|
char *json = cJSON_Print(ecd->json);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no subscribers for %s , %s => %s\n", ecd->event_channel, ecd->key, json);
|
||||||
|
switch_safe_free(json);
|
||||||
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no subscribers for %s , %s\n", ecd->event_channel, ecd->key);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "delivered to %u subscribers for %s\n", t, ecd->event_channel);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "delivered to %u subscribers for %s\n", t, ecd->event_channel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1099,7 +1099,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bridge_bleg(switch_core_session_t *se
|
||||||
switch_channel_clear_flag(channel, CF_ARRANGED_BRIDGE);
|
switch_channel_clear_flag(channel, CF_ARRANGED_BRIDGE);
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
} else {
|
} else {
|
||||||
audio_bridge_on_exchange_media(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
if (!switch_channel_test_flag(channel, CF_TRANSFER)) {
|
||||||
|
audio_bridge_on_exchange_media(session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
|
@ -4383,6 +4383,12 @@ SWITCH_DECLARE(switch_event_t *) switch_dial_leg_get_vars(switch_dial_leg_t *leg
|
||||||
return leg->leg_vars;
|
return leg->leg_vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(const char *) switch_dial_leg_get_var(switch_dial_leg_t *leg, const char *key)
|
||||||
|
{
|
||||||
|
switch_assert(leg);
|
||||||
|
|
||||||
|
return switch_event_get_header(leg->leg_vars, key);
|
||||||
|
}
|
||||||
|
|
||||||
static switch_status_t vars_serialize_json_obj(switch_event_t *event, cJSON **json)
|
static switch_status_t vars_serialize_json_obj(switch_event_t *event, cJSON **json)
|
||||||
{
|
{
|
||||||
|
@ -4559,32 +4565,31 @@ static switch_status_t o_bridge_on_dtmf(switch_core_session_t *session, void *in
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh)
|
SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause)
|
||||||
{
|
{
|
||||||
switch_channel_t *caller_channel = switch_core_session_get_channel(session);
|
switch_channel_t *caller_channel = switch_core_session_get_channel(session);
|
||||||
switch_core_session_t *peer_session = NULL;
|
switch_core_session_t *peer_session = NULL;
|
||||||
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
|
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
int fail = 0;
|
int fail = 0;
|
||||||
|
|
||||||
if ((status = switch_ivr_originate(session,
|
if ((status = switch_ivr_originate(session,
|
||||||
&peer_session,
|
&peer_session,
|
||||||
&cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, dh)) != SWITCH_STATUS_SUCCESS) {
|
cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, dh)) != SWITCH_STATUS_SUCCESS) {
|
||||||
fail = 1;
|
fail = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (fail) {
|
if (fail) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n", switch_channel_cause2str(cause));
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n", switch_channel_cause2str(*cause));
|
||||||
|
|
||||||
switch_channel_set_variable(caller_channel, "originate_failed_cause", switch_channel_cause2str(cause));
|
switch_channel_set_variable(caller_channel, "originate_failed_cause", switch_channel_cause2str(*cause));
|
||||||
|
|
||||||
switch_channel_handle_cause(caller_channel, cause);
|
switch_channel_handle_cause(caller_channel, *cause);
|
||||||
|
|
||||||
return;
|
return status;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
|
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
|
||||||
|
|
||||||
if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) ||
|
if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) ||
|
||||||
switch_true(switch_channel_get_variable(peer_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) {
|
switch_true(switch_channel_get_variable(peer_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) {
|
||||||
switch_channel_set_flag(caller_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
|
switch_channel_set_flag(caller_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
|
||||||
|
@ -4620,6 +4625,8 @@ SWITCH_DECLARE(void) switch_ivr_orig_and_bridge(switch_core_session_t *session,
|
||||||
switch_core_session_rwunlock(peer_session);
|
switch_core_session_rwunlock(peer_session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,6 @@
|
||||||
|
|
||||||
#define MSRP_BUFF_SIZE (SWITCH_RTP_MAX_BUF_LEN - 32)
|
#define MSRP_BUFF_SIZE (SWITCH_RTP_MAX_BUF_LEN - 32)
|
||||||
#define DEBUG_MSRP 0
|
#define DEBUG_MSRP 0
|
||||||
#define MSRP_LISTEN_PORT 2855
|
|
||||||
#define MSRP_SSL_LISTEN_PORT 2856
|
|
||||||
|
|
||||||
struct msrp_socket_s {
|
struct msrp_socket_s {
|
||||||
switch_port_t port;
|
switch_port_t port;
|
||||||
|
@ -108,6 +106,10 @@ static void msrp_deinit_ssl()
|
||||||
SSL_CTX_free(globals.ssl_ctx);
|
SSL_CTX_free(globals.ssl_ctx);
|
||||||
globals.ssl_ctx = NULL;
|
globals.ssl_ctx = NULL;
|
||||||
}
|
}
|
||||||
|
if (globals.ssl_client_ctx) {
|
||||||
|
SSL_CTX_free(globals.ssl_client_ctx);
|
||||||
|
globals.ssl_client_ctx = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void msrp_init_ssl()
|
static void msrp_init_ssl()
|
||||||
|
@ -293,35 +295,41 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_init()
|
||||||
memset(&globals, 0, sizeof(globals));
|
memset(&globals, 0, sizeof(globals));
|
||||||
set_global_ip("0.0.0.0");
|
set_global_ip("0.0.0.0");
|
||||||
globals.pool = pool;
|
globals.pool = pool;
|
||||||
globals.msock.port = (switch_port_t)MSRP_LISTEN_PORT;
|
globals.msock.port = (switch_port_t)0;
|
||||||
globals.msock_ssl.port = (switch_port_t)MSRP_SSL_LISTEN_PORT;
|
globals.msock_ssl.port = (switch_port_t)0;
|
||||||
globals.msock_ssl.secure = 1;
|
globals.msock_ssl.secure = 1;
|
||||||
globals.message_buffer_size = 50;
|
globals.message_buffer_size = 50;
|
||||||
globals.debug = DEBUG_MSRP;
|
globals.debug = DEBUG_MSRP;
|
||||||
|
|
||||||
load_config();
|
load_config();
|
||||||
|
|
||||||
globals.running = 1;
|
if (globals.msock.port) {
|
||||||
|
globals.running = 1;
|
||||||
|
|
||||||
status = msock_init(globals.ip, globals.msock.port, &globals.msock.sock, pool);
|
status = msock_init(globals.ip, globals.msock.port, &globals.msock.sock, pool);
|
||||||
|
|
||||||
if (status == SWITCH_STATUS_SUCCESS) {
|
if (status == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_threadattr_create(&thd_attr, pool);
|
switch_threadattr_create(&thd_attr, pool);
|
||||||
// switch_threadattr_detach_set(thd_attr, 1);
|
// switch_threadattr_detach_set(thd_attr, 1);
|
||||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||||
switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock, pool);
|
switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock, pool);
|
||||||
globals.msock.thread = thread;
|
globals.msock.thread = thread;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msrp_init_ssl();
|
if (globals.msock_ssl.port) {
|
||||||
status = msock_init(globals.ip, globals.msock_ssl.port, &globals.msock_ssl.sock, pool);
|
globals.running = 1;
|
||||||
|
|
||||||
if (status == SWITCH_STATUS_SUCCESS) {
|
msrp_init_ssl();
|
||||||
switch_threadattr_create(&thd_attr, pool);
|
status = msock_init(globals.ip, globals.msock_ssl.port, &globals.msock_ssl.sock, pool);
|
||||||
// switch_threadattr_detach_set(thd_attr, 1);
|
|
||||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
if (status == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock_ssl, pool);
|
switch_threadattr_create(&thd_attr, pool);
|
||||||
globals.msock_ssl.thread = thread;
|
// switch_threadattr_detach_set(thd_attr, 1);
|
||||||
|
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||||
|
switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock_ssl, pool);
|
||||||
|
globals.msock_ssl.thread = thread;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
|
@ -9039,7 +9039,6 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
|
||||||
data = frame->data;
|
data = frame->data;
|
||||||
len = frame->datalen;
|
len = frame->datalen;
|
||||||
ts = rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] ? (uint32_t) frame->timestamp : 0;
|
ts = rtp_session->flags[SWITCH_RTP_FLAG_RAW_WRITE] ? (uint32_t) frame->timestamp : 0;
|
||||||
if (!ts) ts = rtp_session->last_write_ts + rtp_session->samples_per_interval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue