mirror of
https://github.com/asterisk/asterisk.git
synced 2025-08-20 04:33:20 +00:00
Compare commits
90 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b633f5ac94 | ||
|
7c8dd167eb | ||
|
80b3a952e0 | ||
|
404c4a6820 | ||
|
8e0f992505 | ||
|
801966afa9 | ||
|
d3d8257106 | ||
|
1e98c8d5c8 | ||
|
a091e15985 | ||
|
a13b54df83 | ||
|
13cae45bb5 | ||
|
c6d6dd133c | ||
|
1c648c3ebe | ||
|
4c941e856b | ||
|
bacd5521a0 | ||
|
0a939b274e | ||
|
6acd3e3f35 | ||
|
ca81c80ca0 | ||
|
9d2c6bf0f5 | ||
|
7b52be6019 | ||
|
97d18e8649 | ||
|
0f4f2c6884 | ||
|
67da18293f | ||
|
82e513d699 | ||
|
35de18d636 | ||
|
fc8ac2fd17 | ||
|
75acfb0168 | ||
|
169bfc9b55 | ||
|
d5ea628298 | ||
|
de456d5e31 | ||
|
bc876e50f1 | ||
|
31fa14264b | ||
|
885945af03 | ||
|
672a1a5854 | ||
|
3facd0febb | ||
|
29358ce602 | ||
|
27dcb25612 | ||
|
cab2e4514e | ||
|
c4ef22b5f7 | ||
|
6e78b5c257 | ||
|
1bae929f5c | ||
|
76418b5666 | ||
|
bda53c1fe8 | ||
|
a23b33576f | ||
|
e11354b864 | ||
|
24fac2271a | ||
|
52c101d441 | ||
|
edae56dc65 | ||
|
a2b03cf0b4 | ||
|
7244ff1ccd | ||
|
205e2ea351 | ||
|
bc085bba24 | ||
|
9a800b24ac | ||
|
137aa2f13c | ||
|
f877e62cc9 | ||
|
b17ee86148 | ||
|
9528429f4c | ||
|
9cdf44668d | ||
|
73d39f2029 | ||
|
e8a97775ee | ||
|
345409825a | ||
|
105c1168f7 | ||
|
8927b52634 | ||
|
fc68258037 | ||
|
9a95c6dea3 | ||
|
aaee8160bc | ||
|
72e2d978ac | ||
|
1877d36c95 | ||
|
7af0eac02a | ||
|
ef0bf47bb3 | ||
|
be8fa4a81d | ||
|
a1d6b14c40 | ||
|
a783e1e60d | ||
|
9c56f798f6 | ||
|
01ee54ea1c | ||
|
1ad00c1c30 | ||
|
815b6f72f8 | ||
|
c95b611a73 | ||
|
bc94ccbcdd | ||
|
de9145e0fe | ||
|
a7233fbf3e | ||
|
c327430ea0 | ||
|
763a18bc9d | ||
|
ce6898bd3c | ||
|
ebc477aa5d | ||
|
1838b283aa | ||
|
f196cf975d | ||
|
699a7390eb | ||
|
4b17a11d7d | ||
|
bb9dcae98c |
1
.lastclean
Normal file
1
.lastclean
Normal file
@@ -0,0 +1 @@
|
||||
40
|
26
CHANGES
26
CHANGES
@@ -8,6 +8,21 @@
|
||||
===
|
||||
==============================================================================
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
--- Functionality changes from Asterisk 14.0.0 to Asterisk 14.0.1 ----------
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Build System
|
||||
------------------
|
||||
* The res_digium_phone, codec_g729a, codec_silk, codec_siren7 and
|
||||
codec_siren14 binary modules hosted at downloads.digium.com can now be
|
||||
automatically downloaded and installed during the Asterisk install
|
||||
process. If selected in menuselect, when 'make install' is run, the
|
||||
script will check the downloads site for a new version and download
|
||||
and install it if needed. The '--with-externals-cache' option to
|
||||
./configure can be used to specify a location to cache the latest
|
||||
tarballs so they don't have to be re-downloaded for every install.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
--- Functionality changes from Asterisk 13 to Asterisk 14 --------------------
|
||||
------------------------------------------------------------------------------
|
||||
@@ -243,12 +258,11 @@ Core
|
||||
- 'media cache delete <item>' - remove an item from the cache
|
||||
- 'media cache create <uri>' - retrieve a URI and store it in the cache
|
||||
|
||||
* The ability for hints to be automatically created as a result of device state
|
||||
changes now exists in the PBX. This functionality is referred to as "autohints"
|
||||
and is configurable in extensions.conf by placing "autohints=yes" in the
|
||||
context. If enabled then a hint will be automatically created with the name of
|
||||
the device.
|
||||
|
||||
* The ability for device state hints to be automatically created as a result of
|
||||
device state changes now exists in the PBX. This functionality is referred to
|
||||
as "autohints" and is configurable in extensions.conf by placing "autohints=yes"
|
||||
in the context. If enabled a device state hint will be automatically created
|
||||
with the name of the device.
|
||||
|
||||
Functions
|
||||
------------------
|
||||
|
7
Makefile
7
Makefile
@@ -618,9 +618,10 @@ $(SUBDIRS_INSTALL):
|
||||
|
||||
NEWMODS:=$(foreach d,$(MOD_SUBDIRS),$(notdir $(wildcard $(d)/*.so)))
|
||||
OLDMODS=$(filter-out $(NEWMODS) $(notdir $(DESTDIR)$(ASTMODDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTMODDIR)/*.so)))
|
||||
BADMODS=$(strip $(filter-out $(shell ./build_tools/list_valid_installed_externals),$(OLDMODS)))
|
||||
|
||||
oldmodcheck:
|
||||
@if [ -n "$(OLDMODS)" ]; then \
|
||||
@if [ -n "$(BADMODS)" ]; then \
|
||||
echo " WARNING WARNING WARNING" ;\
|
||||
echo "" ;\
|
||||
echo " Your Asterisk modules directory, located at" ;\
|
||||
@@ -630,7 +631,7 @@ oldmodcheck:
|
||||
echo " modules are compatible with this version before" ;\
|
||||
echo " attempting to run Asterisk." ;\
|
||||
echo "" ;\
|
||||
for f in $(OLDMODS); do \
|
||||
for f in $(BADMODS); do \
|
||||
echo " $$f" ;\
|
||||
done ;\
|
||||
echo "" ;\
|
||||
@@ -980,7 +981,7 @@ menuselect/nmenuselect: menuselect/makeopts .lastclean
|
||||
menuselect/makeopts: makeopts .lastclean
|
||||
+$(MAKE_MENUSELECT) makeopts
|
||||
|
||||
menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml utils/utils.xml agi/agi.xml configure makeopts
|
||||
menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc) $(wildcard $(dir)/*.xml)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml utils/utils.xml agi/agi.xml configure makeopts
|
||||
@echo "Generating input for menuselect ..."
|
||||
@echo "<?xml version=\"1.0\"?>" > $@
|
||||
@echo >> $@
|
||||
|
@@ -146,6 +146,18 @@ clean::
|
||||
install:: all
|
||||
@echo "Installing modules from `basename $(CURDIR)`..."
|
||||
@for x in $(LOADABLE_MODS:%=%.so); do $(INSTALL) -m 755 $$x "$(DESTDIR)$(ASTMODDIR)" ; done
|
||||
ifneq ($(findstring :,$(XMLSTARLET)$(BASH)),:)
|
||||
@if [ -f .moduleinfo ] ; then \
|
||||
declare -A DISABLED_MODS ;\
|
||||
for x in $(MENUSELECT_$(MENUSELECT_CATEGORY)) ; do DISABLED_MODS[$${x}]=1 ; done ;\
|
||||
EXTERNAL_MODS=$$(xmlstarlet sel -t -m "/category/member[support_level = 'external']" -v "@name" -n .moduleinfo) ;\
|
||||
for x in $${EXTERNAL_MODS} ; do \
|
||||
if [ -z "$${DISABLED_MODS[$${x}]}" ] ; then \
|
||||
$(ASTTOPDIR)/build_tools/download_externals $${x} ;\
|
||||
fi ;\
|
||||
done ;\
|
||||
fi
|
||||
endif
|
||||
|
||||
uninstall::
|
||||
|
||||
|
41
asterisk-14.0.1-summary.html
Normal file
41
asterisk-14.0.1-summary.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><title>Release Summary - asterisk-14.0.1</title><h1 align="center"><a name="top">Release Summary</a></h1><h3 align="center">asterisk-14.0.1</h3><h3 align="center">Date: 2016-09-27</h3><h3 align="center"><asteriskteam@digium.com></h3><hr><h2 align="center">Table of Contents</h2><ol>
|
||||
<li><a href="#summary">Summary</a></li>
|
||||
<li><a href="#contributors">Contributors</a></li>
|
||||
<li><a href="#open_issues">Open Issues</a></li>
|
||||
<li><a href="#commits">Other Changes</a></li>
|
||||
<li><a href="#diffstat">Diffstat</a></li>
|
||||
</ol><hr><a name="summary"><h2 align="center">Summary</h2></a><center><a href="#top">[Back to Top]</a></center><p>This release is a point release of an existing major version. The changes included were made to address problems that have been identified in this release series, or are minor, backwards compatible new features or improvements. Users should be able to safely upgrade to this version if this release series is already in use. Users considering upgrading from a previous version are strongly encouraged to review the UPGRADE.txt document as well as the CHANGES document for information about upgrading to this release series.</p><p>The data in this summary reflects changes that have been made since the previous release, asterisk-14.0.0.</p><hr><a name="contributors"><h2 align="center">Contributors</h2></a><center><a href="#top">[Back to Top]</a></center><p>This table lists the people who have submitted code, those that have tested patches, as well as those that reported issues on the issue tracker that were resolved in this release. For coders, the number is how many of their patches (of any size) were committed into this release. For testers, the number is the number of times their name was listed as assisting with testing a patch. Finally, for reporters, the number is the number of issues that they reported that were affected by commits that went into this release.</p><table width="100%" border="0">
|
||||
<tr><th width="33%">Coders</th><th width="33%">Testers</th><th width="33%">Reporters</th></tr>
|
||||
<tr valign="top"><td width="33%">5 gtjoseph <gjoseph@digium.com><br/>4 Kevin Harwell <kharwell@digium.com><br/></td><td width="33%"><td width="33%">3 Kevin Harwell <kharwell@digium.com><br/></td></tr>
|
||||
</table><hr><a name="open_issues"><h2 align="center">Open Issues</h2></a><center><a href="#top">[Back to Top]</a></center><p>This is a list of all open issues from the issue tracker that were referenced by changes that went into this release.</p><h3>Improvement</h3><h4>Category: Resources/res_format_attr_opus</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-26409">ASTERISK-26409</a>: codec_opus: Update Asterisk to support the translation codec.<br/>Reported by: Kevin Harwell<ul>
|
||||
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=d3d82571068f6830604201c2b7aff86305e97760">[d3d8257106]</a> gtjoseph -- codec_opus: Add download ability to menuselect</li>
|
||||
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=1e98c8d5c868e433efd2c0521bd3eb9e0162baaa">[1e98c8d5c8]</a> gtjoseph -- codec_opus: Replace res_format_attr_opus with the one from codec_opus</li>
|
||||
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=a091e15985794539d120795e7b4dbf2bc7f449ea">[a091e15985]</a> gtjoseph -- format_ogg_opus: New format</li>
|
||||
</ul><br><hr><a name="commits"><h2 align="center">Commits Not Associated with an Issue</h2></a><center><a href="#top">[Back to Top]</a></center><p>This is a list of all changes that went into this release that did not reference a JIRA issue.</p><table width="100%" border="1">
|
||||
<tr><th>Revision</th><th>Author</th><th>Summary</th></tr>
|
||||
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=80b3a952e038be199abd6de0a7f5cb5a524e4b2b">80b3a952e0</a></td><td>Kevin Harwell</td><td>Release summaries: Remove previous versions</td></tr>
|
||||
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=404c4a6820ce1748389832927a429eb3c655174a">404c4a6820</a></td><td>Kevin Harwell</td><td>.version: Update for 14.0.1</td></tr>
|
||||
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=8e0f992505d58f7dec99bb828c9be5af8530d602">8e0f992505</a></td><td>Kevin Harwell</td><td>.lastclean: Update for 14.0.1</td></tr>
|
||||
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=801966afa9d5b188deaeaa29e6e1fe3e5cbe912e">801966afa9</a></td><td>Kevin Harwell</td><td>realtime: Add database scripts for 14.0.1</td></tr>
|
||||
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=a13b54df83a352dece6f2750c61b9399b78c8968">a13b54df83</a></td><td>gtjoseph</td><td>build_tools: Add ability to download variants to download_externals</td></tr>
|
||||
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=13cae45bb5aa072780bb6645f2146fce7edb9935">13cae45bb5</a></td><td>gtjoseph</td><td>build: Add download capability for external packages</td></tr>
|
||||
</table><hr><a name="diffstat"><h2 align="center">Diffstat Results</h2></a><center><a href="#top">[Back to Top]</a></center><p>This is a summary of the changes to the source code that went into this release that was generated using the diffstat utility.</p><pre>asterisk-14.0.0-summary.html | 4318 -----------
|
||||
asterisk-14.0.0-summary.txt |10112 ---------------------------
|
||||
b/.version | 2
|
||||
b/CHANGES | 15
|
||||
b/Makefile | 7
|
||||
b/Makefile.moddir_rules | 12
|
||||
b/build_tools/download_externals | 224
|
||||
b/build_tools/list_valid_installed_externals | 55
|
||||
b/build_tools/make_version | 4
|
||||
b/build_tools/menuselect-deps.in | 3
|
||||
b/codecs/codecs.xml | 32
|
||||
b/configure | 234
|
||||
b/configure.ac | 24
|
||||
b/formats/format_ogg_opus.c | 229
|
||||
b/include/asterisk/autoconfig.h.in | 3
|
||||
b/include/asterisk/opus.h | 51
|
||||
b/makeopts.in | 5
|
||||
b/res/res.xml | 13
|
||||
b/res/res_format_attr_opus.c | 304
|
||||
19 files changed, 1040 insertions(+), 14607 deletions(-)</pre><br></html>
|
134
asterisk-14.0.1-summary.txt
Normal file
134
asterisk-14.0.1-summary.txt
Normal file
@@ -0,0 +1,134 @@
|
||||
Release Summary
|
||||
|
||||
asterisk-14.0.1
|
||||
|
||||
Date: 2016-09-27
|
||||
|
||||
<asteriskteam@digium.com>
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Table of Contents
|
||||
|
||||
1. Summary
|
||||
2. Contributors
|
||||
3. Open Issues
|
||||
4. Other Changes
|
||||
5. Diffstat
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Summary
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This release is a point release of an existing major version. The changes
|
||||
included were made to address problems that have been identified in this
|
||||
release series, or are minor, backwards compatible new features or
|
||||
improvements. Users should be able to safely upgrade to this version if
|
||||
this release series is already in use. Users considering upgrading from a
|
||||
previous version are strongly encouraged to review the UPGRADE.txt
|
||||
document as well as the CHANGES document for information about upgrading
|
||||
to this release series.
|
||||
|
||||
The data in this summary reflects changes that have been made since the
|
||||
previous release, asterisk-14.0.0.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Contributors
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This table lists the people who have submitted code, those that have
|
||||
tested patches, as well as those that reported issues on the issue tracker
|
||||
that were resolved in this release. For coders, the number is how many of
|
||||
their patches (of any size) were committed into this release. For testers,
|
||||
the number is the number of times their name was listed as assisting with
|
||||
testing a patch. Finally, for reporters, the number is the number of
|
||||
issues that they reported that were affected by commits that went into
|
||||
this release.
|
||||
|
||||
Coders Testers Reporters
|
||||
5 gtjoseph 3 Kevin Harwell
|
||||
4 Kevin Harwell
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Open Issues
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This is a list of all open issues from the issue tracker that were
|
||||
referenced by changes that went into this release.
|
||||
|
||||
Improvement
|
||||
|
||||
Category: Resources/res_format_attr_opus
|
||||
|
||||
ASTERISK-26409: codec_opus: Update Asterisk to support the translation
|
||||
codec.
|
||||
Reported by: Kevin Harwell
|
||||
* [d3d8257106] gtjoseph -- codec_opus: Add download ability to
|
||||
menuselect
|
||||
* [1e98c8d5c8] gtjoseph -- codec_opus: Replace res_format_attr_opus with
|
||||
the one from codec_opus
|
||||
* [a091e15985] gtjoseph -- format_ogg_opus: New format
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Commits Not Associated with an Issue
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This is a list of all changes that went into this release that did not
|
||||
reference a JIRA issue.
|
||||
|
||||
+------------------------------------------------------------------------+
|
||||
| Revision | Author | Summary |
|
||||
|------------+---------------+-------------------------------------------|
|
||||
| 80b3a952e0 | Kevin Harwell | Release summaries: Remove previous |
|
||||
| | | versions |
|
||||
|------------+---------------+-------------------------------------------|
|
||||
| 404c4a6820 | Kevin Harwell | .version: Update for 14.0.1 |
|
||||
|------------+---------------+-------------------------------------------|
|
||||
| 8e0f992505 | Kevin Harwell | .lastclean: Update for 14.0.1 |
|
||||
|------------+---------------+-------------------------------------------|
|
||||
| 801966afa9 | Kevin Harwell | realtime: Add database scripts for 14.0.1 |
|
||||
|------------+---------------+-------------------------------------------|
|
||||
| a13b54df83 | gtjoseph | build_tools: Add ability to download |
|
||||
| | | variants to download_externals |
|
||||
|------------+---------------+-------------------------------------------|
|
||||
| 13cae45bb5 | gtjoseph | build: Add download capability for |
|
||||
| | | external packages |
|
||||
+------------------------------------------------------------------------+
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Diffstat Results
|
||||
|
||||
[Back to Top]
|
||||
|
||||
This is a summary of the changes to the source code that went into this
|
||||
release that was generated using the diffstat utility.
|
||||
|
||||
asterisk-14.0.0-summary.html | 4318 -----------
|
||||
asterisk-14.0.0-summary.txt |10112 ---------------------------
|
||||
b/.version | 2
|
||||
b/CHANGES | 15
|
||||
b/Makefile | 7
|
||||
b/Makefile.moddir_rules | 12
|
||||
b/build_tools/download_externals | 224
|
||||
b/build_tools/list_valid_installed_externals | 55
|
||||
b/build_tools/make_version | 4
|
||||
b/build_tools/menuselect-deps.in | 3
|
||||
b/codecs/codecs.xml | 32
|
||||
b/configure | 234
|
||||
b/configure.ac | 24
|
||||
b/formats/format_ogg_opus.c | 229
|
||||
b/include/asterisk/autoconfig.h.in | 3
|
||||
b/include/asterisk/opus.h | 51
|
||||
b/makeopts.in | 5
|
||||
b/res/res.xml | 13
|
||||
b/res/res_format_attr_opus.c | 304
|
||||
19 files changed, 1040 insertions(+), 14607 deletions(-)
|
224
build_tools/download_externals
Executable file
224
build_tools/download_externals
Executable file
@@ -0,0 +1,224 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ ( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} > 1 ) || ${BASH_VERSINFO[0]} > 4 ]] ; then
|
||||
shopt -s compat41
|
||||
fi
|
||||
set -e
|
||||
|
||||
ASTTOPDIR=${ASTTOPDIR:-.}
|
||||
|
||||
module_name=${1%%-*}
|
||||
variant=${1##*-}
|
||||
|
||||
if [[ "${variant}" = "${module_name}" ]] ; then
|
||||
unset variant
|
||||
fi
|
||||
|
||||
if [[ -z ${module_name} ]] ; then
|
||||
echo "You must supply a module name."
|
||||
exit 64
|
||||
fi
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
if [[ -z "${tmpdir}" ]] ; then
|
||||
echo "${module_name}: Unable to create temporary directory."
|
||||
exit 1
|
||||
fi
|
||||
trap "rm -rf ${tmpdir}" EXIT
|
||||
|
||||
sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts
|
||||
source ${tmpdir}/makeopts
|
||||
if [[ -z "${ASTMODDIR}" ]] ; then
|
||||
echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
XMLSTARLET=${XMLSTARLET:-xmlstarlet}
|
||||
if [[ "${XMLSTARLET}" = ":" ]] ; then
|
||||
echo "${module_name}: The externals downloader requires xmlstarlet to be installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cache_dir="${EXTERNALS_CACHE_DIR}"
|
||||
if [[ -z ${cache_dir} ]] ; then
|
||||
cache_dir=${tmpdir}
|
||||
fi
|
||||
|
||||
version=$(${ASTTOPDIR}/build_tools/make_version ${ASTTOPDIR})
|
||||
if [[ ! ${version} =~ ^(GIT-)?([^.-]+)[.-].* ]] ; then
|
||||
echo "${module_name}: Couldn't parse version ${version}"
|
||||
exit 1
|
||||
fi
|
||||
major_version=${BASH_REMATCH[2]}
|
||||
|
||||
if [[ "${major_version}" == "master" ]] ; then
|
||||
echo "${module_name}: External module downloading is not available in the 'master' git branch. Please disable in menuselect and download manually."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
major_version=${major_version}.0
|
||||
|
||||
if [[ "${HOST_CPU}" = "x86_64" ]] ; then
|
||||
host_bits=64
|
||||
else
|
||||
host_bits=32
|
||||
fi
|
||||
|
||||
if [[ -z "${variant}" ]] ; then
|
||||
variants=$(${XMLSTARLET} sel -t -m "/menu/category/member[@name = '${module_name}']/member_data/downloader/variants/variant" -v "@tag" -n ${ASTTOPDIR}/menuselect-tree || :)
|
||||
member_name=${module_name}
|
||||
for tag in ${variants} ; do
|
||||
condition=$(${XMLSTARLET} sel -t -v "/menu/category/member[@name = '${module_name}']/member_data/downloader/variants/variant[@tag = '${tag}']/@condition" ${ASTTOPDIR}/menuselect-tree || :)
|
||||
variant=$(eval "if $condition ; then echo $tag ; fi")
|
||||
if [[ -n "${variant}" ]] ; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
member_name=${module_name}${variant:+-${variant}}
|
||||
fi
|
||||
|
||||
full_name=${module_name}${variant:+-${variant}}
|
||||
variant_manifest=manifest${variant:+-${variant}}.xml
|
||||
|
||||
# Override the remote base for all packages
|
||||
# useful for testing
|
||||
remote_url=${REMOTE_BASE:+${REMOTE_BASE}/asterisk-${major_version}/x86-${host_bits}}
|
||||
|
||||
if [[ -z "${remote_url}" ]] ; then
|
||||
remote_url=$(${XMLSTARLET} sel -t -v "/menu/category/member[@name = '${member_name}']/member_data/downloader/@remote_url" ${ASTTOPDIR}/menuselect-tree || :)
|
||||
if [[ -n "${remote_url}" ]] ; then
|
||||
remote_url="${remote_url}/asterisk-${major_version}/x86-${host_bits}"
|
||||
else
|
||||
directory_name=$(${XMLSTARLET} sel -t -v "/menu/category/member[@name = '${member_name}']/member_data/downloader/@directory_name" ${ASTTOPDIR}/menuselect-tree || :)
|
||||
remote_url="http://downloads.digium.com/pub/telephony/${directory_name:-${module_name}}/asterisk-${major_version}/x86-${host_bits}"
|
||||
fi
|
||||
fi
|
||||
|
||||
version_convert() {
|
||||
local v=${1##*_}
|
||||
if [[ ${v} =~ ([0-9]+)[.]([0-9]+)[.]([0-9]+) ]] ; then
|
||||
v=$(( ${BASH_REMATCH[1]}<<18 | ${BASH_REMATCH[2]}<<9 | ${BASH_REMATCH[3]} ))
|
||||
fi
|
||||
echo ${v}
|
||||
}
|
||||
|
||||
${WGET} -q -O ${tmpdir}/${variant_manifest} ${remote_url}/${variant_manifest} || {
|
||||
echo "${full_name}: Unable to fetch ${remote_url}/${variant_manifest}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
rpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${tmpdir}/${variant_manifest})
|
||||
rpvi=$(version_convert ${rpv})
|
||||
echo "${full_name}: Remote package version ${rpv} (${rpvi})"
|
||||
|
||||
module_dir=${full_name}-${rpv}-x86_${host_bits}
|
||||
tarball=${module_dir}.tar.gz
|
||||
|
||||
export need_install=0
|
||||
|
||||
if [[ -f ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml ]] ; then
|
||||
package_arch=$(${XMLSTARLET} sel -t -v "/package/@arch" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml)
|
||||
ipv=$(${XMLSTARLET} sel -t -v "/package/@version" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml)
|
||||
package_variant=$(${XMLSTARLET} sel -t -v "/package/@variant" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml || :)
|
||||
ipvi=$(version_convert ${ipv})
|
||||
ip_major=${ipv%_*}
|
||||
echo "${full_name}: Installed package version ${ipv} (${ipvi})"
|
||||
if [[ "${ip_major}" != "${major_version}" || "${package_arch}" != "x86_${host_bits}" || "${package_variant}" != "${variant}" ]] ; then
|
||||
echo "${full_name}: The installed package is not for this version of Asterisk. Reinstalling."
|
||||
need_install=1
|
||||
elif [[ ${rpvi} > ${ipvi} ]] ; then
|
||||
echo "${full_name}: A newer package is available"
|
||||
need_install=1
|
||||
else
|
||||
sums=$(${XMLSTARLET} sel -t -m "//file" -v "@md5sum" -n ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml)
|
||||
for sum in ${sums} ; do
|
||||
install_path=$(${XMLSTARLET} sel -t -v "//file[@md5sum = '${sum}']/@install_path" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml )
|
||||
executable=$(${XMLSTARLET} sel -t -v "//file[@md5sum = '${sum}']/@executable" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml )
|
||||
f=${DESTDIR}$(eval echo ${install_path})
|
||||
if [[ ! -f ${f} ]] ; then
|
||||
echo Not found: ${f}
|
||||
need_install=1
|
||||
break
|
||||
else
|
||||
if [[ "$executable" = "yes" ]] ; then
|
||||
# There are easier ways of doing this (objcopy --dump-section) but not in older bunutils
|
||||
length_offset=$(objdump -h $f | sed -n -r -e "s/^\s+[0-9]+\s+.ast_manifest\s+([0-9a-fA-F]+)\s+[0-9a-fA-F]+\s+[0-9a-fA-F]+\s+([0-9a-fA-F]+)\s+.*$/0x\1 0x\2/p")
|
||||
tags=$($(eval 'printf "dd if=$f bs=1 count=%d skip=%d\n" $length_offset') 2>/dev/null)
|
||||
if [[ -n "${tags}" && "${tags}" != "${module_name},${variant},${rpv}" ]] ; then
|
||||
echo Tag mismatch: ${f} File: "${tags}" Manifest: "${module_name},${variant},${rpv}"
|
||||
need_install=1
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
||||
cs=$(md5sum ${f} | cut -b1-32)
|
||||
if [[ "${cs}" != "${sum}" ]] ; then
|
||||
echo Checksum mismatch: ${f}
|
||||
need_install=1
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
need_install=1
|
||||
fi
|
||||
|
||||
if [[ ${need_install} == 1 ]] ; then
|
||||
if [[ ( -n "${ipvi}" ) && ${ipvi} > ${rpvi} ]] ; then
|
||||
echo "${full_name}: Installed package is newer than that available for download."
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "${full_name} is up to date."
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
need_download=1
|
||||
if [[ -f ${cache_dir}/${full_name}.manifest.xml ]] ; then
|
||||
cpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${cache_dir}/${full_name}.manifest.xml)
|
||||
cpvi=$(version_convert ${cpv})
|
||||
echo "${full_name}: Cached package version ${cpv} (${cpvi})"
|
||||
if [[ ${cpvi} == ${rpvi} && ( -f ${cache_dir}/${tarball} ) ]] ; then
|
||||
echo "${full_name}: Cached version is available."
|
||||
need_download=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${need_download} = 1 ]] ; then
|
||||
echo "${full_name}: Downloading ${remote_url}/${tarball}"
|
||||
${WGET} -q -O ${cache_dir}/${tarball} ${remote_url}/${tarball} || {
|
||||
echo "${full_name}: Unable to fetch ${remote_url}/${tarball}"
|
||||
exit 1
|
||||
}
|
||||
cp ${tmpdir}/${variant_manifest} ${cache_dir}/${full_name}.manifest.xml
|
||||
fi
|
||||
|
||||
tar -xzf ${cache_dir}/${tarball} -C ${cache_dir}
|
||||
trap "rm -rf ${cache_dir}/${module_dir} ; rm -rf ${tmpdir}" EXIT
|
||||
|
||||
echo "${full_name}: Installing."
|
||||
|
||||
if [[ $EUID == 0 ]] ; then
|
||||
install_params="--group=0 --owner=0"
|
||||
fi
|
||||
|
||||
names=$(${XMLSTARLET} sel -t -m "//file" -v "@name" -n ${cache_dir}/${module_dir}/manifest.xml)
|
||||
for name in ${names} ; do
|
||||
source_path=${cache_dir}/${module_dir}/${name}
|
||||
install_path=$(${XMLSTARLET} sel -t -v "//file[@name = '${name}']/@install_path" ${cache_dir}/${module_dir}/manifest.xml)
|
||||
install_path=${DESTDIR}$(eval echo ${install_path})
|
||||
executable=$(${XMLSTARLET} sel -t -v "//file[@name = '${name}']/@executable" ${cache_dir}/${module_dir}/manifest.xml || :)
|
||||
if [[ "${executable}" = "yes" ]] ; then
|
||||
mode=0755
|
||||
else
|
||||
mode=0644
|
||||
fi
|
||||
|
||||
${INSTALL} -Dp ${install_params} --mode=${mode} ${source_path} ${install_path}
|
||||
|
||||
done
|
||||
${INSTALL} -Dp ${install_params} --mode=0644 ${cache_dir}/${module_dir}/manifest.xml ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml
|
||||
|
||||
echo "${full_name}: Installed."
|
55
build_tools/list_valid_installed_externals
Executable file
55
build_tools/list_valid_installed_externals
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ ( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} > 1 ) || ${BASH_VERSINFO[0]} > 4 ]] ; then
|
||||
shopt -s compat41
|
||||
fi
|
||||
set -e
|
||||
|
||||
ASTTOPDIR=${ASTTOPDIR:-.}
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
if [[ -z "${tmpdir}" ]] ; then
|
||||
echo "${module_name}: Unable to create temporary directory."
|
||||
exit 1
|
||||
fi
|
||||
trap "rm -rf ${tmpdir}" EXIT
|
||||
|
||||
sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts
|
||||
source ${tmpdir}/makeopts
|
||||
if [[ -z "${ASTMODDIR}" ]] ; then
|
||||
echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
XMLSTARLET=${XMLSTARLET:-xmlstarlet}
|
||||
if [[ "${XMLSTARLET}" = ":" ]] ; then
|
||||
echo "${module_name}: The externals downloader requires xmlstarlet to be installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$(${ASTTOPDIR}/build_tools/make_version ${ASTTOPDIR})
|
||||
if [[ ! ${version} =~ ^(GIT-)?([^.-]+)[.-].* ]] ; then
|
||||
echo "${module_name}: Couldn't parse version ${version}"
|
||||
exit 1
|
||||
fi
|
||||
major_version=${BASH_REMATCH[2]}.0
|
||||
|
||||
if [[ "${HOST_CPU}" = "x86_64" ]] ; then
|
||||
host_bits=64
|
||||
else
|
||||
host_bits=32
|
||||
fi
|
||||
|
||||
names=""
|
||||
for manifest in ${DESTDIR}${ASTMODDIR}/*.manifest.xml ; do
|
||||
if [ ! -f "$manifest" ] ; then
|
||||
break
|
||||
fi
|
||||
package_version=$(${XMLSTARLET} sel -t -v "/package/@version" ${manifest})
|
||||
package_major_version=${package_version%_*}
|
||||
package_arch=$(${XMLSTARLET} sel -t -v "/package/@arch" ${manifest})
|
||||
if [[ "$package_major_version" = "$major_version" && "${package_arch}" = "x86_${host_bits}" ]] ; then
|
||||
names+=$(${XMLSTARLET} sel -t -m "//file[@executable = 'yes']" -v "concat(@name, ' ')" ${manifest})
|
||||
fi
|
||||
done
|
||||
echo $names
|
@@ -11,11 +11,13 @@ elif [ -d ${1}/.git ]; then
|
||||
if [ -z ${GIT} ]; then
|
||||
GIT="git"
|
||||
fi
|
||||
|
||||
|
||||
if ! command -v ${GIT} >/dev/null 2>&1; then
|
||||
echo "UNKNOWN__and_probably_unsupported"
|
||||
exit 1
|
||||
fi
|
||||
cd ${1}
|
||||
|
||||
# If the first log commit messages indicates that this is checked into
|
||||
# subversion, we'll just use the SVN- form of the revision.
|
||||
MODIFIED=""
|
||||
|
@@ -30,6 +30,8 @@ KQUEUE=@PBX_KQUEUE@
|
||||
LDAP=@PBX_LDAP@
|
||||
LIBEDIT=@PBX_LIBEDIT@
|
||||
LIBXML2=@PBX_LIBXML2@
|
||||
XMLSTARLET=@PBX_XMLSTARLET@
|
||||
BASH=@PBX_BASH@
|
||||
LTDL=@PBX_LTDL@
|
||||
LUA=@PBX_LUA@
|
||||
MISDN=@PBX_MISDN@
|
||||
@@ -42,6 +44,7 @@ NEON29=@PBX_NEON29@
|
||||
OGG=@PBX_OGG@
|
||||
OPENH323=@PBX_OPENH323@
|
||||
OPUS=@PBX_OPUS@
|
||||
OPUSFILE=@PBX_OPUSFILE@
|
||||
OSPTK=@PBX_OSPTK@
|
||||
OSS=@PBX_OSS@
|
||||
PGSQL=@PBX_PGSQL@
|
||||
|
@@ -5883,6 +5883,38 @@ static void copy_socket_data(struct sip_socket *to_sock, const struct sip_socket
|
||||
*to_sock = *from_sock;
|
||||
}
|
||||
|
||||
/*! Cleanup the RTP and SRTP portions of a dialog
|
||||
*
|
||||
* \note This procedure excludes vsrtp as it is initialized differently.
|
||||
*/
|
||||
static void dialog_clean_rtp(struct sip_pvt *p)
|
||||
{
|
||||
if (p->rtp) {
|
||||
ast_rtp_instance_destroy(p->rtp);
|
||||
p->rtp = NULL;
|
||||
}
|
||||
|
||||
if (p->vrtp) {
|
||||
ast_rtp_instance_destroy(p->vrtp);
|
||||
p->vrtp = NULL;
|
||||
}
|
||||
|
||||
if (p->trtp) {
|
||||
ast_rtp_instance_destroy(p->trtp);
|
||||
p->trtp = NULL;
|
||||
}
|
||||
|
||||
if (p->srtp) {
|
||||
ast_sdp_srtp_destroy(p->srtp);
|
||||
p->srtp = NULL;
|
||||
}
|
||||
|
||||
if (p->tsrtp) {
|
||||
ast_sdp_srtp_destroy(p->tsrtp);
|
||||
p->tsrtp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Initialize DTLS-SRTP support on an RTP instance */
|
||||
static int dialog_initialize_dtls_srtp(const struct sip_pvt *dialog, struct ast_rtp_instance *rtp, struct ast_sdp_srtp **srtp)
|
||||
{
|
||||
@@ -5936,6 +5968,9 @@ static int dialog_initialize_rtp(struct sip_pvt *dialog)
|
||||
ast_sockaddr_copy(&bindaddr_tmp, &bindaddr);
|
||||
}
|
||||
|
||||
/* Make sure previous RTP instances/FD's do not leak */
|
||||
dialog_clean_rtp(dialog);
|
||||
|
||||
if (!(dialog->rtp = ast_rtp_instance_new(dialog->engine, sched, &bindaddr_tmp, NULL))) {
|
||||
return -1;
|
||||
}
|
||||
@@ -6611,18 +6646,10 @@ static void sip_pvt_dtor(void *vdoomed)
|
||||
ast_free(p->notify);
|
||||
p->notify = NULL;
|
||||
}
|
||||
if (p->rtp) {
|
||||
ast_rtp_instance_destroy(p->rtp);
|
||||
p->rtp = NULL;
|
||||
}
|
||||
if (p->vrtp) {
|
||||
ast_rtp_instance_destroy(p->vrtp);
|
||||
p->vrtp = NULL;
|
||||
}
|
||||
if (p->trtp) {
|
||||
ast_rtp_instance_destroy(p->trtp);
|
||||
p->trtp = NULL;
|
||||
}
|
||||
|
||||
/* Free RTP and SRTP instances */
|
||||
dialog_clean_rtp(p);
|
||||
|
||||
if (p->udptl) {
|
||||
ast_udptl_destroy(p->udptl);
|
||||
p->udptl = NULL;
|
||||
@@ -6655,21 +6682,11 @@ static void sip_pvt_dtor(void *vdoomed)
|
||||
|
||||
destroy_msg_headers(p);
|
||||
|
||||
if (p->srtp) {
|
||||
ast_sdp_srtp_destroy(p->srtp);
|
||||
p->srtp = NULL;
|
||||
}
|
||||
|
||||
if (p->vsrtp) {
|
||||
ast_sdp_srtp_destroy(p->vsrtp);
|
||||
p->vsrtp = NULL;
|
||||
}
|
||||
|
||||
if (p->tsrtp) {
|
||||
ast_sdp_srtp_destroy(p->tsrtp);
|
||||
p->tsrtp = NULL;
|
||||
}
|
||||
|
||||
if (p->directmediaacl) {
|
||||
p->directmediaacl = ast_free_acl_list(p->directmediaacl);
|
||||
}
|
||||
|
32
codecs/codecs.xml
Normal file
32
codecs/codecs.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<member name="codec_opus" displayname="Download the Opus codec from Digium. See http://downloads.digium.com/pub/telephony/codec_opus/README.">
|
||||
<support_level>external</support_level>
|
||||
<depend>xmlstarlet</depend>
|
||||
<depend>bash</depend>
|
||||
<depend>res_format_attr_opus</depend>
|
||||
<defaultenabled>no</defaultenabled>
|
||||
</member>
|
||||
<member name="codec_silk" displayname="Download the SILK codec from Digium. See http://downloads.digium.com/pub/telephony/codec_silk/README.">
|
||||
<support_level>external</support_level>
|
||||
<depend>xmlstarlet</depend>
|
||||
<depend>bash</depend>
|
||||
<defaultenabled>no</defaultenabled>
|
||||
</member>
|
||||
<member name="codec_siren7" displayname="Download the Siren7 codec from Digium. See http://downloads.digium.com/pub/telephony/codec_siren7/README.">
|
||||
<support_level>external</support_level>
|
||||
<depend>xmlstarlet</depend>
|
||||
<depend>bash</depend>
|
||||
<defaultenabled>no</defaultenabled>
|
||||
</member>
|
||||
<member name="codec_siren14" displayname="Download the Siren14 codec from Digium. See http://downloads.digium.com/pub/telephony/codec_siren14/README.">
|
||||
<support_level>external</support_level>
|
||||
<depend>xmlstarlet</depend>
|
||||
<depend>bash</depend>
|
||||
<defaultenabled>no</defaultenabled>
|
||||
</member>
|
||||
<member name="codec_g729a" displayname="Download the g729a codec from Digium. A license must be purchased for this codec. See http://downloads.digium.com/pub/telephony/codec_g729/README.">
|
||||
<support_level>external</support_level>
|
||||
<depend>xmlstarlet</depend>
|
||||
<depend>bash</depend>
|
||||
<defaultenabled>no</defaultenabled>
|
||||
<member_data><downloader directory_name="codec_g729"/></member_data>
|
||||
</member>
|
@@ -197,6 +197,11 @@ TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
|
||||
; before "B".
|
||||
;
|
||||
;[context]
|
||||
;
|
||||
;autohints = yes
|
||||
; If enabled for a context, a device state hint will be automatically created in
|
||||
; the context with the name of the device and updated with device state changes.
|
||||
;
|
||||
;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...)
|
||||
;
|
||||
; Timing list for includes is
|
||||
|
@@ -38,19 +38,6 @@ pre-connect => yes
|
||||
; record. The default is "select 1".
|
||||
;sanitysql => select 1
|
||||
;
|
||||
; On some databases, the connection times out and a reconnection will be
|
||||
; necessary. This setting configures the amount of time a connection
|
||||
; may sit idle (in seconds) before a reconnection will be attempted.
|
||||
;idlecheck => 3600
|
||||
;
|
||||
; Should we use a single connection for all queries? Most databases will
|
||||
; allow sharing the connection, though Sybase and MS SQL Server will not.
|
||||
;share_connections => yes
|
||||
;
|
||||
; If we aren't sharing connections, what is the maximum number of connections
|
||||
; that we should attempt?
|
||||
;limit => 5
|
||||
;
|
||||
; The maximum number of connections to have open at any given time.
|
||||
; This defaults to 1 and it is highly recommended to only set this higher
|
||||
; if using a version of UnixODBC greater than 2.3.1.
|
||||
|
279
configure
vendored
279
configure
vendored
@@ -822,6 +822,7 @@ PBX_SPANDSP
|
||||
SPANDSP_DIR
|
||||
SPANDSP_INCLUDE
|
||||
SPANDSP_LIB
|
||||
EXTERNALS_CACHE_DIR
|
||||
SOUNDS_CACHE_DIR
|
||||
PBX_SDL_IMAGE
|
||||
SDL_IMAGE_DIR
|
||||
@@ -984,6 +985,10 @@ PBX_OSPTK
|
||||
OSPTK_DIR
|
||||
OSPTK_INCLUDE
|
||||
OSPTK_LIB
|
||||
PBX_OPUSFILE
|
||||
OPUSFILE_DIR
|
||||
OPUSFILE_INCLUDE
|
||||
OPUSFILE_LIB
|
||||
PBX_OPUS
|
||||
OPUS_DIR
|
||||
OPUS_INCLUDE
|
||||
@@ -1198,6 +1203,8 @@ PTHREAD_CC
|
||||
ax_pthread_config
|
||||
MD5
|
||||
SOXMIX
|
||||
PBX_BASH
|
||||
PBX_XMLSTARLET
|
||||
PBX_FLEX
|
||||
PBX_BISON
|
||||
OPENSSL
|
||||
@@ -1207,6 +1214,7 @@ DOWNLOAD
|
||||
FETCH
|
||||
ALEMBIC
|
||||
GIT
|
||||
BASH
|
||||
XMLSTARLET
|
||||
XMLLINT
|
||||
KPATHSEA
|
||||
@@ -1379,6 +1387,7 @@ with_newt
|
||||
with_ogg
|
||||
with_openr2
|
||||
with_opus
|
||||
with_opusfile
|
||||
with_osptk
|
||||
with_oss
|
||||
with_postgres
|
||||
@@ -1393,6 +1402,7 @@ with_resample
|
||||
with_sdl
|
||||
with_SDL_image
|
||||
with_sounds_cache
|
||||
with_externals_cache
|
||||
with_spandsp
|
||||
with_ss7
|
||||
with_speex
|
||||
@@ -2122,6 +2132,7 @@ Optional Packages:
|
||||
--with-ogg=PATH use OGG files in PATH
|
||||
--with-openr2=PATH use MFR2 files in PATH
|
||||
--with-opus=PATH use Opus files in PATH
|
||||
--with-opusfile=PATH use Opusfile files in PATH
|
||||
--with-osptk=PATH use OSP Toolkit files in PATH
|
||||
--with-oss=PATH use Open Sound System files in PATH
|
||||
--with-postgres=PATH use PostgreSQL files in PATH
|
||||
@@ -2138,6 +2149,8 @@ Optional Packages:
|
||||
--with-SDL_image=PATH use Sdl Image files in PATH
|
||||
--with-sounds-cache=PATH
|
||||
use cached sound tarfiles in PATH
|
||||
--with-externals-cache=PATH
|
||||
use cached external module tarfiles in PATH
|
||||
--with-spandsp=PATH use SPANDSP files in PATH
|
||||
--with-ss7=PATH use ISDN SS7 files in PATH
|
||||
--with-speex=PATH use Speex files in PATH
|
||||
@@ -7483,6 +7496,47 @@ $as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# Extract the first word of "bash", so it can be a program name with args.
|
||||
set dummy bash; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_BASH+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
case $BASH in
|
||||
[\\/]* | ?:[\\/]*)
|
||||
ac_cv_path_BASH="$BASH" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_path_BASH="$as_dir/$ac_word$ac_exec_ext"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
test -z "$ac_cv_path_BASH" && ac_cv_path_BASH=":"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
BASH=$ac_cv_path_BASH
|
||||
if test -n "$BASH"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH" >&5
|
||||
$as_echo "$BASH" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
# Extract the first word of "git", so it can be a program name with args.
|
||||
set dummy git; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
@@ -7790,6 +7844,20 @@ else
|
||||
fi
|
||||
|
||||
|
||||
if test "x${XMLSTARLET}" = "x:" ; then
|
||||
PBX_XMLSTARLET=0
|
||||
else
|
||||
PBX_XMLSTARLET=1
|
||||
fi
|
||||
|
||||
|
||||
if test "x${BASH}" = "x:" ; then
|
||||
PBX_BASH=0
|
||||
else
|
||||
PBX_BASH=1
|
||||
fi
|
||||
|
||||
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}soxmix", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}soxmix; ac_word=$2
|
||||
@@ -10715,6 +10783,38 @@ fi
|
||||
|
||||
|
||||
|
||||
OPUSFILE_DESCRIP="Opusfile"
|
||||
OPUSFILE_OPTION="opusfile"
|
||||
PBX_OPUSFILE=0
|
||||
|
||||
# Check whether --with-opusfile was given.
|
||||
if test "${with_opusfile+set}" = set; then :
|
||||
withval=$with_opusfile;
|
||||
case ${withval} in
|
||||
n|no)
|
||||
USE_OPUSFILE=no
|
||||
# -1 is a magic value used by menuselect to know that the package
|
||||
# was disabled, other than 'not found'
|
||||
PBX_OPUSFILE=-1
|
||||
;;
|
||||
y|ye|yes)
|
||||
ac_mandatory_list="${ac_mandatory_list} OPUSFILE"
|
||||
;;
|
||||
*)
|
||||
OPUSFILE_DIR="${withval}"
|
||||
ac_mandatory_list="${ac_mandatory_list} OPUSFILE"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
OSPTK_DESCRIP="OSP Toolkit"
|
||||
OSPTK_OPTION="osptk"
|
||||
PBX_OSPTK=0
|
||||
@@ -11488,6 +11588,30 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --with-externals-cache was given.
|
||||
if test "${with_externals_cache+set}" = set; then :
|
||||
withval=$with_externals_cache;
|
||||
case ${withval} in
|
||||
n|no)
|
||||
unset EXTERNALS_CACHE_DIR
|
||||
;;
|
||||
*)
|
||||
if test "x${withval}" = "x"; then
|
||||
:
|
||||
else
|
||||
EXTERNALS_CACHE_DIR="${withval}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
SPANDSP_DESCRIP="SPANDSP"
|
||||
SPANDSP_OPTION="spandsp"
|
||||
PBX_SPANDSP=0
|
||||
@@ -23683,7 +23807,7 @@ if test "x${PBX_UNBOUND}" != "x1" -a "${USE_UNBOUND}" != "no"; then
|
||||
pbxlibdir="-L${UNBOUND_DIR}"
|
||||
fi
|
||||
fi
|
||||
pbxfuncname="ub_ctx_add_ta_autr"
|
||||
pbxfuncname="ub_ctx_delete"
|
||||
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
|
||||
AST_UNBOUND_FOUND=yes
|
||||
else
|
||||
@@ -23777,6 +23901,49 @@ fi
|
||||
|
||||
|
||||
|
||||
if test "x${PBX_UNBOUND_CONST_PARAMS}" != "x1" -a "${USE_UNBOUND_CONST_PARAMS}" != "no"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UNBOUND_VERSION_MAJOR declared in unbound.h" >&5
|
||||
$as_echo_n "checking for UNBOUND_VERSION_MAJOR declared in unbound.h... " >&6; }
|
||||
saved_cppflags="${CPPFLAGS}"
|
||||
if test "x${UNBOUND_CONST_PARAMS_DIR}" != "x"; then
|
||||
UNBOUND_CONST_PARAMS_INCLUDE="-I${UNBOUND_CONST_PARAMS_DIR}/include"
|
||||
fi
|
||||
CPPFLAGS="${CPPFLAGS} ${UNBOUND_CONST_PARAMS_INCLUDE}"
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <unbound.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#if !defined(UNBOUND_VERSION_MAJOR)
|
||||
(void) UNBOUND_VERSION_MAJOR;
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
PBX_UNBOUND_CONST_PARAMS=1
|
||||
|
||||
$as_echo "#define HAVE_UNBOUND_CONST_PARAMS 1" >>confdefs.h
|
||||
|
||||
|
||||
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
|
||||
CPPFLAGS="${saved_cppflags}"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "x${PBX_UNIXODBC}" != "x1" -a "${USE_UNIXODBC}" != "no"; then
|
||||
pbxlibdir=""
|
||||
@@ -29199,6 +29366,116 @@ _ACEOF
|
||||
fi
|
||||
|
||||
|
||||
# opusfile.h includes <opus_multistream.h> so we need to make sure that
|
||||
# either $OPUS_INCLUDE or /usr/include/opus is added to the search path.
|
||||
__opus_include=${OPUS_INCLUDE}
|
||||
if test -z "$__opus_include" -o x"$__opus_include" = x" " ; then
|
||||
__opus_include=-I/usr/include/opus
|
||||
fi
|
||||
|
||||
if test "x${PBX_OPUSFILE}" != "x1" -a "${USE_OPUSFILE}" != "no"; then
|
||||
pbxlibdir=""
|
||||
# if --with-OPUSFILE=DIR has been specified, use it.
|
||||
if test "x${OPUSFILE_DIR}" != "x"; then
|
||||
if test -d ${OPUSFILE_DIR}/lib; then
|
||||
pbxlibdir="-L${OPUSFILE_DIR}/lib"
|
||||
else
|
||||
pbxlibdir="-L${OPUSFILE_DIR}"
|
||||
fi
|
||||
fi
|
||||
pbxfuncname="op_open_callbacks"
|
||||
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
|
||||
AST_OPUSFILE_FOUND=yes
|
||||
else
|
||||
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} $__opus_include"
|
||||
as_ac_Lib=`$as_echo "ac_cv_lib_opusfile_${pbxfuncname}" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopusfile" >&5
|
||||
$as_echo_n "checking for ${pbxfuncname} in -lopusfile... " >&6; }
|
||||
if eval \${$as_ac_Lib+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lopusfile ${pbxlibdir} $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char ${pbxfuncname} ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return ${pbxfuncname} ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
eval "$as_ac_Lib=yes"
|
||||
else
|
||||
eval "$as_ac_Lib=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
eval ac_res=\$$as_ac_Lib
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
|
||||
AST_OPUSFILE_FOUND=yes
|
||||
else
|
||||
AST_OPUSFILE_FOUND=no
|
||||
fi
|
||||
|
||||
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
|
||||
fi
|
||||
|
||||
# now check for the header.
|
||||
if test "${AST_OPUSFILE_FOUND}" = "yes"; then
|
||||
OPUSFILE_LIB="${pbxlibdir} -lopusfile "
|
||||
# if --with-OPUSFILE=DIR has been specified, use it.
|
||||
if test "x${OPUSFILE_DIR}" != "x"; then
|
||||
OPUSFILE_INCLUDE="-I${OPUSFILE_DIR}/include"
|
||||
fi
|
||||
OPUSFILE_INCLUDE="${OPUSFILE_INCLUDE} $__opus_include"
|
||||
if test "xopus/opusfile.h" = "x" ; then # no header, assume found
|
||||
OPUSFILE_HEADER_FOUND="1"
|
||||
else # check for the header
|
||||
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
|
||||
CPPFLAGS="${CPPFLAGS} ${OPUSFILE_INCLUDE}"
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "opus/opusfile.h" "ac_cv_header_opus_opusfile_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_opus_opusfile_h" = xyes; then :
|
||||
OPUSFILE_HEADER_FOUND=1
|
||||
else
|
||||
OPUSFILE_HEADER_FOUND=0
|
||||
fi
|
||||
|
||||
|
||||
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
|
||||
fi
|
||||
if test "x${OPUSFILE_HEADER_FOUND}" = "x0" ; then
|
||||
OPUSFILE_LIB=""
|
||||
OPUSFILE_INCLUDE=""
|
||||
else
|
||||
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
|
||||
OPUSFILE_LIB=""
|
||||
fi
|
||||
PBX_OPUSFILE=1
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_OPUSFILE 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "${USE_PWLIB}" != "no"; then
|
||||
if test -n "${PWLIB_DIR}"; then
|
||||
|
27
configure.ac
27
configure.ac
@@ -281,6 +281,7 @@ AC_PATH_PROG([CATDVI], [catdvi], :)
|
||||
AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
|
||||
AC_PATH_PROG([XMLLINT], [xmllint], :)
|
||||
AC_PATH_PROG([XMLSTARLET], [xmlstarlet], :)
|
||||
AC_PATH_PROG([BASH], [bash], :)
|
||||
AC_PATH_PROG([GIT], [git], :)
|
||||
AC_PATH_PROG([ALEMBIC], [alembic], :)
|
||||
if test "${WGET}" != ":" ; then
|
||||
@@ -340,6 +341,20 @@ else
|
||||
fi
|
||||
AC_SUBST(PBX_FLEX)
|
||||
|
||||
if test "x${XMLSTARLET}" = "x:" ; then
|
||||
PBX_XMLSTARLET=0
|
||||
else
|
||||
PBX_XMLSTARLET=1
|
||||
fi
|
||||
AC_SUBST(PBX_XMLSTARLET)
|
||||
|
||||
if test "x${BASH}" = "x:" ; then
|
||||
PBX_BASH=0
|
||||
else
|
||||
PBX_BASH=1
|
||||
fi
|
||||
AC_SUBST(PBX_BASH)
|
||||
|
||||
AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
|
||||
if test "${SOXMIX}" != ":" ; then
|
||||
AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
|
||||
@@ -452,6 +467,7 @@ AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
|
||||
AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
|
||||
AST_EXT_LIB_SETUP([OPENR2], [MFR2], [openr2])
|
||||
AST_EXT_LIB_SETUP([OPUS], [Opus], [opus])
|
||||
AST_EXT_LIB_SETUP([OPUSFILE], [Opusfile], [opusfile])
|
||||
AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
|
||||
AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
|
||||
AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
|
||||
@@ -520,6 +536,7 @@ AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
|
||||
AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
|
||||
AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image], [SDL_image])
|
||||
AST_OPTION_ONLY([sounds-cache], [SOUNDS_CACHE_DIR], [cached sound tarfiles], [])
|
||||
AST_OPTION_ONLY([externals-cache], [EXTERNALS_CACHE_DIR], [cached external module tarfiles], [])
|
||||
AST_EXT_LIB_SETUP([SPANDSP], [SPANDSP], [spandsp])
|
||||
AST_EXT_LIB_SETUP([SS7], [ISDN SS7], [ss7])
|
||||
AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
|
||||
@@ -2101,7 +2118,8 @@ AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
|
||||
# script bug which does not find the ldns library. The bug is fixed in
|
||||
# v1.4.22 but that version is not easily detectable.
|
||||
#
|
||||
AST_EXT_LIB_CHECK([UNBOUND], [unbound], [ub_ctx_add_ta_autr], [unbound.h], [])
|
||||
AST_EXT_LIB_CHECK([UNBOUND], [unbound], [ub_ctx_delete], [unbound.h], [])
|
||||
AST_C_DECLARE_CHECK([UNBOUND_CONST_PARAMS], [UNBOUND_VERSION_MAJOR], [unbound.h])
|
||||
|
||||
AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
|
||||
|
||||
@@ -2273,6 +2291,13 @@ AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_set_isup_timer], [libss7.h])
|
||||
AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
|
||||
|
||||
AST_EXT_LIB_CHECK([OPUS], [opus], [opus_encoder_create], [opus/opus.h])
|
||||
# opusfile.h includes <opus_multistream.h> so we need to make sure that
|
||||
# either $OPUS_INCLUDE or /usr/include/opus is added to the search path.
|
||||
__opus_include=${OPUS_INCLUDE}
|
||||
if test -z "$__opus_include" -o x"$__opus_include" = x" " ; then
|
||||
__opus_include=-I/usr/include/opus
|
||||
fi
|
||||
AST_EXT_LIB_CHECK([OPUSFILE], [opusfile], [op_open_callbacks], [opus/opusfile.h], [], [$__opus_include])
|
||||
|
||||
if test "${USE_PWLIB}" != "no"; then
|
||||
if test -n "${PWLIB_DIR}"; then
|
||||
|
@@ -0,0 +1,44 @@
|
||||
"""update_identify_by
|
||||
|
||||
Revision ID: 3772f8f828da
|
||||
Revises: c7a44a5a0851
|
||||
Create Date: 2016-08-11 10:47:29.211063
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3772f8f828da'
|
||||
down_revision = '4a6c67fa9b7a'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def enum_update(table_name, column_name, enum_name, enum_values):
|
||||
if op.get_context().bind.dialect.name != 'postgresql':
|
||||
op.alter_column(table_name, column_name,
|
||||
type_=sa.Enum(*enum_values, name=enum_name))
|
||||
return
|
||||
|
||||
# Postgres requires a few more steps
|
||||
tmp = enum_name + '_tmp'
|
||||
|
||||
op.execute('ALTER TYPE ' + enum_name + ' RENAME TO ' + tmp)
|
||||
|
||||
updated = sa.Enum(*enum_values, name=enum_name)
|
||||
updated.create(op.get_bind(), checkfirst=False)
|
||||
|
||||
op.execute('ALTER TABLE ' + table_name + ' ALTER COLUMN ' + column_name +
|
||||
' TYPE ' + enum_name + ' USING identify_by::text::' + enum_name)
|
||||
|
||||
op.execute('DROP TYPE ' + tmp)
|
||||
|
||||
|
||||
def upgrade():
|
||||
enum_update('ps_endpoints', 'identify_by', 'pjsip_identify_by_values',
|
||||
['username', 'auth_username'])
|
||||
|
||||
|
||||
def downgrade():
|
||||
enum_update('ps_endpoints', 'identify_by', 'pjsip_identify_by_values',
|
||||
['username'])
|
@@ -31,20 +31,18 @@ down_revision = '43956d550a44'
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'extensions',
|
||||
sa.Column('id', sa.BigInteger, primary_key=True, nullable=False,
|
||||
unique=True, autoincrement=True),
|
||||
sa.Column('context', sa.String(40), primary_key=True, nullable=False),
|
||||
sa.Column('exten', sa.String(40), primary_key=True, nullable=False),
|
||||
sa.Column('priority', sa.Integer, primary_key=True, nullable=False,
|
||||
autoincrement=True),
|
||||
sa.Column('context', sa.String(40), nullable=False),
|
||||
sa.Column('exten', sa.String(40), nullable=False),
|
||||
sa.Column('priority', sa.Integer, nullable=False),
|
||||
sa.Column('app', sa.String(40), nullable=False),
|
||||
sa.Column('appdata', sa.String(256), nullable=False),
|
||||
sa.UniqueConstraint('context', 'exten', 'priority')
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('extensions')
|
||||
|
58
contrib/realtime/mssql/mssql_cdr.sql
Normal file
58
contrib/realtime/mssql/mssql_cdr.sql
Normal file
@@ -0,0 +1,58 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
GO
|
||||
|
||||
-- Running upgrade -> 210693f3123d
|
||||
|
||||
CREATE TABLE cdr (
|
||||
accountcode VARCHAR(20) NULL,
|
||||
src VARCHAR(80) NULL,
|
||||
dst VARCHAR(80) NULL,
|
||||
dcontext VARCHAR(80) NULL,
|
||||
clid VARCHAR(80) NULL,
|
||||
channel VARCHAR(80) NULL,
|
||||
dstchannel VARCHAR(80) NULL,
|
||||
lastapp VARCHAR(80) NULL,
|
||||
lastdata VARCHAR(80) NULL,
|
||||
start DATETIME NULL,
|
||||
answer DATETIME NULL,
|
||||
[end] DATETIME NULL,
|
||||
duration INTEGER NULL,
|
||||
billsec INTEGER NULL,
|
||||
disposition VARCHAR(45) NULL,
|
||||
amaflags VARCHAR(45) NULL,
|
||||
userfield VARCHAR(256) NULL,
|
||||
uniqueid VARCHAR(150) NULL,
|
||||
linkedid VARCHAR(150) NULL,
|
||||
peeraccount VARCHAR(20) NULL,
|
||||
sequence INTEGER NULL
|
||||
);
|
||||
|
||||
GO
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('210693f3123d');
|
||||
|
||||
GO
|
||||
|
||||
-- Running upgrade 210693f3123d -> 54cde9847798
|
||||
|
||||
ALTER TABLE cdr ALTER COLUMN accountcode VARCHAR(80);
|
||||
|
||||
GO
|
||||
|
||||
ALTER TABLE cdr ALTER COLUMN peeraccount VARCHAR(80);
|
||||
|
||||
GO
|
||||
|
||||
UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d';
|
||||
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
|
||||
GO
|
||||
|
1529
contrib/realtime/mssql/mssql_config.sql
Normal file
1529
contrib/realtime/mssql/mssql_config.sql
Normal file
File diff suppressed because it is too large
Load Diff
54
contrib/realtime/mssql/mssql_voicemail.sql
Normal file
54
contrib/realtime/mssql/mssql_voicemail.sql
Normal file
@@ -0,0 +1,54 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
GO
|
||||
|
||||
-- Running upgrade -> a2e9769475e
|
||||
|
||||
CREATE TABLE voicemail_messages (
|
||||
dir VARCHAR(255) NOT NULL,
|
||||
msgnum INTEGER NOT NULL,
|
||||
context VARCHAR(80) NULL,
|
||||
macrocontext VARCHAR(80) NULL,
|
||||
callerid VARCHAR(80) NULL,
|
||||
origtime INTEGER NULL,
|
||||
duration INTEGER NULL,
|
||||
recording IMAGE NULL,
|
||||
flag VARCHAR(30) NULL,
|
||||
category VARCHAR(30) NULL,
|
||||
mailboxuser VARCHAR(30) NULL,
|
||||
mailboxcontext VARCHAR(30) NULL,
|
||||
msg_id VARCHAR(40) NULL
|
||||
);
|
||||
|
||||
GO
|
||||
|
||||
ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum);
|
||||
|
||||
GO
|
||||
|
||||
CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir);
|
||||
|
||||
GO
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e');
|
||||
|
||||
GO
|
||||
|
||||
-- Running upgrade a2e9769475e -> 39428242f7f5
|
||||
|
||||
ALTER TABLE voicemail_messages ALTER COLUMN recording IMAGE;
|
||||
|
||||
GO
|
||||
|
||||
UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e';
|
||||
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
|
||||
GO
|
||||
|
40
contrib/realtime/mysql/mysql_cdr.sql
Normal file
40
contrib/realtime/mysql/mysql_cdr.sql
Normal file
@@ -0,0 +1,40 @@
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
-- Running upgrade -> 210693f3123d
|
||||
|
||||
CREATE TABLE cdr (
|
||||
accountcode VARCHAR(20),
|
||||
src VARCHAR(80),
|
||||
dst VARCHAR(80),
|
||||
dcontext VARCHAR(80),
|
||||
clid VARCHAR(80),
|
||||
channel VARCHAR(80),
|
||||
dstchannel VARCHAR(80),
|
||||
lastapp VARCHAR(80),
|
||||
lastdata VARCHAR(80),
|
||||
start DATETIME,
|
||||
answer DATETIME,
|
||||
end DATETIME,
|
||||
duration INTEGER,
|
||||
billsec INTEGER,
|
||||
disposition VARCHAR(45),
|
||||
amaflags VARCHAR(45),
|
||||
userfield VARCHAR(256),
|
||||
uniqueid VARCHAR(150),
|
||||
linkedid VARCHAR(150),
|
||||
peeraccount VARCHAR(20),
|
||||
sequence INTEGER
|
||||
);
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('210693f3123d');
|
||||
|
||||
-- Running upgrade 210693f3123d -> 54cde9847798
|
||||
|
||||
ALTER TABLE cdr MODIFY accountcode VARCHAR(80) NULL;
|
||||
|
||||
ALTER TABLE cdr MODIFY peeraccount VARCHAR(80) NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d';
|
||||
|
946
contrib/realtime/mysql/mysql_config.sql
Normal file
946
contrib/realtime/mysql/mysql_config.sql
Normal file
@@ -0,0 +1,946 @@
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
-- Running upgrade -> 4da0c5f79a9c
|
||||
|
||||
CREATE TABLE sippeers (
|
||||
id INTEGER NOT NULL AUTO_INCREMENT,
|
||||
name VARCHAR(40) NOT NULL,
|
||||
ipaddr VARCHAR(45),
|
||||
port INTEGER,
|
||||
regseconds INTEGER,
|
||||
defaultuser VARCHAR(40),
|
||||
fullcontact VARCHAR(80),
|
||||
regserver VARCHAR(20),
|
||||
useragent VARCHAR(20),
|
||||
lastms INTEGER,
|
||||
host VARCHAR(40),
|
||||
type ENUM('friend','user','peer'),
|
||||
context VARCHAR(40),
|
||||
permit VARCHAR(95),
|
||||
deny VARCHAR(95),
|
||||
secret VARCHAR(40),
|
||||
md5secret VARCHAR(40),
|
||||
remotesecret VARCHAR(40),
|
||||
transport ENUM('udp','tcp','tls','ws','wss','udp,tcp','tcp,udp'),
|
||||
dtmfmode ENUM('rfc2833','info','shortinfo','inband','auto'),
|
||||
directmedia ENUM('yes','no','nonat','update'),
|
||||
nat VARCHAR(29),
|
||||
callgroup VARCHAR(40),
|
||||
pickupgroup VARCHAR(40),
|
||||
language VARCHAR(40),
|
||||
disallow VARCHAR(200),
|
||||
allow VARCHAR(200),
|
||||
insecure VARCHAR(40),
|
||||
trustrpid ENUM('yes','no'),
|
||||
progressinband ENUM('yes','no','never'),
|
||||
promiscredir ENUM('yes','no'),
|
||||
useclientcode ENUM('yes','no'),
|
||||
accountcode VARCHAR(40),
|
||||
setvar VARCHAR(200),
|
||||
callerid VARCHAR(40),
|
||||
amaflags VARCHAR(40),
|
||||
callcounter ENUM('yes','no'),
|
||||
busylevel INTEGER,
|
||||
allowoverlap ENUM('yes','no'),
|
||||
allowsubscribe ENUM('yes','no'),
|
||||
videosupport ENUM('yes','no'),
|
||||
maxcallbitrate INTEGER,
|
||||
rfc2833compensate ENUM('yes','no'),
|
||||
mailbox VARCHAR(40),
|
||||
`session-timers` ENUM('accept','refuse','originate'),
|
||||
`session-expires` INTEGER,
|
||||
`session-minse` INTEGER,
|
||||
`session-refresher` ENUM('uac','uas'),
|
||||
t38pt_usertpsource VARCHAR(40),
|
||||
regexten VARCHAR(40),
|
||||
fromdomain VARCHAR(40),
|
||||
fromuser VARCHAR(40),
|
||||
qualify VARCHAR(40),
|
||||
defaultip VARCHAR(45),
|
||||
rtptimeout INTEGER,
|
||||
rtpholdtimeout INTEGER,
|
||||
sendrpid ENUM('yes','no'),
|
||||
outboundproxy VARCHAR(40),
|
||||
callbackextension VARCHAR(40),
|
||||
timert1 INTEGER,
|
||||
timerb INTEGER,
|
||||
qualifyfreq INTEGER,
|
||||
constantssrc ENUM('yes','no'),
|
||||
contactpermit VARCHAR(95),
|
||||
contactdeny VARCHAR(95),
|
||||
usereqphone ENUM('yes','no'),
|
||||
textsupport ENUM('yes','no'),
|
||||
faxdetect ENUM('yes','no'),
|
||||
buggymwi ENUM('yes','no'),
|
||||
auth VARCHAR(40),
|
||||
fullname VARCHAR(40),
|
||||
trunkname VARCHAR(40),
|
||||
cid_number VARCHAR(40),
|
||||
callingpres ENUM('allowed_not_screened','allowed_passed_screen','allowed_failed_screen','allowed','prohib_not_screened','prohib_passed_screen','prohib_failed_screen','prohib'),
|
||||
mohinterpret VARCHAR(40),
|
||||
mohsuggest VARCHAR(40),
|
||||
parkinglot VARCHAR(40),
|
||||
hasvoicemail ENUM('yes','no'),
|
||||
subscribemwi ENUM('yes','no'),
|
||||
vmexten VARCHAR(40),
|
||||
autoframing ENUM('yes','no'),
|
||||
rtpkeepalive INTEGER,
|
||||
`call-limit` INTEGER,
|
||||
g726nonstandard ENUM('yes','no'),
|
||||
ignoresdpversion ENUM('yes','no'),
|
||||
allowtransfer ENUM('yes','no'),
|
||||
dynamic ENUM('yes','no'),
|
||||
path VARCHAR(256),
|
||||
supportpath ENUM('yes','no'),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (name)
|
||||
);
|
||||
|
||||
CREATE INDEX sippeers_name ON sippeers (name);
|
||||
|
||||
CREATE INDEX sippeers_name_host ON sippeers (name, host);
|
||||
|
||||
CREATE INDEX sippeers_ipaddr_port ON sippeers (ipaddr, port);
|
||||
|
||||
CREATE INDEX sippeers_host_port ON sippeers (host, port);
|
||||
|
||||
CREATE TABLE iaxfriends (
|
||||
id INTEGER NOT NULL AUTO_INCREMENT,
|
||||
name VARCHAR(40) NOT NULL,
|
||||
type ENUM('friend','user','peer'),
|
||||
username VARCHAR(40),
|
||||
mailbox VARCHAR(40),
|
||||
secret VARCHAR(40),
|
||||
dbsecret VARCHAR(40),
|
||||
context VARCHAR(40),
|
||||
regcontext VARCHAR(40),
|
||||
host VARCHAR(40),
|
||||
ipaddr VARCHAR(40),
|
||||
port INTEGER,
|
||||
defaultip VARCHAR(20),
|
||||
sourceaddress VARCHAR(20),
|
||||
mask VARCHAR(20),
|
||||
regexten VARCHAR(40),
|
||||
regseconds INTEGER,
|
||||
accountcode VARCHAR(20),
|
||||
mohinterpret VARCHAR(20),
|
||||
mohsuggest VARCHAR(20),
|
||||
inkeys VARCHAR(40),
|
||||
outkeys VARCHAR(40),
|
||||
language VARCHAR(10),
|
||||
callerid VARCHAR(100),
|
||||
cid_number VARCHAR(40),
|
||||
sendani ENUM('yes','no'),
|
||||
fullname VARCHAR(40),
|
||||
trunk ENUM('yes','no'),
|
||||
auth VARCHAR(20),
|
||||
maxauthreq INTEGER,
|
||||
requirecalltoken ENUM('yes','no','auto'),
|
||||
encryption ENUM('yes','no','aes128'),
|
||||
transfer ENUM('yes','no','mediaonly'),
|
||||
jitterbuffer ENUM('yes','no'),
|
||||
forcejitterbuffer ENUM('yes','no'),
|
||||
disallow VARCHAR(200),
|
||||
allow VARCHAR(200),
|
||||
codecpriority VARCHAR(40),
|
||||
qualify VARCHAR(10),
|
||||
qualifysmoothing ENUM('yes','no'),
|
||||
qualifyfreqok VARCHAR(10),
|
||||
qualifyfreqnotok VARCHAR(10),
|
||||
timezone VARCHAR(20),
|
||||
adsi ENUM('yes','no'),
|
||||
amaflags VARCHAR(20),
|
||||
setvar VARCHAR(200),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (name)
|
||||
);
|
||||
|
||||
CREATE INDEX iaxfriends_name ON iaxfriends (name);
|
||||
|
||||
CREATE INDEX iaxfriends_name_host ON iaxfriends (name, host);
|
||||
|
||||
CREATE INDEX iaxfriends_name_ipaddr_port ON iaxfriends (name, ipaddr, port);
|
||||
|
||||
CREATE INDEX iaxfriends_ipaddr_port ON iaxfriends (ipaddr, port);
|
||||
|
||||
CREATE INDEX iaxfriends_host_port ON iaxfriends (host, port);
|
||||
|
||||
CREATE TABLE voicemail (
|
||||
uniqueid INTEGER NOT NULL AUTO_INCREMENT,
|
||||
context VARCHAR(80) NOT NULL,
|
||||
mailbox VARCHAR(80) NOT NULL,
|
||||
password VARCHAR(80) NOT NULL,
|
||||
fullname VARCHAR(80),
|
||||
alias VARCHAR(80),
|
||||
email VARCHAR(80),
|
||||
pager VARCHAR(80),
|
||||
attach ENUM('yes','no'),
|
||||
attachfmt VARCHAR(10),
|
||||
serveremail VARCHAR(80),
|
||||
language VARCHAR(20),
|
||||
tz VARCHAR(30),
|
||||
deletevoicemail ENUM('yes','no'),
|
||||
saycid ENUM('yes','no'),
|
||||
sendvoicemail ENUM('yes','no'),
|
||||
review ENUM('yes','no'),
|
||||
tempgreetwarn ENUM('yes','no'),
|
||||
operator ENUM('yes','no'),
|
||||
envelope ENUM('yes','no'),
|
||||
sayduration INTEGER,
|
||||
forcename ENUM('yes','no'),
|
||||
forcegreetings ENUM('yes','no'),
|
||||
callback VARCHAR(80),
|
||||
dialout VARCHAR(80),
|
||||
exitcontext VARCHAR(80),
|
||||
maxmsg INTEGER,
|
||||
volgain NUMERIC(5, 2),
|
||||
imapuser VARCHAR(80),
|
||||
imappassword VARCHAR(80),
|
||||
imapserver VARCHAR(80),
|
||||
imapport VARCHAR(8),
|
||||
imapflags VARCHAR(80),
|
||||
stamp DATETIME,
|
||||
PRIMARY KEY (uniqueid)
|
||||
);
|
||||
|
||||
CREATE INDEX voicemail_mailbox ON voicemail (mailbox);
|
||||
|
||||
CREATE INDEX voicemail_context ON voicemail (context);
|
||||
|
||||
CREATE INDEX voicemail_mailbox_context ON voicemail (mailbox, context);
|
||||
|
||||
CREATE INDEX voicemail_imapuser ON voicemail (imapuser);
|
||||
|
||||
CREATE TABLE meetme (
|
||||
bookid INTEGER NOT NULL AUTO_INCREMENT,
|
||||
confno VARCHAR(80) NOT NULL,
|
||||
starttime DATETIME,
|
||||
endtime DATETIME,
|
||||
pin VARCHAR(20),
|
||||
adminpin VARCHAR(20),
|
||||
opts VARCHAR(20),
|
||||
adminopts VARCHAR(20),
|
||||
recordingfilename VARCHAR(80),
|
||||
recordingformat VARCHAR(10),
|
||||
maxusers INTEGER,
|
||||
members INTEGER NOT NULL,
|
||||
PRIMARY KEY (bookid)
|
||||
);
|
||||
|
||||
CREATE INDEX meetme_confno_start_end ON meetme (confno, starttime, endtime);
|
||||
|
||||
CREATE TABLE musiconhold (
|
||||
name VARCHAR(80) NOT NULL,
|
||||
mode ENUM('custom','files','mp3nb','quietmp3nb','quietmp3'),
|
||||
directory VARCHAR(255),
|
||||
application VARCHAR(255),
|
||||
digit VARCHAR(1),
|
||||
sort VARCHAR(10),
|
||||
format VARCHAR(10),
|
||||
stamp DATETIME,
|
||||
PRIMARY KEY (name)
|
||||
);
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('4da0c5f79a9c');
|
||||
|
||||
-- Running upgrade 4da0c5f79a9c -> 43956d550a44
|
||||
|
||||
CREATE TABLE ps_endpoints (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
transport VARCHAR(40),
|
||||
aors VARCHAR(200),
|
||||
auth VARCHAR(40),
|
||||
context VARCHAR(40),
|
||||
disallow VARCHAR(200),
|
||||
allow VARCHAR(200),
|
||||
direct_media ENUM('yes','no'),
|
||||
connected_line_method ENUM('invite','reinvite','update'),
|
||||
direct_media_method ENUM('invite','reinvite','update'),
|
||||
direct_media_glare_mitigation ENUM('none','outgoing','incoming'),
|
||||
disable_direct_media_on_nat ENUM('yes','no'),
|
||||
dtmf_mode ENUM('rfc4733','inband','info'),
|
||||
external_media_address VARCHAR(40),
|
||||
force_rport ENUM('yes','no'),
|
||||
ice_support ENUM('yes','no'),
|
||||
identify_by ENUM('username'),
|
||||
mailboxes VARCHAR(40),
|
||||
moh_suggest VARCHAR(40),
|
||||
outbound_auth VARCHAR(40),
|
||||
outbound_proxy VARCHAR(40),
|
||||
rewrite_contact ENUM('yes','no'),
|
||||
rtp_ipv6 ENUM('yes','no'),
|
||||
rtp_symmetric ENUM('yes','no'),
|
||||
send_diversion ENUM('yes','no'),
|
||||
send_pai ENUM('yes','no'),
|
||||
send_rpid ENUM('yes','no'),
|
||||
timers_min_se INTEGER,
|
||||
timers ENUM('forced','no','required','yes'),
|
||||
timers_sess_expires INTEGER,
|
||||
callerid VARCHAR(40),
|
||||
callerid_privacy ENUM('allowed_not_screened','allowed_passed_screened','allowed_failed_screened','allowed','prohib_not_screened','prohib_passed_screened','prohib_failed_screened','prohib','unavailable'),
|
||||
callerid_tag VARCHAR(40),
|
||||
`100rel` ENUM('no','required','yes'),
|
||||
aggregate_mwi ENUM('yes','no'),
|
||||
trust_id_inbound ENUM('yes','no'),
|
||||
trust_id_outbound ENUM('yes','no'),
|
||||
use_ptime ENUM('yes','no'),
|
||||
use_avpf ENUM('yes','no'),
|
||||
media_encryption ENUM('no','sdes','dtls'),
|
||||
inband_progress ENUM('yes','no'),
|
||||
call_group VARCHAR(40),
|
||||
pickup_group VARCHAR(40),
|
||||
named_call_group VARCHAR(40),
|
||||
named_pickup_group VARCHAR(40),
|
||||
device_state_busy_at INTEGER,
|
||||
fax_detect ENUM('yes','no'),
|
||||
t38_udptl ENUM('yes','no'),
|
||||
t38_udptl_ec ENUM('none','fec','redundancy'),
|
||||
t38_udptl_maxdatagram INTEGER,
|
||||
t38_udptl_nat ENUM('yes','no'),
|
||||
t38_udptl_ipv6 ENUM('yes','no'),
|
||||
tone_zone VARCHAR(40),
|
||||
language VARCHAR(40),
|
||||
one_touch_recording ENUM('yes','no'),
|
||||
record_on_feature VARCHAR(40),
|
||||
record_off_feature VARCHAR(40),
|
||||
rtp_engine VARCHAR(40),
|
||||
allow_transfer ENUM('yes','no'),
|
||||
allow_subscribe ENUM('yes','no'),
|
||||
sdp_owner VARCHAR(40),
|
||||
sdp_session VARCHAR(40),
|
||||
tos_audio INTEGER,
|
||||
tos_video INTEGER,
|
||||
cos_audio INTEGER,
|
||||
cos_video INTEGER,
|
||||
sub_min_expiry INTEGER,
|
||||
from_domain VARCHAR(40),
|
||||
from_user VARCHAR(40),
|
||||
mwi_fromuser VARCHAR(40),
|
||||
dtls_verify VARCHAR(40),
|
||||
dtls_rekey VARCHAR(40),
|
||||
dtls_cert_file VARCHAR(200),
|
||||
dtls_private_key VARCHAR(200),
|
||||
dtls_cipher VARCHAR(200),
|
||||
dtls_ca_file VARCHAR(200),
|
||||
dtls_ca_path VARCHAR(200),
|
||||
dtls_setup ENUM('active','passive','actpass'),
|
||||
srtp_tag_32 ENUM('yes','no'),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_endpoints_id ON ps_endpoints (id);
|
||||
|
||||
CREATE TABLE ps_auths (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
auth_type ENUM('md5','userpass'),
|
||||
nonce_lifetime INTEGER,
|
||||
md5_cred VARCHAR(40),
|
||||
password VARCHAR(80),
|
||||
realm VARCHAR(40),
|
||||
username VARCHAR(40),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_auths_id ON ps_auths (id);
|
||||
|
||||
CREATE TABLE ps_aors (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
contact VARCHAR(40),
|
||||
default_expiration INTEGER,
|
||||
mailboxes VARCHAR(80),
|
||||
max_contacts INTEGER,
|
||||
minimum_expiration INTEGER,
|
||||
remove_existing ENUM('yes','no'),
|
||||
qualify_frequency INTEGER,
|
||||
authenticate_qualify ENUM('yes','no'),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_aors_id ON ps_aors (id);
|
||||
|
||||
CREATE TABLE ps_contacts (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
uri VARCHAR(40),
|
||||
expiration_time VARCHAR(40),
|
||||
qualify_frequency INTEGER,
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_contacts_id ON ps_contacts (id);
|
||||
|
||||
CREATE TABLE ps_domain_aliases (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
domain VARCHAR(80),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_domain_aliases_id ON ps_domain_aliases (id);
|
||||
|
||||
CREATE TABLE ps_endpoint_id_ips (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
endpoint VARCHAR(40),
|
||||
`match` VARCHAR(80),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_endpoint_id_ips_id ON ps_endpoint_id_ips (id);
|
||||
|
||||
UPDATE alembic_version SET version_num='43956d550a44' WHERE alembic_version.version_num = '4da0c5f79a9c';
|
||||
|
||||
-- Running upgrade 43956d550a44 -> 581a4264e537
|
||||
|
||||
CREATE TABLE extensions (
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
context VARCHAR(40) NOT NULL,
|
||||
exten VARCHAR(40) NOT NULL,
|
||||
priority INTEGER NOT NULL,
|
||||
app VARCHAR(40) NOT NULL,
|
||||
appdata VARCHAR(256) NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE (context, exten, priority),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
UPDATE alembic_version SET version_num='581a4264e537' WHERE alembic_version.version_num = '43956d550a44';
|
||||
|
||||
-- Running upgrade 581a4264e537 -> 2fc7930b41b3
|
||||
|
||||
CREATE TABLE ps_systems (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
timer_t1 INTEGER,
|
||||
timer_b INTEGER,
|
||||
compact_headers ENUM('yes','no'),
|
||||
threadpool_initial_size INTEGER,
|
||||
threadpool_auto_increment INTEGER,
|
||||
threadpool_idle_timeout INTEGER,
|
||||
threadpool_max_size INTEGER,
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_systems_id ON ps_systems (id);
|
||||
|
||||
CREATE TABLE ps_globals (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
max_forwards INTEGER,
|
||||
user_agent VARCHAR(40),
|
||||
default_outbound_endpoint VARCHAR(40),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_globals_id ON ps_globals (id);
|
||||
|
||||
CREATE TABLE ps_transports (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
async_operations INTEGER,
|
||||
bind VARCHAR(40),
|
||||
ca_list_file VARCHAR(200),
|
||||
cert_file VARCHAR(200),
|
||||
cipher VARCHAR(200),
|
||||
domain VARCHAR(40),
|
||||
external_media_address VARCHAR(40),
|
||||
external_signaling_address VARCHAR(40),
|
||||
external_signaling_port INTEGER,
|
||||
method ENUM('default','unspecified','tlsv1','sslv2','sslv3','sslv23'),
|
||||
local_net VARCHAR(40),
|
||||
password VARCHAR(40),
|
||||
priv_key_file VARCHAR(200),
|
||||
protocol ENUM('udp','tcp','tls','ws','wss'),
|
||||
require_client_cert ENUM('yes','no'),
|
||||
verify_client ENUM('yes','no'),
|
||||
verifiy_server ENUM('yes','no'),
|
||||
tos ENUM('yes','no'),
|
||||
cos ENUM('yes','no'),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_transports_id ON ps_transports (id);
|
||||
|
||||
CREATE TABLE ps_registrations (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
auth_rejection_permanent ENUM('yes','no'),
|
||||
client_uri VARCHAR(40),
|
||||
contact_user VARCHAR(40),
|
||||
expiration INTEGER,
|
||||
max_retries INTEGER,
|
||||
outbound_auth VARCHAR(40),
|
||||
outbound_proxy VARCHAR(40),
|
||||
retry_interval INTEGER,
|
||||
forbidden_retry_interval INTEGER,
|
||||
server_uri VARCHAR(40),
|
||||
transport VARCHAR(40),
|
||||
support_path ENUM('yes','no'),
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_registrations_id ON ps_registrations (id);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN media_address VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN redirect_method ENUM('user','uri_core','uri_pjsip');
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN set_var TEXT;
|
||||
|
||||
ALTER TABLE ps_endpoints CHANGE mwi_fromuser mwi_from_user VARCHAR(40) NULL;
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN outbound_proxy VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN path TEXT;
|
||||
|
||||
ALTER TABLE ps_aors ADD COLUMN maximum_expiration INTEGER;
|
||||
|
||||
ALTER TABLE ps_aors ADD COLUMN outbound_proxy VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_aors ADD COLUMN support_path ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='2fc7930b41b3' WHERE alembic_version.version_num = '581a4264e537';
|
||||
|
||||
-- Running upgrade 2fc7930b41b3 -> 21e526ad3040
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN debug VARCHAR(40);
|
||||
|
||||
UPDATE alembic_version SET version_num='21e526ad3040' WHERE alembic_version.version_num = '2fc7930b41b3';
|
||||
|
||||
-- Running upgrade 21e526ad3040 -> 28887f25a46f
|
||||
|
||||
CREATE TABLE queues (
|
||||
name VARCHAR(128) NOT NULL,
|
||||
musiconhold VARCHAR(128),
|
||||
announce VARCHAR(128),
|
||||
context VARCHAR(128),
|
||||
timeout INTEGER,
|
||||
ringinuse ENUM('yes','no'),
|
||||
setinterfacevar ENUM('yes','no'),
|
||||
setqueuevar ENUM('yes','no'),
|
||||
setqueueentryvar ENUM('yes','no'),
|
||||
monitor_format VARCHAR(8),
|
||||
membermacro VARCHAR(512),
|
||||
membergosub VARCHAR(512),
|
||||
queue_youarenext VARCHAR(128),
|
||||
queue_thereare VARCHAR(128),
|
||||
queue_callswaiting VARCHAR(128),
|
||||
queue_quantity1 VARCHAR(128),
|
||||
queue_quantity2 VARCHAR(128),
|
||||
queue_holdtime VARCHAR(128),
|
||||
queue_minutes VARCHAR(128),
|
||||
queue_minute VARCHAR(128),
|
||||
queue_seconds VARCHAR(128),
|
||||
queue_thankyou VARCHAR(128),
|
||||
queue_callerannounce VARCHAR(128),
|
||||
queue_reporthold VARCHAR(128),
|
||||
announce_frequency INTEGER,
|
||||
announce_to_first_user ENUM('yes','no'),
|
||||
min_announce_frequency INTEGER,
|
||||
announce_round_seconds INTEGER,
|
||||
announce_holdtime VARCHAR(128),
|
||||
announce_position VARCHAR(128),
|
||||
announce_position_limit INTEGER,
|
||||
periodic_announce VARCHAR(50),
|
||||
periodic_announce_frequency INTEGER,
|
||||
relative_periodic_announce ENUM('yes','no'),
|
||||
random_periodic_announce ENUM('yes','no'),
|
||||
retry INTEGER,
|
||||
wrapuptime INTEGER,
|
||||
penaltymemberslimit INTEGER,
|
||||
autofill ENUM('yes','no'),
|
||||
monitor_type VARCHAR(128),
|
||||
autopause ENUM('yes','no','all'),
|
||||
autopausedelay INTEGER,
|
||||
autopausebusy ENUM('yes','no'),
|
||||
autopauseunavail ENUM('yes','no'),
|
||||
maxlen INTEGER,
|
||||
servicelevel INTEGER,
|
||||
strategy ENUM('ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered'),
|
||||
joinempty VARCHAR(128),
|
||||
leavewhenempty VARCHAR(128),
|
||||
reportholdtime ENUM('yes','no'),
|
||||
memberdelay INTEGER,
|
||||
weight INTEGER,
|
||||
timeoutrestart ENUM('yes','no'),
|
||||
defaultrule VARCHAR(128),
|
||||
timeoutpriority VARCHAR(128),
|
||||
PRIMARY KEY (name)
|
||||
);
|
||||
|
||||
CREATE TABLE queue_members (
|
||||
queue_name VARCHAR(80) NOT NULL,
|
||||
interface VARCHAR(80) NOT NULL,
|
||||
uniqueid VARCHAR(80) NOT NULL,
|
||||
membername VARCHAR(80),
|
||||
state_interface VARCHAR(80),
|
||||
penalty INTEGER,
|
||||
paused INTEGER,
|
||||
PRIMARY KEY (queue_name, interface)
|
||||
);
|
||||
|
||||
UPDATE alembic_version SET version_num='28887f25a46f' WHERE alembic_version.version_num = '21e526ad3040';
|
||||
|
||||
-- Running upgrade 28887f25a46f -> 4c573e7135bd
|
||||
|
||||
ALTER TABLE ps_endpoints MODIFY tos_audio VARCHAR(10) NULL;
|
||||
|
||||
ALTER TABLE ps_endpoints MODIFY tos_video VARCHAR(10) NULL;
|
||||
|
||||
ALTER TABLE ps_endpoints DROP COLUMN cos_audio;
|
||||
|
||||
ALTER TABLE ps_endpoints DROP COLUMN cos_video;
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN cos_audio INTEGER;
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN cos_video INTEGER;
|
||||
|
||||
ALTER TABLE ps_transports MODIFY tos VARCHAR(10) NULL;
|
||||
|
||||
ALTER TABLE ps_transports DROP COLUMN cos;
|
||||
|
||||
ALTER TABLE ps_transports ADD COLUMN cos INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='4c573e7135bd' WHERE alembic_version.version_num = '28887f25a46f';
|
||||
|
||||
-- Running upgrade 4c573e7135bd -> 3855ee4e5f85
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN message_context VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN user_agent VARCHAR(40);
|
||||
|
||||
UPDATE alembic_version SET version_num='3855ee4e5f85' WHERE alembic_version.version_num = '4c573e7135bd';
|
||||
|
||||
-- Running upgrade 3855ee4e5f85 -> e96a0b8071c
|
||||
|
||||
ALTER TABLE ps_globals MODIFY user_agent VARCHAR(255) NULL;
|
||||
|
||||
ALTER TABLE ps_contacts MODIFY id VARCHAR(255) NULL;
|
||||
|
||||
ALTER TABLE ps_contacts MODIFY uri VARCHAR(255) NULL;
|
||||
|
||||
ALTER TABLE ps_contacts MODIFY user_agent VARCHAR(255) NULL;
|
||||
|
||||
ALTER TABLE ps_registrations MODIFY client_uri VARCHAR(255) NULL;
|
||||
|
||||
ALTER TABLE ps_registrations MODIFY server_uri VARCHAR(255) NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='e96a0b8071c' WHERE alembic_version.version_num = '3855ee4e5f85';
|
||||
|
||||
-- Running upgrade e96a0b8071c -> c6d929b23a8
|
||||
|
||||
CREATE TABLE ps_subscription_persistence (
|
||||
id VARCHAR(40) NOT NULL,
|
||||
packet VARCHAR(2048),
|
||||
src_name VARCHAR(128),
|
||||
src_port INTEGER,
|
||||
transport_key VARCHAR(64),
|
||||
local_name VARCHAR(128),
|
||||
local_port INTEGER,
|
||||
cseq INTEGER,
|
||||
tag VARCHAR(128),
|
||||
endpoint VARCHAR(40),
|
||||
expires INTEGER,
|
||||
UNIQUE (id)
|
||||
);
|
||||
|
||||
CREATE INDEX ps_subscription_persistence_id ON ps_subscription_persistence (id);
|
||||
|
||||
UPDATE alembic_version SET version_num='c6d929b23a8' WHERE alembic_version.version_num = 'e96a0b8071c';
|
||||
|
||||
-- Running upgrade c6d929b23a8 -> 51f8cb66540e
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN force_avp ENUM('yes','no');
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN media_use_received_transport ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='51f8cb66540e' WHERE alembic_version.version_num = 'c6d929b23a8';
|
||||
|
||||
-- Running upgrade 51f8cb66540e -> 1d50859ed02e
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN accountcode VARCHAR(20);
|
||||
|
||||
UPDATE alembic_version SET version_num='1d50859ed02e' WHERE alembic_version.version_num = '51f8cb66540e';
|
||||
|
||||
-- Running upgrade 1d50859ed02e -> 1758e8bbf6b
|
||||
|
||||
ALTER TABLE sippeers MODIFY useragent VARCHAR(255) NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='1758e8bbf6b' WHERE alembic_version.version_num = '1d50859ed02e';
|
||||
|
||||
-- Running upgrade 1758e8bbf6b -> 5139253c0423
|
||||
|
||||
ALTER TABLE queue_members DROP COLUMN uniqueid;
|
||||
|
||||
ALTER TABLE queue_members ADD COLUMN uniqueid INTEGER NOT NULL;
|
||||
|
||||
ALTER TABLE queue_members ADD UNIQUE (uniqueid);
|
||||
|
||||
ALTER TABLE queue_members MODIFY uniqueid INTEGER NOT NULL AUTO_INCREMENT;
|
||||
|
||||
UPDATE alembic_version SET version_num='5139253c0423' WHERE alembic_version.version_num = '1758e8bbf6b';
|
||||
|
||||
-- Running upgrade 5139253c0423 -> d39508cb8d8
|
||||
|
||||
CREATE TABLE queue_rules (
|
||||
rule_name VARCHAR(80) NOT NULL,
|
||||
time VARCHAR(32) NOT NULL,
|
||||
min_penalty VARCHAR(32) NOT NULL,
|
||||
max_penalty VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
UPDATE alembic_version SET version_num='d39508cb8d8' WHERE alembic_version.version_num = '5139253c0423';
|
||||
|
||||
-- Running upgrade d39508cb8d8 -> 5950038a6ead
|
||||
|
||||
ALTER TABLE ps_transports CHANGE verifiy_server verify_server ENUM('yes','no') NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='5950038a6ead' WHERE alembic_version.version_num = 'd39508cb8d8';
|
||||
|
||||
-- Running upgrade 5950038a6ead -> 10aedae86a32
|
||||
|
||||
ALTER TABLE sippeers MODIFY directmedia ENUM('yes','no','nonat','update','outgoing') NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='10aedae86a32' WHERE alembic_version.version_num = '5950038a6ead';
|
||||
|
||||
-- Running upgrade 10aedae86a32 -> 371a3bf4143e
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN user_eq_phone ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='371a3bf4143e' WHERE alembic_version.version_num = '10aedae86a32';
|
||||
|
||||
-- Running upgrade 371a3bf4143e -> 15b1430ad6f1
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN moh_passthrough ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='15b1430ad6f1' WHERE alembic_version.version_num = '371a3bf4143e';
|
||||
|
||||
-- Running upgrade 15b1430ad6f1 -> 945b1098bdd
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN media_encryption_optimistic ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='945b1098bdd' WHERE alembic_version.version_num = '15b1430ad6f1';
|
||||
|
||||
-- Running upgrade 945b1098bdd -> 45e3f47c6c44
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN endpoint_identifier_order VARCHAR(40);
|
||||
|
||||
UPDATE alembic_version SET version_num='45e3f47c6c44' WHERE alembic_version.version_num = '945b1098bdd';
|
||||
|
||||
-- Running upgrade 45e3f47c6c44 -> 23530d604b96
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN rpid_immediate ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='23530d604b96' WHERE alembic_version.version_num = '45e3f47c6c44';
|
||||
|
||||
-- Running upgrade 23530d604b96 -> 31cd4f4891ec
|
||||
|
||||
ALTER TABLE ps_endpoints MODIFY dtmf_mode ENUM('rfc4733','inband','info','auto') NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='31cd4f4891ec' WHERE alembic_version.version_num = '23530d604b96';
|
||||
|
||||
-- Running upgrade 31cd4f4891ec -> 461d7d691209
|
||||
|
||||
ALTER TABLE ps_aors ADD COLUMN qualify_timeout INTEGER;
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN qualify_timeout INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='461d7d691209' WHERE alembic_version.version_num = '31cd4f4891ec';
|
||||
|
||||
-- Running upgrade 461d7d691209 -> a541e0b5e89
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN max_initial_qualify_time INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='a541e0b5e89' WHERE alembic_version.version_num = '461d7d691209';
|
||||
|
||||
-- Running upgrade a541e0b5e89 -> 28b8e71e541f
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN g726_non_standard ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='28b8e71e541f' WHERE alembic_version.version_num = 'a541e0b5e89';
|
||||
|
||||
-- Running upgrade 28b8e71e541f -> 498357a710ae
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN rtp_keepalive INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='498357a710ae' WHERE alembic_version.version_num = '28b8e71e541f';
|
||||
|
||||
-- Running upgrade 498357a710ae -> 26f10cadc157
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN rtp_timeout INTEGER;
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN rtp_timeout_hold INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='26f10cadc157' WHERE alembic_version.version_num = '498357a710ae';
|
||||
|
||||
-- Running upgrade 26f10cadc157 -> 154177371065
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN default_from_user VARCHAR(80);
|
||||
|
||||
UPDATE alembic_version SET version_num='154177371065' WHERE alembic_version.version_num = '26f10cadc157';
|
||||
|
||||
-- Running upgrade 154177371065 -> 28ce1e718f05
|
||||
|
||||
ALTER TABLE ps_registrations ADD COLUMN fatal_retry_interval INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='28ce1e718f05' WHERE alembic_version.version_num = '154177371065';
|
||||
|
||||
-- Running upgrade 28ce1e718f05 -> 339a3bdf53fc
|
||||
|
||||
ALTER TABLE ps_endpoints MODIFY accountcode VARCHAR(80) NULL;
|
||||
|
||||
ALTER TABLE sippeers MODIFY accountcode VARCHAR(80) NULL;
|
||||
|
||||
ALTER TABLE iaxfriends MODIFY accountcode VARCHAR(80) NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='339a3bdf53fc' WHERE alembic_version.version_num = '28ce1e718f05';
|
||||
|
||||
-- Running upgrade 339a3bdf53fc -> 189a235b3fd7
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN keep_alive_interval INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='189a235b3fd7' WHERE alembic_version.version_num = '339a3bdf53fc';
|
||||
|
||||
-- Running upgrade 189a235b3fd7 -> 2d078ec071b7
|
||||
|
||||
ALTER TABLE ps_aors MODIFY contact VARCHAR(255) NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='2d078ec071b7' WHERE alembic_version.version_num = '189a235b3fd7';
|
||||
|
||||
-- Running upgrade 2d078ec071b7 -> 26d7f3bf0fa5
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN bind_rtp_to_media_address ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='26d7f3bf0fa5' WHERE alembic_version.version_num = '2d078ec071b7';
|
||||
|
||||
-- Running upgrade 26d7f3bf0fa5 -> 136885b81223
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN regcontext VARCHAR(80);
|
||||
|
||||
UPDATE alembic_version SET version_num='136885b81223' WHERE alembic_version.version_num = '26d7f3bf0fa5';
|
||||
|
||||
-- Running upgrade 136885b81223 -> 423f34ad36e2
|
||||
|
||||
ALTER TABLE ps_aors MODIFY qualify_timeout FLOAT NULL;
|
||||
|
||||
ALTER TABLE ps_contacts MODIFY qualify_timeout FLOAT NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='423f34ad36e2' WHERE alembic_version.version_num = '136885b81223';
|
||||
|
||||
-- Running upgrade 423f34ad36e2 -> dbc44d5a908
|
||||
|
||||
ALTER TABLE ps_systems ADD COLUMN disable_tcp_switch ENUM('yes','no');
|
||||
|
||||
ALTER TABLE ps_registrations ADD COLUMN line ENUM('yes','no');
|
||||
|
||||
ALTER TABLE ps_registrations ADD COLUMN endpoint VARCHAR(40);
|
||||
|
||||
UPDATE alembic_version SET version_num='dbc44d5a908' WHERE alembic_version.version_num = '423f34ad36e2';
|
||||
|
||||
-- Running upgrade dbc44d5a908 -> 3bcc0b5bc2c9
|
||||
|
||||
ALTER TABLE ps_transports ADD COLUMN allow_reload ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='3bcc0b5bc2c9' WHERE alembic_version.version_num = 'dbc44d5a908';
|
||||
|
||||
-- Running upgrade 3bcc0b5bc2c9 -> 5813202e92be
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN contact_expiration_check_interval INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='5813202e92be' WHERE alembic_version.version_num = '3bcc0b5bc2c9';
|
||||
|
||||
-- Running upgrade 5813202e92be -> 1c688d9a003c
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN default_voicemail_extension VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_aors ADD COLUMN voicemail_extension VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN voicemail_extension VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN mwi_subscribe_replaces_unsolicited INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='1c688d9a003c' WHERE alembic_version.version_num = '5813202e92be';
|
||||
|
||||
-- Running upgrade 1c688d9a003c -> 8d478ab86e29
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN disable_multi_domain ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='8d478ab86e29' WHERE alembic_version.version_num = '1c688d9a003c';
|
||||
|
||||
-- Running upgrade 8d478ab86e29 -> 65eb22eb195
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN unidentified_request_count INTEGER;
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN unidentified_request_period INTEGER;
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN unidentified_request_prune_interval INTEGER;
|
||||
|
||||
ALTER TABLE ps_globals ADD COLUMN default_realm VARCHAR(40);
|
||||
|
||||
UPDATE alembic_version SET version_num='65eb22eb195' WHERE alembic_version.version_num = '8d478ab86e29';
|
||||
|
||||
-- Running upgrade 65eb22eb195 -> 81b01a191a46
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN reg_server VARCHAR(20);
|
||||
|
||||
ALTER TABLE ps_contacts ADD CONSTRAINT ps_contacts_uq UNIQUE (id, reg_server);
|
||||
|
||||
UPDATE alembic_version SET version_num='81b01a191a46' WHERE alembic_version.version_num = '65eb22eb195';
|
||||
|
||||
-- Running upgrade 81b01a191a46 -> 6be31516058d
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN authenticate_qualify ENUM('yes','no');
|
||||
|
||||
UPDATE alembic_version SET version_num='6be31516058d' WHERE alembic_version.version_num = '81b01a191a46';
|
||||
|
||||
-- Running upgrade 6be31516058d -> d7e3c73eb2bf
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN deny VARCHAR(95);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN permit VARCHAR(95);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN acl VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN contact_deny VARCHAR(95);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN contact_permit VARCHAR(95);
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN contact_acl VARCHAR(40);
|
||||
|
||||
UPDATE alembic_version SET version_num='d7e3c73eb2bf' WHERE alembic_version.version_num = '6be31516058d';
|
||||
|
||||
-- Running upgrade d7e3c73eb2bf -> a845e4d8ade8
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN via_addr VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN via_port INTEGER;
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN call_id VARCHAR(255);
|
||||
|
||||
UPDATE alembic_version SET version_num='a845e4d8ade8' WHERE alembic_version.version_num = 'd7e3c73eb2bf';
|
||||
|
||||
-- Running upgrade a845e4d8ade8 -> ef7efc2d3964
|
||||
|
||||
ALTER TABLE ps_contacts ADD COLUMN endpoint VARCHAR(40);
|
||||
|
||||
ALTER TABLE ps_contacts MODIFY expiration_time BIGINT NULL;
|
||||
|
||||
CREATE INDEX ps_contacts_qualifyfreq_exp ON ps_contacts (qualify_frequency, expiration_time);
|
||||
|
||||
CREATE INDEX ps_aors_qualifyfreq_contact ON ps_aors (qualify_frequency, contact);
|
||||
|
||||
UPDATE alembic_version SET version_num='ef7efc2d3964' WHERE alembic_version.version_num = 'a845e4d8ade8';
|
||||
|
||||
-- Running upgrade ef7efc2d3964 -> 9deac0ae4717
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN subscribe_context VARCHAR(40);
|
||||
|
||||
UPDATE alembic_version SET version_num='9deac0ae4717' WHERE alembic_version.version_num = 'ef7efc2d3964';
|
||||
|
||||
-- Running upgrade 9deac0ae4717 -> 4a6c67fa9b7a
|
||||
|
||||
ALTER TABLE ps_endpoints ADD COLUMN fax_detect_timeout INTEGER;
|
||||
|
||||
UPDATE alembic_version SET version_num='4a6c67fa9b7a' WHERE alembic_version.version_num = '9deac0ae4717';
|
||||
|
||||
-- Running upgrade 4a6c67fa9b7a -> 3772f8f828da
|
||||
|
||||
ALTER TABLE ps_endpoints MODIFY identify_by ENUM('username','auth_username') NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='3772f8f828da' WHERE alembic_version.version_num = '4a6c67fa9b7a';
|
||||
|
34
contrib/realtime/mysql/mysql_voicemail.sql
Normal file
34
contrib/realtime/mysql/mysql_voicemail.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
-- Running upgrade -> a2e9769475e
|
||||
|
||||
CREATE TABLE voicemail_messages (
|
||||
dir VARCHAR(255) NOT NULL,
|
||||
msgnum INTEGER NOT NULL,
|
||||
context VARCHAR(80),
|
||||
macrocontext VARCHAR(80),
|
||||
callerid VARCHAR(80),
|
||||
origtime INTEGER,
|
||||
duration INTEGER,
|
||||
recording BLOB,
|
||||
flag VARCHAR(30),
|
||||
category VARCHAR(30),
|
||||
mailboxuser VARCHAR(30),
|
||||
mailboxcontext VARCHAR(30),
|
||||
msg_id VARCHAR(40)
|
||||
);
|
||||
|
||||
ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum);
|
||||
|
||||
CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir);
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e');
|
||||
|
||||
-- Running upgrade a2e9769475e -> 39428242f7f5
|
||||
|
||||
ALTER TABLE voicemail_messages MODIFY recording BLOB(4294967295) NULL;
|
||||
|
||||
UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e';
|
||||
|
52
contrib/realtime/oracle/oracle_cdr.sql
Normal file
52
contrib/realtime/oracle/oracle_cdr.sql
Normal file
@@ -0,0 +1,52 @@
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR2(32 CHAR) NOT NULL
|
||||
)
|
||||
|
||||
/
|
||||
|
||||
-- Running upgrade -> 210693f3123d
|
||||
|
||||
CREATE TABLE cdr (
|
||||
accountcode VARCHAR2(20 CHAR),
|
||||
src VARCHAR2(80 CHAR),
|
||||
dst VARCHAR2(80 CHAR),
|
||||
dcontext VARCHAR2(80 CHAR),
|
||||
clid VARCHAR2(80 CHAR),
|
||||
channel VARCHAR2(80 CHAR),
|
||||
dstchannel VARCHAR2(80 CHAR),
|
||||
lastapp VARCHAR2(80 CHAR),
|
||||
lastdata VARCHAR2(80 CHAR),
|
||||
"start" DATE,
|
||||
answer DATE,
|
||||
end DATE,
|
||||
duration INTEGER,
|
||||
billsec INTEGER,
|
||||
disposition VARCHAR2(45 CHAR),
|
||||
amaflags VARCHAR2(45 CHAR),
|
||||
userfield VARCHAR2(256 CHAR),
|
||||
uniqueid VARCHAR2(150 CHAR),
|
||||
linkedid VARCHAR2(150 CHAR),
|
||||
peeraccount VARCHAR2(20 CHAR),
|
||||
sequence INTEGER
|
||||
)
|
||||
|
||||
/
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('210693f3123d')
|
||||
|
||||
/
|
||||
|
||||
-- Running upgrade 210693f3123d -> 54cde9847798
|
||||
|
||||
ALTER TABLE cdr MODIFY accountcode VARCHAR2(80 CHAR)
|
||||
|
||||
/
|
||||
|
||||
ALTER TABLE cdr MODIFY peeraccount VARCHAR2(80 CHAR)
|
||||
|
||||
/
|
||||
|
||||
UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d'
|
||||
|
||||
/
|
||||
|
1523
contrib/realtime/oracle/oracle_config.sql
Normal file
1523
contrib/realtime/oracle/oracle_config.sql
Normal file
File diff suppressed because it is too large
Load Diff
48
contrib/realtime/oracle/oracle_voicemail.sql
Normal file
48
contrib/realtime/oracle/oracle_voicemail.sql
Normal file
@@ -0,0 +1,48 @@
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR2(32 CHAR) NOT NULL
|
||||
)
|
||||
|
||||
/
|
||||
|
||||
-- Running upgrade -> a2e9769475e
|
||||
|
||||
CREATE TABLE voicemail_messages (
|
||||
dir VARCHAR2(255 CHAR) NOT NULL,
|
||||
msgnum INTEGER NOT NULL,
|
||||
context VARCHAR2(80 CHAR),
|
||||
macrocontext VARCHAR2(80 CHAR),
|
||||
callerid VARCHAR2(80 CHAR),
|
||||
origtime INTEGER,
|
||||
duration INTEGER,
|
||||
recording BLOB,
|
||||
flag VARCHAR2(30 CHAR),
|
||||
category VARCHAR2(30 CHAR),
|
||||
mailboxuser VARCHAR2(30 CHAR),
|
||||
mailboxcontext VARCHAR2(30 CHAR),
|
||||
msg_id VARCHAR2(40 CHAR)
|
||||
)
|
||||
|
||||
/
|
||||
|
||||
ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum)
|
||||
|
||||
/
|
||||
|
||||
CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir)
|
||||
|
||||
/
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e')
|
||||
|
||||
/
|
||||
|
||||
-- Running upgrade a2e9769475e -> 39428242f7f5
|
||||
|
||||
ALTER TABLE voicemail_messages MODIFY recording BLOB
|
||||
|
||||
/
|
||||
|
||||
UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e'
|
||||
|
||||
/
|
||||
|
44
contrib/realtime/postgresql/postgresql_cdr.sql
Normal file
44
contrib/realtime/postgresql/postgresql_cdr.sql
Normal file
@@ -0,0 +1,44 @@
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
-- Running upgrade -> 210693f3123d
|
||||
|
||||
CREATE TABLE cdr (
|
||||
accountcode VARCHAR(20),
|
||||
src VARCHAR(80),
|
||||
dst VARCHAR(80),
|
||||
dcontext VARCHAR(80),
|
||||
clid VARCHAR(80),
|
||||
channel VARCHAR(80),
|
||||
dstchannel VARCHAR(80),
|
||||
lastapp VARCHAR(80),
|
||||
lastdata VARCHAR(80),
|
||||
start TIMESTAMP WITHOUT TIME ZONE,
|
||||
answer TIMESTAMP WITHOUT TIME ZONE,
|
||||
"end" TIMESTAMP WITHOUT TIME ZONE,
|
||||
duration INTEGER,
|
||||
billsec INTEGER,
|
||||
disposition VARCHAR(45),
|
||||
amaflags VARCHAR(45),
|
||||
userfield VARCHAR(256),
|
||||
uniqueid VARCHAR(150),
|
||||
linkedid VARCHAR(150),
|
||||
peeraccount VARCHAR(20),
|
||||
sequence INTEGER
|
||||
);
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('210693f3123d');
|
||||
|
||||
-- Running upgrade 210693f3123d -> 54cde9847798
|
||||
|
||||
ALTER TABLE cdr ALTER COLUMN accountcode TYPE VARCHAR(80);
|
||||
|
||||
ALTER TABLE cdr ALTER COLUMN peeraccount TYPE VARCHAR(80);
|
||||
|
||||
UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d';
|
||||
|
||||
COMMIT;
|
||||
|
1024
contrib/realtime/postgresql/postgresql_config.sql
Normal file
1024
contrib/realtime/postgresql/postgresql_config.sql
Normal file
File diff suppressed because it is too large
Load Diff
38
contrib/realtime/postgresql/postgresql_voicemail.sql
Normal file
38
contrib/realtime/postgresql/postgresql_voicemail.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE alembic_version (
|
||||
version_num VARCHAR(32) NOT NULL
|
||||
);
|
||||
|
||||
-- Running upgrade -> a2e9769475e
|
||||
|
||||
CREATE TABLE voicemail_messages (
|
||||
dir VARCHAR(255) NOT NULL,
|
||||
msgnum INTEGER NOT NULL,
|
||||
context VARCHAR(80),
|
||||
macrocontext VARCHAR(80),
|
||||
callerid VARCHAR(80),
|
||||
origtime INTEGER,
|
||||
duration INTEGER,
|
||||
recording BYTEA,
|
||||
flag VARCHAR(30),
|
||||
category VARCHAR(30),
|
||||
mailboxuser VARCHAR(30),
|
||||
mailboxcontext VARCHAR(30),
|
||||
msg_id VARCHAR(40)
|
||||
);
|
||||
|
||||
ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum);
|
||||
|
||||
CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir);
|
||||
|
||||
INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e');
|
||||
|
||||
-- Running upgrade a2e9769475e -> 39428242f7f5
|
||||
|
||||
ALTER TABLE voicemail_messages ALTER COLUMN recording TYPE BYTEA;
|
||||
|
||||
UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e';
|
||||
|
||||
COMMIT;
|
||||
|
229
formats/format_ogg_opus.c
Normal file
229
formats/format_ogg_opus.c
Normal file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 2016, Digium, Inc.
|
||||
*
|
||||
* Mark Michelson <mmichelson@digium.com>
|
||||
*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2. See the LICENSE file
|
||||
* at the top of the source tree.
|
||||
*/
|
||||
|
||||
/*** MODULEINFO
|
||||
<depend>opusfile</depend>
|
||||
<support_level>core</support_level>
|
||||
***/
|
||||
|
||||
#include "asterisk.h"
|
||||
|
||||
#include <opus/opus.h>
|
||||
#include <opus/opusfile.h>
|
||||
#include "asterisk/mod_format.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/format_cache.h"
|
||||
|
||||
/* 120ms of 48KHz audio */
|
||||
#define SAMPLES_MAX 5760
|
||||
#define BUF_SIZE (2 * SAMPLES_MAX)
|
||||
|
||||
struct ogg_opus_desc {
|
||||
OggOpusFile *of;
|
||||
};
|
||||
|
||||
static int fread_wrapper(void *_stream, unsigned char *_ptr, int _nbytes)
|
||||
{
|
||||
FILE *stream = _stream;
|
||||
size_t bytes_read;
|
||||
|
||||
if (!stream || _nbytes < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
bytes_read = fread(_ptr, 1, _nbytes, stream);
|
||||
|
||||
return bytes_read > 0 || feof(stream) ? (int) bytes_read : OP_EREAD;
|
||||
}
|
||||
|
||||
static int fseek_wrapper(void *_stream, opus_int64 _offset, int _whence)
|
||||
{
|
||||
FILE *stream = _stream;
|
||||
|
||||
return fseeko(stream, (off_t) _offset, _whence);
|
||||
}
|
||||
|
||||
static opus_int64 ftell_wrapper(void *_stream)
|
||||
{
|
||||
FILE *stream = _stream;
|
||||
|
||||
return ftello(stream);
|
||||
}
|
||||
|
||||
static int ogg_opus_open(struct ast_filestream *s)
|
||||
{
|
||||
struct ogg_opus_desc *desc = (struct ogg_opus_desc *) s->_private;
|
||||
OpusFileCallbacks cb = {
|
||||
.read = fread_wrapper,
|
||||
.seek = fseek_wrapper,
|
||||
.tell = ftell_wrapper,
|
||||
.close = NULL,
|
||||
};
|
||||
|
||||
memset(desc, 0, sizeof(*desc));
|
||||
desc->of = op_open_callbacks(s->f, &cb, NULL, 0, NULL);
|
||||
if (!desc->of) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ogg_opus_rewrite(struct ast_filestream *s, const char *comment)
|
||||
{
|
||||
/* XXX Unimplemented. We currently only can read from OGG/Opus streams */
|
||||
ast_log(LOG_ERROR, "Cannot write OGG/Opus streams. Sorry :(\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int ogg_opus_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||
{
|
||||
/* XXX Unimplemented. We currently only can read from OGG/Opus streams */
|
||||
ast_log(LOG_ERROR, "Cannot write OGG/Opus streams. Sorry :(\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int ogg_opus_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
|
||||
{
|
||||
int seek_result = -1;
|
||||
off_t relative_pcm_pos;
|
||||
struct ogg_opus_desc *desc = fs->_private;
|
||||
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
seek_result = op_pcm_seek(desc->of, sample_offset);
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
if ((relative_pcm_pos = op_pcm_tell(desc->of)) < 0) {
|
||||
seek_result = -1;
|
||||
break;
|
||||
}
|
||||
seek_result = op_pcm_seek(desc->of, relative_pcm_pos + sample_offset);
|
||||
break;
|
||||
case SEEK_END:
|
||||
if ((relative_pcm_pos = op_pcm_total(desc->of, -1)) < 0) {
|
||||
seek_result = -1;
|
||||
break;
|
||||
}
|
||||
seek_result = op_pcm_seek(desc->of, relative_pcm_pos - sample_offset);
|
||||
break;
|
||||
default:
|
||||
ast_log(LOG_WARNING, "Unknown *whence* to seek on OGG/Opus streams!\n");
|
||||
break;
|
||||
}
|
||||
|
||||
/* normalize error value to -1,0 */
|
||||
return (seek_result == 0) ? 0 : -1;
|
||||
}
|
||||
|
||||
static int ogg_opus_trunc(struct ast_filestream *fs)
|
||||
{
|
||||
/* XXX Unimplemented. This is only used when recording, and we don't support that right now. */
|
||||
ast_log(LOG_ERROR, "Truncation is not supported on OGG/Opus streams!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static off_t ogg_opus_tell(struct ast_filestream *fs)
|
||||
{
|
||||
struct ogg_opus_desc *desc = fs->_private;
|
||||
off_t pos;
|
||||
|
||||
pos = (off_t) op_pcm_tell(desc->of);
|
||||
if (pos < 0) {
|
||||
return -1;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
static struct ast_frame *ogg_opus_read(struct ast_filestream *fs, int *whennext)
|
||||
{
|
||||
struct ogg_opus_desc *desc = fs->_private;
|
||||
int hole = 1;
|
||||
int samples_read;
|
||||
opus_int16 *out_buf;
|
||||
|
||||
AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||
|
||||
out_buf = (opus_int16 *) fs->fr.data.ptr;
|
||||
|
||||
while (hole) {
|
||||
samples_read = op_read(
|
||||
desc->of,
|
||||
out_buf,
|
||||
SAMPLES_MAX,
|
||||
NULL);
|
||||
|
||||
if (samples_read != OP_HOLE) {
|
||||
hole = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (samples_read <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fs->fr.datalen = samples_read * 2;
|
||||
fs->fr.samples = samples_read;
|
||||
*whennext = fs->fr.samples;
|
||||
|
||||
return &fs->fr;
|
||||
}
|
||||
|
||||
static void ogg_opus_close(struct ast_filestream *fs)
|
||||
{
|
||||
struct ogg_opus_desc *desc = fs->_private;
|
||||
|
||||
op_free(desc->of);
|
||||
}
|
||||
|
||||
static struct ast_format_def opus_f = {
|
||||
.name = "ogg_opus",
|
||||
.exts = "opus",
|
||||
.open = ogg_opus_open,
|
||||
.rewrite = ogg_opus_rewrite,
|
||||
.write = ogg_opus_write,
|
||||
.seek = ogg_opus_seek,
|
||||
.trunc = ogg_opus_trunc,
|
||||
.tell = ogg_opus_tell,
|
||||
.read = ogg_opus_read,
|
||||
.close = ogg_opus_close,
|
||||
.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
|
||||
.desc_size = sizeof(struct ogg_opus_desc),
|
||||
};
|
||||
|
||||
static int load_module(void)
|
||||
{
|
||||
opus_f.format = ast_format_slin48;
|
||||
if (ast_format_def_register(&opus_f)) {
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
return AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
static int unload_module(void)
|
||||
{
|
||||
return ast_format_def_unregister(opus_f.name);
|
||||
}
|
||||
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "OGG/Opus audio",
|
||||
.support_level = AST_MODULE_SUPPORT_CORE,
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.load_pri = AST_MODPRI_APP_DEPEND
|
||||
);
|
@@ -556,6 +556,9 @@
|
||||
/* Define to 1 if you have the Opus library. */
|
||||
#undef HAVE_OPUS
|
||||
|
||||
/* Define to 1 if you have the Opusfile library. */
|
||||
#undef HAVE_OPUSFILE
|
||||
|
||||
/* Define this to indicate the ${OSPTK_DESCRIP} library */
|
||||
#undef HAVE_OSPTK
|
||||
|
||||
@@ -1108,6 +1111,9 @@
|
||||
/* Define to 1 if you have the unbound library. */
|
||||
#undef HAVE_UNBOUND
|
||||
|
||||
/* Define if your system has UNBOUND_VERSION_MAJOR declared. */
|
||||
#undef HAVE_UNBOUND_CONST_PARAMS
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
|
@@ -18,24 +18,47 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief Opus Format Attributes (http://tools.ietf.org/html/draft-ietf-payload-rtp-opus)
|
||||
* \brief Codec opus externals and format attributes
|
||||
*
|
||||
* \author Lorenzo Miniero <lorenzo@meetecho.com>
|
||||
* RFC - https://tools.ietf.org/rfc/rfc7587.txt
|
||||
*/
|
||||
#ifndef _AST_FORMAT_OPUS_H_
|
||||
#define _AST_FORMAT_OPUS_H_
|
||||
|
||||
/*! Opus format attribute key value pairs, all are accessible through ast_format_get_value()*/
|
||||
enum opus_attr_keys {
|
||||
OPUS_ATTR_KEY_MAX_BITRATE, /*! value is an int (6000-510000 in spec). */
|
||||
OPUS_ATTR_KEY_MAX_PLAYRATE, /*! value is an int (8000-48000), maximum output rate the receiver can render. */
|
||||
OPUS_ATTR_KEY_MINPTIME, /*! value is an int (3-120 in spec, 10-60 in format.c), decoder's minimum length of time in milliseconds. */
|
||||
OPUS_ATTR_KEY_STEREO, /*! value is an int, 1 prefer receiving stereo, 0 prefer mono. */
|
||||
OPUS_ATTR_KEY_CBR, /*! value is an int, 1 use constant bitrate, 0 use variable bitrate. */
|
||||
OPUS_ATTR_KEY_FEC, /*! value is an int, 1 encode with FEC, 0 do not use FEC. */
|
||||
OPUS_ATTR_KEY_DTX, /*! value is an int, 1 dtx is enabled, 0 dtx not enabled. */
|
||||
OPUS_ATTR_KEY_SPROP_CAPTURE_RATE, /*! value is an int (8000-48000), likely input rate we're going to produce. */
|
||||
OPUS_ATTR_KEY_SPROP_STEREO, /*! value is an int, 1 likely to send stereo, 0 likely to send mono. */
|
||||
};
|
||||
/*! \brief Maximum sampling rate an endpoint is capable of receiving */
|
||||
#define CODEC_OPUS_ATTR_MAX_PLAYBACK_RATE "maxplaybackrate"
|
||||
/*! \brief An alias for maxplaybackrate (used in older versions) */
|
||||
#define CODEC_OPUS_ATTR_MAX_CODED_AUDIO_BANDWIDTH "maxcodedaudiobandwidth"
|
||||
/*! \brief Maximum sampling rate an endpoint is capable of sending */
|
||||
#define CODEC_OPUS_ATTR_SPROP_MAX_CAPTURE_RATE "sprop-maxcapturerate"
|
||||
/*! \brief Maximum duration of packet (in milliseconds) */
|
||||
#define CODEC_OPUS_ATTR_MAX_PTIME "maxptime"
|
||||
/*! \brief Duration of packet (in milliseconds) */
|
||||
#define CODEC_OPUS_ATTR_PTIME "ptime"
|
||||
/*! \brief Maximum average received bit rate (in bits per second) */
|
||||
#define CODEC_OPUS_ATTR_MAX_AVERAGE_BITRATE "maxaveragebitrate"
|
||||
/*! \brief Decode stereo (1) vs mono (0) */
|
||||
#define CODEC_OPUS_ATTR_STEREO "stereo"
|
||||
/*! \brief Likeliness of sender producing stereo (1) vs mono (0) */
|
||||
#define CODEC_OPUS_ATTR_SPROP_STEREO "sprop-stereo"
|
||||
/*! \brief Decoder prefers a constant (1) vs variable (0) bitrate */
|
||||
#define CODEC_OPUS_ATTR_CBR "cbr"
|
||||
/*! \brief Use forward error correction (1) or not (0) */
|
||||
#define CODEC_OPUS_ATTR_FEC "useinbandfec"
|
||||
/*! \brief Use discontinuous transmission (1) or not (0) */
|
||||
#define CODEC_OPUS_ATTR_DTX "usedtx"
|
||||
/*! \brief Custom data object */
|
||||
#define CODEC_OPUS_ATTR_DATA "data"
|
||||
|
||||
/*! \brief Default attribute values */
|
||||
#define CODEC_OPUS_DEFAULT_SAMPLE_RATE 48000
|
||||
#define CODEC_OPUS_DEFAULT_MAX_PLAYBACK_RATE 48000
|
||||
#define CODEC_OPUS_DEFAULT_MAX_PTIME 120
|
||||
#define CODEC_OPUS_DEFAULT_PTIME 20
|
||||
#define CODEC_OPUS_DEFAULT_BITRATE -1000 /* OPUS_AUTO */
|
||||
#define CODEC_OPUS_DEFAULT_CBR 0
|
||||
#define CODEC_OPUS_DEFAULT_FEC 0
|
||||
#define CODEC_OPUS_DEFAULT_DTX 0
|
||||
#define CODEC_OPUS_DEFAULT_STEREO 0
|
||||
|
||||
#endif /* _AST_FORMAT_OPUS_H */
|
||||
|
@@ -63,6 +63,100 @@ struct ast_sdp_srtp *ast_sdp_srtp_alloc(void);
|
||||
*/
|
||||
void ast_sdp_srtp_destroy(struct ast_sdp_srtp *srtp);
|
||||
|
||||
/*! \brief Destroy a previously allocated ast_sdp_crypto struct */
|
||||
typedef void (*sdp_crypto_destroy_cb)(struct ast_sdp_crypto *crypto);
|
||||
|
||||
/*!
|
||||
* \brief Initialize and return an ast_sdp_crypto struct
|
||||
*
|
||||
* \details
|
||||
* This function allocates a new ast_sdp_crypto struct and initializes its values
|
||||
*
|
||||
* \retval NULL on failure
|
||||
* \retval a pointer to a new ast_sdp_crypto structure
|
||||
*/
|
||||
typedef struct ast_sdp_crypto *(*sdp_crypto_alloc_cb)(void);
|
||||
|
||||
/*!
|
||||
* \brief Generate an SRTP a=crypto offer
|
||||
*
|
||||
* \details
|
||||
* The offer is stored on the ast_sdp_crypto struct in a_crypto
|
||||
*
|
||||
* \param crypto A valid ast_sdp_crypto struct
|
||||
* \param taglen Length
|
||||
*
|
||||
* \retval 0 success
|
||||
* \retval nonzero failure
|
||||
*/
|
||||
typedef int (*sdp_crypto_build_offer_cb)(struct ast_sdp_crypto *crypto, int taglen);
|
||||
|
||||
/*!
|
||||
* \brief Parse the a=crypto line from SDP and set appropriate values on the
|
||||
* ast_sdp_crypto struct.
|
||||
*
|
||||
* The attribute line should already have "a=crypto:" removed.
|
||||
*
|
||||
* \param p A valid ast_sdp_crypto struct
|
||||
* \param attr the a:crypto line from SDP
|
||||
* \param rtp The rtp instance associated with the SDP being parsed
|
||||
* \param srtp SRTP structure
|
||||
*
|
||||
* \retval 0 success
|
||||
* \retval nonzero failure
|
||||
*/
|
||||
typedef int (*sdp_crypto_parse_offer_cb)(struct ast_rtp_instance *rtp, struct ast_sdp_srtp *srtp, const char *attr);
|
||||
|
||||
/*!
|
||||
* \brief Get the crypto attribute line for the srtp structure
|
||||
*
|
||||
* \details
|
||||
* The attribute line does not contain the initial "a=crypto:" and does
|
||||
* not terminate with "\r\n".
|
||||
*
|
||||
* \param srtp The ast_sdp_srtp structure for which to get an attribute line
|
||||
* \param dtls_enabled Whether this connection is encrypted with datagram TLS
|
||||
* \param default_taglen_32 Whether to default to a tag length of 32 instead of 80
|
||||
*
|
||||
* \retval An attribute line containing cryptographic information
|
||||
* \retval NULL if the srtp structure does not require an attribute line containing crypto information
|
||||
*/
|
||||
typedef const char *(*sdp_srtp_get_attr_cb)(struct ast_sdp_srtp *srtp, int dtls_enabled, int default_taglen_32);
|
||||
|
||||
struct ast_sdp_crypto_api {
|
||||
/*! Destroy a crypto struct */
|
||||
sdp_crypto_destroy_cb dtor;
|
||||
/*! Allocate a crypto struct */
|
||||
sdp_crypto_alloc_cb alloc;
|
||||
/*! Build a SDP a=crypto offer line parameter string */
|
||||
sdp_crypto_build_offer_cb build_offer;
|
||||
/*! Parse a SDP a=crypto offer line parameter string */
|
||||
sdp_crypto_parse_offer_cb parse_offer;
|
||||
/*! Get the SDP a=crypto offer line parameter string */
|
||||
sdp_srtp_get_attr_cb get_attr;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Register SDP SRTP crypto processing routines.
|
||||
* \since 14.0.0
|
||||
*
|
||||
* \param api Callbacks to register.
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error.
|
||||
*/
|
||||
int ast_sdp_crypto_register(struct ast_sdp_crypto_api *api);
|
||||
|
||||
/*!
|
||||
* \brief Unregister SDP SRTP crypto processing routines.
|
||||
* \since 14.0.0
|
||||
*
|
||||
* \param api Callbacks to unregister.
|
||||
*
|
||||
* \return Nothing
|
||||
*/
|
||||
void ast_sdp_crypto_unregister(struct ast_sdp_crypto_api *api);
|
||||
|
||||
/*! \brief Initialize an return an ast_sdp_crypto struct
|
||||
*
|
||||
* \details
|
||||
@@ -104,7 +198,6 @@ int ast_sdp_crypto_process(struct ast_rtp_instance *rtp, struct ast_sdp_srtp *sr
|
||||
*/
|
||||
int ast_sdp_crypto_build_offer(struct ast_sdp_crypto *p, int taglen);
|
||||
|
||||
|
||||
/*! \brief Get the crypto attribute line for the srtp structure
|
||||
*
|
||||
* The attribute line does not contain the initial "a=crypto:" and does
|
||||
|
@@ -591,11 +591,6 @@ void ast_unregister_thread(void *id)
|
||||
}
|
||||
}
|
||||
|
||||
int ast_pbx_uuid_get(char *pbx_uuid, int length)
|
||||
{
|
||||
return ast_db_get("pbx", "UUID", pbx_uuid, length);
|
||||
}
|
||||
|
||||
/*! \brief Give an overview of core settings */
|
||||
static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
@@ -1040,6 +1035,11 @@ static char *handle_clear_profile(struct ast_cli_entry *e, int cmd, struct ast_c
|
||||
|
||||
#endif /* ! LOW_MEMORY */
|
||||
|
||||
int ast_pbx_uuid_get(char *pbx_uuid, int length)
|
||||
{
|
||||
return ast_db_get("pbx", "UUID", pbx_uuid, length);
|
||||
}
|
||||
|
||||
static void publish_fully_booted(void)
|
||||
{
|
||||
RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
|
||||
@@ -4454,11 +4454,6 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
|
||||
|
||||
aco_init();
|
||||
|
||||
if (init_logger()) { /* Start logging subsystem */
|
||||
printf("Failed: init_logger\n%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ast_bucket_init()) {
|
||||
printf("Failed: ast_bucket_init\n%s", term_quit());
|
||||
exit(1);
|
||||
@@ -4503,6 +4498,11 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
|
||||
|
||||
threadstorage_init();
|
||||
|
||||
if (init_logger()) { /* Start logging subsystem */
|
||||
printf("Failed: init_logger\n%s", term_quit());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ast_rtp_engine_init()) {
|
||||
printf("Failed: ast_rtp_engine_init\n%s", term_quit());
|
||||
exit(1);
|
||||
|
@@ -479,6 +479,7 @@ static void make_components(struct logchannel *chan)
|
||||
* with calculating the ast_verb_sys_level value.
|
||||
*/
|
||||
chan->verbosity = -1;
|
||||
logmask |= (1 << __LOG_VERBOSE);
|
||||
} else {
|
||||
chan->verbosity = verb_level;
|
||||
}
|
||||
@@ -663,7 +664,8 @@ static int init_logger_chain(const char *altconf)
|
||||
return -1;
|
||||
}
|
||||
chan->type = LOGTYPE_CONSOLE;
|
||||
chan->logmask = __LOG_WARNING | __LOG_NOTICE | __LOG_ERROR;
|
||||
chan->logmask = (1 << __LOG_WARNING) | (1 << __LOG_NOTICE) | (1 << __LOG_ERROR)
|
||||
| (1 << __LOG_VERBOSE);
|
||||
memcpy(&chan->formatter, &logformatter_default, sizeof(chan->formatter));
|
||||
|
||||
AST_RWLIST_INSERT_HEAD(&logchannels, chan, list);
|
||||
|
@@ -161,6 +161,9 @@ static enum ast_presence_state ast_presence_state_helper(const char *presence_pr
|
||||
[AST_PRESENCE_DND] = 7
|
||||
};
|
||||
|
||||
*subtype = NULL;
|
||||
*message = NULL;
|
||||
|
||||
while ((label = strsep(&labels, "&"))) {
|
||||
enum ast_presence_state next_state = AST_PRESENCE_INVALID;
|
||||
char *next_subtype = NULL;
|
||||
|
@@ -747,18 +747,18 @@ static void rtp_codecs_payloads_copy_rx(struct ast_rtp_codecs *src, struct ast_r
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
* \brief Remove other matching payload mappings.
|
||||
* \brief Determine if a type of payload is already present in mappings.
|
||||
* \since 14.0.0
|
||||
*
|
||||
* \param codecs Codecs that need tx mappings removed.
|
||||
* \param instance RTP instance to notify of any payloads removed.
|
||||
* \param codecs Codecs to be checked for mappings.
|
||||
* \param to_match Payload type object to compare against.
|
||||
*
|
||||
* \note It is assumed that codecs is write locked before calling.
|
||||
*
|
||||
* \return Nothing
|
||||
* \retval 0 not found
|
||||
* \retval 1 found
|
||||
*/
|
||||
static void payload_mapping_tx_remove_other_mappings(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_rtp_payload_type *to_match)
|
||||
static int payload_mapping_tx_is_present(const struct ast_rtp_codecs *codecs, const struct ast_rtp_payload_type *to_match)
|
||||
{
|
||||
int idx;
|
||||
struct ast_rtp_payload_type *current;
|
||||
@@ -766,12 +766,18 @@ static void payload_mapping_tx_remove_other_mappings(struct ast_rtp_codecs *code
|
||||
for (idx = 0; idx < AST_VECTOR_SIZE(&codecs->payload_mapping_tx); ++idx) {
|
||||
current = AST_VECTOR_GET(&codecs->payload_mapping_tx, idx);
|
||||
|
||||
if (!current || current == to_match) {
|
||||
if (!current) {
|
||||
continue;
|
||||
}
|
||||
if (current == to_match) {
|
||||
/* The exact object is already in the mapping. */
|
||||
return 1;
|
||||
}
|
||||
if (current->asterisk_format && to_match->asterisk_format) {
|
||||
if (ast_format_cmp(current->format, to_match->format) == AST_FORMAT_CMP_NOT_EQUAL) {
|
||||
if (ast_format_get_codec_id(current->format) != ast_format_get_codec_id(to_match->format)) {
|
||||
continue;
|
||||
} else if (current->payload == to_match->payload) {
|
||||
return 0;
|
||||
}
|
||||
} else if (!current->asterisk_format && !to_match->asterisk_format) {
|
||||
if (current->rtp_code != to_match->rtp_code) {
|
||||
@@ -781,13 +787,10 @@ static void payload_mapping_tx_remove_other_mappings(struct ast_rtp_codecs *code
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Remove other mapping */
|
||||
AST_VECTOR_REPLACE(&codecs->payload_mapping_tx, idx, NULL);
|
||||
ao2_ref(current, -1);
|
||||
if (instance && instance->engine && instance->engine->payload_set) {
|
||||
instance->engine->payload_set(instance, idx, 0, NULL, 0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -827,13 +830,14 @@ static void rtp_codecs_payloads_copy_tx(struct ast_rtp_codecs *src, struct ast_r
|
||||
if (instance && instance->engine && instance->engine->payload_set) {
|
||||
instance->engine->payload_set(instance, idx, type->asterisk_format, type->format, type->rtp_code);
|
||||
}
|
||||
|
||||
payload_mapping_tx_remove_other_mappings(dest, instance, type);
|
||||
}
|
||||
}
|
||||
|
||||
void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance)
|
||||
{
|
||||
int idx;
|
||||
struct ast_rtp_payload_type *type;
|
||||
|
||||
ast_rwlock_wrlock(&dest->codecs_lock);
|
||||
|
||||
/* Deadlock avoidance because of held write lock. */
|
||||
@@ -843,6 +847,17 @@ void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_cod
|
||||
ast_rwlock_wrlock(&dest->codecs_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* This represents a completely new mapping of what the remote party is
|
||||
* expecting for payloads, so we clear out the entire tx payload mapping
|
||||
* vector and replace it.
|
||||
*/
|
||||
for (idx = 0; idx < AST_VECTOR_SIZE(&dest->payload_mapping_tx); ++idx) {
|
||||
type = AST_VECTOR_GET(&dest->payload_mapping_tx, idx);
|
||||
ao2_t_cleanup(type, "destroying ast_rtp_codec tx mapping");
|
||||
AST_VECTOR_REPLACE(&dest->payload_mapping_tx, idx, NULL);
|
||||
}
|
||||
|
||||
rtp_codecs_payloads_copy_rx(src, dest, instance);
|
||||
rtp_codecs_payloads_copy_tx(src, dest, instance);
|
||||
dest->framing = src->framing;
|
||||
@@ -915,18 +930,20 @@ void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct as
|
||||
|
||||
ast_rwlock_wrlock(&codecs->codecs_lock);
|
||||
|
||||
if (payload < AST_VECTOR_SIZE(&codecs->payload_mapping_tx)) {
|
||||
ao2_t_cleanup(AST_VECTOR_GET(&codecs->payload_mapping_tx, payload),
|
||||
"cleaning up replaced tx payload type");
|
||||
}
|
||||
AST_VECTOR_REPLACE(&codecs->payload_mapping_tx, payload, new_type);
|
||||
if (!payload_mapping_tx_is_present(codecs, new_type)) {
|
||||
if (payload < AST_VECTOR_SIZE(&codecs->payload_mapping_tx)) {
|
||||
ao2_t_cleanup(AST_VECTOR_GET(&codecs->payload_mapping_tx, payload),
|
||||
"cleaning up replaced tx payload type");
|
||||
}
|
||||
AST_VECTOR_REPLACE(&codecs->payload_mapping_tx, payload, new_type);
|
||||
|
||||
if (instance && instance->engine && instance->engine->payload_set) {
|
||||
instance->engine->payload_set(instance, payload, new_type->asterisk_format, new_type->format, new_type->rtp_code);
|
||||
if (instance && instance->engine && instance->engine->payload_set) {
|
||||
instance->engine->payload_set(instance, payload, new_type->asterisk_format, new_type->format, new_type->rtp_code);
|
||||
}
|
||||
} else {
|
||||
ao2_ref(new_type, -1);
|
||||
}
|
||||
|
||||
payload_mapping_tx_remove_other_mappings(codecs, instance, new_type);
|
||||
|
||||
ast_rwlock_unlock(&codecs->codecs_lock);
|
||||
}
|
||||
|
||||
@@ -983,22 +1000,26 @@ int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs,
|
||||
} else {
|
||||
new_type->format = t->payload_type.format;
|
||||
}
|
||||
|
||||
if (new_type->format) {
|
||||
/* SDP parsing automatically increases the reference count */
|
||||
new_type->format = ast_format_parse_sdp_fmtp(new_type->format, "");
|
||||
}
|
||||
|
||||
if (pt < AST_VECTOR_SIZE(&codecs->payload_mapping_tx)) {
|
||||
ao2_t_cleanup(AST_VECTOR_GET(&codecs->payload_mapping_tx, pt),
|
||||
"cleaning up replaced tx payload type");
|
||||
}
|
||||
AST_VECTOR_REPLACE(&codecs->payload_mapping_tx, pt, new_type);
|
||||
if (!payload_mapping_tx_is_present(codecs, new_type)) {
|
||||
if (pt < AST_VECTOR_SIZE(&codecs->payload_mapping_tx)) {
|
||||
ao2_t_cleanup(AST_VECTOR_GET(&codecs->payload_mapping_tx, pt),
|
||||
"cleaning up replaced tx payload type");
|
||||
}
|
||||
AST_VECTOR_REPLACE(&codecs->payload_mapping_tx, pt, new_type);
|
||||
|
||||
if (instance && instance->engine && instance->engine->payload_set) {
|
||||
instance->engine->payload_set(instance, pt, new_type->asterisk_format, new_type->format, new_type->rtp_code);
|
||||
if (instance && instance->engine && instance->engine->payload_set) {
|
||||
instance->engine->payload_set(instance, pt, new_type->asterisk_format, new_type->format, new_type->rtp_code);
|
||||
}
|
||||
} else {
|
||||
ao2_ref(new_type, -1);
|
||||
}
|
||||
|
||||
payload_mapping_tx_remove_other_mappings(codecs, instance, new_type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1081,11 +1102,14 @@ int ast_rtp_codecs_payload_replace_format(struct ast_rtp_codecs *codecs, int pay
|
||||
type->primary_mapping = 1;
|
||||
|
||||
ast_rwlock_wrlock(&codecs->codecs_lock);
|
||||
if (payload < AST_VECTOR_SIZE(&codecs->payload_mapping_tx)) {
|
||||
ao2_cleanup(AST_VECTOR_GET(&codecs->payload_mapping_tx, payload));
|
||||
if (!payload_mapping_tx_is_present(codecs, type)) {
|
||||
if (payload < AST_VECTOR_SIZE(&codecs->payload_mapping_tx)) {
|
||||
ao2_cleanup(AST_VECTOR_GET(&codecs->payload_mapping_tx, payload));
|
||||
}
|
||||
AST_VECTOR_REPLACE(&codecs->payload_mapping_tx, payload, type);
|
||||
} else {
|
||||
ao2_ref(type, -1);
|
||||
}
|
||||
AST_VECTOR_REPLACE(&codecs->payload_mapping_tx, payload, type);
|
||||
payload_mapping_tx_remove_other_mappings(codecs, NULL, type);
|
||||
ast_rwlock_unlock(&codecs->codecs_lock);
|
||||
|
||||
return 0;
|
||||
@@ -2257,7 +2281,11 @@ static void add_static_payload(int map, struct ast_format *format, int rtp_code)
|
||||
int x;
|
||||
struct ast_rtp_payload_type *type;
|
||||
|
||||
ast_assert(map < ARRAY_LEN(static_RTP_PT));
|
||||
/*
|
||||
* ARRAY_LEN's result is cast to an int so 'map' is not autocast to a size_t,
|
||||
* which if negative would cause an assertion.
|
||||
*/
|
||||
ast_assert(map < (int)ARRAY_LEN(static_RTP_PT));
|
||||
|
||||
ast_rwlock_wrlock(&static_RTP_PT_lock);
|
||||
if (map < 0) {
|
||||
@@ -2268,6 +2296,7 @@ static void add_static_payload(int map, struct ast_format *format, int rtp_code)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (map < 0) {
|
||||
if (format) {
|
||||
ast_log(LOG_WARNING, "No Dynamic RTP mapping available for format %s\n",
|
||||
@@ -2300,14 +2329,10 @@ static void add_static_payload(int map, struct ast_format *format, int rtp_code)
|
||||
|
||||
int ast_rtp_engine_load_format(struct ast_format *format)
|
||||
{
|
||||
char *codec_name = ast_strdupa(ast_format_get_name(format));
|
||||
|
||||
codec_name = ast_str_to_upper(codec_name);
|
||||
|
||||
set_next_mime_type(format,
|
||||
0,
|
||||
ast_codec_media_type2str(ast_format_get_type(format)),
|
||||
codec_name,
|
||||
ast_format_get_codec_name(format),
|
||||
ast_format_get_sample_rate(format));
|
||||
add_static_payload(-1, format, 0);
|
||||
|
||||
@@ -2690,11 +2715,6 @@ int ast_rtp_engine_init(void)
|
||||
/* Opus and VP8 */
|
||||
set_next_mime_type(ast_format_opus, 0, "audio", "opus", 48000);
|
||||
set_next_mime_type(ast_format_vp8, 0, "video", "VP8", 90000);
|
||||
/* DA SILK */
|
||||
set_next_mime_type(ast_format_silk8, 0, "audio", "silk", 8000);
|
||||
set_next_mime_type(ast_format_silk12, 0, "audio", "silk", 12000);
|
||||
set_next_mime_type(ast_format_silk16, 0, "audio", "silk", 16000);
|
||||
set_next_mime_type(ast_format_silk24, 0, "audio", "silk", 24000);
|
||||
|
||||
/* Define the static rtp payload mappings */
|
||||
add_static_payload(0, ast_format_ulaw, 0);
|
||||
@@ -2748,11 +2768,6 @@ int ast_rtp_engine_init(void)
|
||||
add_static_payload(100, ast_format_vp8, 0);
|
||||
add_static_payload(107, ast_format_opus, 0);
|
||||
|
||||
add_static_payload(108, ast_format_silk8, 0);
|
||||
add_static_payload(109, ast_format_silk12, 0);
|
||||
add_static_payload(113, ast_format_silk16, 0);
|
||||
add_static_payload(114, ast_format_silk24, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
606
main/sdp_srtp.c
606
main/sdp_srtp.c
@@ -33,18 +33,12 @@
|
||||
|
||||
ASTERISK_REGISTER_FILE()
|
||||
|
||||
#include <math.h> /* for pow */
|
||||
#include <srtp/srtp.h> /* for SRTP_MAX_KEY_LEN, etc */
|
||||
|
||||
#include "asterisk/linkedlists.h" /* for AST_LIST_NEXT, etc */
|
||||
#include "asterisk/logger.h" /* for ast_log, LOG_ERROR, etc */
|
||||
#include "asterisk/rtp_engine.h" /* for ast_rtp_engine_dtls, etc */
|
||||
#include "asterisk/sdp_srtp.h" /* for ast_sdp_srtp, etc */
|
||||
#include "asterisk/strings.h" /* for ast_strlen_zero */
|
||||
#include "asterisk/utils.h" /* for ast_set_flag, ast_test_flag, etc */
|
||||
|
||||
extern struct ast_srtp_res *res_srtp;
|
||||
extern struct ast_srtp_policy_res *res_srtp_policy;
|
||||
/*! Registered SDP crypto API */
|
||||
static struct ast_sdp_crypto_api *sdp_crypto_api;
|
||||
|
||||
struct ast_sdp_srtp *ast_sdp_srtp_alloc(void)
|
||||
{
|
||||
@@ -63,603 +57,49 @@ void ast_sdp_srtp_destroy(struct ast_sdp_srtp *srtp)
|
||||
for (next = AST_LIST_NEXT(srtp, sdp_srtp_list);
|
||||
srtp;
|
||||
srtp = next, next = srtp ? AST_LIST_NEXT(srtp, sdp_srtp_list) : NULL) {
|
||||
if (srtp->crypto) {
|
||||
ast_sdp_crypto_destroy(srtp->crypto);
|
||||
}
|
||||
ast_sdp_crypto_destroy(srtp->crypto);
|
||||
srtp->crypto = NULL;
|
||||
ast_free(srtp);
|
||||
}
|
||||
}
|
||||
|
||||
struct ast_sdp_crypto {
|
||||
char *a_crypto;
|
||||
unsigned char local_key[SRTP_MAX_KEY_LEN];
|
||||
int tag;
|
||||
char local_key64[((SRTP_MAX_KEY_LEN) * 8 + 5) / 6 + 1];
|
||||
unsigned char remote_key[SRTP_MAX_KEY_LEN];
|
||||
int key_len;
|
||||
};
|
||||
|
||||
static struct ast_sdp_crypto *sdp_crypto_alloc(const int key_len);
|
||||
static struct ast_sdp_crypto *crypto_init_keys(struct ast_sdp_crypto *p, const int key_len);
|
||||
static int set_crypto_policy(struct ast_srtp_policy *policy, int suite_val, const unsigned char *master_key, int key_len, unsigned long ssrc, int inbound);
|
||||
|
||||
void ast_sdp_crypto_destroy(struct ast_sdp_crypto *crypto)
|
||||
{
|
||||
ast_free(crypto->a_crypto);
|
||||
crypto->a_crypto = NULL;
|
||||
ast_free(crypto);
|
||||
}
|
||||
|
||||
static struct ast_sdp_crypto *crypto_init_keys(struct ast_sdp_crypto *p, const int key_len)
|
||||
{
|
||||
unsigned char remote_key[key_len];
|
||||
|
||||
if (res_srtp->get_random(p->local_key, key_len) < 0) {
|
||||
return NULL;
|
||||
if (sdp_crypto_api) {
|
||||
sdp_crypto_api->dtor(crypto);
|
||||
}
|
||||
|
||||
ast_base64encode(p->local_key64, p->local_key, key_len, sizeof(p->local_key64));
|
||||
|
||||
p->key_len = ast_base64decode(remote_key, p->local_key64, sizeof(remote_key));
|
||||
|
||||
if (p->key_len != key_len) {
|
||||
ast_log(LOG_ERROR, "base64 encode/decode bad len %d != %d\n", p->key_len, key_len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (memcmp(remote_key, p->local_key, p->key_len)) {
|
||||
ast_log(LOG_ERROR, "base64 encode/decode bad key\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ast_debug(1 , "local_key64 %s len %zu\n", p->local_key64, strlen(p->local_key64));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static struct ast_sdp_crypto *sdp_crypto_alloc(const int key_len)
|
||||
{
|
||||
struct ast_sdp_crypto *p, *result;
|
||||
|
||||
if (!ast_rtp_engine_srtp_is_registered()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(p = ast_calloc(1, sizeof(*p)))) {
|
||||
return NULL;
|
||||
}
|
||||
p->tag = 1;
|
||||
|
||||
/* default is a key which uses AST_AES_CM_128_HMAC_SHA1_xx */
|
||||
result = crypto_init_keys(p, key_len);
|
||||
if (!result) {
|
||||
ast_sdp_crypto_destroy(p);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct ast_sdp_crypto *ast_sdp_crypto_alloc(void)
|
||||
{
|
||||
return sdp_crypto_alloc(SRTP_MASTER_KEY_LEN);
|
||||
}
|
||||
|
||||
static int set_crypto_policy(struct ast_srtp_policy *policy, int suite_val, const unsigned char *master_key, int key_len, unsigned long ssrc, int inbound)
|
||||
{
|
||||
if (!ast_rtp_engine_srtp_is_registered()) {
|
||||
return -1;
|
||||
if (!sdp_crypto_api) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (res_srtp_policy->set_master_key(policy, master_key, key_len, NULL, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (res_srtp_policy->set_suite(policy, suite_val)) {
|
||||
ast_log(LOG_WARNING, "Could not set remote SRTP suite\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
res_srtp_policy->set_ssrc(policy, ssrc, inbound);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int crypto_activate(struct ast_sdp_crypto *p, int suite_val, unsigned char *remote_key, int key_len, struct ast_rtp_instance *rtp)
|
||||
{
|
||||
struct ast_srtp_policy *local_policy = NULL;
|
||||
struct ast_srtp_policy *remote_policy = NULL;
|
||||
struct ast_rtp_instance_stats stats = {0,};
|
||||
int res = -1;
|
||||
|
||||
if (!ast_rtp_engine_srtp_is_registered()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!p) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(local_policy = res_srtp_policy->alloc())) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(remote_policy = res_srtp_policy->alloc())) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (ast_rtp_instance_get_stats(rtp, &stats, AST_RTP_INSTANCE_STAT_LOCAL_SSRC)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (set_crypto_policy(local_policy, suite_val, p->local_key, key_len, stats.local_ssrc, 0) < 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (set_crypto_policy(remote_policy, suite_val, remote_key, key_len, 0, 1) < 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Add the SRTP policies */
|
||||
if (ast_rtp_instance_add_srtp_policy(rtp, remote_policy, local_policy, 0)) {
|
||||
ast_log(LOG_WARNING, "Could not set SRTP policies\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ast_debug(1 , "SRTP policy activated\n");
|
||||
res = 0;
|
||||
|
||||
err:
|
||||
if (local_policy) {
|
||||
res_srtp_policy->destroy(local_policy);
|
||||
}
|
||||
|
||||
if (remote_policy) {
|
||||
res_srtp_policy->destroy(remote_policy);
|
||||
}
|
||||
|
||||
return res;
|
||||
return sdp_crypto_api->alloc();
|
||||
}
|
||||
|
||||
int ast_sdp_crypto_process(struct ast_rtp_instance *rtp, struct ast_sdp_srtp *srtp, const char *attr)
|
||||
{
|
||||
char *str = NULL;
|
||||
char *tag = NULL;
|
||||
char *suite = NULL;
|
||||
char *key_params = NULL;
|
||||
char *key_param = NULL;
|
||||
char *session_params = NULL;
|
||||
char *key_salt = NULL; /* The actual master key and key salt */
|
||||
char *lifetime = NULL; /* Key lifetime (# of RTP packets) */
|
||||
char *mki = NULL; /* Master Key Index */
|
||||
int found = 0;
|
||||
int key_len_from_sdp;
|
||||
int key_len_expected;
|
||||
int tag_from_sdp;
|
||||
int suite_val = 0;
|
||||
unsigned char remote_key[SRTP_MAX_KEY_LEN];
|
||||
int taglen;
|
||||
double sdes_lifetime;
|
||||
struct ast_sdp_crypto *crypto;
|
||||
struct ast_sdp_srtp *tmp;
|
||||
|
||||
if (!ast_rtp_engine_srtp_is_registered()) {
|
||||
if (!sdp_crypto_api) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
str = ast_strdupa(attr);
|
||||
|
||||
tag = strsep(&str, " ");
|
||||
suite = strsep(&str, " ");
|
||||
key_params = strsep(&str, " ");
|
||||
session_params = strsep(&str, " ");
|
||||
|
||||
if (!tag || !suite) {
|
||||
ast_log(LOG_WARNING, "Unrecognized crypto attribute a=%s\n", attr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* RFC4568 9.1 - tag is 1-9 digits, greater than zero */
|
||||
if (sscanf(tag, "%30d", &tag_from_sdp) != 1 || tag_from_sdp <= 0 || tag_from_sdp > 999999999) {
|
||||
ast_log(LOG_WARNING, "Unacceptable a=crypto tag: %s\n", tag);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ast_strlen_zero(session_params)) {
|
||||
ast_log(LOG_WARNING, "Unsupported crypto parameters: %s\n", session_params);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* On egress, Asterisk sent several crypto lines in the SIP/SDP offer
|
||||
The remote party might have choosen another line than the first */
|
||||
for (tmp = srtp; tmp && tmp->crypto && tmp->crypto->tag != tag_from_sdp;) {
|
||||
tmp = AST_LIST_NEXT(tmp, sdp_srtp_list);
|
||||
}
|
||||
if (tmp) { /* tag matched an already created crypto line */
|
||||
unsigned int flags = tmp->flags;
|
||||
|
||||
/* Make that crypto line the head of the list, not by changing the
|
||||
list structure but by exchanging the content of the list members */
|
||||
crypto = tmp->crypto;
|
||||
tmp->crypto = srtp->crypto;
|
||||
tmp->flags = srtp->flags;
|
||||
srtp->crypto = crypto;
|
||||
srtp->flags = flags;
|
||||
} else {
|
||||
crypto = srtp->crypto;
|
||||
crypto->tag = tag_from_sdp;
|
||||
}
|
||||
|
||||
if (!strcmp(suite, "AES_CM_128_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_128_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
key_len_expected = 30;
|
||||
} else if (!strcmp(suite, "AES_CM_128_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_128_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
key_len_expected = 30;
|
||||
#ifdef HAVE_SRTP_192
|
||||
} else if (!strcmp(suite, "AES_192_CM_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_192_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_192);
|
||||
key_len_expected = 38;
|
||||
} else if (!strcmp(suite, "AES_192_CM_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_192_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_192);
|
||||
key_len_expected = 38;
|
||||
/* RFC used a different name while in draft, some still use that */
|
||||
} else if (!strcmp(suite, "AES_CM_192_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_192_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_192);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
|
||||
key_len_expected = 38;
|
||||
} else if (!strcmp(suite, "AES_CM_192_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_192_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_192);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
|
||||
key_len_expected = 38;
|
||||
#endif
|
||||
#ifdef HAVE_SRTP_256
|
||||
} else if (!strcmp(suite, "AES_256_CM_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_256_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
key_len_expected = 46;
|
||||
} else if (!strcmp(suite, "AES_256_CM_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_256_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
key_len_expected = 46;
|
||||
/* RFC used a different name while in draft, some still use that */
|
||||
} else if (!strcmp(suite, "AES_CM_256_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_256_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
|
||||
key_len_expected = 46;
|
||||
} else if (!strcmp(suite, "AES_CM_256_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_256_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
|
||||
key_len_expected = 46;
|
||||
#endif
|
||||
#ifdef HAVE_SRTP_GCM
|
||||
} else if (!strcmp(suite, "AEAD_AES_128_GCM")) {
|
||||
suite_val = AST_AES_GCM_128;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_16);
|
||||
key_len_expected = AES_128_GCM_KEYSIZE_WSALT;
|
||||
} else if (!strcmp(suite, "AEAD_AES_256_GCM")) {
|
||||
suite_val = AST_AES_GCM_256;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_16);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
key_len_expected = AES_256_GCM_KEYSIZE_WSALT;
|
||||
/* RFC contained a (too) short auth tag for RTP media, some still use that */
|
||||
} else if (!strcmp(suite, "AEAD_AES_128_GCM_8")) {
|
||||
suite_val = AST_AES_GCM_128_8;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_8);
|
||||
key_len_expected = AES_128_GCM_KEYSIZE_WSALT;
|
||||
} else if (!strcmp(suite, "AEAD_AES_256_GCM_8")) {
|
||||
suite_val = AST_AES_GCM_256_8;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_8);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
key_len_expected = AES_256_GCM_KEYSIZE_WSALT;
|
||||
#endif
|
||||
} else {
|
||||
ast_verb(1, "Unsupported crypto suite: %s\n", suite);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((key_param = strsep(&key_params, ";"))) {
|
||||
unsigned int n_lifetime;
|
||||
char *method = NULL;
|
||||
char *info = NULL;
|
||||
|
||||
method = strsep(&key_param, ":");
|
||||
info = strsep(&key_param, ";");
|
||||
sdes_lifetime = 0;
|
||||
|
||||
if (strcmp(method, "inline")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
key_salt = strsep(&info, "|");
|
||||
|
||||
/* The next parameter can be either lifetime or MKI */
|
||||
lifetime = strsep(&info, "|");
|
||||
if (!lifetime) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
mki = strchr(lifetime, ':');
|
||||
if (mki) {
|
||||
mki = lifetime;
|
||||
lifetime = NULL;
|
||||
} else {
|
||||
mki = strsep(&info, "|");
|
||||
}
|
||||
|
||||
if (mki && *mki != '1') {
|
||||
ast_log(LOG_NOTICE, "Crypto MKI handling is not supported: ignoring attribute %s\n", attr);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lifetime) {
|
||||
if (!strncmp(lifetime, "2^", 2)) {
|
||||
char *lifetime_val = lifetime + 2;
|
||||
|
||||
/* Exponential lifetime */
|
||||
if (sscanf(lifetime_val, "%30u", &n_lifetime) != 1) {
|
||||
ast_log(LOG_NOTICE, "Failed to parse lifetime value in crypto attribute: %s\n", attr);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (n_lifetime > 48) {
|
||||
/* Yeah... that's a bit big. */
|
||||
ast_log(LOG_NOTICE, "Crypto lifetime exponent of '%u' is a bit large; using 48\n", n_lifetime);
|
||||
n_lifetime = 48;
|
||||
}
|
||||
sdes_lifetime = pow(2, n_lifetime);
|
||||
} else {
|
||||
/* Decimal lifetime */
|
||||
if (sscanf(lifetime, "%30u", &n_lifetime) != 1) {
|
||||
ast_log(LOG_NOTICE, "Failed to parse lifetime value in crypto attribute: %s\n", attr);
|
||||
continue;
|
||||
}
|
||||
sdes_lifetime = n_lifetime;
|
||||
}
|
||||
|
||||
/* Accept anything above 10 hours. Less than 10; reject. */
|
||||
if (sdes_lifetime < 1800000) {
|
||||
ast_log(LOG_NOTICE, "Rejecting crypto attribute '%s': lifetime '%f' too short\n", attr, sdes_lifetime);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ast_debug(2, "Crypto attribute '%s' accepted with lifetime '%f', MKI '%s'\n",
|
||||
attr, sdes_lifetime, mki ? mki : "-");
|
||||
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
ast_log(LOG_NOTICE, "SRTP crypto offer not acceptable: '%s'\n", attr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
key_len_from_sdp = ast_base64decode(remote_key, key_salt, sizeof(remote_key));
|
||||
if (key_len_from_sdp != key_len_expected) {
|
||||
ast_log(LOG_WARNING, "SRTP descriptions key length is '%d', not '%d'\n",
|
||||
key_len_from_sdp, key_len_expected);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* on default, the key is 30 (AES-128); throw that away (only) when the suite changed actually */
|
||||
/* ingress: optional, but saves one expensive call to get_random(.) */
|
||||
/* egress: required, because the local key was communicated before the remote key is processed */
|
||||
if (crypto->key_len != key_len_from_sdp) {
|
||||
if (!crypto_init_keys(crypto, key_len_from_sdp)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (!memcmp(crypto->remote_key, remote_key, key_len_from_sdp)) {
|
||||
ast_debug(1, "SRTP remote key unchanged; maintaining current policy\n");
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OFFER_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (key_len_from_sdp > sizeof(crypto->remote_key)) {
|
||||
ast_log(LOG_ERROR,
|
||||
"SRTP key buffer is %zu although it must be at least %d bytes\n",
|
||||
sizeof(crypto->remote_key), key_len_from_sdp);
|
||||
return -1;
|
||||
}
|
||||
memcpy(crypto->remote_key, remote_key, key_len_from_sdp);
|
||||
|
||||
if (crypto_activate(crypto, suite_val, remote_key, key_len_from_sdp, rtp) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_32)) {
|
||||
taglen = 32;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_16)) {
|
||||
taglen = 16;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_8)) {
|
||||
taglen = 8;
|
||||
} else {
|
||||
taglen = 80;
|
||||
}
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_AES_256)) {
|
||||
taglen |= 0x0200;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_AES_192)) {
|
||||
taglen |= 0x0100;
|
||||
}
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME)) {
|
||||
taglen |= 0x0080;
|
||||
}
|
||||
|
||||
/* Finally, rebuild the crypto line */
|
||||
if (ast_sdp_crypto_build_offer(crypto, taglen)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OFFER_OK);
|
||||
return 0;
|
||||
return sdp_crypto_api->parse_offer(rtp, srtp, attr);
|
||||
}
|
||||
|
||||
int ast_sdp_crypto_build_offer(struct ast_sdp_crypto *p, int taglen)
|
||||
{
|
||||
/* Rebuild the crypto line */
|
||||
if (p->a_crypto) {
|
||||
ast_free(p->a_crypto);
|
||||
if (!sdp_crypto_api) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((taglen & 0x007f) == 8) {
|
||||
if (ast_asprintf(&p->a_crypto, "%d AEAD_AES_%d_GCM_%d inline:%s",
|
||||
p->tag, 128 + ((taglen & 0x0300) >> 2), taglen & 0x007f, p->local_key64) == -1) {
|
||||
ast_log(LOG_ERROR, "Could not allocate memory for crypto line\n");
|
||||
return -1;
|
||||
}
|
||||
} else if ((taglen & 0x007f) == 16) {
|
||||
if (ast_asprintf(&p->a_crypto, "%d AEAD_AES_%d_GCM inline:%s",
|
||||
p->tag, 128 + ((taglen & 0x0300) >> 2), p->local_key64) == -1) {
|
||||
ast_log(LOG_ERROR, "Could not allocate memory for crypto line\n");
|
||||
return -1;
|
||||
}
|
||||
} else if ((taglen & 0x0300) && !(taglen & 0x0080)) {
|
||||
if (ast_asprintf(&p->a_crypto, "%d AES_%d_CM_HMAC_SHA1_%d inline:%s",
|
||||
p->tag, 128 + ((taglen & 0x0300) >> 2), taglen & 0x007f, p->local_key64) == -1) {
|
||||
ast_log(LOG_ERROR, "Could not allocate memory for crypto line\n");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (ast_asprintf(&p->a_crypto, "%d AES_CM_%d_HMAC_SHA1_%d inline:%s",
|
||||
p->tag, 128 + ((taglen & 0x0300) >> 2), taglen & 0x007f, p->local_key64) == -1) {
|
||||
ast_log(LOG_ERROR, "Could not allocate memory for crypto line\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ast_debug(1, "Crypto line: a=crypto:%s\n", p->a_crypto);
|
||||
|
||||
return 0;
|
||||
return sdp_crypto_api->build_offer(p, taglen);
|
||||
}
|
||||
|
||||
const char *ast_sdp_srtp_get_attrib(struct ast_sdp_srtp *srtp, int dtls_enabled, int default_taglen_32)
|
||||
{
|
||||
int taglen;
|
||||
|
||||
if (!srtp) {
|
||||
if (!sdp_crypto_api) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set encryption properties */
|
||||
if (!srtp->crypto) {
|
||||
|
||||
if (AST_LIST_NEXT(srtp, sdp_srtp_list)) {
|
||||
srtp->crypto = ast_sdp_crypto_alloc();
|
||||
ast_log(LOG_ERROR, "SRTP SDP list was not empty\n");
|
||||
} else {
|
||||
const int len = default_taglen_32 ? AST_SRTP_CRYPTO_TAG_32 : AST_SRTP_CRYPTO_TAG_80;
|
||||
const int attr[][3] = {
|
||||
/* This array creates the following list:
|
||||
* a=crypto:1 AES_CM_128_HMAC_SHA1_ ...
|
||||
* a=crypto:2 AEAD_AES_128_GCM ...
|
||||
* a=crypto:3 AES_256_CM_HMAC_SHA1_ ...
|
||||
* a=crypto:4 AEAD_AES_256_GCM ...
|
||||
* a=crypto:5 AES_192_CM_HMAC_SHA1_ ...
|
||||
* something like 'AEAD_AES_192_GCM' is not specified by the RFCs
|
||||
*
|
||||
* If you want to prefer another crypto suite or you want to
|
||||
* exclude a suite, change this array and recompile Asterisk.
|
||||
* This list cannot be changed from rtp.conf because you should
|
||||
* know what you are doing. Especially AES-192 and AES-GCM are
|
||||
* broken in many VoIP clients, see
|
||||
* https://github.com/cisco/libsrtp/pull/170
|
||||
* https://github.com/cisco/libsrtp/pull/184
|
||||
* Furthermore, AES-GCM uses a shorter crypto-suite string which
|
||||
* causes Nokia phones based on Symbian/S60 to reject the whole
|
||||
* INVITE with status 500, even if a matching suite was offered.
|
||||
* AES-256 might just waste your processor cycles, especially if
|
||||
* your TLS transport is not secured with equivalent grade, see
|
||||
* https://security.stackexchange.com/q/61361
|
||||
* Therefore, AES-128 was preferred here.
|
||||
*
|
||||
* If you want to enable one of those defines, please, go for
|
||||
* CFLAGS='-DENABLE_SRTP_AES_GCM' ./configure && sudo make install
|
||||
*/
|
||||
{ len, 0, 30 },
|
||||
#if defined(HAVE_SRTP_GCM) && defined(ENABLE_SRTP_AES_GCM)
|
||||
{ AST_SRTP_CRYPTO_TAG_16, 0, AES_128_GCM_KEYSIZE_WSALT },
|
||||
#endif
|
||||
#if defined(HAVE_SRTP_256) && defined(ENABLE_SRTP_AES_256)
|
||||
{ len, AST_SRTP_CRYPTO_AES_256, 46 },
|
||||
#endif
|
||||
#if defined(HAVE_SRTP_GCM) && defined(ENABLE_SRTP_AES_GCM) && defined(ENABLE_SRTP_AES_256)
|
||||
{ AST_SRTP_CRYPTO_TAG_16, AST_SRTP_CRYPTO_AES_256, AES_256_GCM_KEYSIZE_WSALT },
|
||||
#endif
|
||||
#if defined(HAVE_SRTP_192) && defined(ENABLE_SRTP_AES_192)
|
||||
{ len, AST_SRTP_CRYPTO_AES_192, 38 },
|
||||
#endif
|
||||
};
|
||||
struct ast_sdp_srtp *tmp = srtp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(attr); i++) {
|
||||
if (attr[i][0]) {
|
||||
ast_set_flag(tmp, attr[i][0]);
|
||||
}
|
||||
if (attr[i][1]) {
|
||||
ast_set_flag(tmp, attr[i][1]);
|
||||
}
|
||||
tmp->crypto = sdp_crypto_alloc(attr[i][2]); /* key_len */
|
||||
tmp->crypto->tag = (i + 1); /* tag starts at 1 */
|
||||
|
||||
if (i < ARRAY_LEN(attr) - 1) {
|
||||
AST_LIST_NEXT(tmp, sdp_srtp_list) = ast_sdp_srtp_alloc();
|
||||
tmp = AST_LIST_NEXT(tmp, sdp_srtp_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dtls_enabled) {
|
||||
/* If DTLS-SRTP is enabled the key details will be pulled from TLS */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* set the key length based on INVITE or settings */
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_80)) {
|
||||
taglen = 80;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_32)) {
|
||||
taglen = 32;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_16)) {
|
||||
taglen = 16;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_8)) {
|
||||
taglen = 8;
|
||||
} else {
|
||||
taglen = default_taglen_32 ? 32 : 80;
|
||||
}
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_AES_256)) {
|
||||
taglen |= 0x0200;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_AES_192)) {
|
||||
taglen |= 0x0100;
|
||||
}
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME)) {
|
||||
taglen |= 0x0080;
|
||||
}
|
||||
|
||||
if (srtp->crypto && (ast_sdp_crypto_build_offer(srtp->crypto, taglen) >= 0)) {
|
||||
return srtp->crypto->a_crypto;
|
||||
}
|
||||
|
||||
ast_log(LOG_WARNING, "No SRTP key management enabled\n");
|
||||
return NULL;
|
||||
return sdp_crypto_api->get_attr(srtp, dtls_enabled, default_taglen_32);
|
||||
}
|
||||
|
||||
char *ast_sdp_get_rtp_profile(unsigned int sdes_active, struct ast_rtp_instance *instance, unsigned int using_avpf,
|
||||
@@ -682,3 +122,19 @@ char *ast_sdp_get_rtp_profile(unsigned int sdes_active, struct ast_rtp_instance
|
||||
}
|
||||
}
|
||||
|
||||
int ast_sdp_crypto_register(struct ast_sdp_crypto_api *api)
|
||||
{
|
||||
if (sdp_crypto_api) {
|
||||
return -1;
|
||||
}
|
||||
sdp_crypto_api = api;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ast_sdp_crypto_unregister(struct ast_sdp_crypto_api *api)
|
||||
{
|
||||
if (sdp_crypto_api == api) {
|
||||
sdp_crypto_api = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -28,11 +28,13 @@ WGET=@WGET@
|
||||
FETCH=@FETCH@
|
||||
DOWNLOAD=@DOWNLOAD@
|
||||
SOUNDS_CACHE_DIR=@SOUNDS_CACHE_DIR@
|
||||
EXTERNALS_CACHE_DIR=@EXTERNALS_CACHE_DIR@
|
||||
RUBBER=@RUBBER@
|
||||
CATDVI=@CATDVI@
|
||||
KPATHSEA=@KPATHSEA@
|
||||
XMLLINT=@XMLLINT@
|
||||
XMLSTARLET=@XMLSTARLET@
|
||||
BASH=@BASH@
|
||||
MD5=@MD5@
|
||||
SHA1SUM=@SHA1SUM@
|
||||
OPENSSL=@OPENSSL@
|
||||
@@ -218,6 +220,9 @@ OGG_LIB=@OGG_LIB@
|
||||
OPUS_INCLUDE=@OPUS_INCLUDE@
|
||||
OPUS_LIB=@OPUS_LIB@
|
||||
|
||||
OPUSFILE_INCLUDE=@OPUSFILE_INCLUDE@
|
||||
OPUSFILE_LIB=@OPUSFILE_LIB@
|
||||
|
||||
OSPTK_INCLUDE=@OSPTK_INCLUDE@
|
||||
OSPTK_LIB=@OSPTK_LIB@
|
||||
|
||||
|
@@ -398,6 +398,11 @@ static int process_xml_use_node(xmlNode *node, struct member *mem)
|
||||
return process_xml_ref_node(node, mem, &mem->uses);
|
||||
}
|
||||
|
||||
static int process_xml_member_data_node(xmlNode *node, struct member *mem)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int process_xml_unknown_node(xmlNode *node, struct member *mem)
|
||||
{
|
||||
fprintf(stderr, "Encountered unknown node: %s\n", node->name);
|
||||
@@ -416,6 +421,7 @@ static const struct {
|
||||
{ "depend", process_xml_depend_node },
|
||||
{ "conflict", process_xml_conflict_node },
|
||||
{ "use", process_xml_use_node },
|
||||
{ "member_data", process_xml_member_data_node },
|
||||
};
|
||||
|
||||
static node_handler lookup_node_handler(xmlNode *node)
|
||||
|
@@ -70,6 +70,8 @@ struct member {
|
||||
const char *touch_on_change;
|
||||
const char *support_level;
|
||||
const char *replacement;
|
||||
/*! member_data is just an opaque, member-specific string */
|
||||
const char *member_data;
|
||||
/*! This module is currently selected */
|
||||
unsigned int enabled:1;
|
||||
/*! This module was enabled when the config was loaded */
|
||||
|
13
res/res.xml
Normal file
13
res/res.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<member name="res_digium_phone" displayname="Download the Digium Phone Module for Asterisk. See http://downloads.digium.com/pub/telephony/res_digium_phone/README.">
|
||||
<support_level>external</support_level>
|
||||
<depend>xmlstarlet</depend>
|
||||
<depend>bash</depend>
|
||||
<defaultenabled>no</defaultenabled>
|
||||
<member_data>
|
||||
<downloader>
|
||||
<variants>
|
||||
<variant tag="bundled" condition='[[ "$PJPROJECT_BUNDLED" = "yes" ]]'/>
|
||||
</variants>
|
||||
</downloader>
|
||||
</member_data>
|
||||
</member>
|
@@ -33,9 +33,10 @@ ASTERISK_REGISTER_FILE()
|
||||
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/format.h"
|
||||
#include "asterisk/logger.h" /* for ast_log, LOG_WARNING */
|
||||
#include "asterisk/strings.h" /* for ast_str_append */
|
||||
#include "asterisk/utils.h" /* for MIN, ast_malloc, ast_free */
|
||||
#include "asterisk/logger.h"
|
||||
#include "asterisk/strings.h"
|
||||
#include "asterisk/utils.h"
|
||||
#include "asterisk/opus.h"
|
||||
|
||||
/*!
|
||||
* \brief Opus attribute structure.
|
||||
@@ -43,32 +44,42 @@ ASTERISK_REGISTER_FILE()
|
||||
* \note http://tools.ietf.org/html/rfc7587#section-6
|
||||
*/
|
||||
struct opus_attr {
|
||||
unsigned int maxbitrate;
|
||||
unsigned int maxplayrate;
|
||||
unsigned int unused; /* was minptime, kept for binary compatibility */
|
||||
unsigned int stereo;
|
||||
unsigned int cbr;
|
||||
unsigned int fec;
|
||||
unsigned int dtx;
|
||||
unsigned int spropmaxcapturerate;
|
||||
unsigned int spropstereo;
|
||||
int maxbitrate;
|
||||
int maxplayrate;
|
||||
int ptime;
|
||||
int stereo;
|
||||
int cbr;
|
||||
int fec;
|
||||
int dtx;
|
||||
int spropmaxcapturerate;
|
||||
int spropstereo;
|
||||
int maxptime;
|
||||
/* Note data is expected to be an ao2_object type */
|
||||
void *data;
|
||||
};
|
||||
|
||||
static struct opus_attr default_opus_attr = {
|
||||
.maxplayrate = 48000,
|
||||
.spropmaxcapturerate = 48000,
|
||||
.maxbitrate = 510000,
|
||||
.stereo = 0,
|
||||
.spropstereo = 0,
|
||||
.cbr = 0,
|
||||
.fec = 1,
|
||||
.dtx = 0,
|
||||
.maxbitrate = CODEC_OPUS_DEFAULT_BITRATE,
|
||||
.maxplayrate = CODEC_OPUS_DEFAULT_SAMPLE_RATE,
|
||||
.ptime = CODEC_OPUS_DEFAULT_PTIME,
|
||||
.stereo = CODEC_OPUS_DEFAULT_STEREO,
|
||||
.cbr = CODEC_OPUS_DEFAULT_CBR,
|
||||
.fec = CODEC_OPUS_DEFAULT_FEC,
|
||||
.dtx = CODEC_OPUS_DEFAULT_DTX,
|
||||
.spropmaxcapturerate = CODEC_OPUS_DEFAULT_SAMPLE_RATE,
|
||||
.spropstereo = CODEC_OPUS_DEFAULT_STEREO,
|
||||
.maxptime = CODEC_OPUS_DEFAULT_MAX_PTIME
|
||||
};
|
||||
|
||||
static void opus_destroy(struct ast_format *format)
|
||||
{
|
||||
struct opus_attr *attr = ast_format_get_attribute_data(format);
|
||||
|
||||
if (!attr) {
|
||||
return;
|
||||
}
|
||||
|
||||
ao2_cleanup(attr->data);
|
||||
ast_free(attr);
|
||||
}
|
||||
|
||||
@@ -81,81 +92,65 @@ static int opus_clone(const struct ast_format *src, struct ast_format *dst)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (original) {
|
||||
*attr = *original;
|
||||
} else {
|
||||
*attr = default_opus_attr;
|
||||
}
|
||||
*attr = original ? *original : default_opus_attr;
|
||||
ao2_bump(attr->data);
|
||||
|
||||
ast_format_set_attribute_data(dst, attr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sdp_fmtp_get(const char *attributes, const char *name, int *attr)
|
||||
{
|
||||
const char *kvp = "";
|
||||
int val;
|
||||
|
||||
if (attributes && !(kvp = strstr(attributes, name))) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the named attribute is not at the start of the given attributes, and
|
||||
* the preceding character is not a space or semicolon then it's not the
|
||||
* attribute we are looking for. It's an attribute with the name embedded
|
||||
* within it (e.g. ptime in maxptime, stereo in sprop-stereo).
|
||||
*/
|
||||
if (kvp != attributes && *(kvp - 1) != ' ' && *(kvp - 1) != ';') {
|
||||
/* Keep searching as it might still be in the attributes string */
|
||||
sdp_fmtp_get(strchr(kvp, ';'), name, attr);
|
||||
/*
|
||||
* Otherwise it's a match, so retrieve the value and set the attribute.
|
||||
*/
|
||||
} else if (sscanf(kvp, "%*[^=]=%30d", &val) == 1) {
|
||||
*attr = val;
|
||||
}
|
||||
}
|
||||
|
||||
static struct ast_format *opus_parse_sdp_fmtp(const struct ast_format *format, const char *attributes)
|
||||
{
|
||||
struct ast_format *cloned;
|
||||
struct opus_attr *attr;
|
||||
const char *kvp;
|
||||
unsigned int val;
|
||||
|
||||
cloned = ast_format_clone(format);
|
||||
if (!cloned) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
attr = ast_format_get_attribute_data(cloned);
|
||||
|
||||
if ((kvp = strstr(attributes, "maxplaybackrate")) && sscanf(kvp, "maxplaybackrate=%30u", &val) == 1) {
|
||||
attr->maxplayrate = val;
|
||||
} else {
|
||||
attr->maxplayrate = 48000;
|
||||
}
|
||||
|
||||
if ((kvp = strstr(attributes, "sprop-maxcapturerate")) && sscanf(kvp, "sprop-maxcapturerate=%30u", &val) == 1) {
|
||||
attr->spropmaxcapturerate = val;
|
||||
} else {
|
||||
attr->spropmaxcapturerate = 48000;
|
||||
}
|
||||
|
||||
if ((kvp = strstr(attributes, "maxaveragebitrate")) && sscanf(kvp, "maxaveragebitrate=%30u", &val) == 1) {
|
||||
attr->maxbitrate = val;
|
||||
} else {
|
||||
attr->maxbitrate = 510000;
|
||||
}
|
||||
|
||||
if (!strncmp(attributes, "stereo=1", 8)) {
|
||||
attr->stereo = 1;
|
||||
} else if (strstr(attributes, " stereo=1")) {
|
||||
attr->stereo = 1;
|
||||
} else if (strstr(attributes, ";stereo=1")) {
|
||||
attr->stereo = 1;
|
||||
} else {
|
||||
attr->stereo = 0;
|
||||
}
|
||||
|
||||
if (strstr(attributes, "sprop-stereo=1")) {
|
||||
attr->spropstereo = 1;
|
||||
} else {
|
||||
attr->spropstereo = 0;
|
||||
}
|
||||
|
||||
if (strstr(attributes, "cbr=1")) {
|
||||
attr->cbr = 1;
|
||||
} else {
|
||||
attr->cbr = 0;
|
||||
}
|
||||
|
||||
if (strstr(attributes, "useinbandfec=1")) {
|
||||
attr->fec = 1;
|
||||
} else {
|
||||
attr->fec = 0;
|
||||
}
|
||||
|
||||
if (strstr(attributes, "usedtx=1")) {
|
||||
attr->dtx = 1;
|
||||
} else {
|
||||
attr->dtx = 0;
|
||||
}
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_PLAYBACK_RATE, &attr->maxplayrate);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_CODED_AUDIO_BANDWIDTH,
|
||||
&attr->maxplayrate);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_SPROP_MAX_CAPTURE_RATE,
|
||||
&attr->spropmaxcapturerate);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_PTIME, &attr->maxptime);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_PTIME, &attr->ptime);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_AVERAGE_BITRATE, &attr->maxbitrate);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_STEREO, &attr->stereo);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_SPROP_STEREO, &attr->spropstereo);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_CBR, &attr->cbr);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_FEC, &attr->fec);
|
||||
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_DTX, &attr->dtx);
|
||||
|
||||
return cloned;
|
||||
}
|
||||
@@ -163,7 +158,7 @@ static struct ast_format *opus_parse_sdp_fmtp(const struct ast_format *format, c
|
||||
static void opus_generate_sdp_fmtp(const struct ast_format *format, unsigned int payload, struct ast_str **str)
|
||||
{
|
||||
struct opus_attr *attr = ast_format_get_attribute_data(format);
|
||||
int added = 0;
|
||||
int size;
|
||||
|
||||
if (!attr) {
|
||||
/*
|
||||
@@ -174,79 +169,52 @@ static void opus_generate_sdp_fmtp(const struct ast_format *format, unsigned int
|
||||
attr = &default_opus_attr;
|
||||
}
|
||||
|
||||
if (48000 != attr->maxplayrate) {
|
||||
if (added) {
|
||||
ast_str_append(str, 0, ";");
|
||||
} else if (0 < ast_str_append(str, 0, "a=fmtp:%u ", payload)) {
|
||||
added = 1;
|
||||
}
|
||||
ast_str_append(str, 0, "maxplaybackrate=%u", attr->maxplayrate);
|
||||
size = ast_str_append(str, 0, "a=fmtp:%u ", payload);
|
||||
|
||||
if (CODEC_OPUS_DEFAULT_SAMPLE_RATE != attr->maxplayrate) {
|
||||
ast_str_append(str, 0, "%s=%d;",
|
||||
CODEC_OPUS_ATTR_MAX_PLAYBACK_RATE, attr->maxplayrate);
|
||||
}
|
||||
|
||||
if (48000 != attr->spropmaxcapturerate) {
|
||||
if (added) {
|
||||
ast_str_append(str, 0, ";");
|
||||
} else if (0 < ast_str_append(str, 0, "a=fmtp:%u ", payload)) {
|
||||
added = 1;
|
||||
}
|
||||
ast_str_append(str, 0, "sprop-maxcapturerate=%u", attr->spropmaxcapturerate);
|
||||
if (CODEC_OPUS_DEFAULT_SAMPLE_RATE != attr->spropmaxcapturerate) {
|
||||
ast_str_append(str, 0, "%s=%d;",
|
||||
CODEC_OPUS_ATTR_SPROP_MAX_CAPTURE_RATE, attr->spropmaxcapturerate);
|
||||
}
|
||||
|
||||
if (510000 != attr->maxbitrate) {
|
||||
if (added) {
|
||||
ast_str_append(str, 0, ";");
|
||||
} else if (0 < ast_str_append(str, 0, "a=fmtp:%u ", payload)) {
|
||||
added = 1;
|
||||
}
|
||||
ast_str_append(str, 0, "maxaveragebitrate=%u", attr->maxbitrate);
|
||||
if (CODEC_OPUS_DEFAULT_BITRATE != attr->maxbitrate || attr->maxbitrate > 0) {
|
||||
ast_str_append(str, 0, "%s=%d;",
|
||||
CODEC_OPUS_ATTR_MAX_AVERAGE_BITRATE, attr->maxbitrate);
|
||||
}
|
||||
|
||||
if (0 != attr->stereo) {
|
||||
if (added) {
|
||||
ast_str_append(str, 0, ";");
|
||||
} else if (0 < ast_str_append(str, 0, "a=fmtp:%u ", payload)) {
|
||||
added = 1;
|
||||
}
|
||||
ast_str_append(str, 0, "stereo=%u", attr->stereo);
|
||||
if (CODEC_OPUS_DEFAULT_STEREO != attr->stereo) {
|
||||
ast_str_append(str, 0, "%s=%d;",
|
||||
CODEC_OPUS_ATTR_STEREO, attr->stereo);
|
||||
}
|
||||
|
||||
if (0 != attr->spropstereo) {
|
||||
if (added) {
|
||||
ast_str_append(str, 0, ";");
|
||||
} else if (0 < ast_str_append(str, 0, "a=fmtp:%u ", payload)) {
|
||||
added = 1;
|
||||
}
|
||||
ast_str_append(str, 0, "sprop-stereo=%u", attr->spropstereo);
|
||||
if (CODEC_OPUS_DEFAULT_STEREO != attr->spropstereo) {
|
||||
ast_str_append(str, 0, "%s=%d;",
|
||||
CODEC_OPUS_ATTR_SPROP_STEREO, attr->spropstereo);
|
||||
}
|
||||
|
||||
if (0 != attr->cbr) {
|
||||
if (added) {
|
||||
ast_str_append(str, 0, ";");
|
||||
} else if (0 < ast_str_append(str, 0, "a=fmtp:%u ", payload)) {
|
||||
added = 1;
|
||||
}
|
||||
ast_str_append(str, 0, "cbr=%u", attr->cbr);
|
||||
if (CODEC_OPUS_DEFAULT_CBR != attr->cbr) {
|
||||
ast_str_append(str, 0, "%s=%d;",
|
||||
CODEC_OPUS_ATTR_CBR, attr->cbr);
|
||||
}
|
||||
|
||||
if (0 != attr->fec) {
|
||||
if (added) {
|
||||
ast_str_append(str, 0, ";");
|
||||
} else if (0 < ast_str_append(str, 0, "a=fmtp:%u ", payload)) {
|
||||
added = 1;
|
||||
}
|
||||
ast_str_append(str, 0, "useinbandfec=%u", attr->fec);
|
||||
if (CODEC_OPUS_DEFAULT_FEC!= attr->fec) {
|
||||
ast_str_append(str, 0, "%s=%d;",
|
||||
CODEC_OPUS_ATTR_FEC, attr->fec);
|
||||
}
|
||||
|
||||
if (0 != attr->dtx) {
|
||||
if (added) {
|
||||
ast_str_append(str, 0, ";");
|
||||
} else if (0 < ast_str_append(str, 0, "a=fmtp:%u ", payload)) {
|
||||
added = 1;
|
||||
}
|
||||
ast_str_append(str, 0, "usedtx=%u", attr->dtx);
|
||||
if (CODEC_OPUS_DEFAULT_DTX != attr->dtx) {
|
||||
ast_str_append(str, 0, "%s=%d;",
|
||||
CODEC_OPUS_ATTR_DTX, attr->dtx);
|
||||
}
|
||||
|
||||
if (added) {
|
||||
if (size == ast_str_strlen(*str)) {
|
||||
ast_str_reset(*str);
|
||||
} else {
|
||||
ast_str_truncate(*str, -1);
|
||||
ast_str_append(str, 0, "\r\n");
|
||||
}
|
||||
}
|
||||
@@ -285,49 +253,68 @@ static struct ast_format *opus_getjoint(const struct ast_format *format1, const
|
||||
* to receive stereo signals, it may be a waste of bandwidth. */
|
||||
attr_res->stereo = attr1->stereo && attr2->stereo ? 1 : 0;
|
||||
|
||||
attr_res->maxbitrate = MIN(attr1->maxbitrate, attr2->maxbitrate);
|
||||
if (attr1->maxbitrate < 0) {
|
||||
attr_res->maxbitrate = attr2->maxbitrate;
|
||||
} else if (attr2->maxbitrate < 0) {
|
||||
attr_res->maxbitrate = attr1->maxbitrate;
|
||||
} else {
|
||||
attr_res->maxbitrate = MIN(attr1->maxbitrate, attr2->maxbitrate);
|
||||
}
|
||||
|
||||
attr_res->spropmaxcapturerate = MIN(attr1->spropmaxcapturerate, attr2->spropmaxcapturerate);
|
||||
attr_res->maxplayrate = MIN(attr1->maxplayrate, attr2->maxplayrate);
|
||||
|
||||
return jointformat;
|
||||
}
|
||||
|
||||
static struct ast_format *opus_set(const struct ast_format *format, const char *name, const char *value)
|
||||
static struct ast_format *opus_set(const struct ast_format *format,
|
||||
const char *name, const char *value)
|
||||
{
|
||||
struct ast_format *cloned;
|
||||
struct opus_attr *attr;
|
||||
unsigned int val;
|
||||
int val;
|
||||
|
||||
if (sscanf(value, "%30u", &val) != 1) {
|
||||
ast_log(LOG_WARNING, "Unknown value '%s' for attribute type '%s'\n",
|
||||
value, name);
|
||||
if (!(cloned = ast_format_clone(format))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cloned = ast_format_clone(format);
|
||||
if (!cloned) {
|
||||
return NULL;
|
||||
}
|
||||
attr = ast_format_get_attribute_data(cloned);
|
||||
|
||||
if (!strcasecmp(name, "max_bitrate")) {
|
||||
attr->maxbitrate = val;
|
||||
} else if (!strcasecmp(name, "max_playrate")) {
|
||||
if (!strcmp(name, CODEC_OPUS_ATTR_DATA)) {
|
||||
ao2_cleanup(attr->data);
|
||||
attr->data = ao2_bump((void*)value);
|
||||
return cloned;
|
||||
}
|
||||
|
||||
if (sscanf(value, "%30d", &val) != 1) {
|
||||
ast_log(LOG_WARNING, "Unknown value '%s' for attribute type '%s'\n",
|
||||
value, name);
|
||||
ao2_ref(cloned, -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!strcasecmp(name, CODEC_OPUS_ATTR_MAX_PLAYBACK_RATE)) {
|
||||
attr->maxplayrate = val;
|
||||
} else if (!strcasecmp(name, "minptime")) {
|
||||
attr->unused = val;
|
||||
} else if (!strcasecmp(name, "stereo")) {
|
||||
attr->stereo = val;
|
||||
} else if (!strcasecmp(name, "cbr")) {
|
||||
attr->cbr = val;
|
||||
} else if (!strcasecmp(name, "fec")) {
|
||||
attr->fec = val;
|
||||
} else if (!strcasecmp(name, "dtx")) {
|
||||
attr->dtx = val;
|
||||
} else if (!strcasecmp(name, "sprop_capture_rate")) {
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_MAX_CODED_AUDIO_BANDWIDTH)) {
|
||||
attr->maxplayrate = val;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_SPROP_MAX_CAPTURE_RATE)) {
|
||||
attr->spropmaxcapturerate = val;
|
||||
} else if (!strcasecmp(name, "sprop_stereo")) {
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_MAX_PTIME)) {
|
||||
attr->maxptime = val;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_PTIME)) {
|
||||
attr->ptime = val;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_MAX_AVERAGE_BITRATE)) {
|
||||
attr->maxbitrate = val;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_STEREO)) {
|
||||
attr->stereo = val;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_SPROP_STEREO)) {
|
||||
attr->spropstereo = val;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_CBR)) {
|
||||
attr->cbr = val;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_FEC)) {
|
||||
attr->fec = val;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_DTX)) {
|
||||
attr->dtx = val;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "unknown attribute type %s\n", name);
|
||||
}
|
||||
@@ -335,6 +322,44 @@ static struct ast_format *opus_set(const struct ast_format *format, const char *
|
||||
return cloned;
|
||||
}
|
||||
|
||||
static const void *opus_get(const struct ast_format *format, const char *name)
|
||||
{
|
||||
struct opus_attr *attr = ast_format_get_attribute_data(format);
|
||||
int *val = NULL;
|
||||
|
||||
if (!attr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!strcasecmp(name, CODEC_OPUS_ATTR_DATA)) {
|
||||
return ao2_bump(attr->data);
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_MAX_PLAYBACK_RATE)) {
|
||||
val = &attr->maxplayrate;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_SPROP_MAX_CAPTURE_RATE)) {
|
||||
val = &attr->spropmaxcapturerate;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_MAX_PTIME)) {
|
||||
val = &attr->maxptime;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_PTIME)) {
|
||||
val = &attr->ptime;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_MAX_AVERAGE_BITRATE)) {
|
||||
val = &attr->maxbitrate;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_STEREO)) {
|
||||
val = &attr->stereo;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_SPROP_STEREO)) {
|
||||
val = &attr->spropstereo;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_CBR)) {
|
||||
val = &attr->cbr;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_FEC)) {
|
||||
val = &attr->fec;
|
||||
} else if (!strcasecmp(name, CODEC_OPUS_ATTR_DTX)) {
|
||||
val = &attr->dtx;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "unknown attribute type %s\n", name);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static struct ast_format_interface opus_interface = {
|
||||
.format_destroy = opus_destroy,
|
||||
.format_clone = opus_clone,
|
||||
@@ -342,11 +367,12 @@ static struct ast_format_interface opus_interface = {
|
||||
.format_attribute_set = opus_set,
|
||||
.format_parse_sdp_fmtp = opus_parse_sdp_fmtp,
|
||||
.format_generate_sdp_fmtp = opus_generate_sdp_fmtp,
|
||||
.format_attribute_get = opus_get
|
||||
};
|
||||
|
||||
static int load_module(void)
|
||||
{
|
||||
if (ast_format_interface_register("opus", &opus_interface)) {
|
||||
if (__ast_format_interface_register("opus", &opus_interface, ast_module_info->self)) {
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
|
||||
@@ -358,9 +384,9 @@ static int unload_module(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Opus Format Attribute Module",
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Opus Format Attribute Module",
|
||||
.support_level = AST_MODULE_SUPPORT_CORE,
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.load_pri = AST_MODPRI_CHANNEL_DEPEND,
|
||||
.load_pri = AST_MODPRI_REALTIME_DRIVER /* Needs to load before codec_opus */
|
||||
);
|
||||
|
@@ -522,7 +522,7 @@ static int load_odbc_config(void)
|
||||
!strncasecmp(v->name, "share", 5) ||
|
||||
!strcasecmp(v->name, "limit") ||
|
||||
!strcasecmp(v->name, "idlecheck")) {
|
||||
ast_log(LOG_WARNING, "The 'pooling', 'shared_connections', 'limit', and 'idlecheck' options are deprecated. Please see UPGRADE.txt for information\n");
|
||||
ast_log(LOG_WARNING, "The 'pooling', 'shared_connections', 'limit', and 'idlecheck' options were replaced by 'max_connections'. See res_odbc.conf.sample.\n");
|
||||
} else if (!strcasecmp(v->name, "enabled")) {
|
||||
enabled = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "pre-connect")) {
|
||||
|
@@ -3510,7 +3510,7 @@ int ast_sip_failover_request(pjsip_tx_data *tdata)
|
||||
{
|
||||
pjsip_via_hdr *via;
|
||||
|
||||
if (tdata->dest_info.cur_addr == tdata->dest_info.addr.count - 1) {
|
||||
if (!tdata->dest_info.addr.count || (tdata->dest_info.cur_addr == tdata->dest_info.addr.count - 1)) {
|
||||
/* No more addresses to try */
|
||||
return 0;
|
||||
}
|
||||
|
@@ -106,6 +106,18 @@ static int global_apply(const struct ast_sorcery *sorcery, void *obj)
|
||||
struct global_config *cfg = obj;
|
||||
char max_forwards[10];
|
||||
|
||||
if (ast_strlen_zero(cfg->debug)) {
|
||||
ast_log(LOG_ERROR,
|
||||
"Global option 'debug' can't be empty. Set it to a valid value or remove the entry to accept 'no' as the default\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_strlen_zero(cfg->default_from_user)) {
|
||||
ast_log(LOG_ERROR,
|
||||
"Global option 'default_from_user' can't be empty. Set it to a valid value or remove the entry to accept 'asterisk' as the default\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(max_forwards, sizeof(max_forwards), "%u", cfg->max_forwards);
|
||||
|
||||
ast_sip_add_global_request_header("Max-Forwards", max_forwards, 1);
|
||||
|
@@ -571,9 +571,7 @@ static pj_bool_t endpoint_lookup(pjsip_rx_data *rdata)
|
||||
}
|
||||
}
|
||||
|
||||
if (!endpoint && !is_ack) {
|
||||
char name[AST_UUID_STR_LEN] = "";
|
||||
pjsip_uri *from = rdata->msg_info.from->uri;
|
||||
if (!endpoint) {
|
||||
|
||||
/* always use an artificial endpoint - per discussion no reason
|
||||
to have "alwaysauthreject" as an option. It is felt using it
|
||||
@@ -581,6 +579,13 @@ static pj_bool_t endpoint_lookup(pjsip_rx_data *rdata)
|
||||
breaking old stuff and we really don't want to enable the discovery
|
||||
of SIP accounts */
|
||||
endpoint = ast_sip_get_artificial_endpoint();
|
||||
}
|
||||
|
||||
rdata->endpt_info.mod_data[endpoint_mod.id] = endpoint;
|
||||
|
||||
if ((endpoint == artificial_endpoint) && !is_ack) {
|
||||
char name[AST_UUID_STR_LEN] = "";
|
||||
pjsip_uri *from = rdata->msg_info.from->uri;
|
||||
|
||||
if (PJSIP_URI_SCHEME_IS_SIP(from) || PJSIP_URI_SCHEME_IS_SIPS(from)) {
|
||||
pjsip_sip_uri *sip_from = pjsip_uri_get_uri(from);
|
||||
@@ -614,7 +619,6 @@ static pj_bool_t endpoint_lookup(pjsip_rx_data *rdata)
|
||||
ast_sip_report_invalid_endpoint(name, rdata);
|
||||
}
|
||||
}
|
||||
rdata->endpt_info.mod_data[endpoint_mod.id] = endpoint;
|
||||
return PJ_FALSE;
|
||||
}
|
||||
|
||||
|
@@ -413,7 +413,7 @@ static pjsip_fromto_hdr *create_new_id_hdr(const pj_str_t *hdr_name, pjsip_fromt
|
||||
id_hdr = pjsip_from_hdr_create(tdata->pool);
|
||||
id_hdr->type = PJSIP_H_OTHER;
|
||||
pj_strdup(tdata->pool, &id_hdr->name, hdr_name);
|
||||
id_hdr->sname.slen = 0;
|
||||
id_hdr->sname = id_hdr->name;
|
||||
|
||||
id_name_addr = pjsip_uri_clone(tdata->pool, base->uri);
|
||||
id_uri = pjsip_uri_get_uri(id_name_addr->uri);
|
||||
|
@@ -305,7 +305,7 @@ static void add_diversion_header(pjsip_tx_data *tdata, struct ast_party_redirect
|
||||
hdr = pjsip_from_hdr_create(tdata->pool);
|
||||
hdr->type = PJSIP_H_OTHER;
|
||||
pj_strdup(tdata->pool, &hdr->name, &diversion_name);
|
||||
hdr->sname.slen = 0;
|
||||
hdr->sname = hdr->name;
|
||||
|
||||
name_addr = pjsip_uri_clone(tdata->pool, base);
|
||||
uri = pjsip_uri_get_uri(name_addr->uri);
|
||||
|
@@ -109,8 +109,11 @@ static pj_status_t multihomed_on_tx_message(pjsip_tx_data *tdata)
|
||||
return PJ_SUCCESS;
|
||||
}
|
||||
|
||||
/* The port in the message should always be that of the original transport */
|
||||
prm.ret_port = tdata->tp_info.transport->local_name.port;
|
||||
/* For UDP we can have multiple transports so the port needs to be maintained */
|
||||
if (tdata->tp_info.transport->key.type == PJSIP_TRANSPORT_UDP ||
|
||||
tdata->tp_info.transport->key.type == PJSIP_TRANSPORT_UDP6) {
|
||||
prm.ret_port = tdata->tp_info.transport->local_name.port;
|
||||
}
|
||||
|
||||
/* If the IP source differs from the existing transport see if we need to update it */
|
||||
if (pj_strcmp(&prm.ret_addr, &tdata->tp_info.transport->local_name.host)) {
|
||||
|
@@ -134,7 +134,7 @@ static int idle_sched_cb(const void *data)
|
||||
|
||||
if (!keepalive->sip_received) {
|
||||
ast_log(LOG_NOTICE, "Shutting down transport '%s' since no request was received in %d seconds\n",
|
||||
keepalive->transport->info, IDLE_TIMEOUT);
|
||||
keepalive->transport->info, IDLE_TIMEOUT / 1000);
|
||||
pjsip_transport_shutdown(keepalive->transport);
|
||||
}
|
||||
|
||||
|
@@ -79,6 +79,17 @@ ASTERISK_REGISTER_FILE()
|
||||
</configInfo>
|
||||
***/
|
||||
|
||||
/*!
|
||||
* Unbound versions <= 1.4.20 declare string function parameters as 'char *'
|
||||
* but versions >= 1.4.21 declare them as 'const char *'. Since CentOS6 is still
|
||||
* at 1.4.20, we need to cast away the 'const' if we detect the earlier version.
|
||||
*/
|
||||
#ifdef HAVE_UNBOUND_CONST_PARAMS
|
||||
#define UNBOUND_CHAR const char
|
||||
#else
|
||||
#define UNBOUND_CHAR char
|
||||
#endif
|
||||
|
||||
/*! \brief Structure for an unbound resolver */
|
||||
struct unbound_resolver {
|
||||
/*! \brief Resolver context itself */
|
||||
@@ -292,7 +303,7 @@ static int unbound_resolver_resolve(struct ast_dns_query *query)
|
||||
data->resolver = ao2_bump(cfg->global->state->resolver);
|
||||
ast_dns_resolver_set_data(query, data);
|
||||
|
||||
res = ub_resolve_async(data->resolver->context, ast_dns_query_get_name(query),
|
||||
res = ub_resolve_async(data->resolver->context, (UNBOUND_CHAR *)ast_dns_query_get_name(query),
|
||||
ast_dns_query_get_rr_type(query), ast_dns_query_get_rr_class(query),
|
||||
ao2_bump(query), unbound_resolver_callback, &data->id);
|
||||
|
||||
@@ -404,7 +415,7 @@ static int unbound_config_preapply(struct unbound_config *cfg)
|
||||
if (!strcmp(cfg->global->hosts, "system")) {
|
||||
res = ub_ctx_hosts(cfg->global->state->resolver->context, NULL);
|
||||
} else if (!ast_strlen_zero(cfg->global->hosts)) {
|
||||
res = ub_ctx_hosts(cfg->global->state->resolver->context, cfg->global->hosts);
|
||||
res = ub_ctx_hosts(cfg->global->state->resolver->context, (UNBOUND_CHAR *)cfg->global->hosts);
|
||||
}
|
||||
|
||||
if (res) {
|
||||
@@ -419,7 +430,7 @@ static int unbound_config_preapply(struct unbound_config *cfg)
|
||||
|
||||
it_nameservers = ao2_iterator_init(cfg->global->nameservers, 0);
|
||||
while ((nameserver = ao2_iterator_next(&it_nameservers))) {
|
||||
res = ub_ctx_set_fwd(cfg->global->state->resolver->context, nameserver);
|
||||
res = ub_ctx_set_fwd(cfg->global->state->resolver->context, (UNBOUND_CHAR *)nameserver);
|
||||
|
||||
if (res) {
|
||||
ast_log(LOG_ERROR, "Failed to add nameserver '%s' to unbound resolver: %s\n",
|
||||
@@ -434,7 +445,7 @@ static int unbound_config_preapply(struct unbound_config *cfg)
|
||||
if (!strcmp(cfg->global->resolv, "system")) {
|
||||
res = ub_ctx_resolvconf(cfg->global->state->resolver->context, NULL);
|
||||
} else if (!ast_strlen_zero(cfg->global->resolv)) {
|
||||
res = ub_ctx_resolvconf(cfg->global->state->resolver->context, cfg->global->resolv);
|
||||
res = ub_ctx_resolvconf(cfg->global->state->resolver->context, (UNBOUND_CHAR *)cfg->global->resolv);
|
||||
}
|
||||
|
||||
if (res) {
|
||||
@@ -444,7 +455,7 @@ static int unbound_config_preapply(struct unbound_config *cfg)
|
||||
}
|
||||
|
||||
if (!ast_strlen_zero(cfg->global->ta_file)) {
|
||||
res = ub_ctx_add_ta_file(cfg->global->state->resolver->context, cfg->global->ta_file);
|
||||
res = ub_ctx_add_ta_file(cfg->global->state->resolver->context, (UNBOUND_CHAR *)cfg->global->ta_file);
|
||||
|
||||
if (res) {
|
||||
ast_log(LOG_ERROR, "Failed to set trusted anchor file to '%s' in unbound resolver: %s\n",
|
||||
@@ -740,13 +751,13 @@ static enum ast_test_result_state nominal_test(struct ast_test *test, resolve_fn
|
||||
static const size_t V4_SIZE = sizeof(struct in_addr);
|
||||
static const size_t V6_SIZE = sizeof(struct in6_addr);
|
||||
|
||||
static const char *DOMAIN1 = "goose.feathers";
|
||||
static const char *DOMAIN2 = "duck.feathers";
|
||||
static UNBOUND_CHAR *DOMAIN1 = "goose.feathers";
|
||||
static UNBOUND_CHAR *DOMAIN2 = "duck.feathers";
|
||||
|
||||
static const char *ADDR1 = "127.0.0.2";
|
||||
static const char *ADDR2 = "127.0.0.3";
|
||||
static const char *ADDR3 = "::1";
|
||||
static const char *ADDR4 = "127.0.0.4";
|
||||
static UNBOUND_CHAR *ADDR1 = "127.0.0.2";
|
||||
static UNBOUND_CHAR *ADDR2 = "127.0.0.3";
|
||||
static UNBOUND_CHAR *ADDR3 = "::1";
|
||||
static UNBOUND_CHAR *ADDR4 = "127.0.0.4";
|
||||
|
||||
char addr1_buf[V4_SIZE];
|
||||
char addr2_buf[V4_SIZE];
|
||||
@@ -786,7 +797,7 @@ static enum ast_test_result_state nominal_test(struct ast_test *test, resolve_fn
|
||||
ub_ctx_zone_add(resolver->context, DOMAIN2, "static");
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(records); ++i) {
|
||||
ub_ctx_data_add(resolver->context, records[i].as_string);
|
||||
ub_ctx_data_add(resolver->context, (UNBOUND_CHAR *)records[i].as_string);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(runs); ++i) {
|
||||
@@ -808,7 +819,7 @@ static enum ast_test_result_state nominal_test(struct ast_test *test, resolve_fn
|
||||
|
||||
cleanup:
|
||||
for (i = 0; i < ARRAY_LEN(records); ++i) {
|
||||
ub_ctx_data_remove(resolver->context, records[i].as_string);
|
||||
ub_ctx_data_remove(resolver->context, (UNBOUND_CHAR *)records[i].as_string);
|
||||
}
|
||||
ub_ctx_zone_remove(resolver->context, DOMAIN1);
|
||||
ub_ctx_zone_remove(resolver->context, DOMAIN2);
|
||||
@@ -1012,10 +1023,10 @@ static enum ast_test_result_state off_nominal_test(struct ast_test *test,
|
||||
|
||||
static const size_t V4_SIZE = sizeof(struct in_addr);
|
||||
|
||||
static const char *DOMAIN1 = "goose.feathers";
|
||||
static const char *DOMAIN2 = "duck.feathers";
|
||||
static UNBOUND_CHAR *DOMAIN1 = "goose.feathers";
|
||||
static UNBOUND_CHAR *DOMAIN2 = "duck.feathers";
|
||||
|
||||
static const char *ADDR1 = "127.0.0.2";
|
||||
static UNBOUND_CHAR *ADDR1 = "127.0.0.2";
|
||||
|
||||
char addr1_buf[V4_SIZE];
|
||||
|
||||
@@ -1046,7 +1057,7 @@ static enum ast_test_result_state off_nominal_test(struct ast_test *test,
|
||||
ub_ctx_zone_add(resolver->context, DOMAIN2, "static");
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(records); ++i) {
|
||||
ub_ctx_data_add(resolver->context, records[i].as_string);
|
||||
ub_ctx_data_add(resolver->context, (UNBOUND_CHAR *)records[i].as_string);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(runs); ++i) {
|
||||
@@ -1196,7 +1207,7 @@ AST_TEST_DEFINE(resolve_naptr)
|
||||
|
||||
const struct ast_dns_record *record;
|
||||
|
||||
static const char * DOMAIN1 = "goose.feathers";
|
||||
static char * DOMAIN1 = "goose.feathers";
|
||||
int i;
|
||||
enum ast_test_result_state res = AST_TEST_PASS;
|
||||
|
||||
@@ -1234,7 +1245,7 @@ AST_TEST_DEFINE(resolve_naptr)
|
||||
ub_ctx_zone_add(resolver->context, DOMAIN1, "static");
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(records); ++i) {
|
||||
ub_ctx_data_add(resolver->context, records[i].zone_entry);
|
||||
ub_ctx_data_add(resolver->context, (UNBOUND_CHAR *)records[i].zone_entry);
|
||||
}
|
||||
|
||||
if (ast_dns_resolve(DOMAIN1, ns_t_naptr, ns_c_in, &result)) {
|
||||
@@ -1311,8 +1322,8 @@ AST_TEST_DEFINE(resolve_srv)
|
||||
RAII_VAR(struct unbound_config *, cfg, NULL, ao2_cleanup);
|
||||
RAII_VAR(struct ast_dns_result *, result, NULL, ast_dns_result_free);
|
||||
const struct ast_dns_record *record;
|
||||
static const char *DOMAIN1 = "taco.bananas";
|
||||
static const char *DOMAIN1_SRV = "taco.bananas 12345 IN SRV 10 20 5060 sip.taco.bananas";
|
||||
static UNBOUND_CHAR *DOMAIN1 = "taco.bananas";
|
||||
static UNBOUND_CHAR *DOMAIN1_SRV = "taco.bananas 12345 IN SRV 10 20 5060 sip.taco.bananas";
|
||||
enum ast_test_result_state res = AST_TEST_PASS;
|
||||
|
||||
switch (cmd) {
|
||||
|
587
res/res_srtp.c
587
res/res_srtp.c
@@ -39,6 +39,7 @@
|
||||
|
||||
ASTERISK_REGISTER_FILE()
|
||||
|
||||
#include <math.h> /* for pow */
|
||||
#include <srtp/srtp.h>
|
||||
#ifdef HAVE_OPENSSL
|
||||
#include <openssl/rand.h>
|
||||
@@ -50,6 +51,7 @@ ASTERISK_REGISTER_FILE()
|
||||
#include "asterisk/frame.h" /* for AST_FRIENDLY_OFFSET */
|
||||
#include "asterisk/logger.h" /* for ast_log, ast_debug, etc */
|
||||
#include "asterisk/module.h" /* for ast_module_info, etc */
|
||||
#include "asterisk/sdp_srtp.h"
|
||||
#include "asterisk/res_srtp.h" /* for ast_srtp_cb, ast_srtp_suite, etc */
|
||||
#include "asterisk/rtp_engine.h" /* for ast_rtp_engine_register_srtp, etc */
|
||||
#include "asterisk/utils.h" /* for ast_free, ast_calloc */
|
||||
@@ -578,10 +580,587 @@ static int ast_srtp_change_source(struct ast_srtp *srtp, unsigned int from_ssrc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ast_sdp_crypto {
|
||||
char *a_crypto;
|
||||
unsigned char local_key[SRTP_MAX_KEY_LEN];
|
||||
int tag;
|
||||
char local_key64[((SRTP_MAX_KEY_LEN) * 8 + 5) / 6 + 1];
|
||||
unsigned char remote_key[SRTP_MAX_KEY_LEN];
|
||||
int key_len;
|
||||
};
|
||||
|
||||
static void res_sdp_crypto_dtor(struct ast_sdp_crypto *crypto)
|
||||
{
|
||||
if (crypto) {
|
||||
ast_free(crypto->a_crypto);
|
||||
crypto->a_crypto = NULL;
|
||||
ast_free(crypto);
|
||||
|
||||
ast_module_unref(ast_module_info->self);
|
||||
}
|
||||
}
|
||||
|
||||
static struct ast_sdp_crypto *crypto_init_keys(struct ast_sdp_crypto *p, const int key_len)
|
||||
{
|
||||
unsigned char remote_key[key_len];
|
||||
|
||||
if (srtp_res.get_random(p->local_key, key_len) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ast_base64encode(p->local_key64, p->local_key, key_len, sizeof(p->local_key64));
|
||||
|
||||
p->key_len = ast_base64decode(remote_key, p->local_key64, sizeof(remote_key));
|
||||
|
||||
if (p->key_len != key_len) {
|
||||
ast_log(LOG_ERROR, "base64 encode/decode bad len %d != %d\n", p->key_len, key_len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (memcmp(remote_key, p->local_key, p->key_len)) {
|
||||
ast_log(LOG_ERROR, "base64 encode/decode bad key\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ast_debug(1 , "local_key64 %s len %zu\n", p->local_key64, strlen(p->local_key64));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static struct ast_sdp_crypto *sdp_crypto_alloc(const int key_len)
|
||||
{
|
||||
struct ast_sdp_crypto *p, *result;
|
||||
|
||||
if (!(p = ast_calloc(1, sizeof(*p)))) {
|
||||
return NULL;
|
||||
}
|
||||
p->tag = 1;
|
||||
ast_module_ref(ast_module_info->self);
|
||||
|
||||
/* default is a key which uses AST_AES_CM_128_HMAC_SHA1_xx */
|
||||
result = crypto_init_keys(p, key_len);
|
||||
if (!result) {
|
||||
res_sdp_crypto_dtor(p);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct ast_sdp_crypto *res_sdp_crypto_alloc(void)
|
||||
{
|
||||
return sdp_crypto_alloc(SRTP_MASTER_KEY_LEN);
|
||||
}
|
||||
|
||||
static int res_sdp_crypto_build_offer(struct ast_sdp_crypto *p, int taglen)
|
||||
{
|
||||
int res;
|
||||
|
||||
/* Rebuild the crypto line */
|
||||
ast_free(p->a_crypto);
|
||||
p->a_crypto = NULL;
|
||||
|
||||
if ((taglen & 0x007f) == 8) {
|
||||
res = ast_asprintf(&p->a_crypto, "%d AEAD_AES_%d_GCM_%d inline:%s",
|
||||
p->tag, 128 + ((taglen & 0x0300) >> 2), taglen & 0x007f, p->local_key64);
|
||||
} else if ((taglen & 0x007f) == 16) {
|
||||
res = ast_asprintf(&p->a_crypto, "%d AEAD_AES_%d_GCM inline:%s",
|
||||
p->tag, 128 + ((taglen & 0x0300) >> 2), p->local_key64);
|
||||
} else if ((taglen & 0x0300) && !(taglen & 0x0080)) {
|
||||
res = ast_asprintf(&p->a_crypto, "%d AES_%d_CM_HMAC_SHA1_%d inline:%s",
|
||||
p->tag, 128 + ((taglen & 0x0300) >> 2), taglen & 0x007f, p->local_key64);
|
||||
} else {
|
||||
res = ast_asprintf(&p->a_crypto, "%d AES_CM_%d_HMAC_SHA1_%d inline:%s",
|
||||
p->tag, 128 + ((taglen & 0x0300) >> 2), taglen & 0x007f, p->local_key64);
|
||||
}
|
||||
if (res == -1 || !p->a_crypto) {
|
||||
ast_log(LOG_ERROR, "Could not allocate memory for crypto line\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ast_debug(1, "Crypto line: a=crypto:%s\n", p->a_crypto);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_crypto_policy(struct ast_srtp_policy *policy, int suite_val, const unsigned char *master_key, int key_len, unsigned long ssrc, int inbound)
|
||||
{
|
||||
if (policy_res.set_master_key(policy, master_key, key_len, NULL, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (policy_res.set_suite(policy, suite_val)) {
|
||||
ast_log(LOG_WARNING, "Could not set remote SRTP suite\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
policy_res.set_ssrc(policy, ssrc, inbound);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int crypto_activate(struct ast_sdp_crypto *p, int suite_val, unsigned char *remote_key, int key_len, struct ast_rtp_instance *rtp)
|
||||
{
|
||||
struct ast_srtp_policy *local_policy = NULL;
|
||||
struct ast_srtp_policy *remote_policy = NULL;
|
||||
struct ast_rtp_instance_stats stats = {0,};
|
||||
int res = -1;
|
||||
|
||||
if (!p) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(local_policy = policy_res.alloc())) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(remote_policy = policy_res.alloc())) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (ast_rtp_instance_get_stats(rtp, &stats, AST_RTP_INSTANCE_STAT_LOCAL_SSRC)) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (set_crypto_policy(local_policy, suite_val, p->local_key, key_len, stats.local_ssrc, 0) < 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (set_crypto_policy(remote_policy, suite_val, remote_key, key_len, 0, 1) < 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Add the SRTP policies */
|
||||
if (ast_rtp_instance_add_srtp_policy(rtp, remote_policy, local_policy, 0)) {
|
||||
ast_log(LOG_WARNING, "Could not set SRTP policies\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
ast_debug(1 , "SRTP policy activated\n");
|
||||
res = 0;
|
||||
|
||||
err:
|
||||
if (local_policy) {
|
||||
policy_res.destroy(local_policy);
|
||||
}
|
||||
|
||||
if (remote_policy) {
|
||||
policy_res.destroy(remote_policy);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int res_sdp_crypto_parse_offer(struct ast_rtp_instance *rtp, struct ast_sdp_srtp *srtp, const char *attr)
|
||||
{
|
||||
char *str = NULL;
|
||||
char *tag = NULL;
|
||||
char *suite = NULL;
|
||||
char *key_params = NULL;
|
||||
char *key_param = NULL;
|
||||
char *session_params = NULL;
|
||||
char *key_salt = NULL; /* The actual master key and key salt */
|
||||
char *lifetime = NULL; /* Key lifetime (# of RTP packets) */
|
||||
char *mki = NULL; /* Master Key Index */
|
||||
int found = 0;
|
||||
int key_len_from_sdp;
|
||||
int key_len_expected;
|
||||
int tag_from_sdp;
|
||||
int suite_val = 0;
|
||||
unsigned char remote_key[SRTP_MAX_KEY_LEN];
|
||||
int taglen;
|
||||
double sdes_lifetime;
|
||||
struct ast_sdp_crypto *crypto;
|
||||
struct ast_sdp_srtp *tmp;
|
||||
|
||||
str = ast_strdupa(attr);
|
||||
|
||||
tag = strsep(&str, " ");
|
||||
suite = strsep(&str, " ");
|
||||
key_params = strsep(&str, " ");
|
||||
session_params = strsep(&str, " ");
|
||||
|
||||
if (!tag || !suite) {
|
||||
ast_log(LOG_WARNING, "Unrecognized crypto attribute a=%s\n", attr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* RFC4568 9.1 - tag is 1-9 digits, greater than zero */
|
||||
if (sscanf(tag, "%30d", &tag_from_sdp) != 1 || tag_from_sdp <= 0 || tag_from_sdp > 999999999) {
|
||||
ast_log(LOG_WARNING, "Unacceptable a=crypto tag: %s\n", tag);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ast_strlen_zero(session_params)) {
|
||||
ast_log(LOG_WARNING, "Unsupported crypto parameters: %s\n", session_params);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* On egress, Asterisk sent several crypto lines in the SIP/SDP offer
|
||||
The remote party might have choosen another line than the first */
|
||||
for (tmp = srtp; tmp && tmp->crypto && tmp->crypto->tag != tag_from_sdp;) {
|
||||
tmp = AST_LIST_NEXT(tmp, sdp_srtp_list);
|
||||
}
|
||||
if (tmp) { /* tag matched an already created crypto line */
|
||||
unsigned int flags = tmp->flags;
|
||||
|
||||
/* Make that crypto line the head of the list, not by changing the
|
||||
list structure but by exchanging the content of the list members */
|
||||
crypto = tmp->crypto;
|
||||
tmp->crypto = srtp->crypto;
|
||||
tmp->flags = srtp->flags;
|
||||
srtp->crypto = crypto;
|
||||
srtp->flags = flags;
|
||||
} else {
|
||||
crypto = srtp->crypto;
|
||||
crypto->tag = tag_from_sdp;
|
||||
}
|
||||
|
||||
if (!strcmp(suite, "AES_CM_128_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_128_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
key_len_expected = 30;
|
||||
} else if (!strcmp(suite, "AES_CM_128_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_128_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
key_len_expected = 30;
|
||||
#ifdef HAVE_SRTP_192
|
||||
} else if (!strcmp(suite, "AES_192_CM_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_192_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_192);
|
||||
key_len_expected = 38;
|
||||
} else if (!strcmp(suite, "AES_192_CM_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_192_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_192);
|
||||
key_len_expected = 38;
|
||||
/* RFC used a different name while in draft, some still use that */
|
||||
} else if (!strcmp(suite, "AES_CM_192_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_192_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_192);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
|
||||
key_len_expected = 38;
|
||||
} else if (!strcmp(suite, "AES_CM_192_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_192_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_192);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
|
||||
key_len_expected = 38;
|
||||
#endif
|
||||
#ifdef HAVE_SRTP_256
|
||||
} else if (!strcmp(suite, "AES_256_CM_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_256_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
key_len_expected = 46;
|
||||
} else if (!strcmp(suite, "AES_256_CM_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_256_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
key_len_expected = 46;
|
||||
/* RFC used a different name while in draft, some still use that */
|
||||
} else if (!strcmp(suite, "AES_CM_256_HMAC_SHA1_80")) {
|
||||
suite_val = AST_AES_CM_256_HMAC_SHA1_80;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_80);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
|
||||
key_len_expected = 46;
|
||||
} else if (!strcmp(suite, "AES_CM_256_HMAC_SHA1_32")) {
|
||||
suite_val = AST_AES_CM_256_HMAC_SHA1_32;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_32);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME);
|
||||
key_len_expected = 46;
|
||||
#endif
|
||||
#ifdef HAVE_SRTP_GCM
|
||||
} else if (!strcmp(suite, "AEAD_AES_128_GCM")) {
|
||||
suite_val = AST_AES_GCM_128;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_16);
|
||||
key_len_expected = AES_128_GCM_KEYSIZE_WSALT;
|
||||
} else if (!strcmp(suite, "AEAD_AES_256_GCM")) {
|
||||
suite_val = AST_AES_GCM_256;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_16);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
key_len_expected = AES_256_GCM_KEYSIZE_WSALT;
|
||||
/* RFC contained a (too) short auth tag for RTP media, some still use that */
|
||||
} else if (!strcmp(suite, "AEAD_AES_128_GCM_8")) {
|
||||
suite_val = AST_AES_GCM_128_8;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_8);
|
||||
key_len_expected = AES_128_GCM_KEYSIZE_WSALT;
|
||||
} else if (!strcmp(suite, "AEAD_AES_256_GCM_8")) {
|
||||
suite_val = AST_AES_GCM_256_8;
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_TAG_8);
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_AES_256);
|
||||
key_len_expected = AES_256_GCM_KEYSIZE_WSALT;
|
||||
#endif
|
||||
} else {
|
||||
ast_verb(1, "Unsupported crypto suite: %s\n", suite);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((key_param = strsep(&key_params, ";"))) {
|
||||
unsigned int n_lifetime;
|
||||
char *method = NULL;
|
||||
char *info = NULL;
|
||||
|
||||
method = strsep(&key_param, ":");
|
||||
info = strsep(&key_param, ";");
|
||||
sdes_lifetime = 0;
|
||||
|
||||
if (strcmp(method, "inline")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
key_salt = strsep(&info, "|");
|
||||
|
||||
/* The next parameter can be either lifetime or MKI */
|
||||
lifetime = strsep(&info, "|");
|
||||
if (!lifetime) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
mki = strchr(lifetime, ':');
|
||||
if (mki) {
|
||||
mki = lifetime;
|
||||
lifetime = NULL;
|
||||
} else {
|
||||
mki = strsep(&info, "|");
|
||||
}
|
||||
|
||||
if (mki && *mki != '1') {
|
||||
ast_log(LOG_NOTICE, "Crypto MKI handling is not supported: ignoring attribute %s\n", attr);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lifetime) {
|
||||
if (!strncmp(lifetime, "2^", 2)) {
|
||||
char *lifetime_val = lifetime + 2;
|
||||
|
||||
/* Exponential lifetime */
|
||||
if (sscanf(lifetime_val, "%30u", &n_lifetime) != 1) {
|
||||
ast_log(LOG_NOTICE, "Failed to parse lifetime value in crypto attribute: %s\n", attr);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (n_lifetime > 48) {
|
||||
/* Yeah... that's a bit big. */
|
||||
ast_log(LOG_NOTICE, "Crypto lifetime exponent of '%u' is a bit large; using 48\n", n_lifetime);
|
||||
n_lifetime = 48;
|
||||
}
|
||||
sdes_lifetime = pow(2, n_lifetime);
|
||||
} else {
|
||||
/* Decimal lifetime */
|
||||
if (sscanf(lifetime, "%30u", &n_lifetime) != 1) {
|
||||
ast_log(LOG_NOTICE, "Failed to parse lifetime value in crypto attribute: %s\n", attr);
|
||||
continue;
|
||||
}
|
||||
sdes_lifetime = n_lifetime;
|
||||
}
|
||||
|
||||
/* Accept anything above 10 hours. Less than 10; reject. */
|
||||
if (sdes_lifetime < 1800000) {
|
||||
ast_log(LOG_NOTICE, "Rejecting crypto attribute '%s': lifetime '%f' too short\n", attr, sdes_lifetime);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ast_debug(2, "Crypto attribute '%s' accepted with lifetime '%f', MKI '%s'\n",
|
||||
attr, sdes_lifetime, mki ? mki : "-");
|
||||
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
ast_log(LOG_NOTICE, "SRTP crypto offer not acceptable: '%s'\n", attr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
key_len_from_sdp = ast_base64decode(remote_key, key_salt, sizeof(remote_key));
|
||||
if (key_len_from_sdp != key_len_expected) {
|
||||
ast_log(LOG_WARNING, "SRTP descriptions key length is '%d', not '%d'\n",
|
||||
key_len_from_sdp, key_len_expected);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* on default, the key is 30 (AES-128); throw that away (only) when the suite changed actually */
|
||||
/* ingress: optional, but saves one expensive call to get_random(.) */
|
||||
/* egress: required, because the local key was communicated before the remote key is processed */
|
||||
if (crypto->key_len != key_len_from_sdp) {
|
||||
if (!crypto_init_keys(crypto, key_len_from_sdp)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (!memcmp(crypto->remote_key, remote_key, key_len_from_sdp)) {
|
||||
ast_debug(1, "SRTP remote key unchanged; maintaining current policy\n");
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OFFER_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (key_len_from_sdp > sizeof(crypto->remote_key)) {
|
||||
ast_log(LOG_ERROR,
|
||||
"SRTP key buffer is %zu although it must be at least %d bytes\n",
|
||||
sizeof(crypto->remote_key), key_len_from_sdp);
|
||||
return -1;
|
||||
}
|
||||
memcpy(crypto->remote_key, remote_key, key_len_from_sdp);
|
||||
|
||||
if (crypto_activate(crypto, suite_val, remote_key, key_len_from_sdp, rtp) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_32)) {
|
||||
taglen = 32;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_16)) {
|
||||
taglen = 16;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_8)) {
|
||||
taglen = 8;
|
||||
} else {
|
||||
taglen = 80;
|
||||
}
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_AES_256)) {
|
||||
taglen |= 0x0200;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_AES_192)) {
|
||||
taglen |= 0x0100;
|
||||
}
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME)) {
|
||||
taglen |= 0x0080;
|
||||
}
|
||||
|
||||
/* Finally, rebuild the crypto line */
|
||||
if (res_sdp_crypto_build_offer(crypto, taglen)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ast_set_flag(srtp, AST_SRTP_CRYPTO_OFFER_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *res_sdp_srtp_get_attr(struct ast_sdp_srtp *srtp, int dtls_enabled, int default_taglen_32)
|
||||
{
|
||||
int taglen;
|
||||
|
||||
if (!srtp) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set encryption properties */
|
||||
if (!srtp->crypto) {
|
||||
if (AST_LIST_NEXT(srtp, sdp_srtp_list)) {
|
||||
srtp->crypto = res_sdp_crypto_alloc();
|
||||
ast_log(LOG_ERROR, "SRTP SDP list was not empty\n");
|
||||
} else {
|
||||
const int len = default_taglen_32 ? AST_SRTP_CRYPTO_TAG_32 : AST_SRTP_CRYPTO_TAG_80;
|
||||
const int attr[][3] = {
|
||||
/* This array creates the following list:
|
||||
* a=crypto:1 AES_CM_128_HMAC_SHA1_ ...
|
||||
* a=crypto:2 AEAD_AES_128_GCM ...
|
||||
* a=crypto:3 AES_256_CM_HMAC_SHA1_ ...
|
||||
* a=crypto:4 AEAD_AES_256_GCM ...
|
||||
* a=crypto:5 AES_192_CM_HMAC_SHA1_ ...
|
||||
* something like 'AEAD_AES_192_GCM' is not specified by the RFCs
|
||||
*
|
||||
* If you want to prefer another crypto suite or you want to
|
||||
* exclude a suite, change this array and recompile Asterisk.
|
||||
* This list cannot be changed from rtp.conf because you should
|
||||
* know what you are doing. Especially AES-192 and AES-GCM are
|
||||
* broken in many VoIP clients, see
|
||||
* https://github.com/cisco/libsrtp/pull/170
|
||||
* https://github.com/cisco/libsrtp/pull/184
|
||||
* Furthermore, AES-GCM uses a shorter crypto-suite string which
|
||||
* causes Nokia phones based on Symbian/S60 to reject the whole
|
||||
* INVITE with status 500, even if a matching suite was offered.
|
||||
* AES-256 might just waste your processor cycles, especially if
|
||||
* your TLS transport is not secured with equivalent grade, see
|
||||
* https://security.stackexchange.com/q/61361
|
||||
* Therefore, AES-128 was preferred here.
|
||||
*
|
||||
* If you want to enable one of those defines, please, go for
|
||||
* CFLAGS='-DENABLE_SRTP_AES_GCM' ./configure && sudo make install
|
||||
*/
|
||||
{ len, 0, 30 },
|
||||
#if defined(HAVE_SRTP_GCM) && defined(ENABLE_SRTP_AES_GCM)
|
||||
{ AST_SRTP_CRYPTO_TAG_16, 0, AES_128_GCM_KEYSIZE_WSALT },
|
||||
#endif
|
||||
#if defined(HAVE_SRTP_256) && defined(ENABLE_SRTP_AES_256)
|
||||
{ len, AST_SRTP_CRYPTO_AES_256, 46 },
|
||||
#endif
|
||||
#if defined(HAVE_SRTP_GCM) && defined(ENABLE_SRTP_AES_GCM) && defined(ENABLE_SRTP_AES_256)
|
||||
{ AST_SRTP_CRYPTO_TAG_16, AST_SRTP_CRYPTO_AES_256, AES_256_GCM_KEYSIZE_WSALT },
|
||||
#endif
|
||||
#if defined(HAVE_SRTP_192) && defined(ENABLE_SRTP_AES_192)
|
||||
{ len, AST_SRTP_CRYPTO_AES_192, 38 },
|
||||
#endif
|
||||
};
|
||||
struct ast_sdp_srtp *tmp = srtp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(attr); i++) {
|
||||
if (attr[i][0]) {
|
||||
ast_set_flag(tmp, attr[i][0]);
|
||||
}
|
||||
if (attr[i][1]) {
|
||||
ast_set_flag(tmp, attr[i][1]);
|
||||
}
|
||||
tmp->crypto = sdp_crypto_alloc(attr[i][2]); /* key_len */
|
||||
tmp->crypto->tag = (i + 1); /* tag starts at 1 */
|
||||
|
||||
if (i < ARRAY_LEN(attr) - 1) {
|
||||
AST_LIST_NEXT(tmp, sdp_srtp_list) = ast_sdp_srtp_alloc();
|
||||
tmp = AST_LIST_NEXT(tmp, sdp_srtp_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dtls_enabled) {
|
||||
/* If DTLS-SRTP is enabled the key details will be pulled from TLS */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* set the key length based on INVITE or settings */
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_80)) {
|
||||
taglen = 80;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_32)) {
|
||||
taglen = 32;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_16)) {
|
||||
taglen = 16;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_TAG_8)) {
|
||||
taglen = 8;
|
||||
} else {
|
||||
taglen = default_taglen_32 ? 32 : 80;
|
||||
}
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_AES_256)) {
|
||||
taglen |= 0x0200;
|
||||
} else if (ast_test_flag(srtp, AST_SRTP_CRYPTO_AES_192)) {
|
||||
taglen |= 0x0100;
|
||||
}
|
||||
if (ast_test_flag(srtp, AST_SRTP_CRYPTO_OLD_NAME)) {
|
||||
taglen |= 0x0080;
|
||||
}
|
||||
|
||||
if (srtp->crypto && (res_sdp_crypto_build_offer(srtp->crypto, taglen) >= 0)) {
|
||||
return srtp->crypto->a_crypto;
|
||||
}
|
||||
|
||||
ast_log(LOG_WARNING, "No SRTP key management enabled\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct ast_sdp_crypto_api res_sdp_crypto_api = {
|
||||
.dtor = res_sdp_crypto_dtor,
|
||||
.alloc = res_sdp_crypto_alloc,
|
||||
.build_offer = res_sdp_crypto_build_offer,
|
||||
.parse_offer = res_sdp_crypto_parse_offer,
|
||||
.get_attr = res_sdp_srtp_get_attr,
|
||||
};
|
||||
|
||||
static void res_srtp_shutdown(void)
|
||||
{
|
||||
srtp_install_event_handler(NULL);
|
||||
ast_sdp_crypto_unregister(&res_sdp_crypto_api);
|
||||
ast_rtp_engine_unregister_srtp();
|
||||
srtp_install_event_handler(NULL);
|
||||
#ifdef HAVE_SRTP_SHUTDOWN
|
||||
srtp_shutdown();
|
||||
#endif
|
||||
@@ -607,6 +1186,12 @@ static int res_srtp_init(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_sdp_crypto_register(&res_sdp_crypto_api)) {
|
||||
ast_log(AST_LOG_WARNING, "Failed to register SDP SRTP crypto API\n");
|
||||
res_srtp_shutdown();
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_initialized = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@@ -370,6 +370,9 @@ static void play_on_channel(struct stasis_app_playback *playback,
|
||||
|
||||
playback_final_update(playback, offsetms, res,
|
||||
ast_channel_uniqueid(chan));
|
||||
if (res == AST_CONTROL_STREAM_STOP) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Reset offset for any subsequent media */
|
||||
offsetms = 0;
|
||||
|
31
third-party/pjproject/Makefile.rules
vendored
31
third-party/pjproject/Makefile.rules
vendored
@@ -1,9 +1,34 @@
|
||||
PJPROJECT_URL = http://www.pjsip.org/release/$(PJPROJECT_VERSION)
|
||||
|
||||
# Even though we're not installing pjproject, we're setting prefix to /opt/pjproject to be safe
|
||||
PJPROJECT_CONFIG_OPTS = --prefix=/opt/pjproject --disable-speex-codec --disable-speex-aec \
|
||||
--disable-gsm-codec --disable-video --disable-v4l2 --disable-sound --disable-opencore-amr \
|
||||
--disable-ilbc-codec --without-libyuv --disable-g7221-codec --disable-resample
|
||||
|
||||
PJPROJECT_CONFIG_OPTS = --prefix=/opt/pjproject \
|
||||
--disable-speex-codec \
|
||||
--disable-speex-aec \
|
||||
--disable-speex-aec \
|
||||
--disable-gsm-codec \
|
||||
--disable-ilbc-codec \
|
||||
--disable-l16-codec \
|
||||
--disable-g711-codec \
|
||||
--disable-g722-codec \
|
||||
--disable-g7221-codec \
|
||||
--disable-opencore-amr \
|
||||
--disable-webrtc \
|
||||
--disable-silk \
|
||||
--disable-opus \
|
||||
--disable-video \
|
||||
--disable-v4l2 \
|
||||
--disable-sound \
|
||||
--disable-ext-sound \
|
||||
--disable-oss \
|
||||
--disable-sdl \
|
||||
--disable-libyuv \
|
||||
--disable-resample \
|
||||
--disable-ffmpeg \
|
||||
--disable-openh264 \
|
||||
--disable-ipp \
|
||||
--without-external-pa \
|
||||
--with-external-srtp
|
||||
|
||||
ifeq ($(shell uname -s),Linux)
|
||||
PJPROJECT_CONFIG_OPTS += --enable-epoll
|
||||
|
@@ -1,73 +0,0 @@
|
||||
From a5030c9b33b2c936879fbacb1d2ea5edc2979181 Mon Sep 17 00:00:00 2001
|
||||
From: George Joseph <gjoseph@digium.com>
|
||||
Date: Sat, 18 Jun 2016 10:14:34 -0600
|
||||
Subject: [PATCH] evsub: Add APIs to add/decrement an event subscription's
|
||||
group lock
|
||||
|
||||
These APIs can be used to ensure that the evsub isn't destroyed before
|
||||
an application is finished using it.
|
||||
---
|
||||
pjsip/include/pjsip-simple/evsub.h | 20 ++++++++++++++++++++
|
||||
pjsip/src/pjsip-simple/evsub.c | 14 ++++++++++++++
|
||||
2 files changed, 34 insertions(+)
|
||||
|
||||
diff --git a/pjsip/include/pjsip-simple/evsub.h b/pjsip/include/pjsip-simple/evsub.h
|
||||
index 2dc4d69..31f85f8 100644
|
||||
--- a/pjsip/include/pjsip-simple/evsub.h
|
||||
+++ b/pjsip/include/pjsip-simple/evsub.h
|
||||
@@ -490,6 +490,26 @@ PJ_DECL(void) pjsip_evsub_set_mod_data( pjsip_evsub *sub, unsigned mod_id,
|
||||
PJ_DECL(void*) pjsip_evsub_get_mod_data( pjsip_evsub *sub, unsigned mod_id );
|
||||
|
||||
|
||||
+/**
|
||||
+ * Increment the event subscription's group lock.
|
||||
+ *
|
||||
+ * @param sub The server subscription instance.
|
||||
+ *
|
||||
+ * @return PJ_SUCCESS on success.
|
||||
+ */
|
||||
+PJ_DEF(pj_status_t) pjsip_evsub_add_ref(pjsip_evsub *sub);
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * Decrement the event subscription's group lock.
|
||||
+ *
|
||||
+ * @param sub The server subscription instance.
|
||||
+ *
|
||||
+ * @return PJ_SUCCESS on success.
|
||||
+ */
|
||||
+PJ_DEF(pj_status_t) pjsip_evsub_dec_ref(pjsip_evsub *sub);
|
||||
+
|
||||
+
|
||||
|
||||
PJ_END_DECL
|
||||
|
||||
diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c
|
||||
index 7cd8859..68a9564 100644
|
||||
--- a/pjsip/src/pjsip-simple/evsub.c
|
||||
+++ b/pjsip/src/pjsip-simple/evsub.c
|
||||
@@ -831,7 +831,21 @@ static pj_status_t evsub_create( pjsip_dialog *dlg,
|
||||
return PJ_SUCCESS;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Increment the event subscription's group lock.
|
||||
+ */
|
||||
+PJ_DEF(pj_status_t) pjsip_evsub_add_ref(pjsip_evsub *sub)
|
||||
+{
|
||||
+ return pj_grp_lock_add_ref(sub->grp_lock);
|
||||
+}
|
||||
|
||||
+/*
|
||||
+ * Decrement the event subscription's group lock.
|
||||
+ */
|
||||
+PJ_DEF(pj_status_t) pjsip_evsub_dec_ref(pjsip_evsub *sub)
|
||||
+{
|
||||
+ return pj_grp_lock_dec_ref(sub->grp_lock);
|
||||
+}
|
||||
|
||||
/*
|
||||
* Create client subscription session.
|
||||
--
|
||||
2.5.5
|
||||
|
@@ -1,48 +0,0 @@
|
||||
From b7cb93b0e1729589a71e8b30d9a9893f0918e2a2 Mon Sep 17 00:00:00 2001
|
||||
From: George Joseph <george.joseph@fairview5.com>
|
||||
Date: Mon, 30 May 2016 11:58:22 -0600
|
||||
Subject: [PATCH] sip_transport_tcp/tls: Set factory on transports created
|
||||
from accept
|
||||
|
||||
The ability to re-use tcp and tls transports when a factory is
|
||||
specified now depends on transport->factory being set which is a new field
|
||||
in 2.5. This was being set only on new outgoing sockets not on
|
||||
incoming sockets. The result was that a client REGISTER created a new
|
||||
socket but without the factory set, the next outgoing request to the
|
||||
client, OPTIONS, INVITE, etc, would attempt to create another socket
|
||||
which the client would refuse.
|
||||
|
||||
This patch sets the factory on transports created as a result of an
|
||||
accept.
|
||||
---
|
||||
pjsip/src/pjsip/sip_transport_tcp.c | 1 +
|
||||
pjsip/src/pjsip/sip_transport_tls.c | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
|
||||
index 1bbb324..00eb8fc 100644
|
||||
--- a/pjsip/src/pjsip/sip_transport_tcp.c
|
||||
+++ b/pjsip/src/pjsip/sip_transport_tcp.c
|
||||
@@ -713,6 +713,7 @@ static pj_status_t tcp_create( struct tcp_listener *listener,
|
||||
tcp->base.send_msg = &tcp_send_msg;
|
||||
tcp->base.do_shutdown = &tcp_shutdown;
|
||||
tcp->base.destroy = &tcp_destroy_transport;
|
||||
+ tcp->base.factory = &listener->factory;
|
||||
|
||||
/* Create group lock */
|
||||
status = pj_grp_lock_create(pool, NULL, &tcp->grp_lock);
|
||||
diff --git a/pjsip/src/pjsip/sip_transport_tls.c b/pjsip/src/pjsip/sip_transport_tls.c
|
||||
index a83ac32..36ee70d 100644
|
||||
--- a/pjsip/src/pjsip/sip_transport_tls.c
|
||||
+++ b/pjsip/src/pjsip/sip_transport_tls.c
|
||||
@@ -742,6 +742,7 @@ static pj_status_t tls_create( struct tls_listener *listener,
|
||||
tls->base.send_msg = &tls_send_msg;
|
||||
tls->base.do_shutdown = &tls_shutdown;
|
||||
tls->base.destroy = &tls_destroy_transport;
|
||||
+ tls->base.factory = &listener->factory;
|
||||
|
||||
tls->ssock = ssock;
|
||||
|
||||
--
|
||||
2.5.5
|
||||
|
56
third-party/pjproject/patches/0002-Fix-1946-Avoid-deinitialization-of-uninitialized-cli.patch
vendored
Normal file
56
third-party/pjproject/patches/0002-Fix-1946-Avoid-deinitialization-of-uninitialized-cli.patch
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
From 33fd755e819dc85a96718abc0ae26a9b46f14800 Mon Sep 17 00:00:00 2001
|
||||
From: nanang <nanang@localhost>
|
||||
Date: Thu, 28 Jul 2016 08:21:45 +0000
|
||||
Subject: [PATCH 2/3] Fix #1946: Avoid deinitialization of uninitialized client
|
||||
auth session.
|
||||
|
||||
---
|
||||
pjsip/src/pjsip/sip_dialog.c | 18 ++++++------------
|
||||
1 file changed, 6 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c
|
||||
index f03885d..421ddc4 100644
|
||||
--- a/pjsip/src/pjsip/sip_dialog.c
|
||||
+++ b/pjsip/src/pjsip/sip_dialog.c
|
||||
@@ -92,6 +92,12 @@ static pj_status_t create_dialog( pjsip_user_agent *ua,
|
||||
pj_list_init(&dlg->inv_hdr);
|
||||
pj_list_init(&dlg->rem_cap_hdr);
|
||||
|
||||
+ /* Init client authentication session. */
|
||||
+ status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt,
|
||||
+ dlg->pool, 0);
|
||||
+ if (status != PJ_SUCCESS)
|
||||
+ goto on_error;
|
||||
+
|
||||
status = pj_mutex_create_recursive(pool, dlg->obj_name, &dlg->mutex_);
|
||||
if (status != PJ_SUCCESS)
|
||||
goto on_error;
|
||||
@@ -283,12 +289,6 @@ PJ_DEF(pj_status_t) pjsip_dlg_create_uac( pjsip_user_agent *ua,
|
||||
/* Initial route set is empty. */
|
||||
pj_list_init(&dlg->route_set);
|
||||
|
||||
- /* Init client authentication session. */
|
||||
- status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt,
|
||||
- dlg->pool, 0);
|
||||
- if (status != PJ_SUCCESS)
|
||||
- goto on_error;
|
||||
-
|
||||
/* Register this dialog to user agent. */
|
||||
status = pjsip_ua_register_dlg( ua, dlg );
|
||||
if (status != PJ_SUCCESS)
|
||||
@@ -506,12 +506,6 @@ pj_status_t create_uas_dialog( pjsip_user_agent *ua,
|
||||
}
|
||||
dlg->route_set_frozen = PJ_TRUE;
|
||||
|
||||
- /* Init client authentication session. */
|
||||
- status = pjsip_auth_clt_init(&dlg->auth_sess, dlg->endpt,
|
||||
- dlg->pool, 0);
|
||||
- if (status != PJ_SUCCESS)
|
||||
- goto on_error;
|
||||
-
|
||||
/* Increment the dialog's lock since tsx may cause the dialog to be
|
||||
* destroyed prematurely (such as in case of transport error).
|
||||
*/
|
||||
--
|
||||
2.7.4
|
||||
|
2
third-party/pjproject/patches/config_site.h
vendored
2
third-party/pjproject/patches/config_site.h
vendored
@@ -19,7 +19,7 @@
|
||||
#define PJ_SCANNER_USE_BITWISE 0
|
||||
#define PJ_OS_HAS_CHECK_STACK 0
|
||||
#define PJ_LOG_MAX_LEVEL 3
|
||||
#define PJ_ENABLE_EXTRA_CHECK 0
|
||||
#define PJ_ENABLE_EXTRA_CHECK 1
|
||||
#define PJSIP_MAX_TSX_COUNT ((64*1024)-1)
|
||||
#define PJSIP_MAX_DIALOG_COUNT ((64*1024)-1)
|
||||
#define PJSIP_UDP_SO_SNDBUF_SIZE (512*1024)
|
||||
|
2
third-party/versions.mak
vendored
2
third-party/versions.mak
vendored
@@ -1,2 +1,2 @@
|
||||
|
||||
PJPROJECT_VERSION = 2.5
|
||||
PJPROJECT_VERSION = 2.5.5
|
||||
|
Reference in New Issue
Block a user