7 months agoconfbridge: Add support for disabling text messaging.
Joshua C. Colp [Thu, 16 Apr 2020 13:15:42 +0000 (10:15 -0300)]
confbridge: Add support for disabling text messaging.

When in a conference bridge it may be necessary to have
text messages disabled for specific participants or for
all. This change adds a configuration option, "text_messaging",
which can be used to enable or disable this on the
user profile. By default existing behavior is preserved
as it defaults to "yes".


Change-Id: I30b5d9ae6f4803881d1ed9300590d405e392bc13

7 months agores_pjsip_refer: Add build-time dependency.
Alexander Traud [Fri, 17 Apr 2020 09:18:25 +0000 (11:18 +0200)]
res_pjsip_refer: Add build-time dependency.


Change-Id: Ic693c3f464e35ec0db242afdb0a1415806af4e25

7 months agoapp_getcpeid: Add build-time dependency.
Alexander Traud [Fri, 17 Apr 2020 10:17:52 +0000 (12:17 +0200)]
app_getcpeid: Add build-time dependency.


Change-Id: I68b78e7e4718be82507247433127ce3992a5ba96

7 months agores_pjsip: Sync load- and build-time deps.
Alexander Traud [Fri, 17 Apr 2020 09:47:01 +0000 (11:47 +0200)]
res_pjsip: Sync load- and build-time deps.

MODULEINFO is checked while buidling/linking the module.
AST_MODULE_INFO is checked while loading/running the module.


Change-Id: I4bb868532ca217fec1351885d99eb55c21b58042

7 months agocurl: Add build-time dependency.
Alexander Traud [Fri, 17 Apr 2020 11:51:31 +0000 (13:51 +0200)]
curl: Add build-time dependency.


Change-Id: I34724e799e1ffaf723eb2c358abe8934dbadcd52

7 months agores_pjsip: Add build-time dependency.
Alexander Traud [Fri, 17 Apr 2020 09:55:32 +0000 (11:55 +0200)]
res_pjsip: Add build-time dependency.


Change-Id: Icb08304744ae3f34dce6ccb76f94379b8382a074

7 months agopjproject_bundled: Honor --without-pjproject.
Alexander Traud [Wed, 15 Apr 2020 18:01:58 +0000 (20:01 +0200)]
pjproject_bundled: Honor --without-pjproject.


Change-Id: Id057324912a3cfe6f50af372675626bb515907d9

7 months agores_rtp_asterisk: Resolve loop when receive buffer is flushed
Pirmin Walthert [Tue, 14 Apr 2020 15:48:07 +0000 (17:48 +0200)]
res_rtp_asterisk: Resolve loop when receive buffer is flushed

When the receive buffer was flushed by a received packet while it
already contained a packet with the same sequence number, Asterisk
never left the while loop which tried to order the packets.

This change makes it so if the packet is in the receive buffer it
is retrieved and freed allowing the buffer to empty.


Change-Id: Idaa376101bc1ac880047c49feb6faee773e718b3

7 months agoinstall_prereq: Add libcap for high bits in DiffServ/ToS.
Alexander Traud [Wed, 15 Apr 2020 12:16:00 +0000 (14:16 +0200)]
install_prereq: Add libcap for high bits in DiffServ/ToS.

works automatically; see Mantis 7047 (now ASTERISK-6863)

Change-Id: I27d2c109180bd857b6757fd532de48eddb78aee6

7 months agochan_sip: DiffServ/ToS not only on UDP but also on TCP and TLS sockets.
Alexander Traud [Wed, 15 Apr 2020 06:20:46 +0000 (08:20 +0200)]
chan_sip: DiffServ/ToS not only on UDP but also on TCP and TLS sockets.

Reported by: Joshua Roys

Change-Id: I6e72ecb874200dec7a3865c7babaf5ac0d3101de

7 months agoBuildSystem: Only if found LibPRI, check its optional parts.
Alexander Traud [Wed, 15 Apr 2020 11:09:11 +0000 (13:09 +0200)]
BuildSystem: Only if found LibPRI, check its optional parts.

Change-Id: If8445f899ee4ce0c606c484943d4ce0c8e43b5da

7 months agores_rtp_asterisk: Free payload when error on insertion to data buffer
Pirmin Walthert [Tue, 14 Apr 2020 15:31:15 +0000 (17:31 +0200)]
res_rtp_asterisk: Free payload when error on insertion to data buffer

When the ast_data_buffer_put rejects to add a packet, for example because
the buffer already contains a packet with the same sequence number, the
payload will never be freed, resulting in a memory leak.

The data buffer will now return an error if this situation occurs
allowing the caller to free the payload. The res_rtp_asterisk module
has also been updated to do this.


Change-Id: Ie6c49495d1c921d5f997651c7d0f79646f095cf1

7 months agoBuildSystem: Only if found external PJProject, check its optional parts.
Alexander Traud [Tue, 14 Apr 2020 11:26:34 +0000 (13:26 +0200)]
BuildSystem: Only if found external PJProject, check its optional parts.

Change-Id: I11d5693d25c166c99d8cebffc16184d58f6362de

7 months agores_rtp_asterisk.c: Check for first DTMF having timestamp set to 0
bernard merindol [Wed, 8 Apr 2020 10:29:42 +0000 (12:29 +0200)]
res_rtp_asterisk.c: Check for first DTMF having timestamp set to 0

When the first DTMF receive in RF2833 codec have TimeStamp at 0
is not processed.


Change-Id: I3196803a062dd2daee4938c9a778c3810cb7e504

7 months agores_stir_shaken: Do not build without OpenSSL.
Alexander Traud [Mon, 13 Apr 2020 16:47:22 +0000 (18:47 +0200)]
res_stir_shaken: Do not build without OpenSSL.

Change-Id: Idba5151a3079f9dcc0076d635422c5df5845114f

7 months agores_audiosocket: Avoid Sometimes-uninitialized Warning with Clang.
Alexander Traud [Mon, 13 Apr 2020 16:38:37 +0000 (18:38 +0200)]
res_audiosocket: Avoid Sometimes-uninitialized Warning with Clang.

