]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
4 years agoasterisk: Add verbose message stating support status.
Joshua C. Colp [Mon, 12 Oct 2020 10:30:52 +0000 (07:30 -0300)] 
asterisk: Add verbose message stating support status.

This change outputs a message at startup and when a remote
console is connected stating that this branch is no longer
receiving bug fixes and to consult the Asterisk Versions wiki
page for status information.

Change-Id: I6b8a77d33e338a3e52dd65f998d8a07e4d16aa2e

4 years agotcptls.c: Don't close TCP client file descriptors more than once
Sean Bright [Wed, 30 Sep 2020 20:00:36 +0000 (16:00 -0400)] 
tcptls.c: Don't close TCP client file descriptors more than once

ASTERISK-28430 #close

Change-Id: Ib556b0a0c95cca939e956886214ec8d828d89606

4 years agoresource_endpoints.c: memory leak when providing a 404 response
Jean Aunis [Mon, 5 Oct 2020 15:44:04 +0000 (17:44 +0200)] 
resource_endpoints.c: memory leak when providing a 404 response

When handling a send_message request to a non-existing endpoint, the response's
body is overriden and not properly freed.

ASTERISK-29108

Change-Id: Ie1d3d70065f80793445b60f5e4a7eb31b4b9c5c8

4 years agopbx.c: On error, ast_add_extension2_lockopt should always free 'data'
Sean Bright [Tue, 29 Sep 2020 18:04:48 +0000 (14:04 -0400)] 
pbx.c: On error, ast_add_extension2_lockopt should always free 'data'

In the event that the desired extension already exists,
ast_add_extension2_lockopt() will free the 'data' it is passed before
returning an error, so we should not be freeing it ourselves.

Additionally, there were two places where ast_add_extension2_lockopt()
could return an error without also freeing the 'data' pointer, so we
add that.

ASTERISK-29097 #close

Change-Id: I904707aae55169feda050a5ed7c6793b53fe6eae

4 years agoapp_confbridge/bridge_softmix: Add ability to force estimated bitrate
George Joseph [Thu, 24 Sep 2020 18:46:15 +0000 (12:46 -0600)] 
app_confbridge/bridge_softmix:  Add ability to force estimated bitrate

app_confbridge now has the ability to set the estimated bitrate on an
SFU bridge.  To use it, set a bridge profile's remb_behavior to "force"
and set remb_estimated_bitrate to a rate in bits per second.  The
remb_estimated_bitrate parameter is ignored if remb_behavior is something
other than "force".

Change-Id: Idce6464ff014a37ea3b82944452e56cc4d75ab0a

4 years agoapp_voicemail.c: Document VMSayName interruption behavior
Sean Bright [Wed, 30 Sep 2020 00:57:20 +0000 (20:57 -0400)] 
app_voicemail.c: Document VMSayName interruption behavior

ASTERISK-26424 #close

Change-Id: I797ad0ed302d0b3d2c90543eff5b7207ed08ecf0

4 years agochannels: Don't dereference NULL pointer
Jasper van der Neut [Wed, 23 Sep 2020 09:05:39 +0000 (11:05 +0200)] 
channels: Don't dereference NULL pointer

Check result of ast_translator_build_path against NULL before dereferencing.

ASTERISK-29091

Change-Id: Ia3538ea190bd371f70c9dd49984b021765691b29

4 years agores_musiconhold: Load all realtime entries, not just the first
lvl [Mon, 28 Sep 2020 12:42:47 +0000 (14:42 +0200)] 
res_musiconhold: Load all realtime entries, not just the first

ASTERISK-29099

Change-Id: I45636679c0fb5a5f59114c8741626631a604e8a6

4 years agores_pjsip_sdp_rtp: Fix accidentally native bridging calls
Holger Hans Peter Freyther [Wed, 23 Sep 2020 03:39:12 +0000 (11:39 +0800)] 
res_pjsip_sdp_rtp: Fix accidentally native bridging calls

Stop advertising RFC2833 support on the rtp_engine when DTMF mode is
auto but no tel_event was found inside SDP file.

On an incoming call create_rtp will be called and when session->dtmf is
set to AST_SIP_DTMF_AUTO, the AST_RTP_PROPERTY_DTMF will be set without
looking at the SDP file.

Once get_codecs gets called we move the DTMF mode from RFC2833 to INBAND
but continued to advertise RFC2833 support.

This meant the native_rtp bridge would falsely consider the two channels
as compatible. In addition to changing the DTMF mode we now set or
remove the AST_RTP_PROPERTY_DTMF.

The property is checked in ast_rtp_dtmf_compatible and called by
native_rtp_bridge_compatible.

ASTERISK-29051 #close

Change-Id: I1e0c1e324598a437932c0b7836bcb626aba8e287

4 years agores_pjsip_diversion: fix double 181
Torrey Searle [Thu, 24 Sep 2020 14:54:08 +0000 (16:54 +0200)] 
res_pjsip_diversion: fix double 181

Arming response to both AST_SIP_SESSION_BEFORE_REDIRECTING and
AST_SIP_SESSION_BEFORE_MEDIA causes 302 to to be handled twice,
resulting in to 181 being generated.

