Compare commits

...

11 Commits

Author SHA1 Message Date
Kevin Harwell
b633f5ac94 ChangeLog: Updated for 14.0.1 2016-09-27 13:43:33 -05:00
Kevin Harwell
7c8dd167eb Release summaries: Add summaries for 14.0.1 2016-09-27 13:43:32 -05:00
Kevin Harwell
80b3a952e0 Release summaries: Remove previous versions 2016-09-27 13:43:21 -05:00
Kevin Harwell
404c4a6820 .version: Update for 14.0.1 2016-09-27 13:43:21 -05:00
Kevin Harwell
8e0f992505 .lastclean: Update for 14.0.1 2016-09-27 13:43:21 -05:00
Kevin Harwell
801966afa9 realtime: Add database scripts for 14.0.1 2016-09-27 13:43:20 -05:00
George Joseph
d3d8257106 codec_opus: Add download ability to menuselect
Updated codecs/codecs.xml to add codec_opus to the external
download list.

ASTERISK-26409

Change-Id: Ia07b36539f30e852125fb2b94147dc9774df31a4
(cherry picked from commit 2cdab0e36eec4997ca3bd85aa09efc477038e31c)
2016-09-27 12:23:13 -05:00
George Joseph
1e98c8d5c8 codec_opus: Replace res_format_attr_opus with the one from codec_opus
Preparation

ASTERISK-26409

Change-Id: I9f20e7cce00c32464d9a180e81283d49d199d0a3
2016-09-27 12:23:13 -05:00
George Joseph
a091e15985 format_ogg_opus: New format
Add Ogg/Opus playback support.

This uses libopusfile in order to be able to read .opus files and play
them back.

Writing/recording support is not present at this time.

ASTERISK-26409

Change-Id: I8815d23345108d8ca7c0bd640f6a1ce6b4f56955
2016-09-27 12:23:13 -05:00
George Joseph
a13b54df83 build_tools: Add ability to download variants to download_externals
Some external packages have multiple variants that apply to different
builds of asterisk.  The DPMA for instance has a "bundled" variant that
needs to be downloaded if asterisk was configured with
--with-pjproject-bundled.

There are 2 ways to specify variants:

If you need the user to make the decision about which variant to
download, simply create multiple menuselect "member" entries like so...

<member name="res_digium_phone" displayname="..snipped..">
  <support_level>external</support_level>
  <depend>xmlstarlet</depend>
  <depend>bash</depend>
  <defaultenabled>no</defaultenabled>
</member>

<member name="res_digium_phone-bundled" displayname="..snipped..">
  <support_level>external</support_level>
  <depend>xmlstarlet</depend>
  <depend>bash</depend>
  <defaultenabled>no</defaultenabled>
</member>

Note that the second entry has "-<variant>" appended to the name.
You can then use the existing menuselect facilities to restrict which
members to enable or disable.  Youy probably don't want the user to
enable multiple at the same time.

If you want to hide the details of the variants, the better way to
do it is to create 1 member with "variant" elements.

<member name="res_digium_phone" displayname="..snipped..">
  <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>

The condition must be a bash expression suitable for use with an "if"
statement.  Any environment variable can be used plus those available
in makeopts.

In this case, if asterisk was configured with --with-pjproject-bundled
the bundled variant will be automatically downloaded.  Otherwise the
normal version will be downloaded.

Change-Id: I4de23e06d4492b0a65e105c8369966547d0faa3e
2016-09-27 10:55:03 -05:00
George Joseph
13cae45bb5 build: Add download capability for external packages
The DPMA and g729a, silk, siren7 and siren14 codecs hosted at
http://downloads.digium.com/pub/telephony/ are now listed in the
"External" sections of the "Resource Modules" and "Codec Translators"
pages in menuselect.  Any that are selected will automatically be
downloaded and installed when "make install" is run.  Their LICENSE and
README (if avaialble) files will be installed to
ASTVARLIBDIR/documentation/thirdparty/<product_name>.

