]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
3 years agoUpdate CHANGES and UPGRADE.txt for 16.8-cert14 certified/16.8
Asterisk Development Team [Thu, 14 Apr 2022 20:53:19 +0000 (15:53 -0500)] 
Update CHANGES and UPGRADE.txt for 16.8-cert14

3 years agofunc_odbc: Add SQL_ESC_BACKSLASHES dialplan function.
Joshua C. Colp [Thu, 10 Feb 2022 12:02:23 +0000 (08:02 -0400)] 
func_odbc: Add SQL_ESC_BACKSLASHES dialplan function.

Some databases depending on their configuration using backslashes
for escaping. When combined with the use of ' this can result in
a broken func_odbc query.

This change adds a SQL_ESC_BACKSLASHES dialplan function which can
be used to escape the backslashes.

This is done as a dialplan function instead of being always done
as some databases do not require this, and always doing it would
result in incorrect data being put into the database.

ASTERISK-29838

Change-Id: I152bf34899b96ddb09cca3e767254d8d78f0c83d

3 years agoAST-2022-005: pjproject - undefined behavior after freeing a dialog set
Kevin Harwell [Thu, 3 Mar 2022 22:42:55 +0000 (16:42 -0600)] 
AST-2022-005: pjproject - undefined behavior after freeing a dialog set

ASTERISK-29945 #close

Change-Id: Ia8ce6d82b115c82c1138747c72a0adcaa42b718c
(cherry picked from commit 7f76dce133412a8a3ce53e73921c43d5b5d2dd18)

3 years agoAST-2022-006: pjproject - unconstrained malformed multipart SIP message
Kevin Harwell [Thu, 3 Mar 2022 22:44:20 +0000 (16:44 -0600)] 
AST-2022-006: pjproject - unconstrained malformed multipart SIP message

ASTERISK-29945 #close

Change-Id: Ic58957afc453195d53c2bd25c905df3d91d1abe6

3 years agoAST-2022-004: pjproject - possible integer underflow on STUN message
Kevin Harwell [Thu, 3 Mar 2022 22:41:16 +0000 (16:41 -0600)] 
AST-2022-004: pjproject - possible integer underflow on STUN message

ASTERISK-29945 #close

Change-Id: I721cd254e4f8aa6d3a97a37529cca53519694c54

3 years agopbx.c: Don't remove dashes from hints on reload.
Sean Bright [Mon, 8 Nov 2021 15:01:09 +0000 (10:01 -0500)] 
pbx.c: Don't remove dashes from hints on reload.

When reloading dialplan, hints created dynamically would lose any dash
characters. Now we ignore those dashes if we are dealing with a hint
during a reload.

ASTERISK-28040 #close

Change-Id: I95e48f5a268efa3c6840ab69798525d3dce91636

3 years agoBuildSystem: Check for alternate openssl packages
George Joseph [Tue, 19 Oct 2021 16:35:26 +0000 (10:35 -0600)] 
BuildSystem: Check for alternate openssl packages

OpenSSL is one of those packages that often have alternatives
with later versions.  For instance, CentOS/EL 7 has an
openssl package at version 1.0.2 but there's an openssl11
package from the epel repository that has 1.1.1.  This gets
installed to /usr/include/openssl11 and /usr/lib64/openssl11.
Unfortunately, the existing --with-ssl and --with-crypto
./configure options expect to point to a source tree and
don't work in this situation.  Also unfortunately, the
checks in ./configure don't use pkg-config.

In order to make this work with the existing situation, you'd
have to run...
./configure --with-ssl=/usr/lib64/openssl11 \
    --with-crypto=/usr/lib64/openssl11 \
    CFLAGS=-I/usr/include/openssl11

BUT...  those options don't get passed down to bundled pjproject
so when you run make, you have to include the CFLAGS again
which is a big pain.

Oh...  To make matters worse, although you can specify
PJPROJECT_CONFIGURE_OPTS on the ./configure command line,
they don't get saved so if you do a make clean, which will
force a re-configure of bundled pjproject, those options
don't get used.

So...

* In configure.ac... Since pkg-config is installed by install_prereq
  anyway, we now use it to check for the system openssl >= 1.1.0.
  If that works, great.  If not, we check for the openssl11
  package. If that works, great.  If not, we fall back to just
  checking for any openssl.  If pkg-config isn't installed for some
  reason, or --with-ssl=<dir> or --with-crypto=<dir> were specified
  on the ./configure command line, we fall back to the existing
  logic that uses AST_EXT_LIB_CHECK().

* The whole OpenSSL check process has been moved up before
  THIRD_PARTY_CONFIGURE(), which does the initial pjproject
  bundled configure, is run.  This way the results of the above
  checks, which may result in new include or library directories,
  is included.

* Although not strictly needed for openssl, We now save the value of
  PJPROJECT_CONFIGURE_OPTS in the makeopts file so it can be used
  again if a re-configure is triggered.

ASTERISK-29693

Change-Id: I341ab7603e6b156aa15a66f43675ac5029d5fbde

3 years agores_pjsip_nat: Don't rewrite Contact on REGISTER responses.
Joshua C. Colp [Wed, 24 Feb 2021 13:04:09 +0000 (09:04 -0400)] 
res_pjsip_nat: Don't rewrite Contact on REGISTER responses.

When sending a SIP response to an incoming REGISTER request
we don't want to change the Contact header as it will
contain the Contacts registered to the AOR and not our own
Contact URI.

ASTERISK-29235

Change-Id: I35a0723545281dd01fcd5cae497baab58720478c
(cherry picked from commit d65041ebea0d54b5306419866a08e6e171fb444d)

4 years agoUpdate CHANGES and UPGRADE.txt for certified/16.8-cert10
Asterisk Development Team [Thu, 22 Jul 2021 22:00:17 +0000 (17:00 -0500)] 
Update CHANGES and UPGRADE.txt for certified/16.8-cert10

4 years agoAST-2021-008 - chan_iax2: remote crash on unsupported media format
Kevin Harwell [Mon, 10 May 2021 22:59:00 +0000 (17:59 -0500)] 
AST-2021-008 - chan_iax2: remote crash on unsupported media format

If chan_iax2 received a packet with an unsupported media format, for
example vp9, then it would set the frame's format to NULL. This could
then result in a crash later when an attempt was made to access the
format.

This patch makes it so chan_iax2 now ignores/drops frames received
with unsupported media format types.

ASTERISK-29392 #close

Change-Id: Ifa869a90dafe33eed8fd9463574fe6f1c0ad3eb1

4 years agoAST-2021-009 - pjproject-bundled: Avoid crash during handshake for TLS
Kevin Harwell [Wed, 16 Jun 2021 16:27:07 +0000 (11:27 -0500)] 
AST-2021-009 - pjproject-bundled: Avoid crash during handshake for TLS

If an SSL socket parent/listener was destroyed during the handshake,
depending on timing, it was possible for the handling callback to
attempt access of it after the fact thus causing a crash.

ASTERISK-29415 #close

Change-Id: I105dacdcd130ea7fdd4cf2010ccf35b5eaf1432d

