]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
3 years agoCI: additional python venv requirements development/16/python3
Mike Bradeen [Tue, 2 Aug 2022 18:23:37 +0000 (12:23 -0600)] 
CI: additional python venv requirements

ASTERISK-26826

Change-Id: I9b281591e90d661fa9480a3b2b10f6ead0602b0e

3 years agoCI: Use virtual environment for testsuite
Mike Bradeen [Fri, 24 Jun 2022 17:19:20 +0000 (11:19 -0600)] 
CI: Use virtual environment for testsuite

As part of the move to Python3, the testsuite is now designed
to work with a virtual environment.

This change is to have runTestsuite use the venv method if
possible and fall back if it can't.  If the script is run from
an externally activated virtual enviroment, then use that and
don't try either method.

Change-Id: I9724c446d67a5ee9e550644e4a78739de823536e

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 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 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 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 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 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 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_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 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 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 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 16.24.0
Asterisk Development Team [Thu, 3 Feb 2022 12:09:02 +0000 (07:09 -0500)] 
Update CHANGES and UPGRADE.txt for 16.24.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 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_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 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 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 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 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 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_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 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

3 years agobuild: Fix issues building pjproject
George Joseph [Wed, 12 Jan 2022 17:12:01 +0000 (10:12 -0700)] 
build: Fix issues building pjproject

The change to allow easier hacking on bundled pjproject created
a few issues:

* The new Makefile was trying to run the bundled make even if
  PJPROJECT_BUNDLED=no.  third-party/Makefile now checks for
  PJPROJECT_BUNDLED and JANSSON_BUNDLED and skips them if they
  are "no".

* When building with bundled, config_site.h was being copied
  only if a full make or a "make main" was done.  A "make res"
  would fail all the pjsip modules because they couldn't find
  config_site.h.  The Makefile now copies config_site.h and
  asterisk_malloc_debug.h into the pjproject source tree
  when it's "configure" is performed.  This is how it used
  to be before the big change.

ASTERISK-29858

Change-Id: I9427264fa3cb8b3f59a95e5f9693eac236a6f76d

3 years agores_pjsip: Add utils for checking media types
George Joseph [Thu, 6 Jan 2022 19:05:34 +0000 (12:05 -0700)] 
res_pjsip: Add utils for checking media types

Added two new functions to assist checking media types...

* ast_sip_are_media_types_equal compares two pjsip_media_types.
* ast_sip_is_media_type_in tests if one media type is in a list
  of others.

Added static definitions for commonly used media types to
res_pjsip.h.

Changed several modules to use the new functions and static
definitions.

ASTERISK_29813
(not ready to close)

Change-Id: Ief77675235bd3bf00a6b095d4673fd878d0801b9

3 years agosay.c: Prevent erroneous failures with 'say' family of functions.
Sean Bright [Wed, 12 Jan 2022 19:20:34 +0000 (14:20 -0500)] 
say.c: Prevent erroneous failures with 'say' family of functions.

A regression was introduced in ASTERISK~29531 that caused 'say'
functions to fail with file lists that would previously have
succeeded. This caused affected channels to hang up where previously
they would have continued.

We now explicitly check for the empty string to restore the previous
behavior.

ASTERISK-29859 #close

Change-Id: Ia2e5769868e2792313c2d7c07996efe009c6f8d5

3 years agobundled_pjproject: Create generic pjsip_hdr_find functions
George Joseph [Wed, 12 Jan 2022 13:16:42 +0000 (06:16 -0700)] 
bundled_pjproject: Create generic pjsip_hdr_find functions

pjsip_msg_find_hdr(), pjsip_msg_find_hdr_by_name(), and
pjsip_msg_find_hdr_by_names() require a pjsip_msg to be passed in
so if you need to search a header list that's not in a pjsip_msg,
you have to do it yourself.  This commit adds generic versions of
those 3 functions that take in the actual header list head instead
of a pjsip_msg so if you need to search a list of headers in
something like a pjsip_multipart_part, you can do so easily.

Change-Id: I6f2c127170eafda48e5e0d5d4d187bcd52b4df07

