]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
3 years agoterm.c: Add support for extended number format terminfo files.
Sean Bright [Sat, 4 Sep 2021 17:07:14 +0000 (13:07 -0400)] 
term.c: Add support for extended number format terminfo files.

ncurses 6.1 introduced an extended number format for terminfo files
which the terminfo parsing in Asterisk is not able to parse. This
results in some TERM values that do support color (screen-256color on
Ubuntu 20.04 for example) to not get a color console.

ASTERISK-29630 #close

Change-Id: I27a4fcfab502219924af2d6b1c46feba92903cb3

3 years agoapp_voicemail.c: Ability to silence instructions if greeting is present.
Sean Bright [Tue, 7 Sep 2021 17:32:33 +0000 (13:32 -0400)] 
app_voicemail.c: Ability to silence instructions if greeting is present.

There is an option to silence voicemail instructions but it does not
take into consideration if a recorded greeting exists or not. Add a
new 'S' option that does that.

ASTERISK-29632 #close

Change-Id: I03f2f043a9beb9d99deab302247e2a8686066fb4

3 years agores_srtp: Disable parsing of not enabled cryptos
Jasper Hafkenscheid [Fri, 3 Sep 2021 05:30:59 +0000 (07:30 +0200)] 
res_srtp: Disable parsing of not enabled cryptos

When compiled without extended srtp crypto suites also disable parsing
these from received SDP. This prevents using these, as some client
implementations are not stable.

ASTERISK-29625

Change-Id: I7dafb29be1cdaabdc984002573f4bea87520533a

3 years agodns.c: Load IPv6 DNS resolvers if configured.
Sean Bright [Mon, 6 Sep 2021 16:37:08 +0000 (12:37 -0400)] 
dns.c: Load IPv6 DNS resolvers if configured.

IPv6 nameserver addresses are stored in different part of the
__res_state structure, so look there if we appear to have support for
it.

ASTERISK-28004 #close

Change-Id: I67067077d8a406ee996664518d9c8fbf11f6977d

3 years agobridge_softmix: Suppress error on topology change failure
George Joseph [Wed, 8 Sep 2021 12:52:43 +0000 (06:52 -0600)] 
bridge_softmix: Suppress error on topology change failure

There are conditions under which a failure to change topology
is expected so there's no need to print an ERROR message.

ASTERISK-29618
Reported by: Alexander

Change-Id: Idc168b8588e018bf3a23769f08c4ad646086d481

3 years agoresource_channels.c: Fix wrong external media parameter parse
sungtae kim [Tue, 31 Aug 2021 07:50:58 +0000 (16:50 +0900)] 
resource_channels.c: Fix wrong external media parameter parse

Fixed ARI external media handler to accept body parameters.

ASTERISK-29622

Change-Id: I49509c48a6cbc0fb4165bfa4f834b5e8b9ace20d

3 years agoconfig_options: Handle ACO arrays correctly in generated XML docs.
Sean Bright [Wed, 25 Aug 2021 15:21:07 +0000 (11:21 -0400)] 
config_options: Handle ACO arrays correctly in generated XML docs.

There are 3 separate changes here but they are all closely related:

* Only try to set matchfield attributes on 'field' nodes

* We need to adjust how we treat the category pointer based on the
  value of the category_match, to avoid memory corruption. We now
  generate a regex-like string when match types other than
  ACO_WHITELIST and ACO_BLACKLIST are used.

* Switch app_agent_pool from ACO_BLACKLIST_ARRAY to
  ACO_BLACKLIST_EXACT since we only have one category we need to
  ignore, not two.

ASTERISK-29614 #close

Change-Id: I7be7bdb1bb9814f942bc6bb4fdd0a55a7b7efe1e

3 years agochan_iax2: Add ANI2/OLI information element
Naveen Albert [Wed, 18 Aug 2021 19:44:17 +0000 (19:44 +0000)] 
chan_iax2: Add ANI2/OLI information element

Adds an information element for ANI2 so that
Originating Line Information can be transmitted
over IAX2 channels.

ASTERISK-29605 #close

Change-Id: Iaeacdf6ccde18eaff7f776a0f49fee87dcb549d2

