Compare commits

..

23 Commits

Author SHA1 Message Date
Joshua Colp
9528429f4c ChangeLog: Updated for 14.0.0-beta2 2016-08-29 07:30:23 -05:00
Joshua Colp
9cdf44668d Release summaries: Add summaries for 14.0.0-beta2 2016-08-29 07:29:55 -05:00
Joshua Colp
73d39f2029 Release summaries: Remove previous versions 2016-08-29 07:29:29 -05:00
Joshua Colp
e8a97775ee .version: Update for 14.0.0-beta2 2016-08-29 07:29:29 -05:00
Joshua Colp
345409825a .lastclean: Update for 14.0.0-beta2 2016-08-29 07:29:29 -05:00
Joshua Colp
105c1168f7 realtime: Add database scripts for 14.0.0-beta2 2016-08-29 07:29:28 -05:00
Joshua Colp
8927b52634 alembic: Fix downgrade path.
The 3772f8f828da version was referencing a previous version
that did not exist in the 14.0 branch. It has been fixed to
reference the correct previous version.

Change-Id: I004d0fcfdfe1d1bb6f01c6dac2b69f6b1f40ae51
2016-08-29 11:31:05 +00:00
Joshua Colp
fc68258037 Merge "res_pjsip: Fail global load if debug or default_from_user are empty" into 14.0 2016-08-12 16:35:21 -05:00
George Joseph
9a95c6dea3 res_pjsip: Fail global load if debug or default_from_user are empty
If debug was specified in the global configuration but left blank,
the logger would treat it as a wildcard and log all hosts.  If
default_from_user was empty, a crash would result.

The global apply handler now checks for empty strings.

ASTERISK-26239 #close
ASTERISK-26238 #close

Change-Id: Ie75727f5cd5808845d92cc81f5713842fb203336
2016-08-12 07:41:51 -05:00
George Joseph
aaee8160bc res_pjsip_caller_id: Copy header name to short header name
When compact_headers was set, we were sending a zero-length header name
for PAI and RPID because we always forced the short header name length
to 0.  We did this because we cloned the header from "From" and wanted
to clear "f" from the sname.  By cloning however, we bypass pjproject's
automatic logic that sets sname to name if there's no compact form of
the header, which there isn't for PAI and RPID.  So now we force sname
to be the same as name right after we set name.

res_pjsip_diversion needed the same treatment for the Diversion header.

ASTERISK-26241 #close

Change-Id: I633ec139630cd83809aae00336cee4a10077e467
2016-08-12 06:08:19 -05:00
Joshua Colp
72e2d978ac Merge "alembic: add auth_username to endpoint's identify_by enum" into 14.0 2016-08-12 04:47:14 -05:00
Joshua Colp
1877d36c95 Merge "res_resolver_unbound: Allow compilation with libunbound version < 1.5" into 14.0 2016-08-11 16:11:31 -05:00
George Joseph
7af0eac02a autohints: Update CHANGES and extensions.conf.sample
Make it clear that we're talking about device state hints and add
an entry to the sample config.

Change-Id: Iaef58ffb960191a21b713e8e0b51ce1fcd47e433
2016-08-11 15:00:44 -05:00
Kevin Harwell
ef0bf47bb3 alembic: add auth_username to endpoint's identify_by enum
A new identify_by option was added recently, auth_username. However, this
setting was not added as an allowable choice in the database enumeration
value.

This patch updates the current enumeration, adding in the new setting.

ASTERISK-26268 #close

Change-Id: Ib4788e8485e4cd40172ec0abbf5810a147ab8bf8
2016-08-11 11:00:50 -05:00
zuul
be8fa4a81d Merge "res_srtp: Move SDP SRTP code from the core to res_srtp." into 14.0 2016-08-11 06:57:06 -05:00
Richard Mudgett
a1d6b14c40 res_srtp: Move SDP SRTP code from the core to res_srtp.
A patch made to the master branch (Now the 14 branch) inadvertently made
libsrtp a required dependency in order to compile Asterisk.  Rather than
create dummy defines to substitute for the defines supplied by libsrtp
when libsrtp is not available, most of the code in sdp_srtp.c is moved
into res_srtp.c.  This gets more code out of Asterisk's core that isn't
used when SRTP is not available.  This also makes another inadvertent
required dependency on libsrtp by Asterisk's core unlikely.