3 years agodocumentation: Document built-in system and channel vars
Naveen Albert [Sat, 8 Jan 2022 20:35:09 +0000 (20:35 +0000)] 
documentation: Document built-in system and channel vars

Documentation for built-in special system and channel
vars is currently outdated, and updating is a manual
process since there is no XML documentation for these
anywhere.

This adds documentation for system vars to func_env
and for channel vars to func_channel so that they
appear along with the corresponding fields that would
be accessed using a function.

ASTERISK-29848 #close

Change-Id: I6997f925c4a45fffe71321861f5898a8b7182fa9

3 years agopbx_variables: add missing ASTSBINDIR variable
Naveen Albert [Sat, 8 Jan 2022 15:09:13 +0000 (15:09 +0000)] 
pbx_variables: add missing ASTSBINDIR variable

Every config variable in the directories
section of asterisk.conf currently has a
counterpart built-in variable containing
the value of the config option, except
for the last one, astsbindir, which should
have an ASTSBINDIR variable.

However, the actual corresponding ASTSBINDIR
variable is missing in pbx_variables.c.

This adds the missing variable so that all
the config options have their corresponding
variable.

ASTERISK-29847 #close

Change-Id: I36006faf471825b36ebc8aa5e87a3bcb38d446fc

3 years agobundled_pjproject: Make it easier to hack
George Joseph [Tue, 30 Nov 2021 22:35:27 +0000 (15:35 -0700)] 
bundled_pjproject:  Make it easier to hack

There are times when you need to troubleshoot issues with bundled
pjproject or add new features that need to be pushed upstream
but...

* The source directory created by extracting the pjproject tarball
  is not scanned for code changes so you have to keep forcing
  rebuilds.
* The source directory isn't a git repo so you can't easily create
  patches, do git bisects, etc.
* Accidentally doing a make distclean will ruin your day by wiping
  out the source directory, and your changes.
* etc.

This commit makes that easier.
See third-party/pjproject/README-hacking.md for the details.

ASTERISK-29824

Change-Id: Idb1251040affdab31d27cd272dda68676da9b268

3 years agoutils.c: Remove all usages of ast_gethostbyname()
Sean Bright [Fri, 24 Dec 2021 16:26:31 +0000 (11:26 -0500)] 
utils.c: Remove all usages of ast_gethostbyname()

gethostbyname() and gethostbyname_r() are deprecated in favor of
getaddrinfo() which we use in the ast_sockaddr family of functions.

ASTERISK-29819 #close

Change-Id: Ie277c0ef768d753b169c121ef570a71665692ab7

3 years agosay.conf: fix 12pm noon logic
Naveen Albert [Mon, 13 Dec 2021 15:53:52 +0000 (15:53 +0000)] 
say.conf: fix 12pm noon logic

Fixes 12pm noon incorrectly returning 0/a.m.
Also fixes a misspelling typo in the config.

ASTERISK-29695 #close

Change-Id: Ie40f9618636eb4c483b449bd707a5dcffca5c406

3 years agopjproject: Fix incorrect unescaping of tokens during parsing
Sean Bright [Tue, 4 Jan 2022 14:08:06 +0000 (09:08 -0500)] 
pjproject: Fix incorrect unescaping of tokens during parsing

ASTERISK-29664 #close

Change-Id: I29dcde52e9faeaf2609c604eada61c6a9e49d8f5

3 years agoapp_queue.c: Support for Nordic syntax in announcements
Mark Petersen [Thu, 30 Dec 2021 13:02:50 +0000 (14:02 +0100)] 
app_queue.c: Support for Nordic syntax in announcements

adding support for playing the correct en/et for nordic languages
by adding 'n' for neuter gender in the relevant ast_say_number

ASTERISK-29827

Change-Id: I03ebc827d2f0dc95132ab2f42799893c70edc5b1

3 years agodsp: Add define macro for DTMF_MATRIX_SIZE
Naveen Albert [Thu, 23 Dec 2021 14:50:42 +0000 (14:50 +0000)] 
dsp: Add define macro for DTMF_MATRIX_SIZE