Change-Id: I866e5461564644ffb8a5e12b6f1330b50a7b63ab

4 years agores_musiconhold: Clarify that playlist mode only supports HTTP(S) URLs
Sean Bright [Thu, 24 Sep 2020 16:47:41 +0000 (12:47 -0400)] 
res_musiconhold: Clarify that playlist mode only supports HTTP(S) URLs

Change-Id: I41e77a04e4a523f4ed61a7a20b738ffd42be441e

4 years agodsp.c: Update calls to ast_format_cmp to check result properly
Sean Bright [Wed, 23 Sep 2020 20:20:48 +0000 (16:20 -0400)] 
dsp.c: Update calls to ast_format_cmp to check result properly

ASTERISK-28311 #close

Change-Id: Ib1ce8fc1a8752751f5bf3615c59245532dfd9aa2

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 agofunc_curl.c: Prevent crash when using CURLOPT(httpheader)
Sean Bright [Fri, 18 Sep 2020 13:09:59 +0000 (09:09 -0400)] 
func_curl.c: Prevent crash when using CURLOPT(httpheader)

Because we use shared thread-local cURL instances, we need to ensure
that the state of the cURL instance is correct before each invocation.

In the case of custom headers, we were not resetting cURL's internal
HTTP header pointer which could result in a crash if subsequent
requests do not configure custom headers.

ASTERISK-29085 #close

Change-Id: I8b4ab34038156dfba613030a45f10e932d2e992d

4 years agores_musiconhold: Start playlist after initial announcement
Sean Bright [Fri, 18 Sep 2020 20:02:27 +0000 (16:02 -0400)] 
res_musiconhold: Start playlist after initial announcement

Only track our sample offset if we are playing a non-announcement file,
otherwise we will skip that number of samples when we start playing the
first MoH file.

ASTERISK-24329 #close

Change-Id: Ib6b3c84fcaa1063889ab38ba7e7fc50050a3ccfc

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 agores_stasis.c: Add compare function for bridges moh container
Michal Hajek [Wed, 16 Sep 2020 13:01:07 +0000 (15:01 +0200)] 
res_stasis.c: Add compare function for bridges moh container

Sometimes not play MOH on bridge.

ASTERISK-29081
Reported-by: Michal Hajek <michal.hajek@daktela.com>
Change-Id: I760c73e0c9be1d340303b5d1c18a00c4759e8232

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.c: Fix build when TEST_FRAMEWORK is not defined
Sean Bright [Tue, 15 Sep 2020 21:16:34 +0000 (17:16 -0400)] 
res_pjsip_session.c: Fix build when TEST_FRAMEWORK is not defined

Change-Id: Id4852c26e9c412af8e37b5dd3c15da9453ad3276

4 years agores_pjsip_diversion: implement support for History-Info
Torrey Searle [Thu, 13 Aug 2020 08:34:55 +0000 (10:34 +0200)] 
res_pjsip_diversion: implement support for History-Info

Implemention of History-Info capable of interworking with Diversion
Header following RFC7544

ASTERISK-29027 #close

Change-Id: I2296369582d4b295c5ea1e60bec391dd1d318fa6

4 years agoformat_cap: Perform codec lookups by pointer instead of name
Sean Bright [Mon, 14 Sep 2020 18:23:27 +0000 (14:23 -0400)] 
format_cap: Perform codec lookups by pointer instead of name

ASTERISK-28416 #close

Change-Id: I069420875ebdbcaada52d92599a5f7de3cb2cdf4

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 agores_stasis.c: Added video_single option for bridge creation
Sungtae Kim [Sun, 30 Aug 2020 20:42:06 +0000 (22:42 +0200)] 
res_stasis.c: Added video_single option for bridge creation

Currently, it was not possible to create bridge with video_mode single.
This made hard to put the bridge in a vidoe_single mode.
So, added video_single option for Bridge creation using the ARI.
This allows create a bridge with video_mode single.

ASTERISK-29055

Change-Id: I43e720e5c83fc75fafe10fe22808ae7f055da2ae

4 years agorealtime: Increased reg_server character size
Sungtae Kim [Mon, 31 Aug 2020 12:21:09 +0000 (14:21 +0200)] 
realtime: Increased reg_server character size

Currently, the ps_contacts table's reg_server column in realtime database type is varchar(20).
This is fine for normal cases, but if the hostname is longer than 20, it returns error and then
failed to register the contact address of the peer.

Normally, 20 characters limitation for the hostname is fine, but with the cloud env.
So, increased the size to 255.

ASTERISK-29056

Change-Id: Iac52c8c35030303cfa551bb39f410b33bffc507d

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 agoUpdate CHANGES and UPGRADE.txt for 17.8.0
Asterisk Development Team [Wed, 9 Sep 2020 14:02:54 +0000 (09:02 -0500)] 
Update CHANGES and UPGRADE.txt for 17.8.0

4 years agores_pjsip_session: Deferred re-INVITE without SDP send a=sendrecv instead of a=sendonly
Patrick Verzele [Tue, 1 Sep 2020 13:43:46 +0000 (14:43 +0100)] 
res_pjsip_session: Deferred re-INVITE without SDP send a=sendrecv instead of a=sendonly