Change-Id: I40c014c2cb88e943cf6f1b99a08c7c885e855b3a

7 months agofunc_volume: Accept decimal number as argument
Jean Aunis [Tue, 7 Apr 2020 12:05:22 +0000 (14:05 +0200)]
func_volume: Accept decimal number as argument

Allow voice volume to be multiplied or divided by a floating point number.


Change-Id: I5b42b890ec4e1f6b0b3400cb44ff16522b021c8c

7 months agores_rtp_asterisk: iterate all local addresses looking to populate ICE.
Jaco Kroon [Tue, 3 Dec 2019 18:35:20 +0000 (20:35 +0200)]
res_rtp_asterisk: iterate all local addresses looking to populate ICE.

By using pjproject to give us a list of candidates, and then filtering,
if the host has >32 addresses configured, then it is possible that we
end up filtering out all 32 of those, and ending up with no candidates
at all.  Instead, get getifaddrs (which pjsip is using underlying
anyway) to retrieve all local addresses, and iterate those, adding the
first 32 addresses not excluded by the ICE ACL.

In our setup at any point in time We've got between 6 and 328 addresses
on any given system.  The lower limit is the lower limit but the upper
limit is growing on a near daily basis currently.

Change-Id: I109eaffc3e2b432f00bf958e3caa0f38cacb4edb
Signed-off-by: Jaco Kroon <>

7 months agopjproject_bundled: Repair ./configure --with-ssl without ARG.
Alexander Traud [Fri, 10 Apr 2020 13:13:34 +0000 (15:13 +0200)]
pjproject_bundled: Repair ./configure --with-ssl without ARG.

Reported by: Patrick Wakano
Reported by: Dmitriy Serov

Change-Id: Ifb6b85c559d116739af00bc48d1f547caa85efac

7 months agores_pjsip: document legal dtls_verify endpoint options.
Jaco Kroon [Sat, 11 Apr 2020 19:03:39 +0000 (21:03 +0200)]
res_pjsip: document legal dtls_verify endpoint options.

Change-Id: I7fa7c5c8a7ddb0bd525982f58bff3264ebbd9a1b

7 months agoBuildSystem: Search for Python/C API when possibly needed only.
Alexander Traud [Sun, 12 Apr 2020 14:53:50 +0000 (16:53 +0200)]
BuildSystem: Search for Python/C API when possibly needed only.

The Python/C API is used only if the Test Framework was enabled in Asterisk
'make menuselect'. The Test Framework is available only if the Developer Mode
was enabled in Asterisk './configure --enable-dev-mode'. And that Python/C API
is used only if the PJProject was found and not disabled in Asterisk; the user
did not go for './configure --without-pjproject'.

Furthermore, because version 2 of that Python/C API is required (currently) and
because some platforms do not offer a generic version 2, the script searches
for 2.7 explicitly as well.

To avoid version mismatch between the Python/C API and the Python environment,
the script searches for the latter in the same versions, in the same the order
as well. Because this Python/C API is just for (some) Asterisk contributors,
the script also goes for the Python 3 environment as a last resort for all
other Asterisk users. This allows 'make full' even on minimal installations of
Ubuntu 18.04 LTS and newer.

Because the Python/C API is Asterisk contributor specific, the Python packages
are removed from the script './contrib/scripts/install_prereq' as this script
is intended for Asterisk users. Asterisk contributors have to install much more
packages in any case, like:
sudo apt install autoconf automake git git-review python2.7-dev


Change-Id: Id46d357e18869f64dcc217b8fdba821b63eeb876

7 months agochan_sip: TCP/TLS client without server.
traud [Wed, 1 Apr 2020 16:52:58 +0000 (18:52 +0200)]
chan_sip: TCP/TLS client without server.

It is possible to configure a TCP/TLS client without having a TCP/TLS
server. In that case, no error or warning was printed but the headers
Contact and Via in SIP REGISTER were "(null)".


Change-Id: I387ca5cb6a65f1eb675a29c5e41df8ec6c242ab2

7 months ago_pjsua: Build even with Clang.
Alexander Traud [Mon, 13 Apr 2020 17:05:48 +0000 (19:05 +0200)]
_pjsua: Build even with Clang.

Change-Id: Iebf7687613aa0295ea3c82256460b337f1595be2

7 months agores_rtp_asterisk: Build without PJProject.
Alexander Traud [Mon, 13 Apr 2020 16:27:28 +0000 (18:27 +0200)]
res_rtp_asterisk: Build without PJProject.

Change-Id: Ifc5059cd867e77b9c92ed9f4b895a9a91200d3ec

7 months agochan_pjsip: digit_begin - constant DTMF tone if RTP is not setup yet
Kevin Harwell [Wed, 8 Apr 2020 19:33:47 +0000 (14:33 -0500)]
chan_pjsip: digit_begin - constant DTMF tone if RTP is not setup yet

If chan_pjsip is configured for DTMF_RFC_4733, and the core triggers a
digit begin before media, or rtp has been setup then it's possible the
outgoing channel will hear a constant DTMF tone upon answering.

This happens because when there is no media, or rtp chan_pjsip notifies
the core to initiate inband DTMF. However, upon digit end if media, and
rtp become available then chan_pjsip does not notify the core to stop
inband DTMF. Thus the tone continues playing.

This patch makes it so chan_pjsip only notifies the core to start
inband DTMF in only the required cases. Now if there is no media, or
rtp availabe upon digit begin chan_pjsip does nothing, but tells the
core it handled it.

ASTERISK-28817 #close

Change-Id: I0dbea9fff444a2595fb18c64b89653e90d2f6eb5

7 months agobridge_softmix_binaural: Show state in menuselect.
Alexander Traud [Thu, 9 Apr 2020 13:25:24 +0000 (15:25 +0200)]
bridge_softmix_binaural: Show state in menuselect.


Change-Id: Iba7ee7bc7936d7a156171c8fc0f1670e864e7600