3 years agopbx_ael: Fix crash and lockup issue regarding 'ael reload'
Mark Murawski [Tue, 31 Aug 2021 20:03:56 +0000 (16:03 -0400)] 
pbx_ael:  Fix crash and lockup issue regarding 'ael reload'

Currently pbx_ael does not check if a reload is currently pending
before proceeding with a reload. This can cause multiple threads to
operate at the same time on what should be mutex protected data. This
change adds protection to reloading to ensure only one ael reload is
executing at a time.

ASTERISK-29609 #close

Change-Id: I5ed392ad226f6e4e7696ad742076d3e45c57af35

3 years agoapp_read: Allow reading # as a digit
Naveen Albert [Wed, 25 Aug 2021 11:49:06 +0000 (11:49 +0000)] 
app_read: Allow reading # as a digit

Allows for the digit # to be read as a digit,
just like any other DTMF digit, as opposed to
forcing it to be used as an end of input
indicator. The default behavior remains
unchanged.

ASTERISK-18454 #close

Change-Id: I3033432adb9d296ad227e76b540b8b4a2417665b

3 years agores_rtp_asterisk: Automatically refresh stunaddr from DNS
Sebastien Duthil [Mon, 5 Apr 2021 19:06:38 +0000 (15:06 -0400)] 
res_rtp_asterisk: Automatically refresh stunaddr from DNS

This allows the STUN server to change its IP address without having to
reload the res_rtp_asterisk module.

The refresh of the name resolution occurs first when the module is
loaded, then recurringly, slightly after the previous DNS answer TTL
expires.

ASTERISK-29508 #close

Change-Id: I7955a046293f913ba121bbd82153b04439e3465f

3 years agobridge_basic: Change warning to verbose if transfer cancelled
Naveen Albert [Wed, 25 Aug 2021 01:04:31 +0000 (01:04 +0000)] 
bridge_basic: Change warning to verbose if transfer cancelled

The attended transfer feature will emit a warning if the user
cancels the transfer or the attended transfer doesn't complete
for any reason. Changes the warning to a verbose message,
since nothing is actually wrong here.

ASTERISK-29612 #close

Change-Id: I64c93cdb21360a0a8d45e9cb6db3af8168f66e6d

3 years agoapp_queue: Don't reset queue stats on reload
Naveen Albert [Fri, 20 Aug 2021 20:35:35 +0000 (20:35 +0000)] 
app_queue: Don't reset queue stats on reload

Prevents reloads of app_queue from also resetting
queue statistics.

Also preserves individual queue agent statistics
if we're just reloading members.

ASTERISK-28701

Change-Id: Ib5d4cdec175e44de38ef0f6ede4a7701751766f1

3 years agores_rtp_asterisk: sqrt(.) requires the header math.h.
Alexander Traud [Wed, 25 Aug 2021 14:23:27 +0000 (16:23 +0200)] 
res_rtp_asterisk: sqrt(.) requires the header math.h.

ASTERISK-29616

Change-Id: I6c01623926bf10ccac32612687a50fdab3ba0900

3 years agodialplan: Add one static and fix two whitespace errors.
Alexander Traud [Wed, 25 Aug 2021 14:29:09 +0000 (16:29 +0200)] 
dialplan: Add one static and fix two whitespace errors.

Change-Id: Ia14d515ab63e773097adc6af772ca7123a392f83

3 years agosig_analog: Changes to improve electromechanical signalling compatibility
Sarah Autumn [Sun, 20 Jun 2021 04:36:34 +0000 (21:36 -0700)] 
sig_analog: Changes to improve electromechanical signalling compatibility

This changeset is intended to address compatibility issues encountered
when interfacing Asterisk to electromechanical telephone switches that
implement ANI-B, ANI-C, or ANI-D.

In particular the behaviours that this impacts include:

 - FGC-CAMA did not work at all when using MF signaling. Modified the
   switch case block to send calls to the correct part of the
   signaling-handling state machine.

 - For FGC-CAMA operation, the delay between called number ST and
   second wink for ANI spill has been made configurable; previously
   all calls were made to wait for one full second.

 - After the ANI spill, previous behavior was to require a 'ST' tone
   to advance the call.  This has been changed to allow 'STP' 'ST2P'
   or 'ST3P' as well, for compatibility with ANI-D.

 - Store ANI2 (ANI INFO) digits in the CALLERID(ANI2) channel variable.

 - For calls with an ANI failure, No. 1 Crossbar switches will send
   forward a single-digit failure code, with no calling number digits
   and no ST pulse to terminate the spill.  I've made the ANI timeout
   configurable so to reduce dead air time on calls with ANI fail.

 - ANI info digits configurable.  Modern digital switches will send 2
   digits, but ANI-B sends only a single info digit.  This caused the
   ANI reported by Asterisk to be misaligned.

 - Changed a confusing log message to be more informative.