Building on ASTERISK-25854. When the device requests hold by sending SDP with attribute recvonly, asterisk places the session in sendonly mode. When the device later requests to resume the call by using a re-INVITE excluding SDP, asterisk needs to change the sendonly mode to sendrecv again.

Change-Id: I60341ce3d87f95869f3bc6dc358bd3e8286477a6

4 years agoconversions: Add string to signed integer conversion functions
Kevin Harwell [Fri, 28 Aug 2020 21:31:40 +0000 (16:31 -0500)] 
conversions: Add string to signed integer conversion functions

Change-Id: Id603b0b03b78eb84c7fca030a08b343c0d5973f9

4 years agoapp_queue: Fix leave-empty not recording a call as abandoned
Kfir Itzhak [Wed, 26 Aug 2020 09:58:21 +0000 (12:58 +0300)] 
app_queue: Fix leave-empty not recording a call as abandoned

This fixes a bug introduced mistakenly in ASTERISK-25665:
If leave-empty is enabled, a call may sometimes be removed from
a queue without recording it as abandoned.
This causes Asterisk to not generate an abandon event for that
call, and for the queue abandoned counter to be incorrect.

ASTERISK-29043 #close

Change-Id: I1a71b81df78adff59af587f1d8483cf57df430c7

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 agoparking: Copy parker UUID as well.
Joshua C. Colp [Fri, 28 Aug 2020 09:29:23 +0000 (06:29 -0300)] 
parking: Copy parker UUID as well.

When fixing issues uncovered by GCC10 a copy of the parker UUID
was removed accidentally. This change restores it so that the
subscription has the data it needs.

ASTERISK-29042

Change-Id: I7d396a14ea648bd26d3c363dd78e78bd386b544a

4 years agosip_nat_settings: Update script for latest Linux.
Alexander Traud [Wed, 26 Aug 2020 15:43:13 +0000 (17:43 +0200)] 
sip_nat_settings: Update script for latest Linux.

With the latest Linux, 'ifconfig' is not installed on default anymore.
Furthermore, the output of the current net-tools 'ifconfig' changed.
Therefore, parsing failed. This update uses 'ip addr show' instead.
Finally, the service for the external IP changed.

Change-Id: I9b1a7c3f457e3553b50a3e9a55524e40d70245a0

4 years agosamples: Fix keep_alive_interval default in pjsip.conf.
Alexander Traud [Wed, 26 Aug 2020 15:19:55 +0000 (17:19 +0200)] 
samples: Fix keep_alive_interval default in pjsip.conf.

Since ASTERISK_27978 the default is not off but 90 seconds. That change
happened because ASTERISK_27347 disabled the keep-alives in the bundled
PJProject and Asterisk should behave the same as before.

Change-Id: Ie63dc558ade6a5a2b969c30a4bd492d63730dc46

4 years agochan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution
Kevin Harwell [Mon, 24 Aug 2020 21:26:23 +0000 (16:26 -0500)] 
chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution

This patch makes it so if the PJSIP_SEND_SESSION_REFRESH dialplan function
is called on a channel prior to answering a warning is issued and the
function returns unsuccessful.

ASTERISK-28878 #close

Change-Id: I053f767d10cf3b2b898fa9e3e7c35ff07e23c9bb

4 years agopbx: Fix hints deadlock between reload and ExtensionState.
Joshua C. Colp [Thu, 27 Aug 2020 10:31:40 +0000 (07:31 -0300)] 
pbx: Fix hints deadlock between reload and ExtensionState.

When the ExtensionState AMI action is executed on a pattern matched
hint it can end up adding a new hint if one does not already exist.
This results in a locking order of contexts -> hints -> contexts.

If at the same time a reload is occurring and adding its own hint
it will have a locking order of hints -> contexts.

This results in a deadlock as one thread wants a lock on contexts
that the other has, and the other thread wants a lock on hints
that the other has.

This change enforces a hints -> contexts locking order by explicitly
locking hints in the places where a hint is added when queried for.
This matches the order seen through normal adding of hints.

ASTERISK-29046

Change-Id: I49f027f4aab5d2d50855ae937bcf5e2fd8bfc504

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 agores_speech: Bump reference on format object
Nickolay Shmyrev [Fri, 21 Aug 2020 21:53:04 +0000 (23:53 +0200)] 
res_speech: Bump reference on format object

Properly bump reference on format object to avoid memory corruption on double free

ASTERISK-29040 #close

Change-Id: Ic5a7faabfe2ef965ddb024186e1de7ca4542e2a3

4 years agores_pjsip_diversion: handle 181
Torrey Searle [Wed, 22 Jul 2020 08:45:57 +0000 (10:45 +0200)] 
res_pjsip_diversion: handle 181

Adapt the response handler so it also called when 181 is received.
In the case 181 is received, also generate the 181 response.

ASTERISK-29001 #close

Change-Id: I73cfee46a8ca85371280ebdb38674f8fde7510df