ASTERISK-26253 #close
Reported by: Ben Merrills

Change-Id: I0a46cde81501c0405399c2588633ae32706d1ee7
2016-08-10 17:43:45 -05:00
Kevin Harwell
a783e1e60d alembic/sqlalchemy: auto increment only allowed on a single column
The extensions table defined two columns (id and priority) as primary key
autoincrement columns. However only one is allowed when defining the primary
key.

This patch removes the autoincrement attribute from the priority column since
it does not need to be as such and really should not have been on there in the
first place.

This patch also removes 'context', 'exten', and 'priority' from the primary key
index and creates a new combined unique contraint index on them.

ASTERISK-26183 #close

Change-Id: Ib9c712c612a4d7ec1edb0dcb77f1bae0905a470b
2016-08-10 13:50:26 -05:00
George Joseph
9c56f798f6 res_resolver_unbound: Allow compilation with libunbound version < 1.5
libunbound at version 1.4.20 (which CentOS still uses) declared all
of their string function parameters as as 'char *'.  1.4.21 changed
them all to 'const char *'.  Thankfully 1.4.21 also introduced the
UNBOUND_VERSION_MAJOR define so configure now checks for that and
sets HAVE_UNBOUND_CONST_PARAMS.  res_resolver_unbound then checks
that and casts away the 'const' if it's not set.

Tested compile and testsuite on CentOS6 (1.4.20), Ubuntu14 (1.4.22) and
Fedora24 (1.5.4).  There are a few failing tests to be addressed though.

ASTERISK-26283 #close

Change-Id: Ib708b19b706c5d0ba7b7d5473e6df339d9ae4148
2016-08-10 12:09:37 -05:00
zuul
01ee54ea1c Merge "menuselect: Add an opaque "member_data" string to the acceptable xml" into 14.0 2016-08-02 18:20:07 -05:00
George Joseph
1ad00c1c30 menuselect: Add an opaque "member_data" string to the acceptable xml
Change-Id: Id5ac43b95c8d7395f3be37f983632169db3d1afe
2016-08-02 09:56:56 -05:00
George Joseph
815b6f72f8 pjproject_bundled: Update for pjproject 2.5.5
Add more --disable-* switches to Makefile.rules including
--disable-opus which was causing bundled pjproject to fail with
"undefined reference" errors in libasteriskpj.

Changed PJ_ENABLE_EXTRA_CHECK to 1.

Removed 2 obsolete patches and added a new one.
The new one was merged by Teluu on 6/27/2016.

ASTERISK-26148 #close

Change-Id: Ib8af6c6a9d31f7238ce65b336134c2efdc855063
(cherry picked from commit 4cf02b5584)
2016-08-02 09:56:20 -05:00
Mark Michelson
c95b611a73 Remove SILK payload mappings from Asterisk core.
SILK is a bit of a hog when it comes to using up our limited number of
dynamic payload types in the RTP engine. By freeing up four slots, it
allows for other codecs to potentially take the place.

Now, codec_silk.so will dynamically use the payload slots in the RTP
engine when it loads.

A better fix would be make RTP dynamic payload types actually
dynamic. However, at this stage of Asterisk 14 development, this is a
risky move that would be imprudent.

Change-Id: I5774e09408f9a203db189529eabdc0d3f4c1e612
2016-08-01 11:40:15 -05:00
Kevin Harwell
bc94ccbcdd rtp_engine: Failed assertion and wrong name given for codec
Fixed an assert check that would trigger when the passed in value was negative.
The negative value was being cast to an unsigned value. This resulted in the
check failing.

Also fixed another problem when loading formats in the engine. When setting the
mime type the format's name was being passed in instead of the codec's name.

Change-Id: I1a201cd419ba4d8e9a40d337e36b6fbe1737192c
2016-07-27 12:49:28 -05:00
33 changed files with 1460 additions and 15045 deletions

View File

@@ -1 +1 @@
14.0.0-beta1
14.0.0-beta2

11
CHANGES
View File

@@ -243,12 +243,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
------------------

198
ChangeLog
View File

