]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
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

5 years agoMerge "res_pjsip_session: Fix off-nominal session refreshes." into certified/16.8
George Joseph [Wed, 4 Mar 2020 15:27:46 +0000 (09:27 -0600)] 
Merge "res_pjsip_session: Fix off-nominal session refreshes." into certified/16.8

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

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
retransmit.

ASTERISK-28764

Change-Id: I97633dfa8a09a7889cef815b2be369f3f0314b41

5 years agores_pjsip_session: Fix off-nominal session refreshes.
Joshua C. Colp [Mon, 10 Feb 2020 11:04:12 +0000 (07:04 -0400)] 
res_pjsip_session: Fix off-nominal session refreshes.

Given a scenario where session refreshes occur close to
each other while another is finishing it was possible for
the session refreshes to occur out of order. It was
also possible for session refreshes to be delayed for
quite some time if a session refresh did not result in
a topology change.

For the out of order session refreshes the first session
refresh would be queued due to a transaction in progress.
This transaction would then finish. When finished a
separate task to process the delayed requests queue
would be queued for handling. A second refresh would
be requested internally before this delayed request
queued task was processed. As no transaction was in
progress this session refresh would be immediately
handled before the queued session refresh.

The code will now check if any delayed requests exist
before allowing a session refresh to immediately occur.
If any exist then the session refresh is queued.

For the delayed session refreshes if a session refresh
did not result in a topology change the attempt would
be immediately stopped and no other delayed requests would
be processed.

The code will now go through the entire delayed requests
queue until a delayed request results in a request
actually being sent.

ASTERISK-28730

Change-Id: Ied640280133871f77d3f332be62265e754605088
(cherry picked from commit b438d1d9adc8c5200214e41876e9abc02c5b5288)

5 years agobridging: Add better support for adding/removing streams.
Joshua C. Colp [Sun, 5 Jan 2020 00:11:20 +0000 (00:11 +0000)] 
bridging: Add better support for adding/removing streams.

This change adds support to bridge_softmix to allow the addition
and removal of additional video source streams. When such a change
occurs each participant is renegotiated as needed to reflect the
update. If another video source is added then each participant
gets another source. If a video source is removed then it is
removed from each participant. This functionality allows you to
have both your webcam and screenshare providing video if you
desire, or even more streams. Mapping has been changed to use
the topology index on the source channel as a unique identifier
for outgoing participant streams, this will never change and
provides an easy way to establish the mapping.

The bridge_simple and bridge_native_rtp modules have also been
updated to renegotiate when the stream topology of a party changes
allowing the same behavior to occur as added to bridge_softmix.
If a screen share is added then the opposite party is renegotiated.
If that screen share is removed then the opposite party is
renegotiated again.

Some additional fixes are also included in here. Stream state is
now conveyed in SDP so sendonly/recvonly/inactive streams can
be requested. Removed streams now also remove previous state
from themselves so consumers don't get confused.

ASTERISK-28733

Change-Id: I93f41fb41b85646bef71408111c17ccea30cb0c5

5 years agoUpdate for certified/16.8-cert1-rc2 certified/16.8-cert1-rc2
Asterisk Development Team [Wed, 19 Feb 2020 14:24:32 +0000 (09:24 -0500)] 
Update for certified/16.8-cert1-rc2

5 years agores_pjsip_outbound_registration: Fix SRV failover on timeout
George Joseph [Thu, 13 Feb 2020 19:39:58 +0000 (12:39 -0700)] 
res_pjsip_outbound_registration: Fix SRV failover on timeout

In order to retry outbound registrations for some situations, we
need access to the tdata from the original request.  For instance,
for 401/407 responses we need it to properly construct the
subsequent request with the authentication.  We also need it if
we're iterating over a DNS SRV response record set so we can skip
entries we've already tried.

We've been getting the tdata from the server response rdata and
transaction but that only works for the failures where there was
actually a response (4XX, 5XX, etc).  For timeouts there's no
response and therefore no rdata or transaction from which to get
the tdata.  When processing a single A/AAAA record for a server,
this wasn't an issue as we just retried that same server after the
retry timer expired.  If we got an SRV record set for the server
though, without the state from the tdata, we just kept trying the
first entry in the set repeatedly instead of skipping to the next
one in the list.