4 years agoapp_queue: Member lastpause time reseting
Evandro César Arruda [Fri, 21 Aug 2020 05:05:57 +0000 (02:05 -0300)] 
app_queue: Member lastpause time reseting

This fixes the reseting members lastpause problem when realtime members is being used,
the function rt_handle_member_record was forcing the reset members lastpause because it
does not exist in realtime

ASTERISK-29034 #close

Change-Id: Ic9107e4456732a1f78412a32adb2ef87f5da40b5

4 years agoapp_voicemail: Process urgent messages with mailcmd
Sean Bright [Fri, 21 Aug 2020 14:17:59 +0000 (10:17 -0400)] 
app_voicemail: Process urgent messages with mailcmd

Rather than putting messages into INBOX and then moving them to Urgent
later, put them directly in to the Urgent folder. This prevents
mailcmd from being skipped.

ASTERISK-27273 #close

Change-Id: I49934e093290d308506ab8d45a40ef705c5ae4f5

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 agobridge_channel: Ensure text messages are zero terminated
Sean Bright [Wed, 19 Aug 2020 17:29:51 +0000 (13:29 -0400)] 
bridge_channel: Ensure text messages are zero terminated

T.140 data in RTP is not zero terminated, so when we are queuing a text
frame on a bridge we need to ensure that we are passing a zero
terminated string.

ASTERISK-28974 #close

Change-Id: Ic10057387ce30b2094613ea67e3ae8c5c431dda3

4 years agores_musiconhold.c: Use ast_file_read_dir to scan MoH directory
Sean Bright [Fri, 7 Aug 2020 14:31:01 +0000 (10:31 -0400)] 
res_musiconhold.c: Use ast_file_read_dir to scan MoH directory

Two changes of note in this patch:

* Use ast_file_read_dir instead of opendir/readdir/closedir

* If the files list should be sorted, do that at the end rather than as
  we go which improves performance for large lists

Change-Id: Ic7e9c913c0f85754c99c74c9cf6dd3514b1b941f

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 agochan_sip: Clear ToHost property on peer when changing to dynamic host
Dennis Buteyn [Tue, 18 Feb 2020 12:30:31 +0000 (14:30 +0200)] 
chan_sip: Clear ToHost property on peer when changing to dynamic host

The ToHost parameter was not cleared when a peer's host value was
changed to dynamic. This causes invites to be sent to the original host.

ASTERISK-29011 #close

Change-Id: I9678d512741f71baca8f131a65b7523020b07d5c

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: 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 agores_musiconhold.c: Prevent crash with realtime MoH
Sean Bright [Thu, 6 Aug 2020 16:41:33 +0000 (12:41 -0400)] 
res_musiconhold.c: Prevent crash with realtime MoH

The MoH class internal file vector is potentially being manipulated by
multiple threads at the same time without sufficient locking. Switch to
a reference counted list and operate on copies where necessary.

ASTERISK-28927 #close

Change-Id: I479c5dcf88db670956e8cac177b5826c986b0217

4 years agovector.h: Fix implementation of AST_VECTOR_COMPACT() for empty vectors
Sean Bright [Tue, 4 Aug 2020 15:51:16 +0000 (11:51 -0400)] 
vector.h: Fix implementation of AST_VECTOR_COMPACT() for empty vectors

The assumed behavior of realloc() - that it was effectively a free() if
its second argument was 0 - is Linux specific behavior and is not
guaranteed by either POSIX or the C specification.

Instead, if we want to resize a vector to 0, do it explicitly.

Change-Id: Ife31d4b510ebab41cb5477fdc7ea4e3138ca8b4f

5 years agopjproject: clone sdp to protect against (nat) modifications
Michael Neuhauser [Tue, 30 Jun 2020 15:40:41 +0000 (17:40 +0200)] 
pjproject: clone sdp to protect against (nat) modifications

