]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
3 years agoasterisk.c: Fix incompatibility warnings for remote console.
Naveen Albert [Sat, 11 Jun 2022 19:29:55 +0000 (19:29 +0000)] 
asterisk.c: Fix incompatibility warnings for remote console.

A previous review fixing ASTERISK_22246 and ASTERISK_26582
got a couple of the options mixed up as to whether or not
they are compatible with the remote console. This fixes
those to the best of my knowledge.

ASTERISK-30097 #close

Change-Id: Id54166991aa79f04fb02699cc499bedda854253b

3 years agotest_aeap_transport: disable part of failing unit test
Kevin Harwell [Tue, 7 Jun 2022 21:03:21 +0000 (16:03 -0500)] 
test_aeap_transport: disable part of failing unit test

The 'transport_binary' test sporadically fails, but on a theory that the
problem is caused by a previously executed test, transport_connect_fail,
part of that test has been disabled until a solution is found.

ASTERISK_30099

Change-Id: I48ed74d696aa9b6159f59661f3d535cac4c909e1

3 years agosig_analog: Fix broken three-way conferencing.
Naveen Albert [Fri, 13 May 2022 12:33:21 +0000 (12:33 +0000)] 
sig_analog: Fix broken three-way conferencing.

Three-way calling for analog lines is currently broken.
If party A is on a call with party B and initiates a
three-way call to party C, the behavior differs depending
on whether the call is conferenced prior to party C
answering. The post-answer case is correct. However,
if A flashes before C answers, then the next flash
disconnects B rather than C, which is incorrect.

This error occurs because the subs are not swapped
in the misbehaving case. This is because the flash
handler only swaps the subs if C has answered already,
which is wrong. To fix this, we swap the subs regardless
of whether C has answered or not when the call is
conferenced. This ensures that C is disconnected
on the next hook flash, rather than B as can happen
currently.

ASTERISK-30043 #close

Change-Id: I96c5bf6c9b7eb2636136b716c677c82c079b6f06

3 years agoARI version: increase non-breaking number
Kevin Harwell [Mon, 13 Jun 2022 15:47:41 +0000 (10:47 -0500)] 
ARI version: increase non-breaking number

A recent change, ASTERISK_30027, now exposes a channel driver's unique
id to ARI channel resources so bump the ARI version.

Change-Id: Ic9da84b7b0eca6f3ff5b6a738b2be8362237951e

3 years agoapp_voicemail: Add option to prevent message deletion.
Naveen Albert [Sun, 15 May 2022 13:31:09 +0000 (13:31 +0000)] 
app_voicemail: Add option to prevent message deletion.

Adds an option to VoiceMailMain that prevents the user
from deleting messages during that application invocation.
This can be useful for public or shared mailboxes, where
some users should be able to listen to messages but not
delete them.

ASTERISK-30063 #close

Change-Id: Icdfb8423ae8d1fce65a056b603eb84a672e80a26

3 years agores_pjsip_pubsub: delete scheduled notification on RLS update
Alexei Gradinari [Mon, 6 Jun 2022 22:21:24 +0000 (18:21 -0400)] 
res_pjsip_pubsub: delete scheduled notification on RLS update

If there is scheduled notification, we must delete it
to avoid using destroyed subscriptions.

ASTERISK-29906

Change-Id: I1c644e5e15a8fe43eed8e4f9112f113cbf87a40f

3 years agores_pjsip_pubsub: XML sanitized RLS display name
Alexei Gradinari [Tue, 7 Jun 2022 13:48:06 +0000 (09:48 -0400)] 
res_pjsip_pubsub: XML sanitized RLS display name

ASTERISK-29891

Change-Id: Ic8c9697e616446e06e6302653eae902aa23372ad

3 years agores_pjsip_outbound_registration: Make max random delay configurable.
Naveen Albert [Sat, 12 Mar 2022 18:27:41 +0000 (18:27 +0000)] 
res_pjsip_outbound_registration: Make max random delay configurable.

Currently, PJSIP will randomly wait up to 10 seconds for each
outbound registration's initial attempt. The reason for this
is to avoid having all outbound registrations attempt to register
simultaneously.

This can create limitations with the test suite where we need to
be able to receive inbound calls potentially within 10 seconds of
starting up. For instance, we might register to another server
and then try to receive a call through the registration, but if
the registration hasn't happened yet, this will fail, and hence
this inconsistent behavior can cause tests to fail. Ultimately,
this requires a smaller random value because there may be no good
reason to wait for up to 10 seconds in these circumstances.

To address this, a new config option is introduced which makes this
maximum delay configurable. This allows, for instance, this to be
set to a very small value in test systems to ensure that registrations
happen immediately without an unnecessary delay, and can be used more
generally to control how "tight" the initial outbound registrations
are.

ASTERISK-29965 #close

Change-Id: Iab989a8e94323e645f3a21cbb6082287c7b2f3fd

3 years agores_pjsip: Actually enable session timers when timers=always
Trevor Peirce [Tue, 7 Jun 2022 21:53:34 +0000 (14:53 -0700)] 
res_pjsip: Actually enable session timers when timers=always

When a pjsip endpoint is defined with timers=always, this has been a
functional noop.  This patch correctly sets the feature bitmap to both
enable support for session timers and to enable them even when the
endpoint itself does not request or support timers.

ASTERISK-29603
Reported-By: Ray Crumrine
Change-Id: I8b5eeaa9ec7f50cc6d96dd34c2b4aa9c53fb5440

3 years agoxmldocs: Improve examples.
Naveen Albert [Wed, 1 Jun 2022 01:43:52 +0000 (01:43 +0000)] 
xmldocs: Improve examples.

Use example tags instead of regular para tags
where possible.

ASTERISK-30090

Change-Id: Iada8bbfda08f30b118cedf2d040bbb21e4966ec5

3 years agoapp_sayunixtime: Use correct inflection for German time.
Christof Efkemann [Wed, 1 Jun 2022 19:59:11 +0000 (21:59 +0200)] 
app_sayunixtime: Use correct inflection for German time.

In function ast_say_date_with_format_de(), take special
care when the hour is one o'clock. In this case, the
German number "eins" must be inflected to its neutrum form,
"ein". This is achieved by playing "digits/1N" instead of
"digits/1". Fixes both 12- and 24-hour formats.

ASTERISK-30092

Change-Id: Ica9b80125c0b317e378d89c1ea786816e2635510

3 years agores_parking: Add music on hold override option.
Naveen Albert [Tue, 31 May 2022 10:59:56 +0000 (10:59 +0000)] 
res_parking: Add music on hold override option.

An m option to Park and ParkAndAnnounce now allows
specifying a music on hold class override.

ASTERISK-30087

Change-Id: I03de8d97b100e451b2611b5a621d48750f5d6a9e

3 years agores_calendar: Prevent assertion if event ends in past.
Naveen Albert [Wed, 23 Mar 2022 11:05:28 +0000 (11:05 +0000)] 
res_calendar: Prevent assertion if event ends in past.

res_calendar will trigger an assertion currently
if the ending time is calculated to be in the past.
Unlike the reminder and start times, however, there
is currently no check to catch non-positive times
and set them to 1. As a result, if we get a negative
value by happenstance, this can cause a crash.

To prevent the assertion from begin triggered, we now
use the same logic as the reminder and start events
to catch this issue before it can cause a problem.

ASTERISK-29981 #close

Change-Id: Idfb3204d195f350d2575fb4bc72a54a597d6e93c

3 years agochan_iax2: Prevent deadlock due to duplicate autoservice.
Naveen Albert [Mon, 16 May 2022 13:01:48 +0000 (13:01 +0000)] 
chan_iax2: Prevent deadlock due to duplicate autoservice.