* Added a "last_tdata" member to the client state structure to keep
  track of the sent tdata.

* Updated registration_client_send() to save the tdata it used into
  the client_state.

* Updated sip_outbound_registration_response_cb() to use the tdata
  saved in client_state when we don't get a response from the
  server. We still use the tdata from the transaction when we DO
  get a response from the server so we can properly handle 4XX
  responses where our new request depends on it.

General note on timeouts:

Although res_pjsip_outbound_registration skips to the next record
immediately when a timeout occurs during SRV set traversal, it's
pjproject that determines how long to wait before a timeout is
declared.  As with other SIP message types, pjproject will continue
trying the same server at an interval specified by "timer_t1" until
"timer_b" expires.  Both of those timers are set in the pjsip.conf
"system" section.

ASTERISK-28746

Change-Id: I199b8274392d17661dd3ce3b4d69a3968368fa06

5 years agores_rtp_asterisk: bad audio (static) due to incomplete dtls/srtp setup
Kevin Harwell [Thu, 13 Feb 2020 21:08:10 +0000 (15:08 -0600)] 
res_rtp_asterisk: bad audio (static) due to incomplete dtls/srtp setup

There was a race condition between client initiated DTLS setup, and handling
of server side ice completion that caused the underlying SSL object to get
cleared during DTLS initialization. If this happened Asterisk would be left
in a partial DTLS setup state. RTP packets were sent and received, but were
not being encrypted and decrypted. This resulted in no audio, or static.

Specifically, this occurred when '__rtp_recvfrom' was processing the handshake
sequence from the client to the server, and then 'ast_rtp_on_ice_complete'
gets called from another thread and clears the SSL object when calling the
'dtls_perform_setup' function. The timing had to be just right in the sense
that from the external SSL library perspective SSL initialization completed
(rtp recv), Asterisk clears/resets the SSL object (ice done), and then checks
to see if SSL is intialized (rtp recv). Since it was cleared, Asterisk thinks
it is not finished, thus not completing 'dtls_srtp_setup'.

This patch removes calls to 'dtls_perform_setup', which clears the SSL object,
in 'ast_rtp_on_ice_complete'. When ice completes, there is no reason to clear
the underlying SSL object. If an ice candidate changes a full protocol level
renegotiation occurs. Also, in the case of bundled ICE candidates are reused
when a stream is added. So no real reason to have to clear, and reset in this
instance.

Also, this patch adds a bit of extra logging to aid in diagnosis of any future
problems.

ASTERISK-28742 #close

Change-Id: I34c9e6bad5a39b087164646e2836e3e48fe6892f

5 years agoUpdate for certified/16.8-cert1-rc1 certified/16.8-cert1-rc1
Asterisk Development Team [Fri, 7 Feb 2020 20:42:37 +0000 (15:42 -0500)] 
Update for certified/16.8-cert1-rc1

5 years agoUpdate CHANGES and UPGRADE.txt for certified/16.8-cert1
Asterisk Development Team [Fri, 7 Feb 2020 20:22:59 +0000 (15:22 -0500)] 
Update CHANGES and UPGRADE.txt for certified/16.8-cert1

5 years agodoc: Fix CHANGES entries to have .txt suffix and update READMEs
George Joseph [Fri, 7 Feb 2020 19:44:50 +0000 (12:44 -0700)] 
doc: Fix CHANGES entries to have .txt suffix and update READMEs

Although the wiki page for the new CHANGES and UPGRADE scheme
states that the files must have the ".txt" suffix, the READMEs
didn't.

Change-Id: I490306aa2cc24d6f014738e9ebbc78592efe0f05

5 years agoAsterisk Certified 16.8 Preparation
George Joseph [Wed, 5 Feb 2020 16:37:17 +0000 (09:37 -0700)] 
Asterisk Certified 16.8 Preparation

* Updated .gitreview default branch to certified/16.8
* Updated .version to certified/16.8
* Set all extended support modules to be disabled by default

Change-Id: I11c9b5f33865fb541192a786dc25dddf8558e09b

5 years agoMerge "res_rtp_asterisk: Don't produce transport-cc if no packets." into certified...
Friendly Automation [Wed, 5 Feb 2020 16:01:25 +0000 (10:01 -0600)] 
Merge "res_rtp_asterisk: Don't produce transport-cc if no packets." into certified/16.8

