Commit Graph

34221 Commits

Author SHA1 Message Date
Igor Goncharovsky
509b90dc6d app_waitforsilence.c: Use milliseconds to calculate timeout time
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
(cherry picked from commit e6ade6ddbd)
2025-09-10 19:53:00 +00:00
Artem Umerov
f8bc41269f Fix missing ast_test_flag64 in extconf.c
Fix missing ast_test_flag64 after 43bf8a4ded

(cherry picked from commit 5a32533245)
2025-09-10 19:53:00 +00:00
Naveen Albert
411001353e pbx_builtins: Allow custom tone for WaitExten.
Currently, the 'd' option will play dial tone while waiting
for digits. Allow it to accept an argument for any tone from
indications.conf.

Resolves: #1396

UserNote: The tone used while waiting for digits in WaitExten
can now be overridden by specifying an argument for the 'd'
option.

(cherry picked from commit d063257ab7)
2025-09-10 19:53:00 +00:00
Naveen Albert
9c2e869be3 res_tonedetect: Add option for TONE_DETECT detection to auto stop.
One of the problems with TONE_DETECT as it was originally written
is that if a tone is detected multiple times, it can trigger
the redirect logic multiple times as well. For example, if we
do an async goto in the dialplan after detecting a tone, because
the detector is still active until explicitly disabled, if we
detect the tone again, we will branch again and start executing
that dialplan a second time. This is rarely ever desired behavior,
and can happen if the detector is not removed quickly enough.

Add a new option, 'e', which automatically disables the detector
once the desired number of matches have been heard. This eliminates
the potential race condition where previously the detector would
need to be disabled immediately, but doing so quickly enough
was not guaranteed. This also allows match criteria to be retained
longer if needed, so the detector does not need to be destroyed
prematurely.

Resolves: #1390

UserNote: The 'e' option for TONE_DETECT now allows detection to
be disabled automatically once the desired number of matches have
been fulfilled, which can help prevent race conditions in the
dialplan, since TONE_DETECT does not need to be disabled after
a hit.

(cherry picked from commit d555e8117f)
2025-09-10 19:53:00 +00:00
Stuart Henderson
892399234d app_queue: fix comparison for announce-position-only-up
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
(cherry picked from commit a32fe85725)
2025-09-10 19:53:00 +00:00
Alexei Gradinari
f3cc44f4b1 sorcery: Prevent duplicate objects and ensure missing objects are created on update
This patch resolves two issues in Sorcery objectset handling with multiple
backends:

1. Prevent duplicate objects:
   When an object exists in more than one backend (e.g., a contact in both
   'astdb' and 'realtime'), the objectset previously returned multiple instances
   of the same logical object. This caused logic failures in components like the
   PJSIP registrar, where duplicate contact entries led to overcounting and
   incorrect deletions, when max_contacts=1 and remove_existing=yes.

   This patch ensures only one instance of an object with a given key is added
   to the objectset, avoiding these duplicate-related side effects.

2. Ensure missing objects are created:
   When using multiple writable backends, a temporary backend failure can lead
   to objects missing permanently from that backend.
   Currently, .update() silently fails if the object is not present,
   and no .create() is attempted.
   This results in inconsistent state across backends (e.g. astdb vs. realtime).

   This patch introduces a new global option in sorcery.conf:
     [general]
     update_or_create_on_update_miss = yes|no

   Default: no (preserves existing behavior).

   When enabled: if .update() fails with no data found, .create() is attempted
   in that backend. This ensures that objects missing due to temporary backend
   outages are re-synchronized once the backend is available again.

   Added a new CLI command:
     sorcery show settings
   Displays global Sorcery settings, including the current value of
   update_or_create_on_update_miss.

   Updated tests to validate both flag enabled/disabled behavior.

Fixes: #1289

UserNote: Users relying on Sorcery multiple writable backends configurations
(e.g., astdb + realtime) may now enable update_or_create_on_update_miss = yes
in sorcery.conf to ensure missing objects are recreated after temporary backend
failures. Default behavior remains unchanged unless explicitly enabled.