Adds the macro DTMF_MATRIX_SIZE to replace
the magic number 4 sprinkled throughout
dsp.c.

ASTERISK-29815 #close

Change-Id: Ie3bddb92c6b16204ece0f758009e9490eb33b9ba

3 years agoami: Add AMI event for Wink
Naveen Albert [Mon, 3 Jan 2022 17:10:03 +0000 (17:10 +0000)] 
ami: Add AMI event for Wink

Adds an AMI event for a wink frame.

ASTERISK-29830 #close

Change-Id: I83e426de5e37baed79a4dbcc91e9e8d030ef1b56

3 years agocli: Add module refresh command
Naveen Albert [Wed, 15 Dec 2021 14:23:06 +0000 (14:23 +0000)] 
cli: Add module refresh command

Adds a command to the CLI to unload and then
load a module. This makes it easier to perform
these operations which are often done
subsequently to load a new version of a module.

"module reload" already refers to reloading of
configuration, so the name "refresh" is chosen
instead.

ASTERISK-29807 #close

Change-Id: I595f6f11774a0de2565a1fba38da22309ce93a2c

3 years agoapp_mp3: Throw warning on nonexistent stream
Naveen Albert [Mon, 3 Jan 2022 01:13:33 +0000 (01:13 +0000)] 
app_mp3: Throw warning on nonexistent stream

Currently, the MP3Player application doesn't
emit a warning if attempting to play a stream
which no longer exists. This can be a common
scenario as many mp3 streams are valid at some
point but can disappear at any time.

Now a warning is thrown if attempting to play
a nonexistent MP3 stream, instead of silently
exiting.

ASTERISK-29829 #close

Change-Id: I53a0bf1ed1740166655eb66fe7675f6f808bf535

3 years agodocumentation: Add missing AMI documentation
Naveen Albert [Mon, 13 Dec 2021 14:29:30 +0000 (14:29 +0000)] 
documentation: Add missing AMI documentation

Adds missing documentation for some channel,
bridge, and queue events.

ASTERISK-24427
ASTERISK-29515

Change-Id: I92b06b88c8cadc0155f95ebe3e870b3e795a8c64

3 years agotcptls.c: refactor client connection to be more robust
Kevin Harwell [Mon, 15 Nov 2021 22:13:19 +0000 (16:13 -0600)] 
tcptls.c: refactor client connection to be more robust

The current TCP client connect code, blocks and does not handle EINTR
error case.

This patch makes the client socket non-blocking while connecting,
ensures a connect does not immediately fail due to EINTR "errors",
and adds a connect timeout option.

The original client start call sets the new timeout option to
"infinite", thus making sure old, orginal behavior is retained.

ASTERISK-29746 #close

Change-Id: I907571843a83e43c0742b95a64785f4411f02671

3 years agoapp_sf: Add full tech-agnostic SF support
Naveen Albert [Mon, 13 Dec 2021 16:59:02 +0000 (16:59 +0000)] 
app_sf: Add full tech-agnostic SF support

Adds tech-agnostic support for SF signaling
by adding SF sender and receiver applications
as well as Dial integration.

ASTERISK-29802 #close

Change-Id: I7ec50752e9a661af639425e5d1e339f17411bcad

3 years agoapp_queue: Fix hint updates, allow dup. hints
Steve Davies [Wed, 15 Dec 2021 12:23:45 +0000 (12:23 +0000)] 
app_queue: Fix hint updates, allow dup. hints

A previous patch for ASTERISK_29578 caused a 'leak' of
extension state information across queues, causing the
state of the first member of unrelated queues to be
updated in addition to the correct member. Which queues
and members depended on the order of queues in the
iterator.

Additionally, it is possible to use the same 'hint:' on
multiple queue members, so the update cannot break out
of the update loop early when a match is found.

ASTERISK-29806 #close

Change-Id: If2c1d1cc2a752afd9286d79710fc818596e7a7ad