7 months agoBuildSystem: Remove doc/tex and doc/pdf leftovers.
traud [Tue, 7 Apr 2020 17:44:49 +0000 (19:44 +0200)]
BuildSystem: Remove doc/tex and doc/pdf leftovers.

Furthermore, the nowhere used compress is removed.


Change-Id: I77daab80cfabb56d51c3ea6b1d14bd9b9fbc577c

7 months agoBuildSystem: Allow space in path.
Alexander Traud [Thu, 9 Apr 2020 12:05:54 +0000 (14:05 +0200)]
BuildSystem: Allow space in path.


Change-Id: Ib7f246896457d9e3b14d7f5199136d6545ce0b6f

7 months agores_rtp_asterisk: Avoid absolute value on unsigned subtraction.
traud [Mon, 6 Apr 2020 13:00:10 +0000 (15:00 +0200)]
res_rtp_asterisk: Avoid absolute value on unsigned subtraction.


Change-Id: I269731715347c8e5ef7db1b6ffd3f8d15fc04be4

7 months agofunc_channel: allow reading 4 fields from dialplan
Sebastien Duthil [Tue, 31 Mar 2020 20:14:51 +0000 (16:14 -0400)]
func_channel: allow reading 4 fields from dialplan

The following fields return an error when read from dialplan:

- exten
- context
- userfield
- channame

ASTERISK-28796 #close

Change-Id: Ieacaac629490f8710fdacc9de80ed5916c5f6ee2

7 months agochan_unistim: Avoid tautological warnings with clang.
traud [Fri, 3 Apr 2020 17:25:37 +0000 (19:25 +0200)]
chan_unistim: Avoid tautological warnings with clang.


Change-Id: I15449621b68d0ad4d57b7c337c1167adb15135af

7 months agotest_stasis: Avoid always true warning with clang.
traud [Mon, 6 Apr 2020 11:56:39 +0000 (13:56 +0200)]
test_stasis: Avoid always true warning with clang.


Change-Id: I5e76831373532d7b8065d024e66cd1fb75dedd80

7 months agoRevert "res_config_odbc: Preserve empty strings returned by the database"
Sean Bright [Mon, 6 Apr 2020 14:29:13 +0000 (09:29 -0500)]
Revert "res_config_odbc: Preserve empty strings returned by the database"

This reverts commit a3a2fbaec685d931d56f669f2d4171220e9977ac.

Reason for revert: There is a lot of code that relies on the broken
behavior that this fixes.

Change-Id: I410c395a0168acbdaf89e616e3cb5e1312d190cb

7 months agomain/backtrace: binutils-2.34 fix.
Jaco Kroon [Wed, 1 Apr 2020 09:00:14 +0000 (11:00 +0200)]
main/backtrace: binutils-2.34 fix.

My tester missed this one previously, have confirmed a positive build
this time round.

Change-Id: Id06853375954a200f03f9a1b9c97fe0b10d31fbf

7 months agores_pjsip: Don't set endpoint to unavailable in all cases.
Joshua C. Colp [Thu, 26 Mar 2020 22:42:27 +0000 (19:42 -0300)]
res_pjsip: Don't set endpoint to unavailable in all cases.

When an AOR is modified endpoints are updated that reference
the AOR so they can start receiving updates and reflect the
correct state. If this is the case then we shouldn't change
the endpoint to be offline if it does not reference the AOR
but instead only when the endpoint is completely updated for
all its AORs.

  pjsip_options-aor.diff submitted by jhord (license 6978)

Change-Id: I3ee00023be2393113cd4e056599f23f3499ef164

7 months agotest_res_pjsip_session_caps: Create unit test
George Joseph [Wed, 25 Mar 2020 17:51:32 +0000 (11:51 -0600)]
test_res_pjsip_session_caps:  Create unit test

This unit test runs through combinations of...
* Local codecs
* Remote Codecs
* Codec Preference
* Incoming/Outgoing

A few new APIs were created to make it easier to test
the functionality but didn't result in any actual
functional change.


Change-Id: Ic8957c43e7ceeab0e9272af60ea53f056164f164

7 months agocodec_negotiation: Implement outgoing_call_offer_pref
George Joseph [Fri, 13 Mar 2020 19:40:46 +0000 (13:40 -0600)]
codec_negotiation: Implement outgoing_call_offer_pref

Based on this new endpoint setting, a joint list of preferred codecs
between those received from the Asterisk core (remote), and those
specified in the endpoint's "allow" parameter (local) is created and
is used to create the outgoing SDP offer.

* Add outgoing_call_offer_pref to pjsip_configuration (endpoint)

* Add "call_direction" to res_pjsip_session.

* Update pjsip_session_caps.c to make the functions more generic
  so they could be used for both incoming and outgoing.

* Update ast_sip_session_create_outgoing to create the
  pending_media_state->topology with the results of

* The endpoint "preferred_codec_only" option now automatically sets
  AST_SIP_CALL_CODEC_PREF_FIRST in incoming_call_offer_pref.

* A helper function ast_stream_get_format_count() was added to
  streams to return the current count of formats.


Change-Id: Id4ec0b4a906c2ae5885bf947f101c59059935437

7 months agores_stir_shaken: Implemented signing of JSON payload.
Ben Ford [Thu, 26 Mar 2020 18:34:47 +0000 (13:34 -0500)]
res_stir_shaken: Implemented signing of JSON payload.

This change provides functions that take in a JSON payload, verify that
the contents contain all the mandatory fields and required values (if
any), and signs the payload with the private key. Four fields are added
to the payload: x5u, attest, iat, and origid. As of now, these are just
placeholder values that will be set to actual values once the logic is
implemented for what to do when an actual payload is received, but the
functions to add these values have all been implemented and are ready to
use. Upon successful signing and the addition of those four values, a
ast_stir_shaken_payload is returned, containing other useful information
such as the algorithm and signature.

Change-Id: I74fa41c0640ab2a64a1a80110155bd7062f13393