If a switch is invoked using chan_iax2, deadlock can result
because the PBX core is autoservicing the channel while chan_iax2
also then attempts to service it while waiting for the result
of the switch. This removes servicing of the channel to prevent
any conflicts.

ASTERISK-30064 #close

Change-Id: Ie92f206d32f9a36924af734ddde652b21106af22

3 years agoloader: Prevent deadlock using tab completion.
Naveen Albert [Tue, 3 May 2022 12:44:07 +0000 (12:44 +0000)] 
loader: Prevent deadlock using tab completion.

If tab completion using ast_module_helper is attempted
during startup, deadlock will ensue because the CLI
will attempt to lock the module list while it is already
locked by the loader. This causes deadlock because when
the loader tries to acquire the CLI lock, they are blocked
on each other.

Waiting for startup to complete is not feasible because
the CLI lock is acquired while waiting, so deadlock will
ensure regardless of whether or not a lock on the module
list is attempted.

To prevent deadlock, we immediately abort if tab completion
is attempted on the module list before Asterisk is fully
booted.

ASTERISK-30039 #close

Change-Id: Idd468906c512bb196631e366a8f597a0e2e9271d

3 years agores_parking: Warn if out of bounds parking spot requested.
Naveen Albert [Mon, 30 May 2022 20:55:33 +0000 (20:55 +0000)] 
res_parking: Warn if out of bounds parking spot requested.

Emits a warning if the user has requested a parking spot that
is out of bounds for the requested parking lot.

ASTERISK-30086

Change-Id: I1080371e4f63e94724455003753014fbd3f95fbf

3 years agochan_pjsip: Only set default audio stream on hold.
Maximilian Fridrich [Thu, 19 May 2022 14:23:11 +0000 (16:23 +0200)] 
chan_pjsip: Only set default audio stream on hold.

When a PJSIP channel is set on hold or off hold, all streams were set
on/off hold. This is not the desired behaviour and caused issues
when there were multiple streams in the topology.

Now, only the default audio stream is set on/off hold when a hold is
indicated.

ASTERISK-30051

Change-Id: I04f1110565fd05fea565f5539b534b54549d4f71

3 years agores_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI
Alexei Gradinari [Thu, 26 May 2022 21:29:29 +0000 (17:29 -0400)] 
res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI

The change "Add LOCAL/REMOTE tags in dialog-info+xml" set both "local"
Identity Element URI and Target Element URI to the same value -
the channel Caller Number.
For Identity Element it's ok to set as Caller ID.
But Local Target URI should be set as local URI.

In this case the Local Target URI can be used for Directed Call Pickup
by Polycom ip-phones (parameter useLocalTargetUriforLegacyPickup).

Also XML sanitized Display names.

ASTERISK-24601

Change-Id: If130a2f2f3b2339b14dca0ec0ebeea3a87b34343

3 years agores_agi: Evaluate dialplan functions and variables in agi exec if enabled
Shloime Rosenblum [Wed, 11 May 2022 19:48:43 +0000 (15:48 -0400)] 
res_agi: Evaluate dialplan functions and variables in agi exec if enabled

Agi commnad exec can now evaluate dialplan functions and
variables if variable AGIEXECFULL is set to yes. this can
be useful when executing Playback or Read from agi.

ASTERISK-30058 #close

Change-Id: I669991f540496e7bddd096fec82b52c083036832

3 years agoast_pkgconfig.m4: AST_PKG_CONFIG_CHECK() relies on sed.
Sean Bright [Tue, 17 May 2022 17:01:16 +0000 (13:01 -0400)] 
ast_pkgconfig.m4: AST_PKG_CONFIG_CHECK() relies on sed.

Make sure that we have a working sed before trying to use it.

ASTERISK-30059 #close

Change-Id: I9abad67a5df11b665d480feec304ab9d6f55cc76

3 years agoari: expose channel driver's unique id to ARI channel resource
Moritz Fain [Mon, 25 Apr 2022 22:40:49 +0000 (00:40 +0200)] 
ari: expose channel driver's unique id to ARI channel resource

This change exposes the channel driver's unique id (i.e. the Call-ID
for chan_sip/chan_pjsip based channels) to ARI channel resources
as `protocol_id`.

ASTERISK-30027
Reported by: Moritz Fain
Tested by: Moritz Fain

Change-Id: I7cc6e7a9d29efe74bc27811d788dac20fe559b87

3 years agoloader.c: Use portable printf conversion specifier for int64.
Sean Bright [Tue, 17 May 2022 14:18:58 +0000 (10:18 -0400)] 
loader.c: Use portable printf conversion specifier for int64.

ASTERISK-30060 #close

Change-Id: I88d47a1488be2f39017b8d562f993f081844fcb8

3 years agores_pjsip_transport_websocket: Also set the remote name.
Joshua C. Colp [Tue, 17 May 2022 12:18:03 +0000 (09:18 -0300)] 
res_pjsip_transport_websocket: Also set the remote name.

As part of PJSIP 2.11 a behavior change was done to require
a matching remote hostname on an established transport for
secure transports. Since the Websocket transport is considered
a secure transport this caused the existing connection to not
be found and used.

We now set the remote hostname and the transport can be found.

ASTERISK-30065

Change-Id: Ia1cdef33e1411f927985b4b852c95e163c080e94

3 years agores_pjsip_outbound_registration: Show time until expiration
Naveen Albert [Fri, 7 Jan 2022 16:25:09 +0000 (16:25 +0000)] 
res_pjsip_outbound_registration: Show time until expiration

Adjusts the pjsip show registration(s) commands to show
the amount of seconds remaining until a registration
expires.

ASTERISK-29845 #close

Change-Id: Ic4fea15a1a1056c424416def49d1ca8e776c0483

3 years agores_pjsip_transport_websocket: save the original contact host
Thomas Guebels [Wed, 4 May 2022 15:37:18 +0000 (17:37 +0200)] 
res_pjsip_transport_websocket: save the original contact host

This is needed to be able to restore it in REGISTER responses,
otherwise the client won't be able to find the contact it created.

ASTERISK-30042

Change-Id: I0c5823918199acf09246b3b206fbde66773688f6

3 years agoapp_confbridge: Add function to retrieve channels.
Naveen Albert [Fri, 29 Apr 2022 16:42:55 +0000 (16:42 +0000)] 
app_confbridge: Add function to retrieve channels.

Adds the CONFBRIDGE_CHANNELS function which can be used
to retrieve a comma-separated list of channels, filtered
by a particular type of participant category. This output
can then be used with functions like UNSHIFT, SHIFT, POP,
etc.

ASTERISK-30036 #close

Change-Id: I1950aff932437476dc1abab6f47fb4ac90520b83

3 years agochan_dahdi: Fix broken operator mode clearing.
Naveen Albert [Tue, 26 Apr 2022 19:00:14 +0000 (19:00 +0000)] 
chan_dahdi: Fix broken operator mode clearing.

Currently, the operator services mode in DAHDI is broken and unusable.
The actual operator recall functionality works properly; however,
when the operator hangs up (which is the only way that such a call
is allowed to end), both lines are permanently taken out of service
until "dahdi restart" is run. This prevents this feature from being
used.

Operator mode is one of the few factors that can cause the general
analog event handling in sig_analog not to be used. Several years
back, much of the analog handling was moved from chan_dahdi to
sig_analog. However, this was not done fully or consistently at
the time, and when operator mode is active, sig_analog does not
get used. Generally this is correct, but in the case of hangup
it should be using sig_analog regardless of the operator mode;
otherwise, the lines do not properly clear and they become unusable.

This bug is fixed so the operator can now hang up and properly
release the call. It is treated just like any other hangup. The
operator mode functionality continues to work as it did before.