PJSIP, UDP transport with external_media_address and session timers
enabled. Connected to SIP server that is not in local net. Asterisk
initiated the connection and is refreshing the session after 150s
(timeout 300s). The 2nd refresh-INVITE triggered by the pjsip timer has
a malformed IP address in its SDP (garbage string). This only happens
when the SDP is modified by the nat-code to replace the local IP address
with the configured external_media_address.
Analysis: the code to modify the SDP (in
res_pjsip_session.c:session_outgoing_nat_hook() and also (redundantly?)
in res_pjsip_sdp_rtp.c:change_outgoing_sdp_stream_media_address()) uses
the tdata->pool to allocate the replacement string. But the same
pjmedia_sdp_stream that was modified for the 1st refresh-INVITE is also
used for the 2nd refresh-INVITE (because it is stored in pjmedia's
pjmedia_sdp_neg structure). The problem is, that at that moment, the
tdata->pool that holds the stringified external_media_address from the
1. refresh-INVITE has long been reused for something else.
Fix by Sauw Ming of pjproject (see
https://github.com/pjsip/pjproject/pull/2476): the local, potentially
modified pjmedia_sdp_stream is cloned in
pjproject/source/pjsip/src/pjmedia/sip_neg.c:process_answer() and the
clone is stored, thereby detaching from the tdata->pool (which is only
released *after* process_answer())

ASTERISK-28973
Reported-by: Michael Neuhauser
Change-Id: I272ac22436076596e06aa51b9fa23fd1c7734a0e

5 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

5 years agoutf8.c: Add UTF-8 validation and utility functions
Sean Bright [Mon, 13 Jul 2020 20:06:14 +0000 (16:06 -0400)] 
utf8.c: Add UTF-8 validation and utility functions

There are various places in Asterisk - specifically in regards to
database integration - where having some kind of UTF-8 validation would
be beneficial. This patch adds:

* Functions to validate that a given string contains only valid UTF-8
  sequences.

* A function to copy a string (similar to ast_copy_string) stopping when
  an invalid UTF-8 sequence is encountered.

* A UTF-8 validator that allows for progressive validation.

All of this is based on the excellent UTF-8 decoder by Björn Höhrmann.
More information is available here:

    https://bjoern.hoehrmann.de/utf-8/decoder/dfa/

The API was written in such a way that should allow us to replace the
implementation later should we determine that we need something more
comprehensive.

Change-Id: I3555d787a79e7c780a7800cd26e0b5056368abf9

5 years agores_pjsip_registrar: Don't specify an expiration for static contacts.
Joshua C. Colp [Wed, 22 Jul 2020 09:41:59 +0000 (06:41 -0300)] 
res_pjsip_registrar: Don't specify an expiration for static contacts.

Statically configured contacts on an AOR don't have an expiration
time so when adding them to the resulting 200 OK if an endpoint
registers ensure they are marked as such.

ASTERISK-28995

Change-Id: I9f0e45eb2ccdedc9a0df5358634a19ccab0ad596

5 years agostasis_bridge.c: Fixed wrong video_mode shown
sungtae kim [Fri, 10 Jul 2020 23:14:53 +0000 (01:14 +0200)] 
stasis_bridge.c: Fixed wrong video_mode shown

Currently, if the bridge has created by the ARI, the video_mode
parameter was
not shown in the BridgeCreated event correctly.

Fixed it and added video_mode shown in the 'bridge show <bridge id>'
cli.

ASTERISK-28987

Change-Id: I8c205126724e34c2bdab9380f523eb62478e4295

5 years agovector.h: Add AST_VECTOR_SORT()
Sean Bright [Mon, 20 Jul 2020 18:17:45 +0000 (14:17 -0400)] 
vector.h: Add AST_VECTOR_SORT()

Allows a vector to be sorted in-place, rather than only during
insertion.

Change-Id: I22cba9ddf556a7e44dacc53c4431bd81dd2fa780

5 years agoCI: Force publishAsteriskDocs to use python2
George Joseph [Thu, 16 Jul 2020 13:41:16 +0000 (07:41 -0600)] 
CI: Force publishAsteriskDocs to use python2

Change-Id: I7d951e75ad2d472fa096647dfb55670b11105e23

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 agopjsip: Include timer patch to prevent cancelling timer 0.
Joshua C. Colp [Mon, 13 Jul 2020 09:41:22 +0000 (06:41 -0300)] 
pjsip: Include timer patch to prevent cancelling timer 0.

I noticed this while looking at another issue and brought
it up with Teluu. It was possible for an uninitialized timer
to be cancelled, resulting in the invalid timer id of 0
being placed into the timer heap causing issues.

This change is a backport from the pjproject repository
preventing this from happening.

Change-Id: I1ba318b1f153a6dd7458846396e2867282b428e7

5 years agoacl.c: Coerce a NULL pointer into the empty string
Sean Bright [Mon, 13 Jul 2020 20:42:40 +0000 (16:42 -0400)] 
acl.c: Coerce a NULL pointer into the empty string

If an ACL is misconfigured in the realtime database (for instance, the
"rule" is blank) and Asterisk attempts to read the ACL, Asterisk will
crash.

ASTERISK-28978 #close

Change-Id: Ic1536c4df856231bfd2da00128f7822224d77610

5 years agores_http_websocket: Avoid reading past end of string
Nickolay Shmyrev [Thu, 2 Jul 2020 22:19:50 +0000 (00:19 +0200)] 
res_http_websocket: Avoid reading past end of string

We read beyond the end of the buffer when copying the string out of the
buffer when we used ast_copy_string() because the original string was
not null terminated. Instead switch to ast_strndup() which does not
exhibit the same behavior.

ASTERISK-28975 #close

Change-Id: Ib4a75cffeb1eb8cf01136ef30306bd623e531a2a

5 years agoUpdate CHANGES and UPGRADE.txt for 17.6.0
Asterisk Development Team [Thu, 9 Jul 2020 15:30:47 +0000 (10:30 -0500)] 
Update CHANGES and UPGRADE.txt for 17.6.0

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

5 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

5 years agores_pjsip.c: Added disable_rport option for pjsip.conf
sungtae kim [Tue, 23 Jun 2020 23:27:47 +0000 (01:27 +0200)] 
res_pjsip.c: Added disable_rport option for pjsip.conf

Currently when the pjsip making an outgoing request, it keep adding the
rport parameter in a request message as a default.

This causes unexpected rport handle at the other end.

Added option for disable this behaviour in the pjsip.conf.

This is a system option, but working as a gloabl option.

ASTERISK-28959

Change-Id: I9596675e52a742774738b5aad5d1fec32f477abc

5 years agores_http_websocket.c: Continue reading after ping/pong
Nickolay Shmyrev [Mon, 22 Jun 2020 17:16:15 +0000 (19:16 +0200)] 
res_http_websocket.c: Continue reading after ping/pong

Do not return error if the client received ping frame
while looking for a string and just wait for another frame.

ASTERISK-28958 #close

Change-Id: I4d06b4827bd71e56cbaafc011ffdcef9f0332922

5 years agoPJSIP_MEDIA_OFFER: override configuration on refresh
Kevin Harwell [Tue, 30 Jun 2020 16:08:47 +0000 (11:08 -0500)] 
PJSIP_MEDIA_OFFER: override configuration on refresh

When using the PSJIP_MEDIA_OFFER dialplan function it was not
overriding an endpoint's configured codecs on refresh unless
they had a shared codec between the two.

This patch makes it so whatever is set using PJSIP_MEDIA_OFFER
is used when creating the SDP for a refresh no matter what.

ASTERISK-28878 #close

Change-Id: I0f7dc86fd0fb607c308e6f98ede303c54d1eacb6

5 years agomanager - Add Content-Type parameter to the SendText action
Kevin Harwell [Wed, 10 Jun 2020 22:01:11 +0000 (17:01 -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

5 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

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 agomenuselect: Resolve infinite loop in dependency scenario.
Joshua C. Colp [Wed, 24 Jun 2020 10:25:47 +0000 (07:25 -0300)] 
menuselect: Resolve infinite loop in dependency scenario.

Given a scenario where a module has a dependency on both
an external library and a module if the external library was
available and the module was not an infinite loop would
occur. This happened due to the code changing the dependecy
status to no failure on each dependency checking loop
iteration, resulting in the code thinking that it had
gone from no failure to failure each time triggering another
dependency check.

This change makes it so that the old dependency status is
preserved throughout the dependency checking allowing it to
determine that after the first iteration the dependency
status does not transition from no failure to failure.

ASTERISK-28930

Change-Id: Iea06d45d9fd6d8bfd068882a0bb7e23a53ec3e84

5 years agochan_pjsip: don't use PJSIP_SC_NULL as it only exists pjproject 2.8+
Kevin Harwell [Mon, 22 Jun 2020 20:27:32 +0000 (15:27 -0500)] 
chan_pjsip: don't use PJSIP_SC_NULL as it only exists pjproject 2.8+

A patch made a reference to the PJSIP_SC_NULL enumeration value, which
was added to pjproject 2.8 and above thus making it so Asterisk would
fail to compile with prior versions of pjproject.

This patch removes the reference, and instead initializes the value
to '0'.

ASTERISK-28886 #close

Change-Id: I68491c80da1a0154b2286c9458440141c98db9d7

5 years agochan_sip: chan_sip does not process 400 response to an INVITE.
Frederic LE FOLL [Mon, 22 Jun 2020 09:08:47 +0000 (11:08 +0200)] 
chan_sip: chan_sip does not process 400 response to an INVITE.

chan_sip handle_response() function, for a 400 response to an INVITE,
calls handle_response_invite() and does not generate ACK.
handle_response_invite() does not recognize 400 response and has no
default response processing for unexpected responses, thus it does not
generate ACK either.
The ACK on response repetition comes from handle_response() mechanism
"We must re-send ACKs to re-transmitted final responses".

According to code history, 400 response specific processing was
introduced with commit
"channels/chan_sip: Add improved support for 4xx error codes"
This commit added support for :
- 400/414/493 in handle_response_subscribe() handle_response_register()
  and handle_response().
- 414/493 only in handle_response_invite().

This fix adds 400 response support in handle_response_invite().

ASTERISK-28957

Change-Id: Ic71a087e5398dfc7273946b9ec6f9a36960218ad

5 years agores_corosync: Fix crash in huge distributed environment.
Università di Bologna - CESIA VoIP [Wed, 3 Jun 2020 10:05:20 +0000 (12:05 +0200)] 
res_corosync: Fix crash in huge distributed environment.

1) Fix memory-leaks
   Added code to release ast_events extracted from corosync and stasis messages

2) Clean stasis cache when a member of the corosync cluster leaves the group
   Added code to remove from the stasis cache of the members remained on the
   group all the messages with the EID of the left member.
   If the device states of the left member remain in the stasis cache of other
   members, they will not be updated anymore and high priority cached values,
   like BUSY, will take precedence over current device states.

3) Stop corosync event propagation when node is not joined to the group
   Updated dispatch_thread_handler code to detect when asterisk is not joined
   to the corosync group and added some condition in publish_event_to_corosync
   code to send corosync messages only when joined.
   When a node is not joined its corosync daemon can't send messages:
   the cpg_mcast_joined function append new messages to the FIFO buffer until
   it's full and then it blocks indefinitely.
   In this scenario if the stasis_message_cb callback, registered by
   res_corosync to handle stasis messages, try to send a corosync messages,
   the thread of the stasis thread-pool will be blocked until the node join
   the corosync cluster.