7 months agochannel: write to a stream on multi-frame writes
Kevin Harwell [Tue, 31 Mar 2020 17:52:44 +0000 (12:52 -0500)]
channel: write to a stream on multi-frame writes

If a frame handling routine returns a list of frames (vs. a single frame)
those frames are never passed to a tech's write_stream handler even if one is
available. For instance, if a codec translation occurred and that codec
returned multiple frames then those particular frames were always only sent
to the tech's "write" handler. If that tech (pjsip for example) was stream
capable then those frames were essentially ignored. Thus resulting in bad

This patch makes it so the "write_stream" handler is appropriately called
for all cases, and for all frames if available.

ASTERISK-28795 #close

Change-Id: I868faea0b73a07ed5a32c2b05bb9cf4b586f739d

7 months agotest_utils: Avoid incorrect error message on load.
traud [Tue, 24 Mar 2020 11:43:37 +0000 (12:43 +0100)]
test_utils: Avoid incorrect error message on load.

In case of no OpenSSL headers, the module was built but did not load.


Change-Id: Ie007e84296bcf2bd4237f19d68ba5f932b84cd02

7 months agofunc_aes: Avoid incorrect error message on load.
traud [Mon, 23 Mar 2020 17:25:30 +0000 (18:25 +0100)]
func_aes: Avoid incorrect error message on load.

In case of no OpenSSL headers, the module func_aes was built but did not load.


Change-Id: I0b99b8468cbeb3b0eab23069cbd64062ef885ffc

7 months agodial.c: Removed dial string 80 character limitation
sungtae kim [Thu, 26 Mar 2020 22:18:17 +0000 (22:18 +0000)]
dial.c: Removed dial string 80 character limitation

The dial application had 80 characters of destination length
limitation. But this limitation causes unexpected dial string
cut if the dial string is long.

Removed unnecessary limited buffer to support longer dial


Change-Id: I72c8f0319a4b47e8180817a66a7e9bde063cb330

7 months agores_pjsip_session: implement processing of Content-Disposition
Torrey Searle [Thu, 19 Mar 2020 09:34:42 +0000 (10:34 +0100)]
res_pjsip_session: implement processing of Content-Disposition

RFC5621 requires any content type with a Content-Disposition
with handling=required to be rejected with a 415 response

ASTERISK-28782 #close

Change-Id: Iad969df75936730254b95c1a8bc3b48497070bb4

7 months agoacl: implement a centralized ACL output mechanism for HAs and ACLs.
Jaco Kroon [Wed, 18 Mar 2020 13:49:56 +0000 (15:49 +0200)]
acl: implement a centralized ACL output mechanism for HAs and ACLs.

named_acl.c (which is really a named_ha) now uses ast_ha_output.

I've also updated main/manager.c to output the actual ACL on "manager
show user <username>" if one is set.  If this works then we can add
similar to other modules as required.

Change-Id: I0ec9876a90dddd379c80ec078d48e3ee6991eb0f

7 months agochan_sip: Send 403 when ACL fails.
Joshua C. Colp [Thu, 26 Mar 2020 13:49:54 +0000 (10:49 -0300)]
chan_sip: Send 403 when ACL fails.

Change-Id: I0910c79196f2b7c7e5ad6f1db95e83800ac737a2

7 months agoCHANGES: Change md file extension to txt.
Joshua C. Colp [Thu, 26 Mar 2020 16:42:01 +0000 (13:42 -0300)]
CHANGES: Change md file extension to txt.

Change-Id: I168e2d3a65d444fb0961bd228257441fe718f6a7
(cherry picked from commit c9cd68126152bae26d42f5b9ce8811ddf1eda4d8)

7 months agores_pjsip_session: Apply intention behind requested formats.
Joshua C. Colp [Mon, 23 Mar 2020 10:49:41 +0000 (07:49 -0300)]
res_pjsip_session: Apply intention behind requested formats.

When an outgoing channel is created a list of formats may
optionally be provided which is used as a request that the
formats be used if possible. If an endpoint is not configured
for any of the formats we ignore this request and use what is
configured. This has the side effect of also including other
stream types (such as video) that were not present in the
requested formats.

This change makes it so that the intention of the request is
preserved - that is if only an audio format is requested then
even if there is no joint audio format between the request and
the configuration we will still only place an audio stream in
the outgoing call.


Change-Id: Ia54c0c63e94aca176169b9bae4bb8a8380ea245f

7 months agores_rtp_asterisk: Ensure sufficient space for worst case NACK.
Joshua C. Colp [Wed, 25 Mar 2020 09:38:53 +0000 (06:38 -0300)]
res_rtp_asterisk: Ensure sufficient space for worst case NACK.


Change-Id: I10df52f98b19ed62575f25dab36e82d136dccd99

7 months agoast_coredumper: add Asterisk information dump
Kevin Harwell [Tue, 17 Mar 2020 20:54:25 +0000 (15:54 -0500)]
ast_coredumper: add Asterisk information dump

This patch makes it so ast_coredumper now outputs the following information to
a *-info.txt file when processing a core file:

  asterisk version and "built by" string
  system start, and last reloaded date/time
  taskprocessor list
  equivalent of "bridge show all"
  equivalent of "core show channels verbose"

Also a slight modification was made when trying to obtain the pid(s) of a
running Asterisk. If it fails to retrieve any it now reports an error.

Change-Id: I54f35c19ab69b8f8dc78cc933c3fb7c99cef346b

7 months agonetsock2: compile fixes.
Jaco Kroon [Fri, 20 Mar 2020 14:12:05 +0000 (16:12 +0200)]
netsock2: compile fixes.

This fixes ast_addressfamily_to_sockaddrsize to reference the
provided argument, and ast_sockaddr_from_sockaddr to not use the name of
a structure as argument.

Change-Id: Ibf5db469c47c3b4214edf8456326086174e8edd7

8 months agores_stir_shaken: Initial commit and reading private key.
Ben Ford [Mon, 23 Mar 2020 20:00:09 +0000 (15:00 -0500)]
res_stir_shaken: Initial commit and reading private key.

