]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
2 years agores_pjsip_stir_shaken: Fix JSON field ordering and disallowed TN characters.
Naveen Albert [Fri, 17 Feb 2023 13:45:16 +0000 (13:45 +0000)] 
res_pjsip_stir_shaken: Fix JSON field ordering and disallowed TN characters.

The current STIR/SHAKEN signing process is inconsistent with the
RFCs in a couple ways that can cause interoperability issues.

RFC8225 specifies that the keys must be ordered lexicographically, but
currently the fields are simply ordered according to the order
in which they were added to the JSON object, which is not
compliant with the RFC and can cause issues with some carriers.

To fix this, we now leverage libjansson's ability to dump a JSON
object sorted by key value, yielding the correct field ordering.

Additionally, telephone numbers must have any leading + prefix removed
and must not contain characters outside of 0-9, *, and # in order
to comply with the RFCs. Numbers are now properly formatted as such.

ASTERISK-30407 #close

Change-Id: Iab76d39447c4b8cf133de85657dba02fda07f9a2

2 years agopbx_dundi: Add PJSIP support.
Naveen Albert [Fri, 9 Dec 2022 14:18:26 +0000 (14:18 +0000)] 
pbx_dundi: Add PJSIP support.

Adds PJSIP as a supported technology to DUNDi.

To facilitate this, we now allow an endpoint to be specified
for outgoing PJSIP calls. We also allow users to force a specific
channel technology for outgoing SIP-protocol calls.

ASTERISK-28109 #close
ASTERISK-28233 #close

Change-Id: I2e28e5a5d007bd49e3df113ad567b011103899bf

2 years agochan_pjsip: fix music on hold continues after INVITE with replaces
Henning Westerholt [Tue, 21 Mar 2023 07:48:38 +0000 (07:48 +0000)] 
chan_pjsip: fix music on hold continues after INVITE with replaces

In a three party scenario with INVITE with replaces, we need to
unhold the call, otherwise one party continues to get music on
hold, and the call is not properly bridged between them.

ASTERISK-30428

Change-Id: I5675df11e739be5226b328f8828d4b8d81fbefb4

2 years agoinstall_prereq: Add Linux Mint support.
The_Blode [Fri, 17 Mar 2023 15:51:57 +0000 (15:51 +0000)] 
install_prereq: Add Linux Mint support.

ASTERISK-30359 #close

Change-Id: I9c140c7f12ca7dafe65c317f2a26122cf2c72556

2 years agovoicemail.conf: Fix incorrect comment about #include.
Naveen Albert [Tue, 28 Mar 2023 13:37:55 +0000 (13:37 +0000)] 
voicemail.conf: Fix incorrect comment about #include.

A comment at the top of voicemail.conf says that #include
cannot be used in voicemail.conf because this breaks
the ability for app_voicemail to auto-update passwords.
This is factually incorrect, since Asterisk has no problem
updating files that are #include'd in the main configuration
file, and this does work in voicemail.conf as well.

ASTERISK-30479 #close

Change-Id: I3bf7d275849ab83f55f7fb6702a75a3077ee1df3

2 years agoapp_queue: Fix minor xmldoc duplication and vagueness.
Naveen Albert [Mon, 3 Apr 2023 14:16:59 +0000 (14:16 +0000)] 
app_queue: Fix minor xmldoc duplication and vagueness.

The F option in the xmldocs for the Queue application
was erroneously duplicated, causing it to display
twice on the wiki. The two sections are now merged into one.

Additionally, the description for the d option was quite
vague. Some more details are added to provide context
as to what this actually does.

ASTERISK-30486 #close

Change-Id: I6706cea708b5cc781f59f8652c2cb377e55aed7e

2 years agotest.c: Fix counting of tests and add 2 new tests
George Joseph [Tue, 28 Mar 2023 14:07:09 +0000 (08:07 -0600)] 
test.c: Fix counting of tests and add 2 new tests

The unit test XML output was counting all registered tests as "run"
even when only a subset were actually requested to be run and
the "failures" attribute was missing.

* The "tests" attribute of the "testsuite" element in the
  output XML now reflects only the tests actually requested
  to be executed instead of all the tests registered.

* The "failures" attribute was added to the "testsuite"
  element.

Also added 2 new unit tests that just pass and fail to be
used for CI testing.

Change-Id: Ia137814b5aeb0e1a44c75034bd3615c26021da69

2 years agores_pjsip_pubsub: subscription cleanup changes
Mike Bradeen [Wed, 29 Mar 2023 18:49:51 +0000 (12:49 -0600)] 
res_pjsip_pubsub: subscription cleanup changes

There are two main parts of the change associated with this
commit. These are driven by the change in call order of
pubsub_on_rx_refresh and pubsub_on_evsub_state by pjproject
when an in-dialog SUBSCRIBE is received.

First, the previous behavior was for pjproject to call
pubsub_on_rx_refresh before calling pubsub_on_evsub_state
when an in-dialog SUBSCRIBE was received that changes the
subscription state.

If that change was a termination due to a re-SUBSCRIBE with
an expires of 0, we used to use the call to pubsub_on_rx_refresh
to set the substate of the evsub to TERMINATE_PENDING before
pjproject could call pubsub_on_evsub_state.

This substate let pubsub_on_evsub_state know that the
subscription TERMINATED event could be ignored as there was
still a subsequent NOTIFY that needed to be generated and
another call to pubsub_on_evsub_state to come with it.

That NOTIFY was sent via serialized_pubsub_on_refresh_timeout
which would see the TERMINATE_PENDING state and transition it
to TERMINATE_IN_PROGRESS before triggering another call to
pubsub_on_evsub_state (which now would clean up the evsub.)

The new pjproject behavior is to call pubsub_on_evsub_state
before pubsub_on_rx_refresh. This means we no longer can set
the state to TERMINATE_PENDING to tell pubsub_on_evsub_state
that it can ignore the first TERMINATED event.

To handle this, we now look directly at the event type,
method type and the expires value to determine whether we
want to ignore the event or use it to trigger the evsub
cleanup.

Second, pjproject now expects the NOTIFY to actually be sent
during pubsub_on_rx_refresh and avoids the protocol violation
inherent in sending a NOTIFY before the SUBSCRIBE is
acknowledged by caching the sent NOTIFY then sending it
after responding to the SUBSCRIBE.

This requires we send the NOTIFY using the non-serialized
pubsub_on_refresh_timeout directly and let pjproject handle
the protocol violation.

ASTERISK-30469

Change-Id: I05c1d91a44fe28244ae93faa4a2268a3332b5fd7

2 years agores_calendar: output busy state as part of show calendar.
Jaco Kroon [Thu, 23 Mar 2023 08:20:51 +0000 (10:20 +0200)] 
res_calendar: output busy state as part of show calendar.

Change-Id: I894e4ecc3e93db4ff7783d46266ba3c5e6ccda10
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2 years agoael: Regenerate lexers and parsers.
Sean Bright [Tue, 21 Mar 2023 13:24:59 +0000 (09:24 -0400)] 
ael: Regenerate lexers and parsers.

Various changes to ensure that the lexers and parsers can be correctly
generated when REBUILD_PARSERS is enabled.

Some notes:

* Because of the version of flex we are using to generate the lexers
  (2.5.35) some post-processing in the Makefile is still required.

* The generated lexers do not contain the problematic C99 check that
  was being replaced by the call to sed in the respective Makefiles so
  it was removed.

* Since these files are generated, they will include trailing
  whitespace in some places. This does not need to be corrected.

Change-Id: Ibbd343606fcf5c0d285b1599e6e8e59f514f2e4e

2 years agoloader.c: Minor module key check simplification.
Sean Bright [Thu, 23 Mar 2023 15:08:15 +0000 (11:08 -0400)] 
loader.c: Minor module key check simplification.

Change-Id: I65aefd4434a783096165c179b5f94f2e4810dffe

2 years agoRevert "pbx_ael: Global variables are not expanded."
Sean Bright [Sun, 19 Mar 2023 21:30:50 +0000 (16:30 -0500)] 
Revert "pbx_ael: Global variables are not expanded."