ASTERISK-28888
Reported by: Università di Bologna - CESIA VoIP

Change-Id: Ie8e99bc23f141a73c13ae6fb1948d148d4de17f2

5 years agores_http_websocket: Add payload masking to the websocket client
Moises Silva [Sat, 13 Jun 2020 16:29:13 +0000 (16:29 +0000)] 
res_http_websocket: Add payload masking to the websocket client

ASTERISK-28949

Change-Id: Id465030f2b1997b83d408933fdbabe01827469ca

5 years agochan_dadhi: Fix setvar in dahdi channels
Guido Falsi [Thu, 18 Jun 2020 10:14:26 +0000 (12:14 +0200)] 
chan_dadhi: Fix setvar in dahdi channels

The change to how setvar works for various channels performed in
ASTERISK~23756 missed some required change in the dahdi channel,
where the variables are actually set while reading configuration.
This change should fix the issue.

ASTERISK-28955

Change-Id: Ibfeb7f8cbdd735346dc4028de6a265f24f9df274

5 years agoapp_stream_echo: Fix state of added streams.
Joshua C. Colp [Thu, 18 Jun 2020 08:49:37 +0000 (05:49 -0300)] 
app_stream_echo: Fix state of added streams.

When stream support was added to Asterisk the stream state
was used inconsistently, resulting in odd behavior. This
was then standardized to be the state of a stream from the
perspective of Asterisk.