ASTERISK-29993 #close

Change-Id: Ib2e3ddb40d9c71e8801e0b4bb0a12e2b52f51d24

3 years agoGCC12: Fixes for 18+. state_id_by_topic comparing wrong value
George Joseph [Wed, 4 May 2022 18:00:27 +0000 (12:00 -0600)] 
GCC12: Fixes for 18+.  state_id_by_topic comparing wrong value

GCC 12 caught an issue in state_id_by_topic where we were
checking a pointer for NULL instead of the contents of
the pointer for '\0'.

ASTERISK-30044

Change-Id: Ia0b04d4fff45c92acb7f07132a33622fa341148e

3 years agoGCC12: Fixes for 16+
George Joseph [Tue, 3 May 2022 12:57:58 +0000 (06:57 -0600)] 
GCC12: Fixes for 16+

Most issues were in stringfields and had to do with comparing
a pointer to an constant/interned string with NULL.  Since the
string was a constant, a pointer to it could never be NULL so
the comparison was always "true".  gcc now complains about that.

There were also a few issues where determining if there was
enough space for a memcpy or s(n)printf which were fixed
by defining some of the involved variables as "volatile".

There were also a few other miscellaneous fixes.

ASTERISK-30044

Change-Id: Ia081ca1bcfb329df6487c4660aaf1944309eb570

3 years agocore_unreal: Flip stream direction of second channel.
Maximilian Fridrich [Fri, 29 Apr 2022 08:47:38 +0000 (10:47 +0200)] 
core_unreal: Flip stream direction of second channel.

When a new unreal (local) channel is created, a second (;2) channel is
created as a counterpart which clones the topology of the first
channel. This creates issues when an outgoing stream is sendonly or
recvonly as the stream state of the inbound channel will be the same
as the stream state of the outbound channel.

Now the stream state is flipped for the streams of the 2nd channel in
ast_unreal_new_channels if the outgoing stream topology is recvonly or
sendonly.

ASTERISK-29655
Reported by: Michael Auracher

ASTERISK-29638
Reported by: Michael Auracher

Change-Id: I0cea29635bb20b7bf7fd0fb95498cd44dab98fbf

3 years agochan_dahdi: Document dial resource options.
Naveen Albert [Sun, 27 Mar 2022 12:33:39 +0000 (12:33 +0000)] 
chan_dahdi: Document dial resource options.

Documents the Dial syntax for DAHDI, namely the channel group,
distinctive ring, answer confirmation, and digital call options
that are specified in the resource itself.

ASTERISK-24827 #close

Change-Id: Ib95e78497fb00dc5cbfde1c93a69f034bfd08c30

3 years agochan_dahdi: Don't allow MWI FSK if channel not idle.
Naveen Albert [Tue, 29 Mar 2022 23:47:41 +0000 (23:47 +0000)] 
chan_dahdi: Don't allow MWI FSK if channel not idle.

For lines that have mailboxes configured on them, with
FSK MWI, DAHDI will periodically try to dispatch FSK
to update MWI. However, this is never supposed to be
done when a channel is not idle.

There is currently an edge case where MWI FSK can
extraneously get spooled for the channel if a caller
hook flashes and hangs up, which triggers a recall ring.
After one ring, the on hook time threshold in this if
condition has been satisfied and an MWI update is spooled.
This means that when the phone is picked up again, the
answerer gets an FSK spill before being reconnected to
the party on hold.

To prevent this, we now explicitly check to ensure that
subchannel 0 has no owner. There is no owner when DAHDI
channels are idle, but if the channel is "in use" in some
way (such as in the aforementioned scenario), then there
is an owner, and we shouldn't process MWI at this time.

ASTERISK-28518 #close

Change-Id: Ia3904434fd81688d71742f7e84358b7e1c38e92a

3 years agoapps/confbridge: Added hear_own_join_sound option to control who hears sound_join
Michael Cargile [Wed, 23 Feb 2022 16:29:09 +0000 (11:29 -0500)] 
apps/confbridge: Added hear_own_join_sound option to control who hears sound_join

Added the hear_own_join_sound option to the confbridge user profile to
control who hears the sound_join audio file. When set to 'yes' the user
entering the conference and the participants already in the conference
will hear the sound_join audio file. When set to 'no' the user entering
the conference will not hear the sound_join audio file, but the
participants already in the conference will hear the sound_join audio
file.

ASTERISK-29931
Added by Michael Cargile

Change-Id: I856bd66dc0dfa057323860a6418c1371d249abd2

3 years agochan_iax2: Prevent crash if dialing RSA-only call without outkey.
Naveen Albert [Sat, 2 Apr 2022 21:22:14 +0000 (21:22 +0000)] 
chan_iax2: Prevent crash if dialing RSA-only call without outkey.

Currently, if attempting to place a call to a peer that only allows
RSA authentication, if we fail to provide an outkey when placing
the call, Asterisk will crash.

This exposes the broader issue that IAX2 is prone to causing a crash
if encryption or decryption is attempted but we never initialized
the encryption and decryption keys. In other words, if the logic
to use encryption in chan_iax2 is not perfectly aligned with the
decision to build keys in the first place, then a crash is not
only possible but probable. This was demonstrated by ASTERISK_29264,
for instance.

This permanently prevents such events from causing a crash by explicitly
checking that keys are initialized properly before setting the flags
to use encryption for the call. Instead of crashing, the call will
now abort.

ASTERISK-30007 #close

Change-Id: If925c3d86099ceac7f621804f2532baac5050c9a

3 years agochan_dahdi: Don't append cadences on dahdi restart.
Naveen Albert [Sun, 27 Mar 2022 11:23:12 +0000 (11:23 +0000)] 
chan_dahdi: Don't append cadences on dahdi restart.

Currently, if any custom ring cadences are specified, they are
appended to the array of cadences from wherever we left off
last time. This works properly the first time, but on subsequent
dahdi restarts, it means that the existing cadences are left
alone and (most likely) the same cadences are then re-added
afterwards. In short order, the cadence array gets maxed out
and the user begins seeing warnings that the array is full
and no more cadences may be added.

This buggy behavior persists until Asterisk is completely
restarted; however, if and when dahdi restart is run again,
then the same problem is reintroduced.

This fixes this behavior so that cadence parsing is more
idempotent, that is so running dahdi restart multiple times
starts adding cadences from the beginning, rather than from
wherever the last cadence was added.

As before, it is still not possible to revert to the default
cadences by simply removing all cadences in this manner, nor
is it possible to delete existing cadences. However, this
does make it possible to update existing cadences, which
was not possible before, and also ensures that the cadences
remain unchanged if the config remains unchanged.

ASTERISK-29990 #close

Change-Id: Ie32ea3e8a243b766756b1afce684d4a31ee7421d

3 years agomenuselect: Don't erroneously recompile modules.
Naveen Albert [Sat, 5 Feb 2022 15:03:21 +0000 (15:03 +0000)] 
menuselect: Don't erroneously recompile modules.

A bug in menuselect can cause modules that are disabled
by default to be recompiled every time a recompilation
occurs. This occurs for module categories that are NOT
positive output, as for these categories, the modules
contained in the makeopts file indicate modules which
should NOT be selected. The existing procedure of iterating
through these modules to mark modules as present is thus
insufficient. This has led to modules with a default_enabled
tag of "no" to get deleted and recompiled every time, even
when they haven't changed.

To fix this, we now modify the mark as present behavior
for module categories that are not positive output. For
these, we start by iterating through the module tree
and marking all modules as present, then go back and
mark anything contained in the makeopts file as not
present. This ensures that makeopt selections are actually
used properly, regardless of whether a module category
uses positive output or not.