ASTERISK-29518

Change-Id: Ib7e27d987aee4ed9bc3663c57ef413e21b404256

3 years agomedia_cache: Don't lock when curl the remote file
Andre Barbosa [Thu, 5 Aug 2021 16:55:33 +0000 (17:55 +0100)] 
media_cache: Don't lock when curl the remote file

When playing a remote sound file, which is not in cache, first we need
to download it with ast_bucket_file_retrieve.

This can take a while if the remote host is slow. The current CURL
timeout is 180secs, so in extreme situations, it can take 3 minutes to
return.

Because ast_media_cache_retrieve has a lock on all function, while we
are waiting for the delayed download, Asterisk is not able to play any
more files, even the files already cached locally.

ASTERISK-29544 #close

Change-Id: I8d4142b463ae4a1d4c41bff2bf63324821567408

3 years agores_pjproject: Allow mapping to Asterisk TRACE level
George Joseph [Mon, 16 Aug 2021 13:25:44 +0000 (07:25 -0600)] 
res_pjproject: Allow mapping to Asterisk TRACE level

Allow mapping pjproject log messages to the Asterisk TRACE
log level.  The defaults were also changes to log pjproject
levels 3,4 to DEBUG and 5,6 to TRACE.  Previously 3,4,5,6
all went to DEBUG.

ASTERISK-29582

Change-Id: I859a37a8dec263ed68099709cfbd3e665324c72d

3 years agoapp_milliwatt: Timing fix
Naveen Albert [Thu, 12 Aug 2021 21:02:27 +0000 (21:02 +0000)] 
app_milliwatt: Timing fix

The Milliwatt application uses incorrect tone timings
that cause it to play the 1004 Hz tone constantly.

This adds an option to enable the correct timing
behavior, so that the Milliwatt application can
be used for milliwatt test lines. The default behavior
remains unchanged for compatability reasons, even
though it is incorrect.

ASTERISK-29575 #close

Change-Id: I73ccc6c6fcaa31931c6fff3b85ad1805b2ce9d8c

3 years agofunc_math: Return integer instead of float if possible
Naveen Albert [Mon, 28 Jun 2021 14:25:24 +0000 (14:25 +0000)] 
func_math: Return integer instead of float if possible

The MIN, MAX, and ABS functions all support float
arguments, but currently return floats even if the
arguments are all integers and the response is
a whole number, in which case the user is likely
expecting an integer. This casts the float to an integer
before printing into the response buffer if possible.

ASTERISK-29495

Change-Id: I902d29eacf3ecd0f8a6a5e433c97f0421d205488

3 years agoapp_morsecode: Add American Morse code
Naveen Albert [Wed, 4 Aug 2021 14:46:42 +0000 (14:46 +0000)] 
app_morsecode: Add American Morse code

Previously, the Morsecode application only supported international
Morse code. This adds support for American Morse code and adds an
option to configure the frequency used in off intervals.

Additionally, the application checks for hangup between tones
to prevent application execution from continuing after hangup.

ASTERISK-29541

Change-Id: I172431a2e18e6527d577e74adfb05b154cba7bd4

3 years agofunc_scramble: Audio scrambler function
Naveen Albert [Wed, 4 Aug 2021 19:16:59 +0000 (19:16 +0000)] 
func_scramble: Audio scrambler function

Adds a function to scramble audio on a channel using
whole spectrum frequency inversion. This can be used
as a privacy enhancement with applications like
ChanSpy or other potentially sensitive audio.

ASTERISK-29542

Change-Id: I01020769d91060a1f56a708eb405f87648d1a67e

3 years agoapp_originate: Add ability to set codecs
Naveen Albert [Thu, 5 Aug 2021 00:28:46 +0000 (00:28 +0000)] 
app_originate: Add ability to set codecs