@@ -1,3 +1,201 @@
2016-08-29 12:30 +0000 Asterisk Development Team <asteriskteam@digium.com>
* asterisk 14.0.0-beta2 Released.
2016-08-29 07:29 +0000 [9cdf44668d] Joshua Colp <jcolp@digium.com>
* Release summaries: Add summaries for 14.0.0-beta2
2016-08-29 07:29 +0000 [73d39f2029] Joshua Colp <jcolp@digium.com>
* Release summaries: Remove previous versions
2016-08-29 07:29 +0000 [e8a97775ee] Joshua Colp <jcolp@digium.com>
* .version: Update for 14.0.0-beta2
2016-08-29 07:29 +0000 [345409825a] Joshua Colp <jcolp@digium.com>
* .lastclean: Update for 14.0.0-beta2
2016-08-29 07:29 +0000 [105c1168f7] Joshua Colp <jcolp@digium.com>
* realtime: Add database scripts for 14.0.0-beta2
2016-08-29 06:31 +0000 [8927b52634] Joshua Colp <jcolp@digium.com>
* alembic: Fix downgrade path.
The 3772f8f828da version was referencing a previous version
that did not exist in the 14.0 branch. It has been fixed to
reference the correct previous version.
Change-Id: I004d0fcfdfe1d1bb6f01c6dac2b69f6b1f40ae51
2016-08-11 12:18 +0000 [9a95c6dea3] gtjoseph <gjoseph@digium.com>
* res_pjsip: Fail global load if debug or default_from_user are empty
If debug was specified in the global configuration but left blank,
the logger would treat it as a wildcard and log all hosts. If
default_from_user was empty, a crash would result.
The global apply handler now checks for empty strings.
ASTERISK-26239 #close
ASTERISK-26238 #close
Change-Id: Ie75727f5cd5808845d92cc81f5713842fb203336
2016-08-11 11:24 +0000 [aaee8160bc] gtjoseph <gjoseph@digium.com>
* res_pjsip_caller_id: Copy header name to short header name
When compact_headers was set, we were sending a zero-length header name
for PAI and RPID because we always forced the short header name length
to 0. We did this because we cloned the header from "From" and wanted
to clear "f" from the sname. By cloning however, we bypass pjproject's
automatic logic that sets sname to name if there's no compact form of
the header, which there isn't for PAI and RPID. So now we force sname
to be the same as name right after we set name.
res_pjsip_diversion needed the same treatment for the Diversion header.
ASTERISK-26241 #close
Change-Id: I633ec139630cd83809aae00336cee4a10077e467
2016-08-11 12:01 +0000 [7af0eac02a] gtjoseph <gjoseph@digium.com>
* autohints: Update CHANGES and extensions.conf.sample
Make it clear that we're talking about device state hints and add
an entry to the sample config.
Change-Id: Iaef58ffb960191a21b713e8e0b51ce1fcd47e433
2016-08-11 10:50 +0000 [ef0bf47bb3] Kevin Harwell <kharwell@digium.com>
* alembic: add auth_username to endpoint's identify_by enum
A new identify_by option was added recently, auth_username. However, this
setting was not added as an allowable choice in the database enumeration
value.
This patch updates the current enumeration, adding in the new setting.
ASTERISK-26268 #close
Change-Id: Ib4788e8485e4cd40172ec0abbf5810a147ab8bf8
2016-08-08 14:50 +0000 [a1d6b14c40] Richard Mudgett <rmudgett@digium.com>
* res_srtp: Move SDP SRTP code from the core to res_srtp.
A patch made to the master branch (Now the 14 branch) inadvertently made
libsrtp a required dependency in order to compile Asterisk. Rather than
create dummy defines to substitute for the defines supplied by libsrtp
when libsrtp is not available, most of the code in sdp_srtp.c is moved
into res_srtp.c. This gets more code out of Asterisk's core that isn't
used when SRTP is not available. This also makes another inadvertent
required dependency on libsrtp by Asterisk's core unlikely.
ASTERISK-26253 #close
Reported by: Ben Merrills
Change-Id: I0a46cde81501c0405399c2588633ae32706d1ee7
2016-08-09 12:07 +0000 [a783e1e60d] Kevin Harwell <kharwell@digium.com>
* alembic/sqlalchemy: auto increment only allowed on a single column
The extensions table defined two columns (id and priority) as primary key
autoincrement columns. However only one is allowed when defining the primary
key.
This patch removes the autoincrement attribute from the priority column since
it does not need to be as such and really should not have been on there in the
first place.
This patch also removes 'context', 'exten', and 'priority' from the primary key
index and creates a new combined unique contraint index on them.
ASTERISK-26183 #close
Change-Id: Ib9c712c612a4d7ec1edb0dcb77f1bae0905a470b
2016-08-10 11:47 +0000 [9c56f798f6] gtjoseph <gjoseph@digium.com>
* res_resolver_unbound: Allow compilation with libunbound version < 1.5
libunbound at version 1.4.20 (which CentOS still uses) declared all
of their string function parameters as as 'char *'. 1.4.21 changed
them all to 'const char *'. Thankfully 1.4.21 also introduced the
UNBOUND_VERSION_MAJOR define so configure now checks for that and
sets HAVE_UNBOUND_CONST_PARAMS. res_resolver_unbound then checks
that and casts away the 'const' if it's not set.
Tested compile and testsuite on CentOS6 (1.4.20), Ubuntu14 (1.4.22) and
Fedora24 (1.5.4). There are a few failing tests to be addressed though.
ASTERISK-26283 #close
Change-Id: Ib708b19b706c5d0ba7b7d5473e6df339d9ae4148
2016-08-01 16:13 +0000 [1ad00c1c30] gtjoseph <gjoseph@digium.com>
* menuselect: Add an opaque "member_data" string to the acceptable xml
Change-Id: Id5ac43b95c8d7395f3be37f983632169db3d1afe
2016-07-17 18:28 +0000 [815b6f72f8] gtjoseph <gjoseph@digium.com>
* pjproject_bundled: Update for pjproject 2.5.5
Add more --disable-* switches to Makefile.rules including
--disable-opus which was causing bundled pjproject to fail with
"undefined reference" errors in libasteriskpj.
Changed PJ_ENABLE_EXTRA_CHECK to 1.
Removed 2 obsolete patches and added a new one.
The new one was merged by Teluu on 6/27/2016.
ASTERISK-26148 #close
Change-Id: Ib8af6c6a9d31f7238ce65b336134c2efdc855063
(cherry picked from commit 4cf02b5584ce33bb0a64408c27bf20c19bc4ce13)
2016-07-29 13:13 +0000 [c95b611a73] Mark Michelson <mmichelson@digium.com>
* Remove SILK payload mappings from Asterisk core.
SILK is a bit of a hog when it comes to using up our limited number of
dynamic payload types in the RTP engine. By freeing up four slots, it
allows for other codecs to potentially take the place.
Now, codec_silk.so will dynamically use the payload slots in the RTP
engine when it loads.
A better fix would be make RTP dynamic payload types actually
dynamic. However, at this stage of Asterisk 14 development, this is a
risky move that would be imprudent.
Change-Id: I5774e09408f9a203db189529eabdc0d3f4c1e612
2016-07-27 12:36 +0000 [bc94ccbcdd] Kevin Harwell <kharwell@digium.com>
* rtp_engine: Failed assertion and wrong name given for codec
Fixed an assert check that would trigger when the passed in value was negative.
The negative value was being cast to an unsigned value. This resulted in the
check failing.
Also fixed another problem when loading formats in the engine. When setting the
mime type the format's name was being passed in instead of the codec's name.
Change-Id: I1a201cd419ba4d8e9a40d337e36b6fbe1737192c
2016-07-26 23:19 +0000 Asterisk Development Team <asteriskteam@digium.com>
* asterisk 14.0.0-beta1 Released.

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,60 @@
<!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.0-beta2</title><h1 align="center"><a name="top">Release Summary</a></h1><h3 align="center">asterisk-14.0.0-beta2</h3><h3 align="center">Date: 2016-08-29</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="#closed_issues">Closed 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 is the first release of a major new version of Asterisk. For a list of new features that have been included with this release, please see the CHANGES file inside the source package. Since this is a new major release, users are encouraged to do extended testing before upgrading to this version in a production environment.</p><p>The data in this summary reflects changes that have been made since the previous release, asterisk-14.0.0-beta1.</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%">6 George Joseph <gjoseph@digium.com><br/>5 Joshua Colp <jcolp@digium.com><br/>3 Kevin Harwell <kharwell@digium.com><br/>1 Richard Mudgett <rmudgett@digium.com><br/>1 Mark Michelson <mmichelson@digium.com><br/></td><td width="33%"><td width="33%">3 George Joseph <gjoseph@digium.com><br/>2 Joshua Colp <jcolp@digium.com><br/>1 Ben Merrills <ben@xdev.net><br/>1 Kevin Harwell <kharwell@digium.com><br/>1 Hans van Eijsden <info@hansvaneijsden.nl><br/></td></tr>
</table><hr><a name="closed_issues"><h2 align="center">Closed Issues</h2></a><center><a href="#top">[Back to Top]</a></center><p>This is a list of all issues from the issue tracker that were closed by changes that went into this release.</p><h3>Bug</h3><h4>Category: Contrib/General</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-26183">ASTERISK-26183</a>: alembic: error when using sqlalchemy version 1.1.0b2<br/>Reported by: Kevin Harwell<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=a783e1e60dd9594e830359ad3eb20c3ef0e761c3">[a783e1e60d]</a> Kevin Harwell -- alembic/sqlalchemy: auto increment only allowed on a single column</li>
</ul><br><h4>Category: Core/General</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-26253">ASTERISK-26253</a>: sdp_srtp: libsrtp now a required dependency, shouldn't be<br/>Reported by: Ben Merrills<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=a1d6b14c40498c3e6c6373fca1c2a41922ab7ebe">[a1d6b14c40]</a> Richard Mudgett -- res_srtp: Move SDP SRTP code from the core to res_srtp.</li>
</ul><br><h4>Category: Resources/res_pjsip</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-26238">ASTERISK-26238</a>: res_pjsip: Empty global default_from_user causes crash<br/>Reported by: Joshua Colp<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=9a95c6dea39ecd2cf14b84f5d923d0a07a42138f">[9a95c6dea3]</a> gtjoseph -- res_pjsip: Fail global load if debug or default_from_user are empty</li>
</ul><a href="https://issues.asterisk.org/jira/browse/ASTERISK-26241">ASTERISK-26241</a>: res_pjsip: When using compact headers, rpid and pai are incorrectly generated<br/>Reported by: George Joseph<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=aaee8160bcb875763eb8375e2b61b1c3a6a5db8a">[aaee8160bc]</a> gtjoseph -- res_pjsip_caller_id: Copy header name to short header name</li>
</ul><br><h4>Category: Resources/res_pjsip/Bundling</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-26148">ASTERISK-26148</a>: pjsip: Cannot compile 13.10.0-rc1: "libasteriskpj.so: undefined reference to..."<br/>Reported by: Hans van Eijsden<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=815b6f72f8796d27e17d91a6f5a14d9569f49564">[815b6f72f8]</a> gtjoseph -- pjproject_bundled: Update for pjproject 2.5.5</li>
</ul><br><h4>Category: Resources/res_pjsip_logger</h4><a href="https://issues.asterisk.org/jira/browse/ASTERISK-26239">ASTERISK-26239</a>: res_pjsip_logger: An empty global/debug option is treated as a "match all" hostname<br/>Reported by: George Joseph<ul>
<li><a href="https://code.asterisk.org/code/changelog/asterisk?cs=9a95c6dea39ecd2cf14b84f5d923d0a07a42138f">[9a95c6dea3]</a> gtjoseph -- res_pjsip: Fail global load if debug or default_from_user are empty</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=73d39f20294168fbb366f9bc7fe5f0b5cf8f5cf2">73d39f2029</a></td><td>Joshua Colp</td><td>Release summaries: Remove previous versions</td></tr>
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=e8a97775ee2ce128a9063f40b5657f1fbf5b3b07">e8a97775ee</a></td><td>Joshua Colp</td><td>.version: Update for 14.0.0-beta2</td></tr>
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=345409825a3e1e6ceb5b019855faf2bcedb44e98">345409825a</a></td><td>Joshua Colp</td><td>.lastclean: Update for 14.0.0-beta2</td></tr>
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=105c1168f7d634b2222d431a2793dec8960d8a33">105c1168f7</a></td><td>Joshua Colp</td><td>realtime: Add database scripts for 14.0.0-beta2</td></tr>
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=8927b52634d7c7396cd31f2bcc258d26d20e0060">8927b52634</a></td><td>Joshua Colp</td><td>alembic: Fix downgrade path.</td></tr>
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=7af0eac02a57a92adf6274ae8c8e6dd8741e12ab">7af0eac02a</a></td><td>gtjoseph</td><td>autohints: Update CHANGES and extensions.conf.sample</td></tr>
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=1ad00c1c30ce3726c0942595ac68b4d4038da10e">1ad00c1c30</a></td><td>gtjoseph</td><td>menuselect: Add an opaque "member_data" string to the acceptable xml</td></tr>
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=c95b611a73889cc29fdaaf037411972847660e56">c95b611a73</a></td><td>Mark Michelson</td><td>Remove SILK payload mappings from Asterisk core.</td></tr>
<tr><td><a href="https://code.asterisk.org/code/changelog/asterisk?cs=bc94ccbcdddc80992d07a42986abc751d958f78d">bc94ccbcdd</a></td><td>Kevin Harwell</td><td>rtp_engine: Failed assertion and wrong name given for codec</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-beta1-summary.html | 4244 ----
asterisk-14.0.0-beta1-summary.txt |10040 ----------
b/.version | 2
b/CHANGES | 11
b/configs/samples/extensions.conf.sample | 5
b/configure | 45
b/configure.ac | 3
b/contrib/ast-db-manage/config/versions/3772f8f828da_update_identify_by.py | 44
b/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py | 10
b/contrib/realtime/mssql/mssql_config.sql | 17
b/contrib/realtime/mysql/mysql_config.sql | 9
b/contrib/realtime/oracle/oracle_config.sql | 17
b/contrib/realtime/postgresql/postgresql_config.sql | 15
b/include/asterisk/autoconfig.h.in | 3
b/include/asterisk/sdp_srtp.h | 95
b/main/rtp_engine.c | 24
b/main/sdp_srtp.c | 606
b/menuselect/menuselect.c | 6
b/menuselect/menuselect.h | 2
b/res/res_pjsip/config_global.c | 12
b/res/res_pjsip_caller_id.c | 2
b/res/res_pjsip_diversion.c | 2
b/res/res_resolver_unbound.c | 53
b/res/res_srtp.c | 587
b/third-party/pjproject/Makefile.rules | 31
third-party/pjproject/patches/0001-evsub-Add-APIs-to-add-decrement-an-event-subscriptio.patch | 73
third-party/pjproject/patches/0001-sip_transport_tcp-tls-Set-factory-on-transports-crea.patch | 26
27 files changed, 963 insertions(+), 15021 deletions(-)</pre><br></html>