ASTERISK-29728 #close

Change-Id: Idf2974c4ed8d0ba3738a92f08a6082b234277b95

3 years agoapp_meetme: Don't erroneously set global variables.
Naveen Albert [Thu, 31 Mar 2022 15:44:23 +0000 (15:44 +0000)] 
app_meetme: Don't erroneously set global variables.

The admin_exec function in app_meetme is used by the SLA
applications for internal bridging. However, in these cases,
chan is NULL. Currently, this function will set some status
variables that are intended for a channel, but since channel
is NULL, this is erroneously creating meaningless global
variables, which shouldn't be happening. This sets these
variables only if chan is not NULL.

ASTERISK-30002 #close

Change-Id: I817df6c26f5bda131678e56791b0b61ba64fc6f7

3 years agoasterisk.c: Warn of incompatibilities with remote console.
Naveen Albert [Sat, 5 Mar 2022 11:43:13 +0000 (11:43 +0000)] 
asterisk.c: Warn of incompatibilities with remote console.

Some command line options to Asterisk only apply when Asterisk
is started and cannot be used with remote console mode. If a
user tries to use any of these, they are currently simply
silently ignored.

This prints out a warning if incompatible options are used,
informing users that an option used cannot be used with remote
console mode. Additionally, some clarifications are added to
the help text and man page.

ASTERISK-22246
ASTERISK-26582

Change-Id: I980a5380ef2c19e8ea348596396d5382893c4337

3 years agofunc_db: Add function to return cardinality at prefix
Naveen Albert [Tue, 15 Mar 2022 01:41:29 +0000 (01:41 +0000)] 
func_db: Add function to return cardinality at prefix

Adds the DB_KEYCOUNT function, which can be used to retrieve
the number of keys at a given prefix in AstDB.

ASTERISK-29968 #close

Change-Id: Ib2393b77b7e962dbaae6192f8576bc3f6ba92d09

3 years agochan_dahdi: Fix insufficient array size for round robin.
Naveen Albert [Wed, 30 Mar 2022 00:22:46 +0000 (00:22 +0000)] 
chan_dahdi: Fix insufficient array size for round robin.

According to chan_dahdi.conf, up to 64 groups (numbered
0 through 63) can be used when dialing DAHDI channels.

However, currently dialing round robin with a group number
greater than 31 fails because the array for the round robin
structure is only size 32, instead of 64 as it should be.

This fixes that so the round robin array size is consistent
with the actual groups capacity.

ASTERISK-29994

Change-Id: I4caa08d7025f78ac75a0539f71aaf3eb3e85b3b7

3 years agofunc_evalexten: Extension evaluation function.
Naveen Albert [Mon, 21 Jun 2021 12:49:16 +0000 (08:49 -0400)] 
func_evalexten: Extension evaluation function.

This adds the EVAL_EXTEN function, which may be used to retrieve
the variable-substituted data at any extension.

ASTERISK-29486

Change-Id: Iad81019689674c9f4ac77d235f5d7234adbb1432

3 years agodocumentation: Adds versioning information.
Naveen Albert [Fri, 25 Feb 2022 20:58:52 +0000 (20:58 +0000)] 
documentation: Adds versioning information.

Adds version information for applications, functions,
and manager events/actions.

This is not completely exhaustive by any means but
covers most new things added that have release
versioning information in the issue tracker.

ASTERISK-29940 #close

Change-Id: I506401e93c799715dbbe97c0a8ba18af2bf5e131

3 years agosamples: Remove obsolete sample configs.
Naveen Albert [Sat, 2 Apr 2022 22:38:50 +0000 (22:38 +0000)] 
samples: Remove obsolete sample configs.

Removes a couple sample config files for modules
which have since been removed from Asterisk.

ASTERISK-30008 #close

Change-Id: I6be89cafc6c575d98a5315e4912b61a833aacf52

3 years agocli: Add command to evaluate dialplan functions.
Naveen Albert [Sun, 26 Dec 2021 21:39:12 +0000 (21:39 +0000)] 
cli: Add command to evaluate dialplan functions.

Adds the dialplan eval function commands to evaluate a dialplan
function from the CLI. The return value and function result are
printed out and can be used for testing or debugging.

ASTERISK-29820 #close

Change-Id: I833e97ea54c49336aca145330a2adeebfad05209

3 years agofile.c: Prevent formats from seeking negative offsets.
Naveen Albert [Tue, 1 Mar 2022 01:29:43 +0000 (01:29 +0000)] 
file.c: Prevent formats from seeking negative offsets.

Currently, if a user uses an application like ControlPlayback
to try to rewind a file past the beginning, this can throw
warnings when the file format (e.g. PCM) tries to seek to
a negative offset.

Instead of letting file formats try (and fail) to seek a
negative offset, we instead now catch this in the rewind
function to ensure that we never seek an offset less than 0.
This prevents legitimate user actions from triggering warnings
from any particular file formats.

ASTERISK-29943 #close

Change-Id: Ia53f2623f57898f4b8e5c894b968b01e95426967

3 years agochan_sip.c Session timers get removed on UPDATE
Mark Petersen [Sat, 26 Feb 2022 09:07:53 +0000 (10:07 +0100)] 
chan_sip.c Session timers get removed on UPDATE

If Asterisk receives a SIP REFER with Session-Timers UAC
maintain Session-Timers when sending UPDATE"

ASTERISK-29843

Change-Id: I8e9a21c13bf757fa34d778f49ba3cf859b29ae5c

3 years agochan_pjsip: Add ability to send flash events.
Naveen Albert [Sat, 26 Feb 2022 12:37:08 +0000 (12:37 +0000)] 
chan_pjsip: Add ability to send flash events.

PJSIP currently is capable of receiving flash events
and converting them to FLASH control frames, but it
currently lacks support for doing the reverse: taking
a FLASH control frame and converting it into a flash
event in the SIP domain.

This adds the ability for PJSIP to process flash control
frames by converting them into the appropriate SIP INFO
message, which can then be sent to the peer. This allows,
for example, flash events to be sent between Asterisk
systems using PJSIP.

ASTERISK-29941 #close

Change-Id: I1590221a4d238597f79672fa5825dd4a920c94dd

3 years agochan_pjsip: add allow_sending_180_after_183 option
Mark Petersen [Mon, 21 Feb 2022 13:23:21 +0000 (14:23 +0100)] 
chan_pjsip: add allow_sending_180_after_183 option

added new global config option "allow_sending_180_after_183"
that if enabled will preserve 180 after a 183

ASTERISK-29842

Change-Id: I8a53f8c35595b6d16d8e86e241b5f110d92f3d18

3 years agochan_sip: SIP route header is missing on UPDATE
Mark Petersen [Mon, 7 Mar 2022 14:11:41 +0000 (15:11 +0100)] 
chan_sip: SIP route header is missing on UPDATE

if Asterisk need to send an UPDATE before answer
on a channel that uses Record-Route:
it will not include a Route header

ASTERISK-29955

Change-Id: Id1920ecbfea7739a038b14dc94487ecfe7b57eef

3 years agobridge_simple.c: Unhold channels on join simple bridge.
Yury Kirsanov [Thu, 21 Apr 2022 14:10:40 +0000 (10:10 -0400)] 
bridge_simple.c: Unhold channels on join simple bridge.

Patch provided inline by Yury Kirsanov on the linked issue and
approved by Josh Colp.

ASTERISK-29253 #close

Change-Id: I5b9ccc67ebf06e875ed061d9e7fc21f47b0a4e1f

3 years agores_aeap & res_speech_aeap: Add Asterisk External Application Protocol
Kevin Harwell [Fri, 18 Jun 2021 17:54:10 +0000 (12:54 -0500)] 
res_aeap & res_speech_aeap: Add Asterisk External Application Protocol