This commit sets up some of the initial framework for the module and
adds a way to read the private key from the specified file, which will
then be appended to the certificate object. This works fine for now, but
eventually some other structure will likely need to be used to store all
this information. Similarly, the caller_id_number is specified on the
certificate config object, but in the end we will want that information
to be tied to the certificate itself and read it from there.

A method has been added that will retrieve the private key associated
with the caller_id_number passed in. Tab completion for certificates and
stores has also been added.

Change-Id: Ic4bc1416fab5d6afe15a8e2d32f7ddd4e023295f

8 months agodahdiras: Only set plugin to pppd if we're running as root.
Jaco Kroon [Wed, 18 Mar 2020 09:21:21 +0000 (11:21 +0200)]
dahdiras: Only set plugin to pppd if we're running as root.

Users of this should set plugin in their options file.


Change-Id: I6d01ad0a10e9fea477876d0941c3f38aac357e91

8 months agodundi: fix NULL dereference.
Jaco Kroon [Wed, 18 Mar 2020 09:38:30 +0000 (11:38 +0200)]
dundi:  fix NULL dereference.

If a negative (error) return is received from dundi_lookup_internal,
this is not handled correctly when assigning the result to the buffer.
As such, use a signed integer in the assignment and do a proper


Change-Id: I5214ebb6491e2bd14f90c7d3ce229da86888f739

8 months agores_pjsip_sdp_rtp: Only do hold/unhold on default audio stream.
Joshua C. Colp [Thu, 19 Mar 2020 18:34:02 +0000 (15:34 -0300)]
res_pjsip_sdp_rtp: Only do hold/unhold on default audio stream.

When examining a stream to determine hold/unhold information we
only care about the default audio stream. Other streams aren't
used for hold/unhold.


Change-Id: I7a1f10f07822c4aee1f98a38b9628849b578afe4

8 months agores_pjsip_session: Fixed wrong session termination
Sungtae Kim [Fri, 14 Feb 2020 08:45:33 +0000 (08:45 +0000)]
res_pjsip_session: Fixed wrong session termination

When the Asterisk receives 200 OK with invalid SDP,
the Asterisk/PJPROJECT terminating the session.
But if the channel was in the Bridge, Asterisk tries send
the Re-Invite before terminating the session.
And when the Asterisk sending the Re-Invite, it doesn't check
the SDP is NULL or not. This crashes the Asterisk.

Fixed it to close the session correctly if the UAS sends the
200 OK with wrong SDP.


Change-Id: Ifa864e0e125b1a7ed2f3abd4164187e1dddc56da

8 months agobuild: enable building with uClibc
Jaco Kroon [Wed, 18 Mar 2020 09:49:39 +0000 (11:49 +0200)]
build: enable building with uClibc

This patch has been included in Gentoo distribution for at least since
asterisk 1.8, but there are references in the logs going back as far as
1.0.0 - not sure if this is still required in any way, it does apply,
and it doesn't (as far as we can determine) cause build failures.

Change-Id: I46d8845e30200205e80580680bf060aa3012ba54

8 months agobuild: search from newest to oldest for gmime.
Jaco Kroon [Wed, 18 Mar 2020 09:43:21 +0000 (11:43 +0200)]
build: search from newest to oldest for gmime.

We (Gentoo distribution) reckon that in the case of multiple versions of
gmime installed we should prefer the newest one.

Change-Id: Idf7be613230232eb1d573d93c4a5a8297f4ecd2d

8 months agores_pjsip_session: Don't restrict non-audio default streams to sendrecv.
Joshua C. Colp [Thu, 19 Mar 2020 13:48:39 +0000 (10:48 -0300)]
res_pjsip_session: Don't restrict non-audio default streams to sendrecv.

The state of the default audio stream is used for hold/unhold so we
restrict it to sendrecv as the core does not handle when it changes as
a result of hold/unhold.

This restriction does not apply to other media types though so we now
only restrict it to audio. This allows the other default streams to
store their state at all values, and not just sendrecv and removed.


Change-Id: I139740f38cea7f7d92a876ec2631ef50681f6625

8 months agochan_psip, res_pjsip_sdp_rtp: ignore rtptimeout if direct-media is active
Michael Neuhauser [Fri, 6 Mar 2020 16:50:00 +0000 (17:50 +0100)]
chan_psip, res_pjsip_sdp_rtp: ignore rtptimeout if direct-media is active

Do not hang up a PJSIP channel on RTP timeout if that channel is in
a direct-media bridge. Also reset the time of the last received RTP packet when
direct-media ends (wait full rtp_timeout period before checking first time after
audio came back to Asterisk).

Reported-by: Michael Neuhauser

Change-Id: I8b62012be7685849e8fb2b1c5dd39d35313ca2d1

8 months agores_rtp_asterisk: implement ACL mechanism for ICE and STUN addresses.
Jaco Kroon [Wed, 27 Nov 2019 13:54:39 +0000 (15:54 +0200)]
res_rtp_asterisk: implement ACL mechanism for ICE and STUN addresses.

A pure blacklist is not good enough, we need a whitelist mechanism as
well, and the simplest way to do that is to re-use existing ACL

This makes it simpler to blacklist say an entire block (/24) except a
smaller block (eg, a /29 or even a /32).  Normally you'd need to
recursively split the block, so if you want to blacklist a /24 except
for a /29 you'd end up with a blacklit for a /25, /26, /27 and /28.  I
feel that having an ACL instead of a blacklist only is clearer.

Change-Id: Id57a8df51fcfd3bd85ea67c489c85c6c3ecd7b30
Signed-off-by: Jaco Kroon <>

8 months agoUpdate main/backtrace.c to deal with changes in binutils 2.34.
Jaco Kroon [Mon, 16 Mar 2020 10:11:11 +0000 (12:11 +0200)]
Update main/backtrace.c to deal with changes in binutils 2.34.

binutils 2.34 merged this commit:;a=commitdiff;\

Which effectively does things like:

-#define bfd_section_size(bfd, ptr) ((ptr)->size)
-#define bfd_get_section_size(ptr) ((ptr)->size)

+#define bfd_section_size(sec) ((sec)->size)

So in order to remain backwards compatible we need to detect this API
change, and adjust accordingly.  The simplest is to notice that the
bfd_get_section_size and bfd_get_section_vma MACROs are no longer
defined, and define then onto the new API.  The alternative is to litter
the code with a number of #ifdef #else #endif splatters right through
the code.

Change-Id: I3efe0f8e8f3e338d16fcbc2b26a505367b6e172f

8 months agofunc_odbc.conf.sample: Clarify sample documentation
Sean Bright [Sun, 15 Mar 2020 14:07:03 +0000 (10:07 -0400)]
func_odbc.conf.sample: Clarify sample documentation

ASTERISK-20325 #close

Change-Id: I06cb9b467b0fd06c8af2a5aee049f872c09cc4b6

8 months agochan_vpb: Fix 'catching polymorphic type ... by value' error
Sean Bright [Fri, 13 Mar 2020 18:43:05 +0000 (14:43 -0400)]
chan_vpb: Fix 'catching polymorphic type ... by value' error

Fixes the following compile error: error: catching polymorphic type
        ‘class std::exception’ by value

Change-Id: Ic87bc357d72427d77626735c83200fd278a7a649

8 months agodns_txt: Add TXT record parsing support
Sean Bright [Tue, 10 Mar 2020 00:07:10 +0000 (20:07 -0400)]
dns_txt: Add TXT record parsing support

Change-Id: Ie0eca23b8e6f4c7d9846b6013d79099314d90ef5

8 months agoaudiohook: Don't allow audiohooks to attach to hung up channels.
Joshua C. Colp [Thu, 12 Mar 2020 14:22:06 +0000 (11:22 -0300)]
audiohook: Don't allow audiohooks to attach to hung up channels.

Given a scenario where MixMonitor was initiated over AMI it
was possible for the channel and MixMonitor thread to remain
alive past hang up of the channel. This scenario required
the AMI initiated MixMonitor to retrieve the channel, a
hangup to occur on the channel in another thread, and then
for MixMonitor to actually start. If this occurred the
MixMonitor thread would remain alive indefinitely and
the channel reference would remain.

This change ensures that audiohooks are never able to
be attached to channels that have been hung up. An
additional fix has also been done in app_mixmonitor to
properly release the channel reference if this occurs.


Change-Id: I8044c06daa06f0f16607788c596f55623be26f58

8 months agoCI: Create generic jenkinsfile
George Joseph [Wed, 4 Mar 2020 21:45:40 +0000 (14:45 -0700)]
CI: Create generic jenkinsfile

This is a generic jenkinsfile to build Asterisk and optionally
perform one or more of the following:
 * Publish the API docs to the wiki
 * Run the Unit tests
 * Run Testsuite Tests

This job can be triggered manually from Jenkins or be triggered
automatically on a schedule based on a cron string.

Change-Id: Id9d22a778a1916b666e0e700af2b9f1bacda0852

8 months agores_rtp_asterisk: Send correct sender SSRC when p2p bridge in use
Torrey Searle [Fri, 6 Mar 2020 16:13:34 +0000 (17:13 +0100)]
res_rtp_asterisk: Send correct sender SSRC when p2p bridge in use

bridge_p2p_rtp_write will forward rtp to the bridged rtp instance
without modifying the ssrc.  However, it is not updating the SSRC
in the bridged rtp.  Thus, when SSRC packets are generated, they
have the correct SSRC for the sender.

ASTERISK-28773 #close

Change-Id: I39f923bde28ebb4f0fddc926b92494aed294a478

8 months agoMerge "res_pjsip_sdp_rtp: Don't wait for ICE if not negotiated"
George Joseph [Tue, 10 Mar 2020 18:37:28 +0000 (13:37 -0500)]
Merge "res_pjsip_sdp_rtp: Don't wait for ICE if not negotiated"

8 months agoMerge "chan_pjsip: Check audio frame when remote SSRC changes."
George Joseph [Tue, 10 Mar 2020 17:00:48 +0000 (12:00 -0500)]
Merge "chan_pjsip: Check audio frame when remote SSRC changes."

8 months agoMerge "codec negotiation: add incoming_call_offer_prefs option"
George Joseph [Mon, 9 Mar 2020 20:07:09 +0000 (15:07 -0500)]
Merge "codec negotiation: add incoming_call_offer_prefs option"

8 months agoMerge "enum.c: Make ast_get_txt() actually do something."
George Joseph [Mon, 9 Mar 2020 15:15:49 +0000 (10:15 -0500)]
Merge "enum.c: Make ast_get_txt() actually do something."

8 months agoMerge "enum.c: Add support for regular expression flag in NAPTR record"
George Joseph [Mon, 9 Mar 2020 15:02:45 +0000 (10:02 -0500)]
Merge "enum.c: Add support for regular expression flag in NAPTR record"

8 months agoMerge "res_rtp_asterisk: Add 'rtp show settings' cli command"
Joshua Colp [Mon, 9 Mar 2020 13:57:09 +0000 (08:57 -0500)]
Merge "res_rtp_asterisk: Add 'rtp show settings' cli command"

8 months agores_pjsip_sdp_rtp: Don't wait for ICE if not negotiated
Torrey Searle [Thu, 5 Mar 2020 09:08:54 +0000 (10:08 +0100)]
res_pjsip_sdp_rtp: Don't wait for ICE if not negotiated

If ICE support is enabled but not negotiated, the rtp->ice structure is
not being destroyed. This leads to Asterisk waiting for ICE to complete
instead of immediately starting the DTLS handshake, resulting in the
call leg having no RTP.

ASTERISK-28769 #close

Change-Id: I17c137546dc9ecfb9583c24dcf4c2ced8bbd7a27

8 months agochan_pjsip: Check audio frame when remote SSRC changes.
Paulo Vicentini [Wed, 26 Feb 2020 00:30:04 +0000 (01:30 +0100)]
chan_pjsip: Check audio frame when remote SSRC changes.