4 years agoUpdate for certified/16.8-cert9 certified/16.8-cert9
Asterisk Development Team [Tue, 22 Jun 2021 15:25:11 +0000 (10:25 -0500)] 
Update for certified/16.8-cert9

4 years agocore: Don't play silence for Busy() and Congestion() applications.
Joshua C. Colp [Mon, 21 Jun 2021 11:31:41 +0000 (08:31 -0300)] 
core: Don't play silence for Busy() and Congestion() applications.

When using the Busy() and Congestion() applications the
function ast_safe_sleep is used by wait_for_hangup to safely
wait on the channel. This function may send silence if Asterisk
is configured to do so using the transmit_silence option.

In a scenario where an answered channel dials a Local channel
either directly or through call forwarding and the Busy()
or Congestion() dialplan applications were executed with the
transmit_silence option enabled the busy or congestion
tone would not be heard.

This is because inband generation of tones (such as busy
and congestion) is stopped when other audio is sent to
the channel they are being played to. In the given
scenario the transmit_silence option would result in
silence being sent to the channel, thus stopping the
inband generation.

This change adds a variant of ast_safe_sleep which can be
used when silence should not be played to the channel. The
wait_for_hangup function has been updated to use this
resulting in the tones being generated as expected.

ASTERISK-29485

Change-Id: I066bfc987a3ad6f0ccc88e0af4cd63f6a4729133

4 years agoUpdate for certified/16.8-cert8 certified/16.8-cert8
Asterisk Development Team [Thu, 25 Mar 2021 17:43:52 +0000 (12:43 -0500)] 
Update for certified/16.8-cert8

4 years agoUpdate CHANGES and UPGRADE.txt for certified/16.8-cert6
Asterisk Development Team [Thu, 25 Mar 2021 17:40:46 +0000 (12:40 -0500)] 
Update CHANGES and UPGRADE.txt for certified/16.8-cert6

4 years agores_pjsip_session: Make reschedule_reinvite check for NULL topologies
George Joseph [Thu, 18 Mar 2021 16:14:34 +0000 (10:14 -0600)] 
res_pjsip_session: Make reschedule_reinvite check for NULL topologies

When the check for equal topologies was added to reschedule_reinvite()
it was assumed that both the pending and active media states would
actually have non-NULL topologies.  We since discovered this isn't
the case.

We now only test for equal topologies if both media states have
non-NULL topologies.  The logic had to be rearranged a bit to make
sure that we cloned the media states if their topologies were
non-NULL but weren't equal.

ASTERISK-29215

Change-Id: I61313cca7fc571144338aac826091791b87b6e17

4 years agores_rtp_asterisk: Force resync on SSRC change.
Joshua C. Colp [Wed, 17 Mar 2021 15:28:45 +0000 (12:28 -0300)] 
res_rtp_asterisk: Force resync on SSRC change.

When an SSRC change occurs the timestamps are likely
to change as well. As a result we need to reset the
timestamp mapping done in the calc_rxstamp function
so that they map properly from timestamp to real
time.

This previously occurred but due to packet
retransmission support the explicit setting
of the marker bit was not effective.

ASTERISK-29352

Change-Id: I2d4c8f93ea24abc1030196706de2d70facf05a5a

4 years agochannel: Fix crash in suppress API.
Joshua C. Colp [Wed, 10 Mar 2021 00:35:08 +0000 (20:35 -0400)] 
channel: Fix crash in suppress API.

There exists an inconsistency with framehook usage
such that it is only on reads that the frame should
be freed, not on writes as well.

ASTERISK-29071

Change-Id: I5ef918ebe4debac8a469e8d43bf9d6b673e8e472

4 years agoasterisk: Update copyright.
Joshua C. Colp [Wed, 3 Mar 2021 18:44:22 +0000 (14:44 -0400)] 
asterisk: Update copyright.

ASTERISK-29326

Change-Id: Ia95dbfb66e2d11ac4d1228444283bb2e4d77396a

4 years agoUpdate for certified/16.8-cert7 certified/16.8-cert7
Asterisk Development Team [Thu, 4 Mar 2021 16:49:33 +0000 (11:49 -0500)] 
Update for certified/16.8-cert7

4 years agoAST-2021-006 - res_pjsip_t38.c: Check for session_media on reinvite.
Ben Ford [Thu, 25 Feb 2021 19:50:47 +0000 (13:50 -0600)] 
AST-2021-006 - res_pjsip_t38.c: Check for session_media on reinvite.

When Asterisk sends a reinvite negotiating T38 faxing, it's possible a
crash can occur if the response contains a m=image and zero port. The
reinvite callback code now checks session_media to see if it is null or
not before trying to access the udptl variable on it.

ASTERISK-29305

Change-Id: I1dfc51c5fa586e38579ede4bc228edee213ccaa9

4 years agochannel: Fix memory leak in suppress API.
Joshua C. Colp [Wed, 3 Mar 2021 13:32:22 +0000 (09:32 -0400)] 
channel: Fix memory leak in suppress API.

A frame suppression API exists as part of channels
which allows audio frames to or from a channel to
be dropped. The MuteAudio AMI action uses this
API to perform its job.

This API uses a framehook to intercept flowing
audio and drop it when appropriate. It is the
responsibility of the framehook to free the
frame it is given if it changes the frame. The
suppression API failed to do this resulting in
a leak of audio frames.

This change adds the freeing of these frames.

ASTERISK-29071

Change-Id: Ie50acd454d672d36af914050c327d2e120d8ba7b

4 years agobridge: Don't try to match audio formats.
Joshua C. Colp [Mon, 18 May 2020 14:05:56 +0000 (11:05 -0300)] 
bridge: Don't try to match audio formats.

When bridging channels we were trying to match the audio
formats of both sides in combination with the configured
formats. While this is allowed in SDP in practice this
causes extra reinvites and problems. This change ensures
that audio streams use the formats of the first existing
active audio stream. It is only when other stream types
(like video) exist that this will result in re-negotiation
occurring for those streams only.

ASTERISK-28871

Change-Id: I22f5a3e7db29e00c165e74d05d10856f6086fe47

4 years agores_pjsip_session.c: Check topology on re-invite.
Ben Ford [Mon, 15 Feb 2021 18:24:42 +0000 (12:24 -0600)] 
res_pjsip_session.c: Check topology on re-invite.

Removes an unnecessary check for the conditional that compares the
stream topologies to see if they are equal to suppress re-invites. This
was a problem when a Digium phone received an INVITE that offered codecs
different than what it supported, causing Asterisk to send the
re-invite.

ASTERISK-29303

Change-Id: I04dc91befb2387904e28a9aaeaa3bcdbcaa7fa63

4 years agoUpdate for certified/16.8-cert6 certified/16.8-cert6
Asterisk Development Team [Thu, 18 Feb 2021 16:51:33 +0000 (11:51 -0500)] 
Update for certified/16.8-cert6

4 years agoAST-2021-002: Remote crash possible when negotiating T.38
Kevin Harwell [Mon, 1 Feb 2021 21:24:25 +0000 (15:24 -0600)] 
AST-2021-002: Remote crash possible when negotiating T.38