This change updates the StreamEcho dialplan application
to use the correct state, send only, since we are only
sending to the endpoint and not expecting them to send us
multiple video streams.

ASTERISK-28954

Change-Id: I35bfd533ef1184ffe62586b22bbd253c82872a56

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 agores_sorcery_memory_cache: Disallow per-object expire with full backend.
Joshua C. Colp [Wed, 10 Jun 2020 09:35:50 +0000 (06:35 -0300)] 
res_sorcery_memory_cache: Disallow per-object expire with full backend.

The AMI action and CLI command did not take into account the properties
of full backend caching. This resulted in an expired object remaining
removed until a full backend update occurred, instead of having the
object updated when needed.

This change makes it so that the AMI action and CLI command for object
expire will now fail instead of putting the cache into an undesired
state. If full backend caching is enabled then only operations
which act on the entire cache are available.

ASTERISK-28942

Change-Id: Id662d888f177ab566c8e802ad583083b742d21f4

5 years agoapp_queue: Read latest wrapuptime instead of (possibly stale) copy
Walter Doekes [Tue, 16 Jun 2020 13:18:11 +0000 (15:18 +0200)] 
app_queue: Read latest wrapuptime instead of (possibly stale) copy

Before this changeset, it was possible that a queue member (agent) was
called even though they just got out of a call, and wrapuptime seconds
hadn't passed yet.

This could happen if a member ended a call _between_ a new call attempt
and asterisk trying that particular member for a new call.

In that case, Asterisk would check the hangup time of the
call-before-the-last-call instead of the hangup time of the-last-call.

ASTERISK-28952

Change-Id: Ie0cab8f0e8d639c01cba633d4968ba19873d80b3

5 years agoapp_queue: Remove stale code in try_calling
Walter Doekes [Mon, 15 Jun 2020 11:53:31 +0000 (13:53 +0200)] 
app_queue: Remove stale code in try_calling

Because ring_entry() is not called, outgoing->chan is not touched here
either.

ASTERISK-28950
ASTERISK-28644

Change-Id: I564613715dfaf45af868251eb75a451f512af90f

5 years agores_pjsip: Include <pjsip_ua.h> instead of internal "pjsua-lib/pjsua.h"
Walter Doekes [Mon, 15 Jun 2020 12:09:19 +0000 (14:09 +0200)] 
res_pjsip: Include <pjsip_ua.h> instead of internal "pjsua-lib/pjsua.h"

Change-Id: I24b5453df412232cf7f9a171ea4a34b35ad3ae78

5 years agopjproject: Upgrade bundled version to pjproject 2.10
Kevin Harwell [Fri, 15 May 2020 21:08:20 +0000 (16:08 -0500)] 
pjproject: Upgrade bundled version to pjproject 2.10

This patch makes the usual necessary changes when upgrading to a new
version pjproject. For instance, version number bump, patches removed
from third-party, new *.md5 file added, etc..

This patch also includes a change to the Asterisk pjproject Makefile to
explicitly create the 'source/pjsip-apps/lib' directory. This directory
is no longer there by default so needs to be added so the Asterisk
malloc debug can be built.

This patch also includes some minor changes to Asterisk that were a result
of the upgrade. Specifically, there was a backward incompatibility change
made in 2.10 that modified the "expires header" variable field from a
signed to an unsigned value. This potentially effects comparison. Namely,
those check for a value less than zero. This patch modified a few locations
in the Asterisk code that may have been affected.

Lastly, this patch adds a new macro PJSIP_MINVERSION that can be used to
check a minimum version of pjproject at compile time.

ASTERISK-28899 #close