Add framework to connect to, and read and write protocol based
messages from and to an external application using an Asterisk
External Application Protocol (AEAP). This has been divided into
several abstractions:

 1. transport - base communication layer (currently websocket only)
 2. message - AEAP description and data (currently JSON only)
 3. transaction - links/binds requests and responses
 4. aeap - transport, message, and transaction handler/manager

This patch also adds an AEAP implementation for speech to text.
Existing speech API callbacks for speech to text have been completed
making it possible for Asterisk to connect to a configured external
translator service and provide audio for STT. Results can also be
received from the external translator, and made available as speech
results in Asterisk.

Unit tests have also been created that test the AEAP framework, and
also the speech to text implementation.

ASTERISK-29726 #close

Change-Id: Iaa4b259f84aa63501e5fd2a6fb107f900b4d4ed2

3 years agomanager: Terminate session on write error.
Joshua C. Colp [Mon, 25 Apr 2022 23:39:10 +0000 (20:39 -0300)] 
manager: Terminate session on write error.

On a write error to an AMI session a flag was set to
indicate that the write error had occurred, with the
expected result being that the session be terminated.
This was not actually happening and instead writing
would continue to be attempted.

This change adds a check for the write error and causes
the session to actually terminate.

ASTERISK-29948

Change-Id: Icaf5d413d4c0d5dc78292a17287fecc8720a31a5

3 years agores_pjsip_stir_shaken.c: Fix enabled when not configured.
Ben Ford [Thu, 21 Apr 2022 15:26:01 +0000 (10:26 -0500)] 
res_pjsip_stir_shaken.c: Fix enabled when not configured.

There was an issue with the conditional where STIR/SHAKEN would be
enabled even when not configured. It has been changed to ensure that if
a profile does not exist and stir_shaken is not set in pjsip.conf, then
the conditional will return from the function without performing
STIR/SHAKEN operations.

ASTERISK-30024

Change-Id: I41286a3d35b033ccbfbe4129427a62cb793a86e6

3 years agores_pjsip: Always set async_operations to 1.
Joshua C. Colp [Wed, 6 Apr 2022 10:23:27 +0000 (07:23 -0300)] 
res_pjsip: Always set async_operations to 1.

The async_operations setting on a transport configures how
many simultaneous incoming packets the transport can handle
when multiple threads are polling and waiting on the transport.
As we only use a single thread this was needlessly creating
incoming packets when set to a non-default value, wasting memory.

ASTERISK-30006

Change-Id: I1915973ef352862dc2852a6ba4cfce2ed536e68f

3 years agoapp_dial: Flip stream direction of outgoing channel.
Maximilian Fridrich [Wed, 13 Apr 2022 13:12:03 +0000 (15:12 +0200)] 
app_dial: Flip stream direction of outgoing channel.

When executing dial, the topology of the incoming channel is cloned and
used for the outgoing channel. This creates issues when an incoming
stream is sendonly or recvonly as the stream state of the outgoing
channel will be the same as the stream state of the incoming channel.

Now the stream state is flipped for the outgoing stream in
dial_exec_full if the incoming stream topology is recvonly or sendonly.

ASTERISK-29655
Reported by: Michael Auracher

ASTERISK-29638
Reported by: Michael Auracher

Change-Id: I294dc834ac9a5f048b101b691669959e9df630e1

3 years agoconfig.h: Don't use C++ keywords as argument names.
Sean Bright [Tue, 19 Apr 2022 15:36:12 +0000 (11:36 -0400)] 
config.h: Don't use C++ keywords as argument names.

ASTERISK-30021 #close

Change-Id: I70eb59b782a4946b979942e21422746b7563029c

3 years agopjsip: Increase maximum number of format attributes.
Joshua C. Colp [Mon, 11 Apr 2022 09:30:33 +0000 (06:30 -0300)] 
pjsip: Increase maximum number of format attributes.

Chrome has added more attributes, causing the limit to be
exceeded. This raises it up some more.

ASTERISK-30015

Change-Id: I964957c005c4e6f7871b15ea1ccd9b4659c7ef32

3 years agocdr_adaptive_odbc: Add support for SQL_DATETIME field type.
Joshua C. Colp [Wed, 20 Apr 2022 12:40:47 +0000 (09:40 -0300)] 
cdr_adaptive_odbc: Add support for SQL_DATETIME field type.

ASTERISK-30023

Change-Id: I0e1697f6af044e9eab7e07bbaeeffd1bb68ac34a

3 years agoUpdate CHANGES and UPGRADE.txt for 19.3.2
Asterisk Development Team [Thu, 14 Apr 2022 20:50:52 +0000 (15:50 -0500)] 
Update CHANGES and UPGRADE.txt for 19.3.2

3 years agoAST-2022-002 - res_stir_shaken/curl: Add ACL checks for Identity header.
Ben Ford [Mon, 28 Feb 2022 17:19:54 +0000 (11:19 -0600)] 
AST-2022-002 - res_stir_shaken/curl: Add ACL checks for Identity header.

Adds a new configuration option, stir_shaken_profile, in pjsip.conf that
can be specified on a per endpoint basis. This option will reference a
stir_shaken_profile that can be configured in stir_shaken.conf. The type
of this option must be 'profile'. The stir_shaken option can be
specified on this object with the same values as before (attest, verify,
on), but it cannot be off since having the profile itself implies wanting
STIR/SHAKEN support. You can also specify an ACL from acl.conf (along
with permit and deny lines in the object itself) that will be used to
limit what interfaces Asterisk will attempt to retrieve information from
when reading the Identity header.

ASTERISK-29476

Change-Id: I87fa61f78a9ea0cd42530691a30da3c781842406

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

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

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

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

ASTERISK-29838

Change-Id: I152bf34899b96ddb09cca3e767254d8d78f0c83d

3 years agoAST-2022-001 - res_stir_shaken/curl: Limit file size and check start.
Ben Ford [Fri, 7 Jan 2022 14:50:18 +0000 (08:50 -0600)] 
AST-2022-001 - res_stir_shaken/curl: Limit file size and check start.

Put checks in place to limit how much we will actually download, as well
as a check for the data we receive at the start to ensure it begins with
what we would expect a certificate to begin with.

ASTERISK-29872

Change-Id: Ifd3c6b8bd52b8b6192a04166ccce4fc8a8000b46

3 years agoapp_mf, app_sf: Return -1 if channel hangs up.
Naveen Albert [Sat, 5 Mar 2022 01:41:30 +0000 (01:41 +0000)] 
app_mf, app_sf: Return -1 if channel hangs up.

The ReceiveMF and ReceiveSF applications currently always
return 0, even if a channel has hung up. The call will still
end but generally applications are expected to return -1 if
the channel has hung up.

We now return -1 if a hangup occured to bring this behavior
in line with this norm. This has no functional impact, but
merely increases conformity with how these modules interact
with the PBX core.

ASTERISK-29951 #close

Change-Id: I234d755050ab8ed58f197c6925b968ba26b14033

3 years agoapp_queue: Add music on hold option to Queue.
Naveen Albert [Sat, 22 Jan 2022 15:53:27 +0000 (15:53 +0000)] 
app_queue: Add music on hold option to Queue.

Adds the m option to the Queue application, which allows a
music on hold class to be specified at runtime which will
override the class configured in queues.conf.

This option functions like the m option to Dial.

ASTERISK-29876 #close

Change-Id: Ie25a48569cf8755c305c9438b1ed292c3adcf8d7

3 years agoapp_meetme: Emit warning if conference not found.
Naveen Albert [Sat, 5 Mar 2022 15:40:16 +0000 (15:40 +0000)] 
app_meetme: Emit warning if conference not found.