When an endpoint requests to re-negotiate for fax and the incoming
re-invite is received prior to Asterisk sending out the 200 OK for
the initial invite the re-invite gets delayed. When Asterisk does
finally send the re-inivite the SDP includes streams for both audio
and T.38.

This happens because when the pending topology and active topologies
differ (pending stream is not in the active) in the delayed scenario
the pending stream is appended to the active topology. However, in
the fax case the pending stream should replace the active.

This patch makes it so when a delay occurs during fax negotiation,
to or from, the audio stream is replaced by the T.38 stream, or vice
versa instead of being appended.

Further when Asterisk sent the re-invite with both audio and T.38,
and the endpoint responded with a declined T.38 stream then Asterisk
would crash when attempting to change the T.38 state.

This patch also puts in a check that ensures the media state has a
valid fax session (associated udptl object) before changing the
T.38 state internally.

ASTERISK-29203 #close

Change-Id: I407f4fa58651255b6a9030d34fd6578cf65ccf09

4 years agortp: Enable srtp replay protection
Alexander Traud [Tue, 26 Jan 2021 17:09:53 +0000 (10:09 -0700)] 
rtp:  Enable srtp replay protection

Add option "srtpreplayprotection" rtp.conf to enable srtp
replay protection.

ASTERISK-29260
Reported by: Alexander Traud

Change-Id: I5cd346e3c6b6812039d1901aa4b7be688173b458

4 years agores_rtp_asterisk.c: Fix signed mismatch that leads to overflow
Sean Bright [Fri, 11 Dec 2020 20:49:48 +0000 (15:49 -0500)] 
res_rtp_asterisk.c: Fix signed mismatch that leads to overflow

ASTERISK-29205 #close

Change-Id: Ib7aa65644e8df76e2378d7613ee7cf751b9d0bea

4 years agopjsip: Make modify_local_offer2 tolerate previous failed SDP.
Joshua C. Colp [Fri, 5 Feb 2021 11:26:02 +0000 (07:26 -0400)] 
pjsip: Make modify_local_offer2 tolerate previous failed SDP.

If a remote side is broken and sends an SDP that can not be
negotiated the call will be torn down but there is a window
where a second 183 Session Progress or 200 OK that is forked
can be received that also attempts to negotiate SDP. Since
the code marked the SDP negotiation as being done and complete
prior to this it assumes that there is an active local and remote
SDP which it can modify, while in fact there is not as the SDP
did not successfully negotiate. Since there is no local or remote
SDP a crash occurs.

This patch changes the pjmedia_sdp_neg_modify_local_offer2
function to no longer assume that a previous SDP negotiation
was successful.

ASTERISK-29196

Change-Id: I22de45916d3b05fdc2a67da92b3a38271ee5949e

4 years agores_pjsip_pidf_digium_body_supplement: Support Sangoma user agent.
Joshua C. Colp [Wed, 16 Dec 2020 12:17:23 +0000 (08:17 -0400)] 
res_pjsip_pidf_digium_body_supplement: Support Sangoma user agent.

This adds support for both Digium and Sangoma user agent strings
for the Sangoma specific body supplement.

Change-Id: Ib99362b24b91d3cbe888d8b2fce3fad5515d9482
(cherry picked from commit 7e4bb4ed11b2741ff6cd47a95fb6e815a5e1d901)

4 years agoUpdate for certified/16.8-cert5 certified/16.8-cert5
Asterisk Development Team [Thu, 5 Nov 2020 21:06:52 +0000 (16:06 -0500)] 
Update for certified/16.8-cert5

4 years agoAST-2020-001 - res_pjsip: Return dialog locked and referenced
Kevin Harwell [Mon, 19 Oct 2020 22:21:57 +0000 (17:21 -0500)] 
AST-2020-001 - res_pjsip: Return dialog locked and referenced

pjproject returns the dialog locked and with a reference. However,
in Asterisk the method that handles this decrements the reference
and removes the lock prior to returning. This makes it possible,
under some circumstances, for another thread to free said dialog
before the thread that created it attempts to use it again. Of
course when the thread that created it tries to use a freed dialog
a crash can occur.

This patch makes it so Asterisk now returns the newly created
dialog both locked, and with an added reference. This allows the
caller to de-reference, and unlock the dialog when it is safe to
do so.

In the case of a new SIP Invite the lock, and reference are now
held for the entirety of the new invite handling process.
Otherwise it's possible for the dialog, or its dependent objects,
like the transaction, to disappear. For example if there is a TCP
transport error.

ASTERISK-29057 #close

Change-Id: I5ef645a47829596f402cf383dc02c629c618969e

4 years agoAST-2020-002 - res_pjsip: Stop sending INVITEs after challenge limit.
Ben Ford [Mon, 2 Nov 2020 16:29:31 +0000 (10:29 -0600)] 
AST-2020-002 - res_pjsip: Stop sending INVITEs after challenge limit.

If Asterisk sends out an INVITE and receives a challenge with a
different nonce value each time, it will continuously send out INVITEs,
even if the call is hung up. The endpoint must be configured for
outbound authentication for this to occur. A limit has been set on
outbound INVITEs so that, once reached, Asterisk will stop sending
INVITEs and the transaction will terminate.

ASTERISK-29013

Change-Id: I2d001ca745b00ca8aa12030f2240cd72363b46f7

4 years agoUpdate for certified/16.8-cert4 certified/16.8-cert4
Asterisk Development Team [Thu, 5 Nov 2020 17:58:14 +0000 (12:58 -0500)] 
Update for certified/16.8-cert4

4 years agoUpdate CHANGES and UPGRADE.txt for certified/16.8-cert4
Asterisk Development Team [Thu, 5 Nov 2020 17:53:00 +0000 (12:53 -0500)] 
Update CHANGES and UPGRADE.txt for certified/16.8-cert4

4 years agoUpdate for certified/16.8-cert4-rc4 certified/16.8-cert4-rc4
Asterisk Development Team [Wed, 4 Nov 2020 17:31:15 +0000 (12:31 -0500)] 
Update for certified/16.8-cert4-rc4

4 years agoRevert "Revert "Revert "core_unreal / core_local: Add multistream and re-negotiation."""
George Joseph [Wed, 4 Nov 2020 15:11:44 +0000 (09:11 -0600)] 
Revert "Revert "Revert "core_unreal / core_local: Add multistream and re-negotiation."""

First it was in.
Then it was out.
Then it was in again.
Now it's out again because of a faxing issue discovered by the swvx team.

Reason for revert: Faxing issue

Change-Id: Ia417853130361b69f83f70bbc799493bb9f2fe27

4 years agoUpdate for certified/16.8-cert4-rc3 certified/16.8-cert4-rc3
Asterisk Development Team [Tue, 6 Oct 2020 22:53:33 +0000 (17:53 -0500)] 
Update for certified/16.8-cert4-rc3

4 years agores_pjsip_session: Fix stream name memory leak.
Joshua C. Colp [Tue, 22 Sep 2020 10:05:34 +0000 (07:05 -0300)] 
res_pjsip_session: Fix stream name memory leak.

When constructing a stream name based on the media type
and position the allocated name was not being freed
causing a leak.

