]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
4 years agojitterbuffer: Correct signed/unsigned mismatch causing assert
George Joseph [Thu, 17 Jun 2021 12:57:11 +0000 (06:57 -0600)] 
jitterbuffer:  Correct signed/unsigned mismatch causing assert

If the system time has stepped backwards because of a time
adjustment between the time a frame is timestamped and the
time we check the timestamps in abstract_jb:hook_event_cb(),
we get a negative interval, but we don't check for that there.
abstract_jb:hook_event_cb() then calls
fixedjitterbuffer:fixed_jb_get() (via abstract_jb:jb_get_fixed)
and the first thing that does is assert(interval >= 0).

There are several issues with this...

 * abstract_jb:hook_event_cb() saves the interval in a variable
   named "now" which is confusing in itself.

 * "now" is defined as an unsigned int which converts the negative
   value returned from ast_tvdiff_ms() to a large positive value.

 * fixed_jb_get()'s parameter is defined as a signed int so the
   interval gets converted back to a negative value.

 * fixed_jb_get()'s assert is NOT an ast_assert but a direct define
   that points to the system assert() so it triggers even in
   production mode.

So...

 * hook_event_cb()'s "now" was renamed to "relative_frame_start" and
   changed to an int64_t.
 * hook_event_cb() now checks for a negative value right after
   retrieving both the current and framedata timestamps and just
   returns the frame if the difference is negative.
 * fixed_jb_get()'s local define of ASSERT() was changed to call
   ast_assert() instead of the system assert().

ASTERISK-29480
Reported by: Dan Cropp

Change-Id: Ic469dec73c2edc3ba134cda6721a999a9714f3c9

4 years agoapp_dial: Expanded A option to add caller announcement
Naveen Albert [Sat, 22 May 2021 00:08:58 +0000 (20:08 -0400)] 
app_dial: Expanded A option to add caller announcement

Hitherto, the A option has made it possible to play
audio upon answer to the called party only. This option
is expanded to allow for playback of an audio file to
the caller instead of or in addition to the audio
played to the answerer.

ASTERISK-29442

Change-Id: If6eed3ff5c341dc8c588c8210987f2571e891e5e

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

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

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

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

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

ASTERISK-29485

Change-Id: I066bfc987a3ad6f0ccc88e0af4cd63f6a4729133

4 years agores_pjsip_sdp_rtp: Evaluate remotely held for Session Progress
Bernd Zobl [Fri, 7 May 2021 06:18:40 +0000 (08:18 +0200)] 
res_pjsip_sdp_rtp: Evaluate remotely held for Session Progress

With the fix for ASTERISK_28754 channels are no longer put on hold if an
outbound INVITE is answered with a "Session Progress" containing
"inactive" audio.

The previous change moved the evaluation of the media attributes to
`negotiate_incoming_sdp_stream()` to have the `remotely_held` status
available when building the SDP in `create_outgoing_sdp_stream()`.
This however means that an answer to an outbound INVITE, which does not
traverse `negotiate_incoming_sdp_stream()`, cannot set the
`remotely_held` status anymore.

This change moves the check so that both, `negotiate_incoming_sdp_stream()` and
`apply_negotiated_sdp_stream()` can do the checks.

ASTERISK-29479

Change-Id: Icde805a819399d5123b688e1ed1d2bcd9d5b0f75

4 years agoUpdate CHANGES and UPGRADE.txt for 18.5.0
Asterisk Development Team [Thu, 17 Jun 2021 14:39:40 +0000 (09:39 -0500)] 
Update CHANGES and UPGRADE.txt for 18.5.0

4 years agores_pjsip_messaging: Overwrite user in existing contact URI
George Joseph [Wed, 16 Jun 2021 13:50:54 +0000 (07:50 -0600)] 
res_pjsip_messaging: Overwrite user in existing contact URI

When the MessageSend destination is in the form
PJSIP/<number>@<endpoint> and the endpoint's contact
URI already has a user component, that user component
will now be replaced with <number> when creating the
request URI.

ASTERISK_29404

Change-Id: I80e5910fa25c803d1440da0594a0d6b34b6b4ad5

4 years agores_pjsip/pjsip_message_filter: set preferred transport in pjsip_message_filter
Bernd Zobl [Tue, 16 Mar 2021 16:45:23 +0000 (17:45 +0100)] 
res_pjsip/pjsip_message_filter: set preferred transport in pjsip_message_filter

Set preferred transport when querying the local address to use in
filter_on_tx_messages(). This prevents the module to erroneously select
the wrong transport if more than one transports of the same type (TCP or
TLS) are configured.

ASTERISK-29241

Change-Id: I598e60257a7f92b29efce1fb3e9a2fc06f1439b6

4 years agopbx_builtins: Corrects SayNumber warning
Naveen Albert [Thu, 10 Jun 2021 14:34:53 +0000 (10:34 -0400)] 
pbx_builtins: Corrects SayNumber warning

Previously, SayNumber always emitted a warning if the caller hung up
during execution. Usually this isn't correct, so check if the channel
hung up and, if so, don't emit a warning.

ASTERISK-29475

Change-Id: Ieea4a67301c6ea83bbc7690c1d4808d79a704594

4 years agofunc_lock: Prevent module unloading in-use module.
Jaco Kroon [Sat, 22 May 2021 12:53:43 +0000 (14:53 +0200)] 
func_lock: Prevent module unloading in-use module.

The scenario where a channel still has an associated datastore we
cannot unload since there is a function pointer to the destroy and fixup
functions in play.  Thus increase the module ref count whenever we
allocate a datastore, and decrease it during destroy.

In order to tighten the race that still exists in spite of this (below)
add some extra failure cases to prevent allocations in these cases.

Race:

If module ref is zero, an LOCK or TRYLOCK is invoked (near)
simultaneously on a channel that has NOT PREVIOUSLY taken a lock, and if
in such a case the datastore is created *prior* to unloading being set
to true (first step in module unload) then it's possible that the module
will unload with the destructor being called (and segfault) post the
module being unloaded.  The module will however wait for such locks to
release prior to unloading.

If post that we can recheck the module ref before returning the we can
(in theory, I think) eliminate the last of the race.  This race is
mostly theoretical in nature.

Change-Id: I21a514a0b56755c578a687f4867eacb8b59e23cf
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
4 years agofunc_lock: Add "dialplan locks show" cli command.
Jaco Kroon [Sat, 22 May 2021 12:29:22 +0000 (14:29 +0200)] 
func_lock: Add "dialplan locks show" cli command.

For example:

arthur*CLI> dialplan locks show
func_lock locks:
Name                                     Requesters Owner
uls-autoref                              0          (unlocked)
1 total locks listed.