Currently, if a user tries to access a non-dynamic
MeetMe conference and the conference is not found,
the call simply silent hangs up. There is no indication
to the user that anything went wrong at all.

This changes the relevant debug message to a warning
so that the user is notified of this invalidity.

ASTERISK-29954 #close

Change-Id: Iebcfae3755d00f2150d676ee211c57bc59530048

3 years agores_pjsip_sdp_rtp: Improve detecting of lack of RTP activity
Boris P. Korzun [Tue, 22 Feb 2022 20:51:02 +0000 (23:51 +0300)] 
res_pjsip_sdp_rtp: Improve detecting of lack of RTP activity

Change RTP timer behavior for detecting RTP only after two-way
SDP channel establishment. Ignore detecting after receiving 183
with SDP or while direct media is used.
Make rtp_timeout and rtp_timeout_hold options consistent to rtptimeout
and rtpholdtimeout options in chan_sip.

ASTERISK-26689 #close
ASTERISK-29929 #close

Change-Id: I07326d5b9c40f25db717fd6075f6f3a8d77279eb

3 years agobuild: Remove obsolete leftover build references.
Naveen Albert [Thu, 24 Feb 2022 19:33:05 +0000 (19:33 +0000)] 
build: Remove obsolete leftover build references.

Removes some leftover build and config references to
modules that have since been removed from Asterisk.

ASTERISK-29935 #close

Change-Id: Iaefc73a23f4b2de3c6c14d928050135b6d0ef6af

3 years agores_pjsip_header_funcs: wrong pool used tdata headers
Kevin Harwell [Wed, 23 Mar 2022 22:45:45 +0000 (17:45 -0500)] 
res_pjsip_header_funcs: wrong pool used tdata headers

When adding headers to an outgoing request the headers were cloned using
the dialog's pool when they should have been cloned using tdata's pool.
Under certain circumstances it was possible for the dialog object, and
its pool to be freed while tdata is still active and available. Thus the
cloned header "disappeared", and when tdata tried to later access it a
crash would occur.

This patch makes it so all added headers are cloned appropriately using
tdata's pool.

ASTERISK-29411 #close
ASTERISK-29535 #close

Change-Id: I9852025b5ee93ce1c038209150ee9dba1e0767c5

3 years agopjproject: Update bundled to 2.12 release.
Joshua C. Colp [Thu, 24 Feb 2022 17:48:19 +0000 (13:48 -0400)] 
pjproject: Update bundled to 2.12 release.

This change removes patches which have been merged into
upstream and updates some existing ones. It also adds
some additional config_site.h changes to restore previous
behavior, as well as a patch to allow multiple Authorization
headers. There seems to be some confusion or disagreement
on language in RFC 8760 in regards to whether multiple
Authorization headers are supported. The RFC implies it
is allowed, as does some past sipcore discussion. There is
also the catch all of "local policy" to allow it. In
the case of Asterisk we allow it.

ASTERISK-29351

Change-Id: Id39ece02dedb7b9f739e0e37ea47d76854af7191

3 years agopbx.c: Warn if there are too many includes in a context.
Naveen Albert [Sat, 5 Mar 2022 16:26:42 +0000 (16:26 +0000)] 
pbx.c: Warn if there are too many includes in a context.

The PBX core uses the stack when it comes to includes, which
means that a context can only contain strictly fewer than
AST_PBX_MAX_STACK includes. If this is exceeded, then warnings
will be emitted for each number of includes beyond this if
searching for an extension in the including context, and if
the extension's inclusion is beyond the stack size, it will
simply not be found.

To address this, we now check if there are too many includes
in a context when the dialplan is reloaded so that if there
is an issue, the user is aware of at "compile time" as opposed
to "run time" only. Secondly, more details are printed out
when this message is encountered so it's clear what has happened.

ASTERISK-26719

Change-Id: Ia3700452e75a7af3391b3e82ee69f06a669f8958

3 years agomake_xml_documentation: Remove usage of get_sourceable_makeopts
George Joseph [Fri, 25 Mar 2022 14:33:30 +0000 (08:33 -0600)] 
make_xml_documentation: Remove usage of get_sourceable_makeopts

get_sourceable_makeopts wasn't handling variables with embedded
double quotes in them very well.  One example was the DOWNLOAD
variable when curl was being used instead of wget.  Rather than
trying to fix get_sourceable_makeopts, it's just been removed.

ASTERISK-29986
Reported by: Stefan Ruijsenaars

Change-Id: Idf2a90902228c2558daa5be7a4f8327556099cd2

3 years agoMakefile: Disable XML doc validation
George Joseph [Fri, 25 Mar 2022 19:00:48 +0000 (13:00 -0600)] 
Makefile:  Disable XML doc validation

make_xml_documentation was being called with the --validate
flag set when it shouldn't have been.  This was causing
build failures if neither xmllint nor xmlstarlet were installed.
The correct behavior is to simply print a message that either
one of those tools should be installed for validation and
continue with the build.

ASTERISK-29988

Change-Id: Idc6c44114e7dd3fadae183a4e22f4fdba0b8a645

3 years agochan_iax2: Fix spacing in netstats command
Naveen Albert [Sat, 5 Feb 2022 00:36:17 +0000 (00:36 +0000)] 
chan_iax2: Fix spacing in netstats command

The iax2 show netstats command previously didn't contain
enough spacing in the header to properly align the table
header with the table body. This caused column headers
to not align with the values on longer channel names.

Some spacing is added to account for the longest channel
names that display (before truncation occurs) so that
columns are always properly aligned.

ASTERISK-29895 #close
patches:
  61205_misaligned2.patch submitted by Birger Harzenetter (license 5870)

Change-Id: I450ce6bb81157b9d6d149007e53b749f237b6d9f

3 years agoopenssl: Supress deprecation warnings from OpenSSL 3.0
Sean Bright [Fri, 25 Mar 2022 13:19:35 +0000 (09:19 -0400)] 
openssl: Supress deprecation warnings from OpenSSL 3.0

There is work going on to update our OpenSSL usage to avoid the
deprecated functions but in the meantime make it possible to compile
in devmode.

Change-Id: Ib082eb8b3751f0185d8aa8fe127da664c93f0726

3 years agodocumentation: Add information on running install_prereq script in readme
Marcel Wagner [Wed, 23 Mar 2022 21:04:13 +0000 (22:04 +0100)] 
documentation: Add information on running install_prereq script in readme

Adding information in the readme about running the install_preqreq script to install components that the ./configure script might indicate as missing.

ASTERISK-29976 #close

Change-Id: Ic287b46300168729838bddd8f9265e98fc22bce6

3 years agores_agi: Fix xmldocs bug with set music.
Naveen Albert [Fri, 25 Feb 2022 17:01:41 +0000 (17:01 +0000)] 
res_agi: Fix xmldocs bug with set music.

The XML documentation for the SET MUSIC AGI
command is invalid, as the parameter does not
have a name and the on/off enum options for
the on/off argument are listed separately, which
is incorrect. The cumulative effect of these currently
is that the Asterisk Wiki documentation for SET MUSIC
is broken and external documentation generators crash
on SET MUSIC due to the malformed documentation.

These issues are corrected so that the documentation
can be successfully parsed as with other similar AGI
commands.

ASTERISK-29939 #close
ASTERISK-28891 #close

Change-Id: I8c3d59897531bcbc401cbc7b00c9e2829dcb35f8
(cherry picked from commit 37ece75677bff5655f0a3fb4dbda2b7c4847bc50)