A list of codecs to use for dialplan-originated calls can
now be specified in Originate, similar to the ability
in call files and the manager action.

Additionally, we now default to just using the slin codec
for originated calls, rather than all the slin* codecs up
through slin192, which has been known to cause issues
and inconsistencies from AMI and call file behavior.

ASTERISK-29543

Change-Id: I96a1aeb83d54b635b7a51e1b4680f03791622883

3 years agoBuildSystem: Remove two dead exceptions for compiler Clang.
Alexander Traud [Mon, 16 Aug 2021 16:11:56 +0000 (18:11 +0200)] 
BuildSystem: Remove two dead exceptions for compiler Clang.

Commit 305ce3d added -Wno-parentheses-equality to Makefile.rules,
turning the previous two warning suppressions from commit e9520db
redundant. Let us remove the latter.

Change-Id: I0b471254b31e6e05902062761dded4b3e626c7ac

3 years agomgcp: Remove dead debug code
Sean Bright [Tue, 10 Aug 2021 17:41:31 +0000 (13:41 -0400)] 
mgcp: Remove dead debug code

ASTERISK-20339 #close

Change-Id: I36f364aaa1971241d8f3ea1a5909b463d185a2d5

3 years agopolicy: Add deprecation and removal versions to modules.
Joshua C. Colp [Wed, 11 Aug 2021 11:15:16 +0000 (08:15 -0300)] 
policy: Add deprecation and removal versions to modules.

app_meetme is deprecated in 19, to be removed in 21.
app_osplookup is deprecated in 19, to be removed in 21.
chan_alsa is deprecated in 19, to be removed in 21.
chan_mgcp is deprecated in 19, to be removed in 21.
chan_skinny is deprecated in 19, to be removed in 21.
res_pktccops is deprecated in 19, to be removed in 21.
cdr_mysql was deprecated in 1.8, to be removed in 19.
app_mysql was deprecated in 1.8, to be removed in 19.
app_ices was deprecated in 16, to be removed in 19.
app_macro was deprecated in 16, to be removed in 21.
app_fax was deprecated in 16, to be removed in 19.
app_url was deprecated in 16, to be removed in 19.
app_image was deprecated in 16, to be removed in 19.
app_nbscat was deprecated in 16, to be removed in 19.
app_dahdiras was deprecated in 16, to be removed in 19.
cdr_syslog was deprecated in 16, to be removed in 19.
chan_oss was deprecated in 16, to be removed in 19.
chan_phone was deprecated in 16, to be removed in 19.
chan_sip was deprecated in 17, to be removed in 21.
chan_nbs was deprecated in 16, to be removed in 19.
chan_misdn was deprecated in 16, to be removed in 19.
chan_vpb was deprecated in 16, to be removed in 19.
res_config_sqlite was deprecated in 16, to be removed in 19.
res_monitor was deprecated in 16, to be removed in 21.
conf2ael was deprecated in 16, to be removed in 19.
muted was deprecated in 16, to be removed in 19.

ASTERISK-29548
ASTERISK-29549
ASTERISK-29550
ASTERISK-29551
ASTERISK-29552
ASTERISK-29553
ASTERISK-29554
ASTERISK-29555
ASTERISK-29557
ASTERISK-29558
ASTERISK-29559
ASTERISK-29560
ASTERISK-29561
ASTERISK-29562
ASTERISK-29563
ASTERISK-29564
ASTERISK-29565
ASTERISK-29566
ASTERISK-29567
ASTERISK-29568
ASTERISK-29569
ASTERISK-29570
ASTERISK-29571
ASTERISK-29572
ASTERISK-29573
ASTERISK-29574

Change-Id: Ic3bee31a10d42c4b3bbc913d893f7b2a28a27131

3 years agoUpdate CHANGES and UPGRADE.txt for 18.6.0
Asterisk Development Team [Thu, 12 Aug 2021 16:00:29 +0000 (11:00 -0500)] 
Update CHANGES and UPGRADE.txt for 18.6.0

3 years agofunc_frame_drop: New function
Naveen Albert [Wed, 16 Jun 2021 20:30:05 +0000 (16:30 -0400)] 
func_frame_drop: New function

Adds function to selectively drop specified frames
in the TX or RX direction on a channel, including
control frames.