(cherry picked from commit a6142af2a0)
2025-09-10 19:53:00 +00:00
Naveen Albert
d40da40783 sig_analog: Skip Caller ID spill if usecallerid=no.
If Caller ID is disabled for an FXS port, then we should not send any
Caller ID spill on the line, as we have no Caller ID information that
we can/should be sending.

Resolves: #1394
(cherry picked from commit 08a588e200)
2025-09-10 19:53:00 +00:00
Naveen Albert
72b406b7de chan_dahdi: Fix erroneously persistent dialmode.
It is possible to modify the dialmode setting in the chan_dahdi/sig_analog
private using the CHANNEL function, to modify it during calls. However,
it was not being reset between calls, meaning that if, for example, tone
dialing was disabled, it would never work again unless explicitly enabled.

This fixes the setting by pairing it with a "perm" version of the setting,
as a few other features have, so that it can be reset to the permanent
setting between calls. The documentation is also clarified to explain
the interaction of this setting and the digitdetect setting more clearly.

Resolves: #1378
(cherry picked from commit 1cfd9216b7)
2025-09-10 19:53:00 +00:00
George Joseph
907f5e6cea .github: Update Releaser to use SES email
(cherry picked from commit bda1d32001)
2025-09-10 19:53:00 +00:00
George Joseph
bd01ef85e6 chan_websocket: Allow additional URI parameters to be added to the outgoing URI.
* Added a new option to the WebSocket dial string to capture the additional
  URI parameters.
* Added a new API ast_uri_verify_encoded() that verifies that a string
  either doesn't need URI encoding or that it has already been encoded.
* Added a new API ast_websocket_client_add_uri_params() to add the params
  to the client websocket session.
* Added XML documentation that will show up with `core show application Dial`
  that shows how to use it.

Resolves: #1352

UserNote: A new WebSocket channel driver option `v` has been added to the
Dial application that allows you to specify additional URI parameters on
outgoing connections. Run `core show application Dial` from the Asterisk CLI
to see how to use it.

(cherry picked from commit de6aaa9623)
2025-09-10 19:53:00 +00:00
George Joseph
959f69be52 chan_websocket: Fix buffer overrun when processing TEXT websocket frames.
ast_websocket_read() receives data into a fixed 64K buffer then continually
reallocates a final buffer that, after all continuation frames have been
received, is the exact length of the data received and returns that to the
caller.  process_text_message() in chan_websocket was attempting to set a
NULL terminator on the received payload assuming the payload buffer it
received was the large 64K buffer.  The assumption was incorrect so when it
tried to set a NULL terminator on the payload, it could, depending on the
state of the heap at the time, cause heap corruption.

process_text_message() now allocates its own payload_len + 1 sized buffer,
copies the payload received from ast_websocket_read() into it then NULL
terminates it prevent the possibility of the overrun and corruption.

Resolves: #1384
(cherry picked from commit 076423aa18)
2025-09-10 19:53:00 +00:00
Naveen Albert
6f79bdb8af sig_analog: Fix SEGV due to calling strcmp on NULL.
Add an additional check to guard against the channel application being
NULL.

Resolves: #1380
(cherry picked from commit 45ee5cda1c)
2025-09-10 19:53:00 +00:00
Sven Kube
d8dd7e3c85 ARI: Add command to indicate progress to a channel
Adds an ARI command to send a progress indication to a channel.

DeveloperNote: A new ARI endpoint is available at `/channels/{channelId}/progress` to indicate progress to a channel.
(cherry picked from commit a0b36f8099)
2025-09-10 19:53:00 +00:00
Naveen Albert
7255de7cd7 dsp.c: Improve debug logging in tone_detect().
The debug logging during DSP processing has always been kind
of overwhelming and annoying to troubleshoot. Simplify and
improve the logging in a few ways to aid DSP debugging:

* If we had a DSP hit, don't also emit the previous debug message that
  was always logged. It is duplicated by the hit message, so this can
  reduce the number of debug messages during detection by 50%.
* Include the hit count and required number of hits in the message so
  on partial detections can be more easily troubleshot.
* Use debug level 9 for hits instead of 10, so we can focus on hits
  without all the noise from the per-frame debug message.
* 1-index the hit count in the debug messages. On the first hit, it
  currently logs '0', just as when we are not detecting anything,
  which can be confusing.

Resolves: #1375
(cherry picked from commit 286c104231)
2025-09-10 19:53:00 +00:00
Jose Lopes
5951994ca3 res_stasis_device_state: Fix delete ARI Devicestates after asterisk restart.
After an asterisk restart, the deletion of ARI Devicestates didn't
return error, but the devicestate was not deleted.
Found a typo on populate_cache function that created wrong cache for
device states.
This bug caused wrong assumption that devicestate didn't exist,
since it was not in cache, so deletion didn't returned error.

Fixes: #1327
(cherry picked from commit 4b9a373ec5)
2025-09-10 19:53:00 +00:00
Naveen Albert
636d74f577 app_chanspy: Add option to not automatically answer channel.
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.

(cherry picked from commit e182531373)
2025-09-10 19:53:00 +00:00
George Joseph
fad1d48aea xmldoc.c: Fix rendering of CLI output.
If you do a `core show application Dial`, you'll see it's kind of a mess.
Indents are wrong is some places, examples are printed in black which makes
them invisible on most terminals, and the lack of line breaks in some cases
makes it hard to follow.

* Fixed the rendering of examples so they are indented properly and changed
the color so they can be seen.
* There is now a line break before each option.
* Options are now printed on their own line with all option content indented
below them.

Example from Dial before fixes:
```
    Example: Dial 555-1212 on first available channel in group 1, searching
    from highest to lowest

    Example: Ringing FXS channel 4 with ring cadence 2

    Example: Dial 555-1212 on channel 3 and require answer confirmation

...

    O([mode]):
        mode - With <mode> either not specified or set to '1', the originator
        hanging up will cause the phone to ring back immediately.
 - With <mode> set to '2', when the operator flashes the trunk, it will ring
 their phone back.
Enables *operator services* mode.  This option only works when bridging a DAHDI
channel to another DAHDI channel only. If specified on non-DAHDI interfaces, it
will be ignored. When the destination answers (presumably an operator services
station), the originator no longer has control of their line. They may hang up,
but the switch will not release their line until the destination party (the
operator) hangs up.

    p: This option enables screening mode. This is basically Privacy mode
    without memory.
```

After:
```
    Example: Dial 555-1212 on first available channel in group 1, searching
    from highest to lowest

     same => n,Dial(DAHDI/g1/5551212)

    Example: Ringing FXS channel 4 with ring cadence 2

     same => n,Dial(DAHDI/4r2)

    Example: Dial 555-1212 on channel 3 and require answer confirmation

     same => n,Dial(DAHDI/3c/5551212)

...

    O([mode]):
        mode - With <mode> either not specified or set to '1', the originator
        hanging up will cause the phone to ring back immediately.
        With <mode> set to '2', when the operator flashes the trunk, it will
        ring their phone back.
        Enables *operator services* mode.  This option only works when bridging
        a DAHDI channel to another DAHDI channel only. If specified on
        non-DAHDI interfaces, it will be ignored. When the destination answers
        (presumably an operator services station), the originator no longer has
        control of their line. They may hang up, but the switch will not
        release their line until the destination party (the operator) hangs up.

    p:
        This option enables screening mode. This is basically Privacy mode
        without memory.
```

There are still things we can do to make this more readable but this is a
start.

(cherry picked from commit bd1e723eca)
2025-09-10 19:53:00 +00:00
Naveen Albert
e633f43fcb func_frame_drop: Add debug messages for dropped frames.
Add debug messages in scenarios where frames that are usually processed
are dropped or skipped.