Example use with codecs:

The codecs/codecs.xml file is a menuselect style xml file that lists
the codecs to be included.  Their support levels are 'external', which
triggers the download and install, and defaultenabled is no.  Also
because codec_g729a is actually in a directory named codec_g729 on the
download server, the newly added 'member_data' element is used to
override the default of the directory name being the package name.  You
can use the 'directory_name' attribute to keep default base URL
(http://downloads.digium.com/pub/telephony/) but use the new directory,
or you use the 'remote_url' attribute to specify a full URL to the
download directory.  In this case, you must still follow the same
subdirectory naming conventions as that used for the packages located
at 'http://downloads.digium.com/pub/telephony'.

A new configure option '--with-externals-cache' was added and like
'--with-sounds-cache' it allows the installer to cache tarballs so
they're not downloaded every time.

To assist with the download and install process, each external package
now has a manifest.xml file that, among other things, contains a package
version and checksums for each file in the tarball.  The manifest is
saved to both the cache directory and ASTMODDIR and together with the
manifest.xml on the downloads site, tells the install scripts whether
a download and/or update is needed.

bash and xmlstarlet are required for downloader operation.  If they're
not installed, the external items in menuselect will be unavailable.

Change-Id: Id3dcf1289ffd3cb0bbd7dfab3cafbb87be60323a
(cherry picked from commit 8b6f9dde14)
2016-09-27 09:53:39 -06:00
22 changed files with 1421 additions and 14613 deletions

View File

@@ -1 +1 @@
14.0.0
14.0.1

15
CHANGES
View File

@@ -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 --------------------
------------------------------------------------------------------------------

162
ChangeLog
View File

@@ -1,3 +1,165 @@
2016-09-27 18:43 +0000 Asterisk Development Team <asteriskteam@digium.com>
* asterisk 14.0.1 Released.
2016-09-27 13:43 +0000 [80b3a952e0] Kevin Harwell <kharwell@digium.com>
* Release summaries: Remove previous versions
2016-09-27 13:43 +0000 [404c4a6820] Kevin Harwell <kharwell@digium.com>
* .version: Update for 14.0.1
2016-09-27 13:43 +0000 [8e0f992505] Kevin Harwell <kharwell@digium.com>
* .lastclean: Update for 14.0.1
2016-09-27 13:43 +0000 [801966afa9] Kevin Harwell <kharwell@digium.com>
* realtime: Add database scripts for 14.0.1
2016-09-22 09:49 +0000 [d3d8257106] gtjoseph <gjoseph@digium.com>
* codec_opus: Add download ability to menuselect
Updated codecs/codecs.xml to add codec_opus to the external
download list.
ASTERISK-26409
Change-Id: Ia07b36539f30e852125fb2b94147dc9774df31a4
(cherry picked from commit 2cdab0e36eec4997ca3bd85aa09efc477038e31c)
2016-07-23 14:50 +0000 [1e98c8d5c8] gtjoseph <gjoseph@digium.com>
* codec_opus: Replace res_format_attr_opus with the one from codec_opus
Preparation
ASTERISK-26409
Change-Id: I9f20e7cce00c32464d9a180e81283d49d199d0a3
2016-07-23 15:56 +0000 [a091e15985] gtjoseph <gjoseph@digium.com>
* format_ogg_opus: New format
Add Ogg/Opus playback support.
This uses libopusfile in order to be able to read .opus files and play
them back.
Writing/recording support is not present at this time.
ASTERISK-26409
Change-Id: I8815d23345108d8ca7c0bd640f6a1ce6b4f56955
2016-09-24 19:05 +0000 [a13b54df83] gtjoseph <gjoseph@digium.com>
* build_tools: Add ability to download variants to download_externals
Some external packages have multiple variants that apply to different
builds of asterisk. The DPMA for instance has a "bundled" variant that
needs to be downloaded if asterisk was configured with
--with-pjproject-bundled.
There are 2 ways to specify variants:
If you need the user to make the decision about which variant to
download, simply create multiple menuselect "member" entries like so...
<member name="res_digium_phone" displayname="..snipped..">
<support_level>external</support_level>
<depend>xmlstarlet</depend>
<depend>bash</depend>
<defaultenabled>no</defaultenabled>
</member>
<member name="res_digium_phone-bundled" displayname="..snipped..">
<support_level>external</support_level>
<depend>xmlstarlet</depend>
<depend>bash</depend>
<defaultenabled>no</defaultenabled>
</member>
Note that the second entry has "-<variant>" appended to the name.
You can then use the existing menuselect facilities to restrict which
members to enable or disable. Youy probably don't want the user to
enable multiple at the same time.
If you want to hide the details of the variants, the better way to
do it is to create 1 member with "variant" elements.
<member name="res_digium_phone" displayname="..snipped..">
<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>
The condition must be a bash expression suitable for use with an "if"
statement. Any environment variable can be used plus those available
in makeopts.
In this case, if asterisk was configured with --with-pjproject-bundled
the bundled variant will be automatically downloaded. Otherwise the
normal version will be downloaded.
Change-Id: I4de23e06d4492b0a65e105c8369966547d0faa3e
2016-08-01 20:55 +0000 [13cae45bb5] gtjoseph <gjoseph@digium.com>
* build: Add download capability for external packages
The DPMA and g729a, silk, siren7 and siren14 codecs hosted at
http://downloads.digium.com/pub/telephony/ are now listed in the
"External" sections of the "Resource Modules" and "Codec Translators"
pages in menuselect. Any that are selected will automatically be
downloaded and installed when "make install" is run. Their LICENSE and
README (if avaialble) files will be installed to
ASTVARLIBDIR/documentation/thirdparty/<product_name>.
Example use with codecs:
The codecs/codecs.xml file is a menuselect style xml file that lists
the codecs to be included. Their support levels are 'external', which
triggers the download and install, and defaultenabled is no. Also
because codec_g729a is actually in a directory named codec_g729 on the
download server, the newly added 'member_data' element is used to
override the default of the directory name being the package name. You
can use the 'directory_name' attribute to keep default base URL
(http://downloads.digium.com/pub/telephony/) but use the new directory,
or you use the 'remote_url' attribute to specify a full URL to the
download directory. In this case, you must still follow the same
subdirectory naming conventions as that used for the packages located
at 'http://downloads.digium.com/pub/telephony'.
A new configure option '--with-externals-cache' was added and like
'--with-sounds-cache' it allows the installer to cache tarballs so
they're not downloaded every time.
To assist with the download and install process, each external package
now has a manifest.xml file that, among other things, contains a package
version and checksums for each file in the tarball. The manifest is
saved to both the cache directory and ASTMODDIR and together with the
manifest.xml on the downloads site, tells the install scripts whether
a download and/or update is needed.
bash and xmlstarlet are required for downloader operation. If they're
not installed, the external items in menuselect will be unavailable.
Change-Id: Id3dcf1289ffd3cb0bbd7dfab3cafbb87be60323a
(cherry picked from commit 8b6f9dde14d5ff30dd63c83ed20fb04dcda07e3e)
2016-09-23 20:38 +0000 Asterisk Development Team <asteriskteam@digium.com>
* asterisk 14.0.0 Released.

View File

@@ -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 >> $@

View File

@@ -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::

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View 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">&lt;asteriskteam@digium.com&gt;</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
View 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
View 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."

View 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

View File

@@ -16,6 +16,8 @@ elif [ -d ${1}/.git ]; 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=""

View File

@@ -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@

32
codecs/codecs.xml Normal file
View 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>

234
configure vendored
View File

@@ -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
@@ -29242,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

View File

@@ -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])
@@ -2274,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

229
formats/format_ogg_opus.c Normal file
View 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
);

View File

@@ -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

View File

@@ -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 */

View File

@@ -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@

13
res/res.xml Normal file
View 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>

View File

@@ -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;
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 */
);