Change-Id: I52510863b24a2f531f0a55b440bb2c81844029de

4 years agores_pjsip_session: Fix session reference leak.
Joshua C. Colp [Tue, 22 Sep 2020 10:13:32 +0000 (07:13 -0300)] 
res_pjsip_session: Fix session reference leak.

The ast_sip_dialog_get_session function returns the session
with reference count increased. This was not taken into
account and was causing sessions to remain around when they
should not be.

ASTERISK-29089

Change-Id: I430fa721b0a824311a59effec6056e9ec528e3e8

4 years agologger.h: Fix ast_trace to respect scope_level
George Joseph [Thu, 17 Sep 2020 16:40:39 +0000 (10:40 -0600)] 
logger.h: Fix ast_trace to respect scope_level

ast_trace() was always emitting messages when it's level was set to -1
because it was ignoring scope_level.

Change-Id: I849c8f4f4613899c37f82be0202024e7d117e506

4 years agobridge_softmix/sfu_topologies_on_join: Ignore topology change failures
George Joseph [Thu, 17 Sep 2020 18:01:27 +0000 (12:01 -0600)] 
bridge_softmix/sfu_topologies_on_join: Ignore topology change failures

When a channel joins a bridge, we do topology change requests on all
existing channels to add the new participant to them.  However the
announcer channel will return an error because it doesn't support
topology in the first place.  Unfortunately, there doesn't seem to be a
reliable way to tell if the error is expected or not so the error is
ignored for all channels.  If the request fails on a "real" channel,
that channel just won't get the new participant's video.

Change-Id: Ic95db4683f27d224c1869fe887795d6b9fdea4f0

4 years agores_pjsip_session: Fix issue with COLP and 491
George Joseph [Fri, 11 Sep 2020 16:09:55 +0000 (10:09 -0600)] 
res_pjsip_session: Fix issue with COLP and 491

The recent 491 changes introduced a check to determine if the active
and pending topologies were equal and to suppress the re-invite if they
were. When a re-invite is sent for a COLP-only change, the pending
topology is NULL so that check doesn't happen and the re-invite is
correctly sent. Of course, sending the re-invite sets the pending
topology.  If a 491 is received, when we resend the re-invite, the
pending topology is set and since we didn't request a change to the
topology in the first place, pending and active topologies are equal so
the topologies-equal check causes the re-invite to be erroneously
suppressed.

This change checks if the topologies are equal before we run the media
state resolver (which recreates the pending topology) so that when we
do the final topologies-equal check we know if this was a topology
change request.  If it wasn't a change request, we don't suppress
the re-invite even though the topologies are equal.

ASTERISK-29014

Change-Id: Iffd7dd0500301156a566119ebde528d1a9573314

4 years agodebugging: Add enough to choke a mule
George Joseph [Thu, 20 Aug 2020 20:09:25 +0000 (14:09 -0600)] 
debugging:  Add enough to choke a mule

Added to:
 * bridges/bridge_softmix.c
 * channels/chan_pjsip.c
 * include/asterisk/res_pjsip_session.h
 * main/channel.c
 * res/res_pjsip_session.c

There NO functional changes in this commit.

Change-Id: I06af034d1ff3ea1feb56596fd7bd6d7939dfdcc3

4 years agores_pjsip_session: Handle multi-stream re-invites better
George Joseph [Thu, 20 Aug 2020 16:21:18 +0000 (10:21 -0600)] 
res_pjsip_session:  Handle multi-stream re-invites better

When both Asterisk and a UA send re-invites at the same time, both
send 491 "Transaction in progress" responses to each other and back
off a specified amount of time before retrying. When Asterisk
prepares to send its re-invite, it sets up the session's pending
media state with the new topology it wants, then sends the
re-invite.  Unfortunately, when it received the re-invite from the
UA, it partially processed the media in the re-invite and reset
the pending media state before sending the 491 losing the state it
set in its own re-invite.

Asterisk also was not tracking re-invites received while an existing
re-invite was queued resulting in sending stale SDP with missing
or duplicated streams, or no re-invite at all because we erroneously
determined that a re-invite wasn't needed.

There was also an issue in bridge_softmix where we were using a stream
from the wrong topology to determine if a stream was added.  This also
caused us to erroneously determine that a re-invite wasn't needed.

Regardless of how the delayed re-invite was triggered, we need to
reconcile the topology that was active at the time the delayed
request was queued, the pending topology of the queued request,
and the topology currently active on the session.  To do this we
need a topology resolver AND we need to make stream named unique
so we can accurately tell what a stream has been added or removed
and if we can re-use a slot in the topology.

Summary of changes:

 * bridge_softmix:
   * We no longer reset the stream name to "removed" in
     remove_all_original_streams().  That was causing  multiple streams
     to have the same name and wrecked the checks for duplicate streams.

   * softmix_bridge_stream_sources_update() was checking the old_stream
     to see if it had the softmix prefix and not considering the stream
     as "new" if it did.  If the stream in that slot has something in it
     because another re-invite happened, then that slot in old might
     have a softmix stream but the same stream in new might actually
     be a new one.  Now we check the new_stream's name instead of
     the old_stream's.

 * stream:
   * Instead of using plain media type name ("audio", "video", etc) as
     the default stream name, we now append the stream position to it
     to make it unique.  We need to do this so we can distinguish multiple
     streams of the same type from each other.

   * When we set a stream's state to REMOVED, we no longer reset its
     name to "removed" or destroy its metadata.  Again, we need to
     do this so we can distinguish multiple streams of the same
     type from each other.

 * res_pjsip_session:
   * Added resolve_refresh_media_states() that takes in 3 media states
     and creates an up-to-date pending media state that includes the changes
     that might have happened while a delayed session refresh was in the
     delayed queue.

   * Added is_media_state_valid() that checks the consistency of
     a media state and returns a true/false value. A valid state has:
     * The same number of stream entries as media session entries.
         Some media session entries can be NULL however.
     * No duplicate streams.
     * A valid stream for each non-NULL media session.
     * A stream that matches each media session's stream_num
       and media type.

   * Updated handle_incoming_sdp() to set the stream name to include the
     stream position number in the name to make it unique.

   * Updated the ast_sip_session_delayed_request structure to include both
     the pending and active media states and updated the associated delay
     functions to process them.

   * Updated sip_session_refresh() to accept both the pending and active
     media states that were in effect when the request was originally queued
     and to pass them on should the request need to be delayed again.

   * Updated sip_session_refresh() to call resolve_refresh_media_states()
     and substitute its results for the pending state passed in.

   * Updated sip_session_refresh() with additional debugging.

   * Updated session_reinvite_on_rx_request() to simply return PJ_FALSE
     to pjproject if a transaction is in progress.  This stops us from
     creating a partial pending media state that would be invalid later on.

   * Updated reschedule_reinvite() to clone both the current pending and
     active media states and pass them to delay_request() so the resolver
     can tell what the original intention of the re-invite was.

   * Added a large unit test for the resolver.

ASTERISK-29014

Change-Id: Id3440972943c611a15f652c6c569fa0e4536bfcb