5 years agores_rtp_asterisk: Don't produce transport-cc if no packets.
Joshua C. Colp [Tue, 4 Feb 2020 14:18:13 +0000 (10:18 -0400)] 
res_rtp_asterisk: Don't produce transport-cc if no packets.

The code assumed that when the transport-cc feedback
function was called at least one packet will have been
received. In practice this isn't always true, so now
we just reschedule the sending and do nothing.

Change-Id: Iabe7b358704da446fc3b0596b847bff8b8a0da6a

5 years agomessage.c: Add option to suppress the Message channel AMI and ARI events
George Joseph [Mon, 3 Feb 2020 16:24:58 +0000 (09:24 -0700)] 
message.c: Add option to suppress the Message channel AMI and ARI events

In order to reduce the amount of AMI and ARI events generated,
the global "Message/ast_msg_queue" channel can be set to suppress
it's normal channel housekeeping events such as "Newexten",
"VarSet", etc. This can greatly reduce load on the manager
and ARI applications when the Digium Phone Module for Asterisk
is in use.  To enable, set "hide_messaging_ami_events" in
asterisk.conf to "yes"  In Asterisk versions <18, the default
is "no" preserving existing behavior.  Beginning with
Asterisk 18, the option will default to "yes".

NOTE:  This change does not affect UserEvents or the ARI
TextMessageReceived events.

* Added the "hide_messaging_ami_events" option to asterisk.conf.

* Changed message.c to set the AST_CHAN_TP_INTERNAL property on
  the "Message/ast_msg_queue" channel if the option is set in
  asterisk.conf.  This suppresses the reporting of the events.

Change-Id: Ia2e3516d43f4e0df994fc6598565d6bba2d7018b
(cherry picked from commit bfe9e1b2e7a489b7eb49a98d290f2e3a68a34dca)

5 years agoUpdate for 16.8.0 16.8 16.8.0
Asterisk Development Team [Tue, 4 Feb 2020 15:03:05 +0000 (10:03 -0500)] 
Update for 16.8.0

5 years agoREVERT: Add option to suppress the Message channel AMI and ARI events
Joshua Colp [Tue, 4 Feb 2020 13:35:47 +0000 (07:35 -0600)] 
REVERT: Add option to suppress the Message channel AMI and ARI events

This reverts commit bfe9e1b2e7a489b7eb49a98d290f2e3a68a34dca.

Reason for revert: Per discussion on IRC we're sticking to policy.

Change-Id: I61691a9ffa1bc30807cbe618a4a72b4d214481aa

5 years agomessage.c: Add option to suppress the Message channel AMI and ARI events
George Joseph [Mon, 3 Feb 2020 16:24:58 +0000 (09:24 -0700)] 
message.c: Add option to suppress the Message channel AMI and ARI events

In order to reduce the amount of AMI and ARI events generated,
the global "Message/ast_msg_queue" channel can be set to suppress
it's normal channel housekeeping events such as "Newexten",
"VarSet", etc. This can greatly reduce load on the manager
and ARI applications when the Digium Phone Module for Asterisk
is in use.  To enable, set "hide_messaging_ami_events" in
asterisk.conf to "yes"  In Asterisk versions <18, the default
is "no" preserving existing behavior.  Beginning with
Asterisk 18, the option will default to "yes".

NOTE:  This change does not affect UserEvents or the ARI
TextMessageReceived events.

* Added the "hide_messaging_ami_events" option to asterisk.conf.

* Changed message.c to set the AST_CHAN_TP_INTERNAL property on
  the "Message/ast_msg_queue" channel if the option is set in
  asterisk.conf.  This suppresses the reporting of the events.

Change-Id: Ia2e3516d43f4e0df994fc6598565d6bba2d7018b

5 years agoUpdate for 16.8.0-rc2 16.8.0-rc2
Asterisk Development Team [Thu, 30 Jan 2020 16:36:41 +0000 (11:36 -0500)] 
Update for 16.8.0-rc2

5 years agores_stasis: trigger cleanup after update
Kevin Harwell [Mon, 27 Jan 2020 17:44:45 +0000 (11:44 -0600)] 
res_stasis: trigger cleanup after update