Change-Id: Iec8821c6cbbc08c369d0e3cd2f14e691b41d0c81

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_ari: Fix create channel request channelId parameter parsing
sungtae kim [Fri, 12 Jun 2020 10:16:14 +0000 (10:16 +0000)] 
res_ari: Fix create channel request channelId parameter parsing

If channelId parameters were passed in the body, the Asterisk doesn't parsing it correctly.

Fixed it to parse the channelId, other_channel_id parameter correclty.

ASTERISK-28948

Change-Id: I59b49161a94869169ee19c1ffab5afcef7026157

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 agores_fax: Don't start a gateway if either channel is hung up
George Joseph [Wed, 3 Jun 2020 16:23:31 +0000 (10:23 -0600)] 
res_fax: Don't start a gateway if either channel is hung up

When fax_gateway_framehook is called and a gateway hasn't already
been started, the framehook gets the t38 state for both the current
channel and the peer.  That call trickles down to the channel
driver which determines the state.  If either channel is hung up
(or in the process of being hung up), the channel driver's tech_pvt
is going to be NULL which, in the case of chan_pjsip, will cause a
segfault.

* Added a hangup check for both the channel and peer channel
  before starting a fax gateway.

* Added a check for NULL tech_pvt to chan_pjsip_queryoption
  so we don't attempt to reference a tech_pvt that's already
  gone.

ASTERISK-28923
Reported by: Yury Kirsanov

Change-Id: I4e10e63b667bbb68c1c8623f977488f5d807897c

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 agocli.c: Fix compiler error.
Ben Ford [Mon, 8 Jun 2020 19:34:10 +0000 (14:34 -0500)] 
cli.c: Fix compiler error.

Added default variable value to fix a compiler error.

Change-Id: I7b592adbb1274dc5464dea1c5e5de0685c928553

5 years agoCompiler fixes for gcc 10
Kevin Harwell [Mon, 1 Jun 2020 23:25:48 +0000 (18:25 -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 agores_ari: Fix create request body parameter parsing.
sungtae kim [Tue, 9 Jun 2020 11:57:24 +0000 (11:57 +0000)] 
res_ari: Fix create request body parameter parsing.

If parameters were passed in the body as JSON to the
create route they were not being parsed before checking
to ensure that required fields were set.

This change moves the parsing so it occurs before
checking.

ASTERISK-28940

Change-Id: I898b4c3c7ae1cde19a6840e59f498822701cf5cf

5 years agobridge_channel: Don't queue unmapped frames.
Joshua C. Colp [Fri, 5 Jun 2020 09:45:18 +0000 (06:45 -0300)] 
bridge_channel: Don't queue unmapped frames.

If a frame is written to a channel in a bridge we
would normally queue this frame up and the channel
thread would then act upon it. If this frame had no
stream mapping on the channel it would then be
discarded.

This change adds a check before the queueing occurs
to determine if a mapping exists. If it does not
exist then the frame is not even queued at all. This
stops a frame duplication from happening and from
the channel thread having to wake up and deal with
it.

Change-Id: I17189b9b1dec45fc7e4490e8081d444a25a00bda

5 years agopjsip: Prevent invalid memory access when attempting to contact a non-sip URI
Walter Doekes [Fri, 5 Jun 2020 09:30:29 +0000 (11:30 +0200)] 
pjsip: Prevent invalid memory access when attempting to contact a non-sip URI

You cannot cast a pjsip_uri to a pjsip_sip_uri using pjsip_uri_get_uri,
without checking that it's a PJSIP_URI_SCHEME_IS_SIP(S).

ASTERISK-28936

Change-Id: I9f572b3677e4730458e9402719e580f8681afe2a

5 years agores_fax: Don't consume frames given to fax gateway on write.
Joshua C. Colp [Wed, 27 May 2020 08:47:07 +0000 (05:47 -0300)] 
res_fax: Don't consume frames given to fax gateway on write.

In a particular fax gateway scenario whereby it would
have to translate using the read translation path on a
channel the frame being translated would be consumed.
When the frame is in the write path it is not permitted
to free the frame as the caller expects it to continue
to exist.

This change makes it so that the frame is only consumed
on the read path where it is acceptable to free it.

ASTERISK-28900

Change-Id: I011c321288a1b056d92b37c85e229f4a28ee737d

5 years agopjproject_bundled: Honor --without-pjproject.
Alexander Traud [Tue, 2 Jun 2020 11:24:11 +0000 (13:24 +0200)] 
pjproject_bundled: Honor --without-pjproject.

The previous change missed that 'make' uses 'PJPROJECT_BUNDLED' anyway.

ASTERISK-28929

Change-Id: I7ef0e78a06ea391b59d95b99d46bbed3fec4fed9

5 years agores_pjsip_logger: use the correct pointer when logging tx_messages to pcap
Pirmin Walthert [Thu, 4 Jun 2020 06:50:35 +0000 (08:50 +0200)] 
res_pjsip_logger: use the correct pointer when logging tx_messages to pcap

When writing tx messages to pcap files, Asterisk is using the wrong
pointer resulting in lots of wasted space. This patch fixes it to use
the correct pointer.

ASTERISK-28932 #close

Change-Id: I5b8253dd59a083a2ca2c81f232f1d14d33c6fd23