4 years agoBridging: Use a ref to bridge_channel's channel to prevent crash.
Ben Ford [Mon, 31 Aug 2020 16:14:20 +0000 (11:14 -0500)] 
Bridging: Use a ref to bridge_channel's channel to prevent crash.

There's a race condition with bridging where a bridge can be torn down
causing the bridge_channel's ast_channel to become NULL when it's still
needed. This particular case happened with attended transfers, but the
crash occurred when trying to publish a stasis message. Now, the
bridge_channel is locked, a ref to the ast_channel is obtained, and that
ref is passed down the chain.

Change-Id: Ic48715c0c041615d17d286790ae3e8c61bb28814

4 years agostream.c: Added 2 more debugging utils and added pos to stream string
George Joseph [Thu, 20 Aug 2020 13:32:03 +0000 (07:32 -0600)] 
stream.c:  Added 2 more debugging utils and added pos to stream string

 * Added ast_stream_to_stra and ast_stream_topology_to_stra() macros
   which are shortcuts for
      ast_str_tmp(256, ast_stream_to_str(stream, &STR_TMP))

 * Added the stream position to the string representation of the
   stream.

 * Fixed some formatting in ast_stream_to_str().

Change-Id: Idaf4cb0affa46d4dce58a73a111f35435331cc4b

4 years agoscope_trace: Added debug messages and added additional macros
George Joseph [Wed, 19 Aug 2020 12:37:23 +0000 (06:37 -0600)] 
scope_trace: Added debug messages and added additional macros

The SCOPE_ENTER and SCOPE_EXIT* macros now print debug messages
at the same level as the scope level.  This allows the same
messages to be printed to the debug log when AST_DEVMODE
isn't enabled.

Also added a few variants of the SCOPE_EXIT macros that will
also call ast_log instead of ast_debug to make it easier to
use scope tracing and still print error messages.

Change-Id: I7fe55f7ec28069919a0fc0b11a82235ce904cc21

4 years agologger.c: Added a new log formatter called "plain"
George Joseph [Fri, 14 Aug 2020 16:13:33 +0000 (10:13 -0600)] 
logger.c: Added a new log formatter called "plain"

Added a new log formatter called "plain" that always prints
file, function and line number if available (even for verbose
messages) and never prints color control characters.  It also
doesn't apply any special formatting for verbose messages.
Most suitable for file output but can be used for other channels
as well.

You use it in logger.conf like so:
debug => [plain]debug
console => [plain]error,warning,debug,notice,pjsip_history
messages => [plain]warning,error,verbose

Change-Id: I4fdfe4089f66ce2f9cb29f3005522090dbb5243d

4 years agoast_coredumper: Fix issues with naming
George Joseph [Fri, 28 Aug 2020 14:34:09 +0000 (08:34 -0600)] 
ast_coredumper: Fix issues with naming

If you run ast_coredumper --tarball-coredumps in the same directory
as the actual coredump, tar can fail because the link to the
actual coredump becomes recursive.  The resulting tarball will
have everything _except_ the coredump (which is usually what
you need)

There's also an issue that the directory name in the tarball
is the same as the coredump so if you extract the tarball the
directory it creates will overwrite the coredump.

So:

 * Made the link to the coredump use the absolute path to the
   file instead of a relative one.  This prevents the recursive
   link and allows tar to add the coredump.

 * The tarballed directory is now named <coredump>.output instead
   of just <coredump> so if you expand the tarball it won't
   overwrite the coredump.

Change-Id: I8b3eeb26e09a577c702ff966924bb0a2f9a759ea

4 years agores_pjsip_session: Don't aggressively terminate on failed re-INVITE.
Joshua C. Colp [Tue, 18 Aug 2020 09:36:05 +0000 (06:36 -0300)] 
res_pjsip_session: Don't aggressively terminate on failed re-INVITE.

Per the RFC when an outgoing re-INVITE is done we should
only terminate the dialog if a 481 or 408 is received.

ASTERISK-29033

Change-Id: I6c3ff513aa41005d02de0396ba820083e9b18503

4 years agores_pjsip_session: Ensure reused streams have correct bundle group
George Joseph [Thu, 23 Jul 2020 19:47:25 +0000 (13:47 -0600)] 
res_pjsip_session: Ensure reused streams have correct bundle group

When a bundled stream is removed, its bundle_group is reset to -1.
If that stream is later reused, the bundle parameters on session
media need to be reset correctly it could mistakenly be rebundled
with a stream that was removed and never reused.  Since the removed
stream has no rtp instance, a crash will result.

Change-Id: Ie2b792220f9291587ab5f9fd123145559dba96d7

4 years agopjsip: Add timer refactor patch and timer 0 cancellation.
Joshua C. Colp [Mon, 13 Jul 2020 09:41:22 +0000 (06:41 -0300)] 
pjsip: Add timer refactor patch and timer 0 cancellation.

There have been numerous timer issues over the years which
resulted in Teluu doing a major refactor of the timer
implementation whereby the timer entries themselves are not
trusted. This change backports this refactor which has
been shown to resolve timer crashes.

Additionally another patch has been backported to prevent
timer entries with an internal id of 0 from being canceled.
This would result in the invalid timer id of 0 being placed
into the timer heap causing issues. This is also a backport.

Change-Id: I1ba318b1f153a6dd7458846396e2867282b428e7
(cherry picked from commit 9ce6d46aea3a7ec70fe923a58cb2aafaa1ea64a8)

4 years agomanager - Add Content-Type parameter to the SendText action
Kevin Harwell [Wed, 10 Jun 2020 22:05:57 +0000 (17:05 -0500)] 
manager - Add Content-Type parameter to the SendText action

This patch allows a user of AMI to now specify the type of message
content contained within by setting the 'Content-Type' parameter.

Note, the AMI version has been bumped for this change.

ASTERISK-28945 #close

Change-Id: Ibb5315702532c6b954e1498beddc8855fabdf4bb

4 years agoMakefile: Fix certified version numbers
cmaj [Thu, 6 Aug 2020 17:51:10 +0000 (11:51 -0600)] 
Makefile: Fix certified version numbers

Adds sed before awk to produce reasonable ASTERISKVERSIONNUM
on certified versions of Asterisk eg. 16.8-cert3 is 160803
instead of the previous 00800.

ASTERISK-29021 #close

Change-Id: Icf241df0ff6db09011b8c936a317a84b0b634e16

4 years agoScope Trace: Make it easier to trace through synchronous tasks
George Joseph [Sun, 5 Jul 2020 23:51:04 +0000 (17:51 -0600)] 
Scope Trace: Make it easier to trace through synchronous tasks

Tracing through synchronous tasks was a little troublesome because
the new thread's stack counter reset to 0.  This change allows
a synchronous task to set its trace level to be the same as the
thread that pushed the task.  For now, the task's level has to be
passed in the task's data structure but a future enhancement to the
taskprocessor subsystem could automatically set the trace level
of the servant to be that of the caller.

This doesn't really make sense for async tasks because you never
know when they're going to run anyway.

Change-Id: Ib8049c0b815063a45d8c7b0cb4e30b7b87b1d825

