Commit Graph

33703 Commits

Author SHA1 Message Date
Naveen Albert
59bc6ceb61 chan_iax2: Improve authentication debugging.
Improves and adds some logging to make it easier
for users to debug authentication issues.

Resolves: #286
(cherry picked from commit 201d554b4e)
2024-01-12 18:21:31 +00:00
Vitezslav Novy
cb1e146b18 res_rtp_asterisk: fix wrong counter management in ioqueue objects
In function  rtp_ioqueue_thread_remove counter in ioqueue object is not decreased
which prevents unused ICE TURN threads from being removed.

Resolves: #301
(cherry picked from commit 8cf1db15c2)
2024-01-12 18:21:31 +00:00
George Joseph
bc20fc4b50 make_buildopts_h, et. al. Allow adding all cflags to buildopts.h
The previous behavior of make_buildopts_h was to not add the
non-ABI-breaking MENUSELECT_CFLAGS like DETECT_DEADLOCKS,
REF_DEBUG, etc. to the buildopts.h file because "it caused
ccache to invalidate files and extended compile times". They're
only defined by passing them on the gcc command line with '-D'
options.   In practice, including them in the include file rarely
causes any impact because the only time ccache cares is if you
actually change an option so the hit occurrs only once after
you change it.

OK so why would we want to include them?  Many IDEs follow the
include files to resolve defines and if the options aren't in an
include file, it can cause the IDE to mark blocks of "ifdeffed"
code as unused when they're really not.

So...

* Added a new menuselect compile option ADD_CFLAGS_TO_BUILDOPTS_H
  which tells make_buildopts_h to include the non-ABI-breaking
  flags in buildopts.h as well as the ABI-breaking ones. The default
  is disabled to preserve current behavior.  As before though,
  only the ABI-breaking flags appear in AST_BUILDOPTS and only
  those are used to calculate AST_BUILDOPT_SUM.
  A new AST_BUILDOPT_ALL define was created to capture all of the
  flags.

* make_version_c was streamlined to use buildopts.h and also to
  create asterisk_build_opts_all[] and ast_get_build_opts_all(void)

* "core show settings" now shows both AST_BUILDOPTS and
  AST_BUILDOPTS_ALL.

UserNote: The "Build Options" entry in the "core show settings"
CLI command has been renamed to "ABI related Build Options" and
a new entry named "All Build Options" has been added that shows
both breaking and non-breaking options.

(cherry picked from commit 55eca816b1)
2024-01-12 18:21:31 +00:00
Mike Bradeen
0077c388b7 func_periodic_hook: Add hangup step to avoid timeout
func_periodic_hook does not hangup after playback, relying on hangup
which keeps the channel alive longer than necessary.

Resolves: #325
(cherry picked from commit 13da50219e)
2024-01-12 18:21:31 +00:00
Sean Bright
3140af85a6 res_stasis_recording.c: Save recording state when unmuted.
Fixes #322

(cherry picked from commit 8be6f7b78c)
2024-01-12 18:21:31 +00:00
Mike Bradeen
23b00a5cec res_speech_aeap: check for null format on response
* Fixed issue in res_speech_aeap when unable to provide an
  input format to check against.

(cherry picked from commit 15829bcef1)
2024-01-12 18:21:31 +00:00
George Joseph
cb18b1e938 func_periodic_hook: Don't truncate channel name
func_periodic_hook was truncating long channel names which
causes issues when you need to run other dialplan functions/apps
on the channel.

Resolves: #319
(cherry picked from commit 209015a2ff)
2024-01-12 18:21:31 +00:00
George Joseph
89c7b31eb9 safe_asterisk: Change directory permissions to 755
If the safe_asterisk script detects that the /var/lib/asterisk
directory doesn't exist, it now creates it with 755 permissions
instead of 770.  safe_asterisk needing to create that directory
should be extremely rare though because it's normally created
by 'make install' which already sets the permissions to 755.

Resolves: #316
(cherry picked from commit c5a93ea93f)
2024-01-12 18:21:31 +00:00
Maximilian Fridrich
98760e932e chan_rtp: Implement RTP glue for UnicastRTP channels
Resolves: #298