3 years agochan_iax2: Fix perceived showing host address.
Naveen Albert [Sun, 13 Mar 2022 17:46:36 +0000 (17:46 +0000)] 
chan_iax2: Fix perceived showing host address.

ASTERISK_22025 introduced a regression that shows
the host IP and port as the perceived IP and port
again, as opposed to showing the actual perceived
address. This fixes this by showing the correct
information.

ASTERISK-29048 #close

Change-Id: I0ad3e25bc6b449e83ce72ea5d1a1cdba72aa304a

3 years agoconfigure.ac: Use pkg-config to detect libxml2
Hugh McMaster [Tue, 15 Mar 2022 23:53:05 +0000 (10:53 +1100)] 
configure.ac: Use pkg-config to detect libxml2

Use pkg-config to detect libxml2, falling back to xml2-config if the
former is not available.

This patch ensures Asterisk continues to build on systems without
xml2-config installed.

The patch also updates the associated 'configure' files.

ASTERISK-29970 #close

Change-Id: I3c90dfe0b0590486cbb8e6d426a7c5c4199410c0

3 years agotime: add support for time64 libcs
Philip Prindeville [Sun, 13 Feb 2022 19:06:37 +0000 (12:06 -0700)] 
time: add support for time64 libcs

Treat time_t's as entirely unique and use the POSIX API's for
converting to/from strings.

Lastly, a 64-bit integer formats as 20 digits at most in base10.
Don't need to have any 100 byte buffers to hold that.

ASTERISK-29674 #close

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Change-Id: Id7b25bdca8f92e34229f6454f6c3e500f2cd6f56

3 years agoconversions.c: Specify that we only want to parse decimal numbers.
Sean Bright [Fri, 4 Mar 2022 20:26:22 +0000 (15:26 -0500)] 
conversions.c: Specify that we only want to parse decimal numbers.

Passing 0 as the last argument to strtoimax() or strtoumax() causes
octal and hexadecimal to be accepted which was not originally
intended. So we now force to only accept decimal.

ASTERISK-29950 #close

Change-Id: I93baf0f273441e8280354630a463df263a8c0edd

3 years agologger: workaround woefully small BUFSIZ in MUSL
Philip Prindeville [Tue, 22 Feb 2022 01:05:49 +0000 (18:05 -0700)] 
logger: workaround woefully small BUFSIZ in MUSL

MUSL defines BUFSIZ as 1024 which is not reasonable for log messages.

More broadly, BUFSIZ is the amount of buffering stdio.h does, which
is arbitrary and largely orthogonal to what logging should accept
as the maximum message size.

ASTERISK-29928

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Change-Id: Iaa49fbbab029c64ae3d95e4b18270e0442cce170

3 years agoapp_dial: Document DIALSTATUS return values.
Naveen Albert [Sat, 5 Mar 2022 12:04:57 +0000 (12:04 +0000)] 
app_dial: Document DIALSTATUS return values.

Adds documentation for all of the possible return values
for the DIALSTATUS variable in the Dial application.

ASTERISK-25716

Change-Id: Id22593f1f1f7ea86e5734cee49516ec50848e8c0

3 years agostasis_recording: Perform a complete match on requested filename.
Sean Bright [Thu, 10 Mar 2022 17:07:40 +0000 (12:07 -0500)] 
stasis_recording: Perform a complete match on requested filename.

Using the length of a file found on the filesystem rather than the
file being requested could result in filenames whose names are
substrings of another to be erroneously matched.

We now ensure a complete comparison before returning a positive
result.

ASTERISK-29960 #close

Change-Id: Id3ffc77681b9b75b8569062f3d952a128a21c71a

3 years agodownload_externals: Use HTTPS for downloads
Sean Bright [Tue, 22 Mar 2022 14:01:27 +0000 (10:01 -0400)] 
download_externals: Use HTTPS for downloads

ASTERISK-29980 #close

Change-Id: I7b347665822ea2774dd322276c09be67914d2065

3 years agores_pjsip_pubsub: RLS 'uri' list attribute mismatch with SUBSCRIBE request
Alexei Gradinari [Tue, 15 Mar 2022 17:24:18 +0000 (13:24 -0400)] 
res_pjsip_pubsub: RLS 'uri' list attribute mismatch with SUBSCRIBE request

When asterisk generates the RLMI part of NOTIFY request,
the asterisk uses the local contact uri instead of the URI to which
the SUBSCRIBE request is sent.
Because of this mismatch some IP phones (for example Cisco 5XX) ignore
this list.

According
https://datatracker.ietf.org/doc/html/rfc4662#section-5.2
  The first mandatory <list> attribute is "uri", which contains the uri
  that corresponds to the list. Typically, this is the URI to which
  the SUBSCRIBE request was sent.
https://datatracker.ietf.org/doc/html/rfc4662#section-5.3
  The "uri" attribute identifies the resource to which the <resource>
  element corresponds. Typically, this will be a SIP URI that, if
  subscribed to, would return the state of the resource.

This patch makes asterisk to generate URI using SUBSCRIBE request URI.

ASTERISK-29961 #close

Change-Id: I1fcfc08fd589677f40608c59a4e143c45ee05f6c

3 years agopbx_builtins: Add missing options documentation
Naveen Albert [Mon, 14 Mar 2022 16:57:29 +0000 (16:57 +0000)] 
pbx_builtins: Add missing options documentation

BackGround and WaitExten both accept options that are not
currently documented. This adds documentation for these
options to the xml documentation for each application.

ASTERISK-29967 #close

Change-Id: If812a9f1ccbba3e4d427a0e7a6dea923c2f905f7

3 years agoUpdate CHANGES and UPGRADE.txt for 19.3.0
Asterisk Development Team [Thu, 17 Mar 2022 15:26:57 +0000 (10:26 -0500)] 
Update CHANGES and UPGRADE.txt for 19.3.0

3 years agoAMI: Bump version for 19.3.0.
Ben Ford [Thu, 17 Mar 2022 14:24:33 +0000 (09:24 -0500)] 
AMI: Bump version for 19.3.0.

Change-Id: Ia41acd3f4f9589e8d3ecda3193764c83dade6186

3 years agores_pjsip_pubsub: update RLS to reflect the changes to the lists
Alexei Gradinari [Tue, 8 Feb 2022 22:58:30 +0000 (17:58 -0500)] 
res_pjsip_pubsub: update RLS to reflect the changes to the lists

This patch makes the Resource List Subscriptions (RLS) dynamic.
The asterisk updates the current subscriptions to reflect the changes
to the list on the subscriptions refresh. If list items are added,
removed, updated or do not exist anymore, the asterisk regenerates
the resource list.

ASTERISK-29906 #close

Change-Id: Icee8c00459a7aaa43c643d77ce6f16fb7ab037d3

3 years agores_config_pgsql: Add text-type column check in require_pgsql()
Boris P. Korzun [Fri, 18 Feb 2022 09:19:37 +0000 (12:19 +0300)] 
res_config_pgsql: Add text-type column check in require_pgsql()

Omit "unsupported column type 'text'" warning in logs while
using text-type column in the PgSQL backend.

ASTERISK-29924 #close

Change-Id: I48061a7d469426859670db07f1ed8af1eb814712

3 years agoapp_queue: Add QueueWithdrawCaller AMI action
Kfir Itzhak [Wed, 9 Feb 2022 10:28:29 +0000 (12:28 +0200)] 
app_queue: Add QueueWithdrawCaller AMI action

This adds a new AMI action called QueueWithdrawCaller.
This AMI action makes it possible to withdraw a caller from a queue,
in a safe and a generic manner.
This can be useful for retrieving a specific call and
dispatching it to a specific extension.
It works by signaling the caller to exit the queue application
whenever it can. Therefore, it is not guaranteed
that the call will leave the queue.