This reverts commit c448dcd2f0e67acf527662574193994559ae853a.

Reason for revert: Behavior change that breaks existing dialplan.

ASTERISK-30472 #close

Change-Id: I20e44b4081d6ee0fe54cde44ac71dcf2d146f909

2 years agobridge_builtin_features: add beep via touch variable
Mike Bradeen [Wed, 1 Mar 2023 22:39:15 +0000 (15:39 -0700)] 
bridge_builtin_features: add beep via touch variable

Add periodic beep option to one-touch recording by setting
the touch variable TOUCH_MONITOR_BEEP or
TOUCH_MIXMONITOR_BEEP to the desired interval in seconds.

If the interval is less than 5 seconds, a minimum of 5
seconds will be imposed.  If the interval is set to an
invalid value, it will default to 15 seconds.

A new test event PERIODIC_HOOK_ENABLED was added to the
func_periodic_hook hook_on function to indicate when
a hook is started.  This is so we can test that the touch
variable starts the hook as expected.

ASTERISK-30446

Change-Id: I800e494a789ba7a930bbdcd717e89d86040d6661

2 years agores_mixmonitor: MixMonitorMute by MixMonitor ID
Mike Bradeen [Mon, 13 Mar 2023 19:27:06 +0000 (13:27 -0600)] 
res_mixmonitor: MixMonitorMute by MixMonitor ID

While it is possible to create multiple mixmonitor instances
on a channel, it was not previously possible to mute individual
instances.

This change includes the ability to specify the MixMonitorID
when calling the manager action: MixMonitorMute.  This will
allow an individual MixMonitor instance to be muted via id.
This id can be stored as a channel variable using the 'i'
MixMonitor option.

As part of this change, if no MixMonitorID is specified in
the manager action MixMonitorMute, Asterisk will set the mute
flag on all MixMonitor spy-type audiohooks on the channel.
This is done via the new audiohook function:
ast_audiohook_set_mute_all.

ASTERISK-30464

Change-Id: Ibba8c7e750577aa1595a24b23316ef445245be98

2 years agoformat_sln: add .slin as supported file extension
Mike Bradeen [Tue, 14 Mar 2023 15:25:12 +0000 (09:25 -0600)] 
format_sln: add .slin as supported file extension

Adds '.slin' to existing supported file extensions:
.sln and .raw

ASTERISK-30465

Change-Id: Ice848addc03a64c8404b87cb5d3b13399c57e496

2 years agocli: increase channel column width
Mike Bradeen [Mon, 6 Mar 2023 20:52:18 +0000 (13:52 -0700)] 
cli: increase channel column width

For 'core show channels', the Channel name field is increased
to 64 characters and the Location name field is increased to
32 characters.

For 'core show channels verbose', the Channel name field is
increased to 80 characters, the Context is increased to 24
characters and the Extension is increased to 24 characters.

ASTERISK-30455

Change-Id: Ibec3742ce360ffc93bc56e9984c2a21dabc4d5e1

2 years agoapp_queue: periodic announcement configurable start time.
Jaco Kroon [Tue, 21 Feb 2023 12:24:36 +0000 (14:24 +0200)] 
app_queue: periodic announcement configurable start time.

This newly introduced periodic-announce-startdelay makes it possible to
configure the initial start delay of the first periodic announcement
after which periodic-announce-frequency takes over.

ASTERISK-30437 #close
Change-Id: Ia79984b6377ef78f167ad9ea2ac084bec29955d0
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2 years agoapp_osplookup: Remove obsolete sample config.
Naveen Albert [Fri, 24 Feb 2023 13:48:16 +0000 (13:48 +0000)] 
app_osplookup: Remove obsolete sample config.

ASTERISK_30302 previously removed app_osplookup,
but its sample config was not removed.
This removes it since nothing else uses it.

ASTERISK-30438 #close

Change-Id: Ife234208f5f197644475db4ab1af95a8551642fd

2 years agofunc_json: Fix JSON parsing issues.
Naveen Albert [Sun, 26 Feb 2023 15:40:15 +0000 (15:40 +0000)] 
func_json: Fix JSON parsing issues.

Fix issue with returning empty instead of dumping
the JSON string when recursing.

Also adds a unit test to capture this fix.

ASTERISK-30441 #close

Change-Id: If0bde9f3fe84f7af485e0838205cc21e0f752a85

2 years agoapp_dial: Fix DTMF not relayed to caller on unanswered calls.
Naveen Albert [Sat, 4 Mar 2023 00:09:23 +0000 (00:09 +0000)] 
app_dial: Fix DTMF not relayed to caller on unanswered calls.

DTMF frames are not handled in app_dial when sent towards the
caller. This means that if DTMF is sent to the calling party
and the call has not yet been answered, the DTMF is not audible.
This is now fixed by relaying DTMF frames if only a single
destination is being dialed.

ASTERISK-29516 #close

Change-Id: Iafd7430ac2915126d42dc48f0b73b262452ee027

2 years agoconfigure: fix detection of re-entrant resolver functions
Fabrice Fontaine [Wed, 8 Mar 2023 18:26:51 +0000 (19:26 +0100)] 
configure: fix detection of re-entrant resolver functions