UserNote: The dial string option 'g' was added to the UnicastRTP channel
which enables RTP glue and therefore native RTP bridges with those
channels.

(cherry picked from commit 0cd336a518)
2024-01-12 18:21:31 +00:00
Jaco Kroon
b90f11fc70 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.

UserNote: Introduce a new queue configuration option called
'periodic-announce-startdelay' which will vary the normal (historic)
behavior of starting the periodic announcement cycle at
periodic-announce-frequency seconds after entering the queue to start
the periodic announcement cycle at period-announce-startdelay seconds
after joining the queue.  The default behavior if this config option is
not set remains unchanged.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
(cherry picked from commit 60b529ea00)
2024-01-12 18:21:31 +00:00
Joshua C. Colp
d371d371a0 variables: Add additional variable dialplan functions.
Using the Set dialplan application does not actually
delete channel or global variables. Instead the
variables are set to an empty value.

This change adds two dialplan functions,
GLOBAL_DELETE and DELETE which can be used to
delete global and channel variables instead
of just setting them to empty.

There is also no ability within the dialplan to
determine if a global or channel variable has
actually been set or not.

This change also adds two dialplan functions,
GLOBAL_EXISTS and VARIABLE_EXISTS which can be
used to determine if a global or channel variable
has been set or not.

Resolves: #289

UserNote: Four new dialplan functions have been added.
GLOBAL_DELETE and DELETE have been added which allows
the deletion of global and channel variables.
GLOBAL_EXISTS and VARIABLE_EXISTS have been added
which checks whether a global or channel variable has
been set.

(cherry picked from commit 039bbddd4f)
2024-01-12 18:21:31 +00:00
George Joseph
8517c62842 Restore CHANGES and UPGRADE.txt to allow cherry-picks to work 2024-01-12 11:01:27 -07:00
Asterisk Development Team
908c88428d Update for 18.20.2 18.20.2 2023-12-20 16:22:22 +00:00
George Joseph
615d468abd res_rtp_asterisk: Fix regression issues with DTLS client check
* Since ICE candidates are used for the check and pjproject is
  required to use ICE, res_rtp_asterisk was failing to compile
  when pjproject wasn't available.  The check is now wrapped
  with an #ifdef HAVE_PJPROJECT.

* The rtp->ice_active_remote_candidates container was being
  used to check the address on incoming packets but that
  container doesn't contain peer reflexive candidates discovered
  during negotiation. This was causing the check to fail
  where it shouldn't.  We now check against pjproject's
  real_ice->rcand array which will contain those candidates.

* Also fixed a bug in ast_sockaddr_from_pj_sockaddr() where
  we weren't zeroing out sin->sin_zero before returning.  This
  was causing ast_sockaddr_cmp() to always return false when
  one of the inputs was converted from a pj_sockaddr, even
  if both inputs had the same address and port.

Resolves: #500
Resolves: #503
Resolves: #505
2023-12-20 08:47:41 -07:00
Asterisk Development Team
14d0e59f3d Update for 18.20.1 18.20.1 2023-12-14 19:56:32 +00:00
Gitea
31e8a39504 res_pjsip_header_funcs: Duplicate new header value, don't copy.
When updating an existing header the 'update' code incorrectly
just copied the new value into the existing buffer. If the
new value exceeded the available buffer size memory outside
of the buffer would be written into, potentially causing
a crash.

This change makes it so that the 'update' now duplicates
the new header value instead of copying it into the existing
buffer.
2023-12-14 11:56:26 -07:00
Mike Bradeen
3e95619135 res_pjsip: disable raw bad packet logging
Add patch to split the log level for invalid packets received on the
signaling port.  The warning regarding the packet will move to level 2
so that it can still be displayed, while the raw packet will be at level
4.
2023-12-14 11:56:17 -07:00
George Joseph
986b55eeaa res_rtp_asterisk.c: Check DTLS packets against ICE candidate list
When ICE is in use, we can prevent a possible DOS attack by allowing
DTLS protocol messages (client hello, etc) only from sources that
are in the active remote candidates list.