3 years agosay.c: Honor requests for DTMF interruption.
Sean Bright [Thu, 23 Dec 2021 21:57:59 +0000 (16:57 -0500)] 
say.c: Honor requests for DTMF interruption.

SayAlpha, SayAlphaCase, SayDigits, SayMoney, SayNumber, SayOrdinal,
and SayPhonetic all claim to allow DTMF interruption if the
SAY_DTMF_INTERRUPT channel variable is set to a truthy value, but we
are failing to break out of a given 'say' application if DTMF actually
occurs.

ASTERISK-29816 #close

Change-Id: I6a96e0130560831d2cb45164919862b9bcb6287e

3 years agobridge: Unlock channel during Local peer check.
Joshua C. Colp [Mon, 27 Dec 2021 13:28:00 +0000 (09:28 -0400)] 
bridge: Unlock channel during Local peer check.

It's not safe to keep the channel locked while locking
the peer Local channel, as it can result in a deadlock.

This change unlocks it during this time but keeps the
bridge locked to ensure nothing changes about the bridge.

ASTERISK-29821

Change-Id: Ib68eb7037e5a479bcc2aceee77337cdde1fbdde6

3 years agotest_time.c: Tolerate DST transitions
Josh Soref [Sun, 7 Nov 2021 15:32:17 +0000 (10:32 -0500)] 
test_time.c: Tolerate DST transitions

When test_timezone_watch runs very near a DST transition,
two time zones that would otherwise be expected to report the same
time can differ because of the DST transition.

Instead of having the test fail when this happens, report the
times, time zones, and dst flags.

ASTERISK-29722

Change-Id: Id59bdac8b277e14343ccdf0c99b89e92f79f316a

3 years agobundled_pjproject: Add more support for multipart bodies
George Joseph [Tue, 14 Dec 2021 17:39:16 +0000 (10:39 -0700)] 
bundled_pjproject:  Add more support for multipart bodies

Adding upstream patch for pull request...
https://github.com/pjsip/pjproject/pull/2920
---------------------------------------------------------------