ASTERISK-29478

Change-Id: I8147c9d55d74e2e48861edba6b22f930920541ec

3 years agoaelparse: Accept an included context with timings.
Alexander Traud [Mon, 2 Aug 2021 17:33:07 +0000 (19:33 +0200)] 
aelparse: Accept an included context with timings.

With Asterisk 1.6.0, in the main parser for the configuration file
extensions.conf, the separator was changed from vertical bar to comma.
However, the first separator was not changed in aelparse; it still had
to be a vertical bar, and no comma was allowed.

Additionally, this change allows the vertical bar for the first and
last parameter again, even in the main parser, because the vertical bar
was still accepted for the other parameters.

ASTERISK-29540

Change-Id: I882e17c73adf4bf2f20f9046390860d04a9f8d81

3 years agoformat_ogg_speex: Implement a "not supported" write handler
Kevin Harwell [Tue, 3 Aug 2021 16:30:54 +0000 (11:30 -0500)] 
format_ogg_speex: Implement a "not supported" write handler

This format did not specify a "write" handler, so when attempting to write
to it (ast_writestream) a crash would occur.

This patch adds a default handler that simply issues a "not supported"
warning, thus no longer crashing.

ASTERISK-29539

Change-Id: I8f6ddc7cc3b15da30803be3b1cf68e2ba0fbce91

4 years agocdr_adaptive_odbc: Prevent filter warnings
Naveen Albert [Mon, 28 Jun 2021 13:48:16 +0000 (13:48 +0000)] 
cdr_adaptive_odbc: Prevent filter warnings

Previously, if CDR filters were used so that
not all CDR records used all sections defined
in cdr_adaptive_odbc.conf, then warnings will
always be emitted (if each CDR record is unique
to a particular section, n-1 warnings to be
specific).

This turns the offending warning log into
a verbose message like the other one, since
this behavior is intentional and not
indicative of anything wrong.

ASTERISK-29494

Change-Id: Ifd314fa9298722bc99494d5ca2658a5caa94a5f8

4 years agoapp_queue: Allow streaming multiple announcement files
Naveen Albert [Sun, 25 Jul 2021 21:53:38 +0000 (21:53 +0000)] 
app_queue: Allow streaming multiple announcement files

Allows multiple files comprising an agent announcement
to be played by separating on the ampersand, similar
to the multi-file support in other Asterisk applications.

ASTERISK-29528

Change-Id: Iec600d8cd5ba14aa1e4e37f906accb356cd7891a

4 years agores_pjsip_header_funcs: Add PJSIP_HEADERS() ability to read header by pattern
Igor Goncharovsky [Tue, 13 Apr 2021 07:36:17 +0000 (13:36 +0600)] 
res_pjsip_header_funcs: Add PJSIP_HEADERS() ability to read header by pattern

PJSIP currently does not provide a function to replace SIP_HEADERS() function to get a list of headers from INVITE request.
It may be used to get all X- headers in case the actual set and names of headers unknown.

ASTERISK-29389

Change-Id: Ic09d395de71a0021e0d6c5c29e1e19d689079f8b

4 years agores_statsd: handle non-standard meter type safely
Rijnhard Hessel [Thu, 8 Jul 2021 12:34:27 +0000 (14:34 +0200)] 
res_statsd: handle non-standard meter type safely

Meter types are not well supported,
lacking support in telegraf, datadog and the official statsd servers.
We deprecate meters and provide a compliant fallback for any existing usages.

A flag has been introduced to allow meters to fallback to counters.

ASTERISK-29513

Change-Id: I5fcb385983a1b88f03696ff30a26b55c546a1dd7

4 years agocodec_builtin.c: G729 audio gets corrupted by Asterisk due to smoother
under [Thu, 22 Jul 2021 16:39:11 +0000 (19:39 +0300)] 
codec_builtin.c: G729 audio gets corrupted by Asterisk due to smoother

If Asterisk gets G.729 6-byte VAD frames inbound, then at outbound Asterisk sends this G.729 stream with non-continuous timestamps.
This makes the audio stream not-playable at the receiver side.
Linphone isn't able to play such an audio - lots of disruptions are heard.
Also I had complains of bad audio from users which use other types of phones.

After debugging, I found this is a regression connected with RTP Smoother (main/smoother.c).