uClibc does not provide res_nsearch:
asterisk-16.0.0/main/dns.c:506: undefined reference to `res_nsearch'

Patch coded by Yann E. MORIN:
http://lists.busybox.net/pipermail/buildroot/2018-October/232630.html

ASTERISK-21795 #close

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[Retrieved from:
https: //git.buildroot.net/buildroot/tree/package/asterisk/0005-configure-fix-detection-of-re-entrant-resolver-funct.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Change-Id: I79296f19e28ec764bbd1e991bf11c416d0b10563

2 years agores_agi: RECORD FILE plays 2 beeps.
Sean Bright [Wed, 8 Mar 2023 14:12:48 +0000 (09:12 -0500)] 
res_agi: RECORD FILE plays 2 beeps.

Sending the "RECORD FILE" command without the optional
`offset_samples` argument can result in two beeps playing on the
channel.

This bug has been present since Asterisk 0.3.0 (2003-02-06).

ASTERISK-30457 #close

Change-Id: I95e88aa59378784d7f0eb648843f090e6723b787

2 years agoapp_senddtmf: Add SendFlash AMI action.
Naveen Albert [Sun, 26 Feb 2023 13:15:50 +0000 (13:15 +0000)] 
app_senddtmf: Add SendFlash AMI action.

Adds an AMI action to send a flash event
on a channel.

ASTERISK-30440 #close

Change-Id: I4707aeecb3cd8f3e63fd0c3fe009798943c369c9

2 years agohttp.c: Minor simplification to HTTP status output.
Boris P. Korzun [Thu, 5 Jan 2023 12:33:08 +0000 (15:33 +0300)] 
http.c: Minor simplification to HTTP status output.

Change the HTTP status page (located at /httpstatus by default) by:

* Combining the address and port into a single line.
* Changing "SSL" to "TLS"

ASTERISK-30433 #close

Change-Id: Id2ccb1218f00a68424aca2b651647d8b1f549bcb

2 years agomake_version: Strip svn stuff and suppress ref HEAD errors
George Joseph [Mon, 13 Mar 2023 19:35:07 +0000 (13:35 -0600)] 
make_version: Strip svn stuff and suppress ref HEAD errors

* All of the code that used subversion has been removed.

* When Asterisk is checked out from a tag or commit instead
  of one of the regular branches, git would emit messages like
  "fatal: ref HEAD is not a symbolic ref" which weren't fatal
  at all.  Those are now suppressed.

Change-Id: I2a11bc9ebbaf6dfa50f53516ede50a6bac65ca3c

2 years agores_http_media_cache: Introduce options and customize
Holger Hans Peter Freyther [Sun, 16 Oct 2022 09:03:53 +0000 (17:03 +0800)] 
res_http_media_cache: Introduce options and customize

Make the existing CURL parameters configurable and allow
to specify the usable protocols, proxy and DNS timeout.

ASTERISK-30340

Change-Id: I2eb02ef44190e026716720419bcbdbcc8125777b

2 years agocontrib: rc.archlinux.asterisk uses invalid redirect.
Sean Bright [Thu, 2 Mar 2023 14:59:51 +0000 (09:59 -0500)] 
contrib: rc.archlinux.asterisk uses invalid redirect.

`rc.archlinux.asterisk`, which explicitly requests bash in its
shebang, uses the following command syntax:

  ${DAEMON} -rx "core stop now" > /dev/null 2&>1

The intent of which is to execute:

  ${DAEMON} -rx "core stop now"

While sending both stdout and stderr to `/dev/null`. Unfortunately,
because the `&` is in the wrong place, bash is interpreting the `2` as
just an additional argument to the `$DAEMON` command and not as a file
descriptor and proceeds to use the bashism `&>` to send stderr and
stdout to a file named `1`.

So we clean it up and just use bash's shortcut syntax.

Issue raised and a fix suggested (but not used) by peutch on GitHub¹.

ASTERISK-30449 #close

1. https://github.com/asterisk/asterisk/pull/31

Change-Id: Ie279bf4efb4d95cbf507313483d316e977303d19

2 years agomain/iostream.c: fix build with libressl
Fabrice Fontaine [Sat, 25 Feb 2023 10:27:12 +0000 (11:27 +0100)] 
main/iostream.c: fix build with libressl

Fix the following build failure with libressl by using SSL_is_server
which is available since version 2.7.0 and
https://github.com/libressl-portable/openbsd/commit/d7ec516916c5eaac29b02d7a8ac6570f63b458f7:

iostream.c: In function 'ast_iostream_close':
iostream.c:559:41: error: invalid use of incomplete typedef 'SSL' {aka 'struct ssl_st'}
  559 |                         if (!stream->ssl->server) {
      |                                         ^~

ASTERISK-30107 #close

Fixes: - http://autobuild.buildroot.org/results/ce4d62d00bb77ba5b303cacf6be7e350581a62f9
Change-Id: Iea7f34970297f2fb50285d73462d0174ba7e9587

2 years agores_pjsip: Replace invalid UTF-8 sequences in callerid name
George Joseph [Thu, 16 Feb 2023 16:05:30 +0000 (09:05 -0700)] 
res_pjsip: Replace invalid UTF-8 sequences in callerid name

* Added a new function ast_utf8_replace_invalid_chars() to
  utf8.c that copies a string replacing any invalid UTF-8
  sequences with the Unicode specified U+FFFD replacement
  character.  For example:  "abc\xffdef" becomes "abc\uFFFDdef".
  Any UTF-8 compliant implementation will show that character
  as a � character.

* Updated res_pjsip:set_id_from_hdr() to use
  ast_utf8_replace_invalid_chars and print a warning if any
  invalid sequences were found during the copy.

* Updated stasis_channels:ast_channel_publish_varset to use
  ast_utf8_replace_invalid_chars and print a warning if any
  invalid sequences were found during the copy.

ASTERISK-27830

Change-Id: I4ffbdb19c80bf0efc675d40078a3ca4f85c567d8

2 years agotest.c: Avoid passing -1 to FD_* family of functions.
Sean Bright [Tue, 28 Feb 2023 00:35:11 +0000 (19:35 -0500)] 
test.c: Avoid passing -1 to FD_* family of functions.

This avoids buffer overflow errors when running tests that capture
output from child processes.

This also corrects a copypasta in an off-nominal error message.

Change-Id: Ib482847a3515364f14c7e7a0c0a4213851ddb10d

2 years agochan_iax2: Fix jitterbuffer regression prior to receiving audio.
Naveen Albert [Wed, 14 Dec 2022 16:00:51 +0000 (16:00 +0000)] 
chan_iax2: Fix jitterbuffer regression prior to receiving audio.

ASTERISK_29392 (a security fix) introduced a regression by
not processing frames when we don't have an audio format.

Currently, chan_iax2 only calls jb_get to read frames from
the jitterbuffer when the voiceformat has been set on the pvt.
However, this only happens when we receive a voice frame, which
means that prior to receiving voice frames, other types of frames
get stalled completely in the jitterbuffer.

To fix this, we now fallback to using the format negotiated during
call setup until we've actually received a voice frame with a format.
This ensures we're always able to read from the jitterbuffer.

ASTERISK-30354 #close
ASTERISK-30162 #close

Change-Id: Ie4fd1e8e088a145ad89e0427c2100a530e964fe9

2 years agotest_crypto.c: Fix getcwd(…) build error.
Sean Bright [Mon, 27 Feb 2023 21:35:57 +0000 (16:35 -0500)] 
test_crypto.c: Fix getcwd(…) build error.

`getcwd(…)` is decorated with the `warn_unused_result` attribute and
therefore needs its return value checked.

Change-Id: Idcccb20a0abf293202c28633d0e9ee0f6a9dbe93

2 years agopjproject_bundled: fix cross-compilation with ssl libs
Nick French [Sat, 11 Feb 2023 12:58:43 +0000 (06:58 -0600)] 
pjproject_bundled: fix cross-compilation with ssl libs

Asterisk makefiles auto-detect ssl library availability,
then they assume that pjproject makefiles will also autodetect
an ssl library at the same time, so they do not pass on the
autodetection result to pjproject.

This normally works, except the pjproject makefiles disables
autodetection when cross-compiling.

Fix by explicitly configuring pjproject to use ssl if we
have been told to use it or it was autodetected

ASTERISK-30424 #close

Change-Id: I8fe2999ea46710e21d1d55a1bed92769c6ebded9

2 years agores_phoneprov.c: Multihomed SERVER cache prevention
cmaj [Sun, 8 Jan 2023 05:04:57 +0000 (22:04 -0700)] 
res_phoneprov.c: Multihomed SERVER cache prevention

Phones moving between subnets on multi-homed server have their
initially connected interface IP cached in the SERVER variable,
even when it is not specified in the configuration files. This
prevents phones from obtaining the correct SERVER variable value
when they move to another subnet.

ASTERISK-30388 #close
Reported-by: cmaj
Change-Id: I1d18987a9d58e85556b4c4a6814ce7006524cc92

2 years agoapp_read: Add an option to return terminator on empty digits.
Mike Bradeen [Mon, 30 Jan 2023 23:14:30 +0000 (16:14 -0700)] 
app_read: Add an option to return terminator on empty digits.

Adds 'e' option to allow Read() to return the terminator as the
dialed digits in the case where only the terminator is entered.

ie; if "#" is entered, return "#" if the 'e' option is set and ""
if it is not.

ASTERISK-30411

Change-Id: I49f3221824330a193a20c660f99da0f1fc2cbbc5

2 years agoapp_directory: Add a 'skip call' option.
Mike Bradeen [Fri, 27 Jan 2023 20:23:59 +0000 (13:23 -0700)] 
app_directory: Add a 'skip call' option.

Adds 's' option to skip calling the extension and instead set the
extension as DIRECTORY_EXTEN channel variable.

ASTERISK-30405

Change-Id: Ib9d9db1ba5b7524594c640461b4aa8f752db8299

2 years agoapp_senddtmf: Add option to answer target channel.
Mike Bradeen [Mon, 6 Feb 2023 15:54:56 +0000 (08:54 -0700)] 
app_senddtmf: Add option to answer target channel.

Adds a new option to SendDTMF() which will answer the specified
channel if it is not already up. If no channel is specified, the
current channel will be answered instead.

ASTERISK-30422

Change-Id: Iddcbd501fcdf9fef0f453b7a8115a90b11f1d085

2 years agores_pjsip: Prevent SEGV in pjsip_evsub_send_request
Mike Bradeen [Tue, 21 Feb 2023 20:25:28 +0000 (13:25 -0700)] 
res_pjsip: Prevent SEGV in pjsip_evsub_send_request

contributed pjproject - patch to check sub->pending_notify
in evsub.c:on_tsx_state before calling
pjsip_evsub_send_request()

res_pjsip_pubsub - change post pjsip 2.13 behavior to use
pubsub_on_refresh_timeout to avoid the ao2_cleanup call on
the sub_tree. This is is because the final NOTIFY send is no
longer the last place the sub_tree is referenced.

ASTERISK-30419

Change-Id: Ib5cc662ce578e9adcda312e16c58a10b6453e438

2 years agoapp_queue: Minor docs and logging fixes for UnpauseQueueMember.
Sean Bright [Thu, 2 Feb 2023 14:19:18 +0000 (09:19 -0500)] 
app_queue: Minor docs and logging fixes for UnpauseQueueMember.

ASTERISK-30417 #close

Change-Id: I7534e7a925bf92a7b5a5347f5f54225768c162fe

2 years agoapp_queue: Reset all queue defaults before reload.
Sean Bright [Tue, 31 Jan 2023 14:40:54 +0000 (09:40 -0500)] 
app_queue: Reset all queue defaults before reload.

Several queue fields were not being set to their default value during
a reload.

Additionally added some sample configuration options that were missing
from queues.conf.sample.

Change-Id: I3a88c7877af91752b1b46a0c087384f7eb9c47e4

2 years agores_pjsip: Upgraded bundled pjsip to 2.13
Mike Bradeen [Fri, 20 Jan 2023 22:50:44 +0000 (15:50 -0700)] 
res_pjsip: Upgraded bundled pjsip to 2.13

Removed multiple patches.

Code chages in res_pjsip_pubsub due to changes in evsub.

Pjsip now calls on_evsub_state() before on_rx_refresh(),
so the sub tree deletion that used to take place in
on_evsub_state() now must take place in on_rx_refresh().

Additionally, pjsip now requires that you send the NOTIFY
from within on_rx_refresh(), otherwise it will assert
when going to send the 200 OK. The idea is that it will
look for this NOTIFY and cache it until after sending the
response in order to deal with the self-imposed message
mis-order. Asterisk previously dealt with this by pushing
the NOTIFY in on_rx_refresh(), but pjsip now forces us
to use it's method.

Changes were required to configure in order to detect
which way pjsip handles this as the two are not
compatible for the reasons mentioned above.

A corresponding change in testsuite is required in order
to deal with the small interal timing changes caused by
moving the NOTIFY send.

ASTERISK-30325

Change-Id: I50b00cac89d950d3511d7b250a1c641965d9fe7f

2 years agodoxygen: Fix doxygen errors.
Sean Bright [Mon, 30 Jan 2023 21:17:08 +0000 (16:17 -0500)] 
doxygen: Fix doxygen errors.

Change-Id: Ic50e95b4fc10f74ab15416d908e8a87ee8ec2f85

2 years agoapp_signal: Add signaling applications
Naveen Albert [Thu, 6 Jan 2022 22:11:44 +0000 (22:11 +0000)] 
app_signal: Add signaling applications

Adds the Signal and WaitForSignal
applications, which can be used for inter-channel
signaling in the dialplan.

Signal supports sending a signal to other channels
listening for a signal of the same name, with an
optional data payload. The signal is received by
all channels waiting for that named signal.

ASTERISK-29810 #close

Change-Id: Ic34439de3d60f8609357666a465c354d81f5fef3

2 years agoapp_directory: add ability to specify configuration file
Mike Bradeen [Wed, 25 Jan 2023 22:27:31 +0000 (15:27 -0700)] 
app_directory: add ability to specify configuration file

Adds option to app_directory to specify a filename from which to
read configuration instead of voicemail.conf ie;

same => n,Directory(,,c(directory.conf))

This configuration should contain a list of extensions using the
voicemail.conf format, ie;

2020=2020,Dog Dog,,,,attach=no|saycid=no|envelope=no|delete=no

ASTERISK-30404

Change-Id: Id58ccb1344ad1e563fa10db12f172fbd104a9d13

2 years agofunc_json: Enhance parsing capabilities of JSON_DECODE
Naveen Albert [Sat, 12 Feb 2022 21:59:52 +0000 (21:59 +0000)] 
func_json: Enhance parsing capabilities of JSON_DECODE

Adds support for arrays to JSON_DECODE by allowing the
user to print out entire arrays or index a particular
key or print the number of keys in a JSON array.

Additionally, adds support for recursively iterating a
JSON tree in a single function call, making it easier
to parse JSON results with multiple levels. A maximum
depth is imposed to prevent potentially blowing
the stack.

Also fixes a bug with the unit tests causing an empty
string to be printed instead of the actual test result.

ASTERISK-29913 #close

Change-Id: I603940b216a3911b498fc6583b18934011ef5d5b

2 years agores_pjsip_session: Add overlap_context option.
Naveen Albert [Thu, 13 Oct 2022 13:45:26 +0000 (13:45 +0000)] 
res_pjsip_session: Add overlap_context option.

Adds the overlap_context option, which can be used
to explicitly specify a context to use for overlap
dialing extension matches, rather than forcibly
using the context configured for the endpoint.

ASTERISK-30262 #close

Change-Id: Ibbcd4a8b11402428a187fb56b8d4e7408774a0db

2 years agores_stasis_snoop: Fix snoop crash
sungtae kim [Wed, 4 Jan 2023 12:35:20 +0000 (21:35 +0900)] 
res_stasis_snoop: Fix snoop crash

Added NULL pointer check and channel lock to prevent resource release
while the chanspy is processing.

ASTERISK-29604

Change-Id: Ibdc675f98052da32333b19685b1708a3751b6d24

2 years agopbx_ael: Global variables are not expanded.
Sean Bright [Thu, 26 Jan 2023 20:18:08 +0000 (15:18 -0500)] 
pbx_ael: Global variables are not expanded.

Variable references within global variable assignments are now
expanded rather than being included literally.

ASTERISK-30406 #close

Change-Id: I136e8d6395e90a4c92d9777a46a7bc3edb08d05d

2 years agores_monitor: Remove deprecated module.
Mike Bradeen [Sat, 19 Nov 2022 01:24:38 +0000 (18:24 -0700)] 
res_monitor: Remove deprecated module.

ASTERISK-30303

Change-Id: I0462caefb4f9544e2e2baa23c498858310b52d50

2 years agoapp_playback.c: Fix PLAYBACKSTATUS regression.
Sean Bright [Thu, 5 Jan 2023 16:41:37 +0000 (11:41 -0500)] 
app_playback.c: Fix PLAYBACKSTATUS regression.

In Asterisk 11, if a channel was redirected away during Playback(),
the PLAYBACKSTATUS variable would be set to SUCCESS. In Asterisk 12
(specifically commit 7d9871b3940fa50e85039aef6a8fb9870a7615b9) that
behavior was inadvertently changed and the same operation would result
in the PLAYBACKSTATUS variable being set to FAILED. The Asterisk 11
behavior has been restored.

Partial fix for ASTERISK~25661.

Change-Id: I53f54e56b59b61c99403a481b6cb8d88b5a559ff

2 years agores_rtp_asterisk: Don't use double math to generate timestamps
George Joseph [Wed, 11 Jan 2023 17:17:02 +0000 (10:17 -0700)] 
res_rtp_asterisk: Don't use double math to generate timestamps

Rounding issues with double math were causing rtp timestamp
slips in outgoing packets.  We're now back to integer math
and are getting no more slips.

ASTERISK-30391

Change-Id: I6ba992b49ffdf9ebea074581dfa784a188c661a4

2 years agoapp_macro: Remove deprecated module.
Mike Bradeen [Mon, 12 Dec 2022 17:12:57 +0000 (10:12 -0700)] 
app_macro: Remove deprecated module.

For most modules that interacted with app_macro, this change is limited
to no longer looking for the current context from the macrocontext when
set.  Additionally, the following modules are impacted:

app_dial - no longer supports M^ connected/redirecting macro
app_minivm - samples written using macro will no longer work.
The sample needs a re-write

app_queue - can no longer a macro on the called party's channel.
Use gosub which is currently supported

ccss - no callback macro, gosub only

app_voicemail - no macro support

channel  - remove macrocontext and priority, no connected line or
redirection macro options
options - stdexten is deprecated to gosub as the default and only
pbx - removed macrolock
pbx_dundi - no longer look for macro

snmp - removed macro context, exten, and priority

ASTERISK-30304

Change-Id: I830daab293117179b8d61bd4df0d971a1b3d07f6

2 years agoformat_wav: replace ast_log(LOG_DEBUG, ...) by ast_debug(1, ...)
Alexei Gradinari [Fri, 6 Jan 2023 16:06:09 +0000 (11:06 -0500)] 
format_wav: replace ast_log(LOG_DEBUG, ...) by ast_debug(1, ...)

Each playback of WAV files results in logging
"Skipping unknown block 'LIST'".

To prevent unnecessary flooding of this DEBUG log this patch replaces
ast_log(LOG_DEBUG, ...) by ast_debug(1, ...).

Change-Id: Iaa09cf19c5348a05385518fdb8cb181b45fe05f0

2 years agores_pjsip_rfc3326: Add SIP causes support for RFC3326
Igor Goncharovsky [Fri, 18 Nov 2022 02:16:50 +0000 (08:16 +0600)] 
res_pjsip_rfc3326: Add SIP causes support for RFC3326

Add ability to set HANGUPCAUSE when SIP causecode received in BYE (in addition to currently supported Q.850).

ASTERISK-30319 #close

Change-Id: I3f55622dc680ce713a2ffb5a458ef5dd39fcf645

2 years agores_rtp_asterisk: Asterisk Media Experience Score (MES)
George Joseph [Fri, 28 Oct 2022 10:57:56 +0000 (04:57 -0600)] 
res_rtp_asterisk: Asterisk Media Experience Score (MES)

-----------------

This commit reinstates MES with some casting fixes to the
functions in time.h that convert between doubles and timeval
structures.  The casting issues were causing incorrect
timestamps to be calculated which caused transcoding from/to
G722 to produce bad or no audio.

ASTERISK-30391

-----------------

This module has been updated to provide additional
quality statistics in the form of an Asterisk
Media Experience Score.  The score is avilable using
the same mechanisms you'd use to retrieve jitter, loss,
and rtt statistics.  For more information about the
score and how to retrieve it, see
https://wiki.asterisk.org/wiki/display/AST/Media+Experience+Score

* Updated chan_pjsip to set quality channel variables when a
  call ends.
* Updated channels/pjsip/dialplan_functions.c to add the ability
  to retrieve the MES along with the existing rtcp stats when
  using the CHANNEL dialplan function.
* Added the ast_debug_rtp_is_allowed and ast_debug_rtcp_is_allowed
  checks for debugging purposes.
* Added several function to time.h for manipulating time-in-samples
  and times represented as double seconds.
* Updated rtp_engine.c to pass through the MES when stats are
  requested.  Also debug output that dumps the stats when an
  rtp instance is destroyed.
* Updated res_rtp_asterisk.c to implement the calculation of the
  MES.  In the process, also had to update the calculation of
  jitter.  Many debugging statements were also changed to be
  more informative.
* Added a unit test for internal testing.  The test should not be
  run during normal operation and is disabled by default.

Change-Id: I4fce265965e68c3fdfeca55e614371ee69c65038

2 years agoRevert "res_rtp_asterisk: Asterisk Media Experience Score (MES)"
George Joseph [Mon, 9 Jan 2023 13:21:46 +0000 (07:21 -0600)] 
Revert "res_rtp_asterisk: Asterisk Media Experience Score (MES)"

This reverts commit e66c5da145b4545428fca768db7fb0921156af98.

Reason for revert: Issue when transcoding to/from g722

Change-Id: I12853c5b1d3a77f5b9200f41908fd238a17159dc

2 years agohttp.c: Fix NULL pointer dereference bug
Boris P. Korzun [Wed, 28 Dec 2022 19:33:42 +0000 (22:33 +0300)] 
http.c: Fix NULL pointer dereference bug

If native HTTP is disabled but HTTPS is enabled and status page enabled
too, Core/HTTP crashes while loading. 'global_http_server' references
to NULL, but the status page tries to dereference it.

The patch adds a check for HTTP is enabled.

ASTERISK-30379 #close

Change-Id: I11b02fc920b72aaed9c809fc43210523ccfdc249

2 years agoloader: Allow declined modules to be unloaded.
Naveen Albert [Thu, 8 Dec 2022 21:44:25 +0000 (21:44 +0000)] 
loader: Allow declined modules to be unloaded.

Currently, if a module declines to load, dlopen is called
to register the module but dlclose never gets called.
Furthermore, loader.c currently doesn't allow dlclose
to ever get called on the module, since it declined to
load and the unload function bails early in this case.

This can be problematic if a module is updated, since the
new module cannot be loaded into memory since we haven't
closed all references to it. To fix this, we now allow
modules to be unloaded, even if they never "loaded" in
Asterisk itself, so that dlclose is called and the module
can be properly cleaned up, allowing the updated module
to be loaded from scratch next time.

ASTERISK-30345 #close

Change-Id: Ifc743aadfa85ebe3284e02a63e124dafa64988d5

2 years agoapp_broadcast: Add Broadcast application
Naveen Albert [Mon, 15 Aug 2022 20:04:38 +0000 (20:04 +0000)] 
app_broadcast: Add Broadcast application

Adds a new application, Broadcast, which can be used for
one-to-many transmission and many-to-one reception of
channel audio in Asterisk. This is similar to ChanSpy,
except it is designed for multiple channel targets instead
of a single one. This can make certain kinds of audio
manipulation more efficient and streamlined. New kinds
of audio injection impossible with ChanSpy are also made
possible.

ASTERISK-30180 #close

Change-Id: I7ba72f765dbab9b58deeae028baca3f4f8377726

2 years agofunc_frame_trace: Print text for text frames.
Naveen Albert [Tue, 13 Dec 2022 20:35:19 +0000 (20:35 +0000)] 
func_frame_trace: Print text for text frames.

Since text frames contain a text body, make FRAME_TRACE
more useful for text frames by actually printing the text.

ASTERISK-30353 #close

Change-Id: Ia6ce3d15cecd7a673a528d34faac86854a2bab50

2 years agoapp_cdr: Remove deprecated application and option.
Naveen Albert [Thu, 22 Dec 2022 01:58:54 +0000 (01:58 +0000)] 
app_cdr: Remove deprecated application and option.

This removes the deprecated NoCDR application, which
was deprecated in Asterisk 12, having long been fully
superseded by the CDR_PROP function.

The deprecated e option to ResetCDR is also removed
for the same reason.

ASTERISK-30371 #close

Change-Id: Id9ed094d8e4baf98bcbc610035c2295bfafe9ec0

2 years agores_http_media_cache: Do not crash when there is no extension
Holger Hans Peter Freyther [Fri, 16 Dec 2022 07:00:42 +0000 (15:00 +0800)] 
res_http_media_cache: Do not crash when there is no extension

Do not crash when a URL has no path component as in this case the
ast_uri_path function will return NULL. Make the code cope with not
having a path.

The below would crash
> media cache create http://google.com /tmp/foo.wav

Thread 1 "asterisk" received signal SIGSEGV, Segmentation fault.
0x0000ffff836616cc in strrchr () from /lib/aarch64-linux-gnu/libc.so.6
(gdb) bt
 #0  0x0000ffff836616cc in strrchr () from /lib/aarch64-linux-gnu/libc.so.6
 #1  0x0000ffff43d43a78 in file_extension_from_string (str=<optimized out>, buffer=buffer@entry=0xffffca9973c0 "",
    capacity=capacity@entry=64) at res_http_media_cache.c:288
 #2  0x0000ffff43d43bac in file_extension_from_url_path (bucket_file=bucket_file@entry=0x3bf96568,
    buffer=buffer@entry=0xffffca9973c0 "", capacity=capacity@entry=64) at res_http_media_cache.c:378
 #3  0x0000ffff43d43c74 in bucket_file_set_extension (bucket_file=bucket_file@entry=0x3bf96568) at res_http_media_cache.c:392
 #4  0x0000ffff43d43d10 in bucket_file_run_curl (bucket_file=0x3bf96568) at res_http_media_cache.c:555
 #5  0x0000ffff43d43f74 in bucket_http_wizard_create (sorcery=<optimized out>, data=<optimized out>, object=<optimized out>)
    at res_http_media_cache.c:613
 #6  0x0000000000487638 in bucket_file_wizard_create (sorcery=<optimized out>, data=<optimized out>, object=<optimized out>)
    at bucket.c:191
 #7  0x0000000000554408 in sorcery_wizard_create (object_wizard=object_wizard@entry=0x3b9f0718,
    details=details@entry=0xffffca9974a8) at sorcery.c:2027
 #8  0x0000000000559698 in ast_sorcery_create (sorcery=<optimized out>, object=object@entry=0x3bf96568) at sorcery.c:2077
 #9  0x00000000004893a4 in ast_bucket_file_create (file=file@entry=0x3bf96568) at bucket.c:727
 #10 0x00000000004f877c in ast_media_cache_create_or_update (uri=0x3bfa1103 "https://google.com",
    file_path=0x3bfa1116 "/tmp/foo.wav", metadata=metadata@entry=0x0) at media_cache.c:335
 #11 0x00000000004f88ec in media_cache_handle_create_item (e=<optimized out>, cmd=<optimized out>, a=0xffffca9976b8)
    at media_cache.c:640

ASTERISK-30375 #close

Change-Id: I6a9433688cb5d3d4be8758b7642d923bdde6c273

2 years agomanager: Fix appending variables.
Naveen Albert [Thu, 22 Dec 2022 01:01:01 +0000 (01:01 +0000)] 
manager: Fix appending variables.

The if statement here is always false after the for
loop finishes, so variables are never appended.
This removes that to properly append to the end
of the variable list.

ASTERISK-30351 #close
Reported by: Sebastian Gutierrez

Change-Id: I1b7f8b85a8918f6a814cb933a479d4278cf16199

2 years agojson.h: Add ast_json_object_real_get.
Naveen Albert [Fri, 16 Dec 2022 18:25:52 +0000 (18:25 +0000)] 
json.h: Add ast_json_object_real_get.

json.h contains macros to get a string and an integer
from a JSON object. However, the macro to do this for
JSON reals is missing. This adds that.

ASTERISK-30361 #close

Change-Id: I8d0e28d763febf27b05801cdc83b73282aa6ee7a

2 years agores_pjsip_transport_websocket: Add remote port to transport
George Joseph [Fri, 23 Dec 2022 12:02:43 +0000 (05:02 -0700)] 
res_pjsip_transport_websocket: Add remote port to transport

When Asterisk receives a new websocket conenction, it creates a new
pjsip transport for it and copies connection data into it.  The
transport manager then uses the remote IP address and port on the
transport to create a monitor for each connection.  However, the
remote port wasn't being copied, only the IP address which meant
that the transport manager was creating only 1 monitoring entry for
all websocket connections from the same IP address. Therefore, if
one of those connections failed, it deleted the transport taking
all the the connections from that same IP address with it.

* We now copy the remote port into the created transport and the
  transport manager behaves correctly.

ASTERISK-30369

Change-Id: Ib506d40897ea6286455ac0be4dfbb0ed43b727e1

2 years agochan_sip: Remove deprecated module.
Mike Bradeen [Mon, 28 Nov 2022 20:05:21 +0000 (13:05 -0700)] 
chan_sip: Remove deprecated module.

ASTERISK-30297

Change-Id: Ic700168c80b68879d9cee8bb07afe2712fb17996

2 years agores_rtp_asterisk: Asterisk Media Experience Score (MES)
George Joseph [Fri, 28 Oct 2022 10:57:56 +0000 (04:57 -0600)] 
res_rtp_asterisk: Asterisk Media Experience Score (MES)

This module has been updated to provide additional
quality statistics in the form of an Asterisk
Media Experience Score.  The score is avilable using
the same mechanisms you'd use to retrieve jitter, loss,
and rtt statistics.  For more information about the
score and how to retrieve it, see
https://wiki.asterisk.org/wiki/display/AST/Media+Experience+Score

* Updated chan_pjsip to set quality channel variables when a
  call ends.
* Updated channels/pjsip/dialplan_functions.c to add the ability
  to retrieve the MES along with the existing rtcp stats when
  using the CHANNEL dialplan function.
* Added the ast_debug_rtp_is_allowed and ast_debug_rtcp_is_allowed
  checks for debugging purposes.
* Added several function to time.h for manipulating time-in-samples
  and times represented as double seconds.
* Updated rtp_engine.c to pass through the MES when stats are
  requested.  Also debug output that dumps the stats when an
  rtp instance is destroyed.
* Updated res_rtp_asterisk.c to implement the calculation of the
  MES.  In the process, also had to update the calculation of
  jitter.  Many debugging statements were also changed to be
  more informative.
* Added a unit test for internal testing.  The test should not be
  run during normal operation and is disabled by default.

ASTERISK-30280

Change-Id: I458cb9a311e8e5dc1db769b8babbcf2e093f107a

2 years agopbx_app: Update outdated pbx_exec channel snapshots.
Naveen Albert [Wed, 21 Dec 2022 15:01:20 +0000 (15:01 +0000)] 
pbx_app: Update outdated pbx_exec channel snapshots.

pbx_exec makes a channel snapshot before executing applications.
This doesn't cause an issue during normal dialplan execution
where pbx_exec is called over and over again in succession.
However, if pbx_exec is called "one off", e.g. using
ast_pbx_exec_application, then a channel snapshot never ends
up getting made after the executed application returns, and
inaccurate snapshot information will linger for a while, causing
"core show channels", etc. to show erroneous info.

This is fixed by manually making a channel snapshot at the end
of ast_pbx_exec_application, since we anticipate that pbx_exec
might not get called again immediately.

ASTERISK-30367 #close

Change-Id: I2a5131053aa9d11badbc0ef2ef40b1f83d0af086

2 years agores_pjsip_session: Use Caller ID for extension matching.
Naveen Albert [Sat, 26 Nov 2022 12:54:29 +0000 (12:54 +0000)] 
res_pjsip_session: Use Caller ID for extension matching.

Currently, there is no Caller ID available to us when
checking for an extension match when handling INVITEs.
As a result, extension patterns that depend on the Caller ID
are not matched and calls may be incorrectly rejected.

The Caller ID is not available because the supplement that
adds Caller ID to the session does not execute until after
this check. Supplement callbacks cannot yet be executed
at this point since the session is not yet in the appropriate
state.

To fix this without impacting existing behavior, the Caller ID
number is now retrieved before attempting to pattern match.
This ensures pattern matching works correctly and there is
no behavior change to the way supplements are called.

ASTERISK-28767 #close

Change-Id: Iec7f5a3b90e51b65ccf74342f96bf80314b7cfc7

2 years agopbx_builtins: Remove deprecated and defunct functionality.
Naveen Albert [Tue, 29 Nov 2022 21:44:28 +0000 (21:44 +0000)] 
pbx_builtins: Remove deprecated and defunct functionality.

This removes the ImportVar and SetAMAFlags applications
which have been deprecated since Asterisk 12, but were
never removed previously.

Additionally, it removes remnants of defunct options
that themselves were removed years ago.

ASTERISK-30335 #close

Change-Id: I749520c7b08d4c9d5eebbf640d4fbc81950eda8d

2 years agores_pjsip_sdp_rtp.c: Use correct timeout when put on hold.
Ben Ford [Mon, 12 Dec 2022 18:42:17 +0000 (12:42 -0600)] 
res_pjsip_sdp_rtp.c: Use correct timeout when put on hold.

When a call is put on hold and it has moh_passthrough and rtp_timeout
set on the endpoint, the wrong timeout will be used. rtp_timeout_hold is
expected to be used, but rtp_timeout is used instead. This change adds a
couple of checks for locally_held to determine if rtp_timeout_hold needs
to be used instead of rtp_timeout.

ASTERISK-30350

Change-Id: I7b106fc244332014216d12bba851cefe884cc25f

2 years agoapp_voicemail_odbc: Fix string overflow warning.
Naveen Albert [Mon, 14 Nov 2022 13:12:19 +0000 (13:12 +0000)] 
app_voicemail_odbc: Fix string overflow warning.

Fixes a negative offset warning by initializing
the buffer to empty.

Additionally, although it doesn't currently complain
about it, the size of a buffer is increased to
accomodate the maximum size contents it could have.

ASTERISK-30240 #close

Change-Id: I8eecedf14d3f2a75864797f802277cac89a32877

2 years agostreams: Ensure that stream is closed in ast_stream_and_wait on error
Peter Fern [Tue, 22 Nov 2022 03:37:19 +0000 (14:37 +1100)] 
streams:  Ensure that stream is closed in ast_stream_and_wait on error

When ast_stream_and_wait returns an error (for example, when attempting
to stream to a channel after hangup) the stream is not closed, and
callers typically do not check the return code. This results in leaking
file descriptors, leading to resource exhaustion.

This change ensures that the stream is closed in case of error.

ASTERISK-30198 #close
Reported-by: Julien Alie
Change-Id: Ie46b67314590ad75154595a3d34d461060b2e803

2 years agofunc_callerid: Warn about invalid redirecting reason.
Naveen Albert [Sat, 26 Nov 2022 00:03:57 +0000 (00:03 +0000)] 
func_callerid: Warn about invalid redirecting reason.

Currently, if a user attempts to set a Caller ID related
function to an invalid value, a warning is emitted,
except for when setting the redirecting reason.
We now emit a warning if we were unable to successfully
parse the user-provided reason.

ASTERISK-30332 #close

Change-Id: Ic341f5d5f7303b6f1115549be64db58a85944f5a

2 years agoapp_sendtext: Remove references to removed applications.
Naveen Albert [Sat, 10 Dec 2022 22:51:11 +0000 (22:51 +0000)] 
app_sendtext: Remove references to removed applications.

Removes see-also references to applications that don't
exist anymore (removed in Asterisk 19),
so these dead links don't show up on the wiki.

ASTERISK-30347 #close

Change-Id: I9539bc30f57cd65aa4e2d5ce8185eafa09567909

2 years agores_pjsip: Fix path usage in case dialing with '@'
Igor Goncharovsky [Fri, 4 Nov 2022 10:11:07 +0000 (16:11 +0600)] 
res_pjsip: Fix path usage in case dialing with '@'

Fix aor lookup on sip path addition. Issue happens in case of dialing
with @ and overriding user part of RURI.

ASTERISK-30100 #close
Reported-by: Yury Kirsanov
Change-Id: I3f2c42a583578c94397b113e32ca3ebf2d600e13

2 years agores_geoloc: fix NULL pointer dereference bug
Alexandre Fournier [Fri, 9 Dec 2022 19:37:13 +0000 (14:37 -0500)] 
res_geoloc: fix NULL pointer dereference bug

The `ast_geoloc_datastore_add_eprofile` function does not return 0 on
success, it returns the size of the underlying datastore. This means
that the datastore will be freed and its pointer set to NULL when no
error occured at all.

ASTERISK-30346

Change-Id: Iea9b209bd1244cc57b903b9496cb680c356e4bb9

2 years agores_pjsip_aoc: Don't assume a body exists on responses.
Joshua C. Colp [Tue, 13 Dec 2022 15:25:17 +0000 (11:25 -0400)] 
res_pjsip_aoc: Don't assume a body exists on responses.

When adding AOC to an outgoing response the code
assumed that a body would exist for comparing the
Content-Type. This isn't always true.

The code now checks to make sure the response has
a body before checking the Content-Type.

ASTERISK-21502

Change-Id: Iaead371434fc3bc693dad487228106a7d7a5ac76

2 years agoapp_if: Fix format truncation errors.
Naveen Albert [Mon, 12 Dec 2022 15:16:17 +0000 (15:16 +0000)] 
app_if: Fix format truncation errors.

Fixes format truncation warnings in gcc 12.2.1.

ASTERISK-30349 #close

Change-Id: I42be4edf0284358b906e765d1966b6b9d66e1d3c

2 years agochan_alsa: Remove deprecated module.
Mike Bradeen [Mon, 14 Nov 2022 19:44:09 +0000 (12:44 -0700)] 
chan_alsa: Remove deprecated module.

ASTERISK-30298

Change-Id: I5c8afb781528afdf55d237e3bffa5e4a862ae8c7

2 years agomanager: AOC-S support for AOCMessage
Michael Kuron [Tue, 1 Nov 2022 20:37:30 +0000 (21:37 +0100)] 
manager: AOC-S support for AOCMessage

ASTERISK-21502

Change-Id: I051b778f8c862d3b4794d28f2f3d782316707b08

2 years agochan_mgcp: Remove deprecated module.
Mike Bradeen [Tue, 15 Nov 2022 17:03:21 +0000 (10:03 -0700)] 
chan_mgcp: Remove deprecated module.

Also removes res_pktcops to avoid merge conflicts
with ASTERISK~30301.

ASTERISK-30299

Change-Id: I41a316d327646a197b6f112f7f637aceb5111b41

2 years agores_pjsip_aoc: New module for sending advice-of-charge with chan_pjsip
Michael Kuron [Sun, 23 Oct 2022 09:42:34 +0000 (11:42 +0200)] 
res_pjsip_aoc: New module for sending advice-of-charge with chan_pjsip

chan_sip supported sending AOC-D and AOC-E information in SIP INFO
messages in an "AOC" header in a format that was originally defined by
Snom. In the meantime, ETSI TS 124 647 introduced an XML-based AOC
format that is supported by devices from multiple vendors, including
Snom phones with firmware >= 8.4.2 (released in 2010).

This commit adds a new res_pjsip_aoc module that inserts AOC information
into outgoing messages or sends SIP INFO messages as described below.
It also fixes a small issue in res_pjsip_session which didn't always
call session supplements on outgoing_response.

* AOC-S in the 180/183/200 responses to an INVITE request
* AOC-S in SIP INFO (if a 200 response has already been sent or if the
  INVITE was sent by Asterisk)
* AOC-D in SIP INFO
* AOC-D in the 200 response to a BYE request (if the client hangs up)
* AOC-D in a BYE request (if Asterisk hangs up)
* AOC-E in the 200 response to a BYE request (if the client hangs up)
* AOC-E in a BYE request (if Asterisk hangs up)

The specification defines one more, AOC-S in an INVITE request, which
is not implemented here because it is not currently possible in
Asterisk to have AOC data ready at this point in call setup. Once
specifying AOC-S via the dialplan or passing it through from another
SIP channel's INVITE is possible, that might be added.

The SIP INFO requests are sent out immediately when the AOC indication
is received. The others are inserted into an appropriate outgoing
message whenever that is ready to be sent. In the latter case, the XML
is stored in a channel variable at the time the AOC indication is
received. Depending on where the AOC indications are coming from (e.g.
PRI or AMI), it may not always be possible to guarantee that the AOC-E
is available in time for the BYE.

Successfully tested AOC-D and both variants of AOC-E with a Snom D735
running firmware 10.1.127.10. It does not appear to properly support
AOC-S however, so that could only be tested by inspecting SIP traces.

ASTERISK-21502 #close
Reported-by: Matt Jordan <mjordan@digium.com>
Change-Id: Iebb7ad0d5f88526bc6629d3a1f9f11665434d333

2 years agores_hep: Add support for named capture agents.
Naveen Albert [Mon, 21 Nov 2022 18:53:49 +0000 (18:53 +0000)] 
res_hep: Add support for named capture agents.

Adds support for the capture agent name field
of the Homer protocol to Asterisk by allowing
users to specify a name that will be sent to
the HEP server.

ASTERISK-30322 #close

Change-Id: I6136583017f9dd08daeb8be02f60fb8df4639a2b

2 years agores_pjsip: Fix typo in from_domain documentation
Marcel Wagner [Fri, 25 Nov 2022 09:59:07 +0000 (10:59 +0100)] 
res_pjsip: Fix typo in from_domain documentation

This fixes a small typo in the from_domain documentation on the endpoint documentation

ASTERISK-30328 #close

Change-Id: Ia6f0897c3f5cab899ef2cde6b3ac07265b8beb21

2 years agoapp_if: Adds conditional branch applications
Naveen Albert [Mon, 28 Jun 2021 16:56:18 +0000 (16:56 +0000)] 
app_if: Adds conditional branch applications

Adds the If, ElseIf, Else, ExitIf, and EndIf
applications for conditional execution
of a block of dialplan, similar to the While,
EndWhile, and ExitWhile applications. The
appropriate branch is executed at most once
if available and may be broken out of while
inside.

ASTERISK-29497

Change-Id: I3aa3bd35a5add82465c6ee9bd86b64601f0e1f49

2 years agores_pjsip_session.c: Map empty extensions in INVITEs to s.
Naveen Albert [Mon, 17 Oct 2022 00:33:44 +0000 (00:33 +0000)] 
res_pjsip_session.c: Map empty extensions in INVITEs to s.

Some SIP devices use an empty extension for PLAR functionality.

Rather than rejecting these empty extensions, we now use the s
extension for such calls to mirror the existing PLAR functionality
in Asterisk (e.g. chan_dahdi).

ASTERISK-30265 #close

Change-Id: I0861a405cd49bbbf532b52f7b47f0e2810832590

2 years agores_pjsip: Update contact_user to point out default
Marcel Wagner [Thu, 17 Nov 2022 19:30:45 +0000 (20:30 +0100)] 
res_pjsip: Update contact_user to point out default

Updates the documentation for the 'contact_user' field to point out the
default outbound contact if no contact_user is specified 's'

ASTERISK-30316 #close

Change-Id: I61f24fb9164e4d07e05908a2511805281874c876

2 years agores_pjsip_header_funcs: Add custom parameter support.
Naveen Albert [Thu, 21 Jul 2022 19:07:04 +0000 (19:07 +0000)] 
res_pjsip_header_funcs: Add custom parameter support.

Adds support for custom URI and header parameters
in the From header in PJSIP. Parameters can be
both set and read using this function.

ASTERISK-30150 #close

Change-Id: Ifb1bc3c512ad5f6faeaebd7817f004a2ecbd6428

2 years agoapp_voicemail: Fix missing email in msg_create_from_file.
Naveen Albert [Thu, 3 Nov 2022 20:28:23 +0000 (20:28 +0000)] 
app_voicemail: Fix missing email in msg_create_from_file.

msg_create_from_file currently does not dispatch emails,
which means that applications using this function, such
as MixMonitor, will not trigger notifications to users
(only AMI events are sent our currently). This is inconsistent
with other ways users can receive voicemail.

This is fixed by adding an option that attempts to send
an email and falling back to just the notifications as
done now if that fails. The existing behavior remains
the default.

ASTERISK-30283 #close

Change-Id: I597cbb9cf971a18d8776172b26ab187dc096a5c7

2 years agoari: Destroy body variables in channel create.
Joshua C. Colp [Thu, 8 Dec 2022 10:33:02 +0000 (06:33 -0400)] 
ari: Destroy body variables in channel create.

When passing a JSON body to the 'create' channel route
it would be converted into Asterisk variables, but never
freed resulting in a memory leak.

This change makes it so that the variables are freed in
all cases.

ASTERISK-30344

Change-Id: I924dbd866a01c6073e2d6fb846ccaa27ef72d49d

2 years agores_adsi: Fix major regression caused by media format rearchitecture.
Naveen Albert [Wed, 23 Nov 2022 22:59:16 +0000 (22:59 +0000)] 
res_adsi: Fix major regression caused by media format rearchitecture.

The commit that rearchitected media formats,
a2c912e9972c91973ea66902d217746133f96026 (ASTERISK_23114)
introduced a regression by improperly translating code in res_adsi.c.
In particular, the pointer to the frame buffer was initialized
at the top of adsi_careful_send, rather than dynamically updating it
for each frame, as is required.

This resulted in the first frame being repeatedly sent,
rather than advancing through the frames.
This corrupted the transmission of the CAS to the CPE,
which meant that CPE would never respond with the DTMF acknowledgment,
effectively completely breaking ADSI functionality.

This issue is now fixed, and ADSI now works properly again.

ASTERISK-29793 #close

Change-Id: Icdeddf733eda2981c98712d1ac9cddc0db507dbe

2 years agofunc_presencestate: Fix invalid memory access.
Naveen Albert [Sun, 13 Nov 2022 22:15:07 +0000 (22:15 +0000)] 
func_presencestate: Fix invalid memory access.

When parsing information from AstDB while loading,
it is possible that certain pointers are never
set, which leads to invalid memory access and
then, fatally, invalid free attempts on this memory.
We now initialize to NULL to prevent this.

ASTERISK-30311 #close

Change-Id: I6120681d04fd2c12a9473f35ce95a1f8e74e3929

2 years agosig_analog: Fix no timeout duration.
Naveen Albert [Thu, 1 Dec 2022 11:54:23 +0000 (11:54 +0000)] 
sig_analog: Fix no timeout duration.

ASTERISK_28702 previously attempted to fix an
issue with flash hook hold timing out after
just under 17 minutes, when it should have never
been timing out. It fixed this by changing 999999
to INT_MAX, but it did so in chan_dahdi, which
is the wrong place since ss_thread is now in
sig_analog and the one in chan_dahdi is mostly
dead code.

This fixes this by porting the fix to sig_analog.

ASTERISK-30336 #close

Change-Id: I05eb69cc0b5319d357842a70bd26ef64d145cb15

2 years agoxmldoc: Allow XML docs to be reloaded.
Naveen Albert [Sat, 5 Nov 2022 12:11:08 +0000 (12:11 +0000)] 
xmldoc: Allow XML docs to be reloaded.

The XML docs are currently only loaded on
startup with no way to update them during runtime.
This makes it impossible to load modules that
use ACO/Sorcery (which require documentation)
if they are added to the source tree and built while
Asterisk is running (e.g. external modules).

This adds a CLI command to reload the XML docs
during runtime so that documentation can be updated
without a full restart of Asterisk.

ASTERISK-30289 #close

Change-Id: I4f265b0e5517e757c5453a0f241201a5788d3a07

2 years agortp_engine.h: Update examples using ast_format_set.
Naveen Albert [Thu, 24 Nov 2022 15:56:55 +0000 (15:56 +0000)] 
rtp_engine.h: Update examples using ast_format_set.

This file includes some doxygen comments referencing
ast_format_set. This is an obsolete API that was
removed years back, but documentation was not fully
updated to reflect that. These examples are
updated to the current way of doing things
(using the format cache).

ASTERISK-30327 #close

Change-Id: I570f3b8007fa17ba470cc7117f44bfe7c555d2f7

2 years agoapp_osplookup: Remove deprecated module.
Mike Bradeen [Fri, 18 Nov 2022 20:06:31 +0000 (13:06 -0700)] 
app_osplookup: Remove deprecated module.

ASTERISK-30302

Change-Id: I2268189646fa0b587675d8619322818143172474

2 years agochan_skinny: Remove deprecated module.
Mike Bradeen [Wed, 16 Nov 2022 15:51:25 +0000 (08:51 -0700)] 
chan_skinny: Remove deprecated module.

ASTERISK-30300

Change-Id: I8be11455010b8ec552e62b0719368342e8a1bae9

2 years agoapp_mixmonitor: Add option to use real Caller ID for voicemail.
Naveen Albert [Fri, 4 Nov 2022 11:04:08 +0000 (11:04 +0000)] 
app_mixmonitor: Add option to use real Caller ID for voicemail.

MixMonitor currently uses the Connected Line as the Caller ID
for voicemails. This is due to the implementation being written
this way for use with Digium phones. However, in general this
is not correct for generic usage in the dialplan, and people
may need the real Caller ID instead. This adds an option to do that.

ASTERISK-30286 #close

Change-Id: I3d0ce76dfe75e2a614e0f709ab27acbd2478267c

2 years agomanager: prevent file access outside of config dir
Mike Bradeen [Mon, 3 Oct 2022 18:54:40 +0000 (12:54 -0600)] 
manager: prevent file access outside of config dir

Add live_dangerously flag to manager and use this flag to
determine if a configuation file outside of AST_CONFIG_DIR
should be read.

ASTERISK-30176

Change-Id: I46b26af4047433b49ae5c8a85cb8cda806a07404
(cherry picked from commit 81f10e847efdbe8ec264062ee234e1098c29b3f6)