The cleanup code in stasis shuts down applications if they are in a deactivated
state, and no longer have explicit subscriptions. When registering an app the
cleanup code was running before calling 'update'. When it should be executed
after 'update' since a call to register may re-activate the app. We don't want
it to shutdown before the 'update' otherwise the app won't be re-activated,
or registered.

This patch makes it so the cleanup code is executed post 'update'.

ASTERISK-28679 #close

Change-Id: I8f2c0b17e33bb8128441567b97fd4c7bf74a327b
(cherry picked from commit dc9875815c441bcb78370cbf0d331ec46e7abb1d)

5 years agostasis/app: don't lock an app before a call to send
Kevin Harwell [Mon, 27 Jan 2020 18:01:15 +0000 (12:01 -0600)] 
stasis/app: don't lock an app before a call to send

Calling 'app_send' eventually calls the app's message handler. It's possible
for a handler to obtain a lock on another object, and then need/want to lock
the app object. If the caller of 'app_send' locks the app object prior to
calling then there's a potential for a deadlock, if another thread calls
'app_send' without locking.

This patch makes it so 'app_send' is not called with the app object locked in
the section of code doing such.

ASTERISK-28423 #close

Change-Id: I6767c6d0933c7db1b984018966eefca4c0638a27
(cherry picked from commit e103339f02f0445b8c77b1c3c6f7d1c80e37f675)

5 years agores_pjsip_pubsub: Increment persistence data ref when recreating.
Joshua C. Colp [Tue, 28 Jan 2020 15:18:45 +0000 (15:18 +0000)] 
res_pjsip_pubsub: Increment persistence data ref when recreating.

Each subscription needs to have a reference to the persisted data
for it, as well as the main JSON contained within the tree. When
recreating a subscription this did not occur and they both shared
the same reference.

ASTERISK-28714

Change-Id: I706abd49ea182ea367a4ac3feca2706460ae9f4a
(cherry picked from commit 4d32f5747c2db25d63005bbb94ee9d27e09059c2)

5 years agoUpdate for 16.8.0-rc1 16.8.0-rc1
Asterisk Development Team [Thu, 23 Jan 2020 16:40:43 +0000 (11:40 -0500)] 
Update for 16.8.0-rc1

5 years agoUpdate CHANGES and UPGRADE.txt for 16.8.0
Asterisk Development Team [Thu, 23 Jan 2020 16:12:30 +0000 (11:12 -0500)] 
Update CHANGES and UPGRADE.txt for 16.8.0

5 years agoMerge "http: Add ability to disable /httpstatus URI" into 16
Joshua Colp [Thu, 23 Jan 2020 14:47:38 +0000 (08:47 -0600)] 
Merge "http: Add ability to disable /httpstatus URI" into 16

5 years agocdr.c: Set event time on party b when leaving a parking bridge
George Joseph [Wed, 22 Jan 2020 18:56:38 +0000 (11:56 -0700)] 
cdr.c: Set event time on party b when leaving a parking bridge

When Alice calls Bob and Bob does a blind transfer to Charlie,
Bob's bridge leave event generates a finalize on both the party_a
and party_b CDRs but while the party_a CDR has the correct end time
set from the event time, party_b's leg did not. This caused that
CDR's end time to be equal to the answered time and resulted in a
billsec of 0.

* We now pass the bridge leave message event time to
cdr_object_party_b_left_bridge_cb() and set it on that CDR before
calling cdr_object_finalize() on it.

NOTE:  This issue affected transfers using chan_sip most of the
time but also occasionally affected chan_pjsip probably due to
message timing.

ASTERISK-28677
Reported by: Maciej Michno

Change-Id: I790720f1e7326f9b8ce8293028743b0ef0fb2cca

5 years agohttp: Add ability to disable /httpstatus URI
Sean Bright [Wed, 22 Jan 2020 15:39:47 +0000 (10:39 -0500)] 
http: Add ability to disable /httpstatus URI

Add a new configuration option 'enable_status' which allows the
/httpstatus URI handler to be administratively disabled.

We also no longer unconditionally register the /static and /httpstatus
URI handlers, but instead do it based upon configuration.

Behavior change: If enable_static was turned off, the URI handler was
still installed but returned a 403 when it was accessed. Because we
now register/unregister the URI handlers as appropriate, if the
/static URI is disabled we will return a 404 instead.