4 years agoscope_trace: Add/update utilities
George Joseph [Fri, 7 Aug 2020 11:58:38 +0000 (05:58 -0600)] 
scope_trace: Add/update utilities

* Added a AST_STREAM_STATE_END sentinel
* Add ast_stream_to_str()
* Add ast_stream_state_to_str()
* Add ast_stream_get_format_count()
* Add ast_stream_topology_to_str()
* Add ast_stream_topology_get_active_count()
* Add ast_format_cap_append_names()
* Add ast_sip_session_get_name()

Change-Id: I132eb5971ea41509c660f64e9113cda8c9013b0b

4 years agoScope Trace: Add some new tracing macros and an ast_str helper
George Joseph [Tue, 30 Jun 2020 13:56:34 +0000 (07:56 -0600)] 
Scope Trace:  Add some new tracing macros and an ast_str helper

Created new SCOPE_ functions that don't depend on RAII_VAR.  Besides
generating less code, the use of the explicit SCOPE_EXIT macros
capture the line number where the scope exited.  The RAII_VAR
versions can't do that.

 * SCOPE_ENTER(level, ...): Like SCOPE_TRACE but doesn't use
   RAII_VAR and therefore needs needs one of...

 * SCOPE_EXIT(...): Decrements the trace stack counter and optionally
   prints a message.

 * SCOPE_EXIT_EXPR(__expr, ...): Decrements the trace stack counter,
   optionally prints a message, then executes the expression.
   SCOPE_EXIT_EXPR(break, "My while got broken\n");

 * SCOPE_EXIT_RTN(, ...): Decrements the trace stack counter,
   optionally prints a message, then returns without a value.
   SCOPE_EXIT_RTN("Bye\n");

 * SCOPE_EXIT_RTN_VALUE(__return_value, ...): Decrements the trace
   stack counter, optionally prints a message, then returns the value
   specified.
   SCOPE_EXIT_RTN_VALUE(rc, "Returning with RC: %d\n", rc);