Smoother has a special code to handle G.729 VAD frames (search for AST_SMOOTHER_FLAG_G729 in smoother.c).

However, this flag is never set in Asterisk-12 and newer.
Previously it has been set (see Asterisk-11).

ASTERISK-29526 #close

Change-Id: I6f51ecb1a3ecd9c6d59ec5a6811a27446e17065d

4 years agoapp_dtmfstore: New application to store digits
Naveen Albert [Wed, 16 Jun 2021 20:26:46 +0000 (16:26 -0400)] 
app_dtmfstore: New application to store digits

Adds application to asynchronously collect digits
dialed on a channel in the TX or RX direction
using a framehook and stores them in a specified
variable, up to a configurable number of digits.

ASTERISK-29477

Change-Id: I51aa93fc9507f7636ac44806c4420ce690423e6f

4 years agodocs: Remove embedded macro in WaitForCond XML documentation.
Joshua C. Colp [Tue, 27 Jul 2021 12:53:08 +0000 (09:53 -0300)] 
docs: Remove embedded macro in WaitForCond XML documentation.

Change-Id: I40c6514e1843e320f3cbe0b2c70d4a98c0e35b9c

4 years agoUpdate CHANGES and UPGRADE.txt for 18.5.1
Asterisk Development Team [Thu, 22 Jul 2021 21:56:34 +0000 (16:56 -0500)] 
Update CHANGES and UPGRADE.txt for 18.5.1

4 years agoAST-2021-009 - pjproject-bundled: Avoid crash during handshake for TLS
Kevin Harwell [Mon, 14 Jun 2021 18:28:25 +0000 (13:28 -0500)] 
AST-2021-009 - pjproject-bundled: Avoid crash during handshake for TLS

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

ASTERISK-29415 #close

Change-Id: I105dacdcd130ea7fdd4cf2010ccf35b5eaf1432d

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

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

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

ASTERISK-29392 #close

Change-Id: Ifa869a90dafe33eed8fd9463574fe6f1c0ad3eb1

4 years agoAST-2021-007 - res_pjsip_session: Don't offer if no channel exists.
Joshua C. Colp [Wed, 28 Apr 2021 12:36:35 +0000 (09:36 -0300)] 
AST-2021-007 - res_pjsip_session: Don't offer if no channel exists.

If a re-INVITE is received after we have sent a BYE request then it
is possible for no channel to be present on the session. If this
occurs we allow PJSIP to produce the offer instead. Since the call
is being hung up if it produces an incorrect offer it doesn't
actually matter. This also ensures that code which produces SDP
does not need to handle if a channel is not present.

ASTERISK-29381

Change-Id: I673cb88c432f38f69b2e0851d55cc57a62236042

4 years agores_stasis_playback: Check for chan hangup on play_on_channels
Andre Barbosa [Tue, 29 Jun 2021 16:07:44 +0000 (17:07 +0100)] 
res_stasis_playback: Check for chan hangup on play_on_channels

Verify `ast_check_hangup` before looping to the next sound file.
If the call is already hangup we just break the cycle.
It also ensures that the PlaybackFinished event is sent if the call was hangup.

This is also use-full when we are playing a big list of file for a channel that is hangup.
Before this patch Asterisk will give a warning for every sound not played and fire a PlaybackStart for every sound file on the list tried to be played.

With the patch we just break the playback cycle when the chan is hangup.

ASTERISK-29501 #close

Change-Id: Ic4e1c01b974c9a1f2d9678c9d6b380bcfc69feb8

4 years agores_pjsip_stir_shaken: RFC 8225 compliance and error message cleanup.
Sean Bright [Thu, 15 Jul 2021 20:04:01 +0000 (16:04 -0400)] 
res_pjsip_stir_shaken: RFC 8225 compliance and error message cleanup.

From RFC 8225 Section 5.2.1:

    The "dest" claim is a JSON object with the claim name of "dest"
    and MUST have at least one identity claim object.  The "dest"
    claim value is an array containing one or more identity claim JSON
    objects representing the destination identities of any type
    (currently "tn" or "uri").  If the "dest" claim value array
    contains both "tn" and "uri" claim names, the JSON object should
    list the "tn" array first and the "uri" array second.  Within the
    "tn" and "uri" arrays, the identity strings should be put in
    lexicographical order, including the scheme-specific portion of
    the URI characters.