View File

@@ -0,0 +1,181 @@
Release Summary
asterisk-14.0.0-beta2
Date: 2016-08-29
<asteriskteam@digium.com>
----------------------------------------------------------------------
Table of Contents
1. Summary
2. Contributors
3. Closed Issues
4. Other Changes
5. Diffstat
----------------------------------------------------------------------
Summary
[Back to Top]
This is the first release of a major new version of Asterisk. For a list
of new features that have been included with this release, please see the
CHANGES file inside the source package. Since this is a new major release,
users are encouraged to do extended testing before upgrading to this
version in a production environment.
The data in this summary reflects changes that have been made since the
previous release, asterisk-14.0.0-beta1.
----------------------------------------------------------------------
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
6 George Joseph 3 George Joseph
5 Joshua Colp 2 Joshua Colp
3 Kevin Harwell 1 Ben Merrills
1 Richard Mudgett 1 Kevin Harwell
1 Mark Michelson 1 Hans van Eijsden
----------------------------------------------------------------------
Closed Issues
[Back to Top]
This is a list of all issues from the issue tracker that were closed by
changes that went into this release.
Bug
Category: Contrib/General
ASTERISK-26183: alembic: error when using sqlalchemy version 1.1.0b2
Reported by: Kevin Harwell
* [a783e1e60d] Kevin Harwell -- alembic/sqlalchemy: auto increment only
allowed on a single column
Category: Core/General
ASTERISK-26253: sdp_srtp: libsrtp now a required dependency, shouldn't be
Reported by: Ben Merrills
* [a1d6b14c40] Richard Mudgett -- res_srtp: Move SDP SRTP code from the
core to res_srtp.
Category: Resources/res_pjsip
ASTERISK-26238: res_pjsip: Empty global default_from_user causes crash
Reported by: Joshua Colp
* [9a95c6dea3] gtjoseph -- res_pjsip: Fail global load if debug or
default_from_user are empty
ASTERISK-26241: res_pjsip: When using compact headers, rpid and pai are
incorrectly generated
Reported by: George Joseph
* [aaee8160bc] gtjoseph -- res_pjsip_caller_id: Copy header name to
short header name
Category: Resources/res_pjsip/Bundling
ASTERISK-26148: pjsip: Cannot compile 13.10.0-rc1: "libasteriskpj.so:
undefined reference to..."
Reported by: Hans van Eijsden
* [815b6f72f8] gtjoseph -- pjproject_bundled: Update for pjproject 2.5.5
Category: Resources/res_pjsip_logger
ASTERISK-26239: res_pjsip_logger: An empty global/debug option is treated
as a "match all" hostname
Reported by: George Joseph
* [9a95c6dea3] gtjoseph -- res_pjsip: Fail global load if debug or
default_from_user are empty
----------------------------------------------------------------------
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 |
|------------+----------------+------------------------------------------|
| 73d39f2029 | Joshua Colp | Release summaries: Remove previous |
| | | versions |
|------------+----------------+------------------------------------------|
| e8a97775ee | Joshua Colp | .version: Update for 14.0.0-beta2 |
|------------+----------------+------------------------------------------|
| 345409825a | Joshua Colp | .lastclean: Update for 14.0.0-beta2 |
|------------+----------------+------------------------------------------|
| 105c1168f7 | Joshua Colp | realtime: Add database scripts for |
| | | 14.0.0-beta2 |
|------------+----------------+------------------------------------------|
| 8927b52634 | Joshua Colp | alembic: Fix downgrade path. |
|------------+----------------+------------------------------------------|
| 7af0eac02a | gtjoseph | autohints: Update CHANGES and |
| | | extensions.conf.sample |
|------------+----------------+------------------------------------------|
| 1ad00c1c30 | gtjoseph | menuselect: Add an opaque "member_data" |
| | | string to the acceptable xml |
|------------+----------------+------------------------------------------|
| c95b611a73 | Mark Michelson | Remove SILK payload mappings from |
| | | Asterisk core. |
|------------+----------------+------------------------------------------|
| bc94ccbcdd | Kevin Harwell | rtp_engine: Failed assertion and wrong |
| | | name given for codec |
+------------------------------------------------------------------------+
----------------------------------------------------------------------
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-beta1-summary.html | 4244 ----
asterisk-14.0.0-beta1-summary.txt |10040 ----------
b/.version | 2
b/CHANGES | 11
b/configs/samples/extensions.conf.sample | 5
b/configure | 45
b/configure.ac | 3
b/contrib/ast-db-manage/config/versions/3772f8f828da_update_identify_by.py | 44
b/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py | 10
b/contrib/realtime/mssql/mssql_config.sql | 17
b/contrib/realtime/mysql/mysql_config.sql | 9
b/contrib/realtime/oracle/oracle_config.sql | 17
b/contrib/realtime/postgresql/postgresql_config.sql | 15
b/include/asterisk/autoconfig.h.in | 3
b/include/asterisk/sdp_srtp.h | 95
b/main/rtp_engine.c | 24
b/main/sdp_srtp.c | 606
b/menuselect/menuselect.c | 6
b/menuselect/menuselect.h | 2
b/res/res_pjsip/config_global.c | 12
b/res/res_pjsip_caller_id.c | 2
b/res/res_pjsip_diversion.c | 2
b/res/res_resolver_unbound.c | 53
b/res/res_srtp.c | 587
b/third-party/pjproject/Makefile.rules | 31
third-party/pjproject/patches/0001-evsub-Add-APIs-to-add-decrement-an-event-subscriptio.patch | 73
third-party/pjproject/patches/0001-sip_transport_tcp-tls-Set-factory-on-transports-crea.patch | 26
27 files changed, 963 insertions(+), 15021 deletions(-)

