]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
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 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 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 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 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_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 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: Add basic config skeleton and CLI commands.
Ben Ford [Mon, 29 Mar 2021 17:28:24 +0000 (12:28 -0500)] 
res_aeap: Add basic config skeleton and CLI commands.

Added support for a basic AEAP configuration read from aeap.conf.
Also added 2 CLI commands for showing individual configurations as
well as all of them: aeap show server <id> and aeap show servers.

Only one configuration option is required at the moment, and that one is
server_url. It must be a websocket URL. The other option, codecs, is
optional and will be used over the codecs specified on the endpoint if
provided.

https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=45482453

Change-Id: I567ac5148c92b98d29d2ad83421b416b75ffdaa3
(cherry picked from commit 45a1977de49f56de5875a2cde951780de146762d)

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 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 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 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 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 agoUpdate CHANGES and UPGRADE.txt for 18.11.2
Asterisk Development Team [Thu, 14 Apr 2022 20:47:41 +0000 (15:47 -0500)] 
Update CHANGES and UPGRADE.txt for 18.11.2

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

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 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 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 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 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 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 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 11:56:42 +0000 (22:56 +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 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 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 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 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 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 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 agoAMI: Bump version for 18.11.0.
Ben Ford [Thu, 17 Mar 2022 14:19:22 +0000 (09:19 -0500)] 
AMI: Bump version for 18.11.0.

Change-Id: Ic15cfca9e68efd06a1b12ab2335d52a5890e7170

3 years agores_config_pgsql: Add text-type column check in require_pgsql() 25/head
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 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 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

3 years agoami: Allow events to be globally disabled.
Naveen Albert [Sun, 9 Jan 2022 13:32:48 +0000 (13:32 +0000)] 
ami: Allow events to be globally disabled.

The disabledevents setting has been added to the general section
in manager.conf, which allows users to specify events that
should be globally disabled and not sent to any AMI listeners.

This allows for processing of these AMI events to end sooner and,
for frequent AMI events such as Newexten which users may not have
any need for, allows them to not be processed. Additionally, it also
cleans up core debug as previously when debug was 3 or higher,
the debug was constantly spammed by "Analyzing AMI event" messages
along with a complete dump of the event contents (often for Newexten).

ASTERISK-29853 #close

Change-Id: Id42b9a3722a1f460d745cad1ebc47c537fd4f205

3 years agofunc_channel: Add lastcontext and lastexten.
Naveen Albert [Thu, 6 Jan 2022 13:57:01 +0000 (13:57 +0000)] 
func_channel: Add lastcontext and lastexten.

Adds the lastcontext and lastexten channel fields to allow users
to access previous dialplan execution locations.

ASTERISK-29840 #close

Change-Id: Ib455fe300cc8e9a127686896ee2d0bd11e900307

3 years agochannel.c: Clean up debug level 1.
Naveen Albert [Sat, 5 Feb 2022 01:27:27 +0000 (01:27 +0000)] 
channel.c: Clean up debug level 1.

Although there are 10 debugs levels, over time,
many current debug calls have come to use
inappropriately low debug levels. In particular,
a select few debug calls (currently all debug 1)
can result in thousands of debug messages per minute
for a single call.

This can adds a lot of noise to core debug
which dilutes the value in having different
debug levels in the first place, as these
log messages are from the core internals are
are better suited for higher debug levels.

Some debugs levels are thus adjusted so that
debug level 1 is not inappropriately overloaded
with these extremely high-volume and general
debug messages.

ASTERISK-29897 #close

Change-Id: I55a71598993552d3d64a401a35ee99474770d4b4

3 years agoconfigs, LICENSE: remove pbx.digium.com.
Naveen Albert [Thu, 17 Feb 2022 19:47:59 +0000 (19:47 +0000)] 
configs, LICENSE: remove pbx.digium.com.

pbx.digium.com no longer accepts IAX2 calls and
there are no plans for it to come back.

Accordingly, nonworking IAX2 URIs are removed from
both the LICENSE file and the sample config.

ASTERISK-29923 #close

Change-Id: I257c54d4d812ed6b4bd4cbec2cd7ebe2b87b5bad

3 years agodocumentation: Add since tag to xmldocs DTD
Naveen Albert [Sat, 5 Feb 2022 01:11:43 +0000 (01:11 +0000)] 
documentation: Add since tag to xmldocs DTD

Adds the since tag to the documentation DTD so
that individual applications, functions, etc.
can now specify when they were added to Asterisk.

This tag is added at the individual application,
function, etc. level as opposed to at the module
level because modules can expand over time as new
functionality is added, and granularity only
to the module level would generally not be useful.

This enables the ability to more easily determine
when new functionality was added to Asterisk, down
to minor version as opposed to just by major version.
This makes it easier for users to write more portable
dialplan if desired to not use functionality that may
not be widely available yet.

ASTERISK-29896 #close

Change-Id: Ibbb35c702d8038bdc3fd0a944fbfa69384cc15d5

3 years agoasterisk: Add macro for curl user agent.
Naveen Albert [Thu, 13 Jan 2022 14:37:16 +0000 (14:37 +0000)] 
asterisk: Add macro for curl user agent.

Currently, each module that uses libcurl duplicates the standard
Asterisk curl user agent.

This adds a global macro for the Asterisk user agent used for
curl requests to eliminate this duplication.

ASTERISK-29861 #close

Change-Id: I9fc37935980384b4daf96ae54fa3c9adb962ed2d

3 years agores_stir_shaken: refactor utility function
Naveen Albert [Thu, 16 Dec 2021 19:41:56 +0000 (19:41 +0000)] 
res_stir_shaken: refactor utility function

Refactors temp file utility function into file.c.

ASTERISK-29809 #close

Change-Id: Ife478708c8f2b127239cb73c1755ef18c0bf431b

3 years agoapp_voicemail: Emit warning if asking for nonexistent mailbox.
Naveen Albert [Wed, 16 Feb 2022 11:34:34 +0000 (11:34 +0000)] 
app_voicemail: Emit warning if asking for nonexistent mailbox.

Currently, if VoiceMailMain is called with a mailbox, if that
mailbox doesn't exist, then the application silently falls back
to prompting the user for the mailbox, as if no arguments were
provided.

However, if a specific mailbox is requested and it doesn't exist,
then no warning at all is emitted.

This fixes this behavior to now warn if a specifically
requested mailbox could not be accessed, before falling back to
prompting the user for the correct mailbox.

ASTERISK-29920 #close

Change-Id: Ib4093b88cd661a2cabc5d685777d4e2f0ebd20a4

3 years agores_pjsip_pubsub: fix Batched Notifications stop working
Alexei Gradinari [Mon, 7 Feb 2022 22:31:19 +0000 (17:31 -0500)] 
res_pjsip_pubsub: fix Batched Notifications stop working

If Subscription refresh occurred between when the batched notification
was scheduled and the serialized notification was to be sent,
then new schedule notification task would never be added.

There are 2 threads:

thread #1. ast_sip_subscription_notify is called,
if notification_batch_interval then call schedule_notification.
1.1. The schedule_notification checks notify_sched_id > -1
not true, then
send_scheduled_notify = 1
notify_sched_id =
  ast_sched_add(sched, sub_tree->notification_batch_interval, sched_cb....
1.2. The sched_cb pushes task serialized_send_notify to serializer
and returns 0 which means no reschedule.
1.3. The serialized_send_notify checks send_scheduled_notify if it's false
the just returns. BUT notify_sched_id is still set, so no more ast_sched_add.

thread #2. pubsub_on_rx_refresh is called
2.1 it pushes serialized_pubsub_on_refresh_timeout to serializer
2.2. The serialized_pubsub_on_refresh_timeout calls pubsub_on_refresh_timeout
which calls send_notify
2.3. The send_notify set send_scheduled_notify = 0;

The serialized_send_notify should always unset notify_sched_id.

ASTERISK-29904 #close

Change-Id: Ifc50c00b213c396509e10326a1ed89d8cf8c7875

3 years agofunc_db: Add validity check for key names when writing.
Naveen Albert [Fri, 18 Feb 2022 12:09:47 +0000 (12:09 +0000)] 
func_db: Add validity check for key names when writing.

Adds a simple sanity check for key names when users are
writing data to AstDB. This captures four cases indicating
malformed keynames that generally result in bad data going
into the DB that the user didn't intend: an empty key name,
a key name beginning or ending with a slash, and a key name
containing two slashes in a row. Generally, this is the
result of a variable being used in the key name being empty.

If a malformed key name is detected, a warning is emitted
to indicate the bug in the dialplan.

ASTERISK-29925 #close

Change-Id: Ifc08a9fe532a519b1b80caca1aafed7611d573bf

3 years agores_pjsip_pubsub: provide a display name for RLS subscriptions
Alexei Gradinari [Tue, 1 Feb 2022 15:59:02 +0000 (10:59 -0500)] 
res_pjsip_pubsub: provide a display name for RLS subscriptions

Whereas BLFs allow to show a display name for each RLS entry,
the asterisk provides only the extension now.
This is not end user friendly.

This commit adds a new resource_list option, resource_display_name,
to indicate whether display name of resource or the resource name being
provided for RLS entries.
If this option is enabled, the Display Name will be provided.
This option is disabled by default to remain the previous behavior.
If the 'event' set to 'presence' or 'dialog' the non-empty HINT name
will be set as the Display Name.
The 'message-summary' is not supported yet.

ASTERISK-29891 #close

Change-Id: Ic5306bd5a7c73d03f5477fe235e9b0f41c69c681

3 years agocli: Add core dump info to core show settings.
Naveen Albert [Fri, 14 Jan 2022 01:37:57 +0000 (01:37 +0000)] 
cli: Add core dump info to core show settings.

Adds two pieces of information to the core show settings command
which are useful in the context of getting backtraces.

The first is to display whether or not Asterisk would generate
a core dump if it were to crash.

The second is to show the current running directory of Asterisk.

ASTERISK-29866 #close

Change-Id: Ic42c0a9ecc233381aad274d86c62808d1ebb4d83

3 years agodocumentation: Adds missing default attributes.
Naveen Albert [Sat, 5 Feb 2022 01:46:27 +0000 (01:46 +0000)] 
documentation: Adds missing default attributes.

The configObject tag contains a default attribute which
allows the default value to be specified, if applicable.
This allows for the default value to show up specially on
the wiki in a way that is clear to users.

There are a couple places in the tree where default values
are included in the description as opposed to as attributes,
which means these can't be parsed specially for the wiki.
These are changed to use the attribute instead of being
included in the text description.

ASTERISK-29898 #close

Change-Id: I9d7ea08f50075f41459ea7b76654906b674ec755

3 years agoapp_mp3: Document and warn about HTTPS incompatibility.
Naveen Albert [Sat, 5 Feb 2022 12:39:42 +0000 (12:39 +0000)] 
app_mp3: Document and warn about HTTPS incompatibility.

mpg123 doesn't support HTTPS, but the MP3Player application
doesn't document this or warn the user about this. HTTPS
streams have become more common nowadays and users could
reasonably try to play them without being aware they should
use the HTTP stream instead.

This adds documentation to note this limitation. It also
throws a warning if users try to use the HTTPS stream to
tell them to use the HTTP stream instead.

ASTERISK-29900 #close

Change-Id: Ie3b029be5258c5a701f71ed3b1a7a80d1e03b827

3 years agoapp_mf: Add max digits option to ReceiveMF.
Naveen Albert [Sat, 22 Jan 2022 22:52:45 +0000 (22:52 +0000)] 
app_mf: Add max digits option to ReceiveMF.

Adds an option to the ReceiveMF application to allow specifying a
maximum number of digits.

Originally, this capability was not added to ReceiveMF as it was
with ReceiveSF because typically a ST digit is used to denote that
sending of digits is complete. However, there are certain signaling
protocols which simply transmit a digit (such as Expanded In-Band
Signaling) and for these, it's necessary to be able to read a
certain number of digits, as opposed to until receiving a ST digit.

This capability is added as an option, as opposed to as a parameter,
to remain compatible with existing usage (and not shift the
parameters).

ASTERISK-29877 #close

Change-Id: I4229167c9aa69b87402c3c2a9065bd8dfa973a0b

3 years agotaskprocessor.c: Prevent crash on graceful shutdown
Mike Bradeen [Thu, 3 Feb 2022 01:18:06 +0000 (18:18 -0700)] 
taskprocessor.c: Prevent crash on graceful shutdown

When tps_shutdown is called as part of the cleanup process there is a
chance that one of the taskprocessors that references the
tps_singletons object is still running.  The change is to allow for
tps_shutdown to check tps_singleton's container count and give the
running taskprocessors a chance to finish.  If after
AST_TASKPROCESSOR_SHUTDOWN_MAX_WAIT (10) seconds there are still
container references we shutdown anyway as this is most likely a bug
due to a taskprocessor not being unreferenced.

ASTERISK-29365

Change-Id: Ia932fc003d316389b9c4fd15ad6594458c9727f1

3 years agoapp_queue: load queues and members from Realtime when needed
Alexei Gradinari [Fri, 21 Jan 2022 19:00:53 +0000 (14:00 -0500)] 
app_queue: load queues and members from Realtime when needed

There are a lot of Queue AMI actions and Queue applications
which do not load queue and queue members from Realtime.

AMI actions
QueuePause - if queue not in memory - response "Interface not found".
QueueStatus/QueueSummary - if queue not in memory - empty response.

Applications:
PauseQueueMember - if queue not in memory
Attempt to pause interface %s, not found
UnpauseQueueMember - if queue not in memory
Attempt to unpause interface xxxxx, not found

This patch adds a new function load_realtime_queues
which loads queue and queue members for desired queue
or all queues and all members if param 'queuename' is NULL or empty.
Calls the function load_realtime_queues when needed.

Also this patch fixes leak of ast_config in function set_member_value.

Also this patch fixes incorrect LOG_WARNING when pausing/unpausing
already paused/unpaused member.
The function ast_update_realtime returns 0 when no record modified.
So 0 is not an error to warn about.

ASTERISK-29873 #close
ASTERISK-18416 #close
ASTERISK-27597 #close

Change-Id: I554ee0eebde93bd8f49df7f84b74acb21edcb99c

3 years agores_prometheus.c: missing module dependency
Mark Petersen [Fri, 21 Jan 2022 13:52:23 +0000 (14:52 +0100)] 
res_prometheus.c: missing module dependency

added res_pjsip_outbound_registration to .requires in AST_MODULE_INFO
which fixes issue with module crashes on load "FRACK!, Failed assertion"

ASTERISK-29871

Change-Id: Ia0f49d048427a40e1b763296b834a52a03610096

3 years agomanager.c: Simplify AMI ModuleCheck handling
Sean Bright [Mon, 7 Feb 2022 16:55:51 +0000 (11:55 -0500)] 
manager.c: Simplify AMI ModuleCheck handling

This code was needlessly complex and would fail to properly delimit
the response message if LOW_MEMORY was defined.

Change-Id: Iae50bf09ef4bc34f9dc4b49435daa76f8b2c5b6e

3 years agores_pjsip.c: Correct minor typos in 'realm' documentation.
Sean Bright [Thu, 3 Feb 2022 21:48:49 +0000 (16:48 -0500)] 
res_pjsip.c: Correct minor typos in 'realm' documentation.

Change-Id: I886936b808def5540d40071321e72f6bfa19063a

3 years agomanager.c: Generate valid XML if attribute names have leading digits.
Sean Bright [Mon, 31 Jan 2022 18:52:26 +0000 (13:52 -0500)] 
manager.c: Generate valid XML if attribute names have leading digits.

The XML Manager Event Interface (amxml) now generates attribute names
that are compliant with the XML 1.1 specification. Previously, an
attribute name that started with a digit would be rendered as-is, even
though attribute names must not begin with a digit. We now prefix
attribute names that start with a digit with an underscore ('_') to
prevent XML validation failures.

This is not backwards compatible but my assumption is that compliant
XML parsers would already have been complaining about this.

ASTERISK-29886 #close

Change-Id: Icfaa56a131a082d803e9b7db5093806d455a0523

3 years agoUpdate CHANGES and UPGRADE.txt for 18.10.0
Asterisk Development Team [Thu, 3 Feb 2022 12:12:12 +0000 (07:12 -0500)] 
Update CHANGES and UPGRADE.txt for 18.10.0

3 years agobuild_tools/make_version: Fix bashism in comparison.
Sean Bright [Tue, 1 Feb 2022 16:09:58 +0000 (11:09 -0500)] 
build_tools/make_version: Fix bashism in comparison.

In POSIX sh (which we indicate in the shebang), there is no ==
operator.

Change-Id: Ic03d38214d14cdf329b0ba272279a815bb532965

3 years agobundled_pjproject: Add additional multipart search utils
George Joseph [Fri, 21 Jan 2022 20:08:11 +0000 (13:08 -0700)] 
bundled_pjproject:  Add additional multipart search utils

Added the following APIs:
pjsip_multipart_find_part_by_header()
pjsip_multipart_find_part_by_header_str()
pjsip_multipart_find_part_by_cid_str()
pjsip_multipart_find_part_by_cid_uri()

Change-Id: I6aee3dcf59eb171f93aae0f0564ff907262ef40d

3 years agochan_sip.c Fix pickup on channel that are in AST_STATE_DOWN
Mark Petersen [Fri, 7 Jan 2022 10:01:27 +0000 (11:01 +0100)] 
chan_sip.c Fix pickup on channel that are in AST_STATE_DOWN

resolve issue with pickup on device that uses "183" and not "180"

ASTERISK-29832

Change-Id: I4c7d223870f8ce9a7354e0f73d4e4cb2e8b58841

3 years agores_pjsip_outbound_authenticator_digest: Prevent ABRT on cleanup
George Joseph [Mon, 31 Jan 2022 13:09:09 +0000 (06:09 -0700)] 
res_pjsip_outbound_authenticator_digest: Prevent ABRT on cleanup

In dev mode, if you call pjsip_auth_clt_deinit() with an auth_sess
that hasn't been initialized, it'll assert and abort.  If
digest_create_request_with_auth() fails to find the proper
auth object however, it jumps to its cleanup which does exactly
that.  So now we no longer attempt to call pjsip_auth_clt_deinit()
if we never actually initialized it.

ASTERISK-29888

Change-Id: Ib6171c25c9fe8e61cc8d11129e324c021bc30b62

3 years agobuild: Add "basebranch" to .gitreview
George Joseph [Wed, 26 Jan 2022 13:56:15 +0000 (06:56 -0700)] 
build: Add "basebranch" to .gitreview

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".  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.  Worse, since the download_externals script uses
make_version to construct the URL to download the binary codecs
or DPMA.  Since it's expecting a simple numeric version, the
downloads will fail.

To get this to work, a new variable "basebranch" has been added
to .gitreview and make_version has been updated to use that instead
of defaultversion:

.gitreview:
defaultbranch=development/16/myproject
basebranch=16

Now git-review will send the reviews to the proper branch
(development/16/myproject) but the version will still be
constructed using the simple branch number (16).

If "basebranch" is missing from .gitreview, make_version will
fall back to using "defaultbranch".

Change-Id: I2941a3b21e668febeb6cfbc1a7bb51a67726fcc4

3 years agocdr: allow disabling CDR by default on new channels
Naveen Albert [Wed, 15 Dec 2021 18:36:42 +0000 (18:36 +0000)] 
cdr: allow disabling CDR by default on new channels

Adds a new option, defaultenabled, to the CDR core to
control whether or not CDR is enabled on a newly created
channel. This allows CDR to be disabled by default on
new channels and require the user to explicitly enable
CDR if desired. Existing behavior remains unchanged.

ASTERISK-29808 #close

Change-Id: Ibb78c11974bda229bbb7004b64761980e0b2c6d1

3 years agores_tonedetect: Fixes some logic issues and typos
Naveen Albert [Tue, 11 Jan 2022 19:19:13 +0000 (19:19 +0000)] 
res_tonedetect: Fixes some logic issues and typos

Fixes some minor logic issues with the module:

Previously, the OPT_END_FILTER flag was getting
tested before options were parsed, so it could
never evaluate to true (wrong ordering).

Additionally, the initially parsed timeout (float)
needs to be compared with 0, not the result int
which is set afterwards (wrong variable).

ASTERISK-29857 #close

Change-Id: I0062bce3b391c15e5df7a714780eeaa96dd93d4c

3 years agofunc_frame_drop: Fix typo referencing wrong buffer
Naveen Albert [Tue, 11 Jan 2022 18:33:34 +0000 (18:33 +0000)] 
func_frame_drop: Fix typo referencing wrong buffer

In order to get around the issue of certain frames
having names that could overlap, func_frame_drop
surrounds names with commas for the purposes of
comparison.

The buffer is allocated and printed to properly,
but the original buffer is used for comparison.
In most cases, this wouldn't have had any effect,
but that was not the intention behind the buffer.
This updates the code to reference the modified
buffer instead.

ASTERISK-29854 #close

Change-Id: I430b52e14e712d0e62a23aa3b5644fe958b684a7

3 years agores/res_rtp_asterisk: fix skip in rtp sequence numbers after dtmf
Torrey Searle [Thu, 20 Jan 2022 12:56:27 +0000 (13:56 +0100)] 
res/res_rtp_asterisk: fix skip in rtp sequence numbers after dtmf

When generating dtmfs, asterisk can incorrectly think packet loss
occured during the dtmf generation, resulting in a jump in sequence
numbers when forwarding voice frames resumes.  This patch forces
asterisk to re-learn the expected sequence number after each DTMF
to avoid this

ASTERISK-29869 #close

Change-Id: Icc7de3d947b207b82c99d3c327af8095884df853

3 years agores_http_websocket: Add a client connection timeout
Kevin Harwell [Thu, 13 Jan 2022 22:31:27 +0000 (16:31 -0600)] 
res_http_websocket: Add a client connection timeout

Previously there was no way to specify a connection timeout when
attempting to connect a websocket client to a server. This patch
makes it possible to now do such.

Change-Id: I5812f6f28d3d13adbc246517f87af177fa20ee9d

3 years agobuild: Rebuild configure and autoconfig.h.in
Sean Bright [Fri, 21 Jan 2022 16:34:38 +0000 (11:34 -0500)] 
build: Rebuild configure and autoconfig.h.in

autoconfigh.h.in was missed in the original review for this
issue. Additionally it looks like I have newer pkg-config autoconf
macros on my development machine.

ASTERISK-29817

Change-Id: I3c85a4de82c5d7d6e0e23dad4c33bb650a86a57b

3 years agosched: fix and test a double deref on delete of an executing call back
Mike Bradeen [Wed, 8 Dec 2021 21:14:48 +0000 (14:14 -0700)] 
sched: fix and test a double deref on delete of an executing call back

sched: Avoid a double deref when AST_SCHED_DEL_UNREF is called on an
executing call-back. This is done by adding a new variable 'rescheduled'
to the struct sched which is set in ast_sched_runq and checked in
ast_sched_del_nonrunning. ast_sched_del_nonrunning is a replacement for
now deprecated ast_sched_del which returns a new possible value -2
if called on an executing call-back with rescheduled set. ast_sched_del
is modified to call ast_sched_del_nonrunning to maintain existing code.
AST_SCHED_DEL_UNREF is also updated to look for the -2 in which case it
will not throw a warning or invoke refcall.
test_sched: Add a new unit test sched_test_freebird that will check the
reference count in the resolved scenario.

ASTERISK-29698

Change-Id: Icfb16b3acbc29cf5b4cef74183f7531caaefe21d

3 years agores_pjsip_sdp_rtp.c: Support keepalive for video streams.
Luke Escude [Wed, 19 Jan 2022 22:33:51 +0000 (17:33 -0500)] 
res_pjsip_sdp_rtp.c: Support keepalive for video streams.

ASTERISK-28890 #close

Change-Id: Iad269a8dc36f892ede90fe8ceb3010560c0f70d1

3 years agoapp_queue.c: Queue don't play "thank-you" when here is no hold time announcements
Mark Petersen [Tue, 4 Jan 2022 09:11:41 +0000 (10:11 +0100)] 
app_queue.c: Queue don't play "thank-you" when here is no hold time announcements

if holdtime is (0 min, 0 sec) there is no hold time announcements
we should then also not playing queue-thankyou

ASTERISK-29831

Change-Id: Ic7e51dcde526b23f1cd8d24e1d1e2d81e10f9d2c

3 years agomain: Enable rdtsc support on NetBSD
Michał Górny [Thu, 11 Nov 2021 04:24:38 +0000 (05:24 +0100)] 
main: Enable rdtsc support on NetBSD

Enable the Linux rdtsc implementation on NetBSD as well.  The assembly
works correctly there.

ASTERISK-29851

Change-Id: I460ad9b4d971913420ecb84186f5ba5ab03f6f37

3 years agobuild_tools/make_version: Fix sed(1) syntax compatibility with NetBSD
Michał Górny [Thu, 11 Nov 2021 03:40:40 +0000 (04:40 +0100)] 
build_tools/make_version: Fix sed(1) syntax compatibility with NetBSD

Fix the sed(1) invocation used to process git-svn-id not to use "\s"
that is a GNU-ism and is not supported by NetBSD sed.  As a result,
this call did not work properly and make_version did output the full
git-svn-id line rather than the revision.

ASTERISK-29852

Change-Id: Ie4b406e2748920643446851a0a252a4ca7245772

3 years agomain/utils: Implement ast_get_tid() for NetBSD
Michał Górny [Thu, 11 Nov 2021 04:29:44 +0000 (05:29 +0100)] 
main/utils: Implement ast_get_tid() for NetBSD

Implement the ast_get_tid() function for NetBSD system.  NetBSD supports
getting the TID via _lwp_self().

ASTERISK-29850

Change-Id: If57fd3f9ea15ef5d010bfbdcbbbae9b379f72f8c

3 years agoBuildSystem: Fix misdetection of gethostbyname_r() on NetBSD
Michał Górny [Thu, 11 Nov 2021 02:05:02 +0000 (03:05 +0100)] 
BuildSystem: Fix misdetection of gethostbyname_r() on NetBSD

Fix the configure script not to detect the presence of gethostbyname_r()
on NetBSD incorrectly.  NetBSD includes it as an internal libc symbol
that is not exposed in system headers and that is incompatible with
other implementations.  In order to avoid misdetecting it, perform
the symbol check only if the declaration is found in the public header
first.

ASTERISK-29817

Change-Id: Iafa359b09908251bcd299ff54be003ea129b9eda

3 years agoinclude: Remove unimplemented HMAC declarations
Michał Górny [Thu, 11 Nov 2021 04:06:27 +0000 (05:06 +0100)] 
include: Remove unimplemented HMAC declarations

Remove the HMAC declarations from the includes.  They are
not implemented nor used anywhere, and their presence breaks the build
on NetBSD that delivers an incompatible hmac() function in <stdlib.h>.

ASTERISK-29818

Change-Id: I0c4b88645e30174b1b63846a6b328625b69c2ea7

3 years agoframe.h: Fix spelling typo
Naveen Albert [Tue, 11 Jan 2022 18:41:18 +0000 (18:41 +0000)] 
frame.h: Fix spelling typo

Fixes CNG description from "noice" to "noise".

ASTERISK-29855 #close

Change-Id: Ie7cbbd7d72b426693df7447384ff8700318cd36d

3 years agores_rtp_asterisk: Fix typo in flag test/set
Naveen Albert [Tue, 11 Jan 2022 18:46:08 +0000 (18:46 +0000)] 
res_rtp_asterisk: Fix typo in flag test/set

The code currently checks to see if an RFC3389
warning flag is set, except if it is, it merely
sets the flag again, the logic of which doesn't
make any sense.

This adjusts the if comparison to check if the
flag has NOT been set, and if so, emit a notice
log event and set the flag so that future frames
do not cause an event to be logged.

ASTERISK-29856 #close

Change-Id: Ib7098c947c63537d087a03b4646199fbb963f8e1

3 years agobundled_pjproject: Fix srtp detection
George Joseph [Tue, 18 Jan 2022 14:04:24 +0000 (07:04 -0700)] 
bundled_pjproject: Fix srtp detection

Reverted recent change that set '--with-external-srtp' instead
of '--without-external-srtp'.  Since Asterisk handles all SRTP,
we don't need it enabled in pjproject at all.

ASTERISK-29867

Change-Id: I2ce1bdd30abd21c062eac8f8fefe9b898787b801

3 years agores_pjsip: Make message_filter and session multipart aware
George Joseph [Mon, 10 Jan 2022 13:44:12 +0000 (06:44 -0700)] 
res_pjsip: Make message_filter and session multipart aware

Neither pjsip_message_filter's filter_on_tx_message() nor
res_pjsip_session's session_outgoing_nat_hook() were multipart
aware and just assumed that an SDP would be the only thing in
a message body.  Both were changed to use the new
pjsip_get_sdp_info() function which searches for an sdp in
both single- and multi- part message bodies.

ASTERISK-29813

Change-Id: I8f5b8cfdc27f1d4bd3e7491ea9090951a4525c56