Obviously other potentially useful stats could be added (eg, how many
times there was contention, how many times it failed etc ... but that
would require keeping the stats and I'm not convinced that's worth the
effort.  This was useful to troubleshoot some other issues so submitting
it.

Change-Id: Ib875e56feb49d523300aec5f36c635ed74843a9f
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
4 years agofunc_lock: Fix memory corruption during unload.
Jaco Kroon [Sat, 22 May 2021 12:42:04 +0000 (14:42 +0200)] 
func_lock: Fix memory corruption during unload.

AST_TRAVERSE accessess current as current = current->(field).next ...
and since we free current (and ast_free poisons the memory) we either
end up on a ast_mutex_lock to a non-existing lock that can never be
obtained, or a segfault.

Incidentally add logging in the "we have to wait for a lock to release"
case, and remove an ineffective statement that sets memory that was just
cleared by ast_calloc to zero.

Change-Id: Id19ba3d9867b23d0e6783b97e6ecd8e62698b8c3
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
4 years agofunc_lock: Fix requesters counter in error paths.
Jaco Kroon [Sat, 22 May 2021 12:48:18 +0000 (14:48 +0200)] 
func_lock: Fix requesters counter in error paths.

In two places we bail out with failure after we've already incremented
the requesters counter, if this occured then it would effectively result
in unload to wait indefinitely, thus preventing clean shutdown.

Change-Id: I362a6c0dc424f736d4a9c733d818e72d19675283
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
4 years agoapp_originate: Allow setting Caller ID and variables
Naveen Albert [Tue, 25 May 2021 15:36:04 +0000 (11:36 -0400)] 
app_originate: Allow setting Caller ID and variables

Caller ID can now be set on the called channel and
Variables can now be set on the destination
using the Originate application, just as
they can be currently using call files
or the Manager Action.

ASTERISK-29450

Change-Id: Ia64cfe97d2792bcbf4775b3126cad662922a8b66

4 years agomenuselect: Fix description of several modules.
Sean Bright [Thu, 10 Jun 2021 21:24:52 +0000 (17:24 -0400)] 
menuselect: Fix description of several modules.

The text description needs to be the last thing on the AST_MODULE_INFO
line to be pulled in properly by menuselect.

Change-Id: I0c913e36fea8b661f42e56920b6c5513ae8fd832

4 years agoapp_confbridge: New ConfKick() application
Naveen Albert [Mon, 24 May 2021 00:20:28 +0000 (20:20 -0400)] 
app_confbridge: New ConfKick() application

Adds a new ConfKick() application, which may
be used to kick a specific channel, all channels,
or all non-admin channels from a specified
conference bridge, similar to existing CLI and
AMI commands.

ASTERISK-29446

Change-Id: I5d96b683880bfdd27b2ab1c3f2e897c5046ded9b

4 years agosip_to_pjsip: Fix missing cases
Naveen Albert [Wed, 2 Jun 2021 13:11:24 +0000 (09:11 -0400)] 
sip_to_pjsip: Fix missing cases

Adds the "auto" case which is valid with
both chan_sip dtmfmode and chan_pjsip's
dtmf_mode, adds subscribecontext to
subscribe_context conversion, and accounts
for cipher = ALL being invalid.

ASTERISK-29459

Change-Id: Ie27d6606efad3591038000e5f3c34fa94730f6f2

4 years agores_pjsip_dtmf_info: Hook flash
Naveen Albert [Wed, 2 Jun 2021 13:25:12 +0000 (09:25 -0400)] 
res_pjsip_dtmf_info: Hook flash

Adds hook flash recognition support
for application/hook-flash.

ASTERISK-29460

Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea

4 years agoapp_confbridge: New option to prevent answer supervision
Naveen Albert [Thu, 20 May 2021 14:51:32 +0000 (10:51 -0400)] 
app_confbridge: New option to prevent answer supervision

A new user option, answer_channel, adds the capability to
prevent answering the channel if it hasn't already been
answered yet.

ASTERISK-29440

Change-Id: I26642729d0345f178c7b8045506605c8402de54b

4 years agores_pjsip_messaging: Refactor outgoing URI processing
George Joseph [Thu, 22 Apr 2021 18:07:22 +0000 (12:07 -0600)] 
res_pjsip_messaging: Refactor outgoing URI processing

 * Implemented the new "to" parameter of the MessageSend()
   dialplan application.  This allows a user to specify
   a complete SIP "To" header separate from the Request URI.

 * Completely refactored the get_outbound_endpoint() function
   to actually handle all the destination combinations that
   we advertized as supporting.

 * We now also accept a destination in the same format
   as Dial()...  PJSIP/number@endpoint

 * Added lots of debugging.

ASTERISK-29404
Reported by Brian J. Murrell

Change-Id: I67a485196d9199916468f7f98bfb9a0b993a4cce

4 years agofunc_math: Three new dialplan functions
Naveen Albert [Sun, 16 May 2021 15:21:39 +0000 (11:21 -0400)] 
func_math: Three new dialplan functions

Introduces three new dialplan functions, MIN and MAX,
which can be used to calculate the minimum or
maximum of up to two numbers, and ABS, an absolute
value function.

ASTERISK-29431

Change-Id: I2bda9269d18f9d54833c85e48e41fce0e0ce4d8d

4 years agoSTIR/SHAKEN: Add Date header, dest->tn, and URL checking.
Ben Ford [Wed, 19 May 2021 18:45:16 +0000 (13:45 -0500)] 
STIR/SHAKEN: Add Date header, dest->tn, and URL checking.

STIR/SHAKEN requires a Date header alongside the Identity header, so
that has been added. Still on the outgoing side, we were missing the
dest->tn section of the JSON payload, so that has been added as well.
Moving to the incoming side, URL checking has been added to the public
cert URL to ensure that it starts with http.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Idee5b1b5e45bc3b483b3070e46ce322dca5b3f1c

4 years agores_pjsip: On partial transport reload also move factories.
Joshua C. Colp [Mon, 24 May 2021 18:38:26 +0000 (15:38 -0300)] 
res_pjsip: On partial transport reload also move factories.

For connection oriented transports PJSIP uses factories to
produce transports. When doing a partial transport reload
we need to also move the factory of the transport over so
that anything referencing the transport (such as an endpoint)
has the factory available.

ASTERISK-29441

Change-Id: Ieae0fb98eab2d9257cad996a1136e5a62d307161

4 years agofunc_volume: Add read capability to function.
Naveen Albert [Thu, 20 May 2021 13:18:03 +0000 (09:18 -0400)] 
func_volume: Add read capability to function.

Up until now, the VOLUME function has been write
only, so that TX/RX values can be set but not
read afterwards. Now, previously set TX/RX values
can be read later.

ASTERISK-29439

Change-Id: Ia23e92fa2e755c36e9c8e69f2940d2703ccccb5f

4 years agostasis: Fix "FRACK!, Failed assertion bad magic number" when unsubscribing
Evgenios_Greek [Tue, 13 Apr 2021 07:57:21 +0000 (10:57 +0300)] 
stasis: Fix "FRACK!, Failed assertion bad magic number" when unsubscribing

When unsubscribing from an endpoint technology a FRACK
would occur due to incorrect reference counting. This fixes
that issue, along with some other issues.

Fixed a typo in get_subscription when calling ao2_find as it
needed to pass the endpoint ID and not the entire object.

Fixed scenario where a subscription would get returned when
it shouldn't have been when searching based on endpoint
technology.

A doulbe unreference has also been resolved by only explicitly
releasing the reference held by tech_subscriptions.

ASTERISK-28237 #close
Reported by: Lucas Tardioli Silveira

Change-Id: Ia91b15f8e5ea68f850c66889a6325d9575901729

4 years agores_pjsip.c: Support endpoints with domain info in username
Joseph Nadiv [Thu, 20 May 2021 07:15:30 +0000 (03:15 -0400)] 
res_pjsip.c: Support endpoints with domain info in username

In multidomain environments, it is desirable to create
PJSIP endpoints with the domain info in the endpoint name
in pjsip_endpoint.conf.  This resulted in an error with
registrations, NOTIFY, and OPTIONS packet generation.

This commit will detect if there is an @ in the endpoint
identifier and generate the URI accordingly so NOTIFY and
OPTIONS From headers will generate correctly.

ASTERISK-28393

Change-Id: I96f8d01dfdd5573ba7a28299e46271dd4210b619

4 years agores_rtp_asterisk: Set correct raddr port on RTCP srflx candidates.
Joshua C. Colp [Thu, 20 May 2021 12:51:46 +0000 (09:51 -0300)] 
res_rtp_asterisk: Set correct raddr port on RTCP srflx candidates.

RTCP ICE candidates use a base address derived from the RTP
candidate. The port on the base address was not being updated to
the RTCP port.

This change sets the base port to the RTCP port and all is well.

ASTERISK-29433

Change-Id: Ide2d2115b307bfd3c2dfbc4d187515d724519040

4 years agoasterisk: We've moved to Libera Chat!
Joshua C. Colp [Tue, 25 May 2021 10:38:58 +0000 (07:38 -0300)] 
asterisk: We've moved to Libera Chat!

Change-Id: I48c1933dd79b50ddc0a6793acec4754b4e95c575

4 years agores_rtp_asterisk: make it possible to remove SOFTWARE attribute
Jeremy LainĂ© [Wed, 19 May 2021 18:13:36 +0000 (20:13 +0200)] 
res_rtp_asterisk: make it possible to remove SOFTWARE attribute

By default Asterisk reports the PJSIP version in a SOFTWARE attribute
of every STUN packet it sends. This may not be desired in a production
environment, and RFC5389 recommends making the use of the SOFTWARE
attribute a configurable option:

https://datatracker.ietf.org/doc/html/rfc5389#section-16.1.2

This patch adds a `stun_software_attribute` yes/no option to make it
possible to omit the SOFTWARE attribute from STUN packets.

ASTERISK-29434

Change-Id: Id3f2b1dd9584536ebb3a1d7e8395fd8b3e46860b

4 years agores_pjsip_outbound_authenticator_digest: Be tolerant of RFC8760 UASs
George Joseph [Thu, 15 Apr 2021 15:43:48 +0000 (09:43 -0600)] 
res_pjsip_outbound_authenticator_digest: Be tolerant of RFC8760 UASs

RFC7616 and RFC8760 allow more than one WWW-Authenticate or
Proxy-Authenticate header per realm, each with different digest
algorithms (including new ones like SHA-256 and SHA-512-256).
Thankfully however a UAS can NOT send back multiple Authenticate
headers for the same realm with the same digest algorithm.  The
UAS is also supposed to send the headers in order of preference
with the first one being the most preferred.  We're supposed to
send an Authorization header for the first one we encounter for a
realm that we can support.

The UAS can also send multiple realms, especially when it's a
proxy that has forked the request in which case the proxy will
aggregate all of the Authenticate headers and then send them all
back to the UAC.

It doesn't stop there though... Each realm can require a
different username from the others.  There's also nothing
preventing each digest algorithm from having a unique password
although I'm not sure if that adds any benefit.

So now... For each Authenticate header we encounter, we have to
determine if we support the digest algorithm and, if not, just
skip the header.  We then have to find an auth object that
matches the realm AND the digest algorithm or find a wildcard
object that matches the digest algorithm. If we find one, we add
it to the results vector and read the next Authenticate header.
If the next header is for the same realm AND we already added an
auth object for that realm, we skip the header. Otherwise we
repeat the process for the next header.

In the end, we'll have accumulated a list of credentials we can
pass to pjproject that it can use to add Authentication headers
to a request.

NOTE: Neither we nor pjproject can currently handle digest
algorithms other than MD5.  We don't even have a place for it in
the ast_sip_auth object. For this reason, we just skip processing
any Authenticate header that's not MD5.  When we support the
others, we'll move the check into the loop that searches the
objects.

Changes:

 * Added a new API ast_sip_retrieve_auths_vector() that takes in
   a vector of auth ids (usually supplied on a call to
   ast_sip_create_request_with_auth()) and populates another
   vector with the actual objects.

 * Refactored res_pjsip_outbound_authenticator_digest to handle
   multiple Authenticate headers and set the stage for handling
   additional digest algorithms.

 * Added a pjproject patch that allows them to ignore digest
   algorithms they don't support.  This patch has already been
   merged upstream.

 * Updated documentation for auth objects in the XML and
   in pjsip.conf.sample.

 * Although res_pjsip_authenticator_digest isn't affected
   by this change, some debugging and a testsuite AMI event
   was added to facilitate testing.

Discovered during OpenSIPit 2021.

ASTERISK-29397

Change-Id: I3aef5ce4fe1d27e48d61268520f284d15d650281

4 years agores_pjsip_dialog_info_body_generator: Add LOCAL/REMOTE tags in dialog-info+xml
Joseph Nadiv [Wed, 14 Apr 2021 14:44:00 +0000 (10:44 -0400)] 
res_pjsip_dialog_info_body_generator: Add LOCAL/REMOTE tags in dialog-info+xml

RFC 4235 Section 4.1.6 describes XML elements that should be
sent to subscribed endpoints to identify the local and remote
participants in the dialog.

This patch adds this functionality to PJSIP by iterating through the
ringing channels causing the NOTIFY, and inserts the channel info
into the dialog so that information is properly passed to the endpoint
in dialog-info+xml.

ASTERISK-24601
Patch submitted: Joshua Elson
Modified by: Joseph Nadiv and Sean Bright
Tested by: Joseph Nadiv

Change-Id: I20c5cf5b45f34d7179df6573c5abf863eb72964b

4 years agoapp_voicemail: Configurable voicemail beep
Naveen Albert [Thu, 13 May 2021 14:47:08 +0000 (10:47 -0400)] 
app_voicemail: Configurable voicemail beep

Hitherto, VoiceMail() played a non-customizable beep tone to indicate
the caller could leave a message. In some cases, the beep may not
be desired, or a different tone may be desired.

To increase flexibility, a new option allows customization of the tone.
If the t option is specified, the default beep will be overridden.
Supplying an argument will cause it to use the specified file for the tone,
and omitting it will cause it to skip the beep altogether. If the option
is not used, the default behavior persists.

ASTERISK-29349

Change-Id: I1c439c0011497e28a28067fc1cf1e654c8843280

4 years agoAMI: Add AMI event to expose hook flash events
Naveen Albert [Thu, 13 May 2021 15:32:06 +0000 (11:32 -0400)] 
AMI: Add AMI event to expose hook flash events

Although Asterisk can receive and propogate flash events, it currently
provides no mechanism for doing anything with them itself.

This AMI event allows flash events to be processed by Asterisk.
Additionally, AST_CONTROL_FLASH is included in a switch statement
in channel.c to avoid throwing a warning when we shouldn't.

ASTERISK-29380

Change-Id: Ie17ffe65086e0282c88542e38eed6a461ec79e81

4 years agochan_sip: Expand hook flash recognition.
Naveen Albert [Thu, 13 May 2021 13:50:02 +0000 (09:50 -0400)] 
chan_sip: Expand hook flash recognition.

Some ATAs send hook flash events as application/hook-flash, rather than a DTMF
event. Now, we also recognize hook-flash as a flash event.

ASTERISK-29370

Change-Id: I1c3b82a040dff3affcd94bad8ce33edc90c04725

4 years agopjsip: Add patch for resolving STUN packet lifetime issues.
Joshua C. Colp [Tue, 11 May 2021 17:00:01 +0000 (14:00 -0300)] 
pjsip: Add patch for resolving STUN packet lifetime issues.

In some cases it was possible for a STUN packet to be destroyed
prematurely or even destroyed partially multiple times.

This patch provided by Teluu fixes the lifetime of these
packets and ensures they aren't partially destroyed multiple
times.

https://github.com/pjsip/pjproject/pull/2709

ASTERISK-29377

Change-Id: Ie842ad24ddf345e01c69a4d333023f05f787abca

4 years agomain/file.c: Don't throw error on flash event.
Naveen Albert [Thu, 13 May 2021 15:13:55 +0000 (11:13 -0400)] 
main/file.c: Don't throw error on flash event.

AST_CONTROL_FLASH isn't accounted for in a switch statement in file.c
where it should be ignored. Adding this to the switch ensures a
warning isn't thrown on RFC2833 flash events, since nothing's amiss.

ASTERISK-29372

Change-Id: I4fa549bfb7ba1894a4044de999ea124877422fbc

4 years agochan_pjsip: Correct misleading trace message
Sean Bright [Thu, 13 May 2021 02:20:23 +0000 (22:20 -0400)] 
chan_pjsip: Correct misleading trace message

ASTERISK-29358 #close

Change-Id: I050daff67066873df4e8fc7f4bd977c1ca06e647

4 years agoSTIR/SHAKEN: Switch to base64 URL encoding.
Ben Ford [Mon, 26 Apr 2021 22:00:11 +0000 (17:00 -0500)] 
STIR/SHAKEN: Switch to base64 URL encoding.

STIR/SHAKEN encodes using base64 URL format. Currently, we just use
base64. New functions have been added that convert to and from base64
encoding.

The origid field should also be an UUID. This means there's no reason to
have it as an option in stir_shaken.conf, as we can simply generate one
when creating the Identity header.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Icf094a2a54e87db91d6b12244c9f5ba4fc2e0b8c

4 years agoSTIR/SHAKEN: OPENSSL_free serial hex from openssl.
Ben Ford [Tue, 11 May 2021 17:26:13 +0000 (12:26 -0500)] 
STIR/SHAKEN: OPENSSL_free serial hex from openssl.

We're getting the serial number of the certificate from openssl and
freeing it with ast_free(), but it needs to be freed with OPENSSL_free()
instead. Now we duplicate the string and free the one from openssl with
OPENSSL_free(), which means we can still use ast_free() on the returned
string.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Ia6e1a4028c1933a0e1d204b769ebb9f5a11f00ab

4 years agoSTIR/SHAKEN: Fix certificate type and storage.
Ben Ford [Wed, 21 Apr 2021 16:12:55 +0000 (11:12 -0500)] 
STIR/SHAKEN: Fix certificate type and storage.

During OpenSIPit, we found out that the public certificates must be of
type X.509. When reading in public keys, we use the corresponding X.509
functions now.

We also discovered that we needed a better naming scheme for the
certificates since certificates with the same name would cause issues
(overwriting certs, etc.). Now when we download a public certificate, we
get the serial number from it and use that as the name of the cached
certificate.

The configuration option public_key_url in stir_shaken.conf has also
been renamed to public_cert_url, which better describes what the option
is for.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Ia00b20835f5f976e3603797f2f2fb19672d8114d

4 years agoUpdates for the MessageSend Dialplan App
George Joseph [Thu, 22 Apr 2021 18:07:22 +0000 (12:07 -0600)] 
Updates for the MessageSend Dialplan App

Enhancements:

 * The MessageSend dialplan application now takes an optional
   third argument that can set the message's "To" field on
   outgoing messages.  It's an alternative to using the
   MESSAGE(to) dialplan function.

   NOTE: No channel driver currently implements this field.  A
   follow-on commit for res_pjsip_messaging will implement it for
   the chan_pjsip channel driver.

 * To prevent confusion with the first argument, currently named
   "to", it's been renamed to "destination". Its function,
   creating the request URI, hasn't changed.

 * The documentation for MessageSend was updated to be
   more clear about the parameters and how they interact
   the MESSAGE() dialplan function.

 * With the rename of MessageSend's first parameter, and the fact
   that message.c references <info> elements in chan_sip.c,
   res_pjsip_messaging.c and res_xmpp, they each needed
   documentation updates to use MessageDestinationInfo instead of
   MessageToInfo.

 * appdocsxml.dtd was updated to include a missing element
   declaration for "dataType".  This was showing up as an error
   in Eclipse's dtd editor.

 * Despite the changes in this commit, there should be
   no impact to current users of MessageSend.

Change-Id: I6fb5b569657a02866a66ea352fd53d30d8ac965a

4 years agotranslate.c: Avoid refleak when checking for a translation path
Sean Bright [Fri, 30 Apr 2021 20:21:55 +0000 (16:21 -0400)] 
translate.c: Avoid refleak when checking for a translation path

Change-Id: Idbd61ff77545f4a78b06a5064b55112e774b70e6

4 years agochan_local: Skip filtering audio formats on removed streams.
Joshua C. Colp [Wed, 28 Apr 2021 12:17:13 +0000 (09:17 -0300)] 
chan_local: Skip filtering audio formats on removed streams.

When a stream topology is provided to chan_local when dialing
it filters the audio formats down. This operation did not skip
streams which were removed (that have no formats) resulting in
calling being aborted.

This change causes such streams to be skipped.

ASTERISK-29407

Change-Id: I1de8b98727cb2d10f4bc287da0b5fdcb381addd6

4 years agores_rtp_asterisk: More robust timestamp checking
Sean Bright [Tue, 27 Apr 2021 17:31:30 +0000 (13:31 -0400)] 
res_rtp_asterisk: More robust timestamp checking

We assume that a timestamp value of 0 represents an 'uninitialized'
timestamp, but 0 is a valid value. Add a simple wrapper to be able to
differentiate between whether the value is set or not.

This also removes the fix for ASTERISK~28812 which should not be
needed if we are checking the last timestamp appropriately.

ASTERISK-29030 #close

Change-Id: Ie70d657d580d9a1f2877e25a6ef161c5ad761cf7

4 years agoUpdate CHANGES and UPGRADE.txt for 18.4.0
Asterisk Development Team [Thu, 29 Apr 2021 15:25:55 +0000 (10:25 -0500)] 
Update CHANGES and UPGRADE.txt for 18.4.0

4 years agores_pjsip.c: OPTIONS processing can now optionally skip authentication
Sean Bright [Fri, 23 Apr 2021 17:37:20 +0000 (13:37 -0400)] 
res_pjsip.c: OPTIONS processing can now optionally skip authentication

ASTERISK-27477 #close

Change-Id: I68f6715bba92a525149e35d142a49377a34a1193

4 years agotranslate.c: Take sampling rate into account when checking codec's buffer size
Jean Aunis [Wed, 21 Apr 2021 11:42:32 +0000 (13:42 +0200)] 
translate.c: Take sampling rate into account when checking codec's buffer size

Up/down sampling changes the number of samples produced by a translation.
This must be taken into account when checking the codec's buffer size.

ASTERISK-29328

Change-Id: I9aebe2f8788e00321a7f5c47aa97c617f39e9055

4 years agosvn: Switch to https scheme.
Joshua C. Colp [Sun, 25 Apr 2021 09:45:57 +0000 (06:45 -0300)] 
svn: Switch to https scheme.

Some versions of SVN seemingly don't follow the redirect
to https.

Change-Id: Ia7c76c18cb620bcf56f08e1211a7d80d321fe253

4 years agores_pjsip: Update documentation for the auth object
George Joseph [Tue, 20 Apr 2021 13:42:52 +0000 (07:42 -0600)] 
res_pjsip:  Update documentation for the auth object

Change-Id: I2f76867ce02ec611964925159be099de83346e38

4 years agobridge_channel_write_frame: Check for NULL channel
George Joseph [Fri, 2 Apr 2021 12:21:33 +0000 (06:21 -0600)] 
bridge_channel_write_frame: Check for NULL channel

There is a possibility, when bridge_channel_write_frame() is
called, that the bridge_channel->chan will be NULL.  The first
thing bridge_channel_write_frame() does though is call
ast_channel_is_multistream() which had no check for a NULL
channel and therefore caused a segfault. Since it's still
possible for bridge_channel_write_frame() to write the frame to
the other channels in the bridge, we don't want to bail before we
call ast_channel_is_multistream() but we can just skip the
multi-channel stuff.  So...

bridge_channel_write_frame() only calls ast_channel_is_multistream()
if bridge_channel->chan is not NULL.

As a safety measure, ast_channel_is_multistream() now returns
false if the supplied channel is NULL.

ASTERISK-29379
Reported-by: Vyrva Igor
Reported-by: Ross Beer
Change-Id: Idfe62dbea8c69813ecfd58e113a6620dc42352ce

4 years agoloader.c: Speed up deprecation metadata lookup
Sean Bright [Thu, 1 Apr 2021 15:38:04 +0000 (11:38 -0400)] 
loader.c: Speed up deprecation metadata lookup

Only use an XPath query once per module, then just navigate the DOM for
everything else.

Change-Id: Ia0336a7185f9180ccba4b6f631a00f9a22a36e92

4 years agores_prometheus: Clone containers before iterating
George Joseph [Thu, 1 Apr 2021 13:39:03 +0000 (07:39 -0600)] 
res_prometheus: Clone containers before iterating

The channels, bridges and endpoints scrape functions were
grabbing their respective global containers, getting the
count of entries, allocating metric arrays based on
that count, then iterating over the container.  If the
global container had new objects added after the count
was taken and the metric arrays were allocated, we'd run
out of metric entries and attempt to write past the end
of the arrays.

Now each of the scape functions clone their respective
global containers and all operations are done on the
clone.  Since the clone is stable between getting the
count and iterating over it, we can't run past the end
of the metrics array.

ASTERISK-29130
Reported-By: Francisco Correia
Reported-By: BJ Weschke
Reported-By: Sébastien Duthil
Change-Id: If0c8e40853bc0e9429f2ba9c7f5f358d90c311af

4 years agoloader: Output warnings for deprecated modules.
Joshua C. Colp [Wed, 10 Mar 2021 15:03:11 +0000 (11:03 -0400)] 
loader: Output warnings for deprecated modules.

Using the information from the MODULEINFO XML we can
now output useful information at the end of module
loading for deprecated modules. This includes the
version it was deprecated in, the version it will be
removed in, and the replacement if available.

ASTERISK-29339

Change-Id: I2080dab97d2186be94c421b41dabf6d79a11611a

4 years agores_rtp_asterisk: Fix standard deviation calculation
Kevin Harwell [Mon, 22 Mar 2021 20:22:42 +0000 (15:22 -0500)] 
res_rtp_asterisk: Fix standard deviation calculation

For some input to the standard deviation algorithm extremely large,
and wrong numbers were being calculated.

This patch uses a new formula for correctly calculating both the
running mean and standard deviation for the given inputs.

ASTERISK-29364 #close

Change-Id: Ibc6e18be41c28bed3fde06d612607acc3fbd621f

4 years agores_rtp_asterisk: Don't count 0 as a minimum lost packets
Kevin Harwell [Mon, 29 Mar 2021 22:40:49 +0000 (17:40 -0500)] 
res_rtp_asterisk: Don't count 0 as a minimum lost packets

The calculated minimum lost packets represents the lowest number of
lost packets missed during an RTCP report interval. Zero of course
is the lowest, but the idea is that this value contain the lowest
number of lost packets once some have been missed.

This patch checks to make sure the number of lost packets over an
interval is not zero before checking and setting the minimum value.

Also, this patch updates the rtp lost packet test to check for
packet loss over several reports vs one.

Change-Id: I07d6e21cec61e289c2326138d6bcbcb3c3d5e008

4 years agores_rtp_asterisk: Statically declare rtp_drop_packets_data object
Kevin Harwell [Wed, 31 Mar 2021 17:17:58 +0000 (12:17 -0500)] 
res_rtp_asterisk: Statically declare rtp_drop_packets_data object

This patch makes the drop_packets_data object static.

Change-Id: If4f9b21fa0c47d41a35b6b05941d978efb4da87b

4 years agores_rtp_asterisk: Only raise flash control frame on end.
Joshua C. Colp [Mon, 29 Mar 2021 22:52:08 +0000 (19:52 -0300)] 
res_rtp_asterisk: Only raise flash control frame on end.

Flash in RTP is conveyed the same as DTMF, just with a
specific digit. In Asterisk however we do flash as a
single control frame.

This change makes it so that only on end do we provide
the flash control frame to the core. Previously we would
provide a flash control frame on both begin and end,
causing flash to work improperly.

ASTERISK-29373

Change-Id: I1accd9c6e859811336e670e698bd8bd124f33226

4 years agores_rtp_asterisk: Add a DEVMODE RTP drop packets CLI command
Kevin Harwell [Fri, 5 Mar 2021 18:53:47 +0000 (12:53 -0600)] 
res_rtp_asterisk: Add a DEVMODE RTP drop packets CLI command

This patch makes it so when Asterisk is compiled in DEVMODE a CLI
command is available that allows someone to drop incoming RTP
packets. The command allows for dropping of packets once, or on a
timed interval (e.g. drop 10 packets every 5 seconds). A user can
also specify to drop packets by IP address.

Change-Id: I25fa7ae9bad6ed68e273bbcccf0ee51cae6e7024

4 years agores_pjsip: Give error when TLS transport configured but not supported.
Joshua C. Colp [Tue, 30 Mar 2021 11:59:14 +0000 (08:59 -0300)] 
res_pjsip: Give error when TLS transport configured but not supported.

Change-Id: I058af496021ff870ccec2d8cbade637b348ab80b

4 years agotime: Add timeval create and unit conversion functions
Kevin Harwell [Fri, 5 Mar 2021 18:47:38 +0000 (12:47 -0600)] 
time: Add timeval create and unit conversion functions

Added a TIME_UNIT enumeration, and a function that converts a
string to one of the enumerated values. Also, added functions
that create and initialize a timeval object using a specified
value, and unit type.

Change-Id: Ic31a1c3262a44f77a5ef78bfc85dcf69a8d47392

4 years agoapp_queue: Add alembic migration to add ringinuse to queue_members.
Sean Bright [Wed, 24 Mar 2021 13:38:20 +0000 (09:38 -0400)] 
app_queue: Add alembic migration to add ringinuse to queue_members.

ASTERISK-28356 #close

Change-Id: I53a1bfdd3113d620bea88349019173a2f3f0ae39

4 years agomodules.conf: Fix more differing usages of assignment operators.
Sean Bright [Sun, 28 Mar 2021 15:47:35 +0000 (11:47 -0400)] 
modules.conf: Fix more differing usages of assignment operators.

I missed the changes in 18 and master in the previous review.

ASTERISK-24434 #close

Change-Id: Ieb132b2a998ce96daa9c9acf26535a974b895876

4 years agologger.conf.sample: Add more debug documentation.
Ben Ford [Wed, 24 Mar 2021 15:52:30 +0000 (10:52 -0500)] 
logger.conf.sample: Add more debug documentation.

Change-Id: Iff0e713f2120d8dce8e1e26924b99ed17f9d9dff

4 years agoqueues.conf.sample: Correct 'context' documentation.
Sean Bright [Tue, 23 Mar 2021 22:24:35 +0000 (18:24 -0400)] 
queues.conf.sample: Correct 'context' documentation.

ASTERISK-24631 #close

Change-Id: I8bf8776906a72ee02f24de6a85345940b9ff6b6f

4 years agoapp_queue.c: Remove dead 'updatecdr' code.
Sean Bright [Tue, 23 Mar 2021 20:15:45 +0000 (16:15 -0400)] 
app_queue.c: Remove dead 'updatecdr' code.

Also removed the sample documentation, and some oddly-placed
documentation about the timeout argument to the Queue() application
itself. There is a large section on the timeout behavior below.

ASTERISK-26614 #close

Change-Id: I8f84e8304b50305b7c4cba2d9787a5d77c3a6217

4 years agologger: Console sessions will now respect logger.conf dateformat= option
Mark Murawski [Fri, 19 Mar 2021 14:11:26 +0000 (10:11 -0400)] 
logger: Console sessions will now respect logger.conf dateformat= option

The 'core' console (ie: asterisk -c) does read logger.conf and does
use the dateformat= option.

Whereas 'remote' consoles (ie: asterisk -r -T) does not read logger.conf
and uses a hard coded dateformat option for printing received verbose messages:
  main/logger.c: static char dateformat[256] = "%b %e %T"

This change will load logger.conf for each remote console session and
use the dateformat= option to set the per-line timestamp for verbose messages

Change-Id: I3ea10990dbd920e9f7ce8ff771bc65aa7f4ea8c1
ASTERISK-25358: #close
Reported-by: Igor Liferenko
4 years agoapp_queue.c: Don't crash when realtime queue name is empty.
Sean Bright [Fri, 19 Mar 2021 20:57:44 +0000 (16:57 -0400)] 
app_queue.c: Don't crash when realtime queue name is empty.

ASTERISK-27542 #close

Change-Id: If0b9719380a25533d2aed1053cff845dc3a4854a

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

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

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

ASTERISK-29215

Change-Id: I61313cca7fc571144338aac826091791b87b6e17

4 years agoapp_queue: Only send QueueMemberStatus if status changes.
Joshua C. Colp [Fri, 19 Mar 2021 09:56:18 +0000 (06:56 -0300)] 
app_queue: Only send QueueMemberStatus if status changes.

If a queue member was updated with the same status multiple
times each time a QueueMemberStatus event would be sent
which would be a duplicate of the previous.

This change makes it so that the QueueMemberStatus event is
only sent if the status actually changes.

ASTERISK-29355

Change-Id: I580c60d992a0a8f2bea8b91c868771b3b490d116

4 years agocore_unreal: Fix deadlock with T.38 control frames.
Joshua C. Colp [Fri, 19 Mar 2021 13:52:08 +0000 (10:52 -0300)] 
core_unreal: Fix deadlock with T.38 control frames.

When using the ast_unreal_lock_all function no channel
locks can be held before calling it.

This change unlocks the channel that indicate was
called on before doing so and then relocks it afterwards.

ASTERISK-29035

Change-Id: Id65016201b5f9c9519a216e250f9101c629e19e9

4 years agores_pjsip: Add support for partial transport reload.
Joshua C. Colp [Mon, 1 Mar 2021 23:32:24 +0000 (19:32 -0400)] 
res_pjsip: Add support for partial transport reload.

Some configuration items for a transport do not result in
the underlying transport changing, but instead are just
state we keep ourselves and use. It is perfectly reasonable
to change these items.

These include local_net and external_* information.

ASTERISK-29354

Change-Id: I027857ccfe4419f460243e562b5f098434b3d43a

4 years agomenuselect: exit non-zero in case of failure on --enable|disable options.
Jaco Kroon [Sat, 13 Mar 2021 11:01:50 +0000 (13:01 +0200)] 
menuselect: exit non-zero in case of failure on --enable|disable options.

ASTERISK-29348

Change-Id: I77e3466435f5a51a57538b29addb68d811af238d
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
4 years agores_rtp_asterisk: Force resync on SSRC change.
Joshua C. Colp [Wed, 17 Mar 2021 15:28:45 +0000 (12:28 -0300)] 
res_rtp_asterisk: Force resync on SSRC change.

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

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

ASTERISK-29352

Change-Id: I2d4c8f93ea24abc1030196706de2d70facf05a5a

4 years agomenuselect: Add ability to set deprecated and removed versions.
Joshua C. Colp [Wed, 10 Mar 2021 14:05:58 +0000 (10:05 -0400)] 
menuselect: Add ability to set deprecated and removed versions.

The "deprecated_in" and "removed_in" information can now be
set in MODULEINFO for a module and is then displayed in
menuselect so users can be aware of when a module is slated
to be deprecated and then removed.

ASTERISK-29337

Change-Id: I6952889cf08e0e9e99cf8b43f99b3cef4688087a

4 years agodocumentation: Fix non-matching module support levels.
Joshua C. Colp [Wed, 10 Mar 2021 10:47:26 +0000 (06:47 -0400)] 
documentation: Fix non-matching module support levels.

Some modules have a different support level documented in their
MODULEINFO XML and Asterisk module definition. This change
brings the two in sync for the modules which were not matching.

ASTERISK-29336

Change-Id: If2f819103d4a271e2e0624ef4db365e897fa3d35

4 years agoxml: Allow deprecated_in and removed_in for MODULEINFO.
Joshua C. Colp [Wed, 10 Mar 2021 14:18:48 +0000 (10:18 -0400)] 
xml: Allow deprecated_in and removed_in for MODULEINFO.

ASTERISK-29337

Change-Id: I2211b7da8d29369f8649aeabce07679da0787f2b

4 years agoxml: Embed module information into core XML documentation.
Joshua C. Colp [Tue, 9 Mar 2021 14:54:27 +0000 (10:54 -0400)] 
xml: Embed module information into core XML documentation.

This change embeds the MODULEINFO block of modules
into the core XML documentation. This provides a shared
mechanism for use by both menuselect and Asterisk for
information and a definitive source of truth.

ASTERISK-29335

Change-Id: Ifbfd5c700049cf320a3e45351ac65dd89bc99d90

4 years agomanager: Increase the non breaking AMI version number
Kevin Harwell [Thu, 11 Mar 2021 16:33:56 +0000 (10:33 -0600)] 
manager: Increase the non breaking AMI version number

ASTERISK~29244 added three new AMI events, so bump the version number.

Change-Id: I0e77fa36d38fb27dec3481d4ef08131330da0632

4 years agoUpdate CHANGES and UPGRADE.txt for 18.3.0
Asterisk Development Team [Thu, 11 Mar 2021 16:40:29 +0000 (11:40 -0500)] 
Update CHANGES and UPGRADE.txt for 18.3.0

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

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

ASTERISK-29071

Change-Id: I5ef918ebe4debac8a469e8d43bf9d6b673e8e472

4 years agofunc_callerid+res_agi: Fix compile errors related to -Werror=zero-length-bounds
Jaco Kroon [Wed, 24 Feb 2021 18:00:35 +0000 (20:00 +0200)] 
func_callerid+res_agi: Fix compile errors related to -Werror=zero-length-bounds

Change-Id: I75152cece8a00b7523d542e5ac22796f9595692b
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
4 years agoapp.h: Fix -Werror=zero-length-bounds compile errors in dev mode.
Jaco Kroon [Wed, 24 Feb 2021 18:34:36 +0000 (20:34 +0200)] 
app.h: Fix -Werror=zero-length-bounds compile errors in dev mode.

Change-Id: I5c104dc1f8417ccd3d01faf86e84ccbf89bc3b31
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
4 years agoapp_dial.c: Only send DTMF on first progress event.
Sean Bright [Sat, 6 Mar 2021 22:57:02 +0000 (17:57 -0500)] 
app_dial.c: Only send DTMF on first progress event.

ASTERISK-29329 #close

Change-Id: Ic58e7a17f1ff3f785a5b21dced88682581149601

4 years agores_format_attr_*: Parameter Names are Case-Insensitive.
Alexander Traud [Fri, 5 Mar 2021 17:16:56 +0000 (18:16 +0100)] 
res_format_attr_*: Parameter Names are Case-Insensitive.

see RFC 4855:
parameter names are case-insensitive both in media type strings and
in the default mapping to the SDP a=fmtp attribute.

This change is required for H.263+ because some implementations are
known to use even mixed-case. This does not fix ASTERISK~29268 because
H.264 was not fixed. This approach here lowers/uppers both parameter
names and parameter values. H.264 needs a different approach because
one of its parameter values is not case-insensitive:
sprop-parameter-sets is Base64.

Change-Id: Idf2a73457be231647aed3c87b1da197afba86892

4 years agochan_iax2: System Header strings is included via asterisk.h/compat.h.
Alexander Traud [Fri, 5 Mar 2021 17:45:32 +0000 (18:45 +0100)] 
chan_iax2: System Header strings is included via asterisk.h/compat.h.

The system header strings was included mistakenly with commit 3de0204.
That header is included via asterisk.h and there via the compat.h.

Change-Id: I3dc49060e275295f785670c87cc65fd3c3abd24a

4 years agomodules.conf: Fix differing usage of assignment operators.
Sean Bright [Mon, 8 Mar 2021 21:43:16 +0000 (16:43 -0500)] 
modules.conf: Fix differing usage of assignment operators.

ASTERISK-24434 #close

Change-Id: I0144e8d65d878128da59dcf3df12ca8cee47d6db

4 years agostrings.h: ast_str_to_upper() and _to_lower() are not pure.
Sean Bright [Mon, 8 Mar 2021 20:06:00 +0000 (15:06 -0500)] 
strings.h: ast_str_to_upper() and _to_lower() are not pure.

Because they modify their argument they are not pure functions and
should not be marked as such, otherwise the compiler may optimize
them away.

ASTERISK-29306 #close

Change-Id: Ibec03a08522dd39e8a137ece9bc6a3059dfaad5f

4 years agores_musiconhold.c: Plug ref leak caused by ao2_replace() misuse.
Sean Bright [Mon, 8 Mar 2021 23:16:14 +0000 (18:16 -0500)] 
res_musiconhold.c: Plug ref leak caused by ao2_replace() misuse.

ao2_replace() bumps the reference count of the object that is doing the
replacing, which is not what we want. We just want to drop the old ref
on the old object and update the pointer to point to the new object.

Pointed out by George Joseph in #asterisk-dev

Change-Id: Ie8167ed3d4b52b9d1ea2d785f885e8c27206743d

4 years agores/res_rtp_asterisk: generate new SSRC on native bridge end
Torrey Searle [Fri, 19 Feb 2021 11:50:21 +0000 (12:50 +0100)] 
res/res_rtp_asterisk: generate new SSRC on native bridge end

For RTCP to work, we update the ssrc to be the one corresponding to
the native bridge while active.  However when the bridge ends we
should generate a new SSRC as the sequence numbers will not continue
from the native bridge left off.

ASTERISK-29300 #close

Change-Id: I23334b6934d2bf6490bda4bbf6414d96b8d17d10

4 years agosorcery: Add support for more intelligent reloading.
Joshua C. Colp [Mon, 1 Mar 2021 21:35:20 +0000 (17:35 -0400)] 
sorcery: Add support for more intelligent reloading.

Some sorcery objects actually contain dynamic content
that can change despite the underlying configuration
itself not changing. A good example of this is the
res_pjsip_endpoint_identifier_ip module which allows
specifying hostnames. While the configuration may not
change between reloads the DNS information of the
hostnames can.

This change adds the ability for a sorcery object to be
marked as having dynamic contents which is then taken
into account when reloading by the sorcery file based
config module. If there is an object with dynamic content
then a reload will be forced while if there are none
then the existing behavior of not reloading occurs.

ASTERISK-29321

Change-Id: I9342dc55be46cc00204533c266a68d972760a0b1

4 years agores_pjsip_refer: Move the progress dlg release to a serializer
George Joseph [Tue, 2 Mar 2021 18:55:38 +0000 (11:55 -0700)] 
res_pjsip_refer: Move the progress dlg release to a serializer

Although the dlg session count was incremented in a pjsip servant
thread, there's no guarantee that the last thread to unref this
progress object was one.  Before we decrement, we need to make
sure that this is either a servant thread or that we push the
decrement to a serializer that is one.

Because pjsip_dlg_dec_session requires the dialog lock, we don't
want to wait on the task to complete if we had to push it to a
serializer.

Change-Id: I8ff2d5d94be3ff04298394070434e22a7d3cbc41

4 years agores_pjsip_registrar: Include source IP and port in log messages.
Joshua C. Colp [Wed, 3 Mar 2021 18:31:07 +0000 (14:31 -0400)] 
res_pjsip_registrar: Include source IP and port in log messages.

When registering it can be useful to see the source IP address and
port in cases where multiple devices are using the same endpoint
or when anonymous is in use.

ASTERISK-29325

Change-Id: Ie178a6f55f53f8473035854c411bc3d056e0a2e0

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

ASTERISK-29326

Change-Id: Ia95dbfb66e2d11ac4d1228444283bb2e4d77396a

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

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

ASTERISK-29305

Change-Id: I1dfc51c5fa586e38579ede4bc228edee213ccaa9

4 years agores_format_attr_h263: Generate valid SDP fmtp for H.263+.
Alexander Traud [Thu, 28 Jan 2021 14:39:01 +0000 (15:39 +0100)] 
res_format_attr_h263: Generate valid SDP fmtp for H.263+.

Fixed:
* RFC 4629 does not allow the value "0" for MPI, K, and N.
* Allow value "0" for PAR.
* BPP is printed only when specified because "0" has a meaning.

New:
* Added CPCF and MaxBR.
* Some implementations provide CIF without MPI: a=fmtp:xx CIF;F=1
  Although a violation of RFC 3555 section 3, we can support that.

Changed:
* Resorts the CIFs from large to small which partly fixes ASTERISK~29267.

Change-Id: I95a650c715007b8dde11a77cb37d9c6c123a441e

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

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

ASTERISK-29235

Change-Id: I35a0723545281dd01fcd5cae497baab58720478c

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

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

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

This change adds the freeing of these frames.

ASTERISK-29071

Change-Id: Ie50acd454d672d36af914050c327d2e120d8ba7b

4 years agores_rtp_asterisk: Check remote ICE reset and reset local ice attrb
Salah Ahmed [Wed, 27 Jan 2021 20:01:01 +0000 (14:01 -0600)] 
res_rtp_asterisk:  Check remote ICE reset and reset local ice attrb

This change will check is the remote ICE session got reset or not by
checking the offered ufrag and password with session. If the remote ICE
reset session then Asterisk reset its local ufrag and password to reject
binding request with Old ufrag and Password.

ASTERISK-29266

Change-Id: I9c55e79a7af98a8fbb497d336b828ba41bc34eeb

4 years agopjsip: Generate progress (once) when receiving a 180 with a SDP
Holger Hans Peter Freyther [Thu, 7 Jan 2021 14:25:05 +0000 (22:25 +0800)] 
pjsip: Generate progress (once) when receiving a 180 with a SDP

ASTERISK-29105

Change-Id: If1615fe7115fe544ef974b044d3cea5c48b94a38

4 years agomain: With Dutch language year after 2020 is not spoken in say.c
Nico Kooijman [Sun, 28 Feb 2021 09:24:29 +0000 (10:24 +0100)] 
main: With Dutch language year after 2020 is not spoken in say.c

Implemented the english way of saying the year in ast_say_date_with_format_nl.
Currently the numbers are spoken correctly until 2020 and stopped working
this year.

ASTERISK-29297 #close
Reported-by: Jacek Konieczny
Change-Id: If5918eed5ab05df31df4dd23f08a909a60f6aba4

4 years agores_pjsip: dont return early from registration if init auth fails
Nick French [Thu, 25 Feb 2021 02:51:55 +0000 (20:51 -0600)] 
res_pjsip: dont return early from registration if init auth fails

If set_outbound_initial_authentication_credentials() fails,
handle_client_registration() bails early without creating or
sending a register message.

[set_outbound_initial_authentication_credentials() failures
can occur during the process of retrieving an oauth access
token.]

The return from handle_client_registration is ignored, so
returning an error doesn't do any good.

This is a real problem when the registration request is a
re-register, because then the registration will still be
marked 'active' despite the re-register never being sent at all.

So instead, log a warning but let the registration be created
and sent (and probably fail) and follow the normal registration
failed retry/abort logic.

ASTERISK-29315 #close

Change-Id: I2e03b1ea7fba1fa1a8279086aa4b17679e7fa7fa