Resolves: #1371
(cherry picked from commit 00b6ab22a0)
2025-09-10 19:53:00 +00:00
Naveen Albert
910f32dd3c test_res_prometheus: Fix compilation failure on Debian 13.
curl_easy_setopt expects long types, so be explicit.

Resolves: #1369
(cherry picked from commit d04f273955)
2025-09-10 19:53:00 +00:00
Naveen Albert
a46fca7643 func_frame_drop: Handle allocation failure properly.
Handle allocation failure and simplify the allocation using asprintf.

Resolves: #1366
(cherry picked from commit 40e6f2b12c)
2025-09-10 19:52:59 +00:00
Alexey Khabulyak
2d9a75c68e pbx_lua.c: segfault when pass null data to term_color function
This can be reproduced under certain curcomstences.
For example: call app.playback from lua with invalid data: app.playback({}).
pbx_lua.c will try to get data for this playback using lua_tostring function.
This function returs NULL for everything but strings and numbers.
Then, it calls term_color with NULL data.
term_color function can call(if we don't use vt100 compat term)
ast_copy_string with NULL inbuf which cause segfault. bt example:
ast_copy_string (size=8192, src=0x0, dst=0x7fe44b4be8b0)
at /usr/src/asterisk/asterisk-20.11.0/include/asterisk/strings.h:412

Resolves: https://github.com/asterisk/asterisk/issues/1363
(cherry picked from commit a321038cad)
2025-09-10 19:52:59 +00:00
Naveen Albert
67007cf6c0 bridge.c: Obey BRIDGE_NOANSWER variable to skip answering channel.
If the BRIDGE_NOANSWER variable is set on a channel, it is not supposed
to answer when another channel bridges to it using Bridge(), and this is
checked when ast_bridge_call* is called. However, another path exists
(bridge_exec -> ast_bridge_add_channel) where this variable was not
checked and channels would be answered. We now check the variable there.

Resolves: #401
Resolves: #1364
(cherry picked from commit 3ea3ec6f0a)
2025-09-10 19:52:59 +00:00
Ben Ford
3f203d137c res_rtp_asterisk: Don't send RTP before DTLS has negotiated.
There was no check in __rtp_sendto that prevented Asterisk from sending
RTP before DTLS had finished negotiating. This patch adds logic to do
so.

Fixes: #1260
(cherry picked from commit 5843d02541)
2025-09-10 19:52:59 +00:00
Alexey Khabulyak
5ab0c5508e app_dial.c: Moved channel lock to prevent deadlock
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
(cherry picked from commit 4b766d24d0)
2025-09-10 19:52:59 +00:00
Mike Bradeen
d06310242e res_pjsip_diversion: resolve race condition between Diversion header processing and redirect
Based on the firing order of the PJSIP call-backs on a redirect, it was possible for
the Diversion header to not be included in the outgoing 181 response to the UAC and
the INVITE to the UAS.

This change moves the Diversion header processing to an earlier PJSIP callback while also
preventing the corresponding update that can cause a duplicate 181 response when processing
the header at that time.

Resolves: #1349
(cherry picked from commit 8dce57f9ad)
2025-09-10 19:52:59 +00:00
Allan Nathanson
e20d0fc912 file.c: with "sounds_search_custom_dir = yes", search "custom" directory
With `sounds_search_custom_dir = yes`, we are supposed to search for sounds
in the `AST_DATA_DIR/sounds/custom` directory before searching the normal
directories.  Unfortunately, a recent change
(https://github.com/asterisk/asterisk/pull/1172) had a typo resulting in
the "custom" directory not being searched.  This change restores this
expected behavior.

Resolves: #1353
(cherry picked from commit 59d6d2addf)
2025-09-10 19:52:59 +00:00
Sperl Viktor
bcc01e11dc cel: Add STREAM_BEGIN, STREAM_END and DTMF event types.
Fixes: #1280

UserNote: Enabling the tracking of the
STREAM_BEGIN and the STREAM_END event
types in cel.conf will log media files and
music on hold played to each channel.
The STREAM_BEGIN event's extra field will
contain a JSON with the file details (path,
format and language), or the class name, in
case of music on hold is played. The DTMF
event's extra field will contain a JSON with
the digit and the duration in milliseconds.

(cherry picked from commit 0906282f25)
2025-09-10 19:52:59 +00:00
George Joseph
1730a6308b channelstorage_cpp_map_name_id.cc: Refactor iterators for thread-safety.
The fact that deleting an object from a map invalidates any iterator
that happens to currently point to that object was overlooked in the initial
implementation.  Unfortunately, there's no way to detect that an iterator
has been invalidated so the result was an occasional SEGV triggered by modules
like app_chanspy that opens an iterator and can keep it open for a long period
of time.  The new implementation doesn't keep the underlying C++ iterator
open across calls to ast_channel_iterator_next() and uses a read lock
on the map to ensure that, even for the few microseconds we use the
iterator, another thread can't delete a channel from under it.  Even with
this change, the iterators are still WAY faster than the ao2_legacy
storage driver.

Full details about the new implementation are located in the comments for
iterator_next() in channelstorage_cpp_map_name_id.cc.

Resolves: #1309
(cherry picked from commit 830dd4656c)
2025-09-10 19:52:59 +00:00
George Joseph
1ca0d2a4f3 res_srtp: Add menuselect options to enable AES_192, AES_256 and AES_GCM
UserNote: Options are now available in the menuselect "Resource Modules"
category that allow you to enable the AES_192, AES_256 and AES_GCM
cipher suites in res_srtp. Of course, libsrtp and OpenSSL must support
them but modern versions do.  Previously, the only way to enable them was
to set the CFLAGS environment variable when running ./configure.
The default setting is to disable them preserving existing behavior.

(cherry picked from commit 581e4a23a8)
2025-09-10 19:52:59 +00:00
zhou_jiajian
46e57a44de cdr: add CANCEL dispostion in CDR
In the original implementation, both CANCEL and NO ANSWER states were
consolidated under the NO ANSWER disposition. This patch introduces a
separate CANCEL disposition, with an optional configuration switch to
enable this new disposition.

Resolves: #1323

UserNote: A new CDR option "canceldispositionenabled" has been added
that when set to true, the NO ANSWER disposition will be split into
two dispositions: CANCEL and NO ANSWER. The default value is 'no'

(cherry picked from commit 9d4674d93d)
2025-09-10 19:52:59 +00:00
Naveen Albert
dea3072d0d func_curl: Allow auth methods to be set.
Currently the CURL function only supports Basic Authentication,
the default auth method in libcurl. Add an option that also
allows enabling digest authentication.

Resolves: #1332

UserNote: The httpauth field in CURLOPT now allows the authentication
methods to be set.

(cherry picked from commit 99b310a33f)
2025-09-10 19:52:59 +00:00
George Joseph
0b7eb1d747 options: Change ast_options from ast_flags to ast_flags64.
DeveloperNote: The 32-bit ast_options has no room left to accomodate new
options and so has been converted to an ast_flags64 structure. All internal
references to ast_options have been updated to use the 64-bit flag
manipulation macros.  External module references to the 32-bit ast_options
should continue to work on little-endian systems because the
least-significant bytes of a 64 bit integer will be in the same location as a
32-bit integer.  Because that's not the case on big-endian systems, we've
swapped the bytes in the flags manupulation macros on big-endian systems
so external modules should still work however you are encouraged to test.

(cherry picked from commit d1a1945967)
2025-09-10 19:52:59 +00:00
Alexei Gradinari
eca3e4aa84 res_config_odbc: Prevent Realtime fallback on record-not-found (SQL_NO_DATA)
This patch fixes an issue in the ODBC Realtime engine where Asterisk incorrectly
falls back to the next configured backend when the current one returns
SQL_NO_DATA (i.e., no record found).
This is a logical error and performance risk in multi-backend configurations.

Solution:
Introduced CONFIG_RT_NOT_FOUND ((void *)-1) as a special return marker.
ODBC Realtime backend now return CONFIG_RT_NOT_FOUND when no data is found.
Core engine stops iterating on this marker, avoiding unnecessary fallback.

Notes:
Other Realtime backends (PostgreSQL, LDAP, etc.) can be updated similarly.
This patch only covers ODBC.

Fixes: #1305
(cherry picked from commit 9e3ea1c8ac)
2025-09-10 19:52:59 +00:00
Sven Kube
485b9a8971 resource_channels.c: Don't call ast_channel_get_by_name on empty optional arguments
`ast_ari_channels_create` and `ast_ari_channels_dial` called the
`ast_channel_get_by_name` function with optional arguments. Since
8f1982c4d6, this function logs an error for empty channel names.
This commit adds checks for empty optional arguments that are used
to call `ast_channel_get_by_name` to prevent these error logs.

(cherry picked from commit 0ba07ac7c3)
2025-09-10 19:52:59 +00:00
Naveen Albert
701c42f0ea app_agent_pool: Remove documentation for removed option.
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
(cherry picked from commit 74e002277c)
2025-09-10 19:52:59 +00:00
Tinet-mucw
7b20381626 pbx.c: When the AST_SOFTHANGUP_ASYNCGOTO flag is set, pbx_extension_helper should return directly.
Under certain circumstances the context/extens/prio are set in the ast_async_goto, for example action Redirect.
In the situation that action Redirect is broken by pbx_extension_helper this info is changed.
This will cause the current dialplan location to be executed twice.
In other words, the Redirect action does not take effect.

Resolves: #1315
(cherry picked from commit 4442e2dce1)
2025-09-10 19:52:59 +00:00
Sperl Viktor
ca26d7720a res_agi: Increase AGI command buffer size from 2K to 8K
Fixes: #1317
(cherry picked from commit 3403da9c01)
2025-09-10 19:52:59 +00:00
Naveen Albert
d9a568ed53 ast_tls_cert: Make certificate validity configurable.
Currently, the ast_tls_cert script is hardcoded to produce certificates
with a validity of 365 days, which is not generally desirable for self-
signed certificates. Make this parameter configurable.

Resolves: #1307
(cherry picked from commit 9c55e72b67)
2025-09-10 19:52:59 +00:00
George Joseph
629a0bbe6d cdr.c: Set tenantid from party_a->base instead of chan->base.
The CDR tenantid was being set in cdr_object_alloc from the channel->base
snapshot.  Since this happens at channel creation before the dialplan is even
reached, calls to `CHANNEL(tenantid)=<something>` in the dialplan were being
ignored.  Instead we now take tenantid from party_a when
cdr_object_create_public_records() is called which is after the call has
ended and all channel snapshots rebuilt.  This is exactly how accountcode
and amaflags, which can also be set in tha dialplpan, are handled.

Resolves: #1259
(cherry picked from commit a4aab9d39f)
2025-09-10 19:52:59 +00:00
George Joseph
722bb9b616 .github: Reduce number of inputs to Releaser to 10.
The max number of inputs supported by GitHub is 10 so
is_security and is_hotfix were factored into a single choice
entry.

(cherry picked from commit f459a57394)
2025-09-10 19:52:59 +00:00
George Joseph
8662f91415 .github: Add skip-cherry-pick and skip-test-builds to Releaser.
(cherry picked from commit cc74f2f28c)
2025-09-10 19:52:59 +00:00
George Joseph
73723576dd app_mixmonitor: Update the documentation concerning the "D" option.
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
(cherry picked from commit 8a602dbfee)
2025-09-10 19:52:59 +00:00
Naveen Albert
cd4d676409 sig_analog: Properly handle STP, ST2P, and ST3P for fgccamamf.
Previously, we were only using # (ST) as a terminator, and not handling
A (STP), B (ST2P), or C (ST3P), which erroneously led to it being
treated as part of the dialed number. Parse any of these as the start
digit.

Resolves: #1301
(cherry picked from commit a45e6d6fd8)
2025-09-10 19:52:59 +00:00
kodokaii
e3f392e084 chan_websocket: Reset frame_queue_length to 0 after FLUSH_MEDIA
In the WebSocket channel driver, the FLUSH_MEDIA command clears all frames from
the queue but does not reset the frame_queue_length counter.

As a result, the driver incorrectly thinks the queue is full after flushing,
which prevents new multimedia frames from being sent, especially after multiple
flush commands.

This fix sets frame_queue_length to 0 after flushing, ensuring the queue state
is consistent with its actual content.

Fixes: #1304
(cherry picked from commit 38d0909669)
2025-09-10 19:52:59 +00:00
Martin Tomec
c173bd57ce chan_pjsip.c: Change SSRC after media source change
When the RTP media source changes, such as after a blind transfer, the new source introduces a discontinuous timestamp. According to RFC 3550, Section 5.1, an RTP stream's timestamp for a given SSRC must increment monotonically and linearly.
To comply with the standard and avoid a large timestamp jump on the existing SSRC, a new SSRC is generated for the new media stream.
This change resolves known interoperability issues with certain SBCs (like Sonus/Ribbon) that stop forwarding media when they detect such a timestamp violation. This code uses the existing implementation from chan_sip.

Resolves: #927
(cherry picked from commit 5946bc6363)
2025-09-10 19:52:59 +00:00
George Joseph
a681fab7b5 Media over Websocket Channel Driver
* Created chan_websocket which can exchange media over both inbound and
outbound websockets which the driver will frame and time.
See http://s.asterisk.net/mow for more information.

* res_http_websocket: Made defines for max message size public and converted
a few nuisance verbose messages to debugs.

* main/channel.c: Changed an obsolete nuisance error to a debug.

* ARI channels: Updated externalMedia to include chan_websocket as a supported
transport.

UserNote: A new channel driver "chan_websocket" is now available. It can
exchange media over both inbound and outbound websockets and will both frame
and re-time the media it receives.
See http://s.asterisk.net/mow for more information.

UserNote: The ARI channels/externalMedia API now includes support for the
WebSocket transport provided by chan_websocket.

(cherry picked from commit 07fd3af897)
2025-09-10 19:52:59 +00:00
Stanislav Abramenkov
82714c0fd8 bundled_pjproject: Avoid deadlock between transport and transaction
Backport patch from upstream
* Avoid deadlock between transport and transaction
https://github.com/pjsip/pjproject/commit/edde06f261ac

Issue described in
https://github.com/pjsip/pjproject/issues/4442

(cherry picked from commit 877e5ef770)
2025-09-10 19:52:59 +00:00
mkmer
bd462f0775 utils.h: Add rounding to float conversion to int.
Quote from an audio engineer NR9V:
There is a minor issue of a small amount of crossover distortion though as a result of `ast_slinear_saturated_multiply_float()` not rounding the float. This could result in some quiet but potentially audible distortion artifacts in lower volume parts of the signal. If you have for example a sign wave function with a max amplitude of just a few samples, all samples between -1 and 1 will be truncated to zero, resulting in the waveform no longer being a sine wave and in harmonic distortion.

Resolves: #1176
(cherry picked from commit 55f4294e82)
2025-09-10 19:52:59 +00:00
Tinet-mucw
57340d50bf pbx.c: when set flag AST_SOFTHANGUP_ASYNCGOTO, ast_explicit_goto should return -1.
Under certain circumstances the context/extens/prio are set in the ast_async_goto, for example action Redirect.
In the situation that action Redirect is broken by GotoIf this info is changed.
that will causes confusion in dialplan execution.

Resolves: #1273
(cherry picked from commit 88f653c12d)
2025-09-10 19:52:59 +00:00
Sean Bright
cb434eb1be res_musiconhold.c: Ensure we're always locked around music state access.
(cherry picked from commit 7feb676409)
2025-09-10 19:52:59 +00:00