If the SSRC of a received RTP packet differed from the previous SSRC
an SSRC change control frame would be queued ahead of the media
frame. In the case of audio this would result in the format of the
audio frame not being checked, and if it differed or was not allowed
then it could cause the call to drop due to failure to set up a
translation path.

The chan_pjsip module will now no longer assume the first frame
will be the audio frame and instead goes through the complete list
to find it.


Change-Id: I6d854cc523f343e299a615636fc65bdbd5f809ec

8 months agoenum.c: Add support for regular expression flag in NAPTR record
Sean Bright [Fri, 6 Mar 2020 20:59:37 +0000 (15:59 -0500)]
enum.c: Add support for regular expression flag in NAPTR record

A regular expression in a NAPTR response record can have a trailing
'i' flag to indicate that the expression should be evaluated in a
case-insensitive way. We were not checking for that flag which caused
the record parsing to fail on otherwise valid input.

Although this change will initially go into Asterisk 13, 16, and 17,
it is my intention to replace the majority of this code in 16 and up -
including this fix - by changing enum.c to consume the new DNS API
which duplicates most of this logic already. Asterisk 13 doesn't have
the DNS API, so this fix will be as good as it gets.

ASTERISK-26711 #close
Reported by: Vitold

Change-Id: I33943a5b3e7539c6dca3a5079982ee15a08186f0

8 months agoindications.conf.sample: Add indication tones for Indonesia
Jared Smith [Fri, 6 Mar 2020 12:10:11 +0000 (12:10 +0000)]
indications.conf.sample: Add indication tones for Indonesia

These tones come from


Change-Id: I48e2285f1e5bb29b3335f762006f66c423d0fcb8

8 months agoMerge "res_pjsip_refer: ensure refer progress is still sent after Proceeding()"
Kevin Harwell [Thu, 5 Mar 2020 17:03:34 +0000 (11:03 -0600)]
Merge "res_pjsip_refer: ensure refer progress is still sent after Proceeding()"

8 months agores_rtp_asterisk: Add 'rtp show settings' cli command
Rodrigo Ramírez Norambuena [Tue, 3 Mar 2020 14:42:16 +0000 (14:42 +0000)]
res_rtp_asterisk: Add 'rtp show settings' cli command

This change introduce a CLI command for the RTP to display the general

In the first step add the follow fields of the configurations:
  - rtpstart
  - rtpend
  - dtmftimeout
  - rtpchecksum
  - strictrtp
  - learning_min_sequential
  - icesupport

Change-Id: Ibe5450898e2c3e1ed68c10993aa1ac6bf09b821f

8 months agoenum.c: Make ast_get_txt() actually do something.
Sean Bright [Wed, 4 Mar 2020 22:53:57 +0000 (17:53 -0500)]
enum.c: Make ast_get_txt() actually do something.

The ast_get_txt() API function (and by extension, the TXTCIDNAME
dialplan function) were broken in
65b8381550a9f46fdce84de79960073e9d51b05d such that we would never
actually make a DNS TXT query as described.

This patch restores the documented behavior.

ASTERISK-19460 #close
Reported by: George Joseph

Change-Id: I1b19aea711488cb1ecd63843cddce05010e39376

8 months agoMerge "check_expr2: fix cross-compile/hardening issues"
Joshua Colp [Wed, 4 Mar 2020 12:10:36 +0000 (06:10 -0600)]
Merge "check_expr2: fix cross-compile/hardening issues"

8 months agoMerge "message & stasis/messaging: make text message variables work in ARI"
Joshua Colp [Wed, 4 Mar 2020 12:10:09 +0000 (06:10 -0600)]
Merge "message & stasis/messaging: make text message variables work in ARI"

8 months agores_pjsip_refer: ensure refer progress is still sent after Proceeding()
lvl [Tue, 3 Mar 2020 16:57:27 +0000 (16:57 +0000)]
res_pjsip_refer: ensure refer progress is still sent after Proceeding()

ASTERISK-28766 #close

Change-Id: I5ce2210062f9325db762edbf6e46075079bb2cd1

8 months agocodec negotiation: add incoming_call_offer_prefs option
Kevin Harwell [Mon, 24 Feb 2020 18:47:46 +0000 (12:47 -0600)]
codec negotiation: add incoming_call_offer_prefs option

Add a new option, incoming_call_offer_pref, to res_pjsip endpoints that
specifies the preferred order of codecs after receiving an offer.

This patch does the following:

  Adds a new enumeration, ast_sip_call_codec_pref, used by the the new
configuration option that's added to the endpoint media structure.

  Adds a new ast_sip_session_caps structure that's set for each session media

  Creates a new file, res_pjsip_session_caps that "implements" the new
structure and option, and is compiled into the res_pjsip_session library.

ASTERISK-28756 #close

Change-Id: I35e7a2a0c236cfb6bd9cdf89539f57a1ffefc76f

8 months agores_rtp_asterisk: Improve video performance in certain networks.
Joshua C. Colp [Thu, 20 Feb 2020 17:33:42 +0000 (17:33 +0000)]
res_rtp_asterisk: Improve video performance in certain networks.

The receive buffer will now grow if we end up flushing the
receive queue after not receiving the expected packet in time.
This is done in hopes that if this is encountered again the
extra buffer size will allow more time to pass and any missing
packets to be received.

The send buffer will now grow if we are asked for packets and
can't find them. This is done in hopes that the packets are
from the past and have simply been expired. If so then in
the future with the extra buffer space the packets should be

Sequence number cycling has been handled so that the
correct sequence number is calculated and used in
various places, including for sorting packets and
for determining if a packet is old or not.

NACK sending is now more aggressive. If a substantial number
of missing sequence numbers are added a NACK will be sent
immediately. Afterwards once the receive buffer reaches 25%
a single NACK is sent. If the buffer continues to grow and
reaches 50% or greater a NACK will be sent for each received
future packet to aggressively ask the remote endpoint to