Resolves: GHSA-hxj9-xwr8-w8pq
2023-12-14 11:56:06 -07:00
Ben Ford
8f015af774 manager.c: Prevent path traversal with GetConfig.
When using AMI GetConfig, it was possible to access files outside of the
Asterisk configuration directory by using filenames with ".." and "./"
even while live_dangerously was not enabled. This change resolves the
full path and ensures we are still in the configuration directory before
attempting to access the file.
2023-12-14 11:55:57 -07:00
Asterisk Development Team
5c38e52afc Update for 18.20.0 18.20.0 2023-10-18 17:01:25 +00:00
Asterisk Development Team
538802a5af Update for 18.20.0-rc1 18.20.0-rc1 2023-09-06 16:47:02 +00:00
George Joseph
f8632232fd ari-stubs: Fix more local anchor references
Also allow CreateDocs job to be run manually with default branches.

(cherry picked from commit c14849ac17)
2023-09-06 16:46:46 +00:00
George Joseph
e2f2e8dcef ari-stubs: Fix more local anchor references
Also allow CreateDocs job to be run manually with default branches.

(cherry picked from commit 0771c94e23)
2023-09-06 16:46:46 +00:00
George Joseph
f2d3c6876d ari-stubs: Fix broken documentation anchors
All of the links that reference page anchors with capital letters in
the ids (#Something) have been changed to lower case to match the
anchors that are generated by mkdocs.

(cherry picked from commit 540c8b2794)
2023-09-06 16:46:46 +00:00
Bastian Triller
9b1071f259 res_pjsip_session: Send Session Interval too small response
Handle session interval lower than endpoint's configured minimum timer
when sending first answer. Timer setting is checked during this step and
needs to handled appropriately.
Before this change, no response was sent at all. After this change a
response with 422 Session Interval too small is sent to UAC.

(cherry picked from commit 98665a14b3)
2023-09-06 16:46:46 +00:00
George Joseph
92ac4efec7 .github: Update workflow-application-token-action to v2
(cherry picked from commit 29967e1eea)
2023-09-06 16:46:46 +00:00
Naveen Albert
fd98f7c893 app_dial: Fix infinite loop when sending digits.
If the called party hangs up while digits are being
sent, -1 is returned to indicate so, but app_dial
was not checking the return value, resulting in
the hangup being lost and looping forever until
the caller manually hangs up the channel. We now
abort if digit sending fails.

ASTERISK-29428 #close

Resolves: #281
(cherry picked from commit 1ada3c0747)
2023-09-06 16:46:46 +00:00
Mike Bradeen
3e2cb7ecb1 app_voicemail: Fix for loop declarations
Resolve for loop initial declarations added in cli changes.

Resolves: #275
(cherry picked from commit 62480fd91b)
2023-09-06 16:46:46 +00:00
George Joseph
a8fead5885 alembic: Fix quoting of the 100rel column
Add quoting around the ps_endpoints 100rel column in the ALTER
statements.  Although alembic doesn't complain when generating
sql statements, postgresql does (rightly so).

Resolves: #274
(cherry picked from commit 39b8b76f7c)
2023-09-06 16:46:46 +00:00
Naveen Albert
1760130d35 pbx.c: Fix gcc 12 compiler warning.
Resolves: #277
(cherry picked from commit 1241410bc3)
2023-09-06 16:46:46 +00:00
zhengsh
e879a5534a app_audiosocket: Fixed timeout with -1 to avoid busy loop.
Resolves: asterisk#234
(cherry picked from commit a2353f4803)
2023-09-06 16:46:46 +00:00
George Joseph
03ff38beb6 download_externals: Fix a few version related issues
* Fixed issue with the script not parsing the new tag format for
  certified releases.  The format changed from certified/18.9-cert5
  to certified-18.9-cert5.

* Fixed issue where the asterisk version wasn't being considered
  when looking for cached versions.

Resolves: #263
(cherry picked from commit 79e533e15b)
2023-09-06 16:46:46 +00:00
Maximilian Fridrich
a62ccbe17e main/refer.c: Fix double free in refer_data_destructor + potential leak
Resolves: #267
(cherry picked from commit 0950d116af)
2023-09-06 16:46:46 +00:00
Naveen Albert
c48bbbdbbc sig_analog: Add Called Subscriber Held capability.
This adds support for Called Subscriber Held for FXS
lines, which allows users to go on hook when receiving
a call and resume the call later from another phone on
the same line, without disconnecting the call. This is
a convenience mechanism that most real PSTN telephone
switches support.

ASTERISK-30372 #close

Resolves: #240

UserNote: Called Subscriber Held is now supported for analog
FXS channels, using the calledsubscriberheld option. This allows
a station  user to go on hook when receiving an incoming call
and resume from another phone on the same line by going on hook,
without disconnecting the call.

(cherry picked from commit 333858fb70)
2023-09-06 16:46:46 +00:00
Matthew Fredrickson
9cec96a04c app_macro: Fix locking around datastore access
app_macro sometimes would crash due to datastore list corruption on the
channel because of lack of locking around find and create process for
the macro datastore. This patch locks the channel lock prior to protect
against this problem.

Resolves: #265
(cherry picked from commit ec4e0340ce)
2023-09-06 16:46:46 +00:00
Matthew Fredrickson
e15c994186 Revert "app_stack: Print proper exit location for PBXless channels."
This reverts commit 617dad4cba.

apps/app_stack.c: Revert buggy gosub patch

This seems to break the case when a predial macro calls a gosub.
When the gosub calls return, the Return function outputs:

app_stack.c:423 return_exec: Return without Gosub: stack is empty

This returns -1 to the calling macro, which returns to app_dial
and causes the call to hangup instead of proceeding with the macro
that invoked the gosub.

Resolves: #253
(cherry picked from commit 3f80f9ce0b)
2023-09-06 16:46:46 +00:00
George Joseph
5b6d391f4b .github: Use generic releaser
(cherry picked from commit a70c39acf8)
2023-09-06 16:46:46 +00:00
Jason D. McCormick
5d38f6bffc install_prereq: Fix dependency install on aarch64.
Fixes dependency solutions in install_prereq for Debian aarch64
platforms. install_prereq was attempting to forcibly install 32-bit
armhf packages due to the aptitude search for dependencies.

Resolves: #37
(cherry picked from commit ef59542668)
2023-09-06 16:46:46 +00:00
MikeNaso
ca8761b9b1 res_pjsip.c: Set contact_user on incoming call local Contact header
If the contact_user is configured on the endpoint it will now be set on the local Contact header URI for incoming calls. The contact_user has already been set on the local Contact header URI for outgoing calls.

Resolves: #226
(cherry picked from commit 4fc07f6d4e)
2023-09-06 16:46:46 +00:00
Sean Bright
81bc763a51 extconfig: Allow explicit DB result set ordering to be disabled.
Added a new boolean configuration flag -
`order_multi_row_results_by_initial_column` - to both res_pgsql.conf
and res_config_odbc.conf that allows the administrator to disable the
explicit `ORDER BY` that was previously being added to all generated
SQL statements that returned multiple rows.

Fixes: #179
(cherry picked from commit 0bb192831c)
2023-09-06 16:46:46 +00:00
George Joseph
1d4565dd54 rest-api: Run make ari-stubs
An earlier cherry-pick that involved rest-api somehow didn't include
a comment change in res/ari/resource_endpoints.h.  This commit
corrects that.  No changes other than the comment.

(cherry picked from commit 6209d47b44)
2023-09-06 16:46:46 +00:00
Naveen Albert
3442c05b65 res_pjsip_header_funcs: Make prefix argument optional.
The documentation for PJSIP_HEADERS claims that
prefix is optional, but in the code it is actually not.
However, there is no inherent reason for this, as users
may want to retrieve all header names, not just those
beginning with a certain prefix.

This makes the prefix optional for this function,
simply fetching all header names if not specified.
As a result, the documentation is now correct.

Resolves: #230

UserNote: The prefix argument to PJSIP_HEADERS is now
optional. If not specified, all header names will be
returned.

(cherry picked from commit 08e7d77fce)
2023-09-06 16:46:46 +00:00
George Joseph
f5ad4f8989 pjproject_bundled: Increase PJSIP_MAX_MODULE to 38
The default is 32 with 8 being used by pjproject itself.  Recent
commits have put us over the limit resulting in assertions in
pjproject.  Since this value is used in invites, dialogs,
transports and subscriptions as well as the global pjproject
endpoint, we don't want to increase it too much.

Resolves: #255
(cherry picked from commit cb7a95d465)
2023-09-06 16:46:46 +00:00
Joshua C. Colp
9ef84b8076 manager: Tolerate stasis messages with no channel snapshot.
In some cases I have yet to determine some stasis messages may
be created without a channel snapshot. This change adds some
tolerance to this scenario, preventing a crash from occurring.

(cherry picked from commit 9b607747ce)
2023-09-06 16:46:46 +00:00
Maximilian Fridrich
fd4ebb4482 core/ari/pjsip: Add refer mechanism
This change adds support for refers that are not session based. It
includes a refer implementation for the PJSIP technology which results
in out-of-dialog REFERs being sent to a PJSIP endpoint. These can be
triggered using the new ARI endpoint `/endpoints/refer`.

Resolves: #71

UserNote: There is a new ARI endpoint `/endpoints/refer` for referring
an endpoint to some URI or endpoint.

(cherry picked from commit 57f77e8218)
2023-09-06 16:46:46 +00:00
Naveen Albert
de8890e0e4 chan_dahdi: Allow autoreoriginating after hangup.
Currently, if an FXS channel is still off hook when
all calls on the line have hung up, the user is provided
reorder tone until going back on hook again.

In addition to not reflecting what most commercial switches
actually do, it's very common for switches to automatically
reoriginate for the user so that dial tone is provided without
the user having to depress and release the hookswitch manually.
This can increase convenience for users.

This behavior is now supported for kewlstart FXS channels.
It's supported only for kewlstart (FXOKS) mainly because the
behavior doesn't make any sense for ground start channels,
and loop start signalling doesn't provide the necessary DAHDI
event that makes this easy to implement. Likely almost everyone
is using FXOKS over FXOLS anyways since FXOLS is pretty useless
these days.

ASTERISK-30357 #close

Resolves: #224

UserNote: The autoreoriginate setting now allows for kewlstart FXS
channels to automatically reoriginate and provide dial tone to the
user again after all calls on the line have cleared. This saves users
from having to manually hang up and pick up the receiver again before
making another call.

(cherry picked from commit c08c458fa2)
2023-09-06 16:46:46 +00:00
Joshua C. Colp
d419ec4e27 audiohook: Unlock channel in mute if no audiohooks present.
In the case where mute was called on a channel that had no
audiohooks the code was not unlocking the channel, resulting
in a deadlock.

Resolves: #233
(cherry picked from commit 674bb1c9fe)
2023-09-06 16:46:46 +00:00
Naveen Albert
b145eb611e sig_analog: Allow three-way flash to time out to silence.
sig_analog allows users to flash and use the three-way dial
tone as a primitive hold function, simply by never timing
it out.

Some systems allow this dial tone to time out to silence,
so the user is not annoyed by a persistent dial tone.
This option allows the dial tone to time out normally to
silence.

ASTERISK-30004 #close
Resolves: #205

UserNote: The threewaysilenthold option now allows the three-way
dial tone to time out to silence, rather than continuing forever.

(cherry picked from commit a670655b7a)
2023-09-06 16:46:46 +00:00
Holger Hans Peter Freyther
0aa95751db res_prometheus: Do not generate broken metrics
In 8d6fdf9c3a invisible bridges were
skipped but that lead to producing metrics with no name and no help.

Keep track of the number of metrics configured and then only emit these.
Add a basic testcase that verifies that there is no '(NULL)' in the
output.

ASTERISK-30474

(cherry picked from commit 9b93fb9f67)
2023-09-06 16:46:46 +00:00
Sean Bright
4db0a4520e res_pjsip: Enable TLS v1.3 if present.
Fixes #221

UserNote: res_pjsip now allows TLS v1.3 to be enabled if supported by
the underlying PJSIP library. The bundled version of PJSIP supports
TLS v1.3.

(cherry picked from commit 8e23f3e313)
2023-09-06 16:46:46 +00:00