ASTERISK-29909 #close

Change-Id: Ic15aa238e23b2884abdcaadff2fda7679e29b7ec

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

ASTERISK-29945 #close

Change-Id: Ic58957afc453195d53c2bd25c905df3d91d1abe6

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

ASTERISK-29945 #close

Change-Id: Ia8ce6d82b115c82c1138747c72a0adcaa42b718c

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

ASTERISK-29945 #close

Change-Id: I721cd254e4f8aa6d3a97a37529cca53519694c54

3 years agoxml.c, config,c: Add stylesheets and variable list string parsing
George Joseph [Wed, 2 Mar 2022 14:57:26 +0000 (07:57 -0700)] 
xml.c, config,c:  Add stylesheets and variable list string parsing

Added functions to open, close, and apply XML Stylesheets
to XML documents.  Although the presence of libxslt was already
being checked by configure, it was only happening if xmldoc was
enabled.  Now it's checked regardless.

Added ability to parse a string consisting of comma separated
name/value pairs into an ast_variable list.  The reverse of
ast_variable_list_join().

Change-Id: I1e1d149be22165a1fb8e88e2903a36bba1a6cf2e

3 years agoxmldoc: Fix issue with xmlstarlet validation
George Joseph [Tue, 1 Mar 2022 16:58:44 +0000 (09:58 -0700)] 
xmldoc: Fix issue with xmlstarlet validation

Added the missing xml-stylesheet and Xinclude namespace
declarations in pjsip_config.xml and pjsip_manager.xml.

Updated make_xml_documentation to show detailed errors when
xmlstarlet is the validator.  It's now run once with the '-q'
option to suppress harmless/expected messages and if it actually
fails, it's run again without '-q' but with '-e' to show
the actual errors.

Change-Id: I4bdc9d2ea6741e8d2e5eb82df60c68ccc59e1f5e

3 years agocore: Config and XML tweaks needed for geolocation
George Joseph [Sun, 20 Feb 2022 20:16:22 +0000 (13:16 -0700)] 
core: Config and XML tweaks needed for geolocation

Added:

Replace a variable in a list:
int ast_variable_list_replace_variable(struct ast_variable **head,
    struct ast_variable *old, struct ast_variable *new);
Added test as well.

Create a "name=value" string from a variable list:
'name1="val1",name2="val2"', etc.
struct ast_str *ast_variable_list_join(
    const struct ast_variable *head, const char *item_separator,
    const char *name_value_separator, const char *quote_char,
    struct ast_str **str);
Added test as well.

Allow the name of an XML element to be changed.
void ast_xml_set_name(struct ast_xml_node *node, const char *name);

Change-Id: I330a5f63dc0c218e0d8dfc0745948d2812141ccb

3 years agoMakefile: Allow XML documentation to exist outside source files
George Joseph [Mon, 14 Feb 2022 13:31:25 +0000 (06:31 -0700)] 
Makefile: Allow XML documentation to exist outside source files

Moved the xmldoc build logic from the top-level Makefile into
its own script "make_xml_documentation" in the build_tools
directory.

Created a new utility script "get_sourceable_makeopts", also in
the build_tools directory, that dumps the top-level "makeopts"
file in a format that can be "sourced" from shell sscripts.
This allows scripts to easily get the values of common make
build variables such as the location of the GREP, SED, AWK, etc.
utilities as well as the AST* and library *_LIB and *_INCLUDE
variables.

Besides moving logic out of the Makefile, some optimizations
were done like removing "third-party" from the list of
subdirectories to be searched for documentation and changing some
assignments from "=" to ":=" so they're only evaluated once.
The speed increase is noticeable.

The makeopts.in file was updated to include the paths to
REALPATH and DIRNAME.  The ./conifgure script was setting them
but makeopts.in wasn't including them.

So...

With this change, you can now place documentation in any"c"
source file AND you can now place it in a separate XML file
altogether.  The following are examples of valid locations:

res/res_pjsip.c
    Using the existing /*** DOCUMENTATION ***/ fragment.

res/res_pjsip/pjsip_configuration.c
    Using the existing /*** DOCUMENTATION ***/ fragment.

res/res_pjsip/pjsip_doc.xml
    A fully-formed XML file.  The "configInfo", "manager",
    "managerEvent", etc. elements that would be in the "c"
    file DOCUMENTATION fragment should be wrapped in proper
    XML.  Example for "somemodule.xml":

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE docs SYSTEM "appdocsxml.dtd">
    <docs>
        <configInfo>
        ...
        </configInfo>
    </docs>

It's the "appdocsxml.dtd" that tells make_xml_documentation
that this is a documentation XML file and not some other XML file.
It also allows many XML-capable editors to do formatting and
validation.

Other than the ".xml" suffix, the name of the file is not
significant.

As a start... This change also moves the documentation that was
in res_pjsip.c to 2 new XML files in res/res_pjsip:
pjsip_config.xml and pjsip_manager.xml.  This cut the number of
lines in res_pjsip.c in half. :)

Change-Id: I486c16c0b5a44d7a8870008e10c941fb19b71ade

3 years agobuild: Refactor the earlier "basebranch" commit
George Joseph [Thu, 17 Feb 2022 16:26:46 +0000 (09:26 -0700)] 
build: Refactor the earlier "basebranch" commit

Recap from earlier commit:  If you have a development branch for a
major project that will receive gerrit reviews it'll probably be
named something like "development/16/newproject" or a work branch
based on that "development" branch.  That will necessitate
setting "defaultbranch=development/16/newproject" in .gitreview.
The make_version script uses that variable to construct the
asterisk version however, which results in versions
like "GIT-development/16/newproject-ee582a8c7b" which is probably
not what you want.  It also constructs the URLs for downloading
external modules with that version, which will fail.

Fast-forward:

The earlier attempt at adding a "basebranch" variable to
.gitreview didn't work out too well in practice because changes
were made to .gitreview, which is a checked-in file.  So, if
you wanted to rebase your work branch on the base branch, rebase
would attempt to overwrite your .gitreview with the one from
the base branch and complain about a conflict.

This is a slighltly different approach that adds three methods to
determine the mainline branch:

1.  --- MAINLINE_BRANCH from the environment

If MAINLINE_BRANCH is already set in the environment, that will
be used.  This is primarily for the Jenkins jobs.

2.  --- .develvars

Instead of storing the basebranch in .gitreview, it can now be
stored in a non-checked-in ".develvars" file and keyed by the
current branch.  So, if you were working on a branch named
"new-feature-work" based on "development/16/new-feature" and wanted
 to push to that branch in Gerrit but wanted to pull the external
 modules for 16, you'd create the following .develvars file:

[branch "new-feature-work"]
    mainline-branch = 16

The .gitreview file would still look like:

[gerrit]
defaultbranch=development/16/new-feature

...which would cause any reviews pushed from "new-feature-work" to
go to the "development/16/new-feature" branch in Gerrit.

The key is that the .develvars file is NEVER checked in (it's been
added to .gitignore).

3.  --- Well Known Development Branch

If you're actually working in a branch named like
"development/<mainline_branch>/some-feature", the mainline branch
will be parsed from it.

4.  --- .gitreview

If none of the earlier conditions exist, the .gitreview
"defaultbranch" variable will be used just as before.

Change-Id: I1cdeeaa0944bba3f2e01d7a2039559d0c266f8c9

3 years agojansson: Update bundled to 2.14 version.
Joshua C. Colp [Wed, 23 Feb 2022 13:58:25 +0000 (09:58 -0400)] 
jansson: Update bundled to 2.14 version.

ASTERISK-29353

Change-Id: I4ea43eda1691565563a4c03ef37166952d211b2b