sip_inv:  Additional multipart support (#2919)

sip_inv.c:inv_check_sdp_in_incoming_msg() deals with multipart
message bodies in rdata correctly. In the case where early media is
involved though, the existing sdp has to be retrieved from the last
tdata sent in this transaction. This, however, always assumes that
the sdp sent is in a non-multipart body. While there's a function
to retrieve the sdp from multipart and non-multpart rdata bodies,
no similar function for tdata exists.  So...

* The existing pjsip_rdata_get_sdp_info2 was refactored to
  find the sdp in any body, multipart or non-multipart, and
  from either an rdata or tdata.  The new function is
  pjsip_get_sdp_info.  This new function detects whether the
  pjsip_msg->body->data is the text representation of the sdp
  from an rdata or an existing pjmedia_sdp_session object
  from a tdata, or whether pjsip_msg->body is a multipart
  body containing either of the two sdp formats.

* The exsting pjsip_rdata_get_sdp_info and pjsip_rdata_get_sdp_info2
  functions are now wrappers that get the body and Content-Type
  header from the rdata and call pjsip_get_sdp_info.

* Two new wrappers named pjsip_tdata_get_sdp_info and
  pjsip_tdata_get_sdp_info2 have been created that get the body
  from the tdata and call pjsip_get_sdp_info.

* inv_offer_answer_test.c was updated to test multipart scenarios.

ASTERISK-29804

Change-Id: I483c7c3d413280c9e247a96ad581278347f9c71b

3 years agoast_coredumper: Fix deleting results when output dir is set
Frederic Van Espen [Thu, 9 Dec 2021 08:55:27 +0000 (09:55 +0100)] 
ast_coredumper: Fix deleting results when output dir is set

When OUTPUTDIR is set to another directory and the
--delete-results-after is set, the resulting txt files are
not deleted.

ASTERISK-29794 #close

Change-Id: I1c0071f6809a1e3f5cfc455d6eb08378bc0d7286

3 years agopbx_variables: initialize uninitialized variable
Naveen Albert [Mon, 13 Dec 2021 22:49:52 +0000 (22:49 +0000)] 
pbx_variables: initialize uninitialized variable

The variable cp4 in a variable substitution function
can potentially be used without being initialized
currently. This causes Asterisk to no longer compile.

This initializes cp4 to NULL to make the compiler
happy.

ASTERISK-29803 #close

Change-Id: I392579cbb76db2795d5820c9427cf55fbcee9e72

3 years agoapp_queue.c: added DIALEDPEERNUMBER on outgoing channel
Mark Petersen [Wed, 8 Dec 2021 11:24:04 +0000 (12:24 +0100)] 
app_queue.c: added DIALEDPEERNUMBER on outgoing channel

added that we set DIALEDPEERNUMBER on the outgoing channels
so it is avalible in b(content^extension^line)
this add the same behaviour as Dial

ASTERISK-29795

Change-Id: Icbc589ea2066f0c401a892bf478f6b2fd44e62f6

3 years agohttp.c: Add ability to create multiple HTTP servers
Kevin Harwell [Mon, 15 Nov 2021 21:35:05 +0000 (15:35 -0600)] 
http.c: Add ability to create multiple HTTP servers

Previously, it was only possible to have one HTTP server in Asterisk.
With this patch it is now possible to have multiple HTTP servers
listening on different addresses.

Note, this behavior has only been made available through an API call
from within the TEST_FRAMEWORK. Specifically, this feature has been
added in order to allow unit test to create/start and stop servers,
if one has not been enabled through configuration.

Change-Id: Ic5fb5f11e62c019a1c51310f4667b32a4dae52f5

3 years agoapp.c: Throw warnings for nonexistent options
Naveen Albert [Mon, 13 Dec 2021 00:08:26 +0000 (00:08 +0000)] 
app.c: Throw warnings for nonexistent options

Currently, Asterisk doesn't throw warnings if options
are passed into applications that don't accept them.
This can confuse users if they're unaware that they
are doing something wrong.

This adds an additional check to parse_options so that
a warning is thrown anytime an option is parsed that
doesn't exist in the parsing application, so that users
are notified of the invalid usage.

ASTERISK-29801 #close

Change-Id: Id029274a57135caca193c913307a63fd75e24679

3 years agoapp_voicemail.c: Support for Danish syntax in VM
Mark Petersen [Wed, 8 Dec 2021 18:07:59 +0000 (19:07 +0100)] 
app_voicemail.c: Support for Danish syntax in VM

added support for playing the correct plural sound file
dependen on where you have 1 or multipe messages
based on the existing SE/NO code

ASTERISK-29797

Change-Id: I88aa814d02f3772bb80b474204b1ffb26fe438c2

3 years agoconfigs: Updates to sample configs
Naveen Albert [Wed, 17 Nov 2021 21:16:56 +0000 (21:16 +0000)] 
configs: Updates to sample configs

Includes some minor updates to extensions.conf
and iax.conf. In particular, the demonstration
of macros in extensions.conf is removed, as
Macro is deprecated and will be removed soon.
These examples have been replaced with examples
demonstrating the usage of Gosub instead.

The older exten => ...,n syntax is also mostly
replaced with the same keyword to demonstrate the
newer, more concise way of defining extensions.

IAXTEL no longer exists, so this example is replaced
with something more generic.

Some documentation is also added to extensions.conf
and iax.conf to clarify some of the new expanded
encryption capabilities with IAX2.

ASTERISK-29758 #close

Change-Id: I04fba9671aa1ee9ba1bd5027061f80bbe38e7b46

3 years agostrings: Fix enum names in comment examples
Naveen Albert [Sun, 12 Dec 2021 02:11:21 +0000 (02:11 +0000)] 
strings: Fix enum names in comment examples

The enum values for ast_strsep_flags includes
AST_STRSEP_STRIP. However, some comments reference
AST_SEP_STRIP, which doesn't exist. This fixes
these comments to use the correct value.

ASTERISK-29800 #close

Change-Id: If7bbd0c0e6226a211d25ddf9d1629347e2674943

3 years agoapp_sendtext: Add ReceiveText application
Naveen Albert [Wed, 17 Nov 2021 21:39:34 +0000 (21:39 +0000)] 
app_sendtext: Add ReceiveText application

Adds a ReceiveText application that can be used in
conjunction with SendText. Currently, there is no
way in Asterisk to receive text in the dialplan
(or anywhere else, really). This allows for Asterisk
to be the recipient of text instead of just the sender.

ASTERISK-29759 #close

Change-Id: Ica2c354a42bff69f323a0493d3a7cd0fb129d52d

3 years agopbx_variables: Increase parsing capabilities of MSet
Naveen Albert [Sat, 20 Nov 2021 20:37:16 +0000 (20:37 +0000)] 
pbx_variables: Increase parsing capabilities of MSet

Currently MSet can only parse a maximum of 24 variables.
If more variables are provided to MSet, the 24th variable
will simply contain the remainder of the string and the
remaining variables thereafter will never get set.

This increases the number of variables that can be parsed
in one go from 24 to 99. Additionally, documentation is added
since this limitation is currently undocumented and is
confusing to users who encounter this limitation.

ASTERISK-29766 #close

Change-Id: I3fe35b462dedec0a452fd9ea7f92c920a3939f16

3 years agochan_sip: Fix crash when accessing RURI before initiating outgoing call
Naveen Albert [Wed, 24 Nov 2021 02:21:23 +0000 (02:21 +0000)] 
chan_sip: Fix crash when accessing RURI before initiating outgoing call

Attempting to access ${CHANNEL(ruri)} in a pre-dial handler before
initiating an outgoing call will cause Asterisk to crash. This is
because a null field is accessed, resulting in an offset from null and
subsequent memory access violation.

Since RURI is not guaranteed to exist, we now check if the base
pointer is non-null before calculating an offset.

ASTERISK-29772

Change-Id: Icd3b02f07256bbe6615854af5717074087b95a83

3 years agofunc_json: Adds JSON_DECODE function
Naveen Albert [Mon, 25 Oct 2021 21:19:49 +0000 (21:19 +0000)] 
func_json: Adds JSON_DECODE function

Adds the JSON_DECODE function for parsing JSON in the
dialplan. JSON parsing already exists in the Asterisk
core and is used for many different things. This
function exposes the basic parsing capability to
the user in the dialplan, for instance, in conjunction
with CURL for using API responses.

ASTERISK-29706 #close

Change-Id: Iea60c49a7358dfdc2db60803cdc9a742f808ba2c

3 years agoCHANGES: Correct reference to configuration file.
Sean Bright [Sun, 12 Dec 2021 00:45:30 +0000 (19:45 -0500)] 
CHANGES: Correct reference to configuration file.

Change-Id: I22a788ebf11168fff7fbf9ea956ebcd705ab63dd

3 years agopbx: Add variable substitution API for extensions
Naveen Albert [Mon, 15 Nov 2021 21:08:11 +0000 (21:08 +0000)] 
pbx: Add variable substitution API for extensions

Currently, variable substitution involving dialplan
extensions is quite clunky since it entails obtaining
the current dialplan location, backing it up, storing
the desired variables for substitution on the channel,
performing substitution, then restoring the original
location.

In addition to being clunky, things could also go wrong
if an async goto were to occur and change the dialplan
location during a substitution.

Fundamentally, there's no reason it needs to be done this
way, so new API is added to allow for directly passing in
the dialplan location for the purposes of variable
substitution so we don't need to mess with the channel
information anymore. Existing API is not changed.

ASTERISK-29745 #close

Change-Id: I23273bf27fa0efb64a606eebf9aa8e2f41a065e4

3 years agoapp_mf: Add full tech-agnostic MF support
Naveen Albert [Wed, 22 Sep 2021 00:18:08 +0000 (00:18 +0000)] 
app_mf: Add full tech-agnostic MF support

Adds tech-agnostic support for MF signaling by adding
MF sender and receiver applications as well as Dial
integration.

ASTERISK-29496-mf #do-not-close

Change-Id: I61962b359b8ec4cfd05df877ddf9f5b8f71927a4

3 years agoxmldoc: Avoid whitespace around value for parameter/required.
Alexander Traud [Mon, 6 Dec 2021 10:25:20 +0000 (11:25 +0100)] 
xmldoc: Avoid whitespace around value for parameter/required.

Otherwise, the value 'false' was not found in the enumerated set of
the XML DTD for the XML attribute 'required' in the XML element
'parameter'. Therefore, DTD validation of the runtime XML failed.

ASTERISK-29790

Change-Id: Id13f230ad65a70dd8c2e3ae9ac85d1e841aed03e

3 years agoprogdocs: Fix Doxygen left-overs.
Alexander Traud [Sat, 4 Dec 2021 09:05:33 +0000 (10:05 +0100)] 
progdocs: Fix Doxygen left-overs.

Change-Id: I5b5cf9c9cbbe00ba8b379a8d162ac67445d39016

3 years agoxmldoc: Correct definition for XML element 'matchInfo'.
Alexander Traud [Mon, 6 Dec 2021 11:17:05 +0000 (12:17 +0100)] 
xmldoc: Correct definition for XML element 'matchInfo'.

ASTERISK-29791

Change-Id: I7c656498427fcadd0a5d61a54ff67e6036609725

3 years agoprogdocs: Update Makefile.
Alexander Traud [Tue, 23 Nov 2021 14:05:55 +0000 (15:05 +0100)] 
progdocs: Update Makefile.

In developer mode, use internal documentation as well.
This should produce no warnings. Fix yours!

In noisy mode, output all possible warnings of Doxygen.
This creates zillion of warnings. Double-check your current module!

Any warnings are in the file './doxygen.log'. Beside that, this change
avoids deprecated parameters because the configuration file for Doxygen
contains only those parameters which differ from the default. This
avoids the need to update the file on each run. Furthermore, it adds
AST_VECTOR to be expanded. Finally, the default name for that file is
Doxyfile. Therefore, let us use that!

ASTERISK-26991
ASTERISK-20259

Change-Id: I4129092a199d5e24c319a09cd088614b121015af

3 years agores_pjsip_sdp_rtp: Do not warn on unknown sRTP crypto suites.
Alexander Traud [Fri, 3 Dec 2021 13:38:35 +0000 (14:38 +0100)] 
res_pjsip_sdp_rtp: Do not warn on unknown sRTP crypto suites.

res_sdp_crypto_parse_offer(.) emits many log messages already.

ASTERISK-29785

Change-Id: I1a191ebe4fec1102946d4e31887e5197ca02dfe8

3 years agochannel: Short-circuit ast_channel_get_by_name() on empty arg.
Sean Bright [Tue, 30 Nov 2021 20:16:45 +0000 (15:16 -0500)] 
channel: Short-circuit ast_channel_get_by_name() on empty arg.

We know that passing a NULL or empty argument to
ast_channel_get_by_name() will never result in a matching channel and
will always result in an error being emitted, so just short-circuit
out in that case.

ASTERISK-28219 #close

Change-Id: I88eadc748e9c6996fc17467b0a05881bbfd00bce

3 years agores_rtp_asterisk: Addressing possible rtp range issues
Mike Bradeen [Tue, 26 Oct 2021 21:12:18 +0000 (15:12 -0600)] 
res_rtp_asterisk: Addressing possible rtp range issues

res/res_rtp_asterisk.c: Adding 1 to rtpstart if it is deteremined
that rtpstart was configured to be an odd value. Also adding a loop
counter to prevent a possible infinite loop when looking for a free
port.

ASTERISK-27406

Change-Id: I90f07deef0716da4a30206e9f849458b2dbe346b

3 years agoapps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING
Mark Petersen [Tue, 24 Aug 2021 18:10:01 +0000 (20:10 +0200)] 
apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING

changed that when we recive a CANCEL that we set HANGUPCAUSE to AST_CAUSE_NORMAL_CLEARING

ASTERISK-28053
Reported by: roadkill

Change-Id: Ib653aec2282f55b59d87484391cc07c8e6612b89