Additionally:

* Change 'enablestatic' to 'enable_static' but keep the former for
  backwards compatibility.
* Improve some internal variable names

ASTERISK-28710 #close

Change-Id: I647510f796473793b1d3ce1beb32659813be69e1

5 years agoMerge "func_odbc.conf.sample: Add example lookup" into 16
Friendly Automation [Wed, 22 Jan 2020 14:44:18 +0000 (08:44 -0600)] 
Merge "func_odbc.conf.sample: Add example lookup" into 16

5 years agoMerge "res_statsd: Document that res_statsd does nothing on its own" into 16
Friendly Automation [Wed, 22 Jan 2020 14:38:15 +0000 (08:38 -0600)] 
Merge "res_statsd: Document that res_statsd does nothing on its own" into 16

5 years agoMerge "chan_dahdi: Change 999999 to INT_MAX to better reflect "no timeout"" into 16
Friendly Automation [Wed, 22 Jan 2020 13:48:38 +0000 (07:48 -0600)] 
Merge "chan_dahdi: Change 999999 to INT_MAX to better reflect "no timeout"" into 16

5 years agoMerge "translate.c: Fix silk 24kHz truncation in 'core show translation'" into 16
Joshua Colp [Wed, 22 Jan 2020 13:45:41 +0000 (07:45 -0600)] 
Merge "translate.c: Fix silk 24kHz truncation in 'core show translation'" into 16

5 years agoMerge "chan_sip.c: Stop handling continuation lines after reading headers" into 16
Friendly Automation [Tue, 21 Jan 2020 14:27:26 +0000 (08:27 -0600)] 
Merge "chan_sip.c: Stop handling continuation lines after reading headers" into 16

5 years agochan_dahdi: Change 999999 to INT_MAX to better reflect "no timeout"
Andrew Siplas [Sat, 18 Jan 2020 21:54:01 +0000 (16:54 -0500)] 
chan_dahdi: Change 999999 to INT_MAX to better reflect "no timeout"

The no-entry timeout set to 999999 == 16⅔ minutes, change to INT_MAX
to match behavior of "no timeout" defined in comment.

ASTERISK-28702 #close

Change-Id: I4ea015986e061374385dba247b272f7aac60bf11

5 years agotranslate.c: Fix silk 24kHz truncation in 'core show translation'
Sean Bright [Mon, 20 Jan 2020 19:53:46 +0000 (14:53 -0500)] 
translate.c: Fix silk 24kHz truncation in 'core show translation'

SILK @ 24kHz is not shown in the 'core show translation' output because of an
off-by-one-error. Discovered while looking into ASTERISK~19871.

ASTERISK-28706
Reported by: Sean Bright

Change-Id: Ie1a551a8a484e07b45c8699cc0c90f1061029510

5 years agofunc_odbc.conf.sample: Add example lookup
Sean Bright [Mon, 20 Jan 2020 21:26:14 +0000 (16:26 -0500)] 
func_odbc.conf.sample: Add example lookup

Change-Id: Ia05aab1f579597963d2ea23920d2210cfcb97c84

5 years agores_statsd: Document that res_statsd does nothing on its own
Sean Bright [Mon, 20 Jan 2020 17:18:17 +0000 (12:18 -0500)] 
res_statsd: Document that res_statsd does nothing on its own

ASTERISK-24484 #close
Reported by: Dan Jenkins

Change-Id: I05f298904511d6739aefb1486b6fcbee27efa9ec

5 years agoMerge "queue_log: Add alembic script for generate db table for queue_log" into 16
Joshua Colp [Mon, 20 Jan 2020 17:32:32 +0000 (11:32 -0600)] 
Merge "queue_log: Add alembic script for generate db table for queue_log" into 16

5 years agoMerge "app_voicemail, say: Fix various leading whitespace problems" into 16
Joshua Colp [Mon, 20 Jan 2020 15:32:36 +0000 (09:32 -0600)] 
Merge "app_voicemail, say: Fix various leading whitespace problems" into 16

5 years agoMerge "app_voicemail: Prevent crash when saving message with realtime voicemail"...
Friendly Automation [Mon, 20 Jan 2020 15:20:49 +0000 (09:20 -0600)] 
Merge "app_voicemail: Prevent crash when saving message with realtime voicemail" into 16