View File

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

45
configure vendored
View File

@@ -23683,7 +23683,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 +23777,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=""

View File

@@ -2101,7 +2101,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], [])

View File

@@ -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'])

View File

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

View File

@@ -557,7 +557,8 @@ CREATE TABLE extensions (
priority INTEGER NOT NULL,
app VARCHAR(40) NOT NULL,
appdata VARCHAR(256) NOT NULL,
PRIMARY KEY (id, context, exten, priority),
PRIMARY KEY (id),
UNIQUE (context, exten, priority),
UNIQUE (id)
);
@@ -1508,6 +1509,20 @@ UPDATE alembic_version SET version_num='4a6c67fa9b7a' WHERE alembic_version.vers
GO
-- Running upgrade 4a6c67fa9b7a -> 3772f8f828da
ALTER TABLE ps_endpoints ALTER COLUMN identify_by VARCHAR(13);
GO
ALTER TABLE ps_endpoints ADD CONSTRAINT pjsip_identify_by_values CHECK (identify_by IN ('username', 'auth_username'));
GO
UPDATE alembic_version SET version_num='3772f8f828da' WHERE alembic_version.version_num = '4a6c67fa9b7a';
GO
COMMIT;
GO

View File

@@ -398,7 +398,8 @@ CREATE TABLE extensions (
priority INTEGER NOT NULL,
app VARCHAR(40) NOT NULL,
appdata VARCHAR(256) NOT NULL,
PRIMARY KEY (id, context, exten, priority),
PRIMARY KEY (id),
UNIQUE (context, exten, priority),
UNIQUE (id)
);
@@ -937,3 +938,9 @@ 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';