Create an ast_str helper ast_str_tmp() that allocates a temporary
ast_str that can be passed to a function that needs it, then frees
it.  This makes using the above macros easier.  Example:

   SCOPE_ENTER(1, Format Caps 1: %s  Format Caps 2: %s\n",
       ast_str_tmp(32, ast_format_cap_get_names(cap1, &STR_TMP),
       ast_str_tmp(32, ast_format_cap_get_names(cap2, &STR_TMP));

The calls to ast_str_tmp create an ast_str of the specified initial
length which can be referenced as STR_TMP.  It then calls the
expression, which must return a char *, ast_strdupa's it, frees
STR_TMP, then returns the ast_strdupa'd string.  That string is
freed when the function returns.

Change-Id: I44059b20d55a889aa91440d2f8a590865998be51
(cherry picked from commit 43ba72dea099b5448fdeb0fcab44b6186a0ddf75)

4 years agoScope Tracing: A new facility for tracing scope enter/exit
George Joseph [Thu, 14 May 2020 18:24:19 +0000 (12:24 -0600)] 
Scope Tracing:  A new facility for tracing scope enter/exit

What's wrong with ast_debug?

  ast_debug is fine for general purpose debug output but it's not
  really geared for scope tracing since it doesn't present its
  output in a way that makes capturing and analyzing flow through
  Asterisk easy.

How is scope tracing better?

  Scope tracing uses the same "cleanup" attribute that RAII_VAR
  uses to print messages to a separate "trace" log level.  Even
  better, the messages are indented and unindented based on a
  thread-local call depth counter.  When output to a separate log
  file, the output is uncluttered and easy to follow.

  Here's an example of the output. The leading timestamps and
  thread ids are removed and the output cut off at 68 columns for
  commit message restrictions but you get the idea.

--> res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001
--> res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173
--> res_pjsip_session.c:3669 handle_incoming_response PJSIP/
--> chan_pjsip.c:3265 chan_pjsip_incoming_response_after
--> chan_pjsip.c:3194 chan_pjsip_incoming_response P
    chan_pjsip.c:3245 chan_pjsip_incoming_respon
<-- chan_pjsip.c:3194 chan_pjsip_incoming_response P
<-- chan_pjsip.c:3265 chan_pjsip_incoming_response_after
<-- res_pjsip_session.c:3669 handle_incoming_response PJSIP/
<-- res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173
<-- res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001

  The messages with the "-->" or "<--" were produced by including
  the following at the top of each function:

  SCOPE_TRACE(1, "%s\n", ast_sip_session_get_name(session));

  Scope isn't limited to functions any more than RAII_VAR is.  You
  can also see entry and exit from "if", "for", "while", etc blocks.

  There is also an ast_trace() macro that doesn't track entry or
  exit but simply outputs a message to the trace log using the
  current indent level.  The deepest message in the sample
  (chan_pjsip.c:3245) was used to indicate which "case" in a
  "select" was executed.

How do you use it?

  More documentation is available in logger.h but here's an overview:

  * Configure with --enable-dev-mode.  Like debug, scope tracing
    is #ifdef'd out if devmode isn't enabled.

  * Add a SCOPE_TRACE() call to the top of your function.

  * Set a logger channel in logger.conf to output the "trace" level.

  * Use the CLI (or cli.conf) to set a trace level similar to setting
    debug level... CLI> core set trace 2 res_pjsip.so

Summary Of Changes:

  * Added LOG_TRACE logger level.  Actually it occupies the slot
    formerly occupied by the now defunct "event" level.

  * Added core asterisk option "trace" similar to debug.  Includes
ability to specify global trace level in asterisk.conf and CLI
commands to turn on/off and set levels.  Levels can be set
globally (probably not a good idea), or by module/source file.

  * Updated sample asterisk.conf and logger.conf.  Tracing is
    disabled by default in both.

  * Added __ast_trace() to logger.c which keeps track of the indent
    level using TLS. It's #ifdef'd out if devmode isn't enabled.

  * Added ast_trace() and SCOPE_TRACE() macros to logger.h.
    These are all #ifdef'd out if devmode isn't enabled.

Why not use gcc's -finstrument-functions capability?

  gcc's facility doesn't allow access to local data and doesn't
  operate on non-function scopes.

Known Issues:

  The only know issue is that we currently don't know the line
  number where the scope exited.  It's reported as the same place
  the scope was entered.  There's probably a way to get around it
  but it might involve looking at the stack and doing an 'addr2line'
  to get the line number.  Kind of like ast_backtrace() does.
  Not sure if it's worth it.

Change-Id: Ic5ebb859883f9c10a08c5630802de33500cad027
(cherry picked from commit 6a0c47237480d750023561b004f2c4052bfab210)

5 years agoframe.c: Make debugging easier
George Joseph [Mon, 6 Jul 2020 15:57:18 +0000 (09:57 -0600)] 
frame.c:  Make debugging easier

 * ast_frame_subclass2str() and ast_frame_type2str() now return
   a pointer to the buffer that was passed in instead of void.
   This makes it easier to use these functions inline in
   printf-style debugging statements.

 * Added many missing control frame entries in
   ast_frame_subclass2str.

Change-Id: Ifd0d6578e758cd644c96d17a5383ff2128c572fc
(cherry picked from commit fdcb3e2ead11243cd8becb2a9778a4fb4ac8b63c)

5 years agoUpdate for certified/16.8-cert4-rc2 certified/16.8-cert4-rc2
Asterisk Development Team [Thu, 23 Jul 2020 18:57:07 +0000 (13:57 -0500)] 
Update for certified/16.8-cert4-rc2

5 years agowebsocket / pjsip: Increase maximum packet size.
Joshua C. Colp [Wed, 22 Jul 2020 17:57:44 +0000 (14:57 -0300)] 
websocket / pjsip: Increase maximum packet size.

When dealing with a lot of video streams on WebRTC
the resulting SDPs can grow to be quite large. This
effectively doubles the maximum size to allow more
streams to exist.

The res_http_websocket module has also been changed
to use a buffer on the session for reading in packets
to ensure that the stack space usage is not excessive.

Change-Id: I31d4351d70c8e2c11564807a7528b984f3fbdd01

5 years agores_pjsip: Apply AOR outbound proxy to static contacts.
Joshua C. Colp [Fri, 26 Jun 2020 10:18:55 +0000 (07:18 -0300)] 
res_pjsip: Apply AOR outbound proxy to static contacts.

The outbound proxy for an AOR was not being applied to
any statically configured Contacts. This resulted in the
OPTIONS requests being sent to the wrong target.

This change sets the outbound proxy on statically configured
contacts once the AOR configuration is done being
applied.

ASTERISK-28965

Change-Id: Ia60f3e93ea63f819c5a46bc8b54be2e588dfa9e0

5 years agoUpdate for certified/16.8-cert4-rc1 certified/16.8-cert4-rc1
Asterisk Development Team [Mon, 29 Jun 2020 09:03:57 +0000 (04:03 -0500)] 
Update for certified/16.8-cert4-rc1

5 years agoRevert "Revert "core_unreal / core_local: Add multistream and re-negotiation.""
Joshua Colp [Tue, 23 Jun 2020 22:23:26 +0000 (17:23 -0500)] 
Revert "Revert "core_unreal / core_local: Add multistream and re-negotiation.""

This reverts commit ec8b3850d21d63c627e8f9d97c34b780c13d941a.

Reason for revert: Time for this to return.

Change-Id: I5858f279bd523c609830c09333902b5d7d048aaf

5 years agoUpdate for certified/16.8-cert3 certified/16.8-cert3
Asterisk Development Team [Fri, 19 Jun 2020 17:47:29 +0000 (12:47 -0500)] 
Update for certified/16.8-cert3

5 years agoRevert "core_unreal / core_local: Add multistream and re-negotiation."
Kevin Harwell [Fri, 19 Jun 2020 17:04:47 +0000 (12:04 -0500)] 
Revert "core_unreal / core_local: Add multistream and re-negotiation."

This reverts commit 2b5b9cd8e0b76f303d567187c4553a2a7edbc1ae.

Reason for revert: <INSERT REASONING HERE>

Change-Id: I37c31857c5f16715a2debb99e1d68a0202fd1186

5 years agores_pjsip_session: Preserve label on incoming re-INVITE.
Joshua C. Colp [Wed, 17 Jun 2020 08:58:44 +0000 (05:58 -0300)] 
res_pjsip_session: Preserve label on incoming re-INVITE.

When a re-INVITE is received we create a new set of
streams that are then swapped in as the active streams.
We did not preserve the SDP label from the previous
streams, resulting in the label getting lost.

This change ensures that if an SDP label is present
on the previous stream then it is set on the new stream.

ASTERISK-28953

Change-Id: I9dd63b88b562fe96ce5c791a3dae5bcaca258445

5 years agocore_unreal / core_local: Add multistream and re-negotiation.
Joshua C. Colp [Wed, 3 Jun 2020 16:47:42 +0000 (13:47 -0300)] 
core_unreal / core_local: Add multistream and re-negotiation.

When requesting a Local channel the requested stream topology
or a converted stream topology will now be placed onto the
resulting channels.

Frames written in on streams will now also preserve the stream
identifier as they are queued on the opposite channel.

Finally when a stream topology change is requested it is
immediately accepted and reflected on both channels. Each
channel also receives a queued frame to indicate that the
topology has changed.

ASTERISK-28938

Change-Id: I4e9d94da5230d4bd046dc755651493fce1d87186

5 years agores_rtp_asterisk: Don't assume setting retrans props means to enable.
Joshua C. Colp [Mon, 8 Jun 2020 11:27:53 +0000 (08:27 -0300)] 
res_rtp_asterisk: Don't assume setting retrans props means to enable.

The "value" passed in when setting an RTP property determines
whether it should be enabled or disabled. The RTP send and
receive retrans props did not examine this to know if the
buffers should be enabled. They assumed they always should be.

This change makes it so that the "value" passed in is
respected.

ASTERISK-28939

Change-Id: I9244cdbdc5fd065c7f6b02cbfa572bc55c7123dc

5 years agobridge_softmix: Add additional old states for adding new source.
Joshua C. Colp [Wed, 10 Jun 2020 17:11:16 +0000 (14:11 -0300)] 
bridge_softmix: Add additional old states for adding new source.

There are three states that an old stream can be in to allow
becoming a source stream in a new stream:

1. Removed
2. Inactive
3. Sendonly

This change adds the two missing ones, inactive and sendonly,
so if a stream transitions from those to a state where they are
providing video to Asterisk we properly re-negotiate the other
participants.

ASTERISK-28944

Change-Id: Id8256b9b254b403411586284bbaedbf50452de01

5 years agoapp_confbridge: Plug ref leak of bridge channel with send_events
George Joseph [Mon, 8 Jun 2020 00:02:00 +0000 (18:02 -0600)] 
app_confbridge: Plug ref leak of bridge channel with send_events

When send_events is enabled for a user, we were leaking a reference
to the bridge channel in confbridge_manager.c:send_message().  This
also caused the bridge snapshot to not be destroyed.

Change-Id: I87a7ae9175e3cd29f6d6a8750e0ec5427bd98e97

5 years agoCompiler fixes for gcc 10
Kevin Harwell [Wed, 3 Jun 2020 17:06:44 +0000 (12:06 -0500)] 
Compiler fixes for gcc 10

This patch fixes a few compile warnings/errors that now occur when using gcc
10+.

Also, the Makefile.rules check to turn off partial inlining in gcc versions
greater or equal to 8.2.1 had a bug where it only it only checked against
versions with at least 3 numbers (ex: 8.2.1 vs 10). This patch now ensures
any version above the specified version is correctly compared.

Change-Id: I54718496eb0c3ce5bd6d427cd279a29e8d2825f9

5 years agoUpdate for certified/16.8-cert2 certified/16.8-cert2
Asterisk Development Team [Thu, 30 Apr 2020 18:43:31 +0000 (13:43 -0500)] 
Update for certified/16.8-cert2

5 years agoapp_voicemail: Add workaround for a gcc 10 issue with -Wrestrict
George Joseph [Thu, 30 Apr 2020 15:56:03 +0000 (09:56 -0600)] 
app_voicemail: Add workaround for a gcc 10 issue with -Wrestrict

The gcc 10 -Wrestrict option was causing "overlap" errors when
snprintf was copying one char[256] structure member to another
char[256] member in the same structure.

Using ast_alloca instead of declaring the structure inline
solves the issue.

Here's a link to the "enhancement":
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-10/msg00570.html

We may follow up with a gcc bug report.

Change-Id: Ie0099adcb0a9727bd9aa99e024dd912a67eaf534

5 years agofax: Fix crashes in PJSIP re-negotiation scenarios.
Joshua C. Colp [Mon, 20 Apr 2020 15:18:24 +0000 (12:18 -0300)] 
fax: Fix crashes in PJSIP re-negotiation scenarios.

This change fixes a few re-negotiation issues
uncovered with fax.

1. The fax support uses its own mechanism for
re-negotiation by conveying T.38 information in
its own frames. The new support for re-negotiating
when adding/removing/changing streams was also
being triggered for this causing multiple re-INVITEs.
The new support will no longer trigger when
transitioning between fax.

2. In off-nominal re-negotiation cases it was
possible for some state information to be left
over and used by the next re-negotiation. This
is now cleared.

ASTERISK-28811
ASTERISK-28839

Change-Id: I8ed5924b53be9fe06a385c58817e5584b0f25cc2
(cherry picked from commit f3ac42b9bd0d436ce2128e5bbb0502ddb587f98a)

5 years 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

ASTERISK-28824
ASTERISK-27717

Change-Id: Id46d357e18869f64dcc217b8fdba821b63eeb876
(cherry picked from commit dfdff0f9ec99ad80a385df99f4e5bf493f6d0b06)

5 years agoRevert "Revert "res_rtp_asterisk: Free payload when error on insertion to data buffer""
Joshua Colp [Wed, 29 Apr 2020 20:42:43 +0000 (15:42 -0500)] 
Revert "Revert "res_rtp_asterisk: Free payload when error on insertion to data buffer""

This reverts commit fe3dc091b57bf16ba62e185fe05f77069062a3b1.

Reason for revert: This will be merged once 16.8-cert1 is released.

Change-Id: I5c29f96a70ed7e1fa146a69e7b48bfe31cbee929

5 years agopjsip: Increase maximum ICE candidate count.
Joshua C. Colp [Tue, 28 Apr 2020 15:31:28 +0000 (12:31 -0300)] 
pjsip: Increase maximum ICE candidate count.

In practice it has been seen that some users come
close to our maximum ICE candidate count of 32.
In case people have gone over this increases the
count to 64, giving ample room.

ASTERISK-28859

Change-Id: I35cd68948ec0ada86c14eb53092cdaf8b62996cf
(cherry picked from commit 4374f8621920da032117662222fa0eb76b00bf76)

5 years agoRevert "Revert "res_rtp_asterisk: Resolve loop when receive buffer is flushed""
Joshua Colp [Wed, 29 Apr 2020 20:43:21 +0000 (15:43 -0500)] 
Revert "Revert "res_rtp_asterisk: Resolve loop when receive buffer is flushed""

This reverts commit a75317ce247b913d1cb92b9ffa47a49aa56b172a.

Reason for revert: This will be merged once 16.8-cert1 is released.

Change-Id: Ic2f4dbb19c5756fabe71b9e35c5a924214f5af08

5 years agoUpdate for certified/16.8-cert1 certified/16.8-cert1
Asterisk Development Team [Thu, 30 Apr 2020 13:30:36 +0000 (08:30 -0500)] 
Update for certified/16.8-cert1

5 years agoRevert "res_rtp_asterisk: Free payload when error on insertion to data buffer"
Joshua Colp [Mon, 20 Apr 2020 16:14:57 +0000 (11:14 -0500)] 
Revert "res_rtp_asterisk: Free payload when error on insertion to data buffer"

This reverts commit fef8a04aadf759bf08f12827de18f970ae7e3e8c.

Reason for revert: Waiting for future release.

Change-Id: I67e9837a352b252f8a75ebaa9a5fb7e5b35d41f7

5 years agoRevert "res_rtp_asterisk: Resolve loop when receive buffer is flushed"
Joshua Colp [Mon, 20 Apr 2020 16:14:35 +0000 (11:14 -0500)] 
Revert "res_rtp_asterisk: Resolve loop when receive buffer is flushed"

This reverts commit 22bc8a71680e4099ffd3ccff7b3fe33d26291c36.

Reason for revert: Waiting for future release.

Change-Id: If924f0b7fa02a72b52c708aa80addc361a87b490

5 years 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.

ASTERISK-28827

Change-Id: Idaa376101bc1ac880047c49feb6faee773e718b3

5 years 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.

ASTERISK-28826

Change-Id: Ie6c49495d1c921d5f997651c7d0f79646f095cf1

5 years agoUpdate for certified/16.8-cert1-rc5 certified/16.8-cert1-rc5
Asterisk Development Team [Mon, 6 Apr 2020 19:56:17 +0000 (14:56 -0500)] 
Update for certified/16.8-cert1-rc5

5 years 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

5 years 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:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;\
h=fd3619828e94a24a92cddec42cbc0ab33352eeb4

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
(cherry picked from commit 33b2c7f79b33693be502e4707c936f8dba392b5f)

5 years 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
audio.

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

5 years agoUpdate for certified/16.8-cert1-rc4 certified/16.8-cert1-rc4
Asterisk Development Team [Thu, 26 Mar 2020 16:48:37 +0000 (11:48 -0500)] 
Update for certified/16.8-cert1-rc4

5 years agoUpdate CHANGES and UPGRADE.txt for certified/16.8-cert1-rc4
Asterisk Development Team [Thu, 26 Mar 2020 16:46:05 +0000 (11:46 -0500)] 
Update CHANGES and UPGRADE.txt for certified/16.8-cert1-rc4

5 years 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

5 years 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.

ASTERISK-28787

Change-Id: Ia54c0c63e94aca176169b9bae4bb8a8380ea245f

5 years 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.

ASTERISK-28790

Change-Id: I10df52f98b19ed62575f25dab36e82d136dccd99

5 years 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
  BUILD_OPTS
  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

5 years 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.

ASTERISK-28783

Change-Id: I139740f38cea7f7d92a876ec2631ef50681f6625

5 years 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

5 years agoUpdate for certified/16.8-cert1-rc3 certified/16.8-cert1-rc3
Asterisk Development Team [Wed, 4 Mar 2020 15:43:52 +0000 (10:43 -0500)] 
Update for certified/16.8-cert1-rc3

5 years agoUpdate CHANGES and UPGRADE.txt for certified/16.8-cert1
Asterisk Development Team [Wed, 4 Mar 2020 15:41:51 +0000 (10:41 -0500)] 
Update CHANGES and UPGRADE.txt for certified/16.8-cert1

5 years agoMerge "bridging: Add better support for adding/removing streams." into certified...
George Joseph [Wed, 4 Mar 2020 15:31:59 +0000 (09:31 -0600)] 
Merge "bridging: Add better support for adding/removing streams." into certified/16.8