Additionally, make it clear that there was a failure to sign the JWT
payload and not necessarily a memory allocation failure.

Change-Id: Ia8733b861aef6edfaa9c2136e97b447a01578dc9

4 years agostun: Emit warning message when STUN request times out
Sebastien Duthil [Wed, 30 Jun 2021 22:15:10 +0000 (18:15 -0400)] 
stun: Emit warning message when STUN request times out

Without this message, it is not obvious that the reason is STUN timeout.

ASTERISK-29507 #close

Change-Id: I26e4853c23a1aed324552e1b9683ea3c05cb1f74

4 years agores_http_media_cache.c: Parse media URLs to find extensions.
Sean Bright [Fri, 2 Jul 2021 15:15:05 +0000 (11:15 -0400)] 
res_http_media_cache.c: Parse media URLs to find extensions.

Use the URI parsing functions to parse playback URLs in order to find
their file extensions.

For backwards compatibility, we first look at the full URL, then at
any Content-Type header, and finally at just the path portion of the
URL.

ASTERISK-27871 #close

Change-Id: I16d0682f6d794be96539261b3e48f237909139cb

4 years agomain/cdr.c: Correct Party A selection.
Sean Bright [Tue, 13 Jul 2021 15:31:01 +0000 (11:31 -0400)] 
main/cdr.c: Correct Party A selection.

This appears to just have been a copy/paste error from 6258bbe7. Fix
suggested by Ross Beer in ASTERISK~29166.

Change-Id: I51e0de92042e53f37597c6f83a75621ef0d1ae37

4 years agoapp_reload: New Reload application
Naveen Albert [Wed, 26 May 2021 17:09:09 +0000 (13:09 -0400)] 
app_reload: New Reload application

Adds an application to reload modules
from within the dialplan.

ASTERISK-29454

Change-Id: Ic8ab025d8b38dd525b872b41c465c999c5810774

4 years agores_ari: Fix audiosocket segfault
Igor Goncharovsky [Thu, 8 Jul 2021 14:32:20 +0000 (20:32 +0600)] 
res_ari: Fix audiosocket segfault

Add check that data parameter specified when audiosocket used for externalMedia.

ASTERISK-29514 #close

Change-Id: Ie562f03c5d6c3835a3631f376b3d43e75b8f9617

4 years agores_pjsip_config_wizard.c: Add port matching support.
Sean Bright [Wed, 30 Jun 2021 13:07:47 +0000 (09:07 -0400)] 
res_pjsip_config_wizard.c: Add port matching support.

In f8b0c2c9 we added support for port numbers in 'match' statements
but neglected to include that support in the PJSIP config wizard.

The removed code would have also prevented IPv6 addresses from being
successfully used in the config wizard as well.

ASTERISK-29503 #close

Change-Id: Idd5bbfd48009e7a741757743dbaea68e2835a34d

4 years agoapp_waitforcond: New application
Naveen Albert [Sat, 22 May 2021 14:31:22 +0000 (10:31 -0400)] 
app_waitforcond: New application

While several applications exist to wait for
a certain event to occur, none allow waiting
for any generic expression to become true.
This application allows for waiting for a condition
to become true, with configurable timeout and
checking interval.

ASTERISK-29444

Change-Id: I08adf2824b8bc63405778cf355963b5005612f41

4 years agores_stasis_playback: Send PlaybackFinish event only once for errors
Andre Barbosa [Fri, 4 Jun 2021 11:11:10 +0000 (12:11 +0100)] 
res_stasis_playback: Send PlaybackFinish event only once for errors

When we try to play a list of sound files in the same Play command,
we get only one PlaybackFinish event, after all sounds are played.

But in the case where the Play fails (because channel is destroyed
for example), Asterisk will send one PlaybackFinish event for each
sound file still to be played. If the list is big, Asterisk is
sending many events.

This patch adds a failed state so we can understand that the play
failed. On that case we don't send the event, if we still have a
list of sounds to be played.

When we reach the last sound, we send the PlaybackFinish with
the failed state.

ASTERISK-29464 #close

Change-Id: I4c2e5921cc597702513af0d7c6c2c982e1798322

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