Change-Id: I97633dfa8a09a7889cef815b2be369f3f0314b41

8 months agoMerge "res/res_pjsip_sdp_rtp: Fix MOH transitions"
Kevin Harwell [Mon, 2 Mar 2020 20:17:45 +0000 (14:17 -0600)]
Merge "res/res_pjsip_sdp_rtp: Fix MOH transitions"

8 months agomessage & stasis/messaging: make text message variables work in ARI
Kevin Harwell [Fri, 28 Feb 2020 18:55:31 +0000 (12:55 -0600)]
message & stasis/messaging: make text message variables work in ARI

When a text message was received any associated variable was not written to
the ARI TextMessageReceived event. This occurred because Asterisk only wrote
out "send" variables. However, even those "send" variables would fail ARI
validation due to a TextMessageVariable formatting bug.

Since it seems the TextMessageReceived event has never been able to include
actual variables it was decided to remove the TextMessageVariable object type
from ARI, and simply return a JSON object of key/value pairs for variables.
This aligns more with how the ARI sendMessage handles variables, and other
places in ARI.

ASTERISK-28755 #close

Change-Id: Ia6051c01a53b30cf7edef84c27df4ed4479b8b6f

8 months agoMerge "addons/res_config_mysql: silense warnings about printf format errors."
Kevin Harwell [Thu, 27 Feb 2020 20:45:00 +0000 (14:45 -0600)]
Merge "addons/res_config_mysql: silense warnings about printf format errors."

8 months agoMerge "app_queue: Refactor odd placement of if's around say_position"
Kevin Harwell [Thu, 27 Feb 2020 20:42:44 +0000 (14:42 -0600)]
Merge "app_queue: Refactor odd placement of if's around say_position"

8 months agoMerge "say: Remove unused "plural" option from main/say"
Kevin Harwell [Thu, 27 Feb 2020 19:43:19 +0000 (13:43 -0600)]
Merge "say: Remove unused "plural" option from main/say"

8 months agoMerge "app_mixmonitor: Turn on synchronization by default"
Kevin Harwell [Thu, 27 Feb 2020 19:17:19 +0000 (13:17 -0600)]
Merge "app_mixmonitor: Turn on synchronization by default"

8 months agoMerge "format_cap: make function parameters 'const'"
Kevin Harwell [Thu, 27 Feb 2020 19:16:51 +0000 (13:16 -0600)]
Merge "format_cap: make function parameters 'const'"

8 months agoMerge "pjsip: Update ACLs on named ACL changes."
Kevin Harwell [Thu, 27 Feb 2020 18:53:48 +0000 (12:53 -0600)]
Merge "pjsip: Update ACLs on named ACL changes."

8 months agocheck_expr2: fix cross-compile/hardening issues
Sebastian Kemper [Sun, 12 Jan 2020 11:37:46 +0000 (12:37 +0100)]
check_expr2: fix cross-compile/hardening issues

When building check_expr2 with ASLR PIE hardening enabled the linker
fails. This is resolved by adding the regular compiler flags when
building the object files from ast_expr2f.c and ast_expr2.c.

Note: The STANDALONE define is removed because it is already defined in
_ASTCFLAGS. YY_NO_INPUT is defined so that the compile survives

Also, a Makefile variable "CROSS_COMPILING" is added so that the
build system doesn't try to run check_expr2 when cross-compiling,
because that will fail the build as will.

ASTERISK-28685 #close

Signed-off-by: Sebastian Kemper <>
Change-Id: If435b7db9f9ad8266245bda51c81c220f9658915

8 months agores/res_pjsip_sdp_rtp: Fix MOH transitions
Torrey Searle [Mon, 24 Feb 2020 15:00:08 +0000 (16:00 +0100)]
res/res_pjsip_sdp_rtp: Fix MOH transitions

Update the state of remote_hold immediately on receipt of remote
SDP so that the information is available when building the SDP

ASTERISK-28754 #close

Change-Id: I7026032a807e9c95081cb8f060400b05deb4836f

8 months agoapp_queue: Refactor odd placement of if's around say_position
Walter Doekes [Tue, 25 Feb 2020 09:51:29 +0000 (10:51 +0100)]
app_queue: Refactor odd placement of if's around say_position

Change-Id: Icba97905e331812f129e5966e91a59b104c7a748

8 months agoformat_cap: make function parameters 'const'
Kevin Harwell [Mon, 24 Feb 2020 18:44:43 +0000 (12:44 -0600)]
format_cap: make function parameters 'const'

There were a couple places where the format cap function parameter was not
'const' when it should have been. This patch makes them 'const'.

Change-Id: Ife753fb16a962d842a6b44f45363a61a66bfdb2e

9 months agosay: Remove unused "plural" option from main/say
Walter Doekes [Mon, 24 Feb 2020 14:39:51 +0000 (15:39 +0100)]
say: Remove unused "plural" option from main/say

There are exceptions for plural objects, but they are detected using the
supplied NUMBER, not using an extra option.

Change-Id: I95d1d1b2796b1aba92048a2dbae8a3856ed8a113

9 months agoaddons/res_config_mysql: silense warnings about printf format errors.
Jaco Kroon [Thu, 20 Feb 2020 12:52:06 +0000 (14:52 +0200)]
addons/res_config_mysql: silense warnings about printf format errors.

Warnings without this:

res_config_mysql.c: In function 'update2_mysql':
res_config_mysql.c:741:15: warning: format '%llu' expects argument of type
    'long long unsigned int', but argument 6 has type 'my_ulonglong'
    {aka 'long unsigned int'} [-Wformat=]
ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n",
    numrows, tablename);

(reformatted for readability within line-wrap)

Change-Id: I2af4d419a37c1a7eeee750cf9ae4a9a2b3a37fd3

9 months agoMerge "tcptls.c: Log more informative OpenSSL errors"
George Joseph [Fri, 21 Feb 2020 15:01:58 +0000 (09:01 -0600)]
Merge "tcptls.c: Log more informative OpenSSL errors"