View File

@@ -555,7 +555,8 @@ CREATE TABLE extensions (
priority INTEGER NOT NULL,
app VARCHAR2(40 CHAR) NOT NULL,
appdata VARCHAR2(256 CHAR) NOT NULL,
PRIMARY KEY (id, context, exten, priority),
PRIMARY KEY (id),
UNIQUE (context, exten, priority),
UNIQUE (id)
)
@@ -1506,3 +1507,17 @@ UPDATE alembic_version SET version_num='4a6c67fa9b7a' WHERE alembic_version.vers
/
-- Running upgrade 4a6c67fa9b7a -> 3772f8f828da
ALTER TABLE ps_endpoints MODIFY identify_by VARCHAR(13 CHAR)
/
ALTER TABLE ps_endpoints ADD CONSTRAINT pjsip_identify_by_values CHECK (identify_by IN ('username', 'auth_username'))
/
UPDATE alembic_version SET version_num='3772f8f828da' WHERE alembic_version.version_num = '4a6c67fa9b7a'
/

View File

@@ -450,7 +450,8 @@ CREATE TABLE extensions (
priority INTEGER NOT NULL,
app VARCHAR(40) NOT NULL,
appdata VARCHAR(256) NOT NULL,
PRIMARY KEY (id, context, exten, priority),
PRIMARY KEY (id),
UNIQUE (context, exten, priority),
UNIQUE (id)
);
@@ -1007,5 +1008,17 @@ 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 TYPE pjsip_identify_by_values RENAME TO pjsip_identify_by_values_tmp;
CREATE TYPE pjsip_identify_by_values AS ENUM ('username', 'auth_username');
ALTER TABLE ps_endpoints ALTER COLUMN identify_by TYPE pjsip_identify_by_values USING identify_by::text::pjsip_identify_by_values;
DROP TYPE pjsip_identify_by_values_tmp;
UPDATE alembic_version SET version_num='3772f8f828da' WHERE alembic_version.version_num = '4a6c67fa9b7a';
COMMIT;

View File

@@ -1108,6 +1108,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

View File

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

View File

@@ -983,6 +983,7 @@ 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, "");
@@ -2257,7 +2258,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 +2273,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 +2306,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 +2692,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 +2745,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;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View 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

View File

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

View File

@@ -1,2 +1,2 @@
PJPROJECT_VERSION = 2.5
PJPROJECT_VERSION = 2.5.5