Adds two optional modules:
res_stasis_broadcast.so: Infrastructure for broadcasting a single incoming
channel to multiple ARI applications with atomic first-claim-wins semantics.
app_stasis_broadcast.so: Provides the StasisBroadcast() dialplan application
which invokes the broadcast infrastructure.
Both modules are self-contained; if neither is loaded there is zero runtime
impact. Loading them does not alter existing Stasis or ARI behavior unless
explicitly used.
Key Features (only active when modules are loaded):
Fisher-Yates shuffled broadcast dispatch for fair claim races
Atomic claim operations using mutex + condition variable signaling
Configurable broadcast timeouts
Safe regex application filtering with validation to mitigate ReDoS risk
Thread-safe channel variable snapshotting (channel locked during reads)
Late-claim safety: broadcast context kept alive until after the Stasis
session ends so concurrent claimants always receive 409 Conflict rather
than 404 Not Found
Memory safety via RAII_VAR, ast_json_ref/unref, and ao2 reference counting
Components Added:
res/res_stasis_broadcast.c: Core broadcast + claim logic
apps/app_stasis_broadcast.c: StasisBroadcast() dialplan application
include/asterisk/stasis_app_broadcast.h: Public API header
res/ari/resource_events.c: Integrates POST /ari/events/claim endpoint
rest-api/api-docs/events.json: New CallBroadcast and CallClaimed events
Implementation Notes:
Broadcast contexts reside in an ao2 hash container keyed by channel id. Each
context holds atomic claim state, winner application name, timeout metadata,
and a condition variable for waiters. Broadcast contexts are kept alive until
after stasis_app_exec() returns so that concurrent claimants racing against
the timeout always receive 409 Conflict. Broadcast dispatch calls
stasis_app_send() directly for each matching application in shuffled order.
Regex filters are validated with bounded length, group depth, quantified
group count, and alternation limits to reduce pathological backtracking.
Timeout calculation uses timespec arithmetic with overflow-safe millisecond
remainder handling. Event JSON follows existing Stasis/ARI conventions;
references are managed correctly to avoid leaks or double frees.
Optional Nature / Impact:
No changes to existing APIs, events, or applications when absent.
Clean fallback: systems ignoring the modules behave identically to prior
versions.
Development was assisted by Claude (Anthropic). All generated code has been
reviewed, tested, and is understood by the author.
UserNote: New optional modules res_stasis_broadcast.so and
app_stasis_broadcast.so enable broadcasting an incoming channel to multiple
ARI applications. The first application to successfully claim (via
POST /ari/events/claim) wins channel control. StasisBroadcast() dialplan
application initiates broadcasts. CallBroadcast and CallClaimed events notify
applications. When modules are not loaded, behavior is unchanged.
DeveloperNote: New public APIs in stasis_app_broadcast.h:
stasis_app_broadcast_channel(), stasis_app_claim_channel(),
stasis_app_broadcast_winner(), and stasis_app_broadcast_wait(). New ARI event
types (CallBroadcast, CallClaimed) added to events.json. All code is isolated;
no existing ABI modified.
Include the channel name in warnings during wait_for_answer to make
them more useful and allow problematic channels to be easily identified.
Resolves: #1802
GCC 15.2.1 pays attention to the discarding of the const
qualifier when strchr, strrchr, memchr, or memrchr are now
used. This change fixes numerous errors with this throughout
the tree. The fixes can be broken down into the following:
1. The return value should be considered const.
2. The value passed to strchr or strrchr can be cast as it is
expected and allowed to be modified.
3. The pointer passed to strchr or strrchr is not meant to be
modified and so the contents must be duplicated.
4. It was declared const and never should have been.
This adds a 'prio' setting to ensure that call priority is respected across multiple queues.
Using 'yes' could cause high-priority callers to be skipped if a caller
in another queue had a longer wait time, regardless of priority.
Resolves: #1637
UserNote: The 'force_longest_waiting_caller' option now supports a 'prio' setting.
When set to 'prio', calls are offered by priority first, then by wait time.
app_queue: Set Dial-compatible timing variables
Extends Queue() to set Dial-compatible timing variables (ANSWEREDTIME, DIALEDTIME) and introduces a precise QUEUEWAIT metric calculated at agent connect time, with proper initialization to prevent stale or misleading values.
QUEUE_RAISE_PENALTY=rN was not respected during member selection. calc_metric() raised penalties below QUEUE_MIN_PENALTY, allowing excluded members to be selected.
This change makes calc_metric() honor raise_respect_min, keeping behavior consistent with queue empty checks and expected rN semantics
UserNote: Fixes an issue where QUEUE_RAISE_PENALTY=rN could raise a member’s penalty below QUEUE_MIN_PENALTY during member selection. This could allow members intended to be excluded to be selected. The queue now consistently respects the minimum penalty when raising penalties, aligning member selection behavior with queue empty checks and documented rN semantics.
This prevents a situation where a call joining at 1st position to a queue with calls
leads to a state where no callers are considered the longest waiting,
causing queues to stop offering calls.
Resolves: #1691
The Call Completion Supplementary Service feature is rarely used but many of
it's functions are called by app_dial and channel.c "just in case". These
functions lock and unlock the channel just to see if CCSS is enabled on it,
which it isn't 99.99% of the time.
UserNote: A new "enabled" parameter has been added to ccss.conf. It defaults
to "yes" to preserve backwards compatibility but CCSS is rarely used so
setting "enabled = no" in the "general" section can save some unneeded channel
locking operations and log message spam. Disabling ccss will also prevent
the func_callcompletion and chan_dahdi modules from loading.
DeveloperNote: A new API ast_is_cc_enabled() has been added. It should be
used to ensure that CCSS is enabled before making any other ast_cc_* calls.
UpgradeNote: In an effort to reduce log spam, two normal progress
"pickup attempted" log messages from app_directed_pickup have been changed
from NOTICE to VERBOSE(3). This puts them on par with other normal
dialplan progress messages.
Calling Reload() without any arguments is supposed to reload
everything (equivalent to a 'core reload'), but actually does
nothing. This is because it was calling ast_module_reload with
an empty string, and the argument needs to explicitly be NULL.
Resolves: #1597
Commit a46d5f9b76 removed the deprecated
'e' option to ResetCDR; this now causes DISA() to emit a warning
if attempting to call ResetCDR() with the deprecated option (in
all cases except when the no answer option is provided). Rewrite
the code to do this the current way.
Resolves: #1592
The 's' (skip) option delays MixMonitor recording until the specified number of seconds
(can be fractional) have elapsed since MixMonitor was invoked.
No audio is written to the recording file during this time. If the call ends before this
period, no audio will be saved. This is useful for avoiding early audio such as
announcements, ringback tones, or other non-essential sounds.
UserNote: This change introduces a new 's(<seconds>)' (skip) option to the MixMonitor
application. Example:
MixMonitor(${UNIQUEID}.wav,s(3))
This skips recording for the first 3 seconds before writing audio to the file.
Existing MixMonitor behavior remains unchanged when the 's' option is not used.
Only make announcements to head caller if announce_to_first_user is true
Fixes: #1568
UserNote: When announce_to_first_user is false, no announcements are played to the head caller
When macro was removed in Asterisk 21, the parameter documentation in
code was not updated to reflect the correct numerization for gosub. It
still stated that it was the seventh parameter, but got shifted to the
sixth due to the removal of macro. This has been updated to correctly
reflect the parameter order, and a note has been added to the XML that
states this was done after the initial commit.
Fixes: #1534
UpgradeNote: As part of Asterisk 21, macros were removed from Asterisk.
This resulted in argument order changing for the Queue dialplan
application since the macro argument was removed. Upgrade notice was
missed when this was done, so this upgrade note has been added to
provide a record of such and a notice to users who may have not upgraded
yet.
The app_queue module subscribes on a per-dialed agent basis to both
the bridge all and channel all topics to keep apprised of things going
on involving them. This subscription has associated state that must
be cleaned up when the subscription ends. This was done by setting
a default router callback that only had logic to handle the case
where the subscription ends. By using the default router callback
all filtering for the subscription was disabled, causing unrelated
messages to get published and handled by it.
This change makes it so that an explicit route is added for the
message type used for the message indicating the subscription has
ended and removes the default router callback. This allows message
filtering to occur on publishing reducing the messages to app_queue
to only those it is interested in.
Add a sorely needed option to set a timeout between digits, rather than
for receiving the entire number. This is needed if the number of digits
being sent is unknown by the receiver in advance. Previously, we had
to wait for the entire timer to expire.
Resolves: #1493
UserNote: The 't' option for ReceiveSF now allows for a timer since
the last digit received, in addition to the number-wide timeout.
Even though Dial() internally uses milliseconds for its dial timeouts,
this capability has been mostly obscured from users as the argument is
only parsed as an integer, thus forcing the use of whole seconds for
timeouts.
Parse it as a decimal instead so that timeouts can now truly have
millisecond precision.
Resolves: #1487
UserNote: The answer and progress dial timeouts now have millisecond
precision, instead of having to be whole numbers.
Add NULL check for word_list before calling word_in_list()
Add NULL checks for channel snapshots from ast_multi_channel_blob_get_channel()
Resolves: #1425
get_token can return NULL, but process_token uses this result without
checking for NULL; as elsewhere, check for a NULL result to avoid
possible NULL dereference.
Resolves: #1419
In many asterisk-based systems, the pause reason is used to separate
pauses by type,and logically, changing the reason defines two intervals
that should be accounted for separately. The introduction of a new
option allows me to separate the intervals of operator inactivity in
the log by the event of unpausing.
UserNote: Add new global option 'log_unpause_on_reason_change' that
is default disabled. When enabled cause addition of UNPAUSE event on
every re-PAUSE with reason changed.
The functions WaitForNoise() and WaitForSilence() use the time()
functions to calculate elapsed time, which causes the timer to fire on
a whole second boundary, and the actual function execution time to fire
the timer may be 1 second less than expected. This fix replaces time()
with ast_tvnow().
Fixes: #1401
Numerically comparing that the current queue position is less than
last_pos_said can only be done after at least one announcement has been
made, otherwise last_pos_said is at the default (0).
Fixes: #1386
Add an option for ChanSpy and ExtenSpy to not answer the channel
automatically. Most applications that auto-answer by default
already have an option to disable this behavior if unwanted.
Resolves: #1358
UserNote: ChanSpy and ExtenSpy can now be configured to not
automatically answer the channel by using the 'N' option.
It's reproducible with pbx_lua, not regular dialplan.
deadlock description:
1. asterisk locks a channel
2. calls function onedigit_goto
3. calls ast_goto_if_exists funciton
4. checks ast_exists_extension -> pbx_extension_helper
5. pbx_extension_helper calls pbx_find_extension
6. Then asterisk starts autoservice in a new thread
7. autoservice run tries to lock the channel again
Because our channel is locked already, autoservice can't lock.
Autoservice can't lock -> autoservice stop is waiting forever.
onedigit_goto waits for autoservice stop.
Resolves: https://github.com/asterisk/asterisk/issues/1335
QUEUE_MEMBER_COUNT has been deprecated since at least 1.6,
for fully duplicating functionality available in the
QUEUE_MEMBER function; remove it now.
Resolves: #1341
UpgradeNote: The deprecated QUEUE_MEMBER_COUNT function
has been removed; use QUEUE_MEMBER(<queue>,logged) instead.
The already-deprecated "password" option for the AGENT function was
removed in commit d43b17a872 for
Asterisk 12, but the documentation for it wasn't removed then.
Resolves: #1321
Remove the deprecated maxmessage and minmessage options,
which have been superseded by maxsecs and minsecs since 1.6.
Also remove the deprecated 'cz' language option (deprecated
since 1.8.)
Resolves: #1298
UpgradeNote: The deprecated maxmessage and minmessage options
have been removed; use maxsecs and minsecs instead.
The deprecated 'cz' language has also been removed; use 'cs' instead.
When using the "D" option to output interleaved audio, the file extension
must be ".raw". That info wasn't being properly rendered in the markdown
and HTML on the documentation site. The XML was updated to move the
note in the option section to a warning in the description.
Resolves: #1269
users.conf was deprecated in Asterisk 21 and is now being removed
for Asterisk 23, in accordance with the Asterisk deprecation policy.
This consists of:
* Removing integration with app_directory, app_voicemail, chan_dahdi,
chan_iax2, and AMI.
* users.conf was also partially used for res_phoneprov, and this remaining
functionality is consolidated to a separate phoneprov_users.conf,
used only by res_phoneprov.
Resolves: #1292
UpgradeNote: users.conf has been removed and all channel drivers must
be configured using their specific configuration files. The functionality
previously in users.conf for res_phoneprov is now in phoneprov_users.conf.
Add a function that can be used to retrieve info
about a previous recording, such as its duration.
This is being added as a function to avoid possibly
trampling on dialplan variables, and could be extended
to provide other information in the future.
Resolves: #548
UserNote: The RECORDING_INFO function can now be used
to retrieve the duration of a recording.
This fixes bugs in SMS messaging to SMS-capable analog phones that prevented app_sms.c from talking to phones using SMS protocol 2.
- Fix MORX message reception (from phone to Asterisk) in SMS protocol 2
- Fix MTTX message transmission (from Asterisk to phone) in SMS protocol 2
One of the bugs caused messages to have random characters and junk appended at the end up to the character limit. Another bug prevented Asterisk from sending messages from Asterisk to the phone at all. A final bug caused the transmission from Asterisk to the phone to take a long time because app_sms.c did not hang up after correctly sending the message, causing the phone to have to time out and hang up in order to complete the message transmission.
This was tested with a Linksys PAP2T and with a GrandStream HT814, sending and receiving messages with Telefónica DOMO Mensajes phones from Telefónica Spain. I had to play with both the network jitter buffer and the dB gain to get it to work. One of my phones required the gain to be set to +3dB for it to work, while another required it to be set to +6dB.
Only MORX and MTTX were tested, I did not test sending and receiving messages to a TelCo SMSC.
This update adds support for a new QUEUE_RAISE_PENALTY format: rN
When QUEUE_RAISE_PENALTY is set to rN (e.g., r4), only members whose current penalty
is greater than or equal to the defined min_penalty and less than or equal to max_penalty
will have their penalty raised to N.
Members with penalties outside the min/max range remain unchanged.
Example behaviors:
QUEUE_RAISE_PENALTY=4 → Raise all members with penalty < 4 (existing behavior)
QUEUE_RAISE_PENALTY=r4 → Raise only members with penalty in [min_penalty, max_penalty] to 4
Implementation details:
Adds parsing logic to detect the r prefix and sets the raise_respect_min flag
Modifies the raise logic to skip members outside the defined penalty range when the flag is active
UserNote: This change introduces QUEUE_RAISE_PENALTY=rN, allowing selective penalty raises
only for members whose current penalty is within the [min_penalty, max_penalty] range.
Members with lower or higher penalties are unaffected.
This behavior is backward-compatible with existing queue rule configurations.
Asterisk can now establish websocket sessions _to_ your ARI applications
as well as accepting websocket sessions _from_ them.
Full details: http://s.asterisk.net/ari-outbound-ws
Code change summary:
* Added an ast_vector_string_join() function,
* Added ApplicationRegistered and ApplicationUnregistered ARI events.
* Converted res/ari/config.c to use sorcery to process ari.conf.
* Added the "outbound-websocket" ARI config object.
* Refactored res/ari/ari_websockets.c to handle outbound websockets.
* Refactored res/ari/cli.c for the sorcery changeover.
* Updated res/res_stasis.c for the sorcery changeover.
* Updated apps/app_stasis.c to allow initiating per-call outbound websockets.
* Added CLI commands to manage ARI websockets.
* Added the new "outbound-websocket" object to ari.conf.sample.
* Moved the ARI XML documentation out of res_ari.c into res/ari/ari_doc.xml
UserNote: Asterisk can now establish websocket sessions _to_ your ARI applications
as well as accepting websocket sessions _from_ them.
Full details: http://s.asterisk.net/ari-outbound-ws
Adds support for Call Waiting Deluxe options to enhance
the current call waiting feature.
As part of this change, a mechanism is also added that
allows a channel driver to queue an audio file for Dial()
to play, which is necessary for the announcement function.
ASTERISK-30373 #close
Resolves: #271
UserNote: Call Waiting Deluxe can now be enabled for FXS channels
by enabling its corresponding option.
Ignore gcc warning about writing 32 bytes into a region of size 6,
since we check that we don't go out of bounds for each byte.
This is due to a vectorization bug in gcc 15, stemming from
gcc commit 68326d5d1a593dc0bf098c03aac25916168bc5a9.
Resolves: #1088
Add log-caller-id-name option to log Caller ID Name in queue log
This patch introduces a new global configuration option, log-caller-id-name,
to queues.conf to control whether the Caller ID name is logged when a call enters a queue.
When log-caller-id-name=yes, the Caller ID name is logged
as parameter 4 in the queue log, provided it’s allowed by the
existing log_restricted_caller_id rules. If log-caller-id-name=no (the default),
the Caller ID name is omitted from the logs.
Fixes: #1091
UserNote: This patch adds a global configuration option, log-caller-id-name, to queues.conf
to control whether the Caller ID name is logged as parameter 4 when a call enters a queue.
When log-caller-id-name=yes, the Caller ID name is included in the queue log,
Any '|' characters in the caller ID name will be replaced with '_'.
(provided it’s allowed by the existing log_restricted_caller_id rules).
When log-caller-id-name=no (the default), the Caller ID name is omitted.
Updated the AudioSocket protocol to allow sending DTMF frames.
AST_FRAME_DTMF frames are now forwarded to the server, in addition to
AST_FRAME_AUDIO frames. A new payload type AST_AUDIOSOCKET_KIND_DTMF
with value 0x03 was added to the protocol. The payload is a 1-byte
ascii representing the DTMF digit (0-9,*,#...).
UserNote: The AudioSocket protocol now forwards DTMF frames with
payload type 0x03. The payload is a 1-byte ascii representing the DTMF
digit (0-9,*,#...).
- Correct wait timeout logic in the dialplan application.
- Include server address in log messages for better traceability.
- Allow dialplan app to exit gracefully on hangup messages and socket closure.
- Optimize I/O by reducing redundant read()/write() operations.
Co-authored-by: Florent CHAUVEAU <florentch@pm.me>