Compare commits

...

176 Commits

Author SHA1 Message Date
Asterisk Development Team 2e7b22a503 Update for 21.2.0 2024-03-18 13:25:20 +00:00
Asterisk Development Team 4a91ec7fc4 Update for 21.2.0-rc2 2024-03-11 17:17:46 +00:00
George Joseph aa23bd9bd7 res_pjsip_stir_shaken.c: Add checks for missing parameters
* Added checks for missing session, session->channel and rdata
  in stir_shaken_incoming_request.

* Added checks for missing session, session->channel and tdata
  in stir_shaken_outgoing_request.

Resolves: #645
2024-03-11 11:06:58 -06:00
Asterisk Development Team 211bfe1220 Update for 21.2.0-rc1 2024-03-07 14:18:52 +00:00
Naveen Albert 6e5a6c176d app_dial: Add dial time for progress/ringing.
Add a timeout option to control the amount of time
to wait if no early media is received before giving
up. This allows aborting early if the destination
is not being responsive.

Resolves: #588

UserNote: The timeout argument to Dial now allows
specifying the maximum amount of time to dial if
early media is not received.

(cherry picked from commit bdf9327a33)
2024-03-07 14:18:41 +00:00
Naveen Albert ae2fa8c5f0 app_voicemail: Properly reinitialize config after unit tests.
Most app_voicemail unit tests were not properly cleaning up
after themselves after running. This led to test mailboxes
lingering around in the system. It also meant that if any
unit tests in app_voicemail that create mailboxes were executed
and the module was not unloaded/loaded again prior to running
the test_voicemail_vm_info unit test, Asterisk would segfault
due to an attempt to copy a NULL string.

The load_config test did actually have logic to reinitialize
the config after the test. However, this did not work in practice
since load_config() would not reload the config since voicemail.conf
had not changed during the test; thus, additional logic has been
added to ensure that voicemail.conf is truly reloaded, after any
unit tests which modify the users list.

This prevents the SEGV due to invalid mailboxes lingering around,
and also ensures that the system state is restored to what it was
prior to the tests running.

Resolves: #629
(cherry picked from commit 2ac9c8fb5c)
2024-03-07 14:18:41 +00:00
Shaaah d43d250e14 app_queue.c : fix "queue add member" usage string
Fixing bracket placement in the "queue add member" cli usage string.

(cherry picked from commit 6f99268f79)
2024-03-07 14:18:41 +00:00
Naveen Albert 6af036a855 app_voicemail: Allow preventing mark messages as urgent.
This adds an option to allow preventing callers from leaving
messages marked as 'urgent'.

Resolves: #619

UserNote: The leaveurgent mailbox option can now be used to
control whether callers may leave messages marked as 'Urgent'.

(cherry picked from commit 190b6eafb3)
2024-03-07 14:18:41 +00:00
Sean Bright 0aa4dbcae7 res_pjsip: Use consistent type for boolean columns.
This migrates the relevant schema objects from the `('yes', 'no')`
definition to the `('0', '1', 'off', 'on', 'false', 'true', 'yes', 'no')`
one.

Fixes #617

(cherry picked from commit 1a94502551)
2024-03-07 14:18:41 +00:00
George Joseph 0fe641503a .github: Remove timeout-minutes from gatetests
(cherry picked from commit 94176ecb88)
2024-03-07 14:18:41 +00:00
George Joseph c085753c2e attestation_config.c: Use ast_free instead of ast_std_free
In as_check_common_config, we were calling ast_std_free on
raw_key but raw_key was allocated with ast_malloc so it
should be freed with ast_free.

Resolves: #636
(cherry picked from commit 1b94c90524)
2024-03-07 14:18:41 +00:00
George Joseph 82df7454dc Makefile: Add stir_shaken/cache to directories created on install
The default location for the stir_shaken cache is
/var/lib/asterisk/keys/stir_shaken/cache but we were only creating
/var/lib/asterisk/keys/stir_shaken on istall.  We now create
the cache sub-directory.

Resolves: #634
(cherry picked from commit 215424aa76)
2024-03-07 14:18:41 +00:00
George Joseph ddc6cc5465 .github: Pass only single GATETEST_COMMAND to AsteriskGateComposite
(cherry picked from commit d58ca20247)
2024-03-07 14:18:41 +00:00
George Joseph d7e262226f Stir/Shaken Refactor
Why do we need a refactor?

The original stir/shaken implementation was started over 3 years ago
when little was understood about practical implementation.  The
result was an implementation that wouldn't actually interoperate
with any other stir-shaken implementations.

There were also a number of stir-shaken features and RFC
requirements that were never implemented such as TNAuthList
certificate validation, sending Reason headers in SIP responses
when verification failed but we wished to continue the call, and
the ability to send Media Key(mky) grants in the Identity header
when the call involved DTLS.

Finally, there were some performance concerns around outgoing
calls and selection of the correct certificate and private key.
The configuration was keyed by an arbitrary name which meant that
for every outgoing call, we had to scan the entire list of
configured TNs to find the correct cert to use.  With only a few
TNs configured, this wasn't an issue but if you have a thousand,
it could be.

What's changed?

* Configuration objects have been refactored to be clearer about
  their uses and to fix issues.
    * The "general" object was renamed to "verification" since it
      contains parameters specific to the incoming verification
      process.  It also never handled ca_path and crl_path
      correctly.
    * A new "attestation" object was added that controls the
      outgoing attestation process.  It sets default certificates,
      keys, etc.
    * The "certificate" object was renamed to "tn" and had it's key
      change to telephone number since outgoing call attestation
      needs to look up certificates by telephone number.
    * The "profile" object had more parameters added to it that can
      override default parameters specified in the "attestation"
      and "verification" objects.
    * The "store" object was removed altogther as it was never
      implemented.

* We now use libjwt to create outgoing Identity headers and to
  parse and validate signatures on incoming Identiy headers.  Our
  previous custom implementation was much of the source of the
  interoperability issues.

* General code cleanup and refactor.
    * Moved things to better places.
    * Separated some of the complex functions to smaller ones.
    * Using context objects rather than passing tons of parameters
      in function calls.
    * Removed some complexity and unneeded encapsuation from the
      config objects.

Resolves: #351
Resolves: #46

UserNote: Asterisk's stir-shaken feature has been refactored to
correct interoperability, RFC compliance, and performance issues.
See https://docs.asterisk.org/Deployment/STIR-SHAKEN for more
information.

UpgradeNote: The stir-shaken refactor is a breaking change but since
it's not working now we don't think it matters. The
stir_shaken.conf file has changed significantly which means that
existing ones WILL need to be changed.  The stir_shaken.conf.sample
file in configs/samples/ has quite a bit more information.  This is
also an ABI breaking change since some of the existing objects
needed to be changed or removed, and new ones added.  Additionally,
if res_stir_shaken is enabled in menuselect, you'll need to either
have the development package for libjwt v1.15.3 installed or use
the --with-libjwt-bundled option with ./configure.

(cherry picked from commit 2e0d837e01)
2024-03-07 14:18:41 +00:00
Sebastian Jennen 91df8b031c translate.c: implement new direct comp table mode
The new mode lists for each codec translation the actual real cost in cpu microseconds per second translated audio.
This allows to compare the real cpu usage of translations and helps in evaluation of codec implementation changes regarding performance (regression testing).

- add new table mode
- hide the 999999 comp values, as these only indicate an issue with transcoding
- hide the 0 values, as these also do not contain any information (only indicate a multistep transcoding)

Resolves: #601
(cherry picked from commit 3c72bc8a7b)
2024-03-07 14:18:41 +00:00
Shyju Kanaprath c33cdfd49e README.md: Removed outdated link
Removed outdated link http://www.quicknet.net from README.md

cherry-pick-to: 18
cherry-pick-to: 20
cherry-pick-to: 21
(cherry picked from commit 07055dce94)
2024-03-07 14:18:41 +00:00
Sean Bright 419feb11bd strings.h: Ensure ast_str_buffer(…) returns a 0 terminated string.
If a dynamic string is created with an initial length of 0,
`ast_str_buffer(…)` will return an invalid pointer.

This was a secondary discovery when fixing #65.

(cherry picked from commit 31ab82840b)
2024-03-07 14:18:41 +00:00
George Joseph 1daec58db8 .github: Add force_cherry_pick option to Releaser
(cherry picked from commit 2d1a4bab25)
2024-03-07 14:18:41 +00:00
George Joseph 53931fac06 .github: Remove start_version from Releaser
(cherry picked from commit 4077b4b340)
2024-03-07 14:18:41 +00:00
romryz e95611216f res_rtp_asterisk.c: Correct coefficient in MOS calculation.
Media Experience Score relies on incorrect pseudo_mos variable
calculation. According to forming an opinion section of the
documentation, calculation relies on ITU-T G.107 standard:

    https://docs.asterisk.org/Deployment/Media-Experience-Score/#forming-an-opinion

ITU-T G.107 Annex B suggests to calculate MOS with a coefficient
"seven times ten to the power of negative six", 7 * 10^(-6). which
would mean 6 digits after the decimal point. Current implementation
has 7 digits after the decimal point, which downrates the calls.

Fixes: #597
(cherry picked from commit a7a03bc294)
2024-03-07 14:18:41 +00:00
Naveen Albert 31cb02dc01 dsp.c: Fix and improve potentially inaccurate log message.
If ast_dsp_process is called with a codec besides slin, ulaw,
or alaw, a warning is logged that in-band DTMF is not supported,
but this message is not always appropriate or correct, because
ast_dsp_process is much more generic than just DTMF detection.

This logs a more generic message in those cases, and also improves
codec-mismatch logging throughout dsp.c by ensuring incompatible
codecs are printed out.

Resolves: #595
(cherry picked from commit 6ddcdfce1f)
2024-03-07 14:18:41 +00:00
George Joseph 3ca2bb5e84 pjsip show channelstats: Prevent possible segfault when faxing
Under rare circumstances, it's possible for the original audio
session in the active_media_state default_session to be corrupted
instead of removed when switching to the t38/image media session
during fax negotiation.  This can cause a segfault when a "pjsip
show channelstats" attempts to print that audio media session's
rtp statistics.  In these cases, the active_media_state
topology is correctly showing only a single t38/image stream
so we now check that there's an audio stream in the topology
before attempting to use the audio media session to get the rtp
statistics.

Resolves: #592
(cherry picked from commit adcfbcd50e)
2024-03-07 14:18:41 +00:00
George Joseph f72d97b7b1 Reduce startup/shutdown verbose logging
When started with a verbose level of 3, asterisk can emit over 1500
verbose message that serve no real purpose other than to fill up
logs. When asterisk shuts down, it emits another 1100 that are of
even less use. Since the testsuite runs asterisk with a verbose
level of 3, and asterisk starts and stops for every one of the 700+
tests, the number of log messages is staggering.  Besides taking up
resources, it also makes it hard to debug failing tests.

This commit changes the log level for those verbose messages to 5
instead of 3 which reduces the number of log messages to only a
handful. Of course, NOTICE, WARNING and ERROR message are
unaffected.

There's also one other minor change...
ast_context_remove_extension_callerid2() logs a DEBUG message
instead of an ERROR if the extension you're deleting doesn't exist.
The pjsip_config_wizard calls that function to clean up the config
and has been triggering that annoying error message for years.

Resolves: #582
(cherry picked from commit a5ae546b88)
2024-03-07 14:18:41 +00:00
Naveen Albert 52a80f974b configure: Rerun bootstrap on modern platform.
The last time configure was run, it was run on a system that
did not enable -std=gnu11 by default, which meant that the
restrict qualifier would not be recognized on certain platforms.
This regenerates the configure files from running bootstrap.sh,
so that these should be recognized on all supported platforms.

Resolves: #586
(cherry picked from commit d0d09ef010)
2024-03-07 14:18:40 +00:00
Ben Ford f7d37df114 Upgrade bundled pjproject to 2.14.
Fixes: #406

UserNote: Bundled pjproject has been upgraded to 2.14. For more
information on what all is included in this change, check out the
pjproject Github page: https://github.com/pjsip/pjproject/releases

(cherry picked from commit 6efa51f512)
2024-03-07 14:18:40 +00:00
Flole998 096243745c res_pjsip_outbound_registration.c: Add User-Agent header override
This introduces a setting for outbound registrations to override the
global User-Agent header setting.

Resolves: #515

UserNote: PJSIP outbound registrations now support a per-registration
User-Agent header

(cherry picked from commit c7fc6ae362)
2024-03-07 14:18:40 +00:00
cmaj 1377ac9e89 app_speech_utils.c: Allow partial speech results.
Adds 'p' option to SpeechBackground() application.
With this option, when the app timeout is reached,
whatever the backend speech engine collected will
be returned as if it were the final, full result.
(This works for engines that make partial results.)

Resolves: #572

UserNote: The SpeechBackground dialplan application now supports a 'p'
option that will return partial results from speech engines that
provide them when a timeout occurs.

(cherry picked from commit c863e0d77d)
2024-03-07 14:18:40 +00:00
Joshua C. Colp 731fddd5d0 utils: Make behavior of ast_strsep* match strsep.
Given the scenario of passing an empty string to the
ast_strsep functions the functions would return NULL
instead of an empty string. This is counter to how
strsep itself works.

This change alters the behavior of the functions to
match that of strsep.

Fixes: #565
(cherry picked from commit 8ce69eda14)
2024-03-07 14:18:40 +00:00
Mike Bradeen b510d681a1 app_chanspy: Add 'D' option for dual-channel audio
Adds the 'D' option to app chanspy that causes the input and output
frames of the spied channel to be interleaved in the spy output frame.
This allows the input and output of the spied channel to be decoded
separately by the receiver.

If the 'o' option is also set, the 'D' option is ignored as the
audio being spied is inherently one direction.

Fixes: #569

UserNote: The ChanSpy application now accepts the 'D' option which
will interleave the spied audio within the outgoing frames. The
purpose of this is to allow the audio to be read as a Dual channel
stream with separate incoming and outgoing audio. Setting both the
'o' option and the 'D' option and results in the 'D' option being
ignored.

(cherry picked from commit 69fe814813)
2024-03-07 14:18:40 +00:00
George Joseph 5c12fda94e .github: Update github-script to v7 and fix a rest bug
Need to update the github-script to v7 to squash deprecation
warnings.

Also fixed the API name for github.rest.pulls.requestReviewers.

(cherry picked from commit 9baf49497e)
2024-03-07 14:18:40 +00:00
Naveen Albert 5e0f1bb5d2 app_if: Fix next priority calculation.
Commit fa3922a4d2 fixed
a branching issue but "overshoots" when calculating
the next priority. This fixes that; accompanying
test suite tests have also been extended.

Resolves: #560
(cherry picked from commit ed39406838)
2024-03-07 14:18:40 +00:00
Sean Bright 36184820bd res_pjsip_t38.c: Permit IPv6 SDP connection addresses.
The existing code prevented IPv6 addresses from being properly parsed.

Fixes #558

(cherry picked from commit 841cd1480c)
2024-03-07 14:18:40 +00:00
Brad Smith 14f84cc202 BuildSystem: Bump autotools versions on OpenBSD.
Bump up to the more commonly used and modern versions of
autoconf and automake.

(cherry picked from commit 9deb4c679e)
2024-03-07 14:18:40 +00:00
Brad Smith 30d05081d7 main/utils: Simplify the FreeBSD ast_get_tid() handling
FreeBSD has had kernel threads for 20+ years.

(cherry picked from commit ec2c10689f)
2024-03-07 14:18:40 +00:00
Sean Bright 2ec0b83e5b res_pjsip_session.c: Correctly format SDP connection addresses.
Resolves a regression identified by @justinludwig involving the
rendering of IPv6 addresses in outgoing SDP.

Also updates `media_address` on PJSIP endpoints so that if we are able
to parse the configured value as an IP we store it in a format that we
can directly use later. Based on my reading of the code it appeared
that one could configure `media_address` as:

```
[foo]
type = endpoint
...
media_address = [2001:db8::]
```

And that value would be blindly copied into the outgoing SDP without
regard to its format.

Fixes #541

(cherry picked from commit 9f20b4659f)
2024-03-07 14:18:40 +00:00
Sean Bright 3b74538fcf rtp_engine.c: Correct sample rate typo for L16/44100.
Fixes #555

(cherry picked from commit 671b47cfda)
2024-03-07 14:18:40 +00:00
Naveen Albert dd90d4536f manager.c: Fix erroneous reloads in UpdateConfig.
Currently, a reload will always occur if the
Reload header is provided for the UpdateConfig
action. However, we should not be doing a reload
if the header value has a falsy value, per the
documentation, so this makes the reload behavior
consistent with the existing documentation.

Resolves: #551
(cherry picked from commit 874ee6e9aa)
2024-03-07 14:18:40 +00:00
Naveen Albert e65c8cede5 res_calendar_icalendar: Print iCalendar error on parsing failure.
If libical fails to parse a calendar, print the error message it provdes.

Resolves: #492
(cherry picked from commit ef891529fa)
2024-03-07 14:18:40 +00:00
Sean Bright dbcd737302 app_confbridge: Don't emit warnings on valid configurations.
The numeric bridge profile options `internal_sample_rate` and
`maximum_sample_rate` are documented to accept the special values
`auto` and `none`, respectively. While these values currently work,
they also emit warnings when used which could be confusing for users.

In passing, also ensure that we only accept the documented range of
sample rate values between 8000 and 192000.

Fixes #546

(cherry picked from commit 03ad690276)
2024-03-07 14:18:40 +00:00
Mike Bradeen ab1a9fa7d1 app_voicemail_odbc: remove macrocontext from voicemail_messages table
When app_macro was deprecated, the macrocontext column was removed from
the INSERT statement but the binds were not renumbered. This broke the
insert.

This change removes the macrocontext column via alembic and re-numbers
the existing columns in the INSERT.

Fixes: #527

UserNote: The fix requires removing the macrocontext column from the
voicemail_messages table in the voicemail database via alembic upgrade.

UpgradeNote: The fix requires that the voicemail database be upgraded via
alembic. Upgrading to the latest voicemail database via alembic will
remove the macrocontext column from the voicemail_messages table.

(cherry picked from commit a22db8fd60)
2024-03-07 14:18:40 +00:00
Naveen Albert 76d33df366 chan_dahdi: Allow MWI to be manually toggled on channels.
This adds a CLI command to manually toggle the MWI status
of a channel, useful for troubleshooting or resetting
MWI devices, similar to the capabilities offered with
SIP messaging to manually control MWI status.

UserNote: The 'dahdi set mwi' now allows MWI on channels
to be manually toggled if needed for troubleshooting.

Resolves: #440
(cherry picked from commit 4b908f364d)
2024-03-07 14:18:40 +00:00
PeterHolik 727a4cceec chan_rtp.c: MulticastRTP missing refcount without codec option
Fixes: #529
(cherry picked from commit 3b46872a8f)
2024-03-07 14:18:40 +00:00
PeterHolik 8a999b6706 chan_rtp.c: Change MulticastRTP nameing to avoid memory leak
Fixes: asterisk#536
(cherry picked from commit 6fe045fd64)
2024-03-07 14:18:40 +00:00
Naveen Albert 947ba375d7 func_frame_trace: Add CLI command to dump frame queue.
This adds a simple CLI command that can be used for
analyzing all frames currently queued to a channel.

A couple log messages are also adjusted to be more
useful in tracing bridging problems.

Resolves: #533
(cherry picked from commit 67088b256d)
2024-03-07 14:18:40 +00:00
Asterisk Development Team 2dccaa4830 Update for 21.1.0 2024-01-25 16:23:00 +00:00
Asterisk Development Team 2310df0ff6 Update for 21.1.0-rc2 2024-01-18 16:48:17 +00:00
Naveen Albert e735ab8cfb logger: Fix linking regression.
Commit 008731b0a4
caused a regression by resulting in logger.xml
being compiled and linked into the asterisk
binary in lieu of logger.c on certain platforms
if Asterisk was compiled in dev mode.

To fix this, we ensure the file has a unique
name without the extension. Most existing .xml
files have been named differently from any
.c files in the same directory or did not
pose this issue.

channels/pjsip/dialplan_functions.xml does not
pose this issue but is also being renamed
to adhere to this policy.

Resolves: #539
2024-01-17 14:55:27 -07:00
Asterisk Development Team 6b8dd72f50 Update for 21.1.0-rc1 2024-01-12 18:32:27 +00:00
George Joseph 077a1b171c Revert "core & res_pjsip: Improve topology change handling."
This reverts commit 315eb551db.

Over the past year, we've had several reports of "topology storms"
occurring where 2 external facing channels connected by one or more
local channels and bridges will get themselves in a state where
they continually send each other topology change requests.  This
usually manifests itself in no-audio calls and a flood of
"Exceptionally long queue length" messages.  It appears that this
commit is the cause so we're reverting it for now until we can
determine a more appropriate solution.

Resolves: #530
(cherry picked from commit c31cd32b82)
2024-01-12 18:32:14 +00:00
Naveen Albert 625826afd4 menuselect: Use more specific error message.
Instead of using the same error message for
missing dependencies and conflicts, be specific
about what actually went wrong.

Resolves: #520
(cherry picked from commit 7683259f37)
2024-01-12 18:32:14 +00:00
Maximilian Fridrich b7701ba973 res_pjsip_nat: Fix potential use of uninitialized transport details
The ast_sip_request_transport_details must be zero initialized,
otherwise this could lead to a SEGV.

Resolves: #509
(cherry picked from commit 81188ada5f)
2024-01-12 18:32:13 +00:00
Naveen Albert c148203225 app_if: Fix faulty EndIf branching.
This fixes faulty branching logic for the
EndIf application. Instead of computing
the next priority, which should be done
for false conditionals or ExitIf, we should
simply advance to the next priority.

Resolves: #341
(cherry picked from commit 1bf4493371)
2024-01-12 18:32:13 +00:00
Naveen Albert ba4a8de400 manager.c: Fix regression due to using wrong free function.
Commit 424be34563 introduced
a regression by calling ast_free on memory allocated by
realpath. This causes Asterisk to abort when executing this
function. Since the memory is allocated by glibc, it should
be freed using ast_std_free.

Resolves: #513
(cherry picked from commit bb364fc61f)
2024-01-12 18:32:13 +00:00
George Joseph c0843b907a doc: Remove obsolete CHANGES-staging and UPGRADE-staging directories
These should have been deleted after the release of 21.0.0
but were missed.

(cherry picked from commit df958a7d63)
2024-01-12 18:32:13 +00:00
Naveen Albert ce29be5536 config_options.c: Fix truncation of option descriptions.
This increases the format width of option descriptions
to avoid needless truncation for longer descriptions.

Resolves: #428
(cherry picked from commit d20c3e2f6f)
2024-01-12 18:32:13 +00:00
Naveen Albert 6c33bf874d manager.c: Improve clarity of "manager show connected".
Improve the "manager show connected" CLI command
to clarify that the last two columns are permissions
related, not counts, and use sufficient widths
to consistently display these values.

ASTERISK-30143 #close
Resolves: #482

(cherry picked from commit 09bd80c627)
2024-01-12 18:32:13 +00:00
Sean Bright d5fc671ae4 make_xml_documentation: Really collect LOCAL_MOD_SUBDIRS documentation.
Although `make_xml_documentation`'s `print_dependencies` command was
corrected by the previous fix (#461) for #142, the `create_xml` was
not properly handling `LOCAL_MOD_SUBDIRS` XML documentation.

(cherry picked from commit e001a1b6d3)
2024-01-12 18:32:13 +00:00
Naveen Albert f485d3cc8b general: Fix broken links.
This fixes a number of broken links throughout the
tree, mostly caused by wiki.asterisk.org being replaced
with docs.asterisk.org, which should eliminate the
need for sporadic fixes as in f28047db36.

Resolves: #430
(cherry picked from commit 3bb34477d4)
2024-01-12 18:32:13 +00:00
George Joseph 0fd8f9ca88 MergeApproved.yml: Remove unneeded concurrency
The concurrency parameter on the MergeAndCherryPick job has
been rmeoved.  It was a hold-over from earlier days.

(cherry picked from commit 751f8649fd)
2024-01-12 18:32:13 +00:00
Maximilian Fridrich b3cff31e1a app_dial: Add option "j" to preserve initial stream topology of caller
Resolves: #462

UserNote: The option "j" is now available for the Dial application which
uses the initial stream topology of the caller to create the outgoing
channels.

(cherry picked from commit 366dc1e99f)
2024-01-12 18:32:13 +00:00
Sean Bright 0f5d624740 pbx_config.c: Don't crash when unloading module.
`pbx_config` subscribes to manager events to capture the `FullyBooted`
event but fails to unsubscribe if the module is loaded after that
event fires. If the module is unloaded, a crash occurs the next time a
manager event is raised.

We now unsubscribe when the module is unloaded if we haven't already
unsubscribed.

Fixes #470

(cherry picked from commit 16a42b2aec)
2024-01-12 18:32:13 +00:00
George Joseph b10a8aa212 ast_coredumper: Increase reliability
Instead of searching for the asterisk binary and the modules in the
filesystem, we now get their locations, along with libdir, from
the coredump itself...

For the binary, we can use `gdb -c <coredump> ... "info proc exe"`.
gdb can print this even without having the executable and symbols.

Once we have the binary, we can get the location of the modules with
`gdb ... "print ast_config_AST_MODULE_DIR`

If there was no result then either it's not an asterisk coredump
or there were no symbols loaded.  Either way, it's not usable.

For libdir, we now run "strings" on the note0 section of the
coredump (which has the shared library -> memory address xref) and
search for "libasteriskssl|libasteriskpj", then take the dirname.

Since we're now getting everything from the coredump, it has to be
correct as long as we're not crossing namespace boundaries like
running asterisk in a docker container but trying to run
ast_coredumper from the host using a shared file system (which you
shouldn't be doing).

There is still a case for using --asterisk-bin and/or --libdir: If
you've updated asterisk since the coredump was taken, the binary,
libraries and modules won't match the coredump which will render it
useless.  If you can restore or rebuild the original files that
match the coredump and place them in a temporary directory, you can
use --asterisk-bin, --libdir, and a new --moddir option to point to
them and they'll be correctly captured in a tarball created
with --tarball-coredumps.  If you also use --tarball-config, you can
use a new --etcdir option to point to what normally would be the
/etc/asterisk directory.

Also addressed many "shellcheck" findings.

Resolves: #445
(cherry picked from commit aec2453688)
2024-01-12 18:32:13 +00:00
Sean Bright b9a9e1e742 logger.c: Move LOG_GROUP documentation to dedicated XML file.
The `get_documentation` awk script will only extract the first
DOCUMENTATION block that it finds in a given file. This is by design
(9bc2127) to prevent AMI event documentation from being pulled in to
the core.xml documentation file.

Because of this, the `LOG_GROUP` documentation added in 89709e2 was
not being properly extracted and was missing fom the resulting XML
documentation file. This commit moves the `LOG_GROUP` documentation to
a separate `logger.xml` file.

(cherry picked from commit 1d05e34d98)
2024-01-12 18:32:13 +00:00
Matthew Fredrickson dd79040125 res_odbc.c: Allow concurrent access to request odbc connections
There are valid scenarios where res_odbc's connection pool might have some dead
or stuck connections while others are healthy (imagine network
elements/firewalls/routers silently timing out connections to a single DB and a
single IP address, or a heterogeneous connection pool connected to potentially
multiple IPs/instances of a replicated DB using a DNS front end for load
balancing and one replica fails).

In order to time out those unhealthy connections without blocking access to
other parts of Asterisk that may attempt access to the connection pool, it would
be beneficial to not lock/block access around the entire pool in
_ast_odbc_request_obj2 while doing potentially blocking operations on connection
pool objects such as the connection_dead() test, odbc_obj_connect(), or by
dereferencing a struct odbc_obj for the last time and triggering a
odbc_obj_disconnect().

This would facilitate much quicker and concurrent timeout of dead connections
via the connection_dead() test, which could block potentially for a long period
of time depending on odbc.ini or other odbc connector specific timeout settings.

This also would make rapid failover (in the clustered DB scenario) much quicker.

This patch changes the locking in _ast_odbc_request_obj2() to not lock around
odbc_obj_connect(), _disconnect(), and connection_dead(), while continuing to
lock around truly shared, non-immutable state like the connection_cnt member and
the connections list on struct odbc_class.

Fixes: #465
(cherry picked from commit e0bf65bde6)
2024-01-12 18:32:13 +00:00
Sean Bright fb289b0bad res_pjsip_header_funcs.c: Check URI parameter length before copying.
Fixes #477

(cherry picked from commit 002d6c2108)
2024-01-12 18:32:13 +00:00
Sean Bright 1c617f9b01 config.c: Log #exec include failures.
If the script referenced by `#exec` does not exist, writes anything to
stderr, or exits abnormally or with a non-zero exit status, we log
that to Asterisk's error logging channel.

Additionally, write out a warning if the script produces no output.

Fixes #259

(cherry picked from commit b437cc3267)
2024-01-12 18:32:13 +00:00
Sean Bright 8087a4ef2c make_xml_documentation: Properly handle absolute LOCAL_MOD_SUBDIRS.
If LOCAL_MOD_SUBDIRS contains absolute paths, do not prefix them with
the path to Asterisk's source tree.

Fixes #142

(cherry picked from commit 5f0b568341)
2024-01-12 18:32:13 +00:00
Sean Bright 77e8011291 app_voicemail.c: Completely resequence mailbox folders.
Resequencing is a process that occurs when we open a voicemail folder
and discover that there are gaps between messages (e.g. `msg0000.txt`
is missing but `msg0001.txt` exists). Resequencing involves shifting
the existing messages down so we end up with a sequential list of
messages.

Currently, this process stops after reaching a threshold based on the
message limit (`maxmsg`) configured on the current folder. However, if
`maxmsg` is lowered when a voicemail folder contains more than
`maxmsg + 10` messages, resequencing will not run completely leaving
the mailbox in an inconsistent state.

We now resequence up to the maximum number of messages permitted by
`app_voicemail` (currently hard-coded at 9999 messages).

Fixes #86

(cherry picked from commit fbe92dce2b)
2024-01-12 18:32:13 +00:00
Naveen Albert 4e774da45a sig_analog: Fix channel leak when mwimonitor is enabled.
When mwimonitor=yes is enabled for an FXO port,
the do_monitor thread will launch mwi_thread if it thinks
there could be MWI on an FXO channel, due to the noise
threshold being satisfied. This, in turns, calls
analog_ss_thread_start in sig_analog. However, unlike
all other instances where __analog_ss_thread is called
in sig_analog, this call path does not properly set
pvt->ss_astchan to the Asterisk channel, which means
that the Asterisk channel is NULL when __analog_ss_thread
starts executing. As a result, the thread exits and the
channel is never properly cleaned up by calling ast_hangup.

This caused issues with do_monitor on incoming calls,
as it would think the channel was still owned even while
receiving events, leading to an infinite barrage of
warning messages; additionally, the channel would persist
improperly.

To fix this, the assignment is added to the call path
where it is missing (which is only used for mwi_thread).
A warning message is also added since previously there
was no indication that __analog_ss_thread was exiting
abnormally. This resolves both the channel leak and the
condition that led to the warning messages.

Resolves: #458
(cherry picked from commit c930230a73)
2024-01-12 18:32:13 +00:00
Sean Bright 72d631b7bd res_rtp_asterisk.c: Update for OpenSSL 3+.
In 5ac5c2b0 we defined `OPENSSL_SUPPRESS_DEPRECATED` to silence
deprecation warnings. This commit switches over to using
non-deprecated API.

(cherry picked from commit 05924e30f9)
2024-01-12 18:32:13 +00:00
Sean Bright 9831c65f38 alembic: Update list of TLS methods available on ps_transports.
Related to #221 and #222.

Also adds `*.ini` to the `.gitignore` file in ast-db-manage for
convenience.

(cherry picked from commit c7838a352a)
2024-01-12 18:32:13 +00:00
Naveen Albert bef9a9422d func_channel: Expose previously unsettable options.
Certain channel options are not set anywhere or
exposed in any way to users, making them unusable.
This exposes some of these options which make sense
for users to manipulate at runtime.

Resolves: #442
(cherry picked from commit 9211fb5e97)
2024-01-12 18:32:13 +00:00
Sean Bright 0620c14eb6 app.c: Allow ampersands in playback lists to be escaped.
Any function or application that accepts a `&`-separated list of
filenames can now include a literal `&` in a filename by wrapping the
entire filename in single quotes, e.g.:

```
exten = _X.,n,Playback('https://example.com/sound.cgi?a=b&c=d'&hello-world)
```

Fixes #172

UpgradeNote: Ampersands in URLs passed to the `Playback()`,
`Background()`, `SpeechBackground()`, `Read()`, `Authenticate()`, or
`Queue()` applications as filename arguments can now be escaped by
single quoting the filename. Additionally, this is also possible when
using the `CONFBRIDGE` dialplan function, or configuring various
features in `confbridge.conf` and `queues.conf`.

(cherry picked from commit 33213c1979)
2024-01-12 18:32:13 +00:00
Sean Bright 6a75f22858 uri.c: Simplify ast_uri_make_host_with_port()
(cherry picked from commit e2e18b366c)
2024-01-12 18:32:13 +00:00
Sean Bright 1eeca01d89 func_curl.c: Remove CURLOPT() plaintext documentation.
I assume this was missed when initially converting to XML
documentation and we've been kicking the can down the road since.

(cherry picked from commit d3c411cd05)
2024-01-12 18:32:13 +00:00
Sean Bright a44fde08dd res_http_websocket.c: Set hostname on client for certificate validation.
Additionally add a `assert()` to in the TLS client setup code to
ensure that hostname is set when it is supposed to be.

Fixes #433

(cherry picked from commit 40a9f5a88c)
2024-01-12 18:32:13 +00:00
Sean Bright 6142e38125 live_ast: Add astcachedir to generated asterisk.conf.
`astcachedir` (added in b0842713) was not added to `live_ast` so
continued to point to the system `/var/cache` directory instead of the
one in the live environment.

(cherry picked from commit 1e426b6f1c)
2024-01-12 18:32:13 +00:00
George Joseph b783ba6b13 SECURITY.md: Update with correct documentation URL
(cherry picked from commit 6ffb295c69)
2024-01-12 18:32:13 +00:00
Naveen Albert 138f6f4b92 func_lock: Add missing see-also refs to documentation.
Resolves: #423
(cherry picked from commit 3be75073a9)
2024-01-12 18:32:13 +00:00
Matthew Fredrickson 8c71aefa04 app_followme.c: Grab reference on nativeformats before using it
Fixes a crash due to a lack of proper reference on the nativeformats
object before passing it into ast_request().  Also found potentially
similar use case bugs in app_chanisavail.c, bridge.c, and bridge_basic.c

Fixes: #388
(cherry picked from commit b5c31b55c9)
2024-01-12 18:32:13 +00:00
Naveen Albert 04764945cf configs: Improve documentation for bandwidth in iax.conf.
This improves the documentation for the bandwidth setting
in iax.conf by making it clearer what the ramifications
of this setting are. It also changes the sample default
from low to high, since only high is compatible with good
codecs that people will want to use in the vast majority
of cases, and this is a common gotcha that trips up new users.

Resolves: #425
(cherry picked from commit 582c4645f3)
2024-01-12 18:32:13 +00:00
Naveen Albert dce2fb6996 logger: Add channel-based filtering.
This adds the ability to filter console
logging by channel or groups of channels.
This can be useful on busy systems where
an administrator would like to analyze certain
calls in detail. A dialplan function is also
included for the purpose of assigning a channel
to a group (e.g. by tenant, or some other metric).

ASTERISK-30483 #close

Resolves: #242

UserNote: The console log can now be filtered by
channels or groups of channels, using the
logger filter CLI commands.

(cherry picked from commit a6439d3723)
2024-01-12 18:32:13 +00:00
Sean Bright a694931478 chan_iax2.c: Don't send unsanitized data to the logger.
This resolves an issue where non-printable characters could be sent to
the console/log files.

(cherry picked from commit da4e6e7ddb)
2024-01-12 18:32:13 +00:00
George Joseph 45c224f9d7 codec_ilbc: Disable system ilbc if version >= 3.0.0
Fedora 37 started shipping ilbc 3.0.4 which we don't yet support.
configure.ac now checks the system for "libilbc < 3" instead of
just "libilbc".  If true, the system version of ilbc will be used.
If not, the version included at codecs/ilbc will be used.

Resolves: #84
(cherry picked from commit 5a770ad13f)
2024-01-12 18:32:13 +00:00
Sean Bright 157e66de0e resource_channels.c: Explicit codec request when creating UnicastRTP.
Fixes #394

(cherry picked from commit 64603c4807)
2024-01-12 18:32:13 +00:00
Sean Bright cbf1226829 doc: Update IP Quality of Service links.
Fixes #328

(cherry picked from commit e4eeda6502)
2024-01-12 18:32:13 +00:00
George Joseph c40496cb38 chan_pjsip: Add PJSIPHangup dialplan app and manager action
See UserNote below.

Exposed the existing Hangup AMI action in manager.c so we can use
all of it's channel search and AMI protocol handling without
duplicating that code in dialplan_functions.c.

Added a lookup function to res_pjsip.c that takes in the
string represenation of the pjsip_status_code enum and returns
the actual status code.  I.E.  ast_sip_str2rc("DECLINE") returns
603.  This allows the caller to specify PJSIPHangup(decline) in
the dialplan, just like Hangup(call_rejected).

Also extracted the XML documentation to its own file since it was
almost as large as the code itself.

UserNote: A new dialplan app PJSIPHangup and AMI action allows you
to hang up an unanswered incoming PJSIP call with a specific SIP
response code in the 400 -> 699 range.

(cherry picked from commit af7e89ebf8)
2024-01-12 18:32:13 +00:00
Sean Bright cd39daaed1 chan_iax2.c: Ensure all IEs are displayed when dumping frame contents.
When IAX2 debugging was enabled (`iax2 set debug on`), if the last IE
in a frame was one that may not have any data - such as the CALLTOKEN
IE in an NEW request - it was not getting displayed.

(cherry picked from commit 19507ae160)
2024-01-12 18:32:13 +00:00
Naveen Albert 27f3df7139 chan_dahdi: Warn if nonexistent cadence is requested.
If attempting to ring a channel using a nonexistent cadence,
emit a warning, before falling back to the default cadence.

Resolves: #409
(cherry picked from commit cdcdca5199)
2024-01-12 18:32:13 +00:00
Holger Hans Peter Freyther 35281dac6a stasis: Update the snapshot after setting the redirect
The previous commit added the caller_rdnis attribute. Make it
avialble during a possible ChanngelHangupRequest.

(cherry picked from commit 9fd2655d5a)
2024-01-12 18:32:13 +00:00
Holger Hans Peter Freyther 4053abc214 ari: Provide the caller ID RDNIS for the channels
Provide the caller ID RDNIS when available. This will allow an
application to follow the redirect.

(cherry picked from commit da0b1ac1c1)
2024-01-12 18:32:13 +00:00
Brad Smith 5fa3c03738 main/utils: Implement ast_get_tid() for OpenBSD
Implement the ast_get_tid() function for OpenBSD. OpenBSD supports
getting the TID via getthrid().

(cherry picked from commit 29a3e5660b)
2024-01-12 18:32:13 +00:00
Brad Smith 3949358ee1 res_rtp_asterisk.c: Fix runtime issue with LibreSSL
The module will fail to load. Use proper function DTLS_method() with LibreSSL.

(cherry picked from commit 1d9c5faeb3)
2024-01-12 18:32:13 +00:00
Naveen Albert 0f33423107 app_directory: Add ADSI support to Directory.
This adds optional ADSI support to the Directory
application, which allows callers with ADSI CPE
to navigate the Directory system significantly
faster than is possible using the audio prompts.
Callers can see the directory name (and optionally
extension) on their screenphone and confirm or
reject a match immediately rather than waiting
for it to be spelled out, enhancing usability.

Resolves: #356
(cherry picked from commit 4a356e984c)
2024-01-12 18:32:13 +00:00
Naveen Albert f6e0478bf4 core_local: Fix local channel parsing with slashes.
Currently, trying to call a Local channel with a slash
in the extension will fail due to the parsing of characters
after such a slash as being dial modifiers. Additionally,
core_local is inconsistent and incomplete with
its parsing of Local dial strings in that sometimes it
uses the first slash and at other times it uses the last.

For instance, something like DAHDI/5 or PJSIP/device
is a perfectly usable extension in the dialplan, but Local
channels in particular prevent these from being called.

This creates inconsistent behavior for users, since using
a slash in an extension is perfectly acceptable, and using
a Goto to accomplish this works fine, but if specified
through a Local channel, the parsing prevents this.

This fixes this by explicitly parsing options from the
last slash in the extension, rather than the first one,
which doesn't cause an issue for extensions with slashes.

ASTERISK-30013 #close

Resolves: #248
(cherry picked from commit 65f83311b7)
2024-01-12 18:32:13 +00:00
Mark Murawski 7ea2c5926b Remove files that are no longer updated
Fixes: #360
(cherry picked from commit 6ebd820e26)
2024-01-12 18:32:13 +00:00
Naveen Albert 8ad6e6e585 app_voicemail: Add AMI event for mailbox PIN changes.
This adds an AMI event that is emitted whenever a
mailbox password is successfully changed, allowing
AMI consumers to process these.

UserNote: The VoicemailPasswordChange event is
now emitted whenever a mailbox password is updated,
containing the mailbox information and the new
password.

Resolves: #398
(cherry picked from commit 95bc661542)
2024-01-12 18:32:13 +00:00
Sean Bright 4feaf8a880 app_queue.c: Emit unpause reason with PauseQueueMember event.
Fixes #395

(cherry picked from commit baf3ce25f5)
2024-01-12 18:32:13 +00:00
George Joseph 1972df7b09 bridge_simple: Suppress unchanged topology change requests
In simple_bridge_join, we were sending topology change requests
even when the new and old topologies were the same.  In some
circumstances, this can cause unnecessary re-invites and even
a re-invite flood.  We now suppress those.

Resolves: #384
(cherry picked from commit 57d31d97dc)
2024-01-12 18:32:12 +00:00
Naveen Albert 1a95cd932b res_pjsip: Include cipher limit in config error message.
If too many ciphers are specified in the PJSIP config,
include the maximum number of ciphers that may be
specified in the user-facing error message.

Resolves: #396
(cherry picked from commit d4185ca025)
2024-01-12 18:32:12 +00:00
Mike Bradeen c28302f839 res_speech: allow speech to translate input channel
* Allow res_speech to translate the input channel if the
  format is translatable to a format suppored by the
  speech provider.

Resolves: #129

UserNote: res_speech now supports translation of an input channel
to a format supported by the speech provider, provided a translation
path is available between the source format and provider capabilites.

(cherry picked from commit e8fbdca40b)
2024-01-12 18:32:12 +00:00
Sean Bright 81386086be res_rtp_asterisk.c: Fix memory leak in ephemeral certificate creation.
Fixes #386

(cherry picked from commit 74a5c452de)
2024-01-12 18:32:12 +00:00
Sean Bright 7f3a5b2be0 res_pjsip_dtmf_info.c: Add 'INFO' to Allow header.
Fixes #376

(cherry picked from commit 3af55f14fa)
2024-01-12 18:32:12 +00:00
George Joseph e571b7c4dd api.wiki.mustache: Fix indentation in generated markdown
The '*' list indicator for default values and allowable values for
path, query and POST parameters need to be indented 4 spaces
instead of 2.

Should resolve issue 38 in the documentation repo.

(cherry picked from commit 443f94b438)
2024-01-12 18:32:12 +00:00
Sean Bright b614397206 pjsip_configuration.c: Disable DTLS renegotiation if WebRTC is enabled.
Per RFC8827:

    Implementations MUST NOT implement DTLS renegotiation and MUST
    reject it with a "no_renegotiation" alert if offered.

So we disable it when webrtc=yes is set.

Fixes #378

UpgradeNote: The dtls_rekey will be disabled if webrtc support is
requested on an endpoint. A warning will also be emitted.

(cherry picked from commit c7afd5357c)
2024-01-12 18:32:12 +00:00
Samuel Olaechea 3139269b33 configs: Fix typo in pjsip.conf.sample.
(cherry picked from commit 4c507d31b9)
2024-01-12 18:32:12 +00:00
George Joseph 785cc25519 res_pjsip_exten_state,res_pjsip_mwi: Allow unload on shutdown
Commit f66f77f last year prevents the res_pjsip_exten_state and
res_pjsip_mwi modules from unloading due to possible pjproject
asserts if the modules are reloaded. A side effect of the
implementation is that the taskprocessors these modules use aren't
being released. When asterisk is doing a graceful shutdown, it
waits AST_TASKPROCESSOR_SHUTDOWN_MAX_WAIT seconds for all
taskprocessors to stop but since those 2 modules don't release
theirs, the shutdown hangs for that amount of time.

This change allows the modules to be unloaded and their resources to
be released when ast_shutdown_final is true.

Resolves: #379
(cherry picked from commit b9ee664440)
2024-01-12 18:32:12 +00:00
sungtae kim 39c2f5733e res_pjsip: Expanding PJSIP endpoint ID and relevant resource length to 255 characters
This commit introduces an extension to the endpoint and relevant
resource sizes for PJSIP, transitioning from its current 40-character
constraint to a more versatile 255-character capacity. This enhancement
significantly overcomes limitations related to domain qualification and
practical usage, ultimately delivering improved functionality. In
addition, it includes adjustments to accommodate the expanded realm size
within the ARI, specifically enhancing the maximum realm length.

Resolves: #345

UserNote: With this update, the PJSIP realm lengths have been extended
to support up to 255 characters.

UpgradeNote: As part of this update, the maximum allowable length
for PJSIP endpoints and relevant resources has been increased from
40 to 255 characters. To take advantage of this enhancement, it is
recommended to run the necessary procedures (e.g., Alembic) to
update your schemas.

(cherry picked from commit 9b70b18dec)
2024-01-12 18:32:12 +00:00
George Joseph 56d568d1d5 .github: PRSubmitActions: Fix adding reviewers to PR
(cherry picked from commit 79c5845141)
2024-01-12 18:32:12 +00:00
George Joseph b404679de0 .github: New PR Submit workflows
The workflows that get triggered when PRs are submitted or updated
have been replaced with ones that are more secure and have
a higher level of parallelism.

(cherry picked from commit 6389654b21)
2024-01-12 18:32:12 +00:00
George Joseph b01a9f59b5 .github: New PR Submit workflows
The workflows that get triggered when PRs are submitted or updated
have been replaced with ones that are more secure and have
a higher level of parallelism.

(cherry picked from commit d06bb7f2fe)
2024-01-12 18:32:12 +00:00
Mike Bradeen 054ec2bf4a res_stasis: signal when new command is queued
res_statsis's app loop sleeps for up to .2s waiting on input
to a channel before re-checking the command queue. This can
cause delays between channel setup and bridge.

This change is to send a SIGURG on the sleeping thread when
a new command is enqueued. This exits the sleeping thread out
of the ast_waitfor() call triggering the new command being
processed on the channel immediately.

Resolves: #362

UserNote: Call setup times should be significantly improved
when using ARI.

(cherry picked from commit 7ea0e3bfda)
2024-01-12 18:32:12 +00:00
Holger Hans Peter Freyther 849cf31e51 ari/stasis: Indicate progress before playback on a bridge
Make it possible to start a playback and the calling party
to receive audio on a bridge before the call is connected.

Model the implementation after play_on_channel and deliver a
AST_CONTROL_PROGRESS before starting the playback.

For a PJSIP channel this will result in sending a SIP 183
Session Progress.

(cherry picked from commit 624c7ac883)
2024-01-12 18:32:12 +00:00
Sean Bright 421924e07c func_curl.c: Ensure channel is locked when manipulating datastores.
(cherry picked from commit 8c1491dda9)
2024-01-12 18:32:12 +00:00
George Joseph 6a60ce8eae .github: Fix job prereqs in PROpenedUpdated
(cherry picked from commit 9e9037a8aa)
2024-01-12 18:32:12 +00:00
George Joseph f3561210c2 .github: Block PR tests until approved
(cherry picked from commit 29e202085d)
2024-01-12 18:32:12 +00:00
George Joseph a2d71fce2a .github: Use generic releaser
(cherry picked from commit ceddfbe7b8)
2024-01-12 18:32:12 +00:00
George Joseph 02b84fa88c logger.h: Add ability to change the prefix on SCOPE_TRACE output
You can now define the _TRACE_PREFIX_ macro to change the
default trace line prefix of "file:line function" to
something else.  Full documentation in logger.h.

(cherry picked from commit f599114ee3)
2024-01-12 18:32:12 +00:00
George Joseph cfc6832062 Add libjwt to third-party
The current STIR/SHAKEN implementation is not currently usable due
to encryption issues. Rather than trying to futz with OpenSSL and
the the current code, we can take advantage of the existing
capabilities of libjwt but we first need to add it to the
third-party infrastructure already in place for jansson and
pjproject.

A few tweaks were also made to the third-party infrastructure as
a whole.  The jansson "dest" install directory was renamed "dist"
to better match convention, and the third-party Makefile was updated
to clean all product directories not just the ones currently in
use.

Resolves: #349
(cherry picked from commit d7a6116681)
2024-01-12 18:32:12 +00:00
Mike Bradeen 893483f915 res_pjsip: update qualify_timeout documentation with DNS note
The documentation on qualify_timeout does not explicitly state that the timeout
includes any time required to perform any needed DNS queries on the endpoint.

If the OPTIONS response is delayed due to the DNS query, it can still render an
endpoint as Unreachable if the net time is enough for qualify_timeout to expire.

Resolves: #352
(cherry picked from commit 323a51fd6c)
2024-01-12 18:32:12 +00:00
Naveen Albert c58d5e9190 chan_dahdi: Clarify scope of callgroup/pickupgroup.
Internally, chan_dahdi only applies callgroup and
pickupgroup to FXO signalled channels, but this is
not documented anywhere. This is now documented in
the sample config, and a warning is emitted if a
user tries configuring these settings for channel
types that do not support these settings, since they
will not have any effect.

Resolves: #294
(cherry picked from commit 5b89e40541)
2024-01-12 18:32:12 +00:00
Bastian Triller 903c594cef func_json: Fix crashes for some types
This commit fixes crashes in JSON_DECODE() for types null, true, false
and real numbers.

In addition it ensures that a path is not deeper than 32 levels.

Also allow root object to be an array.

Add unit tests for above cases.

(cherry picked from commit 1cbbf36929)
2024-01-12 18:32:12 +00:00
Mike Bradeen 779fb2052a res_speech_aeap: add aeap error handling
res_speech_aeap previously did not register an error handler
with aeap, so it was not notified of a disconnect. This resulted
in SpeechBackground never exiting upon a websocket disconnect.

Resolves: #303
(cherry picked from commit e921f5e010)
2024-01-12 18:32:12 +00:00
Naveen Albert a11885989c app_voicemail: Disable ADSI if unavailable.
If ADSI is available on a channel, app_voicemail will repeatedly
try to use ADSI, even if there is no CPE that supports it. This
leads to many unnecessary delays during the session. If ADSI is
available but ADSI setup fails, we now disable it to prevent
further attempts to use ADSI during the session.

Resolves: #354
(cherry picked from commit 75620616f4)
2024-01-12 18:32:12 +00:00
Eduardo d8238d0e15 codec_builtin: Use multiples of 20 for maximum_ms
Some providers require a multiple of 20 for the maxptime or fail to complete calls,
e.g. Vivo in Brazil. To increase compatibility, only multiples of 20 are now used.

Resolves: #260
(cherry picked from commit ca1ed84820)
2024-01-12 18:32:12 +00:00
George Joseph 75bb76528a lock.c: Separate DETECT_DEADLOCKS from DEBUG_THREADS
Previously, DETECT_DEADLOCKS depended on DEBUG_THREADS.
Unfortunately, DEBUG_THREADS adds a lot of lock tracking overhead
to all of the lock lifecycle calls whereas DETECT_DEADLOCKS just
causes the lock calls to loop over trylock in 200us intervals until
the lock is obtained and spits out log messages if it takes more
than 5 seconds.  From a code perspective, the only reason they were
tied together was for logging.  So... The ifdefs in lock.c were
refactored to allow DETECT_DEADLOCKS to be enabled without
also enabling DEBUG_THREADS.

Resolves: #321

UserNote: You no longer need to select DEBUG_THREADS to use
DETECT_DEADLOCKS.  This removes a significant amount of overhead
if you just want to detect possible deadlocks vs needing full
lock tracing.

(cherry picked from commit e1050b4add)
2024-01-12 18:32:12 +00:00
George Joseph fe1bca6a72 asterisk.c: Use the euid's home directory to read/write cli history
The CLI .asterisk_history file is read from/written to the directory
specified by the HOME environment variable. If the root user starts
asterisk with the -U/-G options, or with runuser/rungroup set in
asterisk.conf, the asterisk process is started as root but then it
calls setuid/setgid to set the new user/group. This does NOT reset
the HOME environment variable to the new user's home directory
though so it's still left as "/root". In this case, the new user
will almost certainly NOT have access to read from or write to the
history file.

* Added function process_histfile() which calls
  getpwuid(geteuid()) and uses pw->dir as the home directory
  instead of the HOME environment variable.
* ast_el_read_default_histfile() and ast_el_write_default_histfile()
  have been modified to use the new process_histfile()
  function.

Resolves: #337
(cherry picked from commit fc516f5781)
2024-01-12 18:32:12 +00:00
Tinet-mucw aadf9d920a res_pjsip_transport_websocket: Prevent transport from being destroyed before message finishes.
From the gdb information, ast_websocket_read reads a message successfully,
then transport_read is called in the serializer. During execution of pjsip_transport_down,
ws_session->stream->fd is closed; ast_websocket_read encounters an error and exits the while loop.
After executing transport_shutdown, the transport's reference count becomes 0, causing a crash when sending SIP messages.
This was due to pjsip_transport_dec_ref executing earlier than pjsip_rx_data_clone, leading to this issue.
In websocket_cb executeing pjsip_transport_add_ref, this we now ensure the transport is not destroyed while in the loop.

Resolves: asterisk#299
(cherry picked from commit a38add11e6)
2024-01-12 18:32:12 +00:00
Mike Bradeen f9efc9c681 cel: add publish user event helper
Add a wrapper function around ast_cel_publish_event that
packs event and extras into a blob before publishing

Resolves:#330
(cherry picked from commit 4592f97c36)
2024-01-12 18:32:12 +00:00
Naveen Albert d01b047de3 chan_console: Fix deadlock caused by unclean thread exit.
To terminate a console channel, stop_stream causes pthread_cancel
to make stream_monitor exit. However, commit 5b8fea93d1
added locking to this function which results in deadlock due to
the stream_monitor thread being killed while it's holding the pvt lock.

To resolve this, a flag is now set and read to indicate abort, so
the use of pthread_cancel and pthread_kill can be avoided altogether.

Resolves: #308
(cherry picked from commit 3b027d1e47)
2024-01-12 18:32:12 +00:00
George Joseph dadbaed6f5 file.c: Add ability to search custom dir for sounds
To better co-exist with sounds files that may be managed by
packages, custom sound files may now be placed in
AST_DATA_DIR/sounds/custom instead of the standard
AST_DATA_DIR/sounds/<lang> directory.  If the new
"sounds_search_custom_dir" option in asterisk.conf is set
to "true", asterisk will search the custom directory for sounds
files before searching the standard directory.  For performance
reasons, the "sounds_search_custom_dir" defaults to "false".

Resolves: #315

UserNote: A new option "sounds_search_custom_dir" has been added to
asterisk.conf that allows asterisk to search
AST_DATA_DIR/sounds/custom for sounds files before searching the
standard AST_DATA_DIR/sounds/<lang> directory.

(cherry picked from commit 0e0f99db1d)
2024-01-12 18:32:12 +00:00
Naveen Albert 69338381ea 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 f93138bcad)
2024-01-12 18:32:12 +00:00
Vitezslav Novy e1231fa4ac 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 56244a7371)
2024-01-12 18:32:12 +00:00
George Joseph 58c8d60f4b res_pjsip_pubsub: Add body_type to test_handler for unit tests
The ast_sip_subscription_handler "test_handler" used for the unit
tests didn't set "body_type" so the NULL value was causing
a SEGV in build_subscription_tree().  It's now set to "".

Resolves: #335
(cherry picked from commit 71d75373f9)
2024-01-12 18:32:12 +00:00
George Joseph e2c3fd8d41 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 42f82d55b0)
2024-01-12 18:32:12 +00:00
Mike Bradeen 4799c0eda3 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 2265eafb3a)
2024-01-12 18:32:12 +00:00
Sean Bright fd7a35fad8 res_stasis_recording.c: Save recording state when unmuted.
Fixes #322

(cherry picked from commit b952a8c38d)
2024-01-12 18:32:12 +00:00
Mike Bradeen 2fb8dbc679 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 3759d034cc)
2024-01-12 18:32:12 +00:00
George Joseph e4edc9c75d 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 cff637a24f)
2024-01-12 18:32:12 +00:00
George Joseph 569dc4fb43 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 6bd9f9ae81)
2024-01-12 18:32:12 +00:00
Maximilian Fridrich 3829c94d71 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 1af2ae177c)
2024-01-12 18:32:12 +00:00
Jaco Kroon 9eeee41fc5 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 130c3ab792)
2024-01-12 18:32:12 +00:00
Joshua C. Colp 73179928e6 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 182ad6926b)
2024-01-12 18:32:12 +00:00
George Joseph 2f5dc8985a Restore CHANGES and UPGRADE.txt to allow cherry-picks to work 2024-01-12 11:08:07 -07:00
Asterisk Development Team 71ddb39bd9 Update for 21.0.2 2023-12-20 16:27:02 +00:00
George Joseph a49bb17dbb 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:02 -07:00
Asterisk Development Team beba569755 Update for 21.0.1 2023-12-14 20:03:39 +00:00
Gitea b9594cc08a 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 12:02:12 -07:00
Mike Bradeen 8043d060e3 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 12:01:55 -07:00
George Joseph be5e9c568d 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 12:01:47 -07:00
Ben Ford 1c4d6d3af1 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 12:01:35 -07:00
Asterisk Development Team 12da95e53f Update for 21.0.0 2023-10-18 17:14:20 +00:00
Asterisk Development Team f53f391889 Update for 21.0.0-rc1 2023-09-06 18:21:42 +00:00
George Joseph bbbc9a8540 ari-stubs: Fix more local anchor references
Also allow CreateDocs job to be run manually with default branches.

(cherry picked from commit c457784bd0)
2023-09-06 18:21:31 +00:00
George Joseph a0fc6c3ab0 ari-stubs: Fix more local anchor references
Also allow CreateDocs job to be run manually with default branches.

(cherry picked from commit b68006f3a1)
2023-09-06 18:21:31 +00:00
George Joseph 1108db21ef 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 c4508accc6)
2023-09-06 18:21:31 +00:00
Bastian Triller 28320a9cd8 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 9284dca636)
2023-09-06 18:21:31 +00:00
George Joseph 4b11eb23c8 .github: Update workflow-application-token-action to v2
(cherry picked from commit 83964ede1f)
2023-09-06 18:21:31 +00:00
Naveen Albert 3b7a0d617f 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 c032d38d3f)
2023-09-06 18:21:31 +00:00
Mike Bradeen 5f7c8e75fd app_voicemail: Fix for loop declarations
Resolve for loop initial declarations added in cli changes.

Resolves: #275
(cherry picked from commit e9b269692f)
2023-09-06 18:21:31 +00:00
George Joseph c4e2c00553 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 f8438714ca)
2023-09-06 18:21:31 +00:00
Naveen Albert d29a7c19d0 pbx.c: Fix gcc 12 compiler warning.
Resolves: #277
(cherry picked from commit 9e6266e008)
2023-09-06 18:21:31 +00:00
zhengsh d15a5c547f app_audiosocket: Fixed timeout with -1 to avoid busy loop.
Resolves: asterisk#234
(cherry picked from commit eab40e755e)
2023-09-06 18:21:30 +00:00
George Joseph 62e5a2720a 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 644ad2f9cd)
2023-09-06 18:21:30 +00:00
Maximilian Fridrich 9cb77904e0 main/refer.c: Fix double free in refer_data_destructor + potential leak
Resolves: #267
(cherry picked from commit 48e6a482c2)
2023-09-06 18:21:30 +00:00
Naveen Albert e2f0538dea 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 cd0bfe193f)
2023-09-06 18:21:30 +00:00
Matthew Fredrickson 64f76bdc60 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 1d7ae8d227)
2023-09-06 18:21:30 +00:00
Jason D. McCormick 41e4673eb0 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 2f02095da8)
2023-09-06 18:21:30 +00:00
MikeNaso 59618c3a34 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 720813dc97)
2023-09-06 18:21:30 +00:00
Sean Bright 7e8aadae5a 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 1171beb7e4)
2023-09-06 18:21:30 +00:00
George Joseph f287e8fce4 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 21b0522abd)
2023-09-06 18:21:30 +00:00
Naveen Albert c011914f70 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 2179082eaf)
2023-09-06 18:21:30 +00:00
George Joseph e37cfa85bb 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 d3ee0e6516)
2023-09-06 18:21:30 +00:00
Joshua C. Colp f549da4cf2 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 a75035be55)
2023-09-06 18:21:30 +00:00
George Joseph f7ea380b04 Remove unneeded CHANGES and UPGRADE files
(cherry picked from commit ea7e719d71)
2023-09-06 18:21:30 +00:00
George Joseph 68349125a8 Update version for Asterisk 21 2023-08-09 18:58:48 +00:00
348 changed files with 30217 additions and 17685 deletions

View File

@ -131,7 +131,7 @@ jobs:
github_token: ${{secrets.GITHUB_TOKEN}}
testsuite_repo: ${{vars.TESTSUITE_REPO}}
gatetest_group: ${{matrix.group}}
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
gatetest_command: ${{ toJSON(fromJSON(vars.GATETEST_COMMANDS)[matrix.group]) }}
CherryPickGateTests:
needs: [ IdentifyBranches, CherryPickGateTestMatrix ]

View File

@ -4,7 +4,7 @@ on:
inputs:
branches:
description: "JSON array of branches: ['18','20'] (no spaces)"
required: true
required: false
type: string
schedule:
# Times are UTC
@ -14,15 +14,29 @@ env:
ASTERISK_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCHES: ${{ vars.WIKIDOC_BRANCHES }}
INPUT_BRANCHES: ${{ inputs.branches }}
jobs:
CreateDocsDebug:
runs-on: ubuntu-latest
outputs:
manual_branches: ${{ steps.setup.outputs.manual_branches }}
steps:
- name: setup
run: |
MANUAL_BRANCHES="$INPUT_BRANCHES"
[ -z "$MANUAL_BRANCHES" ] && MANUAL_BRANCHES="$DEFAULT_BRANCHES" || :
echo "manual_branches=${MANUAL_BRANCHES}"
echo "manual_branches=${MANUAL_BRANCHES}" >>${GITHUB_OUTPUT}
exit 0
- name: DumpEnvironment
uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main
with:
action-vars: ${{toJSON(inputs)}}
action-inputs: ${{toJSON(inputs)}}
action-vars: ${{ toJSON(steps.setup.outputs) }}
CreateDocsScheduledMatrix:
needs: [ CreateDocsDebug ]
@ -73,7 +87,7 @@ jobs:
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(inputs.branches) }}
branch: ${{ fromJSON(vars.WIKIDOC_MANUAL_BRANCHES) }}
runs-on: ubuntu-latest
steps:
- name: CreateDocs for ${{matrix.branch}}

View File

@ -123,9 +123,6 @@ jobs:
MergeAndCherryPick:
needs: [ IdentifyBranches, PreMergeUnitTests ]
if: success()
concurrency:
group: MergeAndCherryPick
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Start Merge
@ -138,7 +135,7 @@ jobs:
- name: Get Token needed to push cherry-picks
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v1
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}

View File

@ -33,7 +33,7 @@ jobs:
github_token: ${{secrets.GITHUB_TOKEN}}
testsuite_repo: ${{vars.TESTSUITE_REPO}}
gatetest_group: ${{matrix.group}}
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
gatetest_command: ${{ toJSON(fromJSON(vars.GATETEST_COMMANDS)[matrix.group]) }}
AsteriskNightlyTests:
if: ${{ always() }}

View File

@ -1,184 +0,0 @@
name: PROpenedOrUpdated
run-name: "PR ${{github.event.number}} ${{github.event.action}} by ${{ github.actor }}"
on:
# workflow_dispatch:
pull_request_target:
types: [opened, reopened, synchronize]
env:
ASTERISK_REPO: ${{github.repository}}
PR_NUMBER: ${{github.event.number}}
PR_COMMIT: ${{github.event.pull_request.head.sha}}
BRANCH: ${{github.event.pull_request.base.ref}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
MODULES_BLACKLIST: ${{vars.GATETEST_MODULES_BLACKLIST}} ${{vars.UNITTEST_MODULES_BLACKLIST}}
jobs:
PROpenUpdateUnitTests:
runs-on: ubuntu-latest
steps:
- name: Job Start Delay
env:
JOB_START_DELAY_SEC: ${{vars.PR_JOB_START_DELAY_SEC}}
run: |
# Give the user a chance to add their "cherry-pick-to" comments
sleep ${JOB_START_DELAY_SEC:-60}
- name: Get Token needed to add reviewers
if: github.event.action == 'opened'
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v1
with:
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}
organization: asterisk
- name: Get cherry-pick branches
uses: asterisk/asterisk-ci-actions/GetCherryPickBranchesFromPR@main
id: getbranches
with:
repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
cherry_pick_regex: ${{vars.CHERRY_PICK_REGEX}}
github_token: ${{secrets.GITHUB_TOKEN}}
- name: Add cherry-pick reminder
env:
GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
BRANCHES_OUTPUT: ${{toJSON(steps.getbranches.outputs)}}
BRANCH_COUNT: ${{steps.getbranches.outputs.branch_count}}
FORCED_NONE: ${{steps.getbranches.outputs.forced_none}}
run: |
# If the user already added "cherry-pick-to" comments
# we don't need to remind them.
( $FORCED_NONE || [ $BRANCH_COUNT -gt 0 ] ) && { echo "No reminder needed." ; exit 0 ; }
IFS=$'; \n'
# If there's already a reminder comment, don't add another one.
ADD_COMMENT=true
# This query will FAIL if it finds the comment.
gh pr view --repo ${{github.repository}} --json comments \
--jq '.comments[].body | select(. | startswith("<!--CPR-->")) | halt_error(1)' \
${{env.PR_NUMBER}} >/dev/null 2>&1 || ADD_COMMENT=false
if $ADD_COMMENT ; then
echo "Adding CPR comment"
gh pr comment --repo ${{github.repository}} \
-b "${CHERRY_PICK_REMINDER}" ${{env.PR_NUMBER}}
else
echo "CPR comment already present"
fi
- name: Add reviewers
if: github.event.action == 'opened'
env:
GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
REVIEWERS: ${{vars.PR_REVIEWERS}}
run: |
IFS=$'; \n'
for r in $REVIEWERS ; do
echo "Adding reviewer $r"
gh pr edit --repo ${{github.repository}} ${PR_NUMBER} --add-reviewer $r || :
done
- name: Set Labels
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \
--remove-label ${{vars.TEST_CHECKS_FAILED_LABEL}} \
--remove-label ${{vars.TEST_GATES_PASSED_LABEL}} \
--remove-label ${{vars.TEST_GATES_FAILED_LABEL}} \
--remove-label ${{vars.CHERRY_PICK_CHECKS_PASSED_LABEL}} \
--remove-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \
--remove-label ${{vars.CHERRY_PICK_GATES_PASSED_LABEL}} \
--remove-label ${{vars.CHERRY_PICK_GATES_FAILED_LABEL}} \
--add-label ${{vars.TESTING_IN_PROGRESS}} \
${{env.PR_NUMBER}} || :
- name: Run Unit Tests
uses: asterisk/asterisk-ci-actions/AsteriskUnitComposite@main
with:
asterisk_repo: ${{env.ASTERISK_REPO}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{env.BRANCH}}
modules_blacklist: ${{env.MODULES_BLACKLIST}}
github_token: ${{secrets.GITHUB_TOKEN}}
unittest_command: ${{vars.UNITTEST_COMMAND}}
- name: Add Checks Passed Label
if: ${{ success() }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.TEST_CHECKS_PASSED_LABEL}} \
${{env.PR_NUMBER}} || :
PROpenUpdateGateTestMatrix:
needs: PROpenUpdateUnitTests
continue-on-error: false
strategy:
fail-fast: false
matrix:
group: ${{ fromJSON(vars.GATETEST_LIST) }}
runs-on: ubuntu-latest
steps:
- id: runtest
name: Run Gate Tests for ${{ matrix.group }}
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
with:
test_type: Gate
asterisk_repo: ${{env.ASTERISK_REPO}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{env.BRANCH}}
modules_blacklist: ${{env.MODULES_BLACKLIST}}
github_token: ${{secrets.GITHUB_TOKEN}}
testsuite_repo: ${{vars.TESTSUITE_REPO}}
gatetest_group: ${{matrix.group}}
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
PROpenUpdateGateTests:
if: always()
runs-on: ubuntu-latest
needs: PROpenUpdateGateTestMatrix
steps:
- name: Check test matrix status
env:
RESULT: ${{ needs.PROpenUpdateGateTestMatrix.result }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "all results: ${{ toJSON(needs.*.result) }}"
echo "composite result: $RESULT"
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.TESTING_IN_PROGRESS}} \
${{env.PR_NUMBER}} || :
case $RESULT in
success)
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.TEST_GATES_PASSED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::notice::All Testsuite tests passed"
exit 0
;;
skipped)
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.TEST_CHECKS_FAILED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::error::Testsuite tests were skipped because of an earlier failure"
exit 1
;;
*)
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.TEST_GATES_FAILED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::error::One or more Testsuite tests failed ($RESULT)"
exit 1
esac

148
.github/workflows/PRSubmitActions.yml vendored Normal file
View File

@ -0,0 +1,148 @@
name: PRSubmitActions
run-name: "PRSubmitActions: Test ${{github.event.action}}"
on:
workflow_run:
workflows: [PRSubmitTests]
types:
- requested
- completed
env:
ACTION: ${{ github.event.action }}
CONCLUSION: ${{ github.event.workflow_run.conclusion }}
REPO: ${{ github.repository }}
jobs:
PRSubmitActions:
runs-on: ubuntu-latest
steps:
- name: Get PR Number
id: getpr
uses: actions/github-script@v7
with:
retries: 5
script: |
let search = `repo:${context.repo.owner}/${context.repo.repo} ${context.payload.workflow_run.head_sha}`;
let prs = await github.rest.search.issuesAndPullRequests({
q: search,
});
if (prs.data.total_count == 0) {
core.setFailed(`Unable to get PR for ${context.payload.workflow_run.head_sha}`);
return;
}
let pr_number = prs.data.items[0].number;
core.setOutput('pr_number', pr_number);
return;
- name: Set Label
id: setlabel
uses: actions/github-script@v7
env:
PR_NUMBER: ${{ steps.getpr.outputs.PR_NUMBER }}
LABEL_TIP: ${{ vars.PR_SUBMIT_TESTING_IN_PROGRESS }}
LABEL_PASS: ${{ vars.PR_SUBMIT_TESTS_PASSED }}
LABEL_FAIL: ${{ vars.PR_SUBMIT_TESTS_FAILED }}
with:
retries: 5
script: |
let label;
if (process.env.ACTION === 'requested') {
label = process.env.LABEL_TIP;
} else {
if ( process.env.CONCLUSION === 'success' ) {
label = process.env.LABEL_PASS;
} else {
label = process.env.LABEL_FAIL;
}
}
core.info(`Setting label ${label}`);
github.rest.issues.setLabels({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [ label ]
});
return;
- name: Get cherry-pick branches
if: github.event.action == 'completed'
id: getbranches
uses: asterisk/asterisk-ci-actions/GetCherryPickBranchesFromPR@main
with:
repo: ${{env.REPO}}
pr_number: ${{steps.getpr.outputs.PR_NUMBER}}
cherry_pick_regex: ${{vars.CHERRY_PICK_REGEX}}
github_token: ${{secrets.GITHUB_TOKEN}}
- name: Add cherry-pick reminder
if: github.event.action == 'completed'
uses: actions/github-script@v7
env:
PR_NUMBER: ${{steps.getpr.outputs.PR_NUMBER}}
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
BRANCHES_OUTPUT: ${{toJSON(steps.getbranches.outputs)}}
BRANCH_COUNT: ${{steps.getbranches.outputs.branch_count}}
FORCED_NONE: ${{steps.getbranches.outputs.forced_none}}
with:
retries: 5
script: |
if (process.env.FORCED_NONE === 'true' ||
process.env.BRANCH_COUNT > 0) {
core.info("No cherry-pick reminder needed.");
return;
}
let comments = await github.rest.issues.listComments({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
});
let found = false;
for (const c of comments.data) {
if (c.body.startsWith("<!--CPR-->")) {
found = true;
break;
}
}
if (found) {
core.info("Cherry-pick reminder already exists.");
return;
}
core.info("Adding cherry-pick reminder.");
await github.rest.issues.createComment({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.CHERRY_PICK_REMINDER
})
return;
- name: Add reviewers
if: github.event.action == 'completed'
uses: actions/github-script@v7
env:
PR_NUMBER: ${{steps.getpr.outputs.PR_NUMBER}}
REVIEWERS: ${{vars.PR_REVIEWERS}}
with:
retries: 5
script: |
let rs = JSON.parse(process.env.REVIEWERS);
let users = [];
let teams = [];
for (const r of rs) {
if (r.indexOf("/") > 0) {
teams.push(r.split('/')[1]);
} else {
users.push(r);
}
}
if (teams.length > 0 || users.length > 0) {
core.info(`Adding user reviewers ${users}`);
core.info(`Adding team reviewers ${teams}`);
await github.rest.pulls.requestReviewers({
pull_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
reviewers: users,
team_reviewers: teams
});
}
return;

114
.github/workflows/PRSubmitTests.yml vendored Normal file
View File

@ -0,0 +1,114 @@
name: PRSubmitTests
run-name: "PR ${{github.event.number}} ${{github.event.action}} by ${{ github.actor }}"
on:
pull_request:
types: [opened, reopened, synchronize]
concurrency:
group: ${{github.workflow}}-${{github.event.number}}
cancel-in-progress: true
env:
ASTERISK_REPO: ${{github.repository}}
PR_NUMBER: ${{github.event.number}}
PR_COMMIT: ${{github.event.pull_request.head.sha}}
BRANCH: ${{github.event.pull_request.base.ref}}
jobs:
#
# Pull requests created from forked respositories don't have access to
# the "Action Variables" ('vars' context) so we need to retrieve control
# data from an action.
#
PRSGetControlData:
runs-on: ubuntu-latest
outputs:
control_data: ${{ steps.setvars.outputs.control_data }}
steps:
- id: setvars
uses: asterisk/asterisk-ci-actions/GetRepoControlData@main
with:
repo: ${{ github.event.repository.name}}
- name: DumpEnvironment
uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main
with:
action-inputs: ${{toJSON(inputs)}}
action-vars: ${{ toJSON(steps.setvars.outputs) }}
PRSUnitTests:
needs: PRSGetControlData
runs-on: ubuntu-latest
env:
UNITTEST_COMMAND: ${{ fromJSON(needs.PRSGetControlData.outputs.control_data).UNITTEST_COMMAND }}
steps:
- name: Run Unit Tests
uses: asterisk/asterisk-ci-actions/AsteriskUnitComposite@main
with:
asterisk_repo: ${{env.ASTERISK_REPO}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{env.BRANCH}}
unittest_command: ${{env.UNITTEST_COMMAND}}
PRSGateTestMatrix:
runs-on: ubuntu-latest
needs: PRSGetControlData
continue-on-error: false
strategy:
fail-fast: false
matrix:
group: ${{ fromJSON(fromJSON(needs.PRSGetControlData.outputs.control_data).GATETEST_LIST) }}
env:
TESTSUITE_REPO: "${{ fromJSON(needs.PRSGetControlData.outputs.control_data).TESTSUITE_REPO }}"
GATETEST_COMMANDS: "${{ fromJSON(needs.PRSGetControlData.outputs.control_data).GATETEST_COMMANDS }}"
GATETEST_COMMAND: "${{ toJSON(fromJSON(fromJSON(needs.PRSGetControlData.outputs.control_data).GATETEST_COMMANDS)[matrix.group]) }}"
steps:
- id: runtest
name: Run Gate Tests for ${{ matrix.group }}
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
with:
test_type: Gate
asterisk_repo: ${{env.ASTERISK_REPO}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{env.BRANCH}}
testsuite_repo: ${{env.TESTSUITE_REPO}}
gatetest_group: ${{matrix.group}}
gatetest_command: ${{env.GATETEST_COMMAND}}
PRSTestResults:
if: always()
runs-on: ubuntu-latest
needs: [PRSUnitTests,PRSGateTestMatrix]
steps:
- name: Check test matrix status
env:
RESULT_UNIT: ${{ needs.PRSUnitTests.result }}
RESULT_GATE: ${{ needs.PRSGateTestMatrix.result }}
run: |
declare -i rc=0
echo "all results: ${{ toJSON(needs.*.result) }}"
case $RESULT_UNIT in
success)
echo "::notice::Unit tests passed"
;;
skipped)
echo "::error::Unit tests were skipped because of an earlier failure"
rc+=1
;;
*)
echo "::error::One or more unit tests failed ($RESULT_UNIT)"
rc+=1
esac
case $RESULT_GATE in
success)
echo "::notice::Gate tests passed"
;;
skipped)
echo "::error::Gate tests were skipped because of an earlier failure"
rc+=1
;;
*)
echo "::error::One or more gate tests failed ($RESULT_GATE)"
rc+=1
esac
echo "::notice::Final result code: $rc"
exit $rc

View File

@ -1,6 +1,5 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Asterisk Release
run-name: ${{ github.actor }} is creating Asterisk release ${{inputs.new_version}}
name: Releaser
run-name: ${{ github.actor }} is creating ${{vars.PRODUCT_NAME}} release ${{inputs.new_version}}
on:
workflow_dispatch:
inputs:
@ -12,13 +11,6 @@ on:
certified-20.4-cert1-rc1, certified-20.4-cert1
required: true
type: string
# start_version:
# description: |
# Last Version:
# Only use when you KNOW that the automated
# process won't get it right.
# required: false
# type: string
is_security:
description: |
Security?
@ -40,6 +32,12 @@ on:
required: true
type: boolean
default: false
force_cherry_pick:
description: |
Force cherry-pick for non-RC1 releases? USE WITH CAUTION!
required: true
type: boolean
default: false
push_release_branches:
description: |
Push release branches live?
@ -70,31 +68,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Run Releaser
uses: asterisk/asterisk-ci-actions/AsteriskReleaserComposite@main
uses: asterisk/asterisk-ci-actions/ReleaserComposite@main
with:
product: ${{vars.PRODUCT_NAME}}
is_security: ${{inputs.is_security}}
advisories: ${{inputs.advisories}}
is_hotfix: ${{inputs.is_hotfix}}
new_version: ${{inputs.new_version}}
# start_version: ${{inputs.start_version}}
force_cherry_pick: ${{inputs.force_cherry_pick}}
push_release_branches: ${{inputs.push_release_branches}}
create_github_release: ${{inputs.create_github_release}}
push_tarballs: ${{inputs.push_tarballs}}
send_email: ${{inputs.send_email}}
repo: ${{github.repository}}
asterisk_mail_list_ga: ${{vars.ASTERISK_MAIL_LIST_GA}}
asterisk_mail_list_rc: ${{vars.ASTERISK_MAIL_LIST_RC}}
asterisk_mail_list_cert_ga: ${{vars.ASTERISK_MAIL_LIST_CERT_GA}}
asterisk_mail_list_cert_rc: ${{vars.ASTERISK_MAIL_LIST_CERT_RC}}
asterisk_mail_list_sec: ${{vars.ASTERISK_MAIL_LIST_SEC_ADV}}
sec_adv_url_base: ${{vars.ASTERISK_SEC_ADV_URL_BASE}}
mail_list_ga: ${{vars.MAIL_LIST_GA}}
mail_list_rc: ${{vars.MAIL_LIST_RC}}
mail_list_cert_ga: ${{vars.MAIL_LIST_CERT_GA}}
mail_list_cert_rc: ${{vars.MAIL_LIST_CERT_RC}}
mail_list_sec: ${{vars.MAIL_LIST_SEC_ADV}}
sec_adv_url_base: ${{vars.SEC_ADV_URL_BASE}}
gpg_private_key: ${{secrets.ASTDEV_GPG_PRIV_KEY}}
github_token: ${{secrets.GITHUB_TOKEN}}
application_id: ${{secrets.ASTERISK_ORG_ACCESS_APP_ID}}
application_private_key: ${{secrets.ASTERISK_ORG_ACCESS_APP_PRIV_KEY}}
asteriskteamsa_username: ${{secrets.ASTERISKTEAMSA_GMAIL_ACCT}}
asteriskteamsa_token: ${{secrets.ASTERISKTEAMSA_GMAIL_TOKEN}}
deploy_ssh_priv_key: ${{secrets.ASTERISK_DEPLOY_SSH_PRIV_KEY}}
deploy_ssh_username: ${{secrets.ASTERISK_DEPLOY_SSH_USERNAME}}
deploy_host: ${{vars.ASTERISK_DEPLOY_HOST}}
deploy_dir: ${{vars.ASTERISK_DEPLOY_DIR}}
deploy_ssh_priv_key: ${{secrets.DOWNLOADS_DEPLOY_SSH_PRIV_KEY}}
deploy_ssh_username: ${{secrets.DOWNLOADS_DEPLOY_SSH_USERNAME}}
deploy_host: ${{vars.DEPLOY_HOST}}
deploy_dir: ${{vars.DEPLOY_DIR}}

1
.version Normal file
View File

@ -0,0 +1 @@
21.2.0

2
BUGS
View File

@ -10,7 +10,7 @@ For more information on using the bug tracker, or to
learn how you can contribute by acting as a bug marshal
please see:
https://wiki.asterisk.org/wiki/x/RgAtAQ
https://docs.asterisk.org/Asterisk-Community/Asterisk-Issue-Guidelines/
If you would like to submit a feature request, please
resist the temptation to post it to the bug tracker.

1
CHANGES.md Symbolic link
View File

@ -0,0 +1 @@
ChangeLogs/ChangeLog-21.2.0.md

View File

@ -0,0 +1,766 @@
Change Log for Release asterisk-21.0.0
========================================
Links:
----------------------------------------
- [Full ChangeLog](https://downloads.asterisk.org/pub/telephony/asterisk/releases/ChangeLog-21.0.0.md)
- [GitHub Diff](https://github.com/asterisk/asterisk/compare/21.0.0-pre1...21.0.0)
- [Tarball](https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-21.0.0.tar.gz)
- [Downloads](https://downloads.asterisk.org/pub/telephony/asterisk)
Summary:
----------------------------------------
- Update master branch for Asterisk 21
- translate.c: Prefer better codecs upon translate ties.
- chan_skinny: Remove deprecated module.
- app_osplookup: Remove deprecated module.
- chan_mgcp: Remove deprecated module.
- chan_alsa: Remove deprecated module.
- pbx_builtins: Remove deprecated and defunct functionality.
- chan_sip: Remove deprecated module.
- app_cdr: Remove deprecated application and option.
- app_macro: Remove deprecated module.
- res_monitor: Remove deprecated module.
- http.c: Minor simplification to HTTP status output.
- app_osplookup: Remove obsolete sample config.
- say.c: Fix French time playback. (#42)
- core: Cleanup gerrit and JIRA references. (#58)
- utils.h: Deprecate `ast_gethostbyname()`. (#79)
- res_pjsip_pubsub: Add new pubsub module capabilities. (#82)
- app_sla: Migrate SLA applications out of app_meetme.
- rest-api: Ran make ari stubs to fix resource_endpoints inconsistency
- .github: Update AsteriskReleaser for security releases
- users.conf: Deprecate users.conf configuration.
- Update version for Asterisk 21
- Remove unneeded CHANGES and UPGRADE files
- res_pjsip_pubsub: Add body_type to test_handler for unit tests
- ari-stubs: Fix more local anchor references
- ari-stubs: Fix more local anchor references
- ari-stubs: Fix broken documentation anchors
- res_pjsip_session: Send Session Interval too small response
- .github: Update workflow-application-token-action to v2
- app_dial: Fix infinite loop when sending digits.
- app_voicemail: Fix for loop declarations
- alembic: Fix quoting of the 100rel column
- pbx.c: Fix gcc 12 compiler warning.
- app_audiosocket: Fixed timeout with -1 to avoid busy loop.
- download_externals: Fix a few version related issues
- main/refer.c: Fix double free in refer_data_destructor + potential leak
- sig_analog: Add Called Subscriber Held capability.
- Revert "app_stack: Print proper exit location for PBXless channels."
- install_prereq: Fix dependency install on aarch64.
- res_pjsip.c: Set contact_user on incoming call local Contact header
- extconfig: Allow explicit DB result set ordering to be disabled.
- rest-api: Run make ari-stubs
- res_pjsip_header_funcs: Make prefix argument optional.
- pjproject_bundled: Increase PJSIP_MAX_MODULE to 38
- manager: Tolerate stasis messages with no channel snapshot.
- Remove unneeded CHANGES and UPGRADE files
User Notes:
----------------------------------------
- ### sig_analog: Add Called Subscriber Held capability.
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.
- ### res_pjsip_header_funcs: Make prefix argument optional.
The prefix argument to PJSIP_HEADERS is now
optional. If not specified, all header names will be
returned.
- ### http.c: Minor simplification to HTTP status output.
For bound addresses, the HTTP status page now combines the bound
address and bound port in a single line. Additionally, the SSL bind
address has been renamed to TLS.
Upgrade Notes:
----------------------------------------
- ### utils.h: Deprecate `ast_gethostbyname()`. (#79)
ast_gethostbyname() has been deprecated and will be removed
in Asterisk 23. New code should use `ast_sockaddr_resolve()` and
`ast_sockaddr_resolve_first_af()`.
- ### app_sla: Migrate SLA applications out of app_meetme.
The SLAStation and SLATrunk applications have been moved
from app_meetme to app_sla. If you are using these applications and have
autoload=no, you will need to explicitly load this module in modules.conf.
- ### users.conf: Deprecate users.conf configuration.
The users.conf config is now deprecated
and will be removed in a future version of Asterisk.
- ### res_monitor: Remove deprecated module.
This module was deprecated in Asterisk 16
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
This also removes the 'w' and 'W' options
for app_queue.
MixMonitor should be default and only option
for all settings that previously used either
Monitor or MixMonitor.
- ### app_osplookup: Remove deprecated module.
This module was deprecated in Asterisk 19
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### app_cdr: Remove deprecated application and option.
The previously deprecated NoCDR application has been removed.
Additionally, the previously deprecated 'e' option to the ResetCDR
application has been removed.
- ### app_macro: Remove deprecated module.
This module was deprecated in Asterisk 16
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
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.
The following modules have additional impacts:
app_dial - no longer supports M^ connected/redirecting macro
app_minivm - samples written using macro will no longer work.
The sample needs to be re-written
app_queue - can no longer call 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 options
pbx - removed macrolock
pbx_dundi - no longer look for macro
snmp - removed macro context, exten, and priority
- ### translate.c: Prefer better codecs upon translate ties.
When setting up translation between two codecs the quality was not taken into account,
resulting in suboptimal translation. The quality is now taken into account,
which can reduce the number of translation steps required, and improve the resulting quality.
- ### chan_sip: Remove deprecated module.
This module was deprecated in Asterisk 17
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### chan_alsa: Remove deprecated module.
This module was deprecated in Asterisk 19
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### pbx_builtins: Remove deprecated and defunct functionality.
The previously deprecated ImportVar and SetAMAFlags
applications have now been removed.
- ### chan_mgcp: Remove deprecated module.
This module was deprecated in Asterisk 19
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### chan_skinny: Remove deprecated module.
This module was deprecated in Asterisk 19
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
Closed Issues:
----------------------------------------
- #37: [Bug]: contrib/scripts/install_prereq tries to install armhf packages on aarch64 Debian platforms
- #39: [Bug]: Remove .gitreview from repository.
- #41: [Bug]: say.c Time announcement does not say o'clock for the French language
- #50: [improvement]: app_sla: Migrate SLA applications from app_meetme
- #78: [improvement]: Deprecate ast_gethostbyname()
- #81: [improvement]: Enhance and add additional PJSIP pubsub callbacks
- #179: [bug]: Queue strategy “Linear” with Asterisk 20 on Realtime
- #183: [deprecation]: Deprecate users.conf
- #226: [improvement]: Apply contact_user to incoming calls
- #230: [bug]: PJSIP_RESPONSE_HEADERS function documentation is misleading
- #240: [new-feature]: sig_analog: Add Called Subscriber Held capability
- #253: app_gosub patch appear to have broken predial handlers that utilize macros that call gosubs
- #255: [bug]: pjsip_endpt_register_module: Assertion "Too many modules registered"
- #263: [bug]: download_externals doesn't always handle versions correctly
- #267: [bug]: ari: refer with display_name key in request body leads to crash
- #274: [bug]: Syntax Error in SQL Code
- #275: [bug]:Asterisk make now requires ASTCFLAGS='-std=gnu99 -Wdeclaration-after-statement'
- #277: [bug]: pbx.c: Compiler error with gcc 12.2
- #281: [bug]: app_dial: Infinite loop if called channel hangs up while receiving digits
- #335: [bug]: res_pjsip_pubsub: The bad_event unit test causes a SEGV in build_resource_tree
Commits By Author:
----------------------------------------
- ### Asterisk Development Team (1):
- Update for 21.0.0-rc1
- ### Bastian Triller (1):
- res_pjsip_session: Send Session Interval too small response
- ### George Joseph (9):
- Remove unneeded CHANGES and UPGRADE files
- pjproject_bundled: Increase PJSIP_MAX_MODULE to 38
- rest-api: Run make ari-stubs
- download_externals: Fix a few version related issues
- alembic: Fix quoting of the 100rel column
- .github: Update workflow-application-token-action to v2
- ari-stubs: Fix broken documentation anchors
- ari-stubs: Fix more local anchor references
- ari-stubs: Fix more local anchor references
- ### Jason D. McCormick (1):
- install_prereq: Fix dependency install on aarch64.
- ### Joshua C. Colp (1):
- manager: Tolerate stasis messages with no channel snapshot.
- ### Matthew Fredrickson (1):
- Revert "app_stack: Print proper exit location for PBXless channels."
- ### Maximilian Fridrich (1):
- main/refer.c: Fix double free in refer_data_destructor + potential leak
- ### Mike Bradeen (1):
- app_voicemail: Fix for loop declarations
- ### MikeNaso (1):
- res_pjsip.c: Set contact_user on incoming call local Contact header
- ### Naveen Albert (4):
- res_pjsip_header_funcs: Make prefix argument optional.
- sig_analog: Add Called Subscriber Held capability.
- pbx.c: Fix gcc 12 compiler warning.
- app_dial: Fix infinite loop when sending digits.
- ### Sean Bright (1):
- extconfig: Allow explicit DB result set ordering to be disabled.
- ### zhengsh (1):
- app_audiosocket: Fixed timeout with -1 to avoid busy loop.
Detail:
----------------------------------------
- ### Update master branch for Asterisk 21
Author: George Joseph
Date: 2022-07-20
- ### translate.c: Prefer better codecs upon translate ties.
Author: Naveen Albert
Date: 2021-05-27
If multiple codecs are available for the same
resource and the translation costs between
multiple codecs are the same, ties are
currently broken arbitrarily, which means a
lower quality codec would be used. This forces
Asterisk to explicitly use the higher quality
codec, ceteris paribus.
ASTERISK-29455
- ### chan_skinny: Remove deprecated module.
Author: Mike Bradeen
Date: 2022-11-16
ASTERISK-30300
- ### app_osplookup: Remove deprecated module.
Author: Mike Bradeen
Date: 2022-11-18
ASTERISK-30302
- ### chan_mgcp: Remove deprecated module.
Author: Mike Bradeen
Date: 2022-11-15
Also removes res_pktcops to avoid merge conflicts
with ASTERISK~30301.
ASTERISK-30299
- ### chan_alsa: Remove deprecated module.
Author: Mike Bradeen
Date: 2022-11-14
ASTERISK-30298
- ### pbx_builtins: Remove deprecated and defunct functionality.
Author: Naveen Albert
Date: 2022-11-29
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
- ### chan_sip: Remove deprecated module.
Author: Mike Bradeen
Date: 2022-11-28
ASTERISK-30297
- ### app_cdr: Remove deprecated application and option.
Author: Naveen Albert
Date: 2022-12-22
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
- ### app_macro: Remove deprecated module.
Author: Mike Bradeen
Date: 2022-12-12
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
- ### res_monitor: Remove deprecated module.
Author: Mike Bradeen
Date: 2022-11-18
ASTERISK-30303
- ### http.c: Minor simplification to HTTP status output.
Author: Boris P. Korzun
Date: 2023-01-05
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
- ### app_osplookup: Remove obsolete sample config.
Author: Naveen Albert
Date: 2023-02-24
ASTERISK_30302 previously removed app_osplookup,
but its sample config was not removed.
This removes it since nothing else uses it.
ASTERISK-30438 #close
- ### say.c: Fix French time playback. (#42)
Author: InterLinked1
Date: 2023-05-02
ast_waitstream was not called after ast_streamfile,
resulting in "o'clock" being skipped in French.
Additionally, the minute announcements should be
feminine.
Reported-by: Danny Lloyd
Resolves: #41
ASTERISK-30488
- ### core: Cleanup gerrit and JIRA references. (#58)
Author: Sean Bright
Date: 2023-05-03
* Remove .gitreview and switch to pulling the main asterisk branch
version from configure.ac instead.
* Replace references to JIRA with GitHub.
* Other minor cleanup found along the way.
Resolves: #39
- ### utils.h: Deprecate `ast_gethostbyname()`. (#79)
Author: Sean Bright
Date: 2023-05-11
Deprecate `ast_gethostbyname()` in favor of `ast_sockaddr_resolve()` and
`ast_sockaddr_resolve_first_af()`. `ast_gethostbyname()` has not been
used by any in-tree code since 2021.
This function will be removed entirely in Asterisk 23.
Resolves: #78
UpgradeNote: ast_gethostbyname() has been deprecated and will be removed
in Asterisk 23. New code should use `ast_sockaddr_resolve()` and
`ast_sockaddr_resolve_first_af()`.
- ### res_pjsip_pubsub: Add new pubsub module capabilities. (#82)
Author: InterLinked1
Date: 2023-05-18
The existing res_pjsip_pubsub APIs are somewhat limited in
what they can do. This adds a few API extensions that make
it possible for PJSIP pubsub modules to implement richer
features than is currently possible.
* Allow pubsub modules to get a handle to pjsip_rx_data on subscription
* Allow pubsub modules to run a callback when a subscription is renewed
* Allow pubsub modules to run a callback for outgoing NOTIFYs, with
a handle to the tdata, so that modules can append their own headers
to the NOTIFYs
This change does not add any features directly, but makes possible
several new features that will be added in future changes.
Resolves: #81
ASTERISK-30485 #close
Master-Only: True
- ### app_sla: Migrate SLA applications out of app_meetme.
Author: Naveen Albert
Date: 2023-05-02
This removes the dependency of the SLAStation and SLATrunk
applications on app_meetme, in anticipation of the imminent
removal of the deprecated app_meetme module.
The user interface for the SLA applications is exactly the
same, and in theory, users should not notice a difference.
However, the SLA applications now use ConfBridge under the
hood, rather than MeetMe, and they are now contained within
their own module.
Resolves: #50
ASTERISK-30309
UpgradeNote: The SLAStation and SLATrunk applications have been moved
from app_meetme to app_sla. If you are using these applications and have
autoload=no, you will need to explicitly load this module in modules.conf.
- ### rest-api: Ran make ari stubs to fix resource_endpoints inconsistency
Author: George Joseph
Date: 2023-06-27
- ### .github: Update AsteriskReleaser for security releases
Author: George Joseph
Date: 2023-07-07
- ### users.conf: Deprecate users.conf configuration.
Author: Naveen Albert
Date: 2023-06-30
This deprecates the users.conf config file, which
is no longer as widely supported but still integrated
with a number of different modules.
Because there is no real mechanism for marking a
configuration file as "deprecated", and users.conf
is not just used in a single place, this now emits
a warning to the user when the PBX loads to notify
about the deprecation.
This configuration mechanism has been widely criticized
and discouraged since its inception, and is no longer
relevant to the configuration that most users are doing
today. Removing it will allow for some simplification
and cleanup in the codebase.
Resolves: #183
UpgradeNote: The users.conf config is now deprecated
and will be removed in a future version of Asterisk.
- ### Update version for Asterisk 21
Author: George Joseph
Date: 2023-08-09
- ### Remove unneeded CHANGES and UPGRADE files
Author: George Joseph
Date: 2023-08-09
- ### res_pjsip_pubsub: Add body_type to test_handler for unit tests
Author: George Joseph
Date: 2023-09-15
The ast_sip_subscription_handler "test_handler" used for the unit
tests didn't set "body_type" so the NULL value was causing
a SEGV in build_subscription_tree(). It's now set to "".
Resolves: #335
- ### ari-stubs: Fix more local anchor references
Author: George Joseph
Date: 2023-09-05
Also allow CreateDocs job to be run manually with default branches.
- ### ari-stubs: Fix more local anchor references
Author: George Joseph
Date: 2023-09-05
Also allow CreateDocs job to be run manually with default branches.
- ### ari-stubs: Fix broken documentation anchors
Author: George Joseph
Date: 2023-09-05
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.
- ### res_pjsip_session: Send Session Interval too small response
Author: Bastian Triller
Date: 2023-08-28
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.
- ### .github: Update workflow-application-token-action to v2
Author: George Joseph
Date: 2023-08-31
- ### app_dial: Fix infinite loop when sending digits.
Author: Naveen Albert
Date: 2023-08-28
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
- ### app_voicemail: Fix for loop declarations
Author: Mike Bradeen
Date: 2023-08-29
Resolve for loop initial declarations added in cli changes.
Resolves: #275
- ### alembic: Fix quoting of the 100rel column
Author: George Joseph
Date: 2023-08-28
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
- ### pbx.c: Fix gcc 12 compiler warning.
Author: Naveen Albert
Date: 2023-08-27
Resolves: #277
- ### app_audiosocket: Fixed timeout with -1 to avoid busy loop.
Author: zhengsh
Date: 2023-08-24
Resolves: asterisk#234
- ### download_externals: Fix a few version related issues
Author: George Joseph
Date: 2023-08-18
* 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
- ### main/refer.c: Fix double free in refer_data_destructor + potential leak
Author: Maximilian Fridrich
Date: 2023-08-21
Resolves: #267
- ### sig_analog: Add Called Subscriber Held capability.
Author: Naveen Albert
Date: 2023-08-09
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.
- ### Revert "app_stack: Print proper exit location for PBXless channels."
Author: Matthew Fredrickson
Date: 2023-08-10
This reverts commit 617dad4cba1513dddce87b8e95a61415fb587cf1.
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
- ### install_prereq: Fix dependency install on aarch64.
Author: Jason D. McCormick
Date: 2023-04-28
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
- ### res_pjsip.c: Set contact_user on incoming call local Contact header
Author: MikeNaso
Date: 2023-08-08
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
- ### extconfig: Allow explicit DB result set ordering to be disabled.
Author: Sean Bright
Date: 2023-07-12
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
- ### rest-api: Run make ari-stubs
Author: George Joseph
Date: 2023-08-09
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.
- ### res_pjsip_header_funcs: Make prefix argument optional.
Author: Naveen Albert
Date: 2023-08-09
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.
- ### pjproject_bundled: Increase PJSIP_MAX_MODULE to 38
Author: George Joseph
Date: 2023-08-11
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
- ### manager: Tolerate stasis messages with no channel snapshot.
Author: Joshua C. Colp
Date: 2023-08-09
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.
- ### Remove unneeded CHANGES and UPGRADE files
Author: George Joseph
Date: 2023-08-09

View File

@ -0,0 +1,172 @@
Change Log for Release asterisk-21.0.1
========================================
Links:
----------------------------------------
- [Full ChangeLog](https://downloads.asterisk.org/pub/telephony/asterisk/releases/ChangeLog-21.0.1.md)
- [GitHub Diff](https://github.com/asterisk/asterisk/compare/21.0.0...21.0.1)
- [Tarball](https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-21.0.1.tar.gz)
- [Downloads](https://downloads.asterisk.org/pub/telephony/asterisk)
Summary:
----------------------------------------
- res_pjsip_header_funcs: Duplicate new header value, don't copy.
- res_pjsip: disable raw bad packet logging
- res_rtp_asterisk.c: Check DTLS packets against ICE candidate list
- manager.c: Prevent path traversal with GetConfig.
User Notes:
----------------------------------------
- ### http.c: Minor simplification to HTTP status output.
For bound addresses, the HTTP status page now combines the bound
address and bound port in a single line. Additionally, the SSL bind
address has been renamed to TLS.
Upgrade Notes:
----------------------------------------
- ### chan_sip: Remove deprecated module.
This module was deprecated in Asterisk 17
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### res_monitor: Remove deprecated module.
This module was deprecated in Asterisk 16
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
This also removes the 'w' and 'W' options
for app_queue.
MixMonitor should be default and only option
for all settings that previously used either
Monitor or MixMonitor.
- ### app_osplookup: Remove deprecated module.
This module was deprecated in Asterisk 19
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### app_cdr: Remove deprecated application and option.
The previously deprecated NoCDR application has been removed.
Additionally, the previously deprecated 'e' option to the ResetCDR
application has been removed.
- ### chan_skinny: Remove deprecated module.
This module was deprecated in Asterisk 19
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### chan_mgcp: Remove deprecated module.
This module was deprecated in Asterisk 19
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### translate.c: Prefer better codecs upon translate ties.
When setting up translation between two codecs the quality was not taken into account,
resulting in suboptimal translation. The quality is now taken into account,
which can reduce the number of translation steps required, and improve the resulting quality.
- ### app_macro: Remove deprecated module.
This module was deprecated in Asterisk 16
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
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.
The following modules have additional impacts:
app_dial - no longer supports M^ connected/redirecting macro
app_minivm - samples written using macro will no longer work.
The sample needs to be re-written
app_queue - can no longer call 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 options
pbx - removed macrolock
pbx_dundi - no longer look for macro
snmp - removed macro context, exten, and priority
- ### chan_alsa: Remove deprecated module.
This module was deprecated in Asterisk 19
and is now being removed in accordance with
the Asterisk Module Deprecation policy.
- ### pbx_builtins: Remove deprecated and defunct functionality.
The previously deprecated ImportVar and SetAMAFlags
applications have now been removed.
Closed Issues:
----------------------------------------
None
Commits By Author:
----------------------------------------
- ### Ben Ford (1):
- manager.c: Prevent path traversal with GetConfig.
- ### George Joseph (1):
- res_rtp_asterisk.c: Check DTLS packets against ICE candidate list
- ### Gitea (1):
- res_pjsip_header_funcs: Duplicate new header value, don't copy.
- ### Mike Bradeen (1):
- res_pjsip: disable raw bad packet logging
Detail:
----------------------------------------
- ### res_pjsip_header_funcs: Duplicate new header value, don't copy.
Author: Gitea
Date: 2023-07-10
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.
- ### res_pjsip: disable raw bad packet logging
Author: Mike Bradeen
Date: 2023-07-25
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.
- ### res_rtp_asterisk.c: Check DTLS packets against ICE candidate list
Author: George Joseph
Date: 2023-11-09
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
- ### manager.c: Prevent path traversal with GetConfig.
Author: Ben Ford
Date: 2023-11-13
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.

View File

@ -0,0 +1,68 @@
Change Log for Release asterisk-21.0.2
========================================
Links:
----------------------------------------
- [Full ChangeLog](https://downloads.asterisk.org/pub/telephony/asterisk/releases/ChangeLog-21.0.2.md)
- [GitHub Diff](https://github.com/asterisk/asterisk/compare/21.0.1...21.0.2)
- [Tarball](https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-21.0.2.tar.gz)
- [Downloads](https://downloads.asterisk.org/pub/telephony/asterisk)
Summary:
----------------------------------------
- res_rtp_asterisk: Fix regression issues with DTLS client check
User Notes:
----------------------------------------
Upgrade Notes:
----------------------------------------
Closed Issues:
----------------------------------------
- #500: [bug regression]: res_rtp_asterisk doesn't build if pjproject isn't used
- #503: [bug]: The res_rtp_asterisk DTLS check against ICE candidates fails when it shouldn't
- #505: [bug]: res_pjproject: ast_sockaddr_cmp() always fails on sockaddrs created by ast_sockaddr_from_pj_sockaddr()
Commits By Author:
----------------------------------------
- ### George Joseph (1):
- res_rtp_asterisk: Fix regression issues with DTLS client check
Detail:
----------------------------------------
- ### res_rtp_asterisk: Fix regression issues with DTLS client check
Author: George Joseph
Date: 2023-12-15
* 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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,766 @@
Change Log for Release asterisk-21.2.0
========================================
Links:
----------------------------------------
- [Full ChangeLog](https://downloads.asterisk.org/pub/telephony/asterisk/releases/ChangeLog-21.2.0.md)
- [GitHub Diff](https://github.com/asterisk/asterisk/compare/21.1.0...21.2.0)
- [Tarball](https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-21.2.0.tar.gz)
- [Downloads](https://downloads.asterisk.org/pub/telephony/asterisk)
Summary:
----------------------------------------
- res_pjsip_stir_shaken.c: Add checks for missing parameters
- app_dial: Add dial time for progress/ringing.
- app_voicemail: Properly reinitialize config after unit tests.
- app_queue.c : fix "queue add member" usage string
- app_voicemail: Allow preventing mark messages as urgent.
- res_pjsip: Use consistent type for boolean columns.
- attestation_config.c: Use ast_free instead of ast_std_free
- Makefile: Add stir_shaken/cache to directories created on install
- Stir/Shaken Refactor
- translate.c: implement new direct comp table mode
- README.md: Removed outdated link
- strings.h: Ensure ast_str_buffer(…) returns a 0 terminated string.
- res_rtp_asterisk.c: Correct coefficient in MOS calculation.
- dsp.c: Fix and improve potentially inaccurate log message.
- pjsip show channelstats: Prevent possible segfault when faxing
- Reduce startup/shutdown verbose logging
- configure: Rerun bootstrap on modern platform.
- Upgrade bundled pjproject to 2.14.
- res_pjsip_outbound_registration.c: Add User-Agent header override
- app_speech_utils.c: Allow partial speech results.
- utils: Make behavior of ast_strsep* match strsep.
- app_chanspy: Add 'D' option for dual-channel audio
- app_if: Fix next priority calculation.
- res_pjsip_t38.c: Permit IPv6 SDP connection addresses.
- BuildSystem: Bump autotools versions on OpenBSD.
- main/utils: Simplify the FreeBSD ast_get_tid() handling
- res_pjsip_session.c: Correctly format SDP connection addresses.
- rtp_engine.c: Correct sample rate typo for L16/44100.
- manager.c: Fix erroneous reloads in UpdateConfig.
- res_calendar_icalendar: Print iCalendar error on parsing failure.
- app_confbridge: Don't emit warnings on valid configurations.
- app_voicemail_odbc: remove macrocontext from voicemail_messages table
- chan_dahdi: Allow MWI to be manually toggled on channels.
- chan_rtp.c: MulticastRTP missing refcount without codec option
- chan_rtp.c: Change MulticastRTP nameing to avoid memory leak
- func_frame_trace: Add CLI command to dump frame queue.
User Notes:
----------------------------------------
- ### app_dial: Add dial time for progress/ringing.
The timeout argument to Dial now allows
specifying the maximum amount of time to dial if
early media is not received.
- ### app_voicemail: Allow preventing mark messages as urgent.
The leaveurgent mailbox option can now be used to
control whether callers may leave messages marked as 'Urgent'.
- ### Stir/Shaken Refactor
Asterisk's stir-shaken feature has been refactored to
correct interoperability, RFC compliance, and performance issues.
See https://docs.asterisk.org/Deployment/STIR-SHAKEN for more
information.
- ### Upgrade bundled pjproject to 2.14.
Bundled pjproject has been upgraded to 2.14. For more
information on what all is included in this change, check out the
pjproject Github page: https://github.com/pjsip/pjproject/releases
- ### res_pjsip_outbound_registration.c: Add User-Agent header override
PJSIP outbound registrations now support a per-registration
User-Agent header
- ### app_speech_utils.c: Allow partial speech results.
The SpeechBackground dialplan application now supports a 'p'
option that will return partial results from speech engines that
provide them when a timeout occurs.
- ### app_chanspy: Add 'D' option for dual-channel audio
The ChanSpy application now accepts the 'D' option which
will interleave the spied audio within the outgoing frames. The
purpose of this is to allow the audio to be read as a Dual channel
stream with separate incoming and outgoing audio. Setting both the
'o' option and the 'D' option and results in the 'D' option being
ignored.
- ### app_voicemail_odbc: remove macrocontext from voicemail_messages table
The fix requires removing the macrocontext column from the
voicemail_messages table in the voicemail database via alembic upgrade.
- ### chan_dahdi: Allow MWI to be manually toggled on channels.
The 'dahdi set mwi' now allows MWI on channels
to be manually toggled if needed for troubleshooting.
Resolves: #440
Upgrade Notes:
----------------------------------------
- ### Stir/Shaken Refactor
The stir-shaken refactor is a breaking change but since
it's not working now we don't think it matters. The
stir_shaken.conf file has changed significantly which means that
existing ones WILL need to be changed. The stir_shaken.conf.sample
file in configs/samples/ has quite a bit more information. This is
also an ABI breaking change since some of the existing objects
needed to be changed or removed, and new ones added. Additionally,
if res_stir_shaken is enabled in menuselect, you'll need to either
have the development package for libjwt v1.15.3 installed or use
the --with-libjwt-bundled option with ./configure.
- ### app_voicemail_odbc: remove macrocontext from voicemail_messages table
The fix requires that the voicemail database be upgraded via
alembic. Upgrading to the latest voicemail database via alembic will
remove the macrocontext column from the voicemail_messages table.
Closed Issues:
----------------------------------------
- #46: [bug]: Stir/Shaken: Wrong CID used when looking up certificates
- #351: [improvement]: Refactor res_stir_shaken to use libjwt
- #406: [improvement]: pjsip: Upgrade bundled version to pjproject 2.14
- #440: [new-feature]: chan_dahdi: Allow manually toggling MWI on channels
- #492: [improvement]: res_calendar_icalendar: Print icalendar error if available on parsing failure
- #515: [improvement]: Implement option to override User-Agent-Header on a per-registration basis
- #527: [bug]: app_voicemail_odbc no longer working after removal of macrocontext.
- #529: [bug]: MulticastRTP without selected codec leeds to "FRACK!, Failed assertion bad magic number 0x0 for object" after ~30 calls
- #533: [improvement]: channel.c, func_frame_trace.c: Improve debuggability of channel frame queue
- #551: [bug]: manager: UpdateConfig triggers reload with "Reload: no"
- #560: [bug]: EndIf() causes next priority to be skipped
- #565: [bug]: Application Read() returns immediately
- #569: [improvement]: Add option to interleave input and output frames on spied channel
- #572: [improvement]: Copy partial speech results when Asterisk is ready to move on but the speech backend is not
- #582: [improvement]: Reduce unneeded logging during startup and shutdown
- #586: [bug]: The "restrict" keyword used in chan_iax2.c isn't supported in older gcc versions
- #588: [new-feature]: app_dial: Allow Dial to be aborted if early media is not received
- #592: [bug]: In certain circumstances, "pjsip show channelstats" can segfault when a fax session is active
- #595: [improvement]: dsp.c: Fix and improve confusing warning message.
- #597: [bug]: wrong MOS calculation
- #601: [new-feature]: translate.c: implement new direct comp table mode (PR #585)
- #619: [new-feature]: app_voicemail: Allow preventing callers from marking messages as urgent
- #629: [bug]: app_voicemail: Multiple executions of unit tests cause segfault
- #634: [bug]: make install doesn't create the stir_shaken cache directory
- #636: [bug]: Possible SEGV in res_stir_shaken due to wrong free function
- #645: [bug]: Occasional SEGV in res_pjsip_stir_shaken.c
Commits By Author:
----------------------------------------
- ### Ben Ford (1):
- Upgrade bundled pjproject to 2.14.
- ### Brad Smith (2):
- main/utils: Simplify the FreeBSD ast_get_tid() handling
- BuildSystem: Bump autotools versions on OpenBSD.
- ### Flole998 (1):
- res_pjsip_outbound_registration.c: Add User-Agent header override
- ### George Joseph (6):
- Reduce startup/shutdown verbose logging
- pjsip show channelstats: Prevent possible segfault when faxing
- Stir/Shaken Refactor
- Makefile: Add stir_shaken/cache to directories created on install
- attestation_config.c: Use ast_free instead of ast_std_free
- res_pjsip_stir_shaken.c: Add checks for missing parameters
- ### Joshua C. Colp (1):
- utils: Make behavior of ast_strsep* match strsep.
- ### Mike Bradeen (2):
- app_voicemail_odbc: remove macrocontext from voicemail_messages table
- app_chanspy: Add 'D' option for dual-channel audio
- ### Naveen Albert (10):
- func_frame_trace: Add CLI command to dump frame queue.
- chan_dahdi: Allow MWI to be manually toggled on channels.
- res_calendar_icalendar: Print iCalendar error on parsing failure.
- manager.c: Fix erroneous reloads in UpdateConfig.
- app_if: Fix next priority calculation.
- configure: Rerun bootstrap on modern platform.
- dsp.c: Fix and improve potentially inaccurate log message.
- app_voicemail: Allow preventing mark messages as urgent.
- app_voicemail: Properly reinitialize config after unit tests.
- app_dial: Add dial time for progress/ringing.
- ### PeterHolik (2):
- chan_rtp.c: Change MulticastRTP nameing to avoid memory leak
- chan_rtp.c: MulticastRTP missing refcount without codec option
- ### Sean Bright (6):
- app_confbridge: Don't emit warnings on valid configurations.
- rtp_engine.c: Correct sample rate typo for L16/44100.
- res_pjsip_session.c: Correctly format SDP connection addresses.
- res_pjsip_t38.c: Permit IPv6 SDP connection addresses.
- strings.h: Ensure ast_str_buffer(…) returns a 0 terminated string.
- res_pjsip: Use consistent type for boolean columns.
- ### Sebastian Jennen (1):
- translate.c: implement new direct comp table mode
- ### Shaaah (1):
- app_queue.c : fix "queue add member" usage string
- ### Shyju Kanaprath (1):
- README.md: Removed outdated link
- ### cmaj (1):
- app_speech_utils.c: Allow partial speech results.
- ### romryz (1):
- res_rtp_asterisk.c: Correct coefficient in MOS calculation.
Detail:
----------------------------------------
- ### res_pjsip_stir_shaken.c: Add checks for missing parameters
Author: George Joseph
Date: 2024-03-11
* Added checks for missing session, session->channel and rdata
in stir_shaken_incoming_request.
* Added checks for missing session, session->channel and tdata
in stir_shaken_outgoing_request.
Resolves: #645
- ### app_dial: Add dial time for progress/ringing.
Author: Naveen Albert
Date: 2024-02-08
Add a timeout option to control the amount of time
to wait if no early media is received before giving
up. This allows aborting early if the destination
is not being responsive.
Resolves: #588
UserNote: The timeout argument to Dial now allows
specifying the maximum amount of time to dial if
early media is not received.
- ### app_voicemail: Properly reinitialize config after unit tests.
Author: Naveen Albert
Date: 2024-02-29
Most app_voicemail unit tests were not properly cleaning up
after themselves after running. This led to test mailboxes
lingering around in the system. It also meant that if any
unit tests in app_voicemail that create mailboxes were executed
and the module was not unloaded/loaded again prior to running
the test_voicemail_vm_info unit test, Asterisk would segfault
due to an attempt to copy a NULL string.
The load_config test did actually have logic to reinitialize
the config after the test. However, this did not work in practice
since load_config() would not reload the config since voicemail.conf
had not changed during the test; thus, additional logic has been
added to ensure that voicemail.conf is truly reloaded, after any
unit tests which modify the users list.
This prevents the SEGV due to invalid mailboxes lingering around,
and also ensures that the system state is restored to what it was
prior to the tests running.
Resolves: #629
- ### app_queue.c : fix "queue add member" usage string
Author: Shaaah
Date: 2024-01-23
Fixing bracket placement in the "queue add member" cli usage string.
- ### app_voicemail: Allow preventing mark messages as urgent.
Author: Naveen Albert
Date: 2024-02-24
This adds an option to allow preventing callers from leaving
messages marked as 'urgent'.
Resolves: #619
UserNote: The leaveurgent mailbox option can now be used to
control whether callers may leave messages marked as 'Urgent'.
- ### res_pjsip: Use consistent type for boolean columns.
Author: Sean Bright
Date: 2024-02-27
This migrates the relevant schema objects from the `('yes', 'no')`
definition to the `('0', '1', 'off', 'on', 'false', 'true', 'yes', 'no')`
one.
Fixes #617
- ### attestation_config.c: Use ast_free instead of ast_std_free
Author: George Joseph
Date: 2024-03-05
In as_check_common_config, we were calling ast_std_free on
raw_key but raw_key was allocated with ast_malloc so it
should be freed with ast_free.
Resolves: #636
- ### Makefile: Add stir_shaken/cache to directories created on install
Author: George Joseph
Date: 2024-03-04
The default location for the stir_shaken cache is
/var/lib/asterisk/keys/stir_shaken/cache but we were only creating
/var/lib/asterisk/keys/stir_shaken on istall. We now create
the cache sub-directory.
Resolves: #634
- ### Stir/Shaken Refactor
Author: George Joseph
Date: 2023-10-26
Why do we need a refactor?
The original stir/shaken implementation was started over 3 years ago
when little was understood about practical implementation. The
result was an implementation that wouldn't actually interoperate
with any other stir-shaken implementations.
There were also a number of stir-shaken features and RFC
requirements that were never implemented such as TNAuthList
certificate validation, sending Reason headers in SIP responses
when verification failed but we wished to continue the call, and
the ability to send Media Key(mky) grants in the Identity header
when the call involved DTLS.
Finally, there were some performance concerns around outgoing
calls and selection of the correct certificate and private key.
The configuration was keyed by an arbitrary name which meant that
for every outgoing call, we had to scan the entire list of
configured TNs to find the correct cert to use. With only a few
TNs configured, this wasn't an issue but if you have a thousand,
it could be.
What's changed?
* Configuration objects have been refactored to be clearer about
their uses and to fix issues.
* The "general" object was renamed to "verification" since it
contains parameters specific to the incoming verification
process. It also never handled ca_path and crl_path
correctly.
* A new "attestation" object was added that controls the
outgoing attestation process. It sets default certificates,
keys, etc.
* The "certificate" object was renamed to "tn" and had it's key
change to telephone number since outgoing call attestation
needs to look up certificates by telephone number.
* The "profile" object had more parameters added to it that can
override default parameters specified in the "attestation"
and "verification" objects.
* The "store" object was removed altogther as it was never
implemented.
* We now use libjwt to create outgoing Identity headers and to
parse and validate signatures on incoming Identiy headers. Our
previous custom implementation was much of the source of the
interoperability issues.
* General code cleanup and refactor.
* Moved things to better places.
* Separated some of the complex functions to smaller ones.
* Using context objects rather than passing tons of parameters
in function calls.
* Removed some complexity and unneeded encapsuation from the
config objects.
Resolves: #351
Resolves: #46
UserNote: Asterisk's stir-shaken feature has been refactored to
correct interoperability, RFC compliance, and performance issues.
See https://docs.asterisk.org/Deployment/STIR-SHAKEN for more
information.
UpgradeNote: The stir-shaken refactor is a breaking change but since
it's not working now we don't think it matters. The
stir_shaken.conf file has changed significantly which means that
existing ones WILL need to be changed. The stir_shaken.conf.sample
file in configs/samples/ has quite a bit more information. This is
also an ABI breaking change since some of the existing objects
needed to be changed or removed, and new ones added. Additionally,
if res_stir_shaken is enabled in menuselect, you'll need to either
have the development package for libjwt v1.15.3 installed or use
the --with-libjwt-bundled option with ./configure.
- ### translate.c: implement new direct comp table mode
Author: Sebastian Jennen
Date: 2024-02-25
The new mode lists for each codec translation the actual real cost in cpu microseconds per second translated audio.
This allows to compare the real cpu usage of translations and helps in evaluation of codec implementation changes regarding performance (regression testing).
- add new table mode
- hide the 999999 comp values, as these only indicate an issue with transcoding
- hide the 0 values, as these also do not contain any information (only indicate a multistep transcoding)
Resolves: #601
- ### README.md: Removed outdated link
Author: Shyju Kanaprath
Date: 2024-02-23
Removed outdated link http://www.quicknet.net from README.md
cherry-pick-to: 18
cherry-pick-to: 20
cherry-pick-to: 21
- ### strings.h: Ensure ast_str_buffer(…) returns a 0 terminated string.
Author: Sean Bright
Date: 2024-02-17
If a dynamic string is created with an initial length of 0,
`ast_str_buffer(…)` will return an invalid pointer.
This was a secondary discovery when fixing #65.
- ### res_rtp_asterisk.c: Correct coefficient in MOS calculation.
Author: romryz
Date: 2024-02-06
Media Experience Score relies on incorrect pseudo_mos variable
calculation. According to forming an opinion section of the
documentation, calculation relies on ITU-T G.107 standard:
https://docs.asterisk.org/Deployment/Media-Experience-Score/#forming-an-opinion
ITU-T G.107 Annex B suggests to calculate MOS with a coefficient
"seven times ten to the power of negative six", 7 * 10^(-6). which
would mean 6 digits after the decimal point. Current implementation
has 7 digits after the decimal point, which downrates the calls.
Fixes: #597
- ### dsp.c: Fix and improve potentially inaccurate log message.
Author: Naveen Albert
Date: 2024-02-09
If ast_dsp_process is called with a codec besides slin, ulaw,
or alaw, a warning is logged that in-band DTMF is not supported,
but this message is not always appropriate or correct, because
ast_dsp_process is much more generic than just DTMF detection.
This logs a more generic message in those cases, and also improves
codec-mismatch logging throughout dsp.c by ensuring incompatible
codecs are printed out.
Resolves: #595
- ### pjsip show channelstats: Prevent possible segfault when faxing
Author: George Joseph
Date: 2024-02-09
Under rare circumstances, it's possible for the original audio
session in the active_media_state default_session to be corrupted
instead of removed when switching to the t38/image media session
during fax negotiation. This can cause a segfault when a "pjsip
show channelstats" attempts to print that audio media session's
rtp statistics. In these cases, the active_media_state
topology is correctly showing only a single t38/image stream
so we now check that there's an audio stream in the topology
before attempting to use the audio media session to get the rtp
statistics.
Resolves: #592
- ### Reduce startup/shutdown verbose logging
Author: George Joseph
Date: 2024-01-31
When started with a verbose level of 3, asterisk can emit over 1500
verbose message that serve no real purpose other than to fill up
logs. When asterisk shuts down, it emits another 1100 that are of
even less use. Since the testsuite runs asterisk with a verbose
level of 3, and asterisk starts and stops for every one of the 700+
tests, the number of log messages is staggering. Besides taking up
resources, it also makes it hard to debug failing tests.
This commit changes the log level for those verbose messages to 5
instead of 3 which reduces the number of log messages to only a
handful. Of course, NOTICE, WARNING and ERROR message are
unaffected.
There's also one other minor change...
ast_context_remove_extension_callerid2() logs a DEBUG message
instead of an ERROR if the extension you're deleting doesn't exist.
The pjsip_config_wizard calls that function to clean up the config
and has been triggering that annoying error message for years.
Resolves: #582
- ### configure: Rerun bootstrap on modern platform.
Author: Naveen Albert
Date: 2024-02-12
The last time configure was run, it was run on a system that
did not enable -std=gnu11 by default, which meant that the
restrict qualifier would not be recognized on certain platforms.
This regenerates the configure files from running bootstrap.sh,
so that these should be recognized on all supported platforms.
Resolves: #586
- ### Upgrade bundled pjproject to 2.14.
Author: Ben Ford
Date: 2024-02-05
Fixes: #406
UserNote: Bundled pjproject has been upgraded to 2.14. For more
information on what all is included in this change, check out the
pjproject Github page: https://github.com/pjsip/pjproject/releases
- ### res_pjsip_outbound_registration.c: Add User-Agent header override
Author: Flole998
Date: 2023-12-13
This introduces a setting for outbound registrations to override the
global User-Agent header setting.
Resolves: #515
UserNote: PJSIP outbound registrations now support a per-registration
User-Agent header
- ### app_speech_utils.c: Allow partial speech results.
Author: cmaj
Date: 2024-02-02
Adds 'p' option to SpeechBackground() application.
With this option, when the app timeout is reached,
whatever the backend speech engine collected will
be returned as if it were the final, full result.
(This works for engines that make partial results.)
Resolves: #572
UserNote: The SpeechBackground dialplan application now supports a 'p'
option that will return partial results from speech engines that
provide them when a timeout occurs.
- ### utils: Make behavior of ast_strsep* match strsep.
Author: Joshua C. Colp
Date: 2024-01-31
Given the scenario of passing an empty string to the
ast_strsep functions the functions would return NULL
instead of an empty string. This is counter to how
strsep itself works.
This change alters the behavior of the functions to
match that of strsep.
Fixes: #565
- ### app_chanspy: Add 'D' option for dual-channel audio
Author: Mike Bradeen
Date: 2024-01-31
Adds the 'D' option to app chanspy that causes the input and output
frames of the spied channel to be interleaved in the spy output frame.
This allows the input and output of the spied channel to be decoded
separately by the receiver.
If the 'o' option is also set, the 'D' option is ignored as the
audio being spied is inherently one direction.
Fixes: #569
UserNote: The ChanSpy application now accepts the 'D' option which
will interleave the spied audio within the outgoing frames. The
purpose of this is to allow the audio to be read as a Dual channel
stream with separate incoming and outgoing audio. Setting both the
'o' option and the 'D' option and results in the 'D' option being
ignored.
- ### app_if: Fix next priority calculation.
Author: Naveen Albert
Date: 2024-01-28
Commit fa3922a4d28860d415614347d9f06c233d2beb07 fixed
a branching issue but "overshoots" when calculating
the next priority. This fixes that; accompanying
test suite tests have also been extended.
Resolves: #560
- ### res_pjsip_t38.c: Permit IPv6 SDP connection addresses.
Author: Sean Bright
Date: 2024-01-29
The existing code prevented IPv6 addresses from being properly parsed.
Fixes #558
- ### BuildSystem: Bump autotools versions on OpenBSD.
Author: Brad Smith
Date: 2024-01-27
Bump up to the more commonly used and modern versions of
autoconf and automake.
- ### main/utils: Simplify the FreeBSD ast_get_tid() handling
Author: Brad Smith
Date: 2024-01-27
FreeBSD has had kernel threads for 20+ years.
- ### res_pjsip_session.c: Correctly format SDP connection addresses.
Author: Sean Bright
Date: 2024-01-27
Resolves a regression identified by @justinludwig involving the
rendering of IPv6 addresses in outgoing SDP.
Also updates `media_address` on PJSIP endpoints so that if we are able
to parse the configured value as an IP we store it in a format that we
can directly use later. Based on my reading of the code it appeared
that one could configure `media_address` as:
```
[foo]
type = endpoint
...
media_address = [2001:db8::]
```
And that value would be blindly copied into the outgoing SDP without
regard to its format.
Fixes #541
- ### rtp_engine.c: Correct sample rate typo for L16/44100.
Author: Sean Bright
Date: 2024-01-28
Fixes #555
- ### manager.c: Fix erroneous reloads in UpdateConfig.
Author: Naveen Albert
Date: 2024-01-25
Currently, a reload will always occur if the
Reload header is provided for the UpdateConfig
action. However, we should not be doing a reload
if the header value has a falsy value, per the
documentation, so this makes the reload behavior
consistent with the existing documentation.
Resolves: #551
- ### res_calendar_icalendar: Print iCalendar error on parsing failure.
Author: Naveen Albert
Date: 2023-12-14
If libical fails to parse a calendar, print the error message it provdes.
Resolves: #492
- ### app_confbridge: Don't emit warnings on valid configurations.
Author: Sean Bright
Date: 2024-01-21
The numeric bridge profile options `internal_sample_rate` and
`maximum_sample_rate` are documented to accept the special values
`auto` and `none`, respectively. While these values currently work,
they also emit warnings when used which could be confusing for users.
In passing, also ensure that we only accept the documented range of
sample rate values between 8000 and 192000.
Fixes #546
- ### app_voicemail_odbc: remove macrocontext from voicemail_messages table
Author: Mike Bradeen
Date: 2024-01-10
When app_macro was deprecated, the macrocontext column was removed from
the INSERT statement but the binds were not renumbered. This broke the
insert.
This change removes the macrocontext column via alembic and re-numbers
the existing columns in the INSERT.
Fixes: #527
UserNote: The fix requires removing the macrocontext column from the
voicemail_messages table in the voicemail database via alembic upgrade.
UpgradeNote: The fix requires that the voicemail database be upgraded via
alembic. Upgrading to the latest voicemail database via alembic will
remove the macrocontext column from the voicemail_messages table.
- ### chan_dahdi: Allow MWI to be manually toggled on channels.
Author: Naveen Albert
Date: 2023-11-10
This adds a CLI command to manually toggle the MWI status
of a channel, useful for troubleshooting or resetting
MWI devices, similar to the capabilities offered with
SIP messaging to manually control MWI status.
UserNote: The 'dahdi set mwi' now allows MWI on channels
to be manually toggled if needed for troubleshooting.
Resolves: #440
- ### chan_rtp.c: MulticastRTP missing refcount without codec option
Author: PeterHolik
Date: 2024-01-15
Fixes: #529
- ### chan_rtp.c: Change MulticastRTP nameing to avoid memory leak
Author: PeterHolik
Date: 2024-01-16
Fixes: asterisk#536
- ### func_frame_trace: Add CLI command to dump frame queue.
Author: Naveen Albert
Date: 2024-01-12
This adds a simple CLI command that can be used for
analyzing all frames currently queued to a channel.
A couple log messages are also adjusted to be more
useful in tracing bridging problems.
Resolves: #533

View File

@ -377,7 +377,7 @@ $(MOD_SUBDIRS_MENUSELECT_TREE):
+@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
+@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) makeopts
$(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h
$(SUBDIRS): makeopts .lastclean main/version.c include/asterisk/build.h defaults.h
ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
main: third-party
@ -403,7 +403,7 @@ defaults.h: makeopts .lastclean build_tools/make_defaults_h
@cmp -s $@.tmp $@ || mv $@.tmp $@
@rm -f $@.tmp
main/version.c: FORCE menuselect.makeopts .lastclean
main/version.c: FORCE include/asterisk/buildopts.h menuselect.makeopts .lastclean
@build_tools/make_version_c > $@.tmp
@cmp -s $@.tmp $@ || mv $@.tmp $@
@rm -f $@.tmp
@ -545,7 +545,7 @@ INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTCACHEDIR)" "$(AS
"$(ASTDATADIR)/firmware/iax" "$(ASTDATADIR)/images" "$(ASTDATADIR)/keys" \
"$(ASTDATADIR)/phoneprov" "$(ASTDATADIR)/rest-api" "$(ASTDATADIR)/static-http" \
"$(ASTDATADIR)/sounds" "$(ASTDATADIR)/moh" "$(ASTMANDIR)/man8" "$(AGI_DIR)" "$(ASTDBDIR)" \
"$(ASTDATADIR)/third-party" "${ASTDATADIR}/keys/stir_shaken"
"$(ASTDATADIR)/third-party" "${ASTDATADIR}/keys/stir_shaken" "${ASTDATADIR}/keys/stir_shaken/cache"
installdirs:
@for i in $(INSTALLDIRS); do \

View File

@ -379,9 +379,8 @@ is set to no.
In Asterisk 12 and later, live_dangerously defaults to no.
[voip-security-webinar]: https://www.asterisk.org/security/webinar/
[blog-sip-security]: http://blogs.digium.com/2009/03/28/sip-security/
[voip-security-webinar]: https://docs.asterisk.org/Deployment/Important-Security-Considerations/Asterisk-Security-Webinars/
[blog-sip-security]: https://web.archive.org/web/20171030134647/http://blogs.digium.com/2009/03/28/sip-security/
[Strong Password Generator]: https://www.strongpasswordgenerator.com
[Filtering Data]: #filtering-data
[Proper Device Naming]: #proper-device-naming
@ -389,4 +388,4 @@ In Asterisk 12 and later, live_dangerously defaults to no.
[Reducing Pattern Match Typos]: #reducing-pattern-match-typos
[Manager Class Authorizations]: #manager-class-authorizations
[Avoid Privilege Escalations]: #avoid-privilege-escalations
[Important Security Considerations]: https://wiki.asterisk.org/wiki/display/AST/Important+Security+Considerations
[Important Security Considerations]: https://docs.asterisk.org/Deployment/Important-Security-Considerations/

View File

@ -20,7 +20,7 @@ more telephony interfaces than just Internet telephony. Asterisk also has a
vast amount of support for traditional PSTN telephony, as well.
For more information on the project itself, please visit the Asterisk
[home page] and the official [wiki]. In addition you'll find lots
[home page] and the official [documentation]. In addition you'll find lots
of information compiled by the Asterisk community at [voip-info.org].
There is a book on Asterisk published by O'Reilly under the Creative Commons
@ -48,7 +48,7 @@ ANY special hardware, not even a sound card) to install and run Asterisk.
Supported telephony hardware includes:
* All Analog and Digital Interface cards from [Sangoma]
* QuickNet Internet PhoneJack and LineJack (http://www.quicknet.net)
* QuickNet Internet PhoneJack and LineJack
* any full duplex sound card supported by ALSA, OSS, or PortAudio
* any ISDN card supported by mISDN on Linux
* The Xorcom Astribank channel bank
@ -258,7 +258,7 @@ Asterisk is a trademark of Sangoma Technologies Corporation
[home page]: https://www.asterisk.org
[support]: https://www.asterisk.org/support
[wiki]: https://wiki.asterisk.org/
[documentation]: https://docs.asterisk.org/
[mailing list]: http://lists.digium.com/mailman/listinfo/asterisk-users
[chan_dahdi.conf]: configs/samples/chan_dahdi.conf.sample
[voip-info.org]: http://www.voip-info.org/wiki-Asterisk
@ -269,4 +269,4 @@ Asterisk is a trademark of Sangoma Technologies Corporation
[CHANGES]: CHANGES
[configs]: configs
[doc]: doc
[Important Security Considerations]: https://wiki.asterisk.org/wiki/display/AST/Important+Security+Considerations
[Important Security Considerations]: https://docs.asterisk.org/Deployment/Important-Security-Considerations/

View File

@ -2,7 +2,7 @@
## Supported Versions
The Asterisk project maintains a [wiki page](https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions) of releases. Each version is listed with its release date, security fix only date, and end of life date. Consult this wiki page to see if the version of Asterisk you are reporting a security vulnerability against is still supported.
The Asterisk project maintains a [documentation page](https://docs.asterisk.org/About-the-Project/Asterisk-Versions/) of releases. Each version is listed with its release date, security fix only date, and end of life date. Consult this wiki page to see if the version of Asterisk you are reporting a security vulnerability against is still supported.
## Reporting a Vulnerability

File diff suppressed because it is too large Load Diff

View File

@ -567,7 +567,7 @@ static int load_config(int reload)
ast_config_destroy(cfg);
ast_verb(3, "AMD defaults: initialSilence [%d] greeting [%d] afterGreetingSilence [%d] "
ast_verb(5, "AMD defaults: initialSilence [%d] greeting [%d] afterGreetingSilence [%d] "
"totalAnalysisTime [%d] minimumWordLength [%d] betweenWordsSilence [%d] maximumNumberOfWords [%d] silenceThreshold [%d] maximumWordLength [%d]\n",
dfltInitialSilence, dfltGreeting, dfltAfterGreetingSilence, dfltTotalAnalysisTime,
dfltMinimumWordLength, dfltBetweenWordsSilence, dfltMaximumNumberOfWords, dfltSilenceThreshold, dfltMaximumWordLength);

View File

@ -61,7 +61,7 @@
</syntax>
<description>
<para>Connects to the given TCP service, then transmits channel audio over that socket. In turn, audio is received from the socket and sent to the channel. Only audio frames will be transmitted.</para>
<para>Protocol is specified at https://wiki.asterisk.org/wiki/display/AST/AudioSocket</para>
<para>Protocol is specified at https://docs.asterisk.org/Configuration/Channel-Drivers/AudioSocket/</para>
<para>This application does not automatically answer and should generally be preceeded by an application such as Answer() or Progress().</para>
</description>
</application>
@ -180,7 +180,7 @@ static int audiosocket_run(struct ast_channel *chan, const char *id, int svc)
chanName = ast_channel_name(chan);
while (1) {
ms = -1;
targetChan = ast_waitfor_nandfds(&chan, 1, &svc, 1, NULL, &outfd, &ms);
if (targetChan) {
f = ast_read(chan);

View File

@ -95,8 +95,17 @@ static const char app[] = "Authenticate";
maxdigits have been entered (without requiring the user to press the <literal>#</literal> key).
Defaults to 0 - no limit - wait for the user press the <literal>#</literal> key.</para>
</parameter>
<parameter name="prompt" required="false">
<para>Override the agent-pass prompt file.</para>
<parameter name="prompt" required="false" argsep="&amp;">
<para>Override the &quot;agent-pass&quot; sound file. Can be
an ampersand separated list of filenames. If the filename
is a relative filename (it does not begin with a slash), it
will be searched for in the Asterisk sounds directory. If the
filename is able to be parsed as a URL, Asterisk will
download the file and then begin playback on it. To include a
literal <literal>&amp;</literal> in the URL you can enclose
the URL in single quotes.</para>
<argument name="prompt" required="true" />
<argument name="prompt2" multiple="true" />
</parameter>
</syntax>
<description>

View File

@ -117,6 +117,7 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
struct ast_str *tmp_availcause = ast_str_alloca(2048);
struct ast_channel *tempchan;
struct ast_custom_function *cdr_prop_func = ast_custom_function_find("CDR_PROP");
struct ast_format_cap *caps = NULL;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(reqchans);
AST_APP_ARG(options);
@ -126,6 +127,10 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
AST_STANDARD_APP_ARGS(args, info);
ao2_lock(chan);
caps = ao2_bump(ast_channel_nativeformats(chan));
ao2_unlock(chan);
if (args.options) {
if (strchr(args.options, 'a')) {
option_all_avail = 1;
@ -174,10 +179,11 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
snprintf(trychan, sizeof(trychan), "%s/%s", tech, number);
status = inuse = ast_device_state(trychan);
}
ast_str_append(&tmp_availstat, 0, "%s%d",
ast_str_strlen(tmp_availstat) ? "&" : "", status);
ast_str_append(&tmp_availstat, 0, "%s%d", ast_str_strlen(tmp_availstat) ? "&" : "", status);
if ((inuse <= (int) AST_DEVICE_NOT_INUSE)
&& (tempchan = ast_request(tech, ast_channel_nativeformats(chan), NULL, chan, number, &status))) {
&& (tempchan = ast_request(tech, caps, NULL, chan, number, &status))) {
ast_str_append(&tmp_availchan, 0, "%s%s",
ast_str_strlen(tmp_availchan) ? "&" : "", ast_channel_name(tempchan));
@ -199,8 +205,11 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
break;
}
}
}
ao2_cleanup(caps);
pbx_builtin_setvar_helper(chan, "AVAILCHAN", ast_str_buffer(tmp_availchan));
/* Store the originally used channel too */
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", ast_str_buffer(tmp_availorig));

View File

@ -245,6 +245,11 @@
</enum>
</enumlist>
</option>
<option name="D">
<para>Interleave the audio coming from the channel and the audio coming to the channel in
the output audio as a dual channel stream, rather than mix it. Does nothing if 'o'
is also set.</para>
</option>
<option name="e">
<argument name="ext" required="true" />
<para>Enable <emphasis>enforced</emphasis> mode, so the spying channel can
@ -393,6 +398,7 @@ enum {
OPTION_EXITONHANGUP = (1 << 18), /* Hang up when the spied-on channel hangs up. */
OPTION_UNIQUEID = (1 << 19), /* The chanprefix is a channel uniqueid or fully specified channel name. */
OPTION_LONG_QUEUE = (1 << 20), /* Allow usage of a long queue to store audio frames. */
OPTION_INTERLEAVED = (1 << 21), /* Interleave the Read and Write frames in the output frame. */
};
enum {
@ -411,6 +417,7 @@ AST_APP_OPTIONS(spy_opts, {
AST_APP_OPTION('B', OPTION_BARGE),
AST_APP_OPTION_ARG('c', OPTION_DTMF_CYCLE, OPT_ARG_CYCLE),
AST_APP_OPTION('d', OPTION_DTMF_SWITCH_MODES),
AST_APP_OPTION('D', OPTION_INTERLEAVED),
AST_APP_OPTION_ARG('e', OPTION_ENFORCED, OPT_ARG_ENFORCED),
AST_APP_OPTION('E', OPTION_EXITONHANGUP),
AST_APP_OPTION_ARG('g', OPTION_GROUP, OPT_ARG_GROUP),
@ -471,6 +478,56 @@ static int spy_generate(struct ast_channel *chan, void *data, int len, int sampl
if (ast_test_flag(&csth->flags, OPTION_READONLY)) {
/* Option 'o' was set, so don't mix channel audio */
f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_READ, ast_format_slin);
} else if (ast_test_flag(&csth->flags, OPTION_INTERLEAVED)) {
/* Option 'D' was set, so mix the spy frame as an interleaved dual channel frame. */
int i;
struct ast_frame *fr_read = NULL;
struct ast_frame *fr_write = NULL;
short read_buf[samples];
short write_buf[samples];
short stereo_buf[samples * 2];
struct ast_frame stereo_frame = {
.frametype = AST_FRAME_VOICE,
.datalen = sizeof(stereo_buf),
.samples = samples,
};
f = ast_audiohook_read_frame_all(&csth->spy_audiohook, samples, ast_format_slin, &fr_read, &fr_write);
if (f) {
ast_frame_free(f, 0);
f = NULL;
}
if (fr_read) {
memcpy(read_buf, fr_read->data.ptr, sizeof(read_buf));
} else {
/* silent out the output frame if we can't read the input */
memset(read_buf, 0, sizeof(read_buf));
}
if (fr_write) {
memcpy(write_buf, fr_write->data.ptr, sizeof(write_buf));
} else {
memset(write_buf, 0, sizeof(write_buf));
}
for (i = 0; i < samples; i++) {
stereo_buf[i*2] = read_buf[i];
stereo_buf[i*2+1] = write_buf[i];
}
stereo_frame.data.ptr = stereo_buf;
stereo_frame.subclass.format = ast_format_cache_get_slin_by_rate(samples);
f = ast_frdup(&stereo_frame);
if (fr_read) {
ast_frame_free(fr_read, 0);
}
if (fr_write) {
ast_frame_free(fr_write, 0);
}
} else {
f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_BOTH, ast_format_slin);
}

View File

@ -3035,7 +3035,7 @@ static int action_playback(struct ast_bridge_channel *bridge_channel, const char
char *file_copy = ast_strdupa(playback_file);
char *file = NULL;
while ((file = strsep(&file_copy, "&"))) {
while ((file = ast_strsep(&file_copy, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
if (ast_stream_and_wait(bridge_channel->chan, file, "")) {
ast_log(LOG_WARNING, "Failed to playback file %s to channel\n", file);
return -1;
@ -3059,7 +3059,7 @@ static int action_playback_and_continue(struct confbridge_conference *conference
char *file_copy = ast_strdupa(playback_file);
char *file = NULL;
while ((file = strsep(&file_copy, "&"))) {
while ((file = ast_strsep(&file_copy, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
if (ast_streamfile(bridge_channel->chan, file, ast_channel_language(bridge_channel->chan))) {
ast_log(LOG_WARNING, "Failed to playback file %s to channel\n", file);
return -1;

View File

@ -88,9 +88,12 @@
</argument>
<xi:include xpointer="xpointer(/docs/info[@name='Dial_Resource'])" />
</parameter>
<parameter name="timeout" required="false">
<parameter name="timeout" required="false" argsep="^">
<para>Specifies the number of seconds we attempt to dial the specified devices.</para>
<para>If not specified, this defaults to 136 years.</para>
<para>If a second argument is specified, this controls the number of seconds we attempt to dial the specified devices
without receiving early media or ringing. If neither progress, ringing, nor voice frames have been received when this
timeout expires, the call will be treated as a CHANUNAVAIL. This can be used to skip destinations that may not be responsive.</para>
</parameter>
<parameter name="options" required="false">
<optionlist>
@ -242,6 +245,10 @@
<para>Asterisk will ignore any connected line update requests or any redirecting party
update requests it may receive on this dial attempt.</para>
</option>
<option name="j">
<para>Use the initial stream topology of the caller for outgoing channels, even if the caller topology has changed.</para>
<para>NOTE: For this option to work, it has to be present in all invocations of Dial that the caller channel goes through.</para>
</option>
<option name="k">
<para>Allow the called party to enable parking of the call by sending
the DTMF sequence defined for call parking in <filename>features.conf</filename>.</para>
@ -705,6 +712,7 @@ enum {
#define OPT_RING_WITH_EARLY_MEDIA (1LLU << 43)
#define OPT_HANGUPCAUSE (1LLU << 44)
#define OPT_HEARPULSING (1LLU << 45)
#define OPT_TOPOLOGY_PRESERVE (1LLU << 46)
enum {
OPT_ARG_ANNOUNCE = 0,
@ -749,6 +757,7 @@ AST_APP_OPTIONS(dial_exec_options, BEGIN_OPTIONS
AST_APP_OPTION('H', OPT_CALLER_HANGUP),
AST_APP_OPTION('i', OPT_IGNORE_FORWARDING),
AST_APP_OPTION('I', OPT_IGNORE_CONNECTEDLINE),
AST_APP_OPTION('j', OPT_TOPOLOGY_PRESERVE),
AST_APP_OPTION('k', OPT_CALLEE_PARK),
AST_APP_OPTION('K', OPT_CALLER_PARK),
AST_APP_OPTION_ARG('L', OPT_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),
@ -808,6 +817,16 @@ struct chanlist {
AST_LIST_HEAD_NOLOCK(dial_head, chanlist);
static void topology_ds_destroy(void *data) {
struct ast_stream_topology *top = data;
ast_stream_topology_free(top);
}
static const struct ast_datastore_info topology_ds_info = {
.type = "app_dial_topology_preserve",
.destroy = topology_ds_destroy,
};
static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str **featurecode);
static void chanlist_free(struct chanlist *outgoing)
@ -1181,7 +1200,7 @@ static void set_duration_var(struct ast_channel *chan, const char *var_base, int
}
static struct ast_channel *wait_for_answer(struct ast_channel *in,
struct dial_head *out_chans, int *to, struct ast_flags64 *peerflags,
struct dial_head *out_chans, int *to_answer, int *to_progress, struct ast_flags64 *peerflags,
char *opt_args[],
struct privacy_args *pa,
const struct cause_args *num_in, int *result, char *dtmf_progress,
@ -1194,7 +1213,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
{
struct cause_args num = *num_in;
int prestart = num.busy + num.congestion + num.nochan;
int orig = *to;
int orig_answer_to = *to_answer;
int progress_to_dup = *to_progress;
int orig_progress_to = *to_progress;
struct ast_channel *peer = NULL;
struct chanlist *outgoing = AST_LIST_FIRST(out_chans);
/* single is set if only one destination is enabled */
@ -1222,7 +1243,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
* there is no point in continuing. The bridge
* will just fail if it gets that far.
*/
*to = -1;
*to_answer = -1;
strcpy(pa->status, "CONGESTION");
ast_channel_publish_dial(in, outgoing->chan, NULL, pa->status);
SCOPE_EXIT_RTN_VALUE(NULL, "%s: can't be made compat with %s\n",
@ -1238,7 +1259,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
is_cc_recall = ast_cc_is_recall(in, &cc_recall_core_id, NULL);
while ((*to = ast_remaining_ms(start, orig)) && !peer) {
while ((*to_answer = ast_remaining_ms(start, orig_answer_to)) && (*to_progress = ast_remaining_ms(start, progress_to_dup)) && !peer) {
struct chanlist *o;
int pos = 0; /* how many channels do we handle */
int numlines = prestart;
@ -1264,14 +1285,15 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
} else {
ast_verb(3, "No one is available to answer at this time (%d:%d/%d/%d)\n", numlines, num.busy, num.congestion, num.nochan);
}
*to = 0;
*to_answer = 0;
if (is_cc_recall) {
ast_cc_failed(cc_recall_core_id, "Everyone is busy/congested for the recall. How sad");
}
SCOPE_EXIT_RTN_VALUE(NULL, "%s: No outgoing channels available\n", ast_channel_name(in));
}
winner = ast_waitfor_n(watchers, pos, to);
winner = ast_waitfor_n(watchers, pos, to_answer);
AST_LIST_TRAVERSE(out_chans, o, node) {
int res = 0;
struct ast_frame *f;
struct ast_channel *c = o->chan;
@ -1346,7 +1368,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_channel_unlock(in);
}
do_forward(o, &num, peerflags, single, caller_entertained, &orig,
do_forward(o, &num, peerflags, single, caller_entertained, &orig_answer_to,
forced_clid, stored_clid);
if (o->chan) {
@ -1483,6 +1505,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
* fine for ringing frames to get sent through.
*/
++num_ringing;
*to_progress = -1;
progress_to_dup = -1;
if (ignore_cc || cc_frame_received || num_ringing == numlines) {
ast_verb(3, "%s is ringing\n", ast_channel_name(c));
/* Setup early media if appropriate */
@ -1526,6 +1550,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_indicate(in, AST_CONTROL_PROGRESS);
}
}
*to_progress = -1;
progress_to_dup = -1;
if (!sent_progress) {
struct timeval now, then;
int64_t diff;
@ -1548,7 +1574,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
"Sending MF '%s' to %s as result of "
"receiving a PROGRESS message.\n",
mf_progress, hearpulsing ? "parties" : "called party");
ast_mf_stream(c, (hearpulsing ? NULL : in),
res |= ast_mf_stream(c, (hearpulsing ? NULL : in),
(hearpulsing ? in : NULL), mf_progress, 50, 55, 120, 65, 0);
}
if (!ast_strlen_zero(sf_progress)) {
@ -1556,7 +1582,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
"Sending SF '%s' to %s as result of "
"receiving a PROGRESS message.\n",
sf_progress, (hearpulsing ? "parties" : "called party"));
ast_sf_stream(c, (hearpulsing ? NULL : in),
res |= ast_sf_stream(c, (hearpulsing ? NULL : in),
(hearpulsing ? in : NULL), sf_progress, 0, 0);
}
if (!ast_strlen_zero(dtmf_progress)) {
@ -1564,7 +1590,11 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
"Sending DTMF '%s' to the called party as result of "
"receiving a PROGRESS message.\n",
dtmf_progress);
ast_dtmf_stream(c, in, dtmf_progress, 250, 0);
res |= ast_dtmf_stream(c, in, dtmf_progress, 250, 0);
}
if (res) {
ast_log(LOG_WARNING, "Called channel %s hung up post-progress before all digits could be sent\n", ast_channel_name(c));
goto wait_over;
}
}
ast_channel_publish_dial(in, c, NULL, "PROGRESS");
@ -1578,7 +1608,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
"Sending MF '%s' to %s as result of "
"receiving a WINK message.\n",
mf_wink, (hearpulsing ? "parties" : "called party"));
ast_mf_stream(c, (hearpulsing ? NULL : in),
res |= ast_mf_stream(c, (hearpulsing ? NULL : in),
(hearpulsing ? in : NULL), mf_wink, 50, 55, 120, 65, 0);
}
if (!ast_strlen_zero(sf_wink)) {
@ -1586,9 +1616,13 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
"Sending SF '%s' to %s as result of "
"receiving a WINK message.\n",
sf_wink, (hearpulsing ? "parties" : "called party"));
ast_sf_stream(c, (hearpulsing ? NULL : in),
res |= ast_sf_stream(c, (hearpulsing ? NULL : in),
(hearpulsing ? in : NULL), sf_wink, 0, 0);
}
if (res) {
ast_log(LOG_WARNING, "Called channel %s hung up post-wink before all digits could be sent\n", ast_channel_name(c));
goto wait_over;
}
}
ast_indicate(in, AST_CONTROL_WINK);
break;
@ -1706,6 +1740,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
if (caller_entertained) {
break;
}
*to_progress = -1;
progress_to_dup = -1;
/* Fall through */
case AST_FRAME_TEXT:
if (single && ast_write(in, f)) {
@ -1734,7 +1770,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
#endif
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
/* Got hung up */
*to = -1;
*to_answer = -1;
strcpy(pa->status, "CANCEL");
pa->canceled = 1;
publish_dial_end_event(in, out_chans, NULL, pa->status);
@ -1758,7 +1794,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
if (onedigit_goto(in, context, (char) f->subclass.integer, 1)) {
ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
*to = 0;
*to_answer = 0;
*result = f->subclass.integer;
strcpy(pa->status, "CANCEL");
pa->canceled = 1;
@ -1777,7 +1813,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
if (ast_test_flag64(peerflags, OPT_CALLER_HANGUP) &&
detect_disconnect(in, f->subclass.integer, &featurecode)) {
ast_verb(3, "User requested call disconnect.\n");
*to = 0;
*to_answer = 0;
strcpy(pa->status, "CANCEL");
pa->canceled = 1;
publish_dial_end_event(in, out_chans, NULL, pa->status);
@ -1886,9 +1922,15 @@ skip_frame:;
}
}
if (!*to || ast_check_hangup(in)) {
ast_verb(3, "Nobody picked up in %d ms\n", orig);
wait_over:
if (!*to_answer || ast_check_hangup(in)) {
ast_verb(3, "Nobody picked up in %d ms\n", orig_answer_to);
publish_dial_end_event(in, out_chans, NULL, "NOANSWER");
} else if (!*to_progress) {
ast_verb(3, "No early media received in %d ms\n", orig_progress_to);
publish_dial_end_event(in, out_chans, NULL, "CHANUNAVAIL");
strcpy(pa->status, "CHANUNAVAIL");
*to_answer = 0; /* Reset to prevent hangup */
}
if (is_cc_recall) {
@ -2260,7 +2302,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
struct chanlist *outgoing;
struct chanlist *tmp;
struct ast_channel *peer = NULL;
int to; /* timeout */
int to_answer, to_progress; /* timeouts */
struct cause_args num = { chan, 0, 0, 0 };
int cause, hanguptreecause = -1;
@ -2316,6 +2358,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
*/
struct ast_party_caller caller;
int max_forwards;
struct ast_datastore *topology_ds = NULL;
SCOPE_ENTER(1, "%s: Data: %s\n", ast_channel_name(chan), data);
/* Reset all DIAL variables back to blank, to prevent confusion (in case we don't reset all of them). */
@ -2617,7 +2660,21 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
*/
ast_party_connected_line_copy(&tmp->connected, ast_channel_connected(chan));
topology = ast_stream_topology_clone(ast_channel_get_stream_topology(chan));
if (ast_test_flag64(&opts, OPT_TOPOLOGY_PRESERVE)) {
topology_ds = ast_channel_datastore_find(chan, &topology_ds_info, NULL);
if (!topology_ds && (topology_ds = ast_datastore_alloc(&topology_ds_info, NULL))) {
topology_ds->data = ast_stream_topology_clone(ast_channel_get_stream_topology(chan));
ast_channel_datastore_add(chan, topology_ds);
}
}
if (topology_ds) {
ao2_ref(topology_ds->data, +1);
topology = topology_ds->data;
} else {
topology = ast_stream_topology_clone(ast_channel_get_stream_topology(chan));
}
ast_channel_unlock(chan);
@ -2856,14 +2913,31 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
AST_LIST_TRAVERSE_SAFE_END;
if (ast_strlen_zero(args.timeout)) {
to = -1;
to_answer = -1;
to_progress = -1;
} else {
to = atoi(args.timeout);
if (to > 0)
to *= 1000;
else {
ast_log(LOG_WARNING, "Invalid timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
to = -1;
char *anstimeout = strsep(&args.timeout, "^");
if (!ast_strlen_zero(anstimeout)) {
to_answer = atoi(anstimeout);
if (to_answer > 0) {
to_answer *= 1000;
} else {
ast_log(LOG_WARNING, "Invalid answer timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
to_answer = -1;
}
} else {
to_answer = -1;
}
if (!ast_strlen_zero(args.timeout)) {
to_progress = atoi(args.timeout);
if (to_progress > 0) {
to_progress *= 1000;
} else {
ast_log(LOG_WARNING, "Invalid progress timeout specified: '%s'. Setting timeout to infinite\n", args.timeout);
to_progress = -1;
}
} else {
to_progress = -1;
}
}
@ -2903,7 +2977,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
}
}
peer = wait_for_answer(chan, &out_chans, &to, peerflags, opt_args, &pa, &num, &result,
peer = wait_for_answer(chan, &out_chans, &to_answer, &to_progress, peerflags, opt_args, &pa, &num, &result,
dtmf_progress, mf_progress, mf_wink, sf_progress, sf_wink,
(ast_test_flag64(&opts, OPT_HEARPULSING) ? 1 : 0),
ignore_cc, &forced_clid, &stored_clid, &config);
@ -2911,7 +2985,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
if (!peer) {
if (result) {
res = result;
} else if (to) { /* Musta gotten hung up */
} else if (to_answer) { /* Musta gotten hung up */
res = -1;
} else { /* Nobody answered, next please? */
res = 0;

View File

@ -39,6 +39,7 @@
#include "asterisk/say.h"
#include "asterisk/app.h"
#include "asterisk/utils.h"
#include "asterisk/adsi.h"
/*** DOCUMENTATION
<application name="Directory" language="en_US">
@ -111,12 +112,17 @@
<para>Skip calling the extension, instead set it in the <variable>DIRECTORY_EXTEN</variable>
channel variable.</para>
</option>
<option name="d">
<para>Enable ADSI support for screen phone searching and retrieval
of directory results.</para>
<para>Additionally, the channel must be ADSI-enabled and you must
have an ADSI-compatible (Type III) CPE for this to work.</para>
</option>
</optionlist>
<note><para>Only one of the <replaceable>f</replaceable>, <replaceable>l</replaceable>, or <replaceable>b</replaceable>
options may be specified. <emphasis>If more than one is specified</emphasis>, then Directory will act as
if <replaceable>b</replaceable> was specified. The number
of characters for the user to type defaults to <literal>3</literal>.</para></note>
</parameter>
</syntax>
<description>
@ -167,6 +173,7 @@ enum {
OPT_ALIAS = (1 << 7),
OPT_CONFIG_FILE = (1 << 8),
OPT_SKIP = (1 << 9),
OPT_ADSI = (1 << 10),
};
enum {
@ -200,8 +207,72 @@ AST_APP_OPTIONS(directory_app_options, {
AST_APP_OPTION('a', OPT_ALIAS),
AST_APP_OPTION_ARG('c', OPT_CONFIG_FILE, OPT_ARG_FILENAME),
AST_APP_OPTION('s', OPT_SKIP),
AST_APP_OPTION('d', OPT_ADSI), /* (Would've used 'a', but that was taken already) */
});
static int adsi_search_input(struct ast_channel *chan)
{
unsigned char buf[256];
int bytes = 0;
unsigned char keys[6];
memset(keys, 0, sizeof(keys));
bytes += ast_adsi_display(buf + bytes, ADSI_COMM_PAGE, 3, ADSI_JUST_CENT, 0, " ", "");
bytes += ast_adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_CENT, 0, " ", "");
bytes += ast_adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
bytes += ast_adsi_input_format(buf + bytes, 1, ADSI_DIR_FROM_LEFT, 0, "Query: ***", "");
bytes += ast_adsi_input_control(buf + bytes, ADSI_COMM_PAGE, 4, 1, 1, ADSI_JUST_LEFT);
bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 3, "Search", "Search", "#", 1);
bytes += ast_adsi_set_keys(buf + bytes, keys);
bytes += ast_adsi_voice_mode(buf + bytes, 0);
ast_debug(3, "Sending ADSI search input screen on %s\n", ast_channel_name(chan));
return ast_adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DISPLAY);
}
static int adsi_confirm_match(struct ast_channel *chan, int seq, int total, const char *exten, const char *name, int showexten)
{
unsigned char buf[4096];
int alignments[5] = {ADSI_JUST_CENT, ADSI_JUST_CENT, ADSI_JUST_CENT, ADSI_JUST_CENT};
char *lines[5] = {NULL, NULL, NULL, NULL, NULL};
int x, bytes = 0;
unsigned char keys[8];
char matchbuf[32];
snprintf(matchbuf, sizeof(matchbuf), "%d of %d", seq + 1, total); /* Make it 1-indexed for user consumption */
lines[0] = " "; /* Leave the first line empty so the following lines stand out more */
lines[1] = matchbuf;
lines[2] = (char*) name;
if (showexten) {
/* If say extension option is set, show it for ADSI as well */
lines[3] = (char*) exten;
}
/* Don't use ast_adsi_print here, this way we can send it all at once instead of in 2 transmissions */
for (x = 0; lines[x]; x++) {
bytes += ast_adsi_display(buf + bytes, ADSI_INFO_PAGE, x + 1, alignments[x], 0, lines[x], "");
}
bytes += ast_adsi_set_line(buf + bytes, ADSI_INFO_PAGE, 1);
keys[3] = ADSI_KEY_APPS + 3;
keys[4] = ADSI_KEY_APPS + 4;
keys[5] = ADSI_KEY_APPS + 5;
/* You might think we only need to set the keys up the first time, but nope, we've got to do it each time. */
bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 3, "Dial", "Dial", "1", 0);
bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 4, "Next", "Next", "*", 0);
bytes += ast_adsi_load_soft_key(buf + bytes, ADSI_KEY_APPS + 5, "Exit", "Exit", "#", 0);
bytes += ast_adsi_set_keys(buf + bytes, keys);
bytes += ast_adsi_voice_mode(buf + bytes, 0);
ast_debug(3, "Sending ADSI confirmation menu for %s\n", name);
return ast_adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DISPLAY);
}
static int compare(const char *text, const char *template)
{
char digit;
@ -374,6 +445,10 @@ static int select_item_seq(struct ast_channel *chan, struct directory_item **ite
for (ptr = items, i = 0; i < count; i++, ptr++) {
item = *ptr;
if (ast_test_flag(flags, OPT_ADSI) && adsi_confirm_match(chan, i, count, item->exten, item->name, ast_test_flag(flags, OPT_SAYEXTENSION))) {
return -1;
}
for (loop = 3 ; loop > 0; loop--) {
if (!res)
res = play_mailbox_owner(chan, item->context, item->exten, item->name, flags);
@ -933,6 +1008,18 @@ static int directory_exec(struct ast_channel *chan, const char *data)
}
digits[7] = digit + '0';
if (ast_test_flag(&flags, OPT_ADSI)) {
if (!ast_adsi_available(chan)) {
ast_log(LOG_WARNING, "ADSI not available on %s\n", ast_channel_name(chan));
ast_clear_flag(&flags, OPT_ADSI);
} else {
res = ast_adsi_load_session(chan, NULL, 0, 1);
if (res < 0) {
return res;
}
}
}
if (ast_channel_state(chan) != AST_STATE_UP) {
if (!ast_test_flag(&flags, OPT_NOANSWER)) {
/* Otherwise answer unless we're supposed to read while on-hook */
@ -940,6 +1027,9 @@ static int directory_exec(struct ast_channel *chan, const char *data)
}
}
for (;;) {
if (ast_test_flag(&flags, OPT_ADSI) && adsi_search_input(chan)) {
return -1;
}
if (!ast_strlen_zero(dirintro) && !res) {
res = ast_stream_and_wait(chan, dirintro, AST_DIGIT_ANY);
} else if (!res) {

View File

@ -1068,6 +1068,7 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
ast_copy_string(num, nm->number, sizeof(num));
for (number = num; number; number = rest) {
struct ast_channel *outbound;
struct ast_format_cap *caps;
rest = strchr(number, '&');
if (rest) {
@ -1097,8 +1098,15 @@ static struct ast_channel *findmeexec(struct fm_args *tpargs, struct ast_channel
? "/n" : "/m");
}
outbound = ast_request("Local", ast_channel_nativeformats(caller), NULL, caller,
tmpuser->dialarg, &dg);
/* Capture nativeformats reference in case it gets changed */
ast_channel_lock(caller);
caps = ao2_bump(ast_channel_nativeformats(caller));
ast_channel_unlock(caller);
outbound = ast_request("Local", caps, NULL, caller, tmpuser->dialarg, &dg);
ao2_cleanup(caps);
if (!outbound) {
ast_log(LOG_WARNING, "Unable to allocate a channel for Local/%s cause: %s\n",
tmpuser->dialarg, ast_cause2str(dg));

View File

@ -196,6 +196,7 @@ static int find_matching_endif(struct ast_channel *chan, const char *otherapp)
if (!ast_rdlock_context(c)) {
if (!strcmp(ast_get_context_name(c), ast_channel_context(chan))) {
/* This is the matching context we want */
int cur_priority = ast_channel_priority(chan) + 1, level = 1;
for (e = find_matching_priority(c, ast_channel_exten(chan), cur_priority,
@ -203,6 +204,7 @@ static int find_matching_endif(struct ast_channel *chan, const char *otherapp)
e;
e = find_matching_priority(c, ast_channel_exten(chan), ++cur_priority,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
if (!strcasecmp(ast_get_extension_app(e), "IF")) {
level++;
} else if (!strcasecmp(ast_get_extension_app(e), "ENDIF")) {
@ -283,7 +285,12 @@ static int if_helper(struct ast_channel *chan, const char *data, int end)
pbx_builtin_setvar_helper(chan, my_name, NULL);
snprintf(end_varname,sizeof(end_varname),"END_%s",varname);
ast_channel_lock(chan);
endifpri = find_matching_endif(chan, NULL);
/* For EndIf, simply go to the next priority.
* We do not add 1 to ast_channel_priority because the dialplan will
* auto-increment the priority when we return, so just keep the priority as is.
* For ExitIf or false If() condition, we need to find the end of the current
* If branch (at same indentation) and branch there. */
endifpri = end == 2 ? ast_channel_priority(chan) : find_matching_endif(chan, NULL);
if ((goto_str = pbx_builtin_getvar_helper(chan, end_varname))) {
ast_parseable_goto(chan, goto_str);
pbx_builtin_setvar_helper(chan, end_varname, NULL);

View File

@ -48,6 +48,13 @@
</synopsis>
<syntax>
<parameter name="filenames" required="true" argsep="&amp;">
<para>Ampersand separated list of filenames. If the filename
is a relative filename (it does not begin with a slash), it
will be searched for in the Asterisk sounds directory. If the
filename is able to be parsed as a URL, Asterisk will
download the file and then begin playback on it. To include a
literal <literal>&amp;</literal> in the URL you can enclose
the URL in single quotes.</para>
<argument name="filename" required="true" />
<argument name="filename2" multiple="true" />
</parameter>
@ -492,7 +499,7 @@ static int playback_exec(struct ast_channel *chan, const char *data)
char *front;
ast_stopstream(chan);
while (!res && (front = strsep(&back, "&"))) {
while (!res && (front = ast_strsep(&back, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
if (option_say)
res = say_full(chan, front, "", ast_channel_language(chan), NULL, -1, -1);
else if (option_mix){

View File

@ -230,11 +230,18 @@
<para><replaceable>URL</replaceable> will be sent to the called party if the channel supports it.</para>
</parameter>
<parameter name="announceoverride" argsep="&amp;">
<argument name="filename" required="true">
<para>Announcement file(s) to play to agent before bridging call, overriding the announcement(s)
configured in <filename>queues.conf</filename>, if any.</para>
</argument>
<argument name="filename2" multiple="true" />
<para>Announcement file(s) to play to agent before bridging
call, overriding the announcement(s) configured in
<filename>queues.conf</filename>, if any.</para>
<para>Ampersand separated list of filenames. If the filename
is a relative filename (it does not begin with a slash), it
will be searched for in the Asterisk sounds directory. If the
filename is able to be parsed as a URL, Asterisk will
download the file and then begin playback on it. To include a
literal <literal>&amp;</literal> in the URL you can enclose
the URL in single quotes.</para>
<argument name="announceoverride" required="true" />
<argument name="announceoverride2" multiple="true" />
</parameter>
<parameter name="timeout">
<para>Will cause the queue to fail out after a specified number of
@ -1845,6 +1852,7 @@ struct call_queue {
int announcepositionlimit; /*!< How many positions we announce? */
int announcefrequency; /*!< How often to announce their position */
int minannouncefrequency; /*!< The minimum number of seconds between position announcements (def. 15) */
int periodicannouncestartdelay; /*!< How long into the queue should the periodic accouncement start */
int periodicannouncefrequency; /*!< How often to play periodic announcement */
int numperiodicannounce; /*!< The number of periodic announcements configured */
int randomperiodicannounce; /*!< Are periodic announcments randomly chosen */
@ -2975,6 +2983,7 @@ static void init_queue(struct call_queue *q)
q->weight = 0;
q->timeoutrestart = 0;
q->periodicannouncefrequency = 0;
q->periodicannouncestartdelay = -1;
q->randomperiodicannounce = 0;
q->numperiodicannounce = 0;
q->relativeperiodicannounce = 0;
@ -3431,6 +3440,8 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
ast_str_set(&q->sound_periodicannounce[0], 0, "%s", val);
q->numperiodicannounce = 1;
}
} else if (!strcasecmp(param, "periodic-announce-startdelay")) {
q->periodicannouncestartdelay = atoi(val);
} else if (!strcasecmp(param, "periodic-announce-frequency")) {
q->periodicannouncefrequency = atoi(val);
} else if (!strcasecmp(param, "relative-periodic-announce")) {
@ -7191,7 +7202,7 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
if (!res2 && announce) {
char *front;
char *announcefiles = ast_strdupa(announce);
while ((front = strsep(&announcefiles, "&"))) {
while ((front = ast_strsep(&announcefiles, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
if (play_file(peer, front) < 0) {
ast_log(LOG_ERROR, "play_file failed for '%s' on %s\n", front, ast_channel_name(peer));
}
@ -7794,6 +7805,9 @@ static void set_queue_member_pause(struct call_queue *q, struct member *mem, con
if (paused && !ast_strlen_zero(reason)) {
ast_copy_string(mem->reason_paused, reason, sizeof(mem->reason_paused));
} else {
/* We end up filling this in again later (temporarily) but we need it
* empty for now so that the intervening code - specifically
* dump_queue_members() - has the correct view of things. */
mem->reason_paused[0] = '\0';
}
@ -7812,10 +7826,22 @@ static void set_queue_member_pause(struct call_queue *q, struct member *mem, con
"Queue:%s_avail", q->name);
}
ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"),
"%s", S_OR(reason, ""));
if (!paused && !ast_strlen_zero(reason)) {
/* Because we've been unpaused with a 'reason' we need to ensure that
* that reason is emitted when the subsequent PauseQueueMember event
* is raised. So temporarily set it on the member and clear it out
* again right after. */
ast_copy_string(mem->reason_paused, reason, sizeof(mem->reason_paused));
}
ast_queue_log(q->name, "NONE", mem->membername, paused ? "PAUSE" : "UNPAUSE",
"%s", mem->reason_paused);
publish_queue_member_pause(q, mem);
if (!paused) {
mem->reason_paused[0] = '\0';
}
}
static int set_member_paused(const char *queuename, const char *interface, const char *reason, int paused)
@ -8652,6 +8678,11 @@ static int queue_exec(struct ast_channel *chan, const char *data)
}
ast_assert(qe.parent != NULL);
if (qe.parent->periodicannouncestartdelay >= 0) {
qe.last_periodic_announce_time += qe.parent->periodicannouncestartdelay;
qe.last_periodic_announce_time -= qe.parent->periodicannouncefrequency;
}
ast_queue_log(args.queuename, ast_channel_uniqueid(chan), "NONE", "ENTERQUEUE", "%s|%s|%d",
S_OR(args.url, ""),
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
@ -10957,7 +10988,7 @@ static char *handle_queue_add_member(struct ast_cli_entry *e, int cmd, struct as
case CLI_INIT:
e->command = "queue add member";
e->usage =
"Usage: queue add member <dial string> to <queue> [[[penalty <penalty>] as <membername>] state_interface <interface>]\n"
"Usage: queue add member <dial string> to <queue> [penalty <penalty> [as <membername> [state_interface <interface>]]]\n"
" Add a dial string (Such as a channel,e.g. SIP/6001) to a queue with optionally: a penalty, membername and a state_interface\n";
return NULL;
case CLI_GENERATE:

View File

@ -49,9 +49,15 @@
name.</para>
</parameter>
<parameter name="filenames" argsep="&amp;">
<argument name="filename" required="true">
<para>file(s) to play before reading digits or tone with option i</para>
</argument>
<para>Ampersand separated list of filenames to play before
reading digits or tone with option <literal>i</literal>. If
the filename is a relative filename (it does not begin with a
slash), it will be searched for in the Asterisk sounds
directory. If the filename is able to be parsed as a URL,
Asterisk will download the file and then begin playback on
it. To include a literal <literal>&amp;</literal> in the URL
you can enclose the URL in single quotes.</para>
<argument name="filename" required="true" />
<argument name="filename2" multiple="true" />
</parameter>
<parameter name="maxdigits">

View File

@ -16,7 +16,7 @@
* at the top of the source tree.
*
* Please follow coding guidelines
* https://wiki.asterisk.org/wiki/display/AST/Coding+Guidelines
* https://docs.asterisk.org/Development/Policies-and-Procedures/Coding-Guidelines/
*/
/*! \file
@ -371,7 +371,8 @@ static void play_files_helper(struct ast_channel *chan, const char *prompts)
char *prompt, *rest = ast_strdupa(prompts);
ast_stopstream(chan);
while ((prompt = strsep(&rest, "&")) && !ast_stream_and_wait(chan, prompt, "")) {
while ((prompt = ast_strsep(&rest, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))
&& !ast_stream_and_wait(chan, prompt, "")) {
ast_stopstream(chan);
}
}

View File

@ -85,7 +85,17 @@
Play a sound file and wait for speech to be recognized.
</synopsis>
<syntax>
<parameter name="sound_file" required="true" />
<parameter name="sound_file" required="true" argsep="&amp;">
<para>Ampersand separated list of filenames. If the filename
is a relative filename (it does not begin with a slash), it
will be searched for in the Asterisk sounds directory. If the
filename is able to be parsed as a URL, Asterisk will
download the file and then begin playback on it. To include a
literal <literal>&amp;</literal> in the URL you can enclose
the URL in single quotes.</para>
<argument name="sound_file" required="true" />
<argument name="sound_file2" multiple="true" />
</parameter>
<parameter name="timeout">
<para>Timeout integer in seconds. Note the timeout will only start
once the sound file has stopped playing.</para>
@ -95,6 +105,9 @@
<option name="n">
<para>Don't answer the channel if it has not already been answered.</para>
</option>
<option name="p">
<para>Return partial results when backend is terminated by timeout.</para>
</option>
</optionlist>
</parameter>
</syntax>
@ -690,10 +703,12 @@ static int speech_streamfile(struct ast_channel *chan, const char *filename, con
enum {
SB_OPT_NOANSWER = (1 << 0),
SB_OPT_PARTIALRESULTS = (1 << 1),
};
AST_APP_OPTIONS(speech_background_options, BEGIN_OPTIONS
AST_APP_OPTION('n', SB_OPT_NOANSWER),
AST_APP_OPTION('p', SB_OPT_PARTIALRESULTS),
END_OPTIONS );
/*! \brief SpeechBackground(Sound File,Timeout) Dialplan Application */
@ -776,7 +791,10 @@ static int speech_background(struct ast_channel *chan, const char *data)
/* Okay it's streaming so go into a loop grabbing frames! */
while (done == 0) {
/* If the filename is null and stream is not running, start up a new sound file */
if (!quieted && (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL) && (filename = strsep(&filename_tmp, "&"))) {
if (!quieted
&& ast_channel_streamid(chan) == -1
&& ast_channel_timingfunc(chan) == NULL
&& (filename = ast_strsep(&filename_tmp, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
/* Discard old stream information */
ast_stopstream(chan);
/* Start new stream */
@ -920,7 +938,10 @@ static int speech_background(struct ast_channel *chan, const char *data)
}
}
if (!ast_strlen_zero(dtmf)) {
if (ast_strlen_zero(dtmf) && speech->state == AST_SPEECH_STATE_READY && ast_test_flag(&options, SB_OPT_PARTIALRESULTS)) {
/* Copy to speech structure the results, even partial ones, if desired and available */
speech->results = ast_speech_results_get(speech);
} else if (!ast_strlen_zero(dtmf)) {
/* We sort of make a results entry */
speech->results = ast_calloc(1, sizeof(*speech->results));
if (speech->results != NULL) {

View File

@ -375,26 +375,6 @@ static int pop_exec(struct ast_channel *chan, const char *data)
return res;
}
static int frames_left(struct ast_channel *chan)
{
struct ast_datastore *stack_store;
struct gosub_stack_list *oldlist;
int exists;
ast_channel_lock(chan);
stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
if (!stack_store) {
ast_channel_unlock(chan);
return -1;
}
oldlist = stack_store->data;
AST_LIST_LOCK(oldlist);
exists = oldlist->first ? 1 : 0;
AST_LIST_UNLOCK(oldlist);
ast_channel_unlock(chan);
return exists;
}
static int return_exec(struct ast_channel *chan, const char *data)
{
struct ast_datastore *stack_store;
@ -402,7 +382,6 @@ static int return_exec(struct ast_channel *chan, const char *data)
struct gosub_stack_list *oldlist;
const char *retval = data;
int res = 0;
int lastframe;
ast_channel_lock(chan);
if (!(stack_store = ast_channel_datastore_find(chan, &stack_info, NULL))) {
@ -414,7 +393,6 @@ static int return_exec(struct ast_channel *chan, const char *data)
oldlist = stack_store->data;
AST_LIST_LOCK(oldlist);
oldframe = AST_LIST_REMOVE_HEAD(oldlist, entries);
lastframe = oldlist->first ? 0 : 1;
AST_LIST_UNLOCK(oldlist);
if (!oldframe) {
@ -432,19 +410,12 @@ static int return_exec(struct ast_channel *chan, const char *data)
* what was there before. Channels that do not have a PBX may
* not have the context or exten set.
*/
if (ast_channel_pbx(chan) || !lastframe) {
/* If there's no PBX, the "old location" is simply
* the configured context for the device, such as
* for pre-dial handlers, and restoring this location
* is nonsensical. So if no PBX and there are no further
* frames, leave the location as it is. */
ast_channel_context_set(chan, oldframe->context);
ast_channel_exten_set(chan, oldframe->extension);
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
--oldframe->priority;
}
ast_channel_priority_set(chan, oldframe->priority);
ast_channel_context_set(chan, oldframe->context);
ast_channel_exten_set(chan, oldframe->extension);
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
--oldframe->priority;
}
ast_channel_priority_set(chan, oldframe->priority);
ast_set2_flag(ast_channel_flags(chan), oldframe->in_subroutine, AST_FLAG_SUBROUTINE_EXEC);
gosub_release_frame(chan, oldframe);
@ -1095,13 +1066,10 @@ static int gosub_run(struct ast_channel *chan, const char *sub_args, int ignore_
ast_channel_priority(chan), ast_channel_name(chan));
}
/* Did the routine return?
* For things like predial where there's no PBX on the channel yet,
* the last return leaves the location alone so we can print it out correctly here.
* So to ensure we finished properly, make sure there are no frames left in that case. */
if ((!ast_channel_pbx(chan) && !frames_left(chan)) || (ast_channel_priority(chan) == saved_priority
/* Did the routine return? */
if (ast_channel_priority(chan) == saved_priority
&& !strcmp(ast_channel_context(chan), saved_context)
&& !strcmp(ast_channel_exten(chan), saved_exten))) {
&& !strcmp(ast_channel_exten(chan), saved_exten)) {
ast_verb(3, "%s Internal %s(%s) complete GOSUB_RETVAL=%s\n",
ast_channel_name(chan), app_gosub, sub_args,
S_OR(pbx_builtin_getvar_helper(chan, "GOSUB_RETVAL"), ""));

View File

@ -27,7 +27,7 @@
*
* \par See also
* \arg \ref voicemail.conf "Config_voicemail"
* \note For information about voicemail IMAP storage, https://wiki.asterisk.org/wiki/display/AST/IMAP+Voicemail+Storage
* \note For information about voicemail IMAP storage, https://docs.asterisk.org/Configuration/Applications/Voicemail/IMAP-Voicemail-Storage/
* \ingroup applications
* \todo This module requires res_adsi to load. This needs to be optional
* during compilation.
@ -546,6 +546,22 @@
as the same as the from.</para>
</description>
</manager>
<managerEvent language="en_US" name="VoicemailPasswordChange">
<managerEventInstance class="EVENT_FLAG_USER">
<synopsis>Raised in response to a mailbox password change.</synopsis>
<syntax>
<parameter name="Context">
<para>Mailbox context.</para>
</parameter>
<parameter name="Mailbox">
<para>Mailbox name.</para>
</parameter>
<parameter name="NewPassword">
<para>New password for mailbox.</para>
</parameter>
</syntax>
</managerEventInstance>
</managerEvent>
***/
#ifdef IMAP_STORAGE
@ -672,6 +688,7 @@ static AST_LIST_HEAD_STATIC(vmstates, vmstate);
#define VM_MESSAGEWRAP (1 << 17) /*!< Wrap around from the last message to the first, and vice-versa */
#define VM_FWDURGAUTO (1 << 18) /*!< Autoset of Urgent flag on forwarded Urgent messages set globally */
#define VM_EMAIL_EXT_RECS (1 << 19) /*!< Send voicemail emails when an external recording is added to a mailbox */
#define VM_MARK_URGENT (1 << 20) /*!< After recording, permit the caller to mark the message as urgent */
#define ERROR_LOCK_PATH -100
#define ERROR_MAX_MSGS -101
#define OPERATOR_EXIT 300
@ -751,6 +768,18 @@ static const char * const mailbox_folders[] = {
"Urgent",
};
/*!
* \brief Reload voicemail.conf
* \param reload Whether this is a reload as opposed to module load
* \param force Forcefully reload the config, even it has not changed
* \retval 0 on success, nonzero on failure
*/
static int load_config_force(int reload, int force);
/*! \brief Forcibly reload voicemail.conf, even if it has not changed.
* This is necessary after running unit tests. */
#define force_reload_config() load_config_force(1, 1)
static int load_config(int reload);
#ifdef TEST_FRAMEWORK
static int load_config_from_memory(int reload, struct ast_config *cfg, struct ast_config *ucfg);
@ -1410,6 +1439,8 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
ast_set2_flag(vmu, ast_true(value), VM_SVMAIL);
} else if (!strcasecmp(var, "review")){
ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
} else if (!strcasecmp(var, "leaveurgent")){
ast_set2_flag(vmu, ast_true(value), VM_MARK_URGENT);
} else if (!strcasecmp(var, "tempgreetwarn")){
ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);
} else if (!strcasecmp(var, "messagewrap")){
@ -1849,6 +1880,16 @@ static int reset_user_pw(const char *context, const char *mailbox, const char *n
res = 0;
}
AST_LIST_UNLOCK(&users);
if (!res) {
struct ast_json *json_object;
json_object = ast_json_pack("{s: s, s: s, s: s}",
"Context", S_OR(context, "default"),
"Mailbox", mailbox,
"NewPassword", newpass);
ast_manager_publish_event("VoicemailPasswordChange", EVENT_FLAG_SYSTEM | EVENT_FLAG_USER, json_object);
ast_json_unref(json_object);
}
return res;
}
@ -1892,7 +1933,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
break;
} else {
ast_verb(4, "Writing voicemail password to file %s failed, falling back to config file\n", secretfn);
ast_log(LOG_WARNING, "Writing voicemail password to file %s failed, falling back to config file\n", secretfn);
}
/* Fall-through */
case OPT_PWLOC_VOICEMAILCONF:
@ -4086,16 +4127,14 @@ bail:
/*!
* \brief Determines the highest message number in use for a given user and mailbox folder.
* \param vmu
* \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
*
* This method is used when mailboxes are stored in an ODBC back end.
* Typical use to set the msgnum would be to take the value returned from this method and add one to it.
*
* \return the value of zero or greater to indicate the last message index in use, -1 to indicate none.
*/
static int last_message_index(struct ast_vm_user *vmu, char *dir)
static int last_message_index(char *dir)
{
int x = -1;
int res;
@ -4380,15 +4419,15 @@ static SQLHSTMT insert_data_cb(struct odbc_obj *obj, void *vdata)
SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msgnums), 0, (void *) data->msgnums, 0, NULL);
SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, data->datalen, 0, (void *) data->data, data->datalen, &data->indlen);
SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->context), 0, (void *) data->context, 0, NULL);
SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->callerid), 0, (void *) data->callerid, 0, NULL);
SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->origtime), 0, (void *) data->origtime, 0, NULL);
SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->duration), 0, (void *) data->duration, 0, NULL);
SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxuser), 0, (void *) data->mailboxuser, 0, NULL);
SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxcontext), 0, (void *) data->mailboxcontext, 0, NULL);
SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->flag), 0, (void *) data->flag, 0, NULL);
SQLBindParameter(stmt, 12, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msg_id), 0, (void *) data->msg_id, 0, NULL);
SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->callerid), 0, (void *) data->callerid, 0, NULL);
SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->origtime), 0, (void *) data->origtime, 0, NULL);
SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->duration), 0, (void *) data->duration, 0, NULL);
SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxuser), 0, (void *) data->mailboxuser, 0, NULL);
SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->mailboxcontext), 0, (void *) data->mailboxcontext, 0, NULL);
SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->flag), 0, (void *) data->flag, 0, NULL);
SQLBindParameter(stmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->msg_id), 0, (void *) data->msg_id, 0, NULL);
if (!ast_strlen_zero(data->category)) {
SQLBindParameter(stmt, 13, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->category), 0, (void *) data->category, 0, NULL);
SQLBindParameter(stmt, 12, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(data->category), 0, (void *) data->category, 0, NULL);
}
res = ast_odbc_execute_sql(obj, stmt, data->sql);
if (!SQL_SUCCEEDED(res)) {
@ -4658,7 +4697,6 @@ static void rename_file(char *sfn, char *dfn)
/*!
* \brief Determines the highest message number in use for a given user and mailbox folder.
* \param vmu
* \param dir the folder the mailbox folder to look for messages. Used to construct the SQL where clause.
*
* This method is used when mailboxes are stored on the filesystem. (not ODBC and not IMAP).
@ -4667,7 +4705,7 @@ static void rename_file(char *sfn, char *dfn)
* \note Should always be called with a lock already set on dir.
* \return the value of zero or greaterto indicate the last message index in use, -1 to indicate none.
*/
static int last_message_index(struct ast_vm_user *vmu, char *dir)
static int last_message_index(char *dir)
{
int x;
unsigned char map[MAXMSGLIMIT] = "";
@ -4694,12 +4732,8 @@ static int last_message_index(struct ast_vm_user *vmu, char *dir)
}
closedir(msgdir);
for (x = 0; x < vmu->maxmsg; x++) {
if (map[x] == 1) {
stopcount--;
} else if (map[x] == 0 && !stopcount) {
break;
}
for (x = 0; x < MAXMSGLIMIT && stopcount; x++) {
stopcount -= map[x];
}
return x - 1;
@ -5972,7 +6006,7 @@ static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int i
if (vm_lock_path(todir))
return ERROR_LOCK_PATH;
recipmsgnum = last_message_index(recip, todir) + 1;
recipmsgnum = last_message_index(todir) + 1;
if (recipmsgnum < recip->maxmsg - (imbox ? 0 : inprocess_count(vmu->mailbox, vmu->context, 0))) {
make_file(topath, sizeof(topath), todir, recipmsgnum);
#ifndef ODBC_STORAGE
@ -6467,7 +6501,7 @@ static int msg_create_from_file(struct ast_vm_recording_data *recdata)
return -1;
}
msgnum = last_message_index(recipient, dir) + 1;
msgnum = last_message_index(dir) + 1;
#endif
/* Lock the directory receiving the voicemail since we want it to still exist when we attempt to copy the voicemail.
@ -7035,7 +7069,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
}
} else {
#ifndef IMAP_STORAGE
msgnum = last_message_index(vmu, dir) + 1;
msgnum = last_message_index(dir) + 1;
#endif
make_file(fn, sizeof(fn), dir, msgnum);
@ -7157,7 +7191,7 @@ static int resequence_mailbox(struct ast_vm_user *vmu, char *dir, int stopcount)
return ERROR_LOCK_PATH;
}
for (x = 0, dest = 0; dest != stopcount && x < vmu->maxmsg + 10; x++) {
for (x = 0, dest = 0; dest != stopcount && x < MAXMSGLIMIT; x++) {
make_file(sfn, sizeof(sfn), dir, x);
if (EXISTS(dir, x, sfn, NULL)) {
@ -7246,7 +7280,7 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg
if (vm_lock_path(ddir))
return ERROR_LOCK_PATH;
x = last_message_index(vmu, ddir) + 1;
x = last_message_index(ddir) + 1;
if (box == 10 && x >= vmu->maxdeletedmsg) { /* "Deleted" folder*/
x--;
@ -7422,8 +7456,11 @@ static void adsi_begin(struct ast_channel *chan, int *useadsi)
if (!ast_adsi_available(chan))
return;
x = ast_adsi_load_session(chan, adsifdn, adsiver, 1);
if (x < 0)
if (x < 0) {
*useadsi = 0;
ast_channel_adsicpe_set(chan, AST_ADSI_UNAVAILABLE);
return;
}
if (!x) {
if (adsi_load_vmail(chan, useadsi)) {
ast_log(AST_LOG_WARNING, "Unable to upload voicemail scripts\n");
@ -9103,8 +9140,8 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
return ERROR_LOCK_PATH;
}
/* for local storage, checks directory for messages up to maxmsg limit */
last_msg = last_message_index(vmu, vms->curdir);
/* for local storage, checks directory for messages up to MAXMSGLIMIT */
last_msg = last_message_index(vms->curdir);
ast_unlock_path(vms->curdir);
if (last_msg < -1) {
@ -9140,7 +9177,7 @@ static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
}
/* update count as message may have arrived while we've got mailbox open */
last_msg_idx = last_message_index(vmu, vms->curdir);
last_msg_idx = last_message_index(vms->curdir);
if (last_msg_idx != vms->lastmsg) {
ast_log(AST_LOG_NOTICE, "%d messages received after mailbox opened.\n", last_msg_idx - vms->lastmsg);
}
@ -11550,6 +11587,7 @@ static int show_mailbox_snapshot(struct ast_cli_args *a)
const char *context = a->argv[4];
struct ast_vm_mailbox_snapshot *mailbox_snapshot;
struct ast_vm_msg_snapshot *msg;
int i;
/* Take a snapshot of the mailbox and walk through each folder's contents */
mailbox_snapshot = ast_vm_mailbox_snapshot_create(mailbox, context, NULL, 0, AST_VM_SNAPSHOT_SORT_BY_ID, 0);
@ -11560,7 +11598,7 @@ static int show_mailbox_snapshot(struct ast_cli_args *a)
ast_cli(a->fd, VM_STRING_HEADER_FORMAT, "Folder", "Caller ID", "Date", "Duration", "Flag", "ID");
for (int i = 0; i < mailbox_snapshot->folders; i++) {
for (i = 0; i < mailbox_snapshot->folders; i++) {
AST_LIST_TRAVERSE(&((mailbox_snapshot)->snapshots[i]), msg, msg) {
ast_cli(a->fd, VM_STRING_HEADER_FORMAT, msg->folder_name, msg->callerid, msg->origdate, msg->duration,
msg->flag, msg->msg_id);
@ -11777,9 +11815,10 @@ static char *complete_voicemail_move_message(struct ast_cli_args *a, int maxpos)
}
AST_LIST_UNLOCK(&users);
} else if (pos == 4 || pos == 8 || (pos == 6 && maxpos == 6) ) {
int i;
/* Walk through the standard folders */
wordlen = strlen(word);
for (int i = 0; i < ARRAY_LEN(mailbox_folders); i++) {
for (i = 0; i < ARRAY_LEN(mailbox_folders); i++) {
if (folder && !strncasecmp(word, mailbox_folders[i], wordlen) && ++which > state) {
return ast_strdup(mailbox_folders[i]);
}
@ -11789,7 +11828,6 @@ static char *complete_voicemail_move_message(struct ast_cli_args *a, int maxpos)
/* find messages in the folder */
struct ast_vm_mailbox_snapshot *mailbox_snapshot;
struct ast_vm_msg_snapshot *msg;
int i = 0;
mailbox = a->argv[2];
context = a->argv[3];
folder = a->argv[4];
@ -11797,6 +11835,7 @@ static char *complete_voicemail_move_message(struct ast_cli_args *a, int maxpos)
/* Take a snapshot of the mailbox and snag the individual info */
if ((mailbox_snapshot = ast_vm_mailbox_snapshot_create(mailbox, context, folder, 0, AST_VM_SNAPSHOT_SORT_BY_ID, 0))) {
int i;
/* we are only requesting the one folder, but we still need to know it's index */
for (i = 0; i < ARRAY_LEN(mailbox_folders); i++) {
if (!strcasecmp(mailbox_folders[i], folder)) {
@ -12897,7 +12936,7 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
/* language parameter seems to only be used for display in manager action */
static const char options_string[] = "attach=yes|attachfmt=wav49|"
"serveremail=someguy@digium.com|fromstring=Voicemail System|tz=central|delete=yes|saycid=yes|"
"sendvoicemail=yes|review=yes|tempgreetwarn=yes|messagewrap=yes|operator=yes|"
"sendvoicemail=yes|review=yes|tempgreetwarn=yes|messagewrap=yes|operator=yes|leaveurgent=yes|"
"envelope=yes|moveheard=yes|sayduration=yes|saydurationm=5|forcename=yes|"
"forcegreetings=yes|callback=somecontext|dialout=somecontext2|"
"exitcontext=somecontext3|minsecs=10|maxsecs=100|nextaftercmd=yes|"
@ -12973,6 +13012,10 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
ast_test_status_update(test, "Parse failure for review option\n");
res = 1;
}
if (!ast_test_flag(vmu, VM_MARK_URGENT)) {
ast_test_status_update(test, "Parse failure for leaveurgent option\n");
res = 1;
}
if (!ast_test_flag(vmu, VM_TEMPGREETWARN)) {
ast_test_status_update(test, "Parse failure for tempgreetwarm option\n");
res = 1;
@ -13079,6 +13122,7 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
#endif
free_user(vmu);
force_reload_config(); /* Restore original config */
return res ? AST_TEST_FAIL : AST_TEST_PASS;
}
#endif
@ -13703,6 +13747,7 @@ static int append_vmu_info_astman(
"DeleteMessage: %s\r\n"
"VolumeGain: %.2f\r\n"
"CanReview: %s\r\n"
"CanMarkUrgent: %s\r\n"
"CallOperator: %s\r\n"
"MaxMessageCount: %d\r\n"
"MaxMessageLength: %d\r\n"
@ -13740,6 +13785,7 @@ static int append_vmu_info_astman(
ast_test_flag(vmu, VM_DELETE) ? "Yes" : "No",
vmu->volgain,
ast_test_flag(vmu, VM_REVIEW) ? "Yes" : "No",
ast_test_flag(vmu, VM_MARK_URGENT) ? "Yes" : "No",
ast_test_flag(vmu, VM_OPERATOR) ? "Yes" : "No",
vmu->maxmsg,
vmu->maxsecs,
@ -13773,6 +13819,7 @@ static int append_vmbox_info_astman(
struct ast_vm_mailbox_snapshot *mailbox_snapshot;
struct ast_vm_msg_snapshot *msg;
int nummessages = 0;
int i;
/* Take a snapshot of the mailbox */
mailbox_snapshot = ast_vm_mailbox_snapshot_create(vmu->mailbox, vmu->context, NULL, 0, AST_VM_SNAPSHOT_SORT_BY_ID, 0);
@ -13784,7 +13831,7 @@ static int append_vmbox_info_astman(
astman_send_listack(s, m, "Voicemail box detail will follow", "start");
/* walk through each folder's contents and append info for each message */
for (int i = 0; i < mailbox_snapshot->folders; i++) {
for (i = 0; i < mailbox_snapshot->folders; i++) {
AST_LIST_TRAVERSE(&((mailbox_snapshot)->snapshots[i]), msg, msg) {
astman_append(s,
"Event: %s\r\n"
@ -14168,10 +14215,10 @@ static const char *substitute_escapes(const char *value)
return ast_str_buffer(str);
}
static int load_config(int reload)
static int load_config_force(int reload, int force)
{
struct ast_config *cfg, *ucfg;
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
struct ast_flags config_flags = { reload && !force ? CONFIG_FLAG_FILEUNCHANGED : 0 };
int res;
ast_unload_realtime("voicemail");
@ -14209,6 +14256,11 @@ static int load_config(int reload)
return res;
}
static int load_config(int reload)
{
return load_config_force(reload, 0);
}
#ifdef TEST_FRAMEWORK
static int load_config_from_memory(int reload, struct ast_config *cfg, struct ast_config *ucfg)
{
@ -14703,6 +14755,14 @@ static int actual_load_config(int reload, struct ast_config *cfg, struct ast_con
}
ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW);
if (!(val = ast_variable_retrieve(cfg, "general", "leaveurgent"))){
val = "yes";
} else if (ast_false(val)) {
ast_debug(1, "VM leave urgent messages disabled globally\n");
val = "no";
}
ast_set2_flag((&globalflags), ast_true(val), VM_MARK_URGENT);
/* Temporary greeting reminder */
if (!(val = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) {
ast_debug(1, "VM Temporary Greeting Reminder Option disabled globally\n");
@ -15375,6 +15435,7 @@ AST_TEST_DEFINE(test_voicemail_msgcount)
}
free_user(vmu);
force_reload_config(); /* Restore original config */
return res;
}
@ -15485,6 +15546,7 @@ AST_TEST_DEFINE(test_voicemail_notify_endl)
}
fclose(file);
free_user(vmu);
force_reload_config(); /* Restore original config */
return res;
}
@ -15557,8 +15619,8 @@ AST_TEST_DEFINE(test_voicemail_load_config)
#undef CHECK
/* restore config */
load_config(1); /* this might say "Failed to load configuration file." */
/* Forcibly restore the original config, to reinitialize after test */
force_reload_config(); /* this might say "Failed to load configuration file." */
cleanup:
unlink(config_filename);
@ -15624,6 +15686,11 @@ AST_TEST_DEFINE(test_voicemail_vm_info)
populate_defaults(vmu);
vmu->email = ast_strdup("vm-info-test@example.net");
if (!vmu->email) {
ast_test_status_update(test, "Cannot create vmu email\n");
chan = ast_channel_unref(chan);
return AST_TEST_FAIL;
}
ast_copy_string(vmu->fullname, "Test Framework Mailbox", sizeof(vmu->fullname));
ast_copy_string(vmu->pager, "vm-info-pager-test@example.net", sizeof(vmu->pager));
ast_copy_string(vmu->language, "en", sizeof(vmu->language));
@ -16270,7 +16337,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
}
break;
case '4':
if (outsidecaller) { /* only mark vm messages */
if (outsidecaller && ast_test_flag(vmu, VM_MARK_URGENT)) { /* only mark vm messages */
/* Mark Urgent */
if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
ast_verb(3, "marking message as Urgent\n");
@ -16347,7 +16414,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
return cmd;
if (msg_exists) {
cmd = ast_play_and_wait(chan, "vm-review");
if (!cmd && outsidecaller) {
if (!cmd && outsidecaller && ast_test_flag(vmu, VM_MARK_URGENT)) {
if ((flag && ast_strlen_zero(flag)) || (!ast_strlen_zero(flag) && strcmp(flag, "Urgent"))) {
cmd = ast_play_and_wait(chan, "vm-review-urgent");
} else if (flag) {

View File

@ -2220,6 +2220,30 @@ static int user_template_handler(const struct aco_option *opt, struct ast_variab
return conf_find_user_profile(NULL, var->value, u_profile) ? 0 : -1;
}
static int sample_rate_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct bridge_profile *b_profile = obj;
unsigned int *slot;
if (!strcasecmp(var->name, "internal_sample_rate")) {
slot = &b_profile->internal_sample_rate;
if (!strcasecmp(var->value, "auto")) {
*slot = 0;
return 0;
}
} else if (!strcasecmp(var->name, "maximum_sample_rate")) {
slot = &b_profile->maximum_sample_rate;
if (!strcasecmp(var->value, "none")) {
*slot = 0;
return 0;
}
} else {
return -1;
}
return ast_parse_arg(var->value, PARSE_UINT32 | PARSE_IN_RANGE, slot, 8000, 192000);
}
static int bridge_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct bridge_profile *b_profile = obj;
@ -2437,10 +2461,9 @@ int conf_load_config(void)
/* Bridge options */
aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);
/* "auto" will fail to parse as a uint, but we use PARSE_DEFAULT to set the value to 0 in that case, which is the value that auto resolves to */
aco_option_register(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, PARSE_DEFAULT, FLDSET(struct bridge_profile, internal_sample_rate), 0);
aco_option_register_custom(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "auto", sample_rate_handler, 0);
aco_option_register(&cfg_info, "binaural_active", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_BINAURAL_ACTIVE);
aco_option_register(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, PARSE_DEFAULT, FLDSET(struct bridge_profile, maximum_sample_rate), 0);
aco_option_register_custom(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "none", sample_rate_handler, 0);
aco_option_register_custom(&cfg_info, "mixing_interval", ACO_EXACT, bridge_types, "20", mix_interval_handler, 0);
aco_option_register(&cfg_info, "record_conference", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_CONFERENCE);
aco_option_register_custom(&cfg_info, "video_mode", ACO_EXACT, bridge_types, NULL, video_mode_handler, 0);

View File

@ -22,7 +22,7 @@
*
* \author\verbatim Terry Wilson <twilson@digium.com> \endverbatim
*
* See https://wiki.asterisk.org/wiki/display/AST/Confbridge+state+changes for
* See https://docs.asterisk.org/Development/Reference-Information/Other-Reference-Information/Confbridge-state-changes/ for
* a more complete description of how conference states work.
*/

View File

@ -9,9 +9,9 @@ check_for_app() {
fi
}
# OpenBSD: pkg_add autoconf%2.63 automake%1.9 metaauto
test -n "$AUTOCONF_VERSION" || export AUTOCONF_VERSION=2.63
test -n "$AUTOMAKE_VERSION" || export AUTOMAKE_VERSION=1.9
# OpenBSD: pkg_add autoconf%2.69 automake%1.16 metaauto
test -n "$AUTOCONF_VERSION" || export AUTOCONF_VERSION=2.69
test -n "$AUTOMAKE_VERSION" || export AUTOMAKE_VERSION=1.16
check_for_app autoconf
check_for_app autoheader

View File

@ -181,7 +181,14 @@ static int simple_bridge_join(struct ast_bridge *bridge, struct ast_bridge_chann
return 0;
}
ast_channel_request_stream_topology_change(c1, new_top, &simple_bridge);
if (!ast_stream_topology_equal(new_top, existing_top)) {
ast_channel_request_stream_topology_change(c1, new_top, &simple_bridge);
} else {
ast_debug(3, "%s: Topologies already match. Current: %s Requested: %s\n",
ast_channel_name(c1),
ast_str_tmp(256, ast_stream_topology_to_str(existing_top, &STR_TMP)),
ast_str_tmp(256, ast_stream_topology_to_str(new_top, &STR_TMP)));
}
ast_stream_topology_free(new_top);
return 0;

View File

@ -9,7 +9,6 @@
<support_level>extended</support_level>
</member>
<member name="DETECT_DEADLOCKS" displayname="Detect Deadlocks">
<depend>DEBUG_THREADS</depend>
<support_level>extended</support_level>
</member>
<member name="DUMP_SCHEDULER" displayname="Dump Scheduler Contents for Debugging">

View File

@ -128,4 +128,8 @@
<defaultenabled>yes</defaultenabled>
<depend>native_arch</depend>
</member>
<member name="ADD_CFLAGS_TO_BUILDOPTS_H" displayname="Add ALL of the flags on this page to buildopts.h. Useful for IDEs but may cause slightly longer compile times after flags are changed.">
<support_level>core</support_level>
<defaultenabled>no</defaultenabled>
</member>
</category>

View File

@ -58,7 +58,7 @@ if [[ -z ${cache_dir} ]] ; then
fi
version=$(${ASTTOPDIR}/build_tools/make_version ${ASTTOPDIR})
if [[ ! ${version} =~ ^(GIT-)?(certified/)?([^.-]+)[.-].* ]] ; then
if [[ ! ${version} =~ ^(GIT-)?(certified[/-])?([^.-]+)[.-].* ]] ; then
echo "${module_name}: Couldn't parse version ${version}"
exit 1
fi
@ -172,7 +172,7 @@ if [[ -f ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml ]] ; then
cs=$(${MD5} ${f} | cut -b1-32)
if [[ "${cs}" != "${sum}" ]] ; then
echo Checksum mismatch: ${f}
echo "Checksum mismatch: ${f}"
need_install=1
break
fi
@ -194,8 +194,8 @@ else
fi
need_download=1
if [[ -f ${cache_dir}/${full_name}.manifest.xml ]] ; then
cpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${cache_dir}/${full_name}.manifest.xml)
if [[ -f ${cache_dir}/${full_name}-${major_version}.manifest.xml ]] ; then
cpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${cache_dir}/${full_name}-${major_version}.manifest.xml)
cpvi=$(version_convert ${cpv})
echo "${full_name}: Cached package version ${cpv} (${cpvi})"
if [[ ${cpvi} == ${rpvi} && ( -f ${cache_dir}/${tarball} ) ]] ; then
@ -210,7 +210,7 @@ if [[ ${need_download} = 1 ]] ; then
echo "${full_name}: Unable to fetch ${remote_url}/${tarball}"
exit 1
}
cp ${tmpdir}/${variant_manifest} ${cache_dir}/${full_name}.manifest.xml
cp ${tmpdir}/${variant_manifest} ${cache_dir}/${full_name}-${major_version}.manifest.xml
fi
tar -xzf ${cache_dir}/${tarball} -C ${cache_dir}

View File

@ -18,42 +18,79 @@ then
# gets added to BUILDOPTS.
fi
TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
for x in ${TMP}; do
if test "${x}" = "AO2_DEBUG" \
-o "${x}" = "BETTER_BACKTRACES" \
-o "${x}" = "BUILD_NATIVE" \
-o "${x}" = "COMPILE_DOUBLE" \
-o "${x}" = "DEBUG_CHAOS" \
-o "${x}" = "DEBUG_SCHEDULER" \
-o "${x}" = "DETECT_DEADLOCKS" \
-o "${x}" = "DONT_OPTIMIZE" \
-o "${x}" = "DUMP_SCHEDULER" \
-o "${x}" = "LOTS_OF_SPANS" \
-o "${x}" = "MALLOC_DEBUG" \
-o "${x}" = "RADIO_RELAX" \
-o "${x}" = "REBUILD_PARSERS" \
-o "${x}" = "REF_DEBUG" \
-o "${x}" = "USE_HOARD_ALLOCATOR" ; then
# These options are only for specific sources and have no effect on public ABI.
# Keep them out of buildopts.h so ccache does not invalidate all sources.
continue
fi
ADD_CFLAGS_TO_BUILDOPTS=false
MENUSELECT_CFLAGS=$(${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts)
echo "$MENUSELECT_CFLAGS" | grep -q -e "ADD_CFLAGS_TO_BUILDOPTS_H" && ADD_CFLAGS_TO_BUILDOPTS=true
# Clean up MENUSELECT_CFLAGS by removing the "MENUSELECT_CFLAGS="
# at the front, the "ADD_CFLAGS_TO_BUILDOPTS_H" flag, and any "-D"
# entries.
MENUSELECT_CFLAGS=$( echo "$MENUSELECT_CFLAGS" | \
sed -r -e "s/(MENUSELECT_CFLAGS=|ADD_CFLAGS_TO_BUILDOPTS_H|-D)//g")
# This is a list of flags that don't affect the ABI.
# "ADD_CFLAGS_TO_BUILDOPTS_H" is NOT set, we'll filter these
# out of the buildopts.h file.
#
# These used to always be filtered out but if they're not in
# buildopts.h, many IDEs will show them as undefined and mark
# any code blocks enabled by them as disabled.
#
# The original reasoning for removing them was that trivial
# changes to the buildopts.h file will cause ccache to
# invalidate any source files that use it and increase the
# compile time. It's not such a huge deal these days but
# to preserve backwards behavior the default is still to
# remove them.
#
# The ABI-breaking flags are always included in buildopts.h.
# This variable is used by sed so it needs to be a valid
# regex which will be surrounded by parens.]
FILTER_OUT="\
AO2_DEBUG|BETTER_BACKTRACES|BUILD_NATIVE|\
COMPILE_DOUBLE|DEBUG_CHAOS|DEBUG_SCHEDULER|\
DETECT_DEADLOCKS|DONT_OPTIMIZE|DUMP_SCHEDULER|\
LOTS_OF_SPANS|MALLOC_DEBUG|RADIO_RELAX|\
REBUILD_PARSERS|REF_DEBUG|USE_HOARD_ALLOCATOR"
# Create buildopts.h
INCLUDE_CFLAGS="$MENUSELECT_CFLAGS"
# Do the filter-out if needed.
if ! $ADD_CFLAGS_TO_BUILDOPTS ; then
INCLUDE_CFLAGS=$( echo "$MENUSELECT_CFLAGS" | \
sed -r -e "s/(${FILTER_OUT})//g")
fi
# Output the defines.
for x in ${INCLUDE_CFLAGS}; do
echo "#define ${x} 1"
if test "${x}" = "LOW_MEMORY" ; then
# LOW_MEMORY isn't an ABI affecting option but it is used in many sources
# so it gets defined globally but is not included in AST_BUILTOPTS.
continue
fi
if test "x${BUILDOPTS}" != "x" ; then
BUILDOPTS="${BUILDOPTS}, ${x}"
else
BUILDOPTS="${x}"
fi
done
BUILDSUM=`echo ${BUILDOPTS} | ${MD5} | cut -c1-32`
# We NEVER include the non-ABI-breaking flags in the
# BUILDOPTS or use them to calculate the checksum so
# we always filter out any that may exist.
# After the filter-out, we also need to convert the
# possibly-multi-spaced MENUSELECT_CFLAGS to a nice
# comma-separated list.
# I.E.
# Remove leading spaces.
# Convert consecutive interior spaces to a single space.
# Remove trailing spaces.
# Convert the now-single-spaces in the interior to ", ".
BUILDOPTS=$( echo "$MENUSELECT_CFLAGS" | \
sed -r -e "s/(${FILTER_OUT}|LOW_MEMORY)//g" -e "s/^\s+//g;s/\s+/ /g;s/\s+$//g;s/\s/, /g" )
# Calculate the checksum on only the ABI-breaking flags.
BUILDSUM=$(echo "${BUILDOPTS}" | ${MD5} | cut -c1-32)
echo "#define AST_BUILDOPT_SUM \"${BUILDSUM}\""
echo "#define AST_BUILDOPTS \"${BUILDOPTS}\""
# However, it'd be nice to see the non-ABI-breaking flags
# when you do a "core show settings" so we create a separate
# define for them.
BUILDOPTS_ALL=$( echo "$MENUSELECT_CFLAGS" | \
sed -r -e "s/^\s+//g;s/\s+/ /g;s/\s+$//g;s/\s/, /g" )
echo "#define AST_BUILDOPTS_ALL \"${BUILDOPTS_ALL}\""

View File

@ -2,6 +2,11 @@
GREP=${GREP:-grep}
if test ! -f include/asterisk/buildopts.h ; then
echo "include/asterisk/buildopts.h is missing"
exit 1
fi
if test ! -f .flavor ; then
EXTRA=""
elif test ! -f .version ; then
@ -18,14 +23,11 @@ then
BUILDOPTS="AST_DEVMODE"
fi
TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
for x in ${TMP}; do
if test "x${BUILDOPTS}" != "x" ; then
BUILDOPTS="${BUILDOPTS}, ${x}"
else
BUILDOPTS="${x}"
fi
done
BUILDOPTS=$(sed -n -r -e 's/#define\s+AST_BUILDOPTS\s+"([^"]+)"/\1/gp' \
include/asterisk/buildopts.h )
BUILDOPTS_ALL=$(sed -n -r -e 's/#define\s+AST_BUILDOPTS_ALL\s+"([^"]+)"/\1/gp' \
include/asterisk/buildopts.h )
cat << END
/*
@ -43,6 +45,8 @@ static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}";
static const char asterisk_build_opts[] = "${BUILDOPTS}";
static const char asterisk_build_opts_all[] = "${BUILDOPTS_ALL}";
const char *ast_get_version(void)
{
return asterisk_version;
@ -58,4 +62,9 @@ const char *ast_get_build_opts(void)
return asterisk_build_opts;
}
const char *ast_get_build_opts_all(void)
{
return asterisk_build_opts_all;
}
END

View File

@ -135,12 +135,18 @@ if [ "${for_wiki}" -eq "1" ] || [ "${validate}" -eq "1" ]; then
fi
fi
make_absolute() {
case "$1" in
/*) echo "$1" ;;
*) echo "$source_tree/$1" ;;
esac
}
if [ "${command}" = "print_dependencies" ] ; then
for subdir in ${mod_subdirs} ; do
subpath="${source_tree}/${subdir}"
# We WANT word splitting in the following line.
# shellcheck disable=SC2046
${GREP} -l -E '(language="en_US"|appdocsxml.dtd)' $(${FIND} "${subpath}" -name '*.c' -or -name '*.cc' -or -name '*.xml') || :
subpath=$(make_absolute "$subdir")
${FIND} "${subpath}" \( -name '*.c' -o -name '*.cc' -o -name '*.xml' \) \
-exec ${GREP} -l -E '(language="en_US"|appdocsxml.dtd)' '{}' \;
done
exit
fi
@ -186,7 +192,7 @@ printf "Building Documentation For: "
for subdir in ${mod_subdirs} ; do
printf "%s " "${subdir}"
subdir_path="${source_tree}/${subdir}"
subdir_path=$(make_absolute "$subdir")
for i in $(${FIND} "${subdir_path}" -name '*.c' -or -name '*.cc'); do
if [ "${with_moduleinfo}" -eq "1" ] ; then
MODULEINFO=$(${AWK} -f "${source_tree}/build_tools/get_moduleinfo" "${i}")

View File

@ -28,6 +28,7 @@ URIPARSER=@PBX_URIPARSER@
KQUEUE=@PBX_KQUEUE@
LDAP=@PBX_LDAP@
LIBEDIT=@PBX_LIBEDIT@
LIBJWT=@PBX_LIBJWT@
LIBXML2=@PBX_LIBXML2@
LIBXSLT=@PBX_LIBXSLT@
XMLSTARLET=@PBX_XMLSTARLET@

View File

@ -152,6 +152,8 @@ static struct console_pvt {
struct ast_frame fr;
/*! Running = 1, Not running = 0 */
unsigned int streamstate:1;
/*! Abort stream processing? */
unsigned int abort:1;
/*! On-hook = 0, Off-hook = 1 */
unsigned int hookstate:1;
/*! Unmuted = 0, Muted = 1 */
@ -275,18 +277,19 @@ static void *stream_monitor(void *data)
};
for (;;) {
pthread_testcancel();
console_pvt_lock(pvt);
res = Pa_ReadStream(pvt->stream, buf, sizeof(buf) / sizeof(int16_t));
console_pvt_unlock(pvt);
pthread_testcancel();
if (!pvt->owner) {
if (!pvt->owner || pvt->abort) {
return NULL;
}
if (res == paNoError)
if (res == paNoError) {
ast_queue_frame(pvt->owner, &f);
} else {
ast_log(LOG_WARNING, "Console ReadStream failed: %s\n", Pa_GetErrorText(res));
}
}
return NULL;
@ -401,8 +404,9 @@ static int stop_stream(struct console_pvt *pvt)
if (!pvt->streamstate || pvt->thread == AST_PTHREADT_NULL)
return 0;
pthread_cancel(pvt->thread);
pthread_kill(pvt->thread, SIGURG);
pvt->abort = 1;
/* Wait for pvt->thread to exit cleanly, to avoid killing it while it's holding a lock. */
pthread_kill(pvt->thread, SIGURG); /* Wake it up if needed, but don't cancel it */
pthread_join(pvt->thread, NULL);
console_pvt_lock(pvt);

View File

@ -263,6 +263,10 @@
</enum>
<enum name="dialmode">
<para>R/W Pulse and tone dialing mode of the channel.</para>
<para>Disabling tone dialing using this option will not disable the DSP used for DTMF detection.
To do that, also set the <literal>digitdetect</literal> option. If digit detection is disabled,
DTMF will not be detected, regardless of the <literal>dialmode</literal> setting.
The <literal>digitdetect</literal> setting has no impact on pulse dialing detection.</para>
<para>If set, overrides the setting in <literal>chan_dahdi.conf</literal> for that channel.</para>
<enumlist>
<enum name="both" />
@ -2024,6 +2028,9 @@ static void my_set_cadence(void *pvt, int *cid_rings, struct ast_channel *ast)
ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s': %s\n", p->distinctivering, ast_channel_name(ast), strerror(errno));
*cid_rings = cidrings[p->distinctivering - 1];
} else {
if (p->distinctivering > 0) {
ast_log(LOG_WARNING, "Cadence %d is not defined, falling back to default ring cadence\n", p->distinctivering);
}
if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, NULL))
ast_log(LOG_WARNING, "Unable to reset default ring on '%s': %s\n", ast_channel_name(ast), strerror(errno));
*cid_rings = p->sendcalleridafter;
@ -5223,6 +5230,18 @@ static int has_voicemail(struct dahdi_pvt *p)
int new_msgs;
RAII_VAR(struct stasis_message *, mwi_message, NULL, ao2_cleanup);
/* A manual MWI disposition has been requested, use that instead
* if this is for sending the new MWI indication. */
if (p->mwioverride_active) {
/* We don't clear p->mwioverride_active automatically,
* because otherwise do_monitor would just change it back to the way it was.
* We need to keep the override active until explicitly disabled by the user,
* so that we can keep returning the correct answer in subsequent calls to do_monitor. */
ast_debug(6, "MWI manual override active on channel %d: pretending that it should be %s\n",
p->channel, p->mwioverride_disposition ? "active" : "inactive");
return p->mwioverride_disposition;
}
mwi_message = stasis_cache_get(ast_mwi_state_cache(), ast_mwi_state_type(), p->mailbox);
if (mwi_message) {
struct ast_mwi_state *mwi_state = stasis_message_data(mwi_message);
@ -6719,6 +6738,14 @@ static int dahdi_queryoption(struct ast_channel *chan, int option, void *data, i
}
switch (option) {
case AST_OPTION_TDD:
cp = (char *) data;
if (p->mate) {
*cp = 2;
} else {
*cp = p->tdd ? 1 : 0;
}
break;
case AST_OPTION_DIGIT_DETECT:
cp = (char *) data;
*cp = p->ignoredtmf ? 0 : 1;
@ -11874,7 +11901,7 @@ static void *do_monitor(void *data)
&& (last->sig & __DAHDI_SIG_FXO)
&& !analog_p->fxsoffhookstate
&& !last->owner
&& !ast_strlen_zero(last->mailbox)
&& (!ast_strlen_zero(last->mailbox) || last->mwioverride_active)
&& !analog_p->subs[SUB_REAL].owner /* could be a recall ring from a flash hook hold */
&& (thispass - analog_p->onhooktime > 3)) {
res = has_voicemail(last);
@ -12949,6 +12976,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
tmp->callwaitingcallerid = conf->chan.callwaitingcallerid;
tmp->threewaycalling = conf->chan.threewaycalling;
tmp->threewaysilenthold = conf->chan.threewaysilenthold;
tmp->calledsubscriberheld = conf->chan.calledsubscriberheld; /* Not used in chan_dahdi.c, just analog pvt, but must exist on the DAHDI pvt anyways */
tmp->adsi = conf->chan.adsi;
tmp->use_smdi = conf->chan.use_smdi;
tmp->permhidecallerid = conf->chan.hidecallerid;
@ -13247,6 +13275,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
analog_p->ani_wink_time = conf->chan.ani_wink_time;
analog_p->hanguponpolarityswitch = conf->chan.hanguponpolarityswitch;
analog_p->permcallwaiting = conf->chan.callwaiting; /* permcallwaiting possibly modified in analog_config_complete */
analog_p->calledsubscriberheld = conf->chan.calledsubscriberheld; /* Only actually used in analog pvt, not DAHDI pvt */
analog_p->callreturn = conf->chan.callreturn;
analog_p->cancallforward = conf->chan.cancallforward;
analog_p->canpark = conf->chan.canpark;
@ -16524,6 +16553,75 @@ static char *dahdi_set_dnd(struct ast_cli_entry *e, int cmd, struct ast_cli_args
return CLI_SUCCESS;
}
static char *dahdi_set_mwi(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int channel;
int on;
int override = 1;
struct dahdi_pvt *dahdi_chan = NULL;
switch (cmd) {
case CLI_INIT:
e->command = "dahdi set mwi";
e->usage =
"Usage: dahdi set mwi <chan#> <on|off|reset>\n"
" Sets/unsets MWI (Message Waiting Indicator) manually on a channel.\n"
" This may be used regardless of whether the channel is assigned any mailboxes.\n"
" When active, this setting will override the voicemail status to set MWI.\n"
" Once cleared, the voicemail status will resume control of MWI.\n"
" Changes are queued for when the channel is idle and persist until cleared.\n"
" <chan num> is the channel number\n"
" <on|off|reset> Enable, disable, or reset Message Waiting Indicator override?\n"
;
return NULL;
case CLI_GENERATE:
return NULL;
}
if (a->argc != 5)
return CLI_SHOWUSAGE;
if ((channel = atoi(a->argv[3])) <= 0) {
ast_cli(a->fd, "Expected channel number, got '%s'\n", a->argv[3]);
return CLI_SHOWUSAGE;
}
if (ast_true(a->argv[4])) {
on = 1;
} else if (ast_false(a->argv[4])) {
on = 0;
} else if (!strcmp(a->argv[4], "reset")) {
override = 0;
} else {
ast_cli(a->fd, "Expected 'on' or 'off' or 'reset', got '%s'\n", a->argv[4]);
return CLI_SHOWUSAGE;
}
ast_mutex_lock(&iflock);
for (dahdi_chan = iflist; dahdi_chan; dahdi_chan = dahdi_chan->next) {
if (dahdi_chan->channel != channel)
continue;
/* Found the channel. Actually set it */
if (override) {
dahdi_chan->mwioverride_disposition = on;
ast_cli(a->fd, "MWI '%s' queued for channel %d\n", on ? "enable" : "disable", channel);
}
dahdi_chan->mwioverride_active = override;
/* The do_monitor thread will take care of actually sending the MWI
* at an appropriate time for the channel. */
break;
}
ast_mutex_unlock(&iflock);
if (!dahdi_chan) {
ast_cli(a->fd, "Unable to find given channel %d\n", channel);
return CLI_FAILURE;
}
return CLI_SUCCESS;
}
static struct ast_cli_entry dahdi_cli[] = {
AST_CLI_DEFINE(handle_dahdi_show_cadences, "List cadences"),
AST_CLI_DEFINE(dahdi_show_channels, "Show active DAHDI channels"),
@ -16536,6 +16634,7 @@ static struct ast_cli_entry dahdi_cli[] = {
AST_CLI_DEFINE(dahdi_set_hwgain, "Set hardware gain on a channel"),
AST_CLI_DEFINE(dahdi_set_swgain, "Set software gain on a channel"),
AST_CLI_DEFINE(dahdi_set_dnd, "Sets/resets DND (Do Not Disturb) mode on a channel"),
AST_CLI_DEFINE(dahdi_set_mwi, "Sets/unsets MWI (Message Waiting Indicator) manually on a channel"),
};
#define TRANSFER 0
@ -18341,6 +18440,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
confp->chan.busycount = atoi(v->value);
} else if (!strcasecmp(v->name, "busypattern")) {
parse_busy_pattern(v, &confp->chan.busy_cadence);
} else if (!strcasecmp(v->name, "calledsubscriberheld")) {
confp->chan.calledsubscriberheld = ast_true(v->value);
} else if (!strcasecmp(v->name, "callprogress")) {
confp->chan.callprogress &= ~CALLPROGRESS_PROGRESS;
if (ast_true(v->value))
@ -18430,18 +18531,30 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
} else if (!strcasecmp(v->name, "group")) {
confp->chan.group = ast_get_group(v->value);
} else if (!strcasecmp(v->name, "callgroup")) {
if (!((confp->chan.sig == SIG_FXOKS) || (confp->chan.sig == SIG_FXOGS) || (confp->chan.sig == SIG_FXOLS))) {
ast_log(LOG_WARNING, "Only FXO signalled channels may belong to a call group\n");
}
if (!strcasecmp(v->value, "none"))
confp->chan.callgroup = 0;
else
confp->chan.callgroup = ast_get_group(v->value);
} else if (!strcasecmp(v->name, "pickupgroup")) {
if (!((confp->chan.sig == SIG_FXOKS) || (confp->chan.sig == SIG_FXOGS) || (confp->chan.sig == SIG_FXOLS))) {
ast_log(LOG_WARNING, "Only FXO signalled channels may belong to a pickup group\n");
}
if (!strcasecmp(v->value, "none"))
confp->chan.pickupgroup = 0;
else
confp->chan.pickupgroup = ast_get_group(v->value);
} else if (!strcasecmp(v->name, "namedcallgroup")) {
if (!((confp->chan.sig == SIG_FXOKS) || (confp->chan.sig == SIG_FXOGS) || (confp->chan.sig == SIG_FXOLS))) {
ast_log(LOG_WARNING, "Only FXO signalled channels may belong to a named call group\n");
}
confp->chan.named_callgroups = ast_get_namedgroups(v->value);
} else if (!strcasecmp(v->name, "namedpickupgroup")) {
if (!((confp->chan.sig == SIG_FXOKS) || (confp->chan.sig == SIG_FXOGS) || (confp->chan.sig == SIG_FXOLS))) {
ast_log(LOG_WARNING, "Only FXO signalled channels may belong to a named pickup group\n");
}
confp->chan.named_pickupgroups = ast_get_namedgroups(v->value);
} else if (!strcasecmp(v->name, "setvar")) {
if (v->value) {

View File

@ -204,6 +204,13 @@ struct dahdi_pvt {
* \note Set from the "busydetect" value read in from chan_dahdi.conf
*/
unsigned int busydetect:1;
/*!
* \brief TRUE if Called Subscriber held is enabled.
* This allows a single incoming call to hold a DAHDI channel up,
* allowing a recipient to hang up an extension and pick up another
* phone on the same line without disconnecting the call.
*/
unsigned int calledsubscriberheld:1;
/*!
* \brief TRUE if call return is enabled.
* (*69, if your dialplan doesn't catch this first)
@ -424,6 +431,10 @@ struct dahdi_pvt {
unsigned int mwimonitoractive:1;
/*! \brief TRUE if a MWI message sending thread is active */
unsigned int mwisendactive:1;
/*! \brief TRUE if a manual MWI override is active for a channel */
unsigned int mwioverride_active:1;
/*! \brief Manual MWI disposition (on/off) */
unsigned int mwioverride_disposition:1;
/*!
* \brief TRUE if channel is out of reset and ready
* \note Used by SS7. Otherwise set but not used.

View File

@ -398,6 +398,47 @@ static int (*iax2_regfunk)(const char *username, int onoff) = NULL;
#define DEFAULT_FREQ_OK 60 * 1000 /* How often to check for the host to be up */
#define DEFAULT_FREQ_NOTOK 10 * 1000 /* How often to check, if the host is down... */
/*! \brief Name of effective auth method */
static const char *auth_method_labels[] = {
[0] = "none",
[IAX_AUTH_PLAINTEXT] = "plaintext",
[IAX_AUTH_MD5] = "MD5",
[IAX_AUTH_RSA] = "RSA",
};
/* Max length is length of |RSA|MD5|plaintext (18 + 1 for NUL = 19) */
#define AUTH_METHOD_NAMES_BUFSIZE 19
/*!
* \brief Get names of all auth methods
* \param Bit field of auth methods
* \param[out] buf Buffer into which to write the names. Must be of size AUTH_METHOD_NAMES_BUFSIZE.
* \return Auth methods name
*/
static char *auth_method_names(int authmethods, char *restrict buf)
{
char *pos = buf;
*pos = '\0';
if (authmethods & IAX_AUTH_RSA) {
pos += sprintf(pos, "|RSA");
}
if (authmethods & IAX_AUTH_MD5) {
pos += sprintf(pos, "|MD5");
}
if (authmethods & IAX_AUTH_PLAINTEXT) {
pos += sprintf(pos, "|plaintext");
}
if (pos == buf) { /* No auth methods */
strcpy(buf, "none");
return buf;
}
return buf + 1; /* Skip leading | */
}
/* if a pvt has encryption setup done and is running on the call */
#define IAX_CALLENCRYPTED(pvt) \
(ast_test_flag64(pvt, IAX_ENCRYPTED) && ast_test_flag64(pvt, IAX_KEYPOPULATED))
@ -825,6 +866,8 @@ struct chan_iax2_pvt {
int authrej;
/*! permitted authentication methods */
int authmethods;
/*! effective authentication method */
int eff_auth_method;
/*! permitted encryption methods */
int encmethods;
/*! Encryption AES-128 Key */
@ -8189,7 +8232,7 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
user = user_unref(user);
}
if (ast_test_flag64(p, IAX_FORCE_ENCRYPT) && !p->encmethods) {
ast_log(LOG_NOTICE, "Call Terminated, Incoming call is unencrypted while force encrypt is enabled.\n");
ast_log(LOG_WARNING, "Call Terminated, incoming call is unencrypted while force encrypt is enabled.\n");
return res;
}
if (!ast_test_flag(&p->state, IAX_STATE_AUTHENTICATED))
@ -8215,12 +8258,17 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
key = ast_key_get(keyn, AST_KEY_PUBLIC);
if (key && !ast_check_signature(key, p->challenge, rsasecret)) {
res = 0;
p->eff_auth_method = IAX_AUTH_RSA;
break;
} else if (!key)
ast_log(LOG_WARNING, "requested inkey '%s' for RSA authentication does not exist\n", keyn);
} else if (!key) {
ast_log(LOG_WARNING, "Requested inkey '%s' for RSA authentication does not exist\n", keyn);
}
keyn = strsep(&stringp, ":");
}
ast_free(tmpkey);
if (res && authdebug) {
ast_log(LOG_WARNING, "No RSA public keys on file matched incoming call\n");
}
} else if (p->authmethods & IAX_AUTH_MD5) {
struct MD5Context md5;
unsigned char digest[16];
@ -8237,12 +8285,19 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
sprintf(requeststr + (x << 1), "%02hhx", digest[x]); /* safe */
if (!strcasecmp(requeststr, md5secret)) {
res = 0;
p->eff_auth_method = IAX_AUTH_MD5;
break;
} else if (authdebug) {
ast_log(LOG_WARNING, "MD5 secret mismatch\n");
}
}
} else if (p->authmethods & IAX_AUTH_PLAINTEXT) {
if (!strcmp(secret, p->secret))
if (!strcmp(secret, p->secret)) {
res = 0;
p->eff_auth_method = IAX_AUTH_PLAINTEXT;
} else if (authdebug) {
ast_log(LOG_WARNING, "Plaintext secret mismatch\n");
}
}
return res;
}
@ -8417,22 +8472,25 @@ static int authenticate(const char *challenge, const char *secret, const char *k
if (!ast_strlen_zero(keyn)) {
if (!(authmethods & IAX_AUTH_RSA)) {
if (ast_strlen_zero(secret)) {
ast_log(LOG_NOTICE, "Asked to authenticate to %s with an RSA key, but they don't allow RSA authentication\n", ast_sockaddr_stringify_addr(addr));
ast_log(LOG_WARNING, "Asked to authenticate to %s with an RSA key, but they don't allow RSA authentication\n", ast_sockaddr_stringify_addr(addr));
}
} else if (ast_strlen_zero(challenge)) {
ast_log(LOG_NOTICE, "No challenge provided for RSA authentication to %s\n", ast_sockaddr_stringify_addr(addr));
ast_log(LOG_WARNING, "No challenge provided for RSA authentication to %s\n", ast_sockaddr_stringify_addr(addr));
} else {
char sig[256];
struct ast_key *key;
key = ast_key_get(keyn, AST_KEY_PRIVATE);
if (!key) {
ast_log(LOG_NOTICE, "Unable to find private key '%s'\n", keyn);
ast_log(LOG_WARNING, "Unable to find private key '%s'\n", keyn);
} else {
if (ast_sign(key, (char*)challenge, sig)) {
ast_log(LOG_NOTICE, "Unable to sign challenge with key\n");
ast_log(LOG_WARNING, "Unable to sign challenge with key\n");
res = -1;
} else {
iax_ie_append_str(ied, IAX_IE_RSA_RESULT, sig);
if (pvt) {
pvt->eff_auth_method = IAX_AUTH_RSA;
}
res = 0;
}
}
@ -8465,11 +8523,15 @@ static int authenticate(const char *challenge, const char *secret, const char *k
sprintf(digres + (x << 1), "%02hhx", digest[x]); /* safe */
if (pvt) {
build_encryption_keys(digest, pvt);
pvt->eff_auth_method = IAX_AUTH_MD5;
}
iax_ie_append_str(ied, IAX_IE_MD5_RESULT, digres);
res = 0;
} else if (authmethods & IAX_AUTH_PLAINTEXT) {
iax_ie_append_str(ied, IAX_IE_PASSWORD, secret);
if (pvt) {
pvt->eff_auth_method = IAX_AUTH_PLAINTEXT;
}
res = 0;
} else
ast_log(LOG_WARNING, "No way to send secret to peer '%s' (their methods: %d)\n", ast_sockaddr_stringify_addr(addr), authmethods);
@ -11311,7 +11373,7 @@ static int socket_process_helper(struct iax2_thread *thread)
}
if (authenticate_verify(iaxs[fr->callno], &ies)) {
if (authdebug)
ast_log(LOG_NOTICE, "Host %s failed to authenticate as %s\n", ast_sockaddr_stringify(&addr),
ast_log(LOG_WARNING, "Host %s failed to authenticate as %s\n", ast_sockaddr_stringify(&addr),
iaxs[fr->callno]->username);
memset(&ied0, 0, sizeof(ied0));
auth_fail(fr->callno, IAX_COMMAND_REJECT);
@ -11324,7 +11386,7 @@ static int socket_process_helper(struct iax2_thread *thread)
exists = 0;
if (strcmp(iaxs[fr->callno]->exten, "TBD") && !exists) {
if (authdebug)
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, request '%s@%s' does not exist\n",
ast_log(LOG_WARNING, "Rejected connect attempt from %s, request '%s@%s' does not exist\n",
ast_sockaddr_stringify(&addr),
iaxs[fr->callno]->exten,
iaxs[fr->callno]->context);
@ -11379,12 +11441,12 @@ static int socket_process_helper(struct iax2_thread *thread)
if (!format) {
if (authdebug) {
if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
ast_log(LOG_WARNING, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
ast_sockaddr_stringify(&addr),
iax2_getformatname_multiple(iaxs[fr->callno]->peerformat, &peer_form_buf),
iax2_getformatname_multiple(iaxs[fr->callno]->capability, &cap_buf));
} else {
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
ast_log(LOG_WARNING, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
ast_sockaddr_stringify(&addr),
iax2_getformatname_multiple(iaxs[fr->callno]->peerformat, &peer_form_buf),
iax2_getformatname_multiple(iaxs[fr->callno]->peercapability, &peer_buf),
@ -11437,12 +11499,12 @@ static int socket_process_helper(struct iax2_thread *thread)
iax2_getformatname_multiple(iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability, &cap_buf));
if (authdebug) {
if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
ast_log(LOG_WARNING, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
ast_sockaddr_stringify(&addr),
iax2_getformatname_multiple(iaxs[fr->callno]->peerformat, &peer_form_buf),
iax2_getformatname_multiple(iaxs[fr->callno]->capability, &cap_buf));
} else {
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
ast_log(LOG_WARNING, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
ast_sockaddr_stringify(&addr),
iax2_getformatname_multiple(iaxs[fr->callno]->peerformat, &peer_form_buf),
iax2_getformatname_multiple(iaxs[fr->callno]->peercapability, &peer_buf),
@ -11466,8 +11528,12 @@ static int socket_process_helper(struct iax2_thread *thread)
iax_ie_append_versioned_uint64(&ied1, IAX_IE_FORMAT2, 0, format);
send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACCEPT, 0, ied1.buf, ied1.pos, -1);
if (strcmp(iaxs[fr->callno]->exten, "TBD")) {
char authmethodnames[AUTH_METHOD_NAMES_BUFSIZE];
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
ast_verb(3, "Accepting AUTHENTICATED call from %s:\n"
"%srequested auth methods = (%s),\n"
"%sactual auth method = %s,\n"
"%sencrypted = %s,\n"
"%srequested format = %s,\n"
"%srequested prefs = %s,\n"
"%sactual format = %s,\n"
@ -11475,6 +11541,12 @@ static int socket_process_helper(struct iax2_thread *thread)
"%spriority = %s\n",
ast_sockaddr_stringify(&addr),
VERBOSE_PREFIX_4,
auth_method_names(iaxs[fr->callno]->authmethods, authmethodnames),
VERBOSE_PREFIX_4,
auth_method_labels[iaxs[fr->callno]->eff_auth_method],
VERBOSE_PREFIX_4,
IAX_CALLENCRYPTED(iaxs[fr->callno]) ? "yes" : "no",
VERBOSE_PREFIX_4,
iax2_getformatname(iaxs[fr->callno]->peerformat),
VERBOSE_PREFIX_4,
caller_pref_buf,
@ -11543,7 +11615,7 @@ immediatedial:
ast_string_field_set(iaxs[fr->callno], exten, ies.called_number ? ies.called_number : "s");
if (!ast_exists_extension(NULL, iaxs[fr->callno]->context, iaxs[fr->callno]->exten, 1, iaxs[fr->callno]->cid_num)) {
if (authdebug)
ast_log(LOG_NOTICE, "Rejected dial attempt from %s, request '%s@%s' does not exist\n",
ast_log(LOG_WARNING, "Rejected dial attempt from %s, request '%s@%s' does not exist\n",
ast_sockaddr_stringify(&addr),
iaxs[fr->callno]->exten,
iaxs[fr->callno]->context);

View File

@ -3266,6 +3266,8 @@ static struct ast_custom_function session_refresh_function = {
.write = pjsip_acf_session_refresh_write,
};
static char *app_pjsip_hangup = "PJSIPHangup";
/*!
* \brief Load the module
*
@ -3323,6 +3325,13 @@ static int load_module(void)
goto end;
}
if (ast_register_application_xml(app_pjsip_hangup, pjsip_app_hangup)) {
ast_log(LOG_WARNING, "Unable to register PJSIPHangup dialplan application\n");
goto end;
}
ast_manager_register_xml(app_pjsip_hangup, EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL, pjsip_action_hangup);
ast_sip_register_service(&refer_callback_module);
ast_sip_session_register_supplement(&chan_pjsip_supplement);
@ -3370,6 +3379,9 @@ end:
ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
ast_custom_function_unregister(&chan_pjsip_parse_uri_function);
ast_custom_function_unregister(&session_refresh_function);
ast_unregister_application(app_pjsip_hangup);
ast_manager_unregister(app_pjsip_hangup);
ast_channel_unregister(&chan_pjsip_tech);
ast_rtp_glue_unregister(&chan_pjsip_rtp_glue);
@ -3399,6 +3411,8 @@ static int unload_module(void)
ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
ast_custom_function_unregister(&chan_pjsip_parse_uri_function);
ast_custom_function_unregister(&session_refresh_function);
ast_unregister_application(app_pjsip_hangup);
ast_manager_unregister(app_pjsip_hangup);
ast_channel_unregister(&chan_pjsip_tech);
ao2_ref(chan_pjsip_tech.capabilities, -1);

View File

@ -129,7 +129,8 @@ static struct ast_format *derive_format_from_cap(struct ast_format_cap *cap)
* assignments. Signed linear @ 8kHz does not map, so if that is our
* only capability, we force μ-law instead.
*/
fmt = ast_format_ulaw;
ao2_ref(fmt, -1);
fmt = ao2_bump(ast_format_ulaw);
}
return fmt;
@ -211,7 +212,7 @@ static struct ast_channel *multicast_rtp_request(const char *type, struct ast_fo
}
chan = ast_channel_alloc(1, AST_STATE_DOWN, "", "", "", "", "", assignedids,
requestor, 0, "MulticastRTP/%p", instance);
requestor, 0, "MulticastRTP/%s-%p", args.destination, instance);
if (!chan) {
ast_rtp_instance_destroy(instance);
goto failure;
@ -249,6 +250,7 @@ failure:
enum {
OPT_RTP_CODEC = (1 << 0),
OPT_RTP_ENGINE = (1 << 1),
OPT_RTP_GLUE = (1 << 2),
};
enum {
@ -263,8 +265,14 @@ AST_APP_OPTIONS(unicast_rtp_options, BEGIN_OPTIONS
AST_APP_OPTION_ARG('c', OPT_RTP_CODEC, OPT_ARG_RTP_CODEC),
/*! Set the RTP engine to use for unicast RTP */
AST_APP_OPTION_ARG('e', OPT_RTP_ENGINE, OPT_ARG_RTP_ENGINE),
/*! Provide RTP glue for the channel */
AST_APP_OPTION('g', OPT_RTP_GLUE),
END_OPTIONS );
static const struct ast_datastore_info chan_rtp_datastore_info = {
.type = "CHAN_RTP_GLUE",
};
/*! \brief Function called when we should prepare to call the unicast destination */
static struct ast_channel *unicast_rtp_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
{
@ -372,6 +380,13 @@ static struct ast_channel *unicast_rtp_request(const char *type, struct ast_form
ast_channel_tech_set(chan, &unicast_rtp_tech);
if (ast_test_flag(&opts, OPT_RTP_GLUE)) {
struct ast_datastore *datastore;
if ((datastore = ast_datastore_alloc(&chan_rtp_datastore_info, NULL))) {
ast_channel_datastore_add(chan, datastore);
}
}
ast_format_cap_append(caps, fmt, 0);
ast_channel_nativeformats_set(chan, caps);
ast_channel_set_writeformat(chan, fmt);
@ -401,6 +416,61 @@ failure:
return NULL;
}
/*! \brief Function called by RTP engine to get peer capabilities */
static void chan_rtp_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
{
SCOPE_ENTER(1, "%s Native formats %s\n", ast_channel_name(chan),
ast_str_tmp(AST_FORMAT_CAP_NAMES_LEN, ast_format_cap_get_names(ast_channel_nativeformats(chan), &STR_TMP)));
ast_format_cap_append_from_cap(result, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_UNKNOWN);
SCOPE_EXIT_RTN();
}
/*! \brief Function called by RTP engine to change where the remote party should send media.
*
* chan_rtp is not able to actually update the peer, so this function has no effect.
* */
static int chan_rtp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, const struct ast_format_cap *cap, int nat_active)
{
return -1;
}
/*! \brief Function called by RTP engine to get local audio RTP peer */
static enum ast_rtp_glue_result chan_rtp_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
{
return AST_RTP_GLUE_RESULT_FORBID;
}
/*! \brief Function called by RTP engine to get local audio RTP peer */
static enum ast_rtp_glue_result chan_rtp_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
{
struct ast_rtp_instance *rtp_instance = ast_channel_tech_pvt(chan);
struct ast_datastore *datastore;
if (!rtp_instance) {
return AST_RTP_GLUE_RESULT_FORBID;
}
if ((datastore = ast_channel_datastore_find(chan, &chan_rtp_datastore_info, NULL))) {
ao2_ref(datastore, -1);
*instance = rtp_instance;
ao2_ref(*instance, +1);
return AST_RTP_GLUE_RESULT_LOCAL;
}
return AST_RTP_GLUE_RESULT_FORBID;
}
/*! \brief Local glue for interacting with the RTP engine core */
static struct ast_rtp_glue unicast_rtp_glue = {
.type = "UnicastRTP",
.get_rtp_info = chan_rtp_get_rtp_peer,
.get_vrtp_info = chan_rtp_get_vrtp_peer,
.get_codec = chan_rtp_get_codec,
.update_peer = chan_rtp_set_rtp_peer,
};
/*! \brief Function called when our module is unloaded */
static int unload_module(void)
{
@ -412,6 +482,8 @@ static int unload_module(void)
ao2_cleanup(unicast_rtp_tech.capabilities);
unicast_rtp_tech.capabilities = NULL;
ast_rtp_glue_unregister(&unicast_rtp_glue);
return 0;
}
@ -421,6 +493,9 @@ static int load_module(void)
if (!(multicast_rtp_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
return AST_MODULE_LOAD_DECLINE;
}
ast_rtp_glue_register(&unicast_rtp_glue);
ast_format_cap_append_by_type(multicast_rtp_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
if (ast_channel_register(&multicast_rtp_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class 'MulticastRTP'\n");

View File

@ -424,7 +424,7 @@ static void dump_ies(unsigned char *iedata, int len)
if (len < 2)
return;
while(len > 2) {
while(len >= 2) {
ie = iedata[0];
ielen = iedata[1];
if (ielen + 2> len) {
@ -1063,7 +1063,7 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
if (len == (int)sizeof(unsigned int)) {
ies->calling_ani2 = ntohl(get_unaligned_uint32(data + 2));
} else {
snprintf(tmp, (int)sizeof(tmp), "callingani2 was %d long: %s\n", len, data + 2);
snprintf(tmp, sizeof(tmp), "Expected callingani2 to be %zu bytes but was %d\n", sizeof(unsigned int), len);
errorf(tmp);
}
break;

View File

@ -343,6 +343,7 @@ static int cli_channelstats_print_body(void *obj, void *arg, int flags)
struct ast_sip_session *session;
struct ast_sip_session_media *media;
struct ast_rtp_instance_stats stats;
struct ast_stream *stream;
char *print_name = NULL;
char *print_time = alloca(32);
char codec_in_use[7];
@ -359,16 +360,29 @@ static int cli_channelstats_print_body(void *obj, void *arg, int flags)
cpvt = ast_channel_tech_pvt(channel);
session = cpvt ? cpvt->session : NULL;
if (!session) {
if (!session
|| !session->active_media_state
|| !session->active_media_state->topology) {
ast_str_append(&context->output_buffer, 0, " %s not valid\n", snapshot->base->name);
ast_channel_unlock(channel);
ao2_cleanup(channel);
return 0;
}
stream = ast_stream_topology_get_first_stream_by_type(
session->active_media_state->topology, AST_MEDIA_TYPE_AUDIO);
if (!stream) {
ast_str_append(&context->output_buffer, 0, " %s no audio streams\n", snapshot->base->name);
ast_channel_unlock(channel);
ao2_cleanup(channel);
return 0;
}
media = session->active_media_state->default_session[AST_MEDIA_TYPE_AUDIO];
if (!media || !media->rtp) {
ast_str_append(&context->output_buffer, 0, " %s not valid\n", snapshot->base->name);
if (!media || media->type != AST_MEDIA_TYPE_AUDIO || !media->rtp) {
ast_str_append(&context->output_buffer, 0, " %s corrupted default audio session\n", snapshot->base->name);
ast_channel_unlock(channel);
ao2_cleanup(channel);
return 0;

View File

@ -29,563 +29,6 @@
<support_level>core</support_level>
***/
/*** DOCUMENTATION
<function name="PJSIP_DIAL_CONTACTS" language="en_US">
<synopsis>
Return a dial string for dialing all contacts on an AOR.
</synopsis>
<syntax>
<parameter name="endpoint" required="true">
<para>Name of the endpoint</para>
</parameter>
<parameter name="aor" required="false">
<para>Name of an AOR to use, if not specified the configured AORs on the endpoint are used</para>
</parameter>
<parameter name="request_user" required="false">
<para>Optional request user to use in the request URI</para>
</parameter>
</syntax>
<description>
<para>Returns a properly formatted dial string for dialing all contacts on an AOR.</para>
</description>
</function>
<function name="PJSIP_MEDIA_OFFER" language="en_US">
<synopsis>
Media and codec offerings to be set on an outbound SIP channel prior to dialing.
</synopsis>
<syntax>
<parameter name="media" required="true">
<para>types of media offered</para>
</parameter>
</syntax>
<description>
<para>When read, returns the codecs offered based upon the media choice.</para>
<para>When written, sets the codecs to offer when an outbound dial attempt is made,
or when a session refresh is sent using <replaceable>PJSIP_SEND_SESSION_REFRESH</replaceable>.
</para>
</description>
<see-also>
<ref type="function">PJSIP_SEND_SESSION_REFRESH</ref>
</see-also>
</function>
<function name="PJSIP_DTMF_MODE" language="en_US">
<since>
<version>13.18.0</version>
<version>14.7.0</version>
<version>15.1.0</version>
<version>16.0.0</version>
</since>
<synopsis>
Get or change the DTMF mode for a SIP call.
</synopsis>
<syntax>
</syntax>
<description>
<para>When read, returns the current DTMF mode</para>
<para>When written, sets the current DTMF mode</para>
<para>This function uses the same DTMF mode naming as the dtmf_mode configuration option</para>
</description>
</function>
<function name="PJSIP_MOH_PASSTHROUGH" language="en_US">
<synopsis>
Get or change the on-hold behavior for a SIP call.
</synopsis>
<syntax>
</syntax>
<description>
<para>When read, returns the current moh passthrough mode</para>
<para>When written, sets the current moh passthrough mode</para>
<para>If <replaceable>yes</replaceable>, on-hold re-INVITEs are sent. If <replaceable>no</replaceable>, music on hold is generated.</para>
<para>This function can be used to override the moh_passthrough configuration option</para>
</description>
</function>
<function name="PJSIP_SEND_SESSION_REFRESH" language="en_US">
<since>
<version>13.12.0</version>
<version>14.1.0</version>
<version>15.0.0</version>
</since>
<synopsis>
W/O: Initiate a session refresh via an UPDATE or re-INVITE on an established media session
</synopsis>
<syntax>
<parameter name="update_type" required="false">
<para>The type of update to send. Default is <literal>invite</literal>.</para>
<enumlist>
<enum name="invite">
<para>Send the session refresh as a re-INVITE.</para>
</enum>
<enum name="update">
<para>Send the session refresh as an UPDATE.</para>
</enum>
</enumlist>
</parameter>
</syntax>
<description>
<para>This function will cause the PJSIP stack to immediately refresh
the media session for the channel. This will be done using either a
re-INVITE (default) or an UPDATE request.
</para>
<para>This is most useful when combined with the <replaceable>PJSIP_MEDIA_OFFER</replaceable>
dialplan function, as it allows the formats in use on a channel to be
re-negotiated after call setup.</para>
<warning>
<para>The formats the endpoint supports are <emphasis>not</emphasis>
checked or enforced by this function. Using this function to offer
formats not supported by the endpoint <emphasis>may</emphasis> result
in a loss of media.</para>
</warning>
<example title="Re-negotiate format to g722">
; Within some existing extension on an answered channel
same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
</example>
</description>
<see-also>
<ref type="function">PJSIP_MEDIA_OFFER</ref>
</see-also>
</function>
<function name="PJSIP_PARSE_URI" language="en_US">
<since>
<version>13.24.0</version>
<version>16.1.0</version>
<version>17.0.0</version>
</since>
<synopsis>
Parse an uri and return a type part of the URI.
</synopsis>
<syntax>
<parameter name="uri" required="true">
<para>URI to parse</para>
</parameter>
<parameter name="type" required="true">
<para>The <literal>type</literal> parameter specifies which URI part to read</para>
<enumlist>
<enum name="display">
<para>Display name.</para>
</enum>
<enum name="scheme">
<para>URI scheme.</para>
</enum>
<enum name="user">
<para>User part.</para>
</enum>
<enum name="passwd">
<para>Password part.</para>
</enum>
<enum name="host">
<para>Host part.</para>
</enum>
<enum name="port">
<para>Port number, or zero.</para>
</enum>
<enum name="user_param">
<para>User parameter.</para>
</enum>
<enum name="method_param">
<para>Method parameter.</para>
</enum>
<enum name="transport_param">
<para>Transport parameter.</para>
</enum>
<enum name="ttl_param">
<para>TTL param, or -1.</para>
</enum>
<enum name="lr_param">
<para>Loose routing param, or zero.</para>
</enum>
<enum name="maddr_param">
<para>Maddr param.</para>
</enum>
</enumlist>
</parameter>
</syntax>
<description>
<para>Parse an URI and return a specified part of the URI.</para>
</description>
</function>
<info name="CHANNEL" language="en_US" tech="PJSIP">
<enumlist>
<enum name="rtp">
<para>R/O Retrieve media related information.</para>
<parameter name="type" required="true">
<para>When <replaceable>rtp</replaceable> is specified, the
<literal>type</literal> parameter must be provided. It specifies
which RTP parameter to read.</para>
<enumlist>
<enum name="src">
<para>Retrieve the local address for RTP.</para>
</enum>
<enum name="dest">
<para>Retrieve the remote address for RTP.</para>
</enum>
<enum name="direct">
<para>If direct media is enabled, this address is the remote address
used for RTP.</para>
</enum>
<enum name="secure">
<para>Whether or not the media stream is encrypted.</para>
<enumlist>
<enum name="0">
<para>The media stream is not encrypted.</para>
</enum>
<enum name="1">
<para>The media stream is encrypted.</para>
</enum>
</enumlist>
</enum>
<enum name="hold">
<para>Whether or not the media stream is currently restricted
due to a call hold.</para>
<enumlist>
<enum name="0">
<para>The media stream is not held.</para>
</enum>
<enum name="1">
<para>The media stream is held.</para>
</enum>
</enumlist>
</enum>
</enumlist>
</parameter>
<parameter name="media_type" required="false">
<para>When <replaceable>rtp</replaceable> is specified, the
<literal>media_type</literal> parameter may be provided. It specifies
which media stream the chosen RTP parameter should be retrieved
from.</para>
<enumlist>
<enum name="audio">
<para>Retrieve information from the audio media stream.</para>
<note><para>If not specified, <literal>audio</literal> is used
by default.</para></note>
</enum>
<enum name="video">
<para>Retrieve information from the video media stream.</para>
</enum>
</enumlist>
</parameter>
</enum>
<enum name="rtcp">
<para>R/O Retrieve RTCP statistics.</para>
<parameter name="statistic" required="true">
<para>When <replaceable>rtcp</replaceable> is specified, the
<literal>statistic</literal> parameter must be provided. It specifies
which RTCP statistic parameter to read.</para>
<enumlist>
<enum name="all">
<para>Retrieve a summary of all RTCP statistics.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="ssrc">
<para>Our Synchronization Source identifier</para>
</enum>
<enum name="themssrc">
<para>Their Synchronization Source identifier</para>
</enum>
<enum name="lp">
<para>Our lost packet count</para>
</enum>
<enum name="rxjitter">
<para>Received packet jitter</para>
</enum>
<enum name="rxcount">
<para>Received packet count</para>
</enum>
<enum name="txjitter">
<para>Transmitted packet jitter</para>
</enum>
<enum name="txcount">
<para>Transmitted packet count</para>
</enum>
<enum name="rlp">
<para>Remote lost packet count</para>
</enum>
<enum name="rtt">
<para>Round trip time</para>
</enum>
<enum name="txmes">
<para>Transmitted Media Experience Score</para>
</enum>
<enum name="rxmes">
<para>Received Media Experience Score</para>
</enum>
</enumlist>
</enum>
<enum name="all_jitter">
<para>Retrieve a summary of all RTCP Jitter statistics.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="minrxjitter">
<para>Our minimum jitter</para>
</enum>
<enum name="maxrxjitter">
<para>Our max jitter</para>
</enum>
<enum name="avgrxjitter">
<para>Our average jitter</para>
</enum>
<enum name="stdevrxjitter">
<para>Our jitter standard deviation</para>
</enum>
<enum name="reported_minjitter">
<para>Their minimum jitter</para>
</enum>
<enum name="reported_maxjitter">
<para>Their max jitter</para>
</enum>
<enum name="reported_avgjitter">
<para>Their average jitter</para>
</enum>
<enum name="reported_stdevjitter">
<para>Their jitter standard deviation</para>
</enum>
</enumlist>
</enum>
<enum name="all_loss">
<para>Retrieve a summary of all RTCP packet loss statistics.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="minrxlost">
<para>Our minimum lost packets</para>
</enum>
<enum name="maxrxlost">
<para>Our max lost packets</para>
</enum>
<enum name="avgrxlost">
<para>Our average lost packets</para>
</enum>
<enum name="stdevrxlost">
<para>Our lost packets standard deviation</para>
</enum>
<enum name="reported_minlost">
<para>Their minimum lost packets</para>
</enum>
<enum name="reported_maxlost">
<para>Their max lost packets</para>
</enum>
<enum name="reported_avglost">
<para>Their average lost packets</para>
</enum>
<enum name="reported_stdevlost">
<para>Their lost packets standard deviation</para>
</enum>
</enumlist>
</enum>
<enum name="all_rtt">
<para>Retrieve a summary of all RTCP round trip time information.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="minrtt">
<para>Minimum round trip time</para>
</enum>
<enum name="maxrtt">
<para>Maximum round trip time</para>
</enum>
<enum name="avgrtt">
<para>Average round trip time</para>
</enum>
<enum name="stdevrtt">
<para>Standard deviation round trip time</para>
</enum>
</enumlist>
</enum>
<enum name="all_mes">
<para>Retrieve a summary of all RTCP Media Experience Score information.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="minmes">
<para>Minimum MES based on us analysing received packets.</para>
</enum>
<enum name="maxmes">
<para>Maximum MES based on us analysing received packets.</para>
</enum>
<enum name="avgmes">
<para>Average MES based on us analysing received packets.</para>
</enum>
<enum name="stdevmes">
<para>Standard deviation MES based on us analysing received packets.</para>
</enum>
<enum name="reported_minmes">
<para>Minimum MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
</enum>
<enum name="reported_maxmes">
<para>Maximum MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
</enum>
<enum name="reported_avgmes">
<para>Average MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
</enum>
<enum name="reported_stdevmes">
<para>Standard deviation MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
</enum>
</enumlist>
</enum>
<enum name="txcount"><para>Transmitted packet count</para></enum>
<enum name="rxcount"><para>Received packet count</para></enum>
<enum name="txjitter"><para>Transmitted packet jitter</para></enum>
<enum name="rxjitter"><para>Received packet jitter</para></enum>
<enum name="remote_maxjitter"><para>Their max jitter</para></enum>
<enum name="remote_minjitter"><para>Their minimum jitter</para></enum>
<enum name="remote_normdevjitter"><para>Their average jitter</para></enum>
<enum name="remote_stdevjitter"><para>Their jitter standard deviation</para></enum>
<enum name="local_maxjitter"><para>Our max jitter</para></enum>
<enum name="local_minjitter"><para>Our minimum jitter</para></enum>
<enum name="local_normdevjitter"><para>Our average jitter</para></enum>
<enum name="local_stdevjitter"><para>Our jitter standard deviation</para></enum>
<enum name="txploss"><para>Transmitted packet loss</para></enum>
<enum name="rxploss"><para>Received packet loss</para></enum>
<enum name="remote_maxrxploss"><para>Their max lost packets</para></enum>
<enum name="remote_minrxploss"><para>Their minimum lost packets</para></enum>
<enum name="remote_normdevrxploss"><para>Their average lost packets</para></enum>
<enum name="remote_stdevrxploss"><para>Their lost packets standard deviation</para></enum>
<enum name="local_maxrxploss"><para>Our max lost packets</para></enum>
<enum name="local_minrxploss"><para>Our minimum lost packets</para></enum>
<enum name="local_normdevrxploss"><para>Our average lost packets</para></enum>
<enum name="local_stdevrxploss"><para>Our lost packets standard deviation</para></enum>
<enum name="rtt"><para>Round trip time</para></enum>
<enum name="maxrtt"><para>Maximum round trip time</para></enum>
<enum name="minrtt"><para>Minimum round trip time</para></enum>
<enum name="normdevrtt"><para>Average round trip time</para></enum>
<enum name="stdevrtt"><para>Standard deviation round trip time</para></enum>
<enum name="local_ssrc"><para>Our Synchronization Source identifier</para></enum>
<enum name="remote_ssrc"><para>Their Synchronization Source identifier</para></enum>
<enum name="txmes"><para>
Current MES based on us analyzing rtt, jitter and loss
in the actual received RTP stream received from the remote end.
I.E. This is the MES for the incoming audio stream.
</para></enum>
<enum name="rxmes"><para>
Current MES based on rtt and the jitter and loss values in
RTCP sender and receiver reports we receive from the
remote end. I.E. This is the MES for the outgoing audio stream.
</para></enum>
<enum name="remote_maxmes"><para>Max MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
<enum name="remote_minmes"><para>Min MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
<enum name="remote_normdevmes"><para>Average MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
<enum name="remote_stdevmes"><para>Standard deviation MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
<enum name="local_maxmes"><para>Max MES based on us analyzing the received RTP stream</para></enum>
<enum name="local_minmes"><para>Min MES based on us analyzing the received RTP stream</para></enum>
<enum name="local_normdevmes"><para>Average MES based on us analyzing the received RTP stream</para></enum>
<enum name="local_stdevmes"><para>Standard deviation MES based on us analyzing the received RTP stream</para></enum>
</enumlist>
</parameter>
<parameter name="media_type" required="false">
<para>When <replaceable>rtcp</replaceable> is specified, the
<literal>media_type</literal> parameter may be provided. It specifies
which media stream the chosen RTCP parameter should be retrieved
from.</para>
<enumlist>
<enum name="audio">
<para>Retrieve information from the audio media stream.</para>
<note><para>If not specified, <literal>audio</literal> is used
by default.</para></note>
</enum>
<enum name="video">
<para>Retrieve information from the video media stream.</para>
</enum>
</enumlist>
</parameter>
</enum>
<enum name="endpoint">
<para>R/O The name of the endpoint associated with this channel.
Use the <replaceable>PJSIP_ENDPOINT</replaceable> function to obtain
further endpoint related information.</para>
</enum>
<enum name="contact">
<para>R/O The name of the contact associated with this channel.
Use the <replaceable>PJSIP_CONTACT</replaceable> function to obtain
further contact related information. Note this may not be present and if so
is only available on outgoing legs.</para>
</enum>
<enum name="aor">
<para>R/O The name of the AOR associated with this channel.
Use the <replaceable>PJSIP_AOR</replaceable> function to obtain
further AOR related information. Note this may not be present and if so
is only available on outgoing legs.</para>
</enum>
<enum name="pjsip">
<para>R/O Obtain information about the current PJSIP channel and its
session.</para>
<parameter name="type" required="true">
<para>When <replaceable>pjsip</replaceable> is specified, the
<literal>type</literal> parameter must be provided. It specifies
which signalling parameter to read.</para>
<enumlist>
<enum name="call-id">
<para>The SIP call-id.</para>
</enum>
<enum name="secure">
<para>Whether or not the signalling uses a secure transport.</para>
<enumlist>
<enum name="0"><para>The signalling uses a non-secure transport.</para></enum>
<enum name="1"><para>The signalling uses a secure transport.</para></enum>
</enumlist>
</enum>
<enum name="target_uri">
<para>The contact URI where requests are sent.</para>
</enum>
<enum name="local_uri">
<para>The local URI.</para>
</enum>
<enum name="local_tag">
<para>Tag in From header</para>
</enum>
<enum name="remote_uri">
<para>The remote URI.</para>
</enum>
<enum name="remote_tag">
<para>Tag in To header</para>
</enum>
<enum name="request_uri">
<para>The request URI of the incoming <literal>INVITE</literal>
associated with the creation of this channel.</para>
</enum>
<enum name="t38state">
<para>The current state of any T.38 fax on this channel.</para>
<enumlist>
<enum name="DISABLED"><para>T.38 faxing is disabled on this channel.</para></enum>
<enum name="LOCAL_REINVITE"><para>Asterisk has sent a <literal>re-INVITE</literal> to the remote end to initiate a T.38 fax.</para></enum>
<enum name="REMOTE_REINVITE"><para>The remote end has sent a <literal>re-INVITE</literal> to Asterisk to initiate a T.38 fax.</para></enum>
<enum name="ENABLED"><para>A T.38 fax session has been enabled.</para></enum>
<enum name="REJECTED"><para>A T.38 fax session was attempted but was rejected.</para></enum>
</enumlist>
</enum>
<enum name="local_addr">
<para>On inbound calls, the full IP address and port number that
the <literal>INVITE</literal> request was received on. On outbound
calls, the full IP address and port number that the <literal>INVITE</literal>
request was transmitted from.</para>
</enum>
<enum name="remote_addr">
<para>On inbound calls, the full IP address and port number that
the <literal>INVITE</literal> request was received from. On outbound
calls, the full IP address and port number that the <literal>INVITE</literal>
request was transmitted to.</para>
</enum>
</enumlist>
</parameter>
</enum>
</enumlist>
</info>
<info name="CHANNEL_EXAMPLES" language="en_US" tech="PJSIP">
<example title="PJSIP specific CHANNEL examples">
; Log the current Call-ID
same => n,Log(NOTICE, ${CHANNEL(pjsip,call-id)})
; Log the destination address of the audio stream
same => n,Log(NOTICE, ${CHANNEL(rtp,dest)})
; Store the round-trip time associated with a
; video stream in the CDR field video-rtt
same => n,Set(CDR(video-rtt)=${CHANNEL(rtcp,rtt,video)})
</example>
</info>
***/
#include "asterisk.h"
#include <pjsip.h>
@ -596,6 +39,7 @@
#include "asterisk/module.h"
#include "asterisk/acl.h"
#include "asterisk/app.h"
#include "asterisk/conversions.h"
#include "asterisk/channel.h"
#include "asterisk/stream.h"
#include "asterisk/format.h"
@ -1784,3 +1228,121 @@ int pjsip_acf_session_refresh_write(struct ast_channel *chan, const char *cmd, c
return ast_sip_push_task_wait_serializer(channel->session->serializer, refresh_write_cb, &rdata);
}
struct hangup_data {
struct ast_sip_session *session;
int response_code;
};
/*!
* \brief Serializer task to hangup channel
*/
static int pjsip_hangup(void *obj)
{
struct hangup_data *hdata = obj;
pjsip_tx_data *packet = NULL;
if ((hdata->session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED) &&
(pjsip_inv_answer(hdata->session->inv_session, hdata->response_code, NULL, NULL, &packet) == PJ_SUCCESS)) {
ast_sip_session_send_response(hdata->session, packet);
}
return 0;
}
/*!
* \brief Callback that validates the response code
*/
static int response_code_validator(const char *channel_name,
const char *response) {
int response_code;
int rc = ast_str_to_int(response, &response_code);
if (rc != 0) {
response_code = ast_sip_str2rc(response);
if (response_code < 0) {
ast_log(LOG_WARNING, "%s: Unrecognized response code parameter '%s'."
" Defaulting to 603 DECLINE\n",
channel_name, response);
return PJSIP_SC_DECLINE;
}
}
if (response_code < 400 || response_code > 699) {
ast_log(LOG_WARNING, "%s: Response code %d is out of range 400 -> 699."
" Defaulting to 603 DECLINE\n",
channel_name, response_code);
return PJSIP_SC_DECLINE;
}
return response_code;
}
/*!
* \brief Called by pjsip_app_hangup and pjsip_action_hangup
* to actually perform the hangup
*/
static void pjsip_app_hangup_handler(struct ast_channel *chan, int response_code)
{
struct ast_sip_channel_pvt *channel;
struct hangup_data hdata = { NULL, -1 };
const char *tag = ast_channel_name(chan);
hdata.response_code = response_code;
ast_channel_lock(chan);
if (strcmp(ast_channel_tech(chan)->type, "PJSIP")) {
ast_log(LOG_WARNING, "%s: Not a PJSIP channel\n", tag);
ast_channel_unlock(chan);
return;
}
channel = ast_channel_tech_pvt(chan);
hdata.session = channel->session;
if (hdata.session->inv_session->role != PJSIP_ROLE_UAS || (
hdata.session->inv_session->state != PJSIP_INV_STATE_INCOMING &&
hdata.session->inv_session->state != PJSIP_INV_STATE_EARLY)) {
ast_log(LOG_WARNING, "%s: Not an incoming channel or invalid state '%s'\n",
tag, pjsip_inv_state_name(hdata.session->inv_session->state));
ast_channel_unlock(chan);
return;
}
ast_channel_unlock(chan);
if (ast_sip_push_task_wait_serializer(channel->session->serializer,
pjsip_hangup, &hdata) != 0) {
ast_log(LOG_WARNING, "%s: failed to push hangup task to serializer\n", tag);
}
return;
}
/*!
* \brief PJSIPHangup Dialplan App
*/
int pjsip_app_hangup(struct ast_channel *chan, const char *data)
{
int response_code;
const char *tag = ast_channel_name(chan);
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "%s: Missing response code parameter\n", tag);
return -1;
}
response_code = response_code_validator(tag, data);
pjsip_app_hangup_handler(chan, response_code);
return -1;
}
/*!
* \brief PJSIPHangup Manager Action
*/
int pjsip_action_hangup(struct mansession *s, const struct message *m)
{
return ast_manager_hangup_helper(s, m,
pjsip_app_hangup_handler, response_code_validator);
}

View File

@ -0,0 +1,659 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE docs SYSTEM "appdocsxml.dtd">
<docs>
<application name="PJSIPHangup" language="en_US">
<synopsis>
Hangup an incoming PJSIP channel with a SIP response code
</synopsis>
<syntax>
<parameter name="Cause" required="true">
<para>May be one of...</para>
<enumlist>
<enum name="Response code"><para>A numeric response code in the range 400 ->699</para></enum>
<enum name="Response code name"><para>A response code name from
<literal>third-party/pjproject/source/pjsip/include/pjsip/sip_msg.h</literal>
such as <literal>USE_IDENTITY_HEADER</literal> or
<literal>PJSIP_SC_USE_IDENTITY_HEADER</literal></para></enum>
</enumlist>
</parameter>
</syntax>
<description>
<para>
Hangs up an incoming PJSIP channel and returns the
specified SIP response code in the final response to the caller.
</para>
<para>
</para>
<warning><para>
This function must be called BEFORE anything that
might cause any other final (non 1XX) response to be sent.
For example calling <literal>Answer()</literal> or
<literal>Playback</literal> without the
<literal>noanswer</literal> option will cause the call
to be answered and a final 200 response to be sent.
</para></warning>
<para>
</para>
<para>As with the <literal>Hangup</literal> application,
the dialplan will terminate after calling this function.</para>
<para>
</para>
<para>The cause code set on the channel will be translated to
a standard ISDN cause code using the table defined in
ast_sip_hangup_sip2cause() in res_pjsip.c</para>
<para>
</para>
<example title="Terminate call with 437 response code">
same = n,PJSIPHangup(437)
</example>
<example title="Terminate call with 437 response code using the response code name">
same = n,PJSIPHangup(UNSUPPORTED_CERTIFICATE)
</example>
<example title="Terminate call with 437 response code based on condition">
same = n,ExecIf($[${SOMEVALUE} = ${SOME_BAD_VALUE}]?PJSIPHangup(437))
</example>
</description>
</application>
<manager name="PJSIPHangup" language="en_US">
<synopsis>
Hangup an incoming PJSIP channel with a SIP response code
</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
<xi:include xpointer="xpointer(/docs/manager[@name='Hangup']/syntax/parameter[@name='Channel'])" />
<xi:include xpointer="xpointer(/docs/application[@name='PJSIPHangup']/syntax/parameter[@name='Cause'])" />
</syntax>
<description>
<para>
Hangs up an incoming PJSIP channel and returns the
specified SIP response code in the final response to the caller.
</para>
<para>
</para>
<warning><para>
This function must be called BEFORE anything that
might cause any other final (non 1XX) response to be sent.
For example calling <literal>Answer()</literal> or
<literal>Playback</literal> without the
<literal>noanswer</literal> option will cause the call
to be answered and a final 200 response to be sent.
</para></warning>
<para>
</para>
<para>The cause code set on the channel will be translated to
a standard ISDN cause code using the table defined in
ast_sip_hangup_sip2cause() in res_pjsip.c</para>
<para>
</para>
<example title="Terminate call with 437 response code">
Action: PJSIPHangup
ActionID: 12345678
Channel: PJSIP/alice-00000002
Cause: 437
</example>
<example title="Terminate call with 437 response code using the response code name">
Action: PJSIPHangup
ActionID: 12345678
Channel: PJSIP/alice-00000002
Cause: UNSUPPORTED_CERTIFICATE
</example>
</description>
</manager>
<function name="PJSIP_DIAL_CONTACTS" language="en_US">
<synopsis>
Return a dial string for dialing all contacts on an AOR.
</synopsis>
<syntax>
<parameter name="endpoint" required="true">
<para>Name of the endpoint</para>
</parameter>
<parameter name="aor" required="false">
<para>Name of an AOR to use, if not specified the configured AORs on the endpoint are used</para>
</parameter>
<parameter name="request_user" required="false">
<para>Optional request user to use in the request URI</para>
</parameter>
</syntax>
<description>
<para>Returns a properly formatted dial string for dialing all contacts on an AOR.</para>
</description>
</function>
<function name="PJSIP_MEDIA_OFFER" language="en_US">
<synopsis>
Media and codec offerings to be set on an outbound SIP channel prior to dialing.
</synopsis>
<syntax>
<parameter name="media" required="true">
<para>types of media offered</para>
</parameter>
</syntax>
<description>
<para>When read, returns the codecs offered based upon the media choice.</para>
<para>When written, sets the codecs to offer when an outbound dial attempt is made,
or when a session refresh is sent using <replaceable>PJSIP_SEND_SESSION_REFRESH</replaceable>.
</para>
</description>
<see-also>
<ref type="function">PJSIP_SEND_SESSION_REFRESH</ref>
</see-also>
</function>
<function name="PJSIP_DTMF_MODE" language="en_US">
<since>
<version>13.18.0</version>
<version>14.7.0</version>
<version>15.1.0</version>
<version>16.0.0</version>
</since>
<synopsis>
Get or change the DTMF mode for a SIP call.
</synopsis>
<syntax>
</syntax>
<description>
<para>When read, returns the current DTMF mode</para>
<para>When written, sets the current DTMF mode</para>
<para>This function uses the same DTMF mode naming as the dtmf_mode configuration option</para>
</description>
</function>
<function name="PJSIP_MOH_PASSTHROUGH" language="en_US">
<synopsis>
Get or change the on-hold behavior for a SIP call.
</synopsis>
<syntax>
</syntax>
<description>
<para>When read, returns the current moh passthrough mode</para>
<para>When written, sets the current moh passthrough mode</para>
<para>If <replaceable>yes</replaceable>, on-hold re-INVITEs are sent. If <replaceable>no</replaceable>, music on hold is generated.</para>
<para>This function can be used to override the moh_passthrough configuration option</para>
</description>
</function>
<function name="PJSIP_SEND_SESSION_REFRESH" language="en_US">
<since>
<version>13.12.0</version>
<version>14.1.0</version>
<version>15.0.0</version>
</since>
<synopsis>
W/O: Initiate a session refresh via an UPDATE or re-INVITE on an established media session
</synopsis>
<syntax>
<parameter name="update_type" required="false">
<para>The type of update to send. Default is <literal>invite</literal>.</para>
<enumlist>
<enum name="invite">
<para>Send the session refresh as a re-INVITE.</para>
</enum>
<enum name="update">
<para>Send the session refresh as an UPDATE.</para>
</enum>
</enumlist>
</parameter>
</syntax>
<description>
<para>This function will cause the PJSIP stack to immediately refresh
the media session for the channel. This will be done using either a
re-INVITE (default) or an UPDATE request.
</para>
<para>This is most useful when combined with the <replaceable>PJSIP_MEDIA_OFFER</replaceable>
dialplan function, as it allows the formats in use on a channel to be
re-negotiated after call setup.</para>
<warning>
<para>The formats the endpoint supports are <emphasis>not</emphasis>
checked or enforced by this function. Using this function to offer
formats not supported by the endpoint <emphasis>may</emphasis> result
in a loss of media.</para>
</warning>
<example title="Re-negotiate format to g722">
; Within some existing extension on an answered channel
same => n,Set(PJSIP_MEDIA_OFFER(audio)=!all,g722)
same => n,Set(PJSIP_SEND_SESSION_REFRESH()=invite)
</example>
</description>
<see-also>
<ref type="function">PJSIP_MEDIA_OFFER</ref>
</see-also>
</function>
<function name="PJSIP_PARSE_URI" language="en_US">
<since>
<version>13.24.0</version>
<version>16.1.0</version>
<version>17.0.0</version>
</since>
<synopsis>
Parse an uri and return a type part of the URI.
</synopsis>
<syntax>
<parameter name="uri" required="true">
<para>URI to parse</para>
</parameter>
<parameter name="type" required="true">
<para>The <literal>type</literal> parameter specifies which URI part to read</para>
<enumlist>
<enum name="display">
<para>Display name.</para>
</enum>
<enum name="scheme">
<para>URI scheme.</para>
</enum>
<enum name="user">
<para>User part.</para>
</enum>
<enum name="passwd">
<para>Password part.</para>
</enum>
<enum name="host">
<para>Host part.</para>
</enum>
<enum name="port">
<para>Port number, or zero.</para>
</enum>
<enum name="user_param">
<para>User parameter.</para>
</enum>
<enum name="method_param">
<para>Method parameter.</para>
</enum>
<enum name="transport_param">
<para>Transport parameter.</para>
</enum>
<enum name="ttl_param">
<para>TTL param, or -1.</para>
</enum>
<enum name="lr_param">
<para>Loose routing param, or zero.</para>
</enum>
<enum name="maddr_param">
<para>Maddr param.</para>
</enum>
</enumlist>
</parameter>
</syntax>
<description>
<para>Parse an URI and return a specified part of the URI.</para>
</description>
</function>
<info name="CHANNEL" language="en_US" tech="PJSIP">
<enumlist>
<enum name="rtp">
<para>R/O Retrieve media related information.</para>
<parameter name="type" required="true">
<para>When <replaceable>rtp</replaceable> is specified, the
<literal>type</literal> parameter must be provided. It specifies
which RTP parameter to read.</para>
<enumlist>
<enum name="src">
<para>Retrieve the local address for RTP.</para>
</enum>
<enum name="dest">
<para>Retrieve the remote address for RTP.</para>
</enum>
<enum name="direct">
<para>If direct media is enabled, this address is the remote address
used for RTP.</para>
</enum>
<enum name="secure">
<para>Whether or not the media stream is encrypted.</para>
<enumlist>
<enum name="0">
<para>The media stream is not encrypted.</para>
</enum>
<enum name="1">
<para>The media stream is encrypted.</para>
</enum>
</enumlist>
</enum>
<enum name="hold">
<para>Whether or not the media stream is currently restricted
due to a call hold.</para>
<enumlist>
<enum name="0">
<para>The media stream is not held.</para>
</enum>
<enum name="1">
<para>The media stream is held.</para>
</enum>
</enumlist>
</enum>
</enumlist>
</parameter>
<parameter name="media_type" required="false">
<para>When <replaceable>rtp</replaceable> is specified, the
<literal>media_type</literal> parameter may be provided. It specifies
which media stream the chosen RTP parameter should be retrieved
from.</para>
<enumlist>
<enum name="audio">
<para>Retrieve information from the audio media stream.</para>
<note><para>If not specified, <literal>audio</literal> is used
by default.</para></note>
</enum>
<enum name="video">
<para>Retrieve information from the video media stream.</para>
</enum>
</enumlist>
</parameter>
</enum>
<enum name="rtcp">
<para>R/O Retrieve RTCP statistics.</para>
<parameter name="statistic" required="true">
<para>When <replaceable>rtcp</replaceable> is specified, the
<literal>statistic</literal> parameter must be provided. It specifies
which RTCP statistic parameter to read.</para>
<enumlist>
<enum name="all">
<para>Retrieve a summary of all RTCP statistics.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="ssrc">
<para>Our Synchronization Source identifier</para>
</enum>
<enum name="themssrc">
<para>Their Synchronization Source identifier</para>
</enum>
<enum name="lp">
<para>Our lost packet count</para>
</enum>
<enum name="rxjitter">
<para>Received packet jitter</para>
</enum>
<enum name="rxcount">
<para>Received packet count</para>
</enum>
<enum name="txjitter">
<para>Transmitted packet jitter</para>
</enum>
<enum name="txcount">
<para>Transmitted packet count</para>
</enum>
<enum name="rlp">
<para>Remote lost packet count</para>
</enum>
<enum name="rtt">
<para>Round trip time</para>
</enum>
<enum name="txmes">
<para>Transmitted Media Experience Score</para>
</enum>
<enum name="rxmes">
<para>Received Media Experience Score</para>
</enum>
</enumlist>
</enum>
<enum name="all_jitter">
<para>Retrieve a summary of all RTCP Jitter statistics.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="minrxjitter">
<para>Our minimum jitter</para>
</enum>
<enum name="maxrxjitter">
<para>Our max jitter</para>
</enum>
<enum name="avgrxjitter">
<para>Our average jitter</para>
</enum>
<enum name="stdevrxjitter">
<para>Our jitter standard deviation</para>
</enum>
<enum name="reported_minjitter">
<para>Their minimum jitter</para>
</enum>
<enum name="reported_maxjitter">
<para>Their max jitter</para>
</enum>
<enum name="reported_avgjitter">
<para>Their average jitter</para>
</enum>
<enum name="reported_stdevjitter">
<para>Their jitter standard deviation</para>
</enum>
</enumlist>
</enum>
<enum name="all_loss">
<para>Retrieve a summary of all RTCP packet loss statistics.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="minrxlost">
<para>Our minimum lost packets</para>
</enum>
<enum name="maxrxlost">
<para>Our max lost packets</para>
</enum>
<enum name="avgrxlost">
<para>Our average lost packets</para>
</enum>
<enum name="stdevrxlost">
<para>Our lost packets standard deviation</para>
</enum>
<enum name="reported_minlost">
<para>Their minimum lost packets</para>
</enum>
<enum name="reported_maxlost">
<para>Their max lost packets</para>
</enum>
<enum name="reported_avglost">
<para>Their average lost packets</para>
</enum>
<enum name="reported_stdevlost">
<para>Their lost packets standard deviation</para>
</enum>
</enumlist>
</enum>
<enum name="all_rtt">
<para>Retrieve a summary of all RTCP round trip time information.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="minrtt">
<para>Minimum round trip time</para>
</enum>
<enum name="maxrtt">
<para>Maximum round trip time</para>
</enum>
<enum name="avgrtt">
<para>Average round trip time</para>
</enum>
<enum name="stdevrtt">
<para>Standard deviation round trip time</para>
</enum>
</enumlist>
</enum>
<enum name="all_mes">
<para>Retrieve a summary of all RTCP Media Experience Score information.</para>
<para>The following data items are returned in a semi-colon
delineated list:</para>
<enumlist>
<enum name="minmes">
<para>Minimum MES based on us analysing received packets.</para>
</enum>
<enum name="maxmes">
<para>Maximum MES based on us analysing received packets.</para>
</enum>
<enum name="avgmes">
<para>Average MES based on us analysing received packets.</para>
</enum>
<enum name="stdevmes">
<para>Standard deviation MES based on us analysing received packets.</para>
</enum>
<enum name="reported_minmes">
<para>Minimum MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
</enum>
<enum name="reported_maxmes">
<para>Maximum MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
</enum>
<enum name="reported_avgmes">
<para>Average MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
</enum>
<enum name="reported_stdevmes">
<para>Standard deviation MES based on data we get in Sender and Receiver Reports sent by the remote end</para>
</enum>
</enumlist>
</enum>
<enum name="txcount"><para>Transmitted packet count</para></enum>
<enum name="rxcount"><para>Received packet count</para></enum>
<enum name="txjitter"><para>Transmitted packet jitter</para></enum>
<enum name="rxjitter"><para>Received packet jitter</para></enum>
<enum name="remote_maxjitter"><para>Their max jitter</para></enum>
<enum name="remote_minjitter"><para>Their minimum jitter</para></enum>
<enum name="remote_normdevjitter"><para>Their average jitter</para></enum>
<enum name="remote_stdevjitter"><para>Their jitter standard deviation</para></enum>
<enum name="local_maxjitter"><para>Our max jitter</para></enum>
<enum name="local_minjitter"><para>Our minimum jitter</para></enum>
<enum name="local_normdevjitter"><para>Our average jitter</para></enum>
<enum name="local_stdevjitter"><para>Our jitter standard deviation</para></enum>
<enum name="txploss"><para>Transmitted packet loss</para></enum>
<enum name="rxploss"><para>Received packet loss</para></enum>
<enum name="remote_maxrxploss"><para>Their max lost packets</para></enum>
<enum name="remote_minrxploss"><para>Their minimum lost packets</para></enum>
<enum name="remote_normdevrxploss"><para>Their average lost packets</para></enum>
<enum name="remote_stdevrxploss"><para>Their lost packets standard deviation</para></enum>
<enum name="local_maxrxploss"><para>Our max lost packets</para></enum>
<enum name="local_minrxploss"><para>Our minimum lost packets</para></enum>
<enum name="local_normdevrxploss"><para>Our average lost packets</para></enum>
<enum name="local_stdevrxploss"><para>Our lost packets standard deviation</para></enum>
<enum name="rtt"><para>Round trip time</para></enum>
<enum name="maxrtt"><para>Maximum round trip time</para></enum>
<enum name="minrtt"><para>Minimum round trip time</para></enum>
<enum name="normdevrtt"><para>Average round trip time</para></enum>
<enum name="stdevrtt"><para>Standard deviation round trip time</para></enum>
<enum name="local_ssrc"><para>Our Synchronization Source identifier</para></enum>
<enum name="remote_ssrc"><para>Their Synchronization Source identifier</para></enum>
<enum name="txmes"><para>
Current MES based on us analyzing rtt, jitter and loss
in the actual received RTP stream received from the remote end.
I.E. This is the MES for the incoming audio stream.
</para></enum>
<enum name="rxmes"><para>
Current MES based on rtt and the jitter and loss values in
RTCP sender and receiver reports we receive from the
remote end. I.E. This is the MES for the outgoing audio stream.
</para></enum>
<enum name="remote_maxmes"><para>Max MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
<enum name="remote_minmes"><para>Min MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
<enum name="remote_normdevmes"><para>Average MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
<enum name="remote_stdevmes"><para>Standard deviation MES based on data we get in Sender and Receiver Reports sent by the remote end</para></enum>
<enum name="local_maxmes"><para>Max MES based on us analyzing the received RTP stream</para></enum>
<enum name="local_minmes"><para>Min MES based on us analyzing the received RTP stream</para></enum>
<enum name="local_normdevmes"><para>Average MES based on us analyzing the received RTP stream</para></enum>
<enum name="local_stdevmes"><para>Standard deviation MES based on us analyzing the received RTP stream</para></enum>
</enumlist>
</parameter>
<parameter name="media_type" required="false">
<para>When <replaceable>rtcp</replaceable> is specified, the
<literal>media_type</literal> parameter may be provided. It specifies
which media stream the chosen RTCP parameter should be retrieved
from.</para>
<enumlist>
<enum name="audio">
<para>Retrieve information from the audio media stream.</para>
<note><para>If not specified, <literal>audio</literal> is used
by default.</para></note>
</enum>
<enum name="video">
<para>Retrieve information from the video media stream.</para>
</enum>
</enumlist>
</parameter>
</enum>
<enum name="endpoint">
<para>R/O The name of the endpoint associated with this channel.
Use the <replaceable>PJSIP_ENDPOINT</replaceable> function to obtain
further endpoint related information.</para>
</enum>
<enum name="contact">
<para>R/O The name of the contact associated with this channel.
Use the <replaceable>PJSIP_CONTACT</replaceable> function to obtain
further contact related information. Note this may not be present and if so
is only available on outgoing legs.</para>
</enum>
<enum name="aor">
<para>R/O The name of the AOR associated with this channel.
Use the <replaceable>PJSIP_AOR</replaceable> function to obtain
further AOR related information. Note this may not be present and if so
is only available on outgoing legs.</para>
</enum>
<enum name="pjsip">
<para>R/O Obtain information about the current PJSIP channel and its
session.</para>
<parameter name="type" required="true">
<para>When <replaceable>pjsip</replaceable> is specified, the
<literal>type</literal> parameter must be provided. It specifies
which signalling parameter to read.</para>
<enumlist>
<enum name="call-id">
<para>The SIP call-id.</para>
</enum>
<enum name="secure">
<para>Whether or not the signalling uses a secure transport.</para>
<enumlist>
<enum name="0"><para>The signalling uses a non-secure transport.</para></enum>
<enum name="1"><para>The signalling uses a secure transport.</para></enum>
</enumlist>
</enum>
<enum name="target_uri">
<para>The contact URI where requests are sent.</para>
</enum>
<enum name="local_uri">
<para>The local URI.</para>
</enum>
<enum name="local_tag">
<para>Tag in From header</para>
</enum>
<enum name="remote_uri">
<para>The remote URI.</para>
</enum>
<enum name="remote_tag">
<para>Tag in To header</para>
</enum>
<enum name="request_uri">
<para>The request URI of the incoming <literal>INVITE</literal>
associated with the creation of this channel.</para>
</enum>
<enum name="t38state">
<para>The current state of any T.38 fax on this channel.</para>
<enumlist>
<enum name="DISABLED"><para>T.38 faxing is disabled on this channel.</para></enum>
<enum name="LOCAL_REINVITE"><para>Asterisk has sent a <literal>re-INVITE</literal> to the remote end to initiate a T.38 fax.</para></enum>
<enum name="REMOTE_REINVITE"><para>The remote end has sent a <literal>re-INVITE</literal> to Asterisk to initiate a T.38 fax.</para></enum>
<enum name="ENABLED"><para>A T.38 fax session has been enabled.</para></enum>
<enum name="REJECTED"><para>A T.38 fax session was attempted but was rejected.</para></enum>
</enumlist>
</enum>
<enum name="local_addr">
<para>On inbound calls, the full IP address and port number that
the <literal>INVITE</literal> request was received on. On outbound
calls, the full IP address and port number that the <literal>INVITE</literal>
request was transmitted from.</para>
</enum>
<enum name="remote_addr">
<para>On inbound calls, the full IP address and port number that
the <literal>INVITE</literal> request was received from. On outbound
calls, the full IP address and port number that the <literal>INVITE</literal>
request was transmitted to.</para>
</enum>
</enumlist>
</parameter>
</enum>
</enumlist>
</info>
<info name="CHANNEL_EXAMPLES" language="en_US" tech="PJSIP">
<example title="PJSIP specific CHANNEL examples">
; Log the current Call-ID
same => n,Log(NOTICE, ${CHANNEL(pjsip,call-id)})
; Log the destination address of the audio stream
same => n,Log(NOTICE, ${CHANNEL(rtp,dest)})
; Store the round-trip time associated with a
; video stream in the CDR field video-rtt
same => n,Set(CDR(video-rtt)=${CHANNEL(rtcp,rtt,video)})
</example>
</info>
</docs>

View File

@ -148,4 +148,24 @@ int pjsip_acf_dial_contacts_read(struct ast_channel *chan, const char *cmd, char
*/
int pjsip_acf_parse_uri_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len);
#endif /* _PJSIP_DIALPLAN_FUNCTIONS */
/*!
* \brief Hang up an incoming PJSIP channel with a SIP response code
* \param chan The channel the function is called on
* \param data SIP response code or name
*
* \retval 0 on success
* \retval -1 on failure
*/
int pjsip_app_hangup(struct ast_channel *chan, const char *data);
/*!
* \brief Manager action to hang up an incoming PJSIP channel with a SIP response code
* \param s session
* \param m message
*
* \retval 0 on success
* \retval -1 on failure
*/
int pjsip_action_hangup(struct mansession *s, const struct message *m);
#endif /* _PJSIP_DIALPLAN_FUNCTIONS */

View File

@ -805,6 +805,11 @@ int analog_available(struct analog_pvt *p)
return 0;
}
/* If line is being held, definitely not (don't allow call waitings to an on-hook phone) */
if (p->cshactive) {
return 0;
}
/* If no owner definitely available */
if (!p->owner) {
offhook = analog_is_off_hook(p);
@ -1300,6 +1305,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
p->channel, idx, p->subs[ANALOG_SUB_REAL].allocd, p->subs[ANALOG_SUB_CALLWAIT].allocd, p->subs[ANALOG_SUB_THREEWAY].allocd);
if (idx > -1) {
/* Real channel, do some fixup */
p->cshactive = 0;
p->subs[idx].owner = NULL;
p->polarity = POLARITY_IDLE;
analog_set_linear_mode(p, idx, 0);
@ -1758,10 +1764,7 @@ static void *__analog_ss_thread(void *data)
ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
if (!chan) {
/* What happened to the channel? */
goto quit;
}
ast_assert(chan != NULL);
if ((callid = ast_channel_callid(chan))) {
ast_callid_threadassoc_add(callid);
@ -2750,6 +2753,7 @@ int analog_ss_thread_start(struct analog_pvt *p, struct ast_channel *chan)
{
pthread_t threadid;
p->ss_astchan = chan;
return ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, p);
}
@ -2933,6 +2937,34 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
analog_get_and_handle_alarms(p);
cause_code->ast_cause = AST_CAUSE_NETWORK_OUT_OF_ORDER;
case ANALOG_EVENT_ONHOOK:
if (p->calledsubscriberheld && (p->sig == ANALOG_SIG_FXOLS || p->sig == ANALOG_SIG_FXOGS || p->sig == ANALOG_SIG_FXOKS) && idx == ANALOG_SUB_REAL) {
ast_debug(4, "Channel state on %s is %d\n", ast_channel_name(ast), ast_channel_state(ast));
/* Called Subscriber Held: don't let the called party hang up on an incoming call immediately (if it's the only call). */
if (p->subs[ANALOG_SUB_CALLWAIT].owner || p->subs[ANALOG_SUB_THREEWAY].owner) {
ast_debug(2, "Letting this call hang up normally, since it's not the only call\n");
} else if (!p->owner || !p->subs[ANALOG_SUB_REAL].owner || ast_channel_state(ast) != AST_STATE_UP) {
ast_debug(2, "Called Subscriber Held does not apply: channel state is %d\n", ast_channel_state(ast));
} else if (!p->owner || !p->subs[ANALOG_SUB_REAL].owner || strcmp(ast_channel_appl(p->subs[ANALOG_SUB_REAL].owner), "AppDial")) {
/* Called Subscriber held only applies to incoming calls, not outgoing calls.
* We can't use p->outgoing because that is always true, for both incoming and outgoing calls, so it's not accurate.
* We can check the channel application/data instead.
* For incoming calls to the channel, it will look like: AppDial / (Outgoing Line)
* We only want this behavior for regular calls anyways (and not, say, Queue),
* so this would actually work great. But accessing ast_channel_appl can cause a crash if there are no calls left,
* so this check must occur AFTER we confirm the channel state *is* still UP.
*/
ast_debug(2, "Called Subscriber Held does not apply: not an incoming call\n");
} else if (analog_is_off_hook(p)) {
ast_log(LOG_WARNING, "Got ONHOOK but channel %d is off hook?\n", p->channel); /* Shouldn't happen */
} else {
ast_verb(3, "Holding incoming call %s for channel %d\n", ast_channel_name(ast), p->channel);
/* Inhibit dahdi_hangup from getting called, and do nothing else now.
* When the DAHDI channel goes off hook again, it'll just get reconnected with the incoming call,
* to which, as far as its concerned, nothing has happened. */
p->cshactive = 1; /* Keep track that this DAHDI channel is currently being held by an incoming call. */
break;
}
}
ast_queue_control_data(ast, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
ast_channel_hangupcause_hash_set(ast, cause_code, data_size);
switch (p->sig) {
@ -3809,6 +3841,7 @@ void *analog_handle_init_event(struct analog_pvt *i, int event)
case ANALOG_SIG_FXOKS:
res = analog_off_hook(i);
i->fxsoffhookstate = 1;
i->cshactive = 0;
if (res && (errno == EBUSY)) {
break;
}

View File

@ -289,6 +289,7 @@ struct analog_pvt {
unsigned int ani_wink_time:16; /* Safe wait time before we wink to start ANI spill */
unsigned int answeronpolarityswitch:1;
unsigned int calledsubscriberheld:1; /*!< TRUE if a single incoming call can hold an FXS channel */
unsigned int callreturn:1;
unsigned int cancallforward:1;
unsigned int canpark:1;
@ -330,6 +331,7 @@ struct analog_pvt {
/* XXX: All variables after this are internal */
unsigned int callwaiting:1; /*!< TRUE if call waiting is enabled. (Active option) */
unsigned int cshactive:1; /*!< TRUE if FXS channel is currently held by an incoming call */
unsigned int dialednone:1;
unsigned int dialing:1; /*!< TRUE if in the process of dialing digits or sending something */
unsigned int dnd:1; /*!< TRUE if Do-Not-Disturb is enabled. */

View File

@ -597,20 +597,20 @@ static int parse_config(int reload)
if (!strcasecmp(var->name, "quality")) {
res = abs(atoi(var->value));
if (res > -1 && res < 11) {
ast_verb(3, "CODEC SPEEX: Setting Quality to %d\n",res);
ast_verb(5, "CODEC SPEEX: Setting Quality to %d\n",res);
quality = res;
} else
ast_log(LOG_ERROR,"Error Quality must be 0-10\n");
} else if (!strcasecmp(var->name, "complexity")) {
res = abs(atoi(var->value));
if (res > -1 && res < 11) {
ast_verb(3, "CODEC SPEEX: Setting Complexity to %d\n",res);
ast_verb(5, "CODEC SPEEX: Setting Complexity to %d\n",res);
complexity = res;
} else
ast_log(LOG_ERROR,"Error! Complexity must be 0-10\n");
} else if (!strcasecmp(var->name, "vbr_quality")) {
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0 && res_f <= 10) {
ast_verb(3, "CODEC SPEEX: Setting VBR Quality to %f\n",res_f);
ast_verb(5, "CODEC SPEEX: Setting VBR Quality to %f\n",res_f);
vbr_quality = res_f;
} else
ast_log(LOG_ERROR,"Error! VBR Quality must be 0-10\n");
@ -618,62 +618,62 @@ static int parse_config(int reload)
ast_log(LOG_ERROR,"Error! ABR Quality setting obsolete, set ABR to desired bitrate\n");
} else if (!strcasecmp(var->name, "enhancement")) {
enhancement = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Perceptual Enhancement Mode. [%s]\n",enhancement ? "on" : "off");
ast_verb(5, "CODEC SPEEX: Perceptual Enhancement Mode. [%s]\n",enhancement ? "on" : "off");
} else if (!strcasecmp(var->name, "vbr")) {
vbr = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: VBR Mode. [%s]\n",vbr ? "on" : "off");
ast_verb(5, "CODEC SPEEX: VBR Mode. [%s]\n",vbr ? "on" : "off");
} else if (!strcasecmp(var->name, "abr")) {
res = abs(atoi(var->value));
if (res >= 0) {
if (res > 0)
ast_verb(3, "CODEC SPEEX: Setting ABR target bitrate to %d\n",res);
ast_verb(5, "CODEC SPEEX: Setting ABR target bitrate to %d\n",res);
else
ast_verb(3, "CODEC SPEEX: Disabling ABR\n");
ast_verb(5, "CODEC SPEEX: Disabling ABR\n");
abr = res;
} else
ast_log(LOG_ERROR,"Error! ABR target bitrate must be >= 0\n");
} else if (!strcasecmp(var->name, "vad")) {
vad = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: VAD Mode. [%s]\n",vad ? "on" : "off");
ast_verb(5, "CODEC SPEEX: VAD Mode. [%s]\n",vad ? "on" : "off");
} else if (!strcasecmp(var->name, "dtx")) {
dtx = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: DTX Mode. [%s]\n",dtx ? "on" : "off");
ast_verb(5, "CODEC SPEEX: DTX Mode. [%s]\n",dtx ? "on" : "off");
} else if (!strcasecmp(var->name, "preprocess")) {
preproc = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Preprocessing. [%s]\n",preproc ? "on" : "off");
ast_verb(5, "CODEC SPEEX: Preprocessing. [%s]\n",preproc ? "on" : "off");
} else if (!strcasecmp(var->name, "pp_vad")) {
pp_vad = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Preprocessor VAD. [%s]\n",pp_vad ? "on" : "off");
ast_verb(5, "CODEC SPEEX: Preprocessor VAD. [%s]\n",pp_vad ? "on" : "off");
} else if (!strcasecmp(var->name, "pp_agc")) {
pp_agc = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off");
ast_verb(5, "CODEC SPEEX: Preprocessor AGC. [%s]\n",pp_agc ? "on" : "off");
} else if (!strcasecmp(var->name, "pp_agc_level")) {
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
ast_verb(3, "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f);
ast_verb(5, "CODEC SPEEX: Setting preprocessor AGC Level to %f\n",res_f);
pp_agc_level = res_f;
} else
ast_log(LOG_ERROR,"Error! Preprocessor AGC Level must be >= 0\n");
} else if (!strcasecmp(var->name, "pp_denoise")) {
pp_denoise = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Preprocessor Denoise. [%s]\n",pp_denoise ? "on" : "off");
ast_verb(5, "CODEC SPEEX: Preprocessor Denoise. [%s]\n",pp_denoise ? "on" : "off");
} else if (!strcasecmp(var->name, "pp_dereverb")) {
pp_dereverb = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off");
ast_verb(5, "CODEC SPEEX: Preprocessor Dereverb. [%s]\n",pp_dereverb ? "on" : "off");
} else if (!strcasecmp(var->name, "pp_dereverb_decay")) {
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
ast_verb(3, "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f);
ast_verb(5, "CODEC SPEEX: Setting preprocessor Dereverb Decay to %f\n",res_f);
pp_dereverb_decay = res_f;
} else
ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Decay must be >= 0\n");
} else if (!strcasecmp(var->name, "pp_dereverb_level")) {
if (sscanf(var->value, "%30f", &res_f) == 1 && res_f >= 0) {
ast_verb(3, "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f);
ast_verb(5, "CODEC SPEEX: Setting preprocessor Dereverb Level to %f\n",res_f);
pp_dereverb_level = res_f;
} else
ast_log(LOG_ERROR,"Error! Preprocessor Dereverb Level must be >= 0\n");
} else if (!strcasecmp(var->name, "experimental_rtcp_feedback")) {
exp_rtcp_fb = ast_true(var->value) ? 1 : 0;
ast_verb(3, "CODEC SPEEX: Experimental RTCP Feedback. [%s]\n",exp_rtcp_fb ? "on" : "off");
ast_verb(5, "CODEC SPEEX: Experimental RTCP Feedback. [%s]\n",exp_rtcp_fb ? "on" : "off");
}
}
ast_config_destroy(cfg);

View File

@ -8,8 +8,8 @@ If you intend to use this configuration as a template for your own, then
you will need to change many values in the various configuration files to
match your own devices, network, SIP ITSP accounts and more.
For further documentation on this configuration see the Asterisk wiki:
https://wiki.asterisk.org/wiki/display/AST/Reference+Use+Cases+for+Asterisk.
For further documentation on this configuration see the Asterisk documentation:
https://docs.asterisk.org/Deployment/Reference-Use-Cases-for-Asterisk/.
Please report bugs or errors in configuration on the Asterisk issue tracker:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines
https://docs.asterisk.org/Asterisk-Community/Asterisk-Issue-Guidelines/

View File

@ -126,6 +126,10 @@ documentation_language = en_US ; Set the language you want documentation
; housekeeping AMI and ARI channel events. This can
; reduce the load on the manager and ARI applications
; when the Digium Phone Module for Asterisk is in use.
;sounds_search_custom_dir = no; This option, if enabled, will
; cause Asterisk to search for sounds files in
; AST_DATA_DIR/sounds/custom before searching the
; normal directories like AST_DATA_DIR/sounds/<lang>.
; Changing the following lines may compromise your security.
;[files]

View File

@ -2,7 +2,7 @@
; --- Call Completion Supplementary Services ---
;
; For more information about CCSS, see the CCSS user documentation
; https://wiki.asterisk.org/wiki/display/AST/Call+Completion+Supplementary+Services+(CCSS)
; https://docs.asterisk.org/Deployment/PSTN-Connectivity/Call-Completion-Supplementary-Services-CCSS/
;
[general]

View File

@ -595,7 +595,7 @@ usecallerid=yes
; polarity = polarity reversal signals the start
; polarity_IN = polarity reversal signals the start, for India,
; for dtmf dialtone detection; using DTMF.
; (see https://wiki.asterisk.org/wiki/display/AST/Caller+ID+in+India)
; (see https://wiki.asterisk.org/wiki/display/AST/Caller+ID+in+India)
; dtmf = causes monitor loop to look for dtmf energy on the
; incoming channel to initate cid acquisition
;
@ -755,6 +755,18 @@ usecallingpres=yes
;
callwaitingcallerid=yes
;
; Whether or not to allow users to go on-hook when receiving an incoming call
; without disconnecting it. Users can later resume the call from any phone
; on the same physical phone line (the same DAHDI channel).
; This setting only has an effect on FXS (FXO-signalled) channels where there
; is only a single incoming call to the DAHDI channel, using the Dial application.
; (This is a convenience mechanism to avoid users wishing to resume a conversation
; at a different phone from leaving a phone off the hook, resuming elsewhere,
; and forgetting to restore the original phone on hook afterwards.)
; Default is no.
;
;calledsubscriberheld=yes
;
; Support three-way calling
;
threewaycalling=yes
@ -932,6 +944,10 @@ group=1
; you can answer it by picking up and dialing *8#. For simple offices, just
; make these both the same. Groups range from 0 to 63.
;
; Call groups and pickup groups may only be specified for FXO signalled channels.
; If you need to pick up an FXS signalled channel directly, you can have it
; dial a Local channel and pick up the ;1 side of the Local channel instead.
;
callgroup=1
pickupgroup=1
;
@ -1563,7 +1579,7 @@ pickupgroup=1
;#include ss7.timers
; For more information on setting up SS7, see the README file in libss7 or
; https://wiki.asterisk.org/wiki/display/AST/Signaling+System+Number+7
; https://docs.asterisk.org/Deployment/PSTN-Connectivity/Signaling-System-Number-7/
; ----------------- SS7 Options ----------------------------------------
; ---------------- Options for use with signalling=mfcr2 --------------

View File

@ -29,7 +29,7 @@
;bindaddr=0.0.0.0
;port=4520
;
; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of the tos parameter.
; See https://docs.asterisk.org/Configuration/Channel-Drivers/IP-Quality-of-Service for a description of the tos parameter.
;tos=ef
;
; Our entity identifier. (It should generally be the MAC address of the

View File

@ -2,7 +2,7 @@
; Static and realtime external configuration
; engine configuration
;
; See https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration
; See https://docs.asterisk.org/Fundamentals/Asterisk-Configuration/Database-Support-Configuration/Realtime-Database-Configuration/
; for basic table formatting information.
;
[settings]
@ -84,6 +84,7 @@
;ps_outbound_publishes => odbc,asterisk
;ps_inbound_publications = odbc,asterisk
;ps_asterisk_publications = odbc,asterisk
;stir_tn => odbc,asterisk
;voicemail => odbc,asterisk
;extensions => odbc,asterisk
;meetme => mysql,general

View File

@ -1,7 +1,7 @@
;--
Geolocation Profile Sample Configuration
Please see https://wiki.asterisk.org/wiki/display/AST/Geolocation
Please see https://docs.asterisk.org/Deployment/Geolocation/
for the most current information.
--;
@ -33,7 +33,7 @@ incoming calls (Asterisk is the UAS) and and one for outgoing calls
NOTE:
See https://wiki.asterisk.org/wiki/display/AST/Geolocation for the most
See https://docs.asterisk.org/Deployment/Geolocation/ for the most
complete and up-to-date information on valid values for the object
parameters and a full list of references.
@ -96,7 +96,7 @@ variables like ${EXTEN}, channel variables you may have added in the
dialplan, or variables you may have specified in the profile that
references this location object.
NOTE: See https://wiki.asterisk.org/wiki/display/AST/Geolocation for the
NOTE: See https://docs.asterisk.org/Deployment/Geolocation/ for the
most complete and up-to-date information on valid values for the object
parameters and a full list of references.

View File

@ -140,9 +140,13 @@
;
; Specify bandwidth of low, medium, or high to control which codecs are used
; in general.
; in general. This setting will restrict codecs used to only those that comply
; with the bandwidth setting. In most cases, you should set this to 'high' so
; that high-quality codecs may be used; if set to a lower value, this will
; degrade call quality, so you probably only want to do this if you have
; actual significant bandwidth constraints.
;
bandwidth=low
bandwidth=high
;
;
@ -323,7 +327,7 @@ encryption=yes
;
;authdebug = yes
;
; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of these parameters.
; See https://docs.asterisk.org/Configuration/Channel-Drivers/IP-Quality-of-Service for a description of these parameters.
;tos=ef
;cos=5
;

View File

@ -53,7 +53,7 @@ codec=ulaw
;
flags=register,heartbeat
;
; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of this parameter.
; See https://docs.asterisk.org/Configuration/Channel-Drivers/IP-Quality-of-Service for a description of this parameter.
;tos=ef
;
; Example iaxy provisioning

View File

@ -38,6 +38,10 @@
; - 5: trace
; - 6: more detailed trace
;
; Note: setting the pjproject debug level to 4 (debug) or above may result in
; raw packets being logged. This should only be enabled during active debugging
; to avoid a potential security issue due to logging injection.
;
;asterisk_error = ; A comma separated list of pjproject log levels to map to
; Asterisk errors.
; (default: "0,1")

View File

@ -20,7 +20,7 @@
; Documentation
;
; The official documentation is at http://wiki.asterisk.org
; The official documentation is at https://docs.asterisk.org
; You can read the XML configuration help via Asterisk command line with
; "config show help res_pjsip", then you can drill down through the various
; sections and their options.
@ -31,8 +31,8 @@
; At a minimum please read the file "README-SERIOUSLY.bestpractices.txt",
; located in the Asterisk source directory before starting Asterisk.
; Otherwise you risk allowing the security of the Asterisk system to be
; compromised. Beyond that please visit and read the security information on
; the wiki at: https://wiki.asterisk.org/wiki/x/EwFB
; compromised. Beyond that please visit and read the security information in
; the documentation at: https://docs.asterisk.org/Deployment/Important-Security-Considerations/
;
; A few basics to pay attention to:
;
@ -47,7 +47,7 @@
;
; See the example ACL configuration in this file. Read the configuration help
; for the section and all of its options. Look over the samples in acl.conf
; and documentation at https://wiki.asterisk.org/wiki/x/uA80AQ
; and documentation at https://docs.asterisk.org/Configuration/Core-Configuration/Named-ACLs/
; If possible, restrict access to only networks and addresses you trust.
;
; Dialplan Contexts
@ -175,7 +175,7 @@
;
; This is a simple registration that works with some SIP trunking providers.
; You'll need to set up the auth example "mytrunk_auth" below to enable outbound
; authentication. Note that we "outbound_auth=" use for outbound authentication
; authentication. Note that we use "outbound_auth=" for outbound authentication
; instead of "auth=", which is for inbound authentication.
;
; If you are registering to a server from behind NAT, be sure you assign a transport
@ -393,7 +393,7 @@
;rewrite_contact=yes ; necessary if endpoint does not know/register public ip:port
;ice_support=yes ;This is specific to clients that support NAT traversal
;for media via ICE,STUN,TURN. See the wiki at:
;https://wiki.asterisk.org/wiki/x/D4FHAQ
;https://docs.asterisk.org/Configuration/Miscellaneous/Interactive-Connectivity-Establishment-ICE-in-Asterisk/
;for a deeper explanation of this topic.
;[6002]
@ -1454,7 +1454,7 @@
; MODULE PROVIDING BELOW SECTION(S): res_pjsip_outbound_publish
;======================OUTBOUND_PUBLISH SECTION OPTIONS=====================
; See https://wiki.asterisk.org/wiki/display/AST/Publishing+Extension+State
; See https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Publishing-Extension-State/
; for more information.
;[outbound-publish]
;type=outbound-publish ; Must be of type 'outbound-publish'.
@ -1509,9 +1509,9 @@
; MODULE PROVIDING BELOW SECTION(S): res_pjsip_pubsub
;=============================RESOURCE-LIST===================================
; See https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=30278158
; See https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Resource-List-Subscriptions-RLS/
; for more information.
;=============================RESOURCE-LIST===================================
;[resource_list]
;type=resource_list ; Must be of type 'resource_list'.
@ -1568,7 +1568,7 @@
;==========================INBOUND_PUBLICATION================================
; See https://wiki.asterisk.org/wiki/display/AST/Exchanging+Device+and+Mailbox+State+Using+PJSIP
; See https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Exchanging-Device-and-Mailbox-State-Using-PJSIP/
; for more information.
;[inbound-publication]
;type= ; Must be of type 'inbound-publication'.
@ -1579,7 +1579,7 @@
; MODULE PROVIDING BELOW SECTION(S): res_pjsip_publish_asterisk
;==========================ASTERISK_PUBLICATION===============================
; See https://wiki.asterisk.org/wiki/display/AST/Exchanging+Device+and+Mailbox+State+Using+PJSIP
; See https://docs.asterisk.org/Configuration/Channel-Drivers/SIP/Configuring-res_pjsip/Exchanging-Device-and-Mailbox-State-Using-PJSIP/
; for more information.
;[asterisk-publication]
;type=asterisk-publication ; Must be of type 'asterisk-publication'.

View File

@ -20,7 +20,7 @@
; Documentation
;
; The official documentation is at http://wiki.asterisk.org
; The official documentation is at https://docs.asterisk.org
; You can read the XML configuration help via Asterisk command line with
; "config show help res_pjsip_config_wizard", then you can drill down through
; the various sections and their options.

View File

@ -286,6 +286,13 @@ monitor-type = MixMonitor
;
;periodic-announce-frequency=60
;
; If given indicates the number of seconds after entering the queue the first
; periodic announcement should be played. The default (and historic) behavior
; is to play the first periodic announcement at periodic-announce-frequency
; seconds after entering the queue.
;
;periodic-announce-startdelay=10
;
; Should the periodic announcements be played in a random order? Default is no.
;
;random-periodic-announce=no

View File

@ -0,0 +1,14 @@
;
; Sample configuration for res_config_odbc
;
; Most configuration occurs in the system ODBC configuration files,
; res_odbc.conf, and extconfig.conf. You only need this file in the
; event that you want to influence default sorting behavior.
;
[general]
; When multiple rows are requested by realtime, res_config_odbc will add an
; explicit ORDER BY clause to the generated SELECT statement. To prevent
; that from occuring, set order_multi_row_results_by_initial_column to 'no'.
;
;order_multi_row_results_by_initial_column=no

View File

@ -28,3 +28,9 @@ dbpass=password
; createchar - Create char columns only
;
requirements=warn
; When multiple rows are requested by realtime, res_config_pgsql will add an
; explicit ORDER BY clause to the generated SELECT statement. To prevent
; that from occuring, set order_multi_row_results_by_initial_column to 'no'.
;
;order_multi_row_results_by_initial_column=no

View File

@ -1,7 +1,7 @@
;
; Configuration for Shared Line Appearances (SLA).
;
; See http://wiki.asterisk.org or doc/AST.pdf for more information.
; See https://docs.asterisk.org for more information.
;
; ---- General Options ----------------
@ -37,7 +37,7 @@
; DAHDI channels can be directly used. IP trunks
; require some indirect configuration which is
; described in
; https://wiki.asterisk.org/wiki/display/AST/SLA+Trunk+Configuration
; https://docs.asterisk.org/Configuration/Applications/Shared-Line-Appearances-SLA/
;autocontext=line1 ; This supports automatic generation of the dialplan entries
; if the autocontext option is used. Each trunk should have
@ -73,7 +73,7 @@
;type=trunk
;device=Local/disa@line4_outbound ; A Local channel in combination with the Disa
; application can be used to support IP trunks.
; See https://wiki.asterisk.org/wiki/display/AST/SLA+Trunk+Configuration
; See https://docs.asterisk.org/Configuration/Applications/Shared-Line-Appearances-SLA/
;autocontext=line4
; --------------------------------------

View File

@ -76,3 +76,6 @@ test=memory
;[res_pjsip_publish_asterisk]
;asterisk-publication=realtime,ps_asterisk_publications
;[res_stir_shaken]
;tn=realtime,stir_tn

View File

@ -1,103 +1,459 @@
;
; This file is used by the res_stir_shaken module to configure parameters
; used for STIR/SHAKEN.
;
; There are 2 sides to STIR/SHAKEN: attestation and verification.
;
; Attestation is done on outgoing calls and makes use out of the certificate
; objects. The cert located at path will be used to sign, and the cert
; located at public_cert_url will be placed in the Identity header to let the
; remote side know where to download the public cert from. These 2 certs must
; match; that is, the cert located at public_cert_url must be the public cert
; derived from the private cert located at path.
;
; Verification is done on incoming calls and doesn't rely on cert objects
; defined in this file.
;
; The general section applies to all STIR/SHAKEN operations. However,
; cache_max_size, curl_timeout, and signature_timeout only apply to the
; verification side.
;
; It's important to note that downloaded certificates are stored in
; <ast_config_AST_DATA_DIR>/keys/stir_shaken, which is usually
; /etc/asterisk/keys/stir_shaken, but may be changed depending on where your
; config directory is.
;
; Visit the wiki page:
; https://wiki.asterisk.org/wiki/display/AST/STIR+and+SHAKEN
;
; [general]
;
; File path to the certificate authority certificate
;ca_file=/etc/asterisk/stir/ca.crt
;
; File path to a chain of trust
;ca_path=/etc/asterisk/stir/ca
;
; Maximum size to use for caching public keys
;cache_max_size=1000
;
; Maximum time (in seconds) to wait to CURL certificates
;curl_timeout=2
;
; Amount of time (in seconds) a signature is valid for
;signature_timeout=15
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; A certificate store is used to examine, and load all certificates found in a
; given directory. When using this type the public key URL is generated based
; upon the filename, and variable substitution.
;[certificates]
;
; type must be "store"
;type=store
;
; Path to a directory containing certificates
;path=/etc/asterisk/stir
;
; URL to the public certificate(s). Must contain variable '${CERTIFICATE}' used for
; substitution. '${CERTIFICATE}' will be replaced by the names of the files located
; at path.
; This will be put in the Identity header when signing.
;public_cert_url=http://mycompany.com/${CERTIFICATE}.pem
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Individual certificates are declared by using the certificate type.
;[alice]
;
; type must be "certificate"
;type=certificate
;
; File path to a certificate. This can be RSA or ECDSA, but eventually only ECDSA will be supported.
;path=/etc/asterisk/stir/alice.pem
;
; URL to the public certificate. Must be of type X509 and be derived from the
; certificate located at path.
; This will be put in the identity header when signing.
;public_cert_url=http://mycompany.com/alice.pem
;
; The caller ID number to match on
;caller_id_number=1234567
;
; Must have an attestation of A, B, or C
;attestation=C
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Profiles can be defined here which can be referenced by channel drivers.
;[my_profile]
;
; type must be "profile"
;type=profile
;
; Set stir_shaken to 'attest', 'verify', or 'on', which is the default
;stir_shaken=on
;
; You can specify an ACL that will be used strictly for the Identity header when downloading public certificates
;acllist=myacllist
;
; You can also do permit / deny lines if you want (also supports IPv6)
;--
There are 4 object types used by the STIR/SHAKEN process...
The "attestation" object sets the parameters for creating an Identity
header which attests to the ownership of the caller id on outgoing
INVITE requests.
One or more "tn" objects that are used to create the outgoing Identity
header. Each object's "id" is a specific caller-id telephone number
and the object contains the URL to the certificate that was used to
attest to the ownership of the caller-id, the level (A,B,C) of the
attestation you're making, and the private key the asterisk
attestation service will use to sign the Identity header. When
an outgoing INVITE request is placed, the attestation service will
look up the caller-id in the tn object list and if it's found, use
the information in the object to create the Identity header.
The "verification" object sets the parameters for verification
of the Identity header and caller id on incoming INVITE requests.
One or more "profile" objects that can be associated to channel
driver endpoints (currently only chan_pjsip). Profiles can set
whether verification, attestation, both or neither should be
performed on requests coming in to this endpoint or requests
going out from this endpoint. Additionally they can override
most of the attestation and verification options to make them
specific to an endpoint. When Asterisk loads the configs, it
creates "effective profiles" or "eprofiles" on the fly that are
the amalgamation of the attestation, verification and profile.
You can see them in the CLI with "stir_shaken show eprofiles".
NOTE: The "tn" object can be configured to source its data from a
realtime database by configuring sorcery.conf and extconfig.conf.
Both of those files have examples for "stir_tn". There is also an
Alembic script in the "config" section of contrib/ast-db-manage that
will create the table. Since there can be only one "verification"
or "attestation" object, and will probably be only a few "profile"
objects, those objects aren't realtime enabled.
--;
;--
=======================================================================
Attestation Object Description
=======================================================================
The "attestation" object sets the parameters for creating an Identity
header which attests to the ownership of the caller id on outgoing
INVITE requests.
All parameters except 'global_disable" may be overridden in a "profile"
or "tn" object.
Only one "attestation" object may exist.
Parameters:
-- global_disable -----------------------------------------------------
If set, globally disables the attestation service. No Identity headers
will be added to any outgoing INVITE requests.
Default: no
-- private_key_file ---------------------------------------------------
The path to a file containing the private key you received from the
issuing authority. The file must NOT be group or world readable or
writable so make sure the user the asterisk process is running as is
the owner.
Default: none
-- public_cert_url ----------------------------------------------------
The URL to the certificate you received from the issueing authority.
They may give you a URL to use or you may have to host the certificate
yourself and provide your own URL here.
Default: none
WARNING: Make absolutely sure the file that's made public doesn't
accidentally include the privite key as well as the certificate.
If you set "check_tn_cert_public_url" in the "attestation" section
above, the tn will not be loaded and a "DANGER" message will be output
on the asterisk console if the file does contain a private key.
-- check_tn_cert_public_url -------------------------------------------
Identity headers in outgoing requests must contain a URL that points
to the certificate used to sign the header. Setting this parameter
tells Asterisk to actually try to retrieve the certificates indicated
by "public_cert_url" parameters and fail loading that tn if the cert
can't be retrieved or if its 'Not Valid Before" -> 'Not Valid After"
date range doesn't include today. This is a network intensive process
so use with caution.
Default: no
-- attest_level -------------------------------------------------------
The level of the attestation you're making.
One of "A", "B", "C"
Default: none
-- send_mky -----------------------------------------------------------
If set and an outgoing call uses DTLS, an "mky" Media Key grant will
be added to the Identity header. Although RFC8224/8225 require this,
not many implementations support it so a remote verification service
may fail to verify the signature.
Default: no
-----------------------------------------------------------------------
Example "attestation" object:
--;
;[attestation]
;global_disable = no
;private_key_path = /var/lib/asterisk/keys/stir_shaken/tns/multi-tns-key.pem
;public_cert_url = https://example.com/tncerts/multi-tns-cert.pem
;attest_level = C
;--
=======================================================================
TN Object Description
=======================================================================
Each "tn" object contains the parameters needed to create the Identity
header used to attest to the ownership of the caller-id on outgoing
requests. When an outgoing INVITE request is placed, the attestation
service will look up the caller-id in this list and if it's found, use
the information in the object to create the Identity header.
The private key and certificate needed to sign the Identity header are
usually provided to you by the telephone number issuing authority along
with their certificate authority certificate. You should give the CA
certificate to any recipients who expect to receive calls from you
although this has probably already been done by the issuing authority.
The "id" of this object MUST be a canonicalized telephone number which
starts with a country code. The only valid characters are the numbers
0-9, '#' and '*'.
Parameters:
-- type (required) ----------------------------------------------------
Must be set to "tn"
Default: none
-- private_key_file ---------------------------------------------------
The path to a file containing the private key you received from the
issuing authority. The file must NOT be group or world readable or
writable so make sure the user the asterisk process is running as is
the owner.
Default: private_key_file from the profile or attestation objects.
-- public_cert_url ----------------------------------------------------
The URL to the certificate you received from the issueing authority.
They may give you a URL to use or you may have to host the certificate
yourself and provide your own URL here.
Default: public_cert_url from the profile or attestation objects.
WARNING: Make absolutely sure the file that's made public doesn't
accidentally include the privite key as well as the certificate.
If you set "check_tn_cert_public_url" in the "attestation" section
above, the tn will not be loaded and a "DANGER" message will be output
on the asterisk console if the file does contain a private key.
-- attest_level -------------------------------------------------------
The level of the attestation you're making.
One of "A", "B", "C"
Default: attest_level from the profile or attestation objects.
-----------------------------------------------------------------------
Example "tn" object:
--;
;[18005551515]
;type = tn
;private_key_path = /var/lib/asterisk/keys/stir_shaken/tns/18005551515-key.pem
;public_cert_url = https://example.com/tncerts/18005551515-cert.pem
;attest_level = C
;--
=======================================================================
Verification Object Description
=======================================================================
The "verification" object sets the parameters for verification
of the Identity header on incoming INVITE requests.
All parameters except 'global_disable" may be overridden in a "profile"
object.
Only one "verification" object may exist.
Parameters:
-- global_disable -----------------------------------------------------
If set, globally disables the verification service.
Default: no
-- load_system_certs---------------------------------------------------
If set, loads the system Certificate Authority certificates
(usually located in /etc/pki/CA) into the trust store used to
validate the certificates in incoming requests. This is not
normally required as service providers will usually provide their
CA certififcate to you separately.
Default: no
-- ca_file -----------------------------------------------------------
Path to a single file containing a CA certificate or certificate chain
to be used to validate the certificates in incoming requests.
Default: none
-- ca_path -----------------------------------------------------------
Path to a directory containing one or more CA certificates to be used
to validate the certificates in incoming requests. The files in that
directory must contain only one certificate each and the directory
must be hashed using the OpenSSL 'c_rehash' utility.
Default: none
NOTE: Both ca_file and ca_path can be specified but at least one
MUST be.
-- crl_file -----------------------------------------------------------
Path to a single file containing a CA certificate revocation list
to be used to validate the certificates in incoming requests.
Default: none
-- crl_path -----------------------------------------------------------
Path to a directory containing one or more CA certificate revocation
lists to be used to validate the certificates in incoming requests.
The files in that directory must contain only one certificate each and
the directory must be hashed using the OpenSSL 'c_rehash' utility.
Default: none
NOTE: Neither crl_file nor crl_path are required.
-- cert_cache_dir -----------------------------------------------------
Incoming Identity headers will have a URL pointing to the certificate
used to sign the header. To prevent us from having to retrieve the
certificate for every request, we maintain a cache of them in the
'cert_cache_dir' specified. The directory will be checked for
existence and writability at startup.
Default: <astvarlibdir>/keys/stir_shaken/cache
-- curl_timeout -------------------------------------------------------
The number of seconds we'll wait for a response when trying to retrieve
the certificate specified in the incoming Identity header's "x5u"
parameter.
Default: 2
-- max_cache_entry_age ------------------------------------------------
Maximum age in seconds a certificate in the cache can reach before
re-retrieving it.
Default: 86400 (24 hours per ATIS-1000074)
NOTE: If, when retrieving the URL specified by the "x5u" parameter,
we receive a recognized caching directive in the HTTP response AND that
directive indicates caching for MORE than the value set here, we'll use
that time for the max_cache_entry_age.
-- max_cache_size -----------------------------------------------------
Maximum number of entries the cache can hold.
Not presently implemented.
-- max_iat_age --------------------------------------------------------
The "iat" parameter in the Identity header indicates the time the
sender actually created their attestation. If that is older than the
current time by the number of seconds set here, the request will be
considered "failed".
Default: 15
-- max_date_header_age ------------------------------------------------
The sender MUST also send a SIP Date header in their request. If we
receive one that is older than the current time by the number of seconds
set here, the request will be considered "failed".
Default: 15
-- failure_action -----------------------------------------------------
Indicates what will happen to requests that have failed verification.
Must be one of:
- continue -
Continue processing the request. You can use the STIR_SHAKEN
dialplan function to determine whether the request passed or failed
verification and take the action you deem appropriate.
- reject_request -
Reject the request immediately using the SIP response codes
defined by RFC8224.
- continue_return_reason -
Continue processing the request but, per RFC8224, send a SIP Reason
header back to the originator in the next provisional response
indicating the issue according to RFC8224. You can use the
STIR_SHAKEN dialplan function to determine whether the request
passed or failed verification and take the action you deem
appropriate.
Default: continue
NOTE: If you select "continue" or "continue_return_reason", and,
based on the results from the STIR_SHAKEN function, you determine you
want to terminate the call, you can use the PJSIPHangup() dialplan
application to reject the call using a STIR/SHAKEN-specific SIP
response code.
-- use_rfc9410_responses ----------------------------------------------
If set, when sending Reason headers back to originators, the protocol
header parameter will be set to "STIR" rather than "SIP". This is a
new protocol defined in RFC9410 and may not be supported by all
participants.
Default: no
-- relax_x5u_port_scheme_restrictions ---------------------------------
If set, the port and scheme restrictions imposed by ATIS-1000074
section 5.3.1 that require the scheme to be "https" and the port to
be 443 or 8443 are relaxed. This will allow schemes like "http"
and ports other than the two mentioned to appear in x5u URLs received
in Identity headers.
Default: no
CAUTION: Setting this parameter could have serious security
implications and should only be use for testing.
-- relax_x5u_path_restrictions ----------------------------------------
If set, the path restrictions imposed by ATIS-1000074 section 5.3.1
that require the x5u URL to be rejected if it contains a query string,
path parameters, fragment identifier or user/password are relaxed.
Default: no
CAUTION: Setting this parameter could have serious security
implications and should only be use for testing.
-- x5u_permit/x5u_deny ------------------------------------------------
When set, the IP address of the host in a received Identity header x5u
URL is checked against the acl created by this list of permit/deny
parameters. If the check fails, the x5u URL will be considered invalid
and verification will fail. This can prevent an attacker from sending
you a request pretending to be a known originator with a mailcious
certificate URL. (Server-side request forgery (SSRF)).
See acl.conf.sample to see examples of how to specify the permit/deny
parameters.
Default: Deny all "Special-Purpose" IP addresses described in RFC 6890.
This includes the loopback addresses 127.0.0.0/8, private use networks such
as 10.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, and the link local network
169.254.0.0/16 among others.
CAUTION: Setting this parameter could have serious security
implications and should only be use for testing.
-- x5u_acl ------------------------------------------------------------
Rather than providing individual permit/deny parameters, you can set
the acllist parameter to an acl list predefined in acl.conf.
Default: none
CAUTION: Setting this parameter could have serious security
implications and should only be use for testing.
-----------------------------------------------------------------------
Example "verification" object:
--;
;[verification]
;global_disable = yes
;load_system_certs = no
;ca_path = /var/lib/asterisk/keys/stir_shaken/verification_ca
;cert_cache_dir = /var/lib/asterisk/keys/stir_shaken/verification_cache
;failure_action = reject_request
;curl_timeout=5
;max_iat_age=60
;max_date_header_age=60
;max_cache_entry_age = 300
; For internal testing
;x5u_deny=0.0.0.0/0.0.0.0
;x5u_permit=127.0.0.0/8
;x5u_permit=192.168.100.0/24
;relax_x5u_port_scheme_restrictions = yes
;relax_x5u_path_restrictions = yes
;--
=======================================================================
Profile Object Description
=======================================================================
A "profile" object can be associated to channel driver endpoint
(currently only chan_pjsip) and can set verification and attestation
parameters specific to endpoints using this profile. If you have
multiple upstream providers, this is the place to set parameters
specific to them.
The "id" of this object is arbitrary and you'd specify it in the
"stir_shaken_profile" parameter of the endpoint.
Parameters:
-- type (required) ----------------------------------------------------
Must be set to "profile"
Default: none
-- endpoint_behhavior--------------------------------------------------
Actions to be performed for endpoints referencing this profile.
Must be one of:
- off -
Don't do any STIR/SHAKEN processing.
- attest -
Attest on outgoing calls.
- verify
Verify incoming calls.
- on -
Attest outgoing calls and verify incoming calls.
Default: off
All of the "verification" parameters defined above can be set on a profile
with the exception of 'global_disable'.
All of the "attestation" parameters defined above can be set on a profile
with the exception of 'global_disable'.
When Asterisk loads the configs, it creates "effective profiles" or
"eprofiles" on the fly that are the amalgamation of the attestation,
verification and profile. You can see them in the CLI with
"stir_shaken show eprofiles".
-----------------------------------------------------------------------
Example "profile" object:
--;
;[myprofile]
;type = profile
;endpoint_behavior = verify
;failure_action = continue_return_reason
;x5u_acl = myacllist
;In pjsip.conf...
;[myendpoint]
;type = endpoint
;stir_shaken_profile = myprofile
;In acl.conf...
;[myacllist]
;permit=0.0.0.0/0.0.0.0
;deny=127.0.0.1
;deny=10.24.20.171

View File

@ -5,7 +5,7 @@
[general]
port=5000 ; UDP port
;
; See https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service for a description of these parameters.
; See https://docs.asterisk.org/Configuration/Channel-Drivers/IP-Quality-of-Service for a description of these parameters.
;tos=cs3 ; Sets TOS for signaling packets.
;tos_audio=ef ; Sets TOS for RTP audio packets.
;cos=3 ; Sets 802.1p priority for signaling packets.

View File

@ -293,7 +293,8 @@ sendvoicemail=yes ; Allow the user to compose and send a voicemail while inside
; if not listed, calling the sender back will not be permitted
; exitcontext=fromvm ; Context to go to on user exit such as * or 0
; The default is the current context.
; review=yes ; Allow sender to review/rerecord their message before saving it [OFF by default
; review=yes ; Allow sender to review/rerecord their message before saving it [OFF by default]
; leaveurgent=yes ; Allow senders to leave messages that are marked as 'Urgent' [ON by default]
; operator=yes ; Allow sender to hit 0 before/after/during leaving a voicemail to
; reach an operator. This option REQUIRES an 'o' extension in the
; same context (or in exitcontext, if set), as that is where the

18135
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
AC_PREREQ(2.60a)
AC_INIT([asterisk], [master], [https://github.com/asterisk/asterisk/issues])
AC_INIT([asterisk], [21], [https://github.com/asterisk/asterisk/issues])
# cross-compile macros
AC_CANONICAL_BUILD
@ -463,6 +463,15 @@ if test "${with_pjproject}" = "no" || test "${with_pjproject}" = "n" ; then
PJPROJECT_BUNDLED=no
fi
LIBJWT_BUNDLED=no
AC_ARG_WITH([libjwt-bundled],
[AS_HELP_STRING([--with-libjwt-bundled],
[Use bundled libjwt library])],
[case "${withval}" in
y|ye|yes) LIBJWT_BUNDLED=yes ;;
*) LIBJWT_BUNDLED=no ;;
esac])
#
# OpenSSL stuff has to be done here because we want to pass
# any resulting CFLAGS and LDFLAGS to the bundled pjproject
@ -553,6 +562,7 @@ AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap])
AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit])
AST_EXT_LIB_SETUP_OPTIONAL([LIBEDIT_IS_UNICODE], [Libedit compiled for unicode], [LIBEDIT], [libedit])
AST_EXT_LIB_SETUP([LIBJWT], [LIBJWT], [libjwt])
AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt])
AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt])
@ -736,6 +746,14 @@ else
PBX_JANSSON=1
fi
source ./third-party/versions.mak
# Find required JWT support if bundled is not enabled.
if test "$LIBJWT_BUNDLED" = "no" ; then
AST_PKG_CONFIG_CHECK([LIBJWT], [libjwt >= $LIBJWT_VERSION])
else
PBX_LIBJWT=1
fi
# See if clock_gettime is in librt
AST_EXT_LIB_CHECK([RT], [rt], [clock_gettime], [])
@ -1154,9 +1172,6 @@ AC_LINK_IFELSE(
#)
#fi
# for FreeBSD thr_self
AC_CHECK_HEADERS([sys/thr.h])
AC_MSG_CHECKING(for compiler sync operations)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
@ -1714,7 +1729,7 @@ if test "${USE_ILBC}" != "no"; then
ILBC_INTERNAL="no"
fi
if test "${ILBC_SYSTEM}" = "yes"; then
AST_PKG_CONFIG_CHECK(ILBC, libilbc)
AST_PKG_CONFIG_CHECK(ILBC, libilbc < 3)
if test "$PBX_ILBC" = "1"; then
ILBC_INTERNAL="no"
fi

1
contrib/ast-db-manage/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.ini

View File

@ -0,0 +1,22 @@
"""add user-agent-header to ps_registrations
Revision ID: 24c12d8e9014
Revises: 37a5332640e2
Create Date: 2024-01-05 14:14:47.510917
"""
# revision identifiers, used by Alembic.
revision = '24c12d8e9014'
down_revision = '37a5332640e2'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('ps_registrations', sa.Column('user_agent', sa.String(255)))
def downgrade():
op.drop_column('ps_registrations', 'user_agent')

View File

@ -0,0 +1,58 @@
"""update pjsip tls method list
Revision ID: 37a5332640e2
Revises: dac2b4c328b8
Create Date: 2023-11-14 18:02:18.857452
"""
# revision identifiers, used by Alembic.
revision = '37a5332640e2'
down_revision = 'dac2b4c328b8'
from alembic import op
from sqlalchemy.dialects.postgresql import ENUM
import sqlalchemy as sa
PJSIP_TRANSPORT_METHOD_OLD_NAME = 'pjsip_transport_method_values'
PJSIP_TRANSPORT_METHOD_NEW_NAME = 'pjsip_transport_method_values_v2'
PJSIP_TRANSPORT_METHOD_OLD_VALUES = ['default', 'unspecified', 'tlsv1', 'sslv2',
'sslv3', 'sslv23']
PJSIP_TRANSPORT_METHOD_NEW_VALUES = ['default', 'unspecified',
'tlsv1', 'tlsv1_1', 'tlsv1_2', 'tlsv1_3',
'sslv2', 'sslv23', 'sslv3']
PJSIP_TRANSPORT_METHOD_OLD_TYPE = sa.Enum(*PJSIP_TRANSPORT_METHOD_OLD_VALUES,
name=PJSIP_TRANSPORT_METHOD_OLD_NAME)
PJSIP_TRANSPORT_METHOD_NEW_TYPE = sa.Enum(*PJSIP_TRANSPORT_METHOD_NEW_VALUES,
name=PJSIP_TRANSPORT_METHOD_NEW_NAME)
def upgrade():
if op.get_context().bind.dialect.name == 'postgresql':
enum = PJSIP_TRANSPORT_METHOD_NEW_TYPE
enum.create(op.get_bind(), checkfirst=False)
op.alter_column('ps_transports', 'method',
type_=PJSIP_TRANSPORT_METHOD_NEW_TYPE,
existing_type=PJSIP_TRANSPORT_METHOD_OLD_TYPE,
postgresql_using='method::text::' + PJSIP_TRANSPORT_METHOD_NEW_NAME)
if op.get_context().bind.dialect.name == 'postgresql':
ENUM(name=PJSIP_TRANSPORT_METHOD_OLD_NAME).drop(op.get_bind(), checkfirst=False)
def downgrade():
# First we need to ensure that columns are not using the enum values
# that are going away.
op.execute("UPDATE ps_transports SET method = 'tlsv1' WHERE method IN ('tlsv1_1', 'tlsv1_2', 'tlsv1_3')")
if op.get_context().bind.dialect.name == 'postgresql':
enum = PJSIP_TRANSPORT_METHOD_OLD_TYPE
enum.create(op.get_bind(), checkfirst=False)
op.alter_column('ps_transports', 'method',
type_=PJSIP_TRANSPORT_METHOD_OLD_TYPE,
existing_type=PJSIP_TRANSPORT_METHOD_NEW_TYPE,
postgresql_using='method::text::' + PJSIP_TRANSPORT_METHOD_OLD_NAME)
if op.get_context().bind.dialect.name == 'postgresql':
ENUM(name=PJSIP_TRANSPORT_METHOD_NEW_NAME).drop(op.get_bind(), checkfirst=False)

View File

@ -33,9 +33,9 @@ def upgrade():
enum = ENUM(*NEW_ENUM, name='pjsip_100rel_values_v2')
enum.create(op.get_bind(), checkfirst=False)
op.execute('ALTER TABLE ps_endpoints ALTER COLUMN 100rel TYPE'
op.execute('ALTER TABLE ps_endpoints ALTER COLUMN "100rel" TYPE'
' pjsip_100rel_values_v2 USING'
' 100rel::text::pjsip_100rel_values_v2')
' "100rel"::text::pjsip_100rel_values_v2')
ENUM(name="pjsip_100rel_values").drop(op.get_bind(), checkfirst=False)
@ -50,8 +50,8 @@ def downgrade():
enum = ENUM(*OLD_ENUM, name='pjsip_100rel_values')
enum.create(op.get_bind(), checkfirst=False)
op.execute('ALTER TABLE ps_endpoints ALTER COLUMN 100rel TYPE'
op.execute('ALTER TABLE ps_endpoints ALTER COLUMN "100rel" TYPE'
' pjsip_100rel_values USING'
' 100rel::text::pjsip_100rel_values')
' "100rel"::text::pjsip_100rel_values')
ENUM(name="pjsip_100rel_values_v2").drop(op.get_bind(), checkfirst=False)

View File

@ -0,0 +1,158 @@
"""more permission boolean columns
Revision ID: 74dc751dfe8e
Revises: bd335bae5d33
Create Date: 2024-02-27 15:31:09.458313
"""
# revision identifiers, used by Alembic.
revision = '74dc751dfe8e'
down_revision = 'bd335bae5d33'
import itertools
import operator
from alembic import op
import sqlalchemy as sa
from sqlalchemy import case, cast, or_, text
from sqlalchemy.dialects.postgresql import ENUM
from sqlalchemy.sql import table, column
COLUMNS = [ ('ps_aors', 'authenticate_qualify'),
('ps_aors', 'remove_existing'),
('ps_aors', 'remove_unavailable'),
('ps_aors', 'support_path'),
('ps_asterisk_publications', 'device_state'),
('ps_asterisk_publications', 'mailbox_state'),
('ps_contacts', 'authenticate_qualify'),
('ps_contacts', 'prune_on_boot'),
('ps_endpoint_id_ips', 'srv_lookups'),
('ps_endpoints', '100rel'),
('ps_endpoints', 'accept_multiple_sdp_answers'),
('ps_endpoints', 'aggregate_mwi'),
('ps_endpoints', 'allow_overlap'),
('ps_endpoints', 'allow_subscribe'),
('ps_endpoints', 'allow_transfer'),
('ps_endpoints', 'allow_unauthenticated_options'),
('ps_endpoints', 'asymmetric_rtp_codec'),
('ps_endpoints', 'bind_rtp_to_media_address'),
('ps_endpoints', 'bundle'),
('ps_endpoints', 'direct_media'),
('ps_endpoints', 'disable_direct_media_on_nat'),
('ps_endpoints', 'dtls_auto_generate_cert'),
('ps_endpoints', 'fax_detect'),
('ps_endpoints', 'follow_early_media_fork'),
('ps_endpoints', 'force_avp'),
('ps_endpoints', 'force_rport'),
('ps_endpoints', 'g726_non_standard'),
('ps_endpoints', 'ice_support'),
('ps_endpoints', 'ignore_183_without_sdp'),
('ps_endpoints', 'inband_progress'),
('ps_endpoints', 'media_encryption_optimistic'),
('ps_endpoints', 'media_use_received_transport'),
('ps_endpoints', 'moh_passthrough'),
('ps_endpoints', 'mwi_subscribe_replaces_unsolicited'),
('ps_endpoints', 'notify_early_inuse_ringing'),
('ps_endpoints', 'one_touch_recording'),
('ps_endpoints', 'preferred_codec_only'),
('ps_endpoints', 'refer_blind_progress'),
('ps_endpoints', 'rewrite_contact'),
('ps_endpoints', 'rpid_immediate'),
('ps_endpoints', 'rtcp_mux'),
('ps_endpoints', 'rtp_ipv6'),
('ps_endpoints', 'rtp_symmetric'),
('ps_endpoints', 'send_aoc'),
('ps_endpoints', 'send_connected_line'),
('ps_endpoints', 'send_diversion'),
('ps_endpoints', 'send_history_info'),
('ps_endpoints', 'send_pai'),
('ps_endpoints', 'send_rpid'),
('ps_endpoints', 'srtp_tag_32'),
('ps_endpoints', 'stir_shaken'),
('ps_endpoints', 'suppress_q850_reason_headers'),
('ps_endpoints', 't38_bind_udptl_to_media_address'),
('ps_endpoints', 't38_udptl'),
('ps_endpoints', 't38_udptl_ipv6'),
('ps_endpoints', 't38_udptl_nat'),
('ps_endpoints', 'timers'),
('ps_endpoints', 'trust_connected_line'),
('ps_endpoints', 'trust_id_inbound'),
('ps_endpoints', 'trust_id_outbound'),
('ps_endpoints', 'use_avpf'),
('ps_endpoints', 'use_ptime'),
('ps_endpoints', 'user_eq_phone'),
('ps_endpoints', 'webrtc'),
('ps_globals', 'all_codecs_on_empty_reinvite'),
('ps_globals', 'allow_sending_180_after_183'),
('ps_globals', 'disable_multi_domain'),
('ps_globals', 'ignore_uri_user_options'),
('ps_globals', 'mwi_disable_initial_unsolicited'),
('ps_globals', 'norefersub'),
('ps_globals', 'send_contact_status_on_update_registration'),
('ps_globals', 'use_callerid_contact'),
('ps_outbound_publishes', 'multi_user'),
('ps_registrations', 'auth_rejection_permanent'),
('ps_registrations', 'line'),
('ps_registrations', 'support_path'),
('ps_resource_list', 'full_state'),
('ps_resource_list', 'resource_display_name'),
('ps_subscription_persistence', 'prune_on_boot'),
('ps_systems', 'accept_multiple_sdp_answers'),
('ps_systems', 'compact_headers'),
('ps_systems', 'disable_rport'),
('ps_systems', 'disable_tcp_switch'),
('ps_systems', 'follow_early_media_fork'),
('ps_transports', 'allow_reload'),
('ps_transports', 'allow_wildcard_certs'),
('ps_transports', 'require_client_cert'),
('ps_transports', 'symmetric_transport'),
('ps_transports', 'verify_client'),
('ps_transports', 'verify_server') ]
YESNO_NAME = 'yesno_values'
YESNO_VALUES = ['yes', 'no']
AST_BOOL_NAME = 'ast_bool_values'
AST_BOOL_VALUES = [ '0', '1',
'off', 'on',
'false', 'true',
'no', 'yes' ]
yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
def upgrade():
for table_name, column_list in itertools.groupby(COLUMNS, operator.itemgetter(0)):
with op.batch_alter_table(table_name) as batch_op:
for _, column_name in column_list:
batch_op.alter_column(column_name,
type_=ast_bool_values,
existing_type=yesno_values,
postgresql_using='"{}"::text::{}'.format(column_name, AST_BOOL_NAME))
def downgrade():
for table_name, column_list in itertools.groupby(COLUMNS, operator.itemgetter(0)):
subject = table(table_name)
values_exprs = {}
for _, column_name in column_list:
subject.append_column(column(column_name))
values_exprs[column_name] = cast(
case((or_(subject.c[column_name] == text("'yes'"),
subject.c[column_name] == text("'1'"),
subject.c[column_name] == text("'on'"),
subject.c[column_name] == text("'true'")), text("'yes'")),
else_=text("'no'")),
ast_bool_values)
op.execute(
subject.update().values(values_exprs)
)
for table_name, column_list in itertools.groupby(COLUMNS, operator.itemgetter(0)):
with op.batch_alter_table(table_name) as batch_op:
for _, column_name in column_list:
batch_op.alter_column(column_name,
type_=yesno_values,
existing_type=ast_bool_values,
postgresql_using='"{}"::text::{}'.format(column_name, YESNO_NAME))

View File

@ -0,0 +1,35 @@
"""Create STIR/SHAKEN TN table
Revision ID: bd335bae5d33
Revises: 24c12d8e9014
Create Date: 2024-01-09 12:17:47.353533
"""
# revision identifiers, used by Alembic.
revision = 'bd335bae5d33'
down_revision = '24c12d8e9014'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ENUM
AST_BOOL_NAME = 'ast_bool_values'
AST_BOOL_VALUES = [ '0', '1',
'off', 'on',
'false', 'true',
'no', 'yes' ]
def upgrade():
ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
op.create_table(
'stir_tn',
sa.Column('id', sa.String(80), nullable=False, primary_key=True),
sa.Column('private_key_file', sa.String(1024), nullable=True),
sa.Column('public_cert_url', sa.String(1024), nullable=True),
sa.Column('attest_level', sa.String(1), nullable=True),
sa.Column('send_mky', ast_bool_values)
)
def downgrade():
op.drop_table('stir_tn')

View File

@ -0,0 +1,83 @@
"""increase pjsip id length
Revision ID: dac2b4c328b8
Revises: f5b0e7427449
Create Date: 2023-09-23 02:15:24.270526
"""
# revision identifiers, used by Alembic.
revision = 'dac2b4c328b8'
down_revision = 'f5b0e7427449'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column('ps_aors', 'id', type_=sa.String(255))
op.alter_column('ps_aors', 'outbound_proxy', type_=sa.String(255))
op.alter_column('ps_auths', 'id', type_=sa.String(255))
op.alter_column('ps_auths', 'realm', type_=sa.String(255))
op.alter_column('ps_contacts', 'outbound_proxy', type_=sa.String(255))
op.alter_column('ps_contacts', 'endpoint', type_=sa.String(255))
op.alter_column('ps_domain_aliases', 'id', type_=sa.String(255))
op.alter_column('ps_domain_aliases', 'domain', type_=sa.String(255))
op.alter_column('ps_endpoint_id_ips', 'id', type_=sa.String(255))
op.alter_column('ps_endpoint_id_ips', 'endpoint', type_=sa.String(255))
op.alter_column('ps_endpoints', 'id', type_=sa.String(255))
op.alter_column('ps_endpoints', 'aors', type_=sa.String(2048))
op.alter_column('ps_endpoints', 'auth', type_=sa.String(255))
op.alter_column('ps_endpoints', 'outbound_auth', type_=sa.String(255))
op.alter_column('ps_endpoints', 'outbound_proxy', type_=sa.String(255))
op.alter_column('ps_inbound_publications', 'id', type_=sa.String(255))
op.alter_column('ps_inbound_publications', 'endpoint', type_=sa.String(255))
op.alter_column('ps_outbound_publishes', 'id', type_=sa.String(255))
op.alter_column('ps_outbound_publishes', 'outbound_auth', type_=sa.String(255))
op.alter_column('ps_registrations', 'id', type_=sa.String(255))
op.alter_column('ps_registrations', 'outbound_auth', type_=sa.String(255))
op.alter_column('ps_registrations', 'outbound_proxy', type_=sa.String(255))
op.alter_column('ps_registrations', 'endpoint', type_=sa.String(255))
def downgrade():
op.alter_column('ps_aors', 'id', type_=sa.String(40))
op.alter_column('ps_aors', 'outbound_proxy', type_=sa.String(40))
op.alter_column('ps_auths', 'id', type_=sa.String(40))
op.alter_column('ps_auths', 'realm', type_=sa.String(40))
op.alter_column('ps_contacts', 'outbound_proxy', type_=sa.String(40))
op.alter_column('ps_contacts', 'endpoint', type_=sa.String(40))
op.alter_column('ps_domain_aliases', 'id', type_=sa.String(40))
op.alter_column('ps_domain_aliases', 'domain', type_=sa.String(40))
op.alter_column('ps_endpoint_id_ips', 'id', type_=sa.String(40))
op.alter_column('ps_endpoint_id_ips', 'endpoint', type_=sa.String(40))
op.alter_column('ps_endpoints', 'id', type_=sa.String(40))
op.alter_column('ps_endpoints', 'aors', type_=sa.String(200))
op.alter_column('ps_endpoints', 'auth', type_=sa.String(40))
op.alter_column('ps_endpoints', 'outbound_auth', type_=sa.String(40))
op.alter_column('ps_endpoints', 'outbound_proxy', type_=sa.String(40))
op.alter_column('ps_inbound_publications', 'id', type_=sa.String(40))
op.alter_column('ps_inbound_publications', 'endpoint', type_=sa.String(40))
op.alter_column('ps_outbound_publishes', 'id', type_=sa.String(40))
op.alter_column('ps_outbound_publishes', 'outbound_auth', type_=sa.String(40))
op.alter_column('ps_registrations', 'id', type_=sa.String(40))
op.alter_column('ps_registrations', 'outbound_auth', type_=sa.String(40))
op.alter_column('ps_registrations', 'outbound_proxy', type_=sa.String(40))
op.alter_column('ps_registrations', 'endpoint', type_=sa.String(40))

View File

@ -0,0 +1,22 @@
"""Remove macrocontext field
Revision ID: 1c55c341360f
Revises: 39428242f7f5
Create Date: 2024-01-09 15:01:39.698918
"""
# revision identifiers, used by Alembic.
revision = '1c55c341360f'
down_revision = '39428242f7f5'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_column('voicemail_messages', 'macrocontext')
def downgrade():
op.add_column('voicemail_messages', sa.Column('macrocontext', sa.String(80)))

View File

@ -0,0 +1,41 @@
CREATE TABLE alembic_version (
version_num VARCHAR(32) NOT NULL,
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
);
-- Running upgrade -> 210693f3123d
CREATE TABLE cdr (
accountcode VARCHAR(20),
src VARCHAR(80),
dst VARCHAR(80),
dcontext VARCHAR(80),
clid VARCHAR(80),
channel VARCHAR(80),
dstchannel VARCHAR(80),
lastapp VARCHAR(80),
lastdata VARCHAR(80),
start DATETIME,
answer DATETIME,
end DATETIME,
duration INTEGER,
billsec INTEGER,
disposition VARCHAR(45),
amaflags VARCHAR(45),
userfield VARCHAR(256),
uniqueid VARCHAR(150),
linkedid VARCHAR(150),
peeraccount VARCHAR(20),
sequence INTEGER
);
INSERT INTO alembic_version (version_num) VALUES ('210693f3123d');
-- Running upgrade 210693f3123d -> 54cde9847798
ALTER TABLE cdr MODIFY accountcode VARCHAR(80) NULL;
ALTER TABLE cdr MODIFY peeraccount VARCHAR(80) NULL;
UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
BEGIN;
CREATE TABLE alembic_version (
version_num VARCHAR(32) NOT NULL,
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
);
-- Running upgrade -> 4105ee839f58
CREATE TABLE queue_log (
id BIGSERIAL NOT NULL,
time TIMESTAMP WITHOUT TIME ZONE,
callid VARCHAR(80),
queuename VARCHAR(256),
agent VARCHAR(80),
event VARCHAR(32),
data1 VARCHAR(100),
data2 VARCHAR(100),
data3 VARCHAR(100),
data4 VARCHAR(100),
data5 VARCHAR(100),
PRIMARY KEY (id),
UNIQUE (id)
);
INSERT INTO alembic_version (version_num) VALUES ('4105ee839f58');
COMMIT;

View File

@ -0,0 +1,41 @@
CREATE TABLE alembic_version (
version_num VARCHAR(32) NOT NULL,
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
);
-- Running upgrade -> a2e9769475e
CREATE TABLE voicemail_messages (
dir VARCHAR(255) NOT NULL,
msgnum INTEGER NOT NULL,
context VARCHAR(80),
macrocontext VARCHAR(80),
callerid VARCHAR(80),
origtime INTEGER,
duration INTEGER,
recording BLOB,
flag VARCHAR(30),
category VARCHAR(30),
mailboxuser VARCHAR(30),
mailboxcontext VARCHAR(30),
msg_id VARCHAR(40)
);
ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum);
CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir);
INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e');
-- Running upgrade a2e9769475e -> 39428242f7f5
ALTER TABLE voicemail_messages MODIFY recording BLOB(4294967295) NULL;
UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e';
-- Running upgrade 39428242f7f5 -> 1c55c341360f
ALTER TABLE voicemail_messages DROP COLUMN macrocontext;
UPDATE alembic_version SET version_num='1c55c341360f' WHERE alembic_version.version_num = '39428242f7f5';

View File

@ -0,0 +1,45 @@
BEGIN;
CREATE TABLE alembic_version (
version_num VARCHAR(32) NOT NULL,
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
);
-- Running upgrade -> 210693f3123d
CREATE TABLE cdr (
accountcode VARCHAR(20),
src VARCHAR(80),
dst VARCHAR(80),
dcontext VARCHAR(80),
clid VARCHAR(80),
channel VARCHAR(80),
dstchannel VARCHAR(80),
lastapp VARCHAR(80),
lastdata VARCHAR(80),
start TIMESTAMP WITHOUT TIME ZONE,
answer TIMESTAMP WITHOUT TIME ZONE,
"end" TIMESTAMP WITHOUT TIME ZONE,
duration INTEGER,
billsec INTEGER,
disposition VARCHAR(45),
amaflags VARCHAR(45),
userfield VARCHAR(256),
uniqueid VARCHAR(150),
linkedid VARCHAR(150),
peeraccount VARCHAR(20),
sequence INTEGER
);
INSERT INTO alembic_version (version_num) VALUES ('210693f3123d');
-- Running upgrade 210693f3123d -> 54cde9847798
ALTER TABLE cdr ALTER COLUMN accountcode TYPE VARCHAR(80);
ALTER TABLE cdr ALTER COLUMN peeraccount TYPE VARCHAR(80);
UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d';
COMMIT;

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More