Compare commits

...

2054 Commits
master ... 16

Author SHA1 Message Date
George Joseph f96a9b7e96 ari-stubs: Fix more local anchor references
Also allow CreateDocs job to be run manually with default branches.
2023-09-05 13:36:08 -06:00
George Joseph f1c45f2225 ari-stubs: Fix more local anchor references
Also allow CreateDocs job to be run manually with default branches.
2023-09-05 13:05:37 -06:00
George Joseph f9b052ef90 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.
2023-09-05 09:55:40 -06:00
George Joseph 97a25c6005 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
2023-08-29 11:09:52 +00:00
George Joseph fb98642410 .github: Use generic releaser 2023-08-15 13:13:04 -06:00
George Joseph c90aef87d2 .github: Suppress cherry-pick reminder for some situations
In PROpenedOrUpdated, the cherry-pick reminder will now be
suppressed if there are already valid 'cherry-pick-to' comments
in the PR or the PR contained a 'cherry-pick-to: none' comment.
2023-07-11 06:50:32 -06:00
Sean Bright 5101616aeb apply_patches: Use globbing instead of file/sort.
This accomplishes the same thing as a `find ... | sort` but with the
added benefit of clarity and avoiding a call to a subshell.

Additionally drop the -s option from call to patch as it is not POSIX.
2023-07-07 15:12:02 +00:00
George Joseph 4ff194bd8e bundled_pjproject: Backport 2 SSL patches from upstream
* Fix double free of ossock->ossl_ctx in case of errors
https://github.com/pjsip/pjproject/commit/863629bc65d6

* free SSL context and reset context pointer when setting the cipher
  list fails
https://github.com/pjsip/pjproject/commit/0fb32cd4c0b2

Resolves: #194
2023-07-06 18:28:41 +00:00
George Joseph 05b45ca303 bundled_pjproject: Backport security fixes from pjproject 2.13.1
Merge-pull-request-from-GHSA-9pfh-r8x4-w26w.patch
Merge-pull-request-from-GHSA-cxwq-5g9x-x7fr.patch
Locking-fix-so-that-SSL_shutdown-and-SSL_write-are-n.patch
Don-t-call-SSL_shutdown-when-receiving-SSL_ERROR_SYS.patch

Resolves: #188
2023-07-06 15:21:42 +00:00
George Joseph 6df35a1a6f apply_patches: Sort patch list before applying
The apply_patches script wasn't sorting the list of patches in
the "patches" directory before applying them. This left the list
in an indeterminate order. In most cases, the list is actually
sorted but rarely, they can be out of order and cause dependent
patches to fail to apply.

We now sort the list but the "sort" program wasn't in the
configure scripts so we needed to add that and regenerate
the scripts as well.

Resolves: #193
2023-07-06 14:03:59 +00:00
George Joseph eef68819b7 .github: Add workflow to this branch 2023-07-05 08:02:57 -06:00
George Joseph c3af86ae10 rest-api: Updates for new documentation site
The new documentation site uses traditional markdown instead
of the Confluence flavored version.  This required changes in
the mustache templates and the python that generates the files.
2023-06-27 08:31:50 -06:00
Naveen Albert afdce6fc53 say: Don't prepend ampersand erroneously.
Some logic in say.c for determining if we need
to also add an ampersand for file seperation was faulty,
as non-successful files would increment the count, causing
a leading ampersand to be added improperly.

This is fixed, and a unit test that captures this regression
is also added.

ASTERISK-30248 #close

Change-Id: I02c1d3a11d82fe4ea8b462070cbd1effb5834d2b
(cherry picked from commit bf6194be45)
2023-01-04 06:01:41 -06:00
George Joseph 54b1a64ef0 res_pjsip_transport_websocket: Add remote port to transport
When Asterisk receives a new websocket conenction, it creates a new
pjsip transport for it and copies connection data into it.  The
transport manager then uses the remote IP address and port on the
transport to create a monitor for each connection.  However, the
remote port wasn't being copied, only the IP address which meant
that the transport manager was creating only 1 monitoring entry for
all websocket connections from the same IP address. Therefore, if
one of those connections failed, it deleted the transport taking
all the the connections from that same IP address with it.

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

ASTERISK-30369

Change-Id: Ib506d40897ea6286455ac0be4dfbb0ed43b727e1
2023-01-03 06:48:59 -06:00
Asterisk Development Team 0e455fdd6d Update CHANGES and UPGRADE.txt for 16.30.0 2022-12-15 07:35:32 -05:00
Alexandre Fournier fabdbed47c res_geoloc: fix NULL pointer dereference bug
The `ast_geoloc_datastore_add_eprofile` function does not return 0 on
success, it returns the size of the underlying datastore. This means
that the datastore will be freed and its pointer set to NULL when no
error occured at all.

ASTERISK-30346

Change-Id: Iea9b209bd1244cc57b903b9496cb680c356e4bb9
2022-12-13 10:31:43 -05:00
Ben Ford c5b1fafb04 pjproject: 2.13 security fixes
Backports two security fixes (c4d3498 and 450baca) from pjproject 2.13.

ASTERISK-30338

Change-Id: I86fdc003d5d22cb66e7cc6dc3313a8194f27eb69
2022-12-03 10:26:56 -06:00
George Joseph 23560be802 pjsip_transport_events: Fix possible use after free on transport
It was possible for a module that registered for transport monitor
events to pass in a pjsip_transport that had already been freed.
This caused pjsip_transport_events to crash when looking up the
monitor for the transport.  The fix is a two pronged approach.

1. We now increment the reference count on pjsip_transports when we
create monitors for them, then decrement the count when the
transport is going to be destroyed.

2. There are now APIs to register and unregister monitor callbacks
by "transport key" which is a string concatenation of the remote ip
address and port.  This way the module needing to monitor the
transport doesn't have to hold on to the transport object itself to
unregister.  It just has to save the transport_key.

* Added the pjsip_transport reference increment and decrement.

* Changed the internal transport monitor container key from the
  transport->obj_name (which may not be unique anyway) to the
  transport_key.

* Added a helper macro AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR() that
  fills a buffer with the transport_key using a passed-in
  pjsip_transport.

* Added the following functions:
  ast_sip_transport_monitor_register_key
  ast_sip_transport_monitor_register_replace_key
  ast_sip_transport_monitor_unregister_key
  and marked their non-key counterparts as deprecated.

* Updated res_pjsip_pubsub and res_pjsip_outbound_register to use
  the new "key" monitor functions.

NOTE: res_pjsip_registrar also uses the transport monitor
functionality but doesn't have a persistent object other than
contact to store a transport key.  At this time, it continues to
use the non-key monitor functions.

ASTERISK-30244

Change-Id: I1a20baf2a8643c272dcf819871d6c395f148f00b
2022-12-03 10:24:10 -06:00
Mike Bradeen 282e1cbf9f manager: prevent file access outside of config dir
Add live_dangerously flag to manager and use this flag to
determine if a configuation file outside of AST_CONFIG_DIR
should be read.

ASTERISK-30176

Change-Id: I46b26af4047433b49ae5c8a85cb8cda806a07404
2022-12-03 10:22:11 -06:00
Mike Bradeen 993ebe302b ooh323c: not checking for IE minimum length
When decoding q.931 encoded calling/called number
now checking for length being less than minimum required.

ASTERISK-30103

Change-Id: I3dcfce0f35eca258dc450f87c92d4d7af402c2e7
2022-12-01 11:08:54 -06:00
Mike Bradeen 7f2a13786b res_pjsip: prevent crash on websocket disconnect
When a websocket (or potentially any stateful connection) is quickly
created then destroyed, it is possible that the qualify thread will
destroy the transaction before the initialzing thread is finished
with it.

Depending on the timing, this can cause an assertion within pjsip.

To prevent this, ast_send_stateful_response will now create the group
lock and add a reference to it before creating the transaction.

While this should resolve the crash, there is still the potential that
the contact will not be cleaned up properly, see:ASTERISK~29286. As a
result, the contact has to 'time out' before it will be removed.

ASTERISK-28689

Change-Id: Id050fded2247a04d8f0fc5b8a2cf3e5482cb8cee
2022-10-31 10:09:11 -05:00
Igor Goncharovsky bc18b2d567 res_pjsip_outbound_registration: Allow to use multiple proxies for registration
Current registration code use pjsip_parse_uri to verify outbound_proxy
that is different from the reading this option for the endpoint. This
made value with multiple proxies invalid for registration pjsip settings.
Removing URI validation helps to use registration through multiple proxies.

ASTERISK-30217 #close

Change-Id: I064558e66f04b9f3260c46181812a01349761357
2022-10-31 08:40:58 -05:00
Henning Westerholt 15265aeea9 res_pjsip: return all codecs on a re-INVITE without SDP
Currently chan_pjsip on receiving a re-INVITE without SDP will only
return the codecs that are previously negotiated and not offering
all enabled codecs.

This causes interoperability issues with different equipment (e.g.
from Cisco) for some of our customers and probably also in other
scenarios involving 3PCC infrastructure.

According to RFC 3261, section 14.2 we SHOULD return all codecs
on a re-INVITE without SDP

The PR proposes a new parameter to configure this behaviour:
all_codecs_on_empty_reinvite. It includes the code, documentation,
alembic migrations, CHANGES file and example configuration additions.

ASTERISK-30193 #close

Change-Id: I69763708d5039d512f391e296ee8a4d43a1e2148
2022-10-27 14:45:59 -05:00
Philip Prindeville 95bb23ce4c res_crypto: handle unsafe private key files
ASTERISK-30213 #close

Change-Id: I4a77143d41615b7c4fc25bb1251c0a9cb87b417a
2022-10-14 10:01:56 -05:00
Mike Bradeen 14e1ba19ee audiohook: add directional awareness
Add enum to allow setting optional direction. If set to only one
direction, only feed matching-direction frames to the associated
slin factory.

This prevents mangling the transcoder on non-mixed frames when the
READ and WRITE frames would have otherwise required it.  Also
removes the need to mute or discard the un-wanted frames as they
are no longer added in the first place.

res_stasis_snoop is changed to use this addition to set direction
on audiohook based on spy direction.

If no direction is set, the ast_audiohook_init will init this enum
to BOTH which maintains existing functionality.

ASTERISK-30252

Change-Id: If8716bad334562a5d812be4eeb2a92e4f3be28eb
2022-10-11 08:13:10 -05:00
Naveen Albert a587258733 cdr: Allow bridging and dial state changes to be ignored.
Allows bridging, parking, and dial messages to be globally
ignored for all CDRs such that only a single CDR record
is generated per channel.

This is useful when CDRs should endure for the lifetime of
an entire channel and bridging and dial updates in the
dialplan should not result in multiple CDR records being
created for the call. With the ignore bridging option,
bridging changes have no impact on the channel's CDRs.
With the ignore dial state option, multiple Dials and their
outcomes have no impact on the channel's CDRs. The
last disposition on the channel is preserved in the CDR,
so the actual disposition of the call remains available.

These two options can reduce the amount of "CDR hacks" that
have hitherto been necessary to ensure that CDR was not
"spoiled" by these messages if that was undesired, such as
putting a dummy optimization-disabled local channel between
the caller and the actual call and putting the CDR on the channel
in the middle to ensure that CDR would persist for the entire
call and properly record start, answer, and end times.
Enabling these options is desirable when calls correspond
to the entire lifetime of channels and the CDR should
reflect that.

Current default behavior remains unchanged.

ASTERISK-30091 #close

Change-Id: I393981af42732ec5ac3ff9266444abb453b7c832
2022-10-10 12:06:53 -05:00
Naveen Albert 1c97a1d141 res_tonedetect: Add ringback support to TONE_DETECT.
Adds support for detecting audible ringback tone
to the TONE_DETECT function using the p option.

ASTERISK-30254 #close

Change-Id: Ie2329ff245248768367d26749c285fbe823f6414
2022-10-10 12:04:46 -05:00
Philip Prindeville c19fe636df res_crypto: don't modify fname in try_load_key()
"fname" is passed in as a const char *, but strstr() mangles that
into a char *, and we were attempting to modify the string in place.
This is an unwanted (and undocumented) side-effect.

ASTERISK-30213

Change-Id: Ifa36d352aafeb7f9beec3f746332865c7d21e629
2022-10-10 10:12:46 -05:00
Philip Prindeville 24b677db88 res_crypto: use ast_file_read_dirs() to iterate
ASTERISK-30213

Change-Id: I115f5f8942ffcfb23cd2559a55bac8a2eba081e0
2022-10-10 10:09:23 -05:00
Naveen Albert 83afb94f79 chan_dahdi: Resolve format truncation warning.
Fixes a format truncation warning in notify_message.

ASTERISK-30256 #close

Change-Id: I983a423c0214641ca4f8c9dfe0b19c47448fdee1
2022-10-10 09:55:24 -05:00
George Joseph a5f2cbb9e2 res_geolocation: Update wiki documentation
Also added a note to the geolocation.conf.sample file
and added a README to the res/res_geolocation/wiki
directory.

Change-Id: I89c3c5db8c0701b33127993622d5e4f904bddfbc
2022-10-10 07:31:40 -05:00
Maximilian Fridrich fc6f91eebb res_pjsip: Add mediasec capabilities.
This patch adds support for mediasec SIP headers and SDP attributes.
These are defined in RFC 3329, 3GPP TS 24.229 and
draft-dawes-sipcore-mediasec-parameter. The new features are
implemented so that a backbone for RFC 3329 is present to streamline
future work on RFC 3329.

With this patch, Asterisk can communicate with Deutsche Telekom trunks
which require these fields.

ASTERISK-30032

Change-Id: Ia7f5b5ba42db18074fdd5428c4e1838728586be2
2022-10-03 07:31:48 -05:00
Asterisk Development Team 61dbbc4268 Update CHANGES and UPGRADE.txt for 16.29.0 2022-09-28 07:37:02 -05:00
George Joseph 608c1df651 manager.h: Bump version to 5.0.5
Change-Id: I36de7263df7d9ab4d55769a15c9c27e5b5c26ed3
2022-09-28 05:56:39 -06:00
Naveen Albert 7c6538c7f1 db: Fix incorrect DB tree count for AMI.
The DBGetTree AMI action's ListItem previously
always reported 1, regardless of the count. This
is corrected to report the actual count.

ASTERISK-30245 #close
patches:
  gettreecount.diff submitted by Birger Harzenetter (license 5870)

Change-Id: I46d8992710f1b8524426b1255f57d1ef4a4934d4
2022-09-26 17:19:00 -05:00
Naveen Albert ae4ee53731 res_pjsip_geolocation: Change some notices to debugs.
If geolocation is not in use for an endpoint, the NOTICE
log level is currently spammed with messages about this,
even though nothing is wrong and these messages provide
no real value. These log messages are therefore changed
to debugs.

ASTERISK-30241 #close

Change-Id: I656b355d812f67cc0f0fdf09b00b0e1458598bb4
2022-09-26 15:40:50 -05:00
Naveen Albert 07a4a9b8ec func_logic: Don't emit warning if both IF branches are empty.
The IF function currently emits warnings if both IF branches
are empty. However, there is no actual necessity that either
branch be non-empty as, unlike other conditional applications/
functions, nothing is inherently done with IF, and both
sides could legitimately be empty. The warning is thus turned
into a debug message.

ASTERISK-30243 #close

Change-Id: I5250625dd720f95e1859b5dfb933905d7e7a730e
2022-09-26 12:32:56 -05:00
Naveen Albert 7400939d73 features: Add no answer option to Bridge.
Adds the n "no answer" option to the Bridge application
so that answer supervision can not automatically
be provided when Bridge is executed.

Additionally, a mechanism (dialplan variable)
is added to prevent bridge targets (typically the
target of a masquerade) from answering the channel
when they enter the bridge.

ASTERISK-30223 #close

Change-Id: I76f73fcd8e403bcd18f2abb40c658f537ac1ba6d
2022-09-26 11:28:52 -05:00
Naveen Albert c19a2eb1f5 app_bridgewait: Add option to not answer channel.
Adds the n option to not answer the channel when calling
BridgeWait, so the application can be used without
forcing answer supervision.

ASTERISK-30216 #close

Change-Id: I6b85ef300b1f7b5170f8537e2b10889cc2e6605a
2022-09-26 10:36:38 -05:00
Naveen Albert 383a93cdfb app_amd: Add option to play audio during AMD.
Adds an option that will play an audio file
to the party while AMD is running on the
channel, so the called party does not just
hear silence.

ASTERISK-30179 #close

Change-Id: I4af306274552b61b3d9f0883c33f698abd4699b6
2022-09-26 09:47:41 -05:00
Philip Prindeville 5b9f91d0a1 test: initialize capture structure before freeing
ASTERISK-30232 #close

Change-Id: I2603e2cef8f93f6b0a6ef39f7eac744251bb3902
2022-09-26 09:39:59 -05:00
Naveen Albert 1500de2b09 func_export: Add EXPORT function
Adds the EXPORT function, which allows write
access to variables and functions on other
channels.

ASTERISK-29432 #close

Change-Id: I7492645ae4307553d0f586d78e13a4f586231fdf
2022-09-26 07:53:31 -05:00
Maximilian Fridrich 7b56859a42 res_pjsip: Add 100rel option "peer_supported".
This patch adds a new option to the 100rel parameter for pjsip
endpoints called "peer_supported". When an endpoint with this option
receives an incoming request and the request indicated support for the
100rel extension, then Asterisk will send 1xx responses reliably. If
the request did not indicate 100rel support, Asterisk sends 1xx
responses normally.

ASTERISK-30158

Change-Id: Id6d95ffa8f00dab118e0b386146e99f254f287ad
2022-09-22 18:38:54 -05:00
Jaco Kroon 86735ebfc2 manager: be more aggressive about purging http sessions.
If we find that n_max (currently hard wired to 1) sessions were purged,
schedule the next purge for 1ms into the future rather than 5000ms (as
per current).  This way we will purge up to 1000 sessions per second
rather than 1 every 5 seconds.

This mitigates a build-up of sessions should http sessions gets
established faster than 1 per 5 seconds.

Change-Id: I9820d39aa080109df44fe98c1325cafae48d54f5
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2022-09-22 11:20:52 -05:00
Naveen Albert 21b1651646 func_scramble: Fix null pointer dereference.
Fix segfault due to null pointer dereference
inside the audiohook callback.

ASTERISK-30220 #close

Change-Id: Ideb80f606974366e89d619d908744230b5a5a259
2022-09-22 10:22:27 -05:00
Naveen Albert 2f10855177 func_strings: Add trim functions.
Adds TRIM, LTRIM, and RTRIM, which can be used
for trimming leading and trailing whitespace
from strings.

ASTERISK-30222 #close

Change-Id: I50fb0c40726d044a7a41939fa9026f3da4872554
2022-09-22 05:48:45 -05:00
George Joseph 148d077b52 res_crypto: Memory issues and uninitialized variable errors
ASTERISK-30235

Change-Id: Ia1e326e7b52cd06fd5e6c9009e3e63193c92f6cd
2022-09-19 05:32:03 -06:00
George Joseph 78cb7d6fec res_geolocation: Fix issues exposed by compiling with -O2
Fixed "may be used uninitialized" errors in geoloc_config.c.

ASTERISK-30234

Change-Id: I1ea336bf7abbc16fa59b75720f0db8f1d960b3d4
2022-09-16 08:30:15 -06:00
Philip Prindeville 029ac0e882 res_crypto: don't complain about directories
ASTERISK-30226 #close

Change-Id: I5695fb0c9521f112f754b8362cff2a8f3eff05c5
2022-09-14 23:12:09 -06:00
Asterisk Development Team a1fbffc8b7 Update CHANGES and UPGRADE.txt for 16.29.0 2022-09-14 09:07:13 -05:00
Mike Bradeen 2bb970cfe7 res_pjsip: Add user=phone on From and PAID for usereqphone=yes
Adding user=phone to local-side uri's when user_eq_phone=yes is set for
an endpoint. Previously this would only add the header to the To and R-URI.

ASTERISK-30178

Change-Id: Id3bfb5d225d762e7d2668c023fe09e4541ae8600
2022-09-14 07:20:11 -05:00
George Joseph f18d20e28e res_geolocation: Fix segfault when there's an empty element
Fixed a segfault caused by var_list_from_loc_info() encountering
an empty location info element.

Fixed an issue in ast_strsep() where a value with only whitespace
wasn't being preserved.

Fixed an issue in ast_variable_list_from_quoted_string() where
an empty value was considered a failure.

ASTERISK-30215
Reported by: Dan Cropp

Change-Id: Ieca64e061a6d9298f0196c694b60d986ef82613a
2022-09-13 07:14:37 -06:00
sungtae kim 5ccf79b917 res_musiconhold: Add option to not play music on hold on unanswered channels
This change adds an option, answeredonly, that will prevent music on
hold on channels that are not answered.

ASTERISK-30135

Change-Id: I1ab0defa43a29a26ae39f94c623596cf90fddc08
2022-09-13 05:48:15 -05:00
Ben Ford 369f45c432 res_pjsip: Add TEL URI support for basic calls.
This change allows TEL URI requests to come through for basic calls. The
allowed requests are INVITE, ACK, BYE, and CANCEL. The From and To
headers will now allow TEL URIs, as well as the request URI.

Support is only for TEL URIs present in traffic from a remote party.
Asterisk does not generate any TEL URIs on its own.

ASTERISK-26894

Change-Id: If5729e6cd583be7acf666373bf9f1b9d653ec29a
2022-09-13 04:51:21 -05:00
Philip Prindeville b1cf0e0069 res_crypto: Use EVP API's instead of legacy API's
ASTERISK-30046 #close

Change-Id: I5c738756de75fd27ebad54be144c0ac6193f21b2
2022-09-12 16:19:11 -05:00
Philip Prindeville f82ec339fc test: Add coverage for res_crypto
We're validating the following functionality:

encrypting a block of data with RSA
decrypting a block of data with RSA
signing a block of data with RSA
verifying a signature with RSA
encrypting a block of data with AES-ECB
encrypting a block of data with AES-ECB

as well as accessing test keys from the keystore.

ASTERISK-30045 #close

Change-Id: I0d10e7b41009c5290a4356c6480e636712d5c96d
2022-09-12 14:57:09 -05:00
Philip Prindeville 6e9c8caded res_crypto: make keys reloadable on demand for testing
ASTERISK-30045

Change-Id: If59bbb50c1771084bfe2fef307a6077c90d35ce8
2022-09-12 13:09:32 -05:00
Philip Prindeville b9c2810607 test: Add test coverage for capture child process output
ASTERISK-30037 #close

Change-Id: I0273e85eeeb6b8e46703f24cd74d84f3daf0a69a
2022-09-12 11:23:43 -05:00
Philip Prindeville e7f34d1591 main/utils: allow checking for command in $PATH
ASTERISK-30037

Change-Id: I4b6f7264c8c737c476c798d2352f3232b263bbdf
2022-09-12 09:50:28 -05:00
Philip Prindeville 18a466a08d test: Add ability to capture child process output
ASTERISK-30037

Change-Id: Icbf84ce05addb197a458361c35d784e460d8d6c2
2022-09-12 08:16:03 -05:00
Philip Prindeville 792287918e res_crypto: Don't load non-regular files in keys directory
ASTERISK-30046

Change-Id: Ie77e0648f8b0b1c2159fb24662d1989cfd4cc36d
2022-09-12 07:55:50 -05:00
Naveen Albert 1a18e4dade func_frame_trace: Remove bogus assertion.
The FRAME_TRACE function currently asserts if it sees
a MASQUERADE_NOTIFY. However, this is a legitimate thing
that can happen so asserting is inappropriate, as there
are no clear negative ramifications of such a thing. This
is adjusted to be like the other frames to print out
the subclass.

ASTERISK-30210 #close

Change-Id: I8ecbdcf17e35f64bdeab42868471f581ad1d1a56
2022-09-11 18:04:37 -05:00
Naveen Albert 148549122c lock.c: Add AMI event for deadlocks.
Adds an AMI event to indicate that a deadlock
has likely started, when Asterisk is compiled
with DETECT_DEADLOCKS enabled. This can make
it easier to perform automated deadlock detection
and take appropriate action (such as doing a core
dump). Unlike the deadlock warnings, the AMI event
is emitted only once per deadlock.

ASTERISK-30161 #close

Change-Id: Ifc6ed3e390f8b4cff7f8077a50e4d7a5b54e42fb
2022-09-11 17:15:44 -05:00
Naveen Albert e84420a14d app_confbridge: Add end_marked_any option.
Adds the end_marked_any option, which can be used
to kick a user from a conference if any marked user
leaves.

ASTERISK-30211 #close

Change-Id: I9e8da7ccb892e522546c0f2b5476d172e022c2f5
2022-09-11 16:22:14 -05:00
George Joseph f500a87bb4 res_geolocation: Add two new options to GEOLOC_PROFILE
Added an 'a' option to the GEOLOC_PROFILE function to allow
variable lists like location_info_refinement to be appended
to instead of replacing the entire list.

Added an 'r' option to the GEOLOC_PROFILE function to resolve all
variables before a read operation and after a Set operation.

Added a few missing parameters to the ones allowed for writing
with GEOLOC_PROFILE.

Fixed a bug where calling GEOLOC_PROFILE to read a parameter
might actually update the profile object.

Cleaned up XML documentation a bit.

ASTERISK-30190

Change-Id: I75f541db43345509a2e86225bfa4cf8e242e5b6c
2022-09-10 12:54:08 -05:00
George Joseph dbdd26e867 res_geolocation: Allow location parameters on the profile object
You can now specify the location object's format, location_info,
method, location_source and confidence parameters directly on
a profile object for simple scenarios where the location
information isn't common with any other profiles.  This is
mutually exclusive with setting location_reference on the
profile.

Updated appdocsxml.dtd to allow xi:include in a configObject
element.  This makes it easier to link to complete configOptions
in another object.  This is used to add the above fields to the
profile object without having to maintain the option descriptions
in two places.

ASTERISK-30185

Change-Id: Ifd5f05be0a76f0a6ad49fa28d17c394027677569
2022-09-10 12:50:27 -05:00
George Joseph c55320e42e res_geolocation: Add profile parameter suppress_empty_ca_elements
Added profile parameter "suppress_empty_ca_elements" that
will cause Civic Address elements that are empty to be
suppressed from the outgoing PIDF-LO document.

Fixed a possible SEGV if a sub-parameter value didn't have a
value.

ASTERISK-30177

Change-Id: I924ccc5aa2f45110a3155b22e53dfaf3ef2092dd
2022-09-10 11:08:19 -05:00
George Joseph 4794e06825 res_geolocation: Add built-in profiles
The trigger to perform outgoing geolocation processing is the
presence of a geoloc_outgoing_call_profile on an endpoint. This
is intentional so as to not leak location information to
destinations that shouldn't receive it.   In a totally dynamic
configuration scenario however, there may not be any profiles
defined in geolocation.conf.  This makes it impossible to do
outgoing processing without defining a "dummy" profile in the
config file.

This commit adds 4 built-in profiles:
  "<prefer_config>"
  "<discard_config>"
  "<prefer_incoming>"
  "<discard_incoming>"
The profiles are empty except for having their precedence
set and can be set on an endpoint to allow processing without
entries in geolocation.conf.  "<discard_config>" is actually the
best one to use in this situation.

ASTERISK-30182

Change-Id: I1819ccfa404ce59802a3a07ad1cabed60fb9480a
2022-09-10 11:04:33 -05:00
Joshua C. Colp 1ad22c33cd res_pjsip_sdp_rtp: Skip formats without SDP details.
When producing an outgoing SDP we iterate through the configured
formats and produce SDP information. It is possible for some
configured formats to not have SDP information available. If this
is the case we skip over them to allow the SDP to still be
produced.

ASTERISK-29185

Change-Id: I3e37569aa4ca341260e6ca5904dc2f75e46a1749
2022-09-10 10:59:54 -05:00
Naveen Albert 393b903adc cli: Prevent assertions on startup from bad ao2 refs.
If "core show channels" is run before startup has completed, it
is possible for bad ao2 refs to occur because the system is not
yet fully initialized. This will lead to an assertion failing.

To prevent this, initialization of CLI builtins is moved to be
later along in the main load sequence. Core CLI commands are
loaded at the same time, but channel-related commands are loaded
later on.

ASTERISK-29846 #close

Change-Id: If6b3cde802876bd738c1b4cf2683bea6ddc615b6
2022-09-09 20:41:39 -05:00
Joshua C. Colp 3cb161cc59 pjsip: Add TLS transport reload support for certificate and key.
This change adds support using the pjsip_tls_transport_restart
function for reloading the TLS certificate and key, if the filenames
remain unchanged. This is useful for Let's Encrypt and other
situations. Note that no restart of the transport will occur if
the certificate and key remain unchanged.

ASTERISK-30186

Change-Id: I9bc95a6bf791830a9491ad9fa43c17d4010028d0
2022-09-09 18:40:52 -05:00
Naveen Albert 3978d6193f res_tonedetect: Fix typos referring to wrong variables.
Fixes two typos that cause fax detection to not work.
One refers to the wrong frame variable, and the other
refers to the subclass.integer instead of the frametype
as it should.

ASTERISK-30192 #close

Change-Id: I7b35fdb7bcf25a29a212eee37c20812c64ab3ef1
2022-09-09 12:29:54 -05:00
Mike Bradeen c085ecd9f7 alembic: add missing ps_endpoints columns
The stir_shaken_profile column was added to the
ps_endpoints table.

ASTERISK-29453

Change-Id: Ic52ce30e7951d5bc01396c950bdc2a8b3c1df74b
2022-09-09 11:34:31 -05:00
Sean Bright 1e2dfd0c32 chan_dahdi.c: Resolve a format-truncation build warning.
With gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0:

> chan_dahdi.c:4129:18: error: ‘%s’ directive output may be truncated
>   writing up to 255 bytes into a region of size between 242 and 252
>   [-Werror=format-truncation=]

This removes the error-prone sizeof(...) calculations in favor of just
doubling the size of the base buffer.

Change-Id: I2d276785286730d3d5d0a921bcea2e065dbf27c5
2022-09-09 09:39:03 -05:00
Alexei Gradinari 43bdb6da7e res_pjsip_pubsub: Postpone destruction of old subscriptions on RLS update
Set termination state to old subscriptions to prevent queueing and sending
NOTIFY messages on exten/device state changes.

Postpone destruction of old subscriptions until all already queued tasks
that may be using old subscriptions have completed.

ASTERISK-29906

Change-Id: I96582aad3a26515ca73a8460ee6756f56f6ba23b
2022-09-09 08:36:05 -05:00
Sean Bright e8db3ce4a3 channel.h: Remove redundant declaration.
The DECLARE_STRINGFIELD_SETTERS_FOR() declares ast_channel_name_set()
for us, so no need to declare it separately.

Change-Id: I4813a884ada475ddc62bca480bceb4a53b3ec59a
2022-09-09 05:59:39 -05:00
Naveen Albert 393356a7c5 features: Add transfer initiation options.
Adds additional control options over the transfer
feature functionality to give users more control
in how the transfer feature sounds and works.

First, the "transfer" sound that plays when a transfer is
initiated can now be customized by the user in
features.conf, just as with the other transfer sounds.

Secondly, the user can now specify the transfer extension
in advance by using the TRANSFER_EXTEN variable. If
a valid extension is contained in this variable, the call
will automatically be transferred to this destination.
Otherwise, it will fall back to collecting the extension
from the user as is always done now.

ASTERISK-29899 #close

Change-Id: Ibff309caa459a2b958706f2ed0ca393b1ef502e3
2022-09-08 12:45:03 -05:00
Mike Bradeen 5c8e414ce0 CI: Fixing path issue on venv check
ASTERISK-26826

Change-Id: I07388d16f74452cebc9c981f99044eb6b77df792
2022-08-31 13:43:49 -06:00
Mike Bradeen 942480a937 CI: use Python3 virtual environment
Requires Python3 testsuite changes

ASTERISK-26826

Change-Id: I92ec7dec751ad455503a584d6e860db88c56d6bc
2022-08-31 09:44:48 -05:00
Naveen Albert 86c5d1222e general: Very minor coding guideline fixes.
Fixes a few coding guideline violations:
* Use of C99 comments
* Opening brace on same line as function prototype

ASTERISK-30163 #close

Change-Id: I07771c4c89facd41ce8d323859f022ddbddf6ca7
2022-08-17 11:11:50 -05:00
Asterisk Development Team d4dabeda13 Update CHANGES and UPGRADE.txt for 16.28.0 2022-08-11 10:35:01 -05:00
George Joseph 065b7c3aef res_geolocation: Address user issues, remove complexity, plug leaks
* Added processing for the 'confidence' element.
* Added documentation to some APIs.
* removed a lot of complex code related to the very-off-nominal
  case of needing to process multiple location info sources.
* Create a new 'ast_geoloc_eprofile_to_pidf' API that just takes
  one eprofile instead of a datastore of multiples.
* Plugged a huge leak in XML processing that arose from
  insufficient documentation by the libxml/libxslt authors.
* Refactored stylesheets to be more efficient.
* Renamed 'profile_action' to 'profile_precedence' to better
  reflect it's purpose.
* Added the config option for 'allow_routing_use' which
  sets the value of the 'Geolocation-Routing' header.
* Removed the GeolocProfileCreate and GeolocProfileDelete
  dialplan apps.
* Changed the GEOLOC_PROFILE dialplan function as follows:
  * Removed the 'profile' argument.
  * Automatically create a profile if it doesn't exist.
  * Delete a profile if 'inheritable' is set to no.
* Fixed various bugs and leaks
* Updated Asterisk WiKi documentation.

ASTERISK-30167

Change-Id: If38c23f26228e96165be161c2f5e849cb8e16fa0
2022-08-10 11:47:55 -06:00
George Joseph 42a724c33b CHANGES: Delete orphaned geolocation files
Not sure how but the res_geolocation.txt and
res_pjsip_geolocation.txt files seem to be orphaned and need
to be removed.  This is a 16-only commit.

ASTERISK_30167 #noclose

Change-Id: I7718ffc071a91918af7558a983ccaaf257b77238
2022-08-10 08:10:24 -06:00
Naveen Albert 859b84476e chan_iax2: Add missing options documentation.
Adds missing dial resource option documentation.

ASTERISK-30164 #close

Change-Id: I674e1fc9b1e5d67a20599bd4b418ce294d48fc83
2022-08-10 08:39:44 -05:00
George Joseph 3cdea61bef Geolocation: Wiki Documentation
Change-Id: I68ba22db0a69d9e2eabcc2141b48a2395f7f1a23
2022-08-08 05:15:12 -05:00
Naveen Albert 77f117763c app_confbridge: Fix memory leak on updated menu options.
If the CONFBRIDGE function is used to dynamically set
menu options, a memory leak occurs when a menu option
that has been set is overridden, since the menu entry
is not destroyed before being freed. This ensures that
it is.

Additionally, logic that duplicates the destroy function
is removed in lieu of the destroy function itself.

ASTERISK-28422 #close

Change-Id: I71cfb5c24e636984d41086d1333a416dc12ff995
2022-08-02 10:42:41 -05:00
Naveen Albert 4060e56f80 manager: Remove documentation for nonexistent action.
The manager XML documentation documents a "FilterList"
action, but there is no such action. Therefore, this can
lead to confusion when people try to use a documented
action that does not, in fact, exist. This is removed
as the action never did exist in the past, nor would it
be trivial to add since we only store the regex_t
objects, so the filter list can't actually be provided
without storing that separately. Most likely, the
documentation was originally added (around version 10)
in anticipation of something that never happened.

ASTERISK-29917 #close

Change-Id: I846b16fd6f80a91d4ddc5d8a861b522d7c6f8f97
2022-08-02 09:08:59 -05:00
Naveen Albert 5bb7c2bd7d app_confbridge: Add missing AMI documentation.
Documents the ConfbridgeListRooms AMI response,
which is currently not documented.

ASTERISK-30020 #close

Change-Id: Id6fff7a936244bae7b52686301eb740c1169cdea
2022-08-01 11:05:58 -05:00
Naveen Albert dc7f5466db app_meetme: Add missing AMI documentation.
The MeetmeList and MeetmeListRooms AMI
responses are currently completely undocumented.
This adds documentation for these responses.

ASTERISK-30018 #close

Change-Id: Id93135b7edf01de6f8fba266e2122989dc8996b8
2022-08-01 11:05:22 -05:00
Naveen Albert 03e151c156 cdr.conf: Remove obsolete app_mysql reference.
The CDR sample config still mentions that app_mysql
is available in the addons directory, but this is
incorrect as it was removed as of 19. This removes
that to avoid confusion.

ASTERISK-30160 #close

Change-Id: Ie5293ccb4f2b365896981811b480544e67bb9cd7
2022-08-01 10:07:08 -05:00
Naveen Albert ff360ecdb9 general: Remove obsolete SVN references.
There are a handful of files in the tree that
reference an SVN link for the coding guidelines.

This removes these because the links are dead
and the vast majority of source files do not
contain these links, so this is more consistent.

app_skel still maintains an (up to date) link
to the coding guidelines.

ASTERISK-30159 #close

Change-Id: I35bbb20f66982e98099cff3029ede20091ffdac7
2022-08-01 09:20:25 -05:00
Naveen Albert 7703330142 general: Improve logging levels of some log messages.
Adjusts some logging levels to be more or less important,
that is more prominent when actual problems occur and less
prominent for less noteworthy things.

ASTERISK-30153 #close

Change-Id: Ifc8f7df427aa018627db462125ae744986d3261b
2022-08-01 08:00:31 -05:00
Naveen Albert 6badedc201 func_srv: Document field parameter.
Adds missing documentation for the field parameter
for the SRVRESULT function.

ASTERISK-30151
Reported by: Chris Young

Change-Id: I4385a2e0892a07e30dea1a8a0588e2c1bea2b1f1
2022-07-27 12:10:20 -05:00
Naveen Albert bc0bd5aa5d pbx_functions.c: Manually update ast_str strlen.
When ast_func_read2 is used to read a function using
its read function (as opposed to a native ast_str read2
function), the result is copied directly by the function
into the ast_str buffer. As a result, the ast_str length
remains initialized to 0, which is a bug because this is
not the real string length.

This can cascade and have issues elsewhere, such as when
reading substrings of functions that only register read
as opposed to read2 callbacks. In this case, since reading
ast_str_strlen returns 0, the returned substring is empty
as opposed to the actual substring. This has caused
the ast_str family of functions to behave inconsistently
and erroneously, in contrast to the pbx_variables substitution
functions which work correctly.

This fixes this issue by manually updating the ast_str length
when the result is copied directly into the ast_str buffer.

Additionally, an assertion and a unit test that previously
exposed these issues are added, now that the issue is fixed.

ASTERISK-29966 #close

Change-Id: I4e2dba41410f9d4dff61c995d2ca27718248e07f
2022-07-26 10:48:04 -05:00
Sergey V. Lobanov b2b8847456 build: fix bininstall launchd issue on cross-platform build
configure script detects /sbin/launchd, but the result of this
check is not used in Makefile (bininstall). Makefile also detects
/sbin/launchd file to decide if it is required to install
safe_asterisk.

configure script correctly detects cross compile build and sets
PBX_LAUNCHD=0

In case of building asterisk on MacOS host for Linux target using
external toolchain (e.g. OpenWrt toolchain), bininstall does not
install safe_asterisk (due to /sbin/launchd detection in Makefile),
but it is required on target (Linux).

This patch adds HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@ to makeopts.in to
use the result of /sbin/launchd detection from configure script in
Makefile.
Also this patch uses HAVE_SBIN_LAUNCHD in Makefile (bininstall) to
decide if it is required to install safe_asterisk.

ASTERISK-29905 #close

Change-Id: Iff61217276cd188f43f51ef4cdbffe39d9f07f65
2022-07-24 11:51:33 -05:00
Naveen Albert 4efea4780b manager: Fix incomplete filtering of AMI events.
The global event filtering code was only in one
possible execution path, so not all events were
being properly filtered out if requested. This moves
that into the universal AMI handling code so all
events are properly handled.

Additionally, the CLI listing of disabled events can
also get truncated, so we now print out everything.

ASTERISK-30137 #close

Change-Id: If8c42edcb2abc5158552da7eba2a8ff6b20e1959
2022-07-20 09:47:47 -05:00
Naveen Albert e8205fb166 db: Add AMI action to retrieve DB keys at prefix.
Adds the DBGetTree action, which can be used to
retrieve all of the DB keys beginning with a
particular prefix, similar to the capability
provided by the database show CLI command.

ASTERISK-30136 #close

Change-Id: I3be9425e53be71f24303fdd4d2923c14e84337e6
2022-07-18 12:35:45 -05:00
Michael Neuhauser 6fbcb24abb res_pjsip: delay contact pruning on Asterisk start
Move the call to ast_sip_location_prune_boot_contacts() *after* the call
to ast_res_pjsip_init_options_handling() so that
res/res_pjsip/pjsip_options.c is informed about the contact deletion and
updates its sip_options_contact_statuses list. This allows for an AMI
event to be sent by res/res_pjsip/pjsip_options.c if the endpoint
registers again from the same remote address and port (i.e., same URI)
as used before the Asterisk restart.

ASTERISK-30109
Reported-by: Michael Neuhauser

Change-Id: I1ba4478019e4931a7085f62708d9b66837e901a8
2022-07-14 09:44:22 -05:00
Sam Banks 30cc5bab2f queues.conf.sample: Correction of typo
ASTERISK-30126 #close

Change-Id: I009c4dcbf9338a13e3baf87b52a5bbe4f9f81a42
2022-07-14 08:16:42 -05:00
Naveen Albert 5177bb9f34 chan_dahdi: Fix buggy and missing Caller ID parameters
There are several things wrong with analog Caller ID
handling that are fixed by this commit:

callerid.c's Caller ID generation function contains the
logic to use the presentation to properly send the proper
Caller ID. However, currently, DAHDI does not pass any
presentation information to the Caller ID module, which
means that presentation is completely ignored on all calls.
This means that lines could be getting Caller ID information
they aren't supposed to.

Part of the reason this has been obscured is because the
simple switch logic for handling the built in *67 and *82
is completely wrong. Rather than modifying the presentation
for the call accordingly (which is what it's supposed to do),
it simply blanks out the Caller ID or fills it in. This is
wrong, so wrong that it makes a mockery of the specification.
Additionally, it would leave to the "UNAVAILABLE" disposition
being used for Caller ID generation as opposed to the "PRIVATE"
disposition that it should have been using. This is now fixed
to only update the presentation and not modify the number and
name, so that the simple switch *67/*82 work correctly.

Next, sig_analog currently only copies over the name and number,
nothing else, when it is filling in a duplicated caller id
structure. Thus, we also now copy over the presentation
information so that is available for the Caller ID spill.
Additionally, this meant that "valid" was implicitly 0,
and as such presentation would always fail to "Unavailable".
The validity is therefore also copied over so it can be used
by ast_party_id_presentation.

As part of this fix, new API is added so that all the relevant
Caller ID information can be passed in to the Caller ID generation
functions. Parameters that are also completely missing from the
Caller ID spill have also been added, to enhance the compatibility,
correctness, and completeness of the Asterisk Caller ID implementation.

ASTERISK-29991 #close

Change-Id: Icc44a5e09979916f4c18a440f96e10dc1c76ae15
2022-07-14 07:51:07 -05:00
Naveen Albert 15dc2f8c16 chan_dahdi: Add POLARITY function.
Adds a POLARITY function which can be used to
retrieve the current polarity of an FXS channel
as well as set the polarity of an FXS channel
to idle or reverse at any point during a call.

ASTERISK-30000 #close

Change-Id: If6f50998f723e4484bf68e2473f5cedfeaf9b8f1
2022-07-14 06:52:37 -05:00
Naveen Albert ebe9b566d2 app_confbridge: Always set minimum video update interval.
Currently, if multiple video-enabled ConfBridges are
conferenced together, we immediately get into a scenario
where an infinite sequence of video updates fills up
the taskprocessor queue and causes memory consumption
to climb unabated until Asterisk is killed. This is due
to the core bridging mechanism that provides video updates
(softmix_bridge_write_control in bridge_softmix.c)
continously updating all the channels in the bridge with
video updates.

The logic to do so in the core is that the video updates
should be provided if the video_update_discard property
for the bridge is 0, or if enough time has elapsed since
the last video update. Thus, we already have a safeguard
built in to ensure the scenario described above does not
happen. Currently, however, this safeguard is not being
adequately ensured.

In app_confbridge, the video_update_discard property
defaults to 2000, which is a healthy value that should
completely prevent this issue. However, this value is
only set onto the bridge in the SFU video mode. This
leaves video modes such as follow_talker completely
vulnerable, since video_update_discard will actually
be 0, since the default or set value was never applied.
As a result, the core bridging mechanism will always
try to provide video updates regardless of when the last
one was sent.

To prevent this issue from happening, we now always
set the video_update_discard property on the bridge
with the value from the bridge profile. The app_confbridge
defaults will thus ensure that infinite video updates
no longer happen in any video mode.

ASTERISK-29907 #close

Change-Id: I4accb2536ac62797950468e9930f12ef7dd486b2
2022-07-13 18:05:26 -05:00
Mike Bradeen 306186092e Makefile: Avoid git-make user conflict
make_version now silently checks if the required git commands will
fail.  If they do, then return UNKNOWN__git_check_fail to
distinguish this failure from other UNKNOWN__ version failures

Makefile checks for this value on install and exits out with
instructions

ASTERISK-30029

Change-Id: If8f10cac8f509c08981120f17555762342020221
2022-07-13 17:24:16 -05:00
Sean Bright a0c3eb3b08 pbx.c: Simplify ast_context memory management.
Allocate all of the ast_context's character data in the structure's
flexible array member and eliminate the clunky fake_context. This will
simplify future changes to ast_context.

Change-Id: I98357de75d8ac2b3c4c9f201223632e6901021ea
2022-07-13 17:17:31 -05:00
George Joseph dd0badf16b geoloc_eprofile.c: Fix setting of loc_src in set_loc_src()
line 196:    loc_src = '\0';
should have been
line 196:    *loc_src = '\0';

The issue was caught by the gcc optimizer complaining that
loc_src had a zero length because the pointer itself was being
set to NULL instead of the _contents_ of the pointer being set
to the NULL terminator.

ASTERISK-30138
Reported-by: Sean Bright

Change-Id: Id247be113cc8510f043ca053d5b4f5f3d32acd29
2022-07-13 12:38:10 -06:00
George Joseph a6f0fb9bf7 Geolocation: chan_pjsip Capability Preview
This commit adds res_pjsip_geolocation which gives chan_pjsip
the ability to use the core geolocation capabilities.

This commit message is intentionally short because this isn't
a simple capability.  See the documentation at
https://wiki.asterisk.org/wiki/display/AST/Geolocation
for more information.

THE CAPABILITIES IMPLEMENTED HERE MAY CHANGE BASED ON
USER FEEDBACK!

ASTERISK-30128

Change-Id: Ie2e2bcd87243c2cfabc43eb823d4427c7086f4d9
2022-07-12 13:33:35 -05:00
George Joseph 916dd96c86 Geolocation: Core Capability Preview
This commit adds res_geolocation which creates the core capabilities
to manipulate Geolocation information on SIP INVITEs.

An upcoming commit will add res_pjsip_geolocation which will
allow the capabilities to be used with the pjsip channel driver.

This commit message is intentionally short because this isn't
a simple capability.  See the documentation at
https://wiki.asterisk.org/wiki/display/AST/Geolocation
for more information.

THE CAPABILITIES IMPLEMENTED HERE MAY CHANGE BASED ON
USER FEEDBACK!

ASTERISK-30127

Change-Id: Ibfde963121b1ecf57fd98ee7060c4f0808416303
2022-07-12 07:50:32 -05:00
Naveen Albert a8395c9420 general: Fix various typos.
ASTERISK-30089 #close

Change-Id: I1f5db911fd05a3a211c522c13e990fa1d0e62275
2022-07-12 07:44:54 -05:00
Kevin Harwell 9ba2f083cf cel_odbc & res_config_odbc: Add support for SQL_DATETIME field type
See also: ASTERISK_30023

ASTERISK-30096 #close
patches:
  inline on issue - submitted by Morvai Szabolcs

Change-Id: I79c0b74862100acd9c8319dca5cc456a654d02eb
2022-07-11 04:12:59 -05:00
Naveen Albert f812dfb68c chan_iax2: Allow compiling without OpenSSL.
ASTERISK_30007 accidentally made OpenSSL a
required depdendency. This adds an ifdef so
the relevant code is compiled only if OpenSSL
is available, since it only needs to be executed
if OpenSSL is available anyways.

ASTERISK-30083 #close

Change-Id: Iad05c1a9a8bd2a48e7edf8d234eaa9f80779e34d
2022-07-11 04:12:01 -05:00
Naveen Albert 8a0ff5c0a6 res_cliexec: Add dialplan exec CLI command.
Adds a CLI command similar to "dialplan eval function" except for
applications: "dialplan exec application", useful for quickly
testing certain application behavior directly from the CLI
without writing any dialplan.

ASTERISK-30062 #close

Change-Id: I42e9fa9b60746c21450d40f99a026d48d2486dde
2022-07-08 08:53:59 -05:00
Trevor Peirce 14144af7a6 features: Update documentation for automon and automixmon
The current documentation is out of date and does not reflect actual
behaviour.  This change makes documentation clearer and accurately
reflect the purpose of relevant channel variables.

ASTERISK-30123

Change-Id: I160d0b01fce862477ad55ac1aa708a730473eb6f
2022-07-08 08:52:25 -05:00
George Joseph d0ef2164d9 Geolocation: Base Asterisk Prereqs
* Added ast_variable_list_from_quoted_string()
  Parse a quoted string into an ast_variable list.

* Added ast_str_substitute_variables_full2()
  Perform variable/function/expression substitution on an ast_str.

* Added ast_strsep_quoted()
  Like ast_strsep except you can specify a specific quote character.
  Also added unit test.

* Added ast_xml_find_child_element()
  Find a direct child element by name.

* Added ast_xml_doc_dump_memory()
  Dump the specified document to a buffer

* ast_datastore_free() now checks for a NULL datastore
  before attempting to destroy it.

Change-Id: I5dcefed2f5f93a109e8b489e18d80d42e45244ec
2022-07-07 08:34:25 -05:00
Boris P. Korzun 5761d7ab3b pbx_lua: Remove compiler warnings
Improved variable definitions (specified correct type) for avoiding
compiler warnings.

ASTERISK-30117 #close

Change-Id: I3b00c1befb658ee9379ddabd9a9132765ca9201a
2022-07-06 16:01:59 -05:00
Jose Lopes 043627f814 res_pjsip_header_funcs: Add functions PJSIP_RESPONSE_HEADER and PJSIP_RESPONSE_HEADERS
These new functions allow retrieving information from headers on 200 OK
INVITE response.

ASTERISK-29999

Change-Id: I264a610a9333359297a0825feb29a1bb4f4ad144
2022-07-04 02:15:59 -05:00
Naveen Albert 51a79fd4fd db: Notify user if deleted DB entry didn't exist.
Currently, if using the CLI to delete a DB entry,
"Database entry removed" is always returned,
regardless of whether or not the entry actually
existed in the first place. This meant that users
were never told if entries did not exist.

The same issue occurs if trying to delete a DB key
using AMI.

To address this, new API is added that is more stringent
in deleting values from AstDB, which will not return
success if the value did not exist in the first place,
and will print out specific error details if available.

ASTERISK-30001 #close

Change-Id: Ic84e3eddcd66c7a6ed7fea91cdfd402568378b18
2022-07-01 10:15:22 -05:00
Naveen Albert 12f693d401 cli: Fix CLI blocking forever on terminating backslash
A corner case exists in CLI parsing where if
a CLI user in a remote console ends with
a backslash and then invokes command completion
(using TAB or ?), then the console will freeze
forever until a SIGQUIT signal is sent to the
process, due to getting blocked forever
reading the command completion. CTRL+C
and other key combinations have no impact on
the CLI session.

This occurs because, in such cases, the CLI
process is waiting for AST_CLI_COMPLETE_EOF
to appear in the buffer from the main process,
but instead the main process is confused by
the funny syntax and thus prints out the CLI help.
As a result, the CLI process is stuck on the
read call, waiting for the completion that
will never come.

This prevents blocking forever by checking
if the data from the main process starts with
"Usage:". If it does, that means that CLI help
was sent instead of the tab complete vector,
and thus the CLI should bail out and not wait
any longer.

ASTERISK-29822 #close

Change-Id: I9810ac59304fec162da701653c9c834f0ec8f670
2022-07-01 10:14:55 -05:00
Naveen Albert 2a8d407935 res_calendar_icalendar: Send user agent in request.
Microsoft recently began rejecting all requests for
ICS calendars on Office 365 with 400 errors if
the request doesn't contain a user agent. See:

https://docs.microsoft.com/en-us/answers/questions/883904/34the-remote-server-returned-an-error-400-bad-requ.html

Accordingly, we now send a user agent on requests for
ICS files so that requests to Office 365 will work as
they did before.

ASTERISK-30106

Change-Id: Ie9dcaef12ae8adf37533c684499eb11005fac8f7
2022-07-01 09:57:20 -05:00
Naveen Albert f6f4e11d17 app_dial: Propagate outbound hook flashes.
The Dial application currently stops hook flashes
dead in their tracks from propagating through on
outbound calls. This fixes that so they can go
down the wire.

ASTERISK-30115 #close

Change-Id: Id4e78b29a049f35c5b1e7520eaa10d0eb5b7f97c
2022-06-30 18:36:08 -05:00
Naveen Albert 96e56b89e0 app_dial: Fix dial status regression.
ASTERISK_28638 caused a regression by incorrectly aborting
early and overwriting the status on certain calls.
This was exhibited by certain technologies such as DAHDI,
where DAHDI returns NULL for the request if a line is busy.
This caused the BUSY condition to be incorrectly treated
as CHANUNAVAIL because the DIALSTATUS was getting incorrectly
overwritten and call handling was aborted early.

This is fixed by instead checking if any valid peers have been
specified, as opposed to checking the list size of successful
requests. This is because the latter could be empty but this
does not indicate any kind of problem. This restores the
previous working behavior.

ASTERISK-29989 #close

Change-Id: I4d4b209b967816b1bc791534593ababa2b99bb88
2022-06-30 18:09:54 -05:00
Kevin Harwell 628661ca42 res_pjsip: allow TLS verification of wildcard cert-bearing servers
Rightly the use of wildcards in certificates is disallowed in accordance
with RFC5922. However, RFC2818 does make some allowances with regards to
their use when using subject alt names with DNS name types.

As such this patch creates a new setting for TLS transports called
'allow_wildcard_certs', which when it and 'verify_server' are both enabled
allows DNS name types, as well as the common name that start with '*.'
to match as a wildcard.

For instance: *.example.com
will match for: foo.example.com

Partial matching is not allowed, e.g. f*.example.com, foo.*.com, etc...
And the starting wildcard only matches for a single level.

For instance: *.example.com
will NOT match for: foo.bar.example.com

The new setting is disabled by default.

ASTERISK-30072 #close

Change-Id: If0be3fdab2e09c2a66bb54824fca406ebaac3da4
2022-06-30 16:53:53 -05:00
Naveen Albert c76a107cdf say: Abort play loop if caller hangs up.
If the caller has hung up, break out of the play loop so we don't try
to play remaining files and fail to do so.

ASTERISK-30075 #close

Change-Id: I55e85be28ee90b48c0fe4ce20ac136a7dbb49f14
2022-06-30 16:30:23 -05:00
Naveen Albert b1359bdfcf pbx: Add helper function to execute applications.
Finding an application and executing it if found is
a common task throughout Asterisk. This adds a helper
function around pbx_exec to do this, to eliminate
redundant code and make it easier for modules to
substitute variables and execute applications by name.

ASTERISK-30061 #close

Change-Id: Ifee4d2825df7545fb515d763d393065675140c84
2022-06-30 15:20:59 -05:00
Stanislav Abramenkov cd85f4a2a7 pjsip: Upgrade bundled version to pjproject 2.12.1
More information:
https://github.com/pjsip/pjproject/releases/tag/2.12.1

Pull request to third-party
https://github.com/asterisk/third-party/pull/11

ASTERISK-30050

Change-Id: Icb4e86d4b85ef9b975355c91f3ed56a50b51c6bd
2022-06-17 12:41:54 -05:00
Asterisk Development Team 786577c05b Update CHANGES and UPGRADE.txt for 16.27.0 2022-06-16 13:41:32 -05:00
Naveen Albert b7107b4dd4 asterisk.c: Fix incompatibility warnings for remote console.
A previous review fixing ASTERISK_22246 and ASTERISK_26582
got a couple of the options mixed up as to whether or not
they are compatible with the remote console. This fixes
those to the best of my knowledge.

ASTERISK-30097 #close

Change-Id: Id54166991aa79f04fb02699cc499bedda854253b
2022-06-16 10:51:21 -05:00
Naveen Albert a57e36edfc sig_analog: Fix broken three-way conferencing.
Three-way calling for analog lines is currently broken.
If party A is on a call with party B and initiates a
three-way call to party C, the behavior differs depending
on whether the call is conferenced prior to party C
answering. The post-answer case is correct. However,
if A flashes before C answers, then the next flash
disconnects B rather than C, which is incorrect.

This error occurs because the subs are not swapped
in the misbehaving case. This is because the flash
handler only swaps the subs if C has answered already,
which is wrong. To fix this, we swap the subs regardless
of whether C has answered or not when the call is
conferenced. This ensures that C is disconnected
on the next hook flash, rather than B as can happen
currently.

ASTERISK-30043 #close

Change-Id: I96c5bf6c9b7eb2636136b716c677c82c079b6f06
2022-06-15 12:21:23 -05:00
Kevin Harwell 5fe8583611 ARI version: increase non-breaking number
A recent change, ASTERISK_30027, now exposes a channel driver's unique
id to ARI channel resources so bump the ARI version.

Change-Id: Ic9da84b7b0eca6f3ff5b6a738b2be8362237951e
2022-06-15 11:37:24 -05:00
Naveen Albert 47a1d7b1a3 app_voicemail: Add option to prevent message deletion.
Adds an option to VoiceMailMain that prevents the user
from deleting messages during that application invocation.
This can be useful for public or shared mailboxes, where
some users should be able to listen to messages but not
delete them.

ASTERISK-30063 #close

Change-Id: Icdfb8423ae8d1fce65a056b603eb84a672e80a26
2022-06-09 19:40:38 -05:00
Naveen Albert 8935333364 res_parking: Add music on hold override option.
An m option to Park and ParkAndAnnounce now allows
specifying a music on hold class override.

ASTERISK-30087

Change-Id: I03de8d97b100e451b2611b5a621d48750f5d6a9e
2022-06-09 04:42:31 -05:00
Trevor Peirce 6dff26971f res_pjsip: Actually enable session timers when timers=always
When a pjsip endpoint is defined with timers=always, this has been a
functional noop.  This patch correctly sets the feature bitmap to both
enable support for session timers and to enable them even when the
endpoint itself does not request or support timers.

ASTERISK-29603
Reported-By: Ray Crumrine

Change-Id: I8b5eeaa9ec7f50cc6d96dd34c2b4aa9c53fb5440
2022-06-09 03:48:34 -05:00
Naveen Albert 4f3c774246 xmldocs: Improve examples.
Use example tags instead of regular para tags
where possible.

ASTERISK-30090

Change-Id: Iada8bbfda08f30b118cedf2d040bbb21e4966ec5
2022-06-09 03:47:47 -05:00
Naveen Albert c1611e7d1b res_pjsip_outbound_registration: Make max random delay configurable.
Currently, PJSIP will randomly wait up to 10 seconds for each
outbound registration's initial attempt. The reason for this
is to avoid having all outbound registrations attempt to register
simultaneously.

This can create limitations with the test suite where we need to
be able to receive inbound calls potentially within 10 seconds of
starting up. For instance, we might register to another server
and then try to receive a call through the registration, but if
the registration hasn't happened yet, this will fail, and hence
this inconsistent behavior can cause tests to fail. Ultimately,
this requires a smaller random value because there may be no good
reason to wait for up to 10 seconds in these circumstances.

To address this, a new config option is introduced which makes this
maximum delay configurable. This allows, for instance, this to be
set to a very small value in test systems to ensure that registrations
happen immediately without an unnecessary delay, and can be used more
generally to control how "tight" the initial outbound registrations
are.

ASTERISK-29965 #close

Change-Id: Iab989a8e94323e645f3a21cbb6082287c7b2f3fd
2022-06-09 03:45:47 -05:00
Alexei Gradinari 0350a05aea res_pjsip_pubsub: delete scheduled notification on RLS update
If there is scheduled notification, we must delete it
to avoid using destroyed subscriptions.

ASTERISK-29906

Change-Id: I1c644e5e15a8fe43eed8e4f9112f113cbf87a40f
2022-06-08 21:45:40 -05:00
Alexei Gradinari 6a73f7aca8 res_pjsip_pubsub: XML sanitized RLS display name
ASTERISK-29891

Change-Id: Ic8c9697e616446e06e6302653eae902aa23372ad
2022-06-08 20:39:33 -05:00
Christof Efkemann 58cf5d3912 app_sayunixtime: Use correct inflection for German time.
In function ast_say_date_with_format_de(), take special
care when the hour is one o'clock. In this case, the
German number "eins" must be inflected to its neutrum form,
"ein". This is achieved by playing "digits/1N" instead of
"digits/1". Fixes both 12- and 24-hour formats.

ASTERISK-30092

Change-Id: Ica9b80125c0b317e378d89c1ea786816e2635510
2022-06-08 19:50:25 -05:00
Naveen Albert 82cebaa023 chan_iax2: Prevent deadlock due to duplicate autoservice.
If a switch is invoked using chan_iax2, deadlock can result
because the PBX core is autoservicing the channel while chan_iax2
also then attempts to service it while waiting for the result
of the switch. This removes servicing of the channel to prevent
any conflicts.

ASTERISK-30064 #close

Change-Id: Ie92f206d32f9a36924af734ddde652b21106af22
2022-06-07 12:06:01 -05:00
Naveen Albert 3b7bcbb6d5 res_calendar: Prevent assertion if event ends in past.
res_calendar will trigger an assertion currently
if the ending time is calculated to be in the past.
Unlike the reminder and start times, however, there
is currently no check to catch non-positive times
and set them to 1. As a result, if we get a negative
value by happenstance, this can cause a crash.

To prevent the assertion from begin triggered, we now
use the same logic as the reminder and start events
to catch this issue before it can cause a problem.

ASTERISK-29981 #close

Change-Id: Idfb3204d195f350d2575fb4bc72a54a597d6e93c
2022-06-06 16:55:25 -05:00
Naveen Albert 8ec9e58eb4 res_parking: Warn if out of bounds parking spot requested.
Emits a warning if the user has requested a parking spot that
is out of bounds for the requested parking lot.

ASTERISK-30086

Change-Id: I1080371e4f63e94724455003753014fbd3f95fbf
2022-06-06 16:52:42 -05:00
Naveen Albert ea8d2ca17c loader: Prevent deadlock using tab completion.
If tab completion using ast_module_helper is attempted
during startup, deadlock will ensue because the CLI
will attempt to lock the module list while it is already
locked by the loader. This causes deadlock because when
the loader tries to acquire the CLI lock, they are blocked
on each other.

Waiting for startup to complete is not feasible because
the CLI lock is acquired while waiting, so deadlock will
ensure regardless of whether or not a lock on the module
list is attempted.

To prevent deadlock, we immediately abort if tab completion
is attempted on the module list before Asterisk is fully
booted.

ASTERISK-30039 #close

Change-Id: Idd468906c512bb196631e366a8f597a0e2e9271d
2022-06-02 12:20:18 -05:00
Maximilian Fridrich 9ae06885fc chan_pjsip: Only set default audio stream on hold.
When a PJSIP channel is set on hold or off hold, all streams were set
on/off hold. This is not the desired behaviour and caused issues
when there were multiple streams in the topology.

Now, only the default audio stream is set on/off hold when a hold is
indicated.

ASTERISK-30051

Change-Id: I04f1110565fd05fea565f5539b534b54549d4f71
2022-06-02 11:33:17 -05:00
Alexei Gradinari 3ec5eb5ae6 res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI
The change "Add LOCAL/REMOTE tags in dialog-info+xml" set both "local"
Identity Element URI and Target Element URI to the same value -
the channel Caller Number.
For Identity Element it's ok to set as Caller ID.
But Local Target URI should be set as local URI.

In this case the Local Target URI can be used for Directed Call Pickup
by Polycom ip-phones (parameter useLocalTargetUriforLegacyPickup).

Also XML sanitized Display names.

ASTERISK-24601

Change-Id: If130a2f2f3b2339b14dca0ec0ebeea3a87b34343
2022-06-01 19:26:48 -05:00
Shloime Rosenblum e8616a2701 res_agi: Evaluate dialplan functions and variables in agi exec if enabled
Agi commnad exec can now evaluate dialplan functions and
variables if variable AGIEXECFULL is set to yes. this can
be useful when executing Playback or Read from agi.

ASTERISK-30058 #close

Change-Id: I669991f540496e7bddd096fec82b52c083036832
2022-05-31 16:26:22 -05:00
Moritz Fain 4f2bd069a4 ari: expose channel driver's unique id to ARI channel resource
This change exposes the channel driver's unique id (i.e. the Call-ID
for chan_sip/chan_pjsip based channels) to ARI channel resources
as `protocol_id`.

ASTERISK-30027
Reported by: Moritz Fain
Tested by: Moritz Fain

Change-Id: I7cc6e7a9d29efe74bc27811d788dac20fe559b87
2022-05-22 15:40:43 -05:00
Sean Bright 95daff54ca loader.c: Use portable printf conversion specifier for int64.
ASTERISK-30060 #close

Change-Id: I88d47a1488be2f39017b8d562f993f081844fcb8
2022-05-19 20:43:10 -05:00
Sean Bright 9d951a9c1f ast_pkgconfig.m4: AST_PKG_CONFIG_CHECK() relies on sed.
Make sure that we have a working sed before trying to use it.

ASTERISK-30059 #close

Change-Id: I9abad67a5df11b665d480feec304ab9d6f55cc76
2022-05-19 20:40:44 -05:00
Joshua C. Colp f01ce810d0 res_pjsip_transport_websocket: Also set the remote name.
As part of PJSIP 2.11 a behavior change was done to require
a matching remote hostname on an established transport for
secure transports. Since the Websocket transport is considered
a secure transport this caused the existing connection to not
be found and used.

We now set the remote hostname and the transport can be found.

ASTERISK-30065

Change-Id: Ia1cdef33e1411f927985b4b852c95e163c080e94
2022-05-17 07:20:14 -05:00
Naveen Albert c720ccf46a res_pjsip_outbound_registration: Show time until expiration
Adjusts the pjsip show registration(s) commands to show
the amount of seconds remaining until a registration
expires.

ASTERISK-29845 #close

Change-Id: Ic4fea15a1a1056c424416def49d1ca8e776c0483
2022-05-13 09:54:16 -05:00
Thomas Guebels 73a01aed5e res_pjsip_transport_websocket: save the original contact host
This is needed to be able to restore it in REGISTER responses,
otherwise the client won't be able to find the contact it created.

ASTERISK-30042

Change-Id: I0c5823918199acf09246b3b206fbde66773688f6
2022-05-13 08:58:09 -05:00
Naveen Albert 58c40a911b app_confbridge: Add function to retrieve channels.
Adds the CONFBRIDGE_CHANNELS function which can be used
to retrieve a comma-separated list of channels, filtered
by a particular type of participant category. This output
can then be used with functions like UNSHIFT, SHIFT, POP,
etc.

ASTERISK-30036 #close

Change-Id: I1950aff932437476dc1abab6f47fb4ac90520b83
2022-05-11 07:25:52 -05:00
Naveen Albert 6722136531 chan_dahdi: Fix broken operator mode clearing.
Currently, the operator services mode in DAHDI is broken and unusable.
The actual operator recall functionality works properly; however,
when the operator hangs up (which is the only way that such a call
is allowed to end), both lines are permanently taken out of service
until "dahdi restart" is run. This prevents this feature from being
used.

Operator mode is one of the few factors that can cause the general
analog event handling in sig_analog not to be used. Several years
back, much of the analog handling was moved from chan_dahdi to
sig_analog. However, this was not done fully or consistently at
the time, and when operator mode is active, sig_analog does not
get used. Generally this is correct, but in the case of hangup
it should be using sig_analog regardless of the operator mode;
otherwise, the lines do not properly clear and they become unusable.

This bug is fixed so the operator can now hang up and properly
release the call. It is treated just like any other hangup. The
operator mode functionality continues to work as it did before.

ASTERISK-29993 #close

Change-Id: Ib2e3ddb40d9c71e8801e0b4bb0a12e2b52f51d24
2022-05-09 08:38:12 -05:00
George Joseph 01dc630b8c GCC12: Fixes for 16+
Most issues were in stringfields and had to do with comparing
a pointer to an constant/interned string with NULL.  Since the
string was a constant, a pointer to it could never be NULL so
the comparison was always "true".  gcc now complains about that.

There were also a few issues where determining if there was
enough space for a memcpy or s(n)printf which were fixed
by defining some of the involved variables as "volatile".

There were also a few other miscellaneous fixes.

ASTERISK-30044

Change-Id: Ia081ca1bcfb329df6487c4660aaf1944309eb570
2022-05-09 07:51:58 -05:00
Asterisk Development Team 1e3acba443 Update CHANGES and UPGRADE.txt for 16.26.0 2022-05-05 09:12:06 -05:00
Naveen Albert e5dc9e0979 chan_dahdi: Document dial resource options.
Documents the Dial syntax for DAHDI, namely the channel group,
distinctive ring, answer confirmation, and digital call options
that are specified in the resource itself.

ASTERISK-24827 #close

Change-Id: Ib95e78497fb00dc5cbfde1c93a69f034bfd08c30
2022-05-02 15:46:59 -05:00
Naveen Albert 3dc982bdcc chan_dahdi: Don't allow MWI FSK if channel not idle.
For lines that have mailboxes configured on them, with
FSK MWI, DAHDI will periodically try to dispatch FSK
to update MWI. However, this is never supposed to be
done when a channel is not idle.

There is currently an edge case where MWI FSK can
extraneously get spooled for the channel if a caller
hook flashes and hangs up, which triggers a recall ring.
After one ring, the on hook time threshold in this if
condition has been satisfied and an MWI update is spooled.
This means that when the phone is picked up again, the
answerer gets an FSK spill before being reconnected to
the party on hold.

To prevent this, we now explicitly check to ensure that
subchannel 0 has no owner. There is no owner when DAHDI
channels are idle, but if the channel is "in use" in some
way (such as in the aforementioned scenario), then there
is an owner, and we shouldn't process MWI at this time.

ASTERISK-28518 #close

Change-Id: Ia3904434fd81688d71742f7e84358b7e1c38e92a
2022-05-02 15:45:54 -05:00
Michael Cargile 7f3b4b07a4 apps/confbridge: Added hear_own_join_sound option to control who hears sound_join
Added the hear_own_join_sound option to the confbridge user profile to
control who hears the sound_join audio file. When set to 'yes' the user
entering the conference and the participants already in the conference
will hear the sound_join audio file. When set to 'no' the user entering
the conference will not hear the sound_join audio file, but the
participants already in the conference will hear the sound_join audio
file.

ASTERISK-29931
Added by Michael Cargile

Change-Id: I856bd66dc0dfa057323860a6418c1371d249abd2
2022-05-02 09:31:56 -05:00
Naveen Albert 4350eee04b chan_dahdi: Don't append cadences on dahdi restart.
Currently, if any custom ring cadences are specified, they are
appended to the array of cadences from wherever we left off
last time. This works properly the first time, but on subsequent
dahdi restarts, it means that the existing cadences are left
alone and (most likely) the same cadences are then re-added
afterwards. In short order, the cadence array gets maxed out
and the user begins seeing warnings that the array is full
and no more cadences may be added.

This buggy behavior persists until Asterisk is completely
restarted; however, if and when dahdi restart is run again,
then the same problem is reintroduced.

This fixes this behavior so that cadence parsing is more
idempotent, that is so running dahdi restart multiple times
starts adding cadences from the beginning, rather than from
wherever the last cadence was added.

As before, it is still not possible to revert to the default
cadences by simply removing all cadences in this manner, nor
is it possible to delete existing cadences. However, this
does make it possible to update existing cadences, which
was not possible before, and also ensures that the cadences
remain unchanged if the config remains unchanged.

ASTERISK-29990 #close

Change-Id: Ie32ea3e8a243b766756b1afce684d4a31ee7421d
2022-05-02 08:55:27 -05:00
Naveen Albert 59a8cdaca2 chan_iax2: Prevent crash if dialing RSA-only call without outkey.
Currently, if attempting to place a call to a peer that only allows
RSA authentication, if we fail to provide an outkey when placing
the call, Asterisk will crash.

This exposes the broader issue that IAX2 is prone to causing a crash
if encryption or decryption is attempted but we never initialized
the encryption and decryption keys. In other words, if the logic
to use encryption in chan_iax2 is not perfectly aligned with the
decision to build keys in the first place, then a crash is not
only possible but probable. This was demonstrated by ASTERISK_29264,
for instance.

This permanently prevents such events from causing a crash by explicitly
checking that keys are initialized properly before setting the flags
to use encryption for the call. Instead of crashing, the call will
now abort.

ASTERISK-30007 #close

Change-Id: If925c3d86099ceac7f621804f2532baac5050c9a
2022-05-02 08:54:39 -05:00
Naveen Albert 086c7728a7 menuselect: Don't erroneously recompile modules.
A bug in menuselect can cause modules that are disabled
by default to be recompiled every time a recompilation
occurs. This occurs for module categories that are NOT
positive output, as for these categories, the modules
contained in the makeopts file indicate modules which
should NOT be selected. The existing procedure of iterating
through these modules to mark modules as present is thus
insufficient. This has led to modules with a default_enabled
tag of "no" to get deleted and recompiled every time, even
when they haven't changed.

To fix this, we now modify the mark as present behavior
for module categories that are not positive output. For
these, we start by iterating through the module tree
and marking all modules as present, then go back and
mark anything contained in the makeopts file as not
present. This ensures that makeopt selections are actually
used properly, regardless of whether a module category
uses positive output or not.

ASTERISK-29728 #close

Change-Id: Idf2974c4ed8d0ba3738a92f08a6082b234277b95
2022-04-28 14:55:57 -05:00
Naveen Albert 0018f31353 app_meetme: Don't erroneously set global variables.
The admin_exec function in app_meetme is used by the SLA
applications for internal bridging. However, in these cases,
chan is NULL. Currently, this function will set some status
variables that are intended for a channel, but since channel
is NULL, this is erroneously creating meaningless global
variables, which shouldn't be happening. This sets these
variables only if chan is not NULL.

ASTERISK-30002 #close

Change-Id: I817df6c26f5bda131678e56791b0b61ba64fc6f7
2022-04-27 18:38:57 -05:00
Naveen Albert d75da1de1f func_db: Add function to return cardinality at prefix
Adds the DB_KEYCOUNT function, which can be used to retrieve
the number of keys at a given prefix in AstDB.

ASTERISK-29968 #close

Change-Id: Ib2393b77b7e962dbaae6192f8576bc3f6ba92d09
2022-04-27 11:41:25 -05:00
Naveen Albert d1c23c2cec chan_dahdi: Fix insufficient array size for round robin.
According to chan_dahdi.conf, up to 64 groups (numbered
0 through 63) can be used when dialing DAHDI channels.

However, currently dialing round robin with a group number
greater than 31 fails because the array for the round robin
structure is only size 32, instead of 64 as it should be.

This fixes that so the round robin array size is consistent
with the actual groups capacity.

ASTERISK-29994

Change-Id: I4caa08d7025f78ac75a0539f71aaf3eb3e85b3b7
2022-04-27 11:38:37 -05:00
Naveen Albert 467505d1da asterisk.c: Warn of incompatibilities with remote console.
Some command line options to Asterisk only apply when Asterisk
is started and cannot be used with remote console mode. If a
user tries to use any of these, they are currently simply
silently ignored.

This prints out a warning if incompatible options are used,
informing users that an option used cannot be used with remote
console mode. Additionally, some clarifications are added to
the help text and man page.

ASTERISK-22246
ASTERISK-26582

Change-Id: I980a5380ef2c19e8ea348596396d5382893c4337
2022-04-27 06:03:48 -05:00
Naveen Albert 4199afd360 func_evalexten: Extension evaluation function.
This adds the EVAL_EXTEN function, which may be used to retrieve
the variable-substituted data at any extension.

ASTERISK-29486

Change-Id: Iad81019689674c9f4ac77d235f5d7234adbb1432
2022-04-27 03:06:46 -05:00
Mark Petersen a107ee8616 chan_sip.c Session timers get removed on UPDATE
If Asterisk receives a SIP REFER with Session-Timers UAC
maintain Session-Timers when sending UPDATE"

ASTERISK-29843

Change-Id: I8e9a21c13bf757fa34d778f49ba3cf859b29ae5c
2022-04-27 03:02:57 -05:00
Naveen Albert 237defce8a file.c: Prevent formats from seeking negative offsets.
Currently, if a user uses an application like ControlPlayback
to try to rewind a file past the beginning, this can throw
warnings when the file format (e.g. PCM) tries to seek to
a negative offset.

Instead of letting file formats try (and fail) to seek a
negative offset, we instead now catch this in the rewind
function to ensure that we never seek an offset less than 0.
This prevents legitimate user actions from triggering warnings
from any particular file formats.

ASTERISK-29943 #close

Change-Id: Ia53f2623f57898f4b8e5c894b968b01e95426967
2022-04-26 18:42:05 -05:00
Naveen Albert f97386bd54 chan_pjsip: Add ability to send flash events.
PJSIP currently is capable of receiving flash events
and converting them to FLASH control frames, but it
currently lacks support for doing the reverse: taking
a FLASH control frame and converting it into a flash
event in the SIP domain.

This adds the ability for PJSIP to process flash control
frames by converting them into the appropriate SIP INFO
message, which can then be sent to the peer. This allows,
for example, flash events to be sent between Asterisk
systems using PJSIP.

ASTERISK-29941 #close

Change-Id: I1590221a4d238597f79672fa5825dd4a920c94dd
2022-04-26 18:30:04 -05:00
Naveen Albert 74e28c1270 cli: Add command to evaluate dialplan functions.
Adds the dialplan eval function commands to evaluate a dialplan
function from the CLI. The return value and function result are
printed out and can be used for testing or debugging.

ASTERISK-29820 #close

Change-Id: I833e97ea54c49336aca145330a2adeebfad05209
2022-04-26 17:43:44 -05:00
Naveen Albert 7e18d42479 documentation: Adds versioning information.
Adds version information for applications, functions,
and manager events/actions.

This is not completely exhaustive by any means but
covers most new things added that have release
versioning information in the issue tracker.

ASTERISK-29940 #close

Change-Id: I506401e93c799715dbbe97c0a8ba18af2bf5e131
2022-04-26 17:34:36 -05:00
Mark Petersen edaf12872b chan_sip: SIP route header is missing on UPDATE
if Asterisk need to send an UPDATE before answer
on a channel that uses Record-Route:
it will not include a Route header

ASTERISK-29955

Change-Id: Id1920ecbfea7739a038b14dc94487ecfe7b57eef
2022-04-26 16:46:31 -05:00
Mark Petersen bd5cc4c81e chan_pjsip: add allow_sending_180_after_183 option
added new global config option "allow_sending_180_after_183"
that if enabled will preserve 180 after a 183

ASTERISK-29842

Change-Id: I8a53f8c35595b6d16d8e86e241b5f110d92f3d18
2022-04-26 16:37:18 -05:00
Joshua C. Colp d33050f172 manager: Terminate session on write error.
On a write error to an AMI session a flag was set to
indicate that the write error had occurred, with the
expected result being that the session be terminated.
This was not actually happening and instead writing
would continue to be attempted.

This change adds a check for the write error and causes
the session to actually terminate.

ASTERISK-29948

Change-Id: Icaf5d413d4c0d5dc78292a17287fecc8720a31a5
2022-04-26 15:36:42 -05:00
Yury Kirsanov 069a996bd8 bridge_simple.c: Unhold channels on join simple bridge.
Patch provided inline by Yury Kirsanov on the linked issue and
approved by Josh Colp.

ASTERISK-29253 #close

Change-Id: I5b9ccc67ebf06e875ed061d9e7fc21f47b0a4e1f
2022-04-26 15:01:43 -05:00
Ben Ford 9ec47a5fa8 res_pjsip_stir_shaken.c: Fix enabled when not configured.
There was an issue with the conditional where STIR/SHAKEN would be
enabled even when not configured. It has been changed to ensure that if
a profile does not exist and stir_shaken is not set in pjsip.conf, then
the conditional will return from the function without performing
STIR/SHAKEN operations.

ASTERISK-30024

Change-Id: I41286a3d35b033ccbfbe4129427a62cb793a86e6
2022-04-26 11:10:49 -05:00
Joshua C. Colp 37981d25e3 res_pjsip: Always set async_operations to 1.
The async_operations setting on a transport configures how
many simultaneous incoming packets the transport can handle
when multiple threads are polling and waiting on the transport.
As we only use a single thread this was needlessly creating
incoming packets when set to a non-default value, wasting memory.

ASTERISK-30006

Change-Id: I1915973ef352862dc2852a6ba4cfce2ed536e68f
2022-04-26 11:10:29 -05:00
Maximilian Fridrich 163abe6934 core_unreal & app_dial: Flip stream direction of second channel.
When executing dial, the topology of the inbound channel is cloned and
used for the outbound channel. This creates issues when an incoming
stream is sendonly or recvonly as the stream state of the outbound
channel will be the same as the stream state of the inbound channel.

Now the stream state is flipped for the outgoing stream in
dial_exec_full if the incoming stream topology is recvonly or sendonly.

The same is the case for unreal (local) channels which create a second
(;2) channel as a counterpart which clones the topology of the
first channel. Now the stream state is flipped for the streams of
the 2nd channel in ast_unreal_new_channels if the incoming stream
topology is recvonly or sendonly.

ASTERISK-29655
Reported by: Michael Auracher

ASTERISK-29638
Reported by: Michael Auracher

Change-Id: I294dc834ac9a5f048b101b691669959e9df630e1
2022-04-26 10:45:29 -05:00
Joshua C. Colp 8edbc3b07b pjsip: Increase maximum number of format attributes.
Chrome has added more attributes, causing the limit to be
exceeded. This raises it up some more.

ASTERISK-30015

Change-Id: I964957c005c4e6f7871b15ea1ccd9b4659c7ef32
2022-04-25 18:31:29 -05:00
Sean Bright 7939a7eef7 config.h: Don't use C++ keywords as argument names.
ASTERISK-30021 #close

Change-Id: I70eb59b782a4946b979942e21422746b7563029c
2022-04-25 16:29:59 -05:00
Joshua C. Colp 3cbcc79a72 cdr_adaptive_odbc: Add support for SQL_DATETIME field type.
ASTERISK-30023

Change-Id: I0e1697f6af044e9eab7e07bbaeeffd1bb68ac34a
2022-04-20 09:40:47 -03:00
Ben Ford 10692ba968 AST-2022-002 - res_stir_shaken/curl: Add ACL checks for Identity header.
Adds a new configuration option, stir_shaken_profile, in pjsip.conf that
can be specified on a per endpoint basis. This option will reference a
stir_shaken_profile that can be configured in stir_shaken.conf. The type
of this option must be 'profile'. The stir_shaken option can be
specified on this object with the same values as before (attest, verify,
on), but it cannot be off since having the profile itself implies wanting
STIR/SHAKEN support. You can also specify an ACL from acl.conf (along
with permit and deny lines in the object itself) that will be used to
limit what interfaces Asterisk will attempt to retrieve information from
when reading the Identity header.

ASTERISK-29476

Change-Id: I87fa61f78a9ea0cd42530691a30da3c781842406
2022-04-14 16:58:57 -05:00
Joshua C. Colp a201ececba func_odbc: Add SQL_ESC_BACKSLASHES dialplan function.
Some databases depending on their configuration using backslashes
for escaping. When combined with the use of ' this can result in
a broken func_odbc query.

This change adds a SQL_ESC_BACKSLASHES dialplan function which can
be used to escape the backslashes.

This is done as a dialplan function instead of being always done
as some databases do not require this, and always doing it would
result in incorrect data being put into the database.

ASTERISK-29838

Change-Id: I152bf34899b96ddb09cca3e767254d8d78f0c83d
2022-04-14 16:57:38 -05:00
Asterisk Development Team fda5e507a3 Update CHANGES and UPGRADE.txt for 16.25.2 2022-04-14 15:39:14 -05:00
Ben Ford 256e160846 AST-2022-001 - res_stir_shaken/curl: Limit file size and check start.
Put checks in place to limit how much we will actually download, as well
as a check for the data we receive at the start to ensure it begins with
what we would expect a certificate to begin with.

ASTERISK-29872

Change-Id: Ifd3c6b8bd52b8b6192a04166ccce4fc8a8000b46
2022-04-14 12:20:45 -05:00
Naveen Albert 5a19d3dfe0 app_mf, app_sf: Return -1 if channel hangs up.
The ReceiveMF and ReceiveSF applications currently always
return 0, even if a channel has hung up. The call will still
end but generally applications are expected to return -1 if
the channel has hung up.

We now return -1 if a hangup occured to bring this behavior
in line with this norm. This has no functional impact, but
merely increases conformity with how these modules interact
with the PBX core.

ASTERISK-29951 #close

Change-Id: I234d755050ab8ed58f197c6925b968ba26b14033
2022-04-08 16:36:30 -05:00
Naveen Albert df9791676e app_queue: Add music on hold option to Queue.
Adds the m option to the Queue application, which allows a
music on hold class to be specified at runtime which will
override the class configured in queues.conf.

This option functions like the m option to Dial.

ASTERISK-29876 #close

Change-Id: Ie25a48569cf8755c305c9438b1ed292c3adcf8d7
2022-04-08 16:34:02 -05:00
Naveen Albert e409219097 app_meetme: Emit warning if conference not found.
Currently, if a user tries to access a non-dynamic
MeetMe conference and the conference is not found,
the call simply silent hangs up. There is no indication
to the user that anything went wrong at all.

This changes the relevant debug message to a warning
so that the user is notified of this invalidity.

ASTERISK-29954 #close

Change-Id: Iebcfae3755d00f2150d676ee211c57bc59530048
2022-04-01 06:04:24 -05:00
Joshua C. Colp 4510fcfe94 pjproject: Update bundled to 2.12 release.
This change removes patches which have been merged into
upstream and updates some existing ones. It also adds
some additional config_site.h changes to restore previous
behavior, as well as a patch to allow multiple Authorization
headers. There seems to be some confusion or disagreement
on language in RFC 8760 in regards to whether multiple
Authorization headers are supported. The RFC implies it
is allowed, as does some past sipcore discussion. There is
also the catch all of "local policy" to allow it. In
the case of Asterisk we allow it.

ASTERISK-29351

Change-Id: Id39ece02dedb7b9f739e0e37ea47d76854af7191
2022-03-30 16:10:54 -05:00
Kevin Harwell 324b525e71 res_pjsip_header_funcs: wrong pool used tdata headers
When adding headers to an outgoing request the headers were cloned using
the dialog's pool when they should have been cloned using tdata's pool.
Under certain circumstances it was possible for the dialog object, and
its pool, to be freed while tdata is still active and available. Thus the
cloned header "disappeared", and when tdata tried to later access it a
crash would occur.

This patch makes it so all added headers are cloned appropriately using
tdata's pool.

ASTERISK-29411 #close
ASTERISK-29535 #close

Change-Id: I9852025b5ee93ce1c038209150ee9dba1e0767c5
2022-03-30 15:13:00 -05:00
Naveen Albert 8442c83229 pbx.c: Warn if there are too many includes in a context.
The PBX core uses the stack when it comes to includes, which
means that a context can only contain strictly fewer than
AST_PBX_MAX_STACK includes. If this is exceeded, then warnings
will be emitted for each number of includes beyond this if
searching for an extension in the including context, and if
the extension's inclusion is beyond the stack size, it will
simply not be found.

To address this, we now check if there are too many includes
in a context when the dialplan is reloaded so that if there
is an issue, the user is aware of at "compile time" as opposed
to "run time" only. Secondly, more details are printed out
when this message is encountered so it's clear what has happened.

ASTERISK-26719

Change-Id: Ia3700452e75a7af3391b3e82ee69f06a669f8958
2022-03-29 16:02:08 -05:00
Naveen Albert 4abd75b1d4 app_mf: Add max digits option to ReceiveMF.
Adds an option to the ReceiveMF application to allow specifying a
maximum number of digits.

Originally, this capability was not added to ReceiveMF as it was
with ReceiveSF because typically a ST digit is used to denote that
sending of digits is complete. However, there are certain signaling
protocols which simply transmit a digit (such as Expanded In-Band
Signaling) and for these, it's necessary to be able to read a
certain number of digits, as opposed to until receiving a ST digit.

This capability is added as an option, as opposed to as a parameter,
to remain compatible with existing usage (and not shift the
parameters).

ASTERISK-29877 #close

Change-Id: I4229167c9aa69b87402c3c2a9065bd8dfa973a0b
(cherry picked from commit 0da713168d)
2022-03-29 14:14:15 -05:00
George Joseph 4a7e01b8ae Makefile: Disable XML doc validation
make_xml_documentation was being called with the --validate
flag set when it shouldn't have been.  This was causing
build failures if neither xmllint nor xmlstarlet were installed.
The correct behavior is to simply print a message that either
one of those tools should be installed for validation and
continue with the build.

ASTERISK-29988

Change-Id: Idc6c44114e7dd3fadae183a4e22f4fdba0b8a645
2022-03-29 12:42:21 -05:00
George Joseph 6de7ad5ba1 make_xml_documentation: Remove usage of get_sourceable_makeopts
get_sourceable_makeopts wasn't handling variables with embedded
double quotes in them very well.  One example was the DOWNLOAD
variable when curl was being used instead of wget.  Rather than
trying to fix get_sourceable_makeopts, it's just been removed.

ASTERISK-29986
Reported by: Stefan Ruijsenaars

Change-Id: Idf2a90902228c2558daa5be7a4f8327556099cd2
2022-03-29 12:33:18 -05:00
Naveen Albert a6f9499c71 chan_iax2: Fix spacing in netstats command
The iax2 show netstats command previously didn't contain
enough spacing in the header to properly align the table
header with the table body. This caused column headers
to not align with the values on longer channel names.

Some spacing is added to account for the longest channel
names that display (before truncation occurs) so that
columns are always properly aligned.

ASTERISK-29895 #close
patches:
  61205_misaligned2.patch submitted by Birger Harzenetter (license 5870)

Change-Id: I450ce6bb81157b9d6d149007e53b749f237b6d9f
2022-03-28 15:06:36 -05:00
Marcel Wagner e4ad8b223f documentation: Add information on running install_prereq script in readme
Adding information in the readme about running the install_preqreq script to install components that the ./configure script might indicate as missing.

ASTERISK-29976 #close

Change-Id: Ic287b46300168729838bddd8f9265e98fc22bce6
2022-03-28 11:33:35 -05:00
Sean Bright 4279a8f978 openssl: Supress deprecation warnings from OpenSSL 3.0
There is work going on to update our OpenSSL usage to avoid the
deprecated functions but in the meantime make it possible to compile
in devmode.

Change-Id: Ib082eb8b3751f0185d8aa8fe127da664c93f0726
2022-03-28 11:33:13 -05:00
Naveen Albert 2a77d0f069 res_agi: Fix xmldocs bug with set music.
The XML documentation for the SET MUSIC AGI
command is invalid, as the parameter does not
have a name and the on/off enum options for
the on/off argument are listed separately, which
is incorrect. The cumulative effect of these currently
is that the Asterisk Wiki documentation for SET MUSIC
is broken and external documentation generators crash
on SET MUSIC due to the malformed documentation.

These issues are corrected so that the documentation
can be successfully parsed as with other similar AGI
commands.

ASTERISK-29939 #close
ASTERISK-28891 #close

Change-Id: I8c3d59897531bcbc401cbc7b00c9e2829dcb35f8
(cherry picked from commit 37ece75677)
2022-03-25 18:27:29 -05:00
Naveen Albert 669f9da5ce chan_iax2: Fix perceived showing host address.
ASTERISK_22025 introduced a regression that shows
the host IP and port as the perceived IP and port
again, as opposed to showing the actual perceived
address. This fixes this by showing the correct
information.

ASTERISK-29048 #close

Change-Id: I0ad3e25bc6b449e83ce72ea5d1a1cdba72aa304a
2022-03-25 17:34:46 -05:00
Boris P. Korzun 5565d86fa6 res_pjsip_sdp_rtp: Improve detecting of lack of RTP activity
Change RTP timer behavior for detecting RTP only after two-way
SDP channel establishment. Ignore detecting after receiving 183
with SDP or while direct media is used.
Make rtp_timeout and rtp_timeout_hold options consistent to rtptimeout
and rtpholdtimeout options in chan_sip.

ASTERISK-26689 #close
ASTERISK-29929 #close

Change-Id: I07326d5b9c40f25db717fd6075f6f3a8d77279eb
2022-03-25 17:26:40 -05:00
Hugh McMaster bf9dafa7c2 configure.ac: Use pkg-config to detect libxml2
Use pkg-config to detect libxml2, falling back to xml2-config if the
former is not available.

This patch ensures Asterisk continues to build on systems without
xml2-config installed.

The patch also updates the associated 'configure' files.

ASTERISK-29970 #close

Change-Id: I3c90dfe0b0590486cbb8e6d426a7c5c4199410c0
2022-03-25 15:10:39 -05:00
Philip Prindeville 7f8803ba1c time: add support for time64 libcs
Treat time_t's as entirely unique and use the POSIX API's for
converting to/from strings.

Lastly, a 64-bit integer formats as 20 digits at most in base10.
Don't need to have any 100 byte buffers to hold that.

ASTERISK-29674 #close

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Change-Id: Id7b25bdca8f92e34229f6454f6c3e500f2cd6f56
2022-03-24 11:22:59 -05:00
Alexei Gradinari 7a4a83ab27 res_pjsip_pubsub: RLS 'uri' list attribute mismatch with SUBSCRIBE request
When asterisk generates the RLMI part of NOTIFY request,
the asterisk uses the local contact uri instead of the URI to which
the SUBSCRIBE request is sent.
Because of this mismatch some IP phones (for example Cisco 5XX) ignore
this list.

According
https://datatracker.ietf.org/doc/html/rfc4662#section-5.2
  The first mandatory <list> attribute is "uri", which contains the uri
  that corresponds to the list. Typically, this is the URI to which
  the SUBSCRIBE request was sent.
https://datatracker.ietf.org/doc/html/rfc4662#section-5.3
  The "uri" attribute identifies the resource to which the <resource>
  element corresponds. Typically, this will be a SIP URI that, if
  subscribed to, would return the state of the resource.

This patch makes asterisk to generate URI using SUBSCRIBE request URI.

ASTERISK-29961 #close

Change-Id: I1fcfc08fd589677f40608c59a4e143c45ee05f6c
2022-03-23 18:12:42 -05:00
Naveen Albert 8abe4784ac app_dial: Document DIALSTATUS return values.
Adds documentation for all of the possible return values
for the DIALSTATUS variable in the Dial application.

ASTERISK-25716

Change-Id: Id22593f1f1f7ea86e5734cee49516ec50848e8c0
2022-03-23 18:09:29 -05:00
Sean Bright 1ceb000264 download_externals: Use HTTPS for downloads
ASTERISK-29980 #close

Change-Id: I7b347665822ea2774dd322276c09be67914d2065
2022-03-23 18:05:46 -05:00
Sean Bright 2dce4f6579 conversions.c: Specify that we only want to parse decimal numbers.
Passing 0 as the last argument to strtoimax() or strtoumax() causes
octal and hexadecimal to be accepted which was not originally
intended. So we now force to only accept decimal.

ASTERISK-29950 #close

Change-Id: I93baf0f273441e8280354630a463df263a8c0edd
2022-03-23 17:08:03 -05:00
Philip Prindeville 309c8da206 logger: workaround woefully small BUFSIZ in MUSL
MUSL defines BUFSIZ as 1024 which is not reasonable for log messages.

More broadly, BUFSIZ is the amount of buffering stdio.h does, which
is arbitrary and largely orthogonal to what logging should accept
as the maximum message size.

ASTERISK-29928

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Change-Id: Iaa49fbbab029c64ae3d95e4b18270e0442cce170
2022-03-23 16:16:19 -05:00
Naveen Albert a9c4c8461a pbx_builtins: Add missing options documentation
BackGround and WaitExten both accept options that are not
currently documented. This adds documentation for these
options to the xml documentation for each application.

ASTERISK-29967 #close

Change-Id: If812a9f1ccbba3e4d427a0e7a6dea923c2f905f7
2022-03-23 15:17:41 -05:00
Sean Bright b6ae8ab493 stasis_recording: Perform a complete match on requested filename.
Using the length of a file found on the filesystem rather than the
file being requested could result in filenames whose names are
substrings of another to be erroneously matched.

We now ensure a complete comparison before returning a positive
result.

ASTERISK-29960 #close

Change-Id: Id3ffc77681b9b75b8569062f3d952a128a21c71a
2022-03-23 15:08:16 -05:00
Asterisk Development Team 8663dab865 Update CHANGES and UPGRADE.txt for 16.25.0 2022-03-17 10:18:48 -05:00
Ben Ford 705600d48e AMI: Bump version for 16.25.0.
Change-Id: I1fcec9b7698a7ce9f8e6ba3b780fb53cedd3c6d4
2022-03-17 09:15:17 -05:00
Alexei Gradinari 90eaf227c6 res_pjsip_pubsub: update RLS to reflect the changes to the lists
This patch makes the Resource List Subscriptions (RLS) dynamic.
The asterisk updates the current subscriptions to reflect the changes
to the list on the subscriptions refresh. If list items are added,
removed, updated or do not exist anymore, the asterisk regenerates
the resource list.

ASTERISK-29906 #close

Change-Id: Icee8c00459a7aaa43c643d77ce6f16fb7ab037d3
2022-03-15 11:13:22 -05:00
Boris P. Korzun e82627c001 res_config_pgsql: Add text-type column check in require_pgsql()
Omit "unsupported column type 'text'" warning in logs while
using text-type column in the PgSQL backend.

ASTERISK-29924 #close

Change-Id: I48061a7d469426859670db07f1ed8af1eb814712
2022-03-14 09:10:19 -05:00
Kfir Itzhak 3069e1c640 app_queue: Add QueueWithdrawCaller AMI action
This adds a new AMI action called QueueWithdrawCaller.
This AMI action makes it possible to withdraw a caller from a queue,
in a safe and a generic manner.
This can be useful for retrieving a specific call and
dispatching it to a specific extension.
It works by signaling the caller to exit the queue application
whenever it can. Therefore, it is not guaranteed
that the call will leave the queue.

ASTERISK-29909 #close

Change-Id: Ic15aa238e23b2884abdcaadff2fda7679e29b7ec
2022-03-11 08:47:13 -06:00
Kevin Harwell 0d4dfbf8e3 AST-2022-006: pjproject - unconstrained malformed multipart SIP message
ASTERISK-29945 #close

Change-Id: Ic58957afc453195d53c2bd25c905df3d91d1abe6
2022-03-04 12:47:55 -06:00
Kevin Harwell 7f76dce133 AST-2022-005: pjproject - undefined behavior after freeing a dialog set
ASTERISK-29945 #close

Change-Id: Ia8ce6d82b115c82c1138747c72a0adcaa42b718c
2022-03-04 12:35:29 -06:00
Kevin Harwell 08c92cb997 AST-2022-004: pjproject - possible integer underflow on STUN message
ASTERISK-29945 #close

Change-Id: I721cd254e4f8aa6d3a97a37529cca53519694c54
2022-03-04 12:32:29 -06:00
George Joseph 45fec4bb7c xml.c, config,c: Add stylesheets and variable list string parsing
Added functions to open, close, and apply XML Stylesheets
to XML documents.  Although the presence of libxslt was already
being checked by configure, it was only happening if xmldoc was
enabled.  Now it's checked regardless.

Added ability to parse a string consisting of comma separated
name/value pairs into an ast_variable list.  The reverse of
ast_variable_list_join().

Change-Id: I1e1d149be22165a1fb8e88e2903a36bba1a6cf2e
2022-03-03 09:44:55 -06:00
George Joseph f7158cc659 xmldoc: Fix issue with xmlstarlet validation
Added the missing xml-stylesheet and Xinclude namespace
declarations in pjsip_config.xml and pjsip_manager.xml.

Updated make_xml_documentation to show detailed errors when
xmlstarlet is the validator.  It's now run once with the '-q'
option to suppress harmless/expected messages and if it actually
fails, it's run again without '-q' but with '-e' to show
the actual errors.

Change-Id: I4bdc9d2ea6741e8d2e5eb82df60c68ccc59e1f5e
2022-03-01 09:58:44 -07:00
George Joseph 2fcd80ef38 Makefile: Allow XML documentation to exist outside source files
Moved the xmldoc build logic from the top-level Makefile into
its own script "make_xml_documentation" in the build_tools
directory.

Created a new utility script "get_sourceable_makeopts", also in
the build_tools directory, that dumps the top-level "makeopts"
file in a format that can be "sourced" from shell sscripts.
This allows scripts to easily get the values of common make
build variables such as the location of the GREP, SED, AWK, etc.
utilities as well as the AST* and library *_LIB and *_INCLUDE
variables.

Besides moving logic out of the Makefile, some optimizations
were done like removing "third-party" from the list of
subdirectories to be searched for documentation and changing some
assignments from "=" to ":=" so they're only evaluated once.
The speed increase is noticeable.

The makeopts.in file was updated to include the paths to
REALPATH and DIRNAME.  The ./conifgure script was setting them
but makeopts.in wasn't including them.

So...

With this change, you can now place documentation in any"c"
source file AND you can now place it in a separate XML file
altogether.  The following are examples of valid locations:

res/res_pjsip.c
    Using the existing /*** DOCUMENTATION ***/ fragment.

res/res_pjsip/pjsip_configuration.c
    Using the existing /*** DOCUMENTATION ***/ fragment.

res/res_pjsip/pjsip_doc.xml
    A fully-formed XML file.  The "configInfo", "manager",
    "managerEvent", etc. elements that would be in the "c"
    file DOCUMENTATION fragment should be wrapped in proper
    XML.  Example for "somemodule.xml":

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE docs SYSTEM "appdocsxml.dtd">
    <docs>
        <configInfo>
        ...
        </configInfo>
    </docs>

It's the "appdocsxml.dtd" that tells make_xml_documentation
that this is a documentation XML file and not some other XML file.
It also allows many XML-capable editors to do formatting and
validation.

Other than the ".xml" suffix, the name of the file is not
significant.

As a start... This change also moves the documentation that was
in res_pjsip.c to 2 new XML files in res/res_pjsip:
pjsip_config.xml and pjsip_manager.xml.  This cut the number of
lines in res_pjsip.c in half. :)

Change-Id: I486c16c0b5a44d7a8870008e10c941fb19b71ade
2022-02-28 08:47:00 -06:00
George Joseph 13177a310d build: Refactor the earlier "basebranch" commit
Recap from earlier commit:  If you have a development branch for a
major project that will receive gerrit reviews it'll probably be
named something like "development/16/newproject" or a work branch
based on that "development" branch.  That will necessitate
setting "defaultbranch=development/16/newproject" in .gitreview.
The make_version script uses that variable to construct the
asterisk version however, which results in versions
like "GIT-development/16/newproject-ee582a8c7b" which is probably
not what you want.  It also constructs the URLs for downloading
external modules with that version, which will fail.

Fast-forward:

The earlier attempt at adding a "basebranch" variable to
.gitreview didn't work out too well in practice because changes
were made to .gitreview, which is a checked-in file.  So, if
you wanted to rebase your work branch on the base branch, rebase
would attempt to overwrite your .gitreview with the one from
the base branch and complain about a conflict.

This is a slighltly different approach that adds three methods to
determine the mainline branch:

1.  --- MAINLINE_BRANCH from the environment

If MAINLINE_BRANCH is already set in the environment, that will
be used.  This is primarily for the Jenkins jobs.

2.  --- .develvars

Instead of storing the basebranch in .gitreview, it can now be
stored in a non-checked-in ".develvars" file and keyed by the
current branch.  So, if you were working on a branch named
"new-feature-work" based on "development/16/new-feature" and wanted
 to push to that branch in Gerrit but wanted to pull the external
 modules for 16, you'd create the following .develvars file:

[branch "new-feature-work"]
    mainline-branch = 16

The .gitreview file would still look like:

[gerrit]
defaultbranch=development/16/new-feature

...which would cause any reviews pushed from "new-feature-work" to
go to the "development/16/new-feature" branch in Gerrit.

The key is that the .develvars file is NEVER checked in (it's been
added to .gitignore).

3.  --- Well Known Development Branch

If you're actually working in a branch named like
"development/<mainline_branch>/some-feature", the mainline branch
will be parsed from it.

4.  --- .gitreview

If none of the earlier conditions exist, the .gitreview
"defaultbranch" variable will be used just as before.

Change-Id: I1cdeeaa0944bba3f2e01d7a2039559d0c266f8c9
2022-02-28 08:46:14 -06:00
George Joseph 83372e7ab5 core: Config and XML tweaks needed for geolocation
Added:

Replace a variable in a list:
int ast_variable_list_replace_variable(struct ast_variable **head,
    struct ast_variable *old, struct ast_variable *new);
Added test as well.

Create a "name=value" string from a variable list:
'name1="val1",name2="val2"', etc.
struct ast_str *ast_variable_list_join(
    const struct ast_variable *head, const char *item_separator,
    const char *name_value_separator, const char *quote_char,
    struct ast_str **str);
Added test as well.

Allow the name of an XML element to be changed.
void ast_xml_set_name(struct ast_xml_node *node, const char *name);

Change-Id: I330a5f63dc0c218e0d8dfc0745948d2812141ccb
2022-02-28 08:29:20 -06:00
Naveen Albert 466a361626 ami: Allow events to be globally disabled.
The disabledevents setting has been added to the general section
in manager.conf, which allows users to specify events that
should be globally disabled and not sent to any AMI listeners.

This allows for processing of these AMI events to end sooner and,
for frequent AMI events such as Newexten which users may not have
any need for, allows them to not be processed. Additionally, it also
cleans up core debug as previously when debug was 3 or higher,
the debug was constantly spammed by "Analyzing AMI event" messages
along with a complete dump of the event contents (often for Newexten).

ASTERISK-29853 #close

Change-Id: Id42b9a3722a1f460d745cad1ebc47c537fd4f205
2022-02-25 15:13:11 -06:00
Joshua C. Colp be09484831 jansson: Update bundled to 2.14 version.
ASTERISK-29353

Change-Id: I4ea43eda1691565563a4c03ef37166952d211b2b
2022-02-25 15:12:08 -06:00
Naveen Albert f60dcfc333 func_channel: Add lastcontext and lastexten.
Adds the lastcontext and lastexten channel fields to allow users
to access previous dialplan execution locations.

ASTERISK-29840 #close

Change-Id: Ib455fe300cc8e9a127686896ee2d0bd11e900307
2022-02-25 14:43:09 -06:00
Naveen Albert a1f207bcf7 channel.c: Clean up debug level 1.
Although there are 10 debugs levels, over time,
many current debug calls have come to use
inappropriately low debug levels. In particular,
a select few debug calls (currently all debug 1)
can result in thousands of debug messages per minute
for a single call.

This can adds a lot of noise to core debug
which dilutes the value in having different
debug levels in the first place, as these
log messages are from the core internals are
are better suited for higher debug levels.

Some debugs levels are thus adjusted so that
debug level 1 is not inappropriately overloaded
with these extremely high-volume and general
debug messages.

ASTERISK-29897 #close

Change-Id: I55a71598993552d3d64a401a35ee99474770d4b4
2022-02-25 14:41:53 -06:00
Naveen Albert c214e0d115 configs, LICENSE: remove pbx.digium.com.
pbx.digium.com no longer accepts IAX2 calls and
there are no plans for it to come back.

Accordingly, nonworking IAX2 URIs are removed from
both the LICENSE file and the sample config.

ASTERISK-29923 #close

Change-Id: I257c54d4d812ed6b4bd4cbec2cd7ebe2b87b5bad
2022-02-25 13:42:07 -06:00
Naveen Albert c4afe9e664 documentation: Add since tag to xmldocs DTD
Adds the since tag to the documentation DTD so
that individual applications, functions, etc.
can now specify when they were added to Asterisk.

This tag is added at the individual application,
function, etc. level as opposed to at the module
level because modules can expand over time as new
functionality is added, and granularity only
to the module level would generally not be useful.

This enables the ability to more easily determine
when new functionality was added to Asterisk, down
to minor version as opposed to just by major version.
This makes it easier for users to write more portable
dialplan if desired to not use functionality that may
not be widely available yet.

ASTERISK-29896 #close

Change-Id: Ibbb35c702d8038bdc3fd0a944fbfa69384cc15d5
2022-02-25 13:04:50 -06:00
Naveen Albert 6f128da80c asterisk: Add macro for curl user agent.
Currently, each module that uses libcurl duplicates the standard
Asterisk curl user agent.

This adds a global macro for the Asterisk user agent used for
curl requests to eliminate this duplication.

ASTERISK-29861 #close

Change-Id: I9fc37935980384b4daf96ae54fa3c9adb962ed2d
2022-02-24 12:44:30 +00:00
Naveen Albert 76e3fb402f app_voicemail: Emit warning if asking for nonexistent mailbox.
Currently, if VoiceMailMain is called with a mailbox, if that
mailbox doesn't exist, then the application silently falls back
to prompting the user for the mailbox, as if no arguments were
provided.

However, if a specific mailbox is requested and it doesn't exist,
then no warning at all is emitted.

This fixes this behavior to now warn if a specifically
requested mailbox could not be accessed, before falling back to
prompting the user for the correct mailbox.

ASTERISK-29920 #close

Change-Id: Ib4093b88cd661a2cabc5d685777d4e2f0ebd20a4
2022-02-23 16:40:56 -06:00
Alexei Gradinari 99e0bedf7b res_pjsip_pubsub: fix Batched Notifications stop working
If Subscription refresh occurred between when the batched notification
was scheduled and the serialized notification was to be sent,
then new schedule notification task would never be added.

There are 2 threads:

thread #1. ast_sip_subscription_notify is called,
if notification_batch_interval then call schedule_notification.
1.1. The schedule_notification checks notify_sched_id > -1
not true, then
send_scheduled_notify = 1
notify_sched_id =
  ast_sched_add(sched, sub_tree->notification_batch_interval, sched_cb....
1.2. The sched_cb pushes task serialized_send_notify to serializer
and returns 0 which means no reschedule.
1.3. The serialized_send_notify checks send_scheduled_notify if it's false
the just returns. BUT notify_sched_id is still set, so no more ast_sched_add.

thread #2. pubsub_on_rx_refresh is called
2.1 it pushes serialized_pubsub_on_refresh_timeout to serializer
2.2. The serialized_pubsub_on_refresh_timeout calls pubsub_on_refresh_timeout
which calls send_notify
2.3. The send_notify set send_scheduled_notify = 0;

The serialized_send_notify should always unset notify_sched_id.

ASTERISK-29904 #close

Change-Id: Ifc50c00b213c396509e10326a1ed89d8cf8c7875
2022-02-23 15:30:27 -06:00
Naveen Albert b471b40bc7 func_db: Add validity check for key names when writing.
Adds a simple sanity check for key names when users are
writing data to AstDB. This captures four cases indicating
malformed keynames that generally result in bad data going
into the DB that the user didn't intend: an empty key name,
a key name beginning or ending with a slash, and a key name
containing two slashes in a row. Generally, this is the
result of a variable being used in the key name being empty.

If a malformed key name is detected, a warning is emitted
to indicate the bug in the dialplan.

ASTERISK-29925 #close

Change-Id: Ifc08a9fe532a519b1b80caca1aafed7611d573bf
2022-02-23 15:28:40 -06:00
Naveen Albert 78b7ab11a4 res_stir_shaken: refactor utility function
Refactors temp file utility function into file.c.

ASTERISK-29809 #close

Change-Id: Ife478708c8f2b127239cb73c1755ef18c0bf431b
2022-02-23 14:32:00 -06:00
Alexei Gradinari dffc4408e7 res_pjsip_pubsub: provide a display name for RLS subscriptions
Whereas BLFs allow to show a display name for each RLS entry,
the asterisk provides only the extension now.
This is not end user friendly.

This commit adds a new resource_list option, resource_display_name,
to indicate whether display name of resource or the resource name being
provided for RLS entries.
If this option is enabled, the Display Name will be provided.
This option is disabled by default to remain the previous behavior.
If the 'event' set to 'presence' or 'dialog' the non-empty HINT name
will be set as the Display Name.
The 'message-summary' is not supported yet.

ASTERISK-29891 #close

Change-Id: Ic5306bd5a7c73d03f5477fe235e9b0f41c69c681
2022-02-23 14:26:36 -06:00
Naveen Albert f0c6b900de cli: Add core dump info to core show settings.
Adds two pieces of information to the core show settings command
which are useful in the context of getting backtraces.

The first is to display whether or not Asterisk would generate
a core dump if it were to crash.

The second is to show the current running directory of Asterisk.

ASTERISK-29866 #close

Change-Id: Ic42c0a9ecc233381aad274d86c62808d1ebb4d83
2022-02-23 13:34:39 -06:00
Naveen Albert 248f670470 documentation: Adds missing default attributes.
The configObject tag contains a default attribute which
allows the default value to be specified, if applicable.
This allows for the default value to show up specially on
the wiki in a way that is clear to users.

There are a couple places in the tree where default values
are included in the description as opposed to as attributes,
which means these can't be parsed specially for the wiki.
These are changed to use the attribute instead of being
included in the text description.

ASTERISK-29898 #close

Change-Id: I9d7ea08f50075f41459ea7b76654906b674ec755
2022-02-23 13:31:55 -06:00
Naveen Albert 312e8989dd app_mp3: Document and warn about HTTPS incompatibility.
mpg123 doesn't support HTTPS, but the MP3Player application
doesn't document this or warn the user about this. HTTPS
streams have become more common nowadays and users could
reasonably try to play them without being aware they should
use the HTTP stream instead.

This adds documentation to note this limitation. It also
throws a warning if users try to use the HTTPS stream to
tell them to use the HTTP stream instead.

ASTERISK-29900 #close

Change-Id: Ie3b029be5258c5a701f71ed3b1a7a80d1e03b827
2022-02-17 11:22:19 -06:00
Mike Bradeen e6cff954ab taskprocessor.c: Prevent crash on graceful shutdown
When tps_shutdown is called as part of the cleanup process there is a
chance that one of the taskprocessors that references the
tps_singletons object is still running.  The change is to allow for
tps_shutdown to check tps_singleton's container count and give the
running taskprocessors a chance to finish.  If after
AST_TASKPROCESSOR_SHUTDOWN_MAX_WAIT (10) seconds there are still
container references we shutdown anyway as this is most likely a bug
due to a taskprocessor not being unreferenced.

ASTERISK-29365

Change-Id: Ia932fc003d316389b9c4fd15ad6594458c9727f1
2022-02-15 17:48:45 -06:00
Alexei Gradinari aaf507fa36 app_queue: load queues and members from Realtime when needed
There are a lot of Queue AMI actions and Queue applications
which do not load queue and queue members from Realtime.

AMI actions
QueuePause - if queue not in memory - response "Interface not found".
QueueStatus/QueueSummary - if queue not in memory - empty response.

Applications:
PauseQueueMember - if queue not in memory
	Attempt to pause interface %s, not found
UnpauseQueueMember - if queue not in memory
	Attempt to unpause interface xxxxx, not found

This patch adds a new function load_realtime_queues
which loads queue and queue members for desired queue
or all queues and all members if param 'queuename' is NULL or empty.
Calls the function load_realtime_queues when needed.

Also this patch fixes leak of ast_config in function set_member_value.

Also this patch fixes incorrect LOG_WARNING when pausing/unpausing
already paused/unpaused member.
The function ast_update_realtime returns 0 when no record modified.
So 0 is not an error to warn about.

ASTERISK-29873 #close
ASTERISK-18416 #close
ASTERISK-27597 #close

Change-Id: I554ee0eebde93bd8f49df7f84b74acb21edcb99c
2022-02-11 12:21:11 -06:00
Sean Bright a2eb555230 manager.c: Simplify AMI ModuleCheck handling
This code was needlessly complex and would fail to properly delimit
the response message if LOW_MEMORY was defined.

Change-Id: Iae50bf09ef4bc34f9dc4b49435daa76f8b2c5b6e
2022-02-07 12:04:23 -05:00
Sean Bright 7857e7914d res_pjsip.c: Correct minor typos in 'realm' documentation.
Change-Id: I886936b808def5540d40071321e72f6bfa19063a
2022-02-03 16:48:49 -05:00
Sean Bright ba4d6aac20 manager.c: Generate valid XML if attribute names have leading digits.
The XML Manager Event Interface (amxml) now generates attribute names
that are compliant with the XML 1.1 specification. Previously, an
attribute name that started with a digit would be rendered as-is, even
though attribute names must not begin with a digit. We now prefix
attribute names that start with a digit with an underscore ('_') to
prevent XML validation failures.

This is not backwards compatible but my assumption is that compliant
XML parsers would already have been complaining about this.

ASTERISK-29886 #close

Change-Id: Icfaa56a131a082d803e9b7db5093806d455a0523
2022-02-03 07:55:31 -06:00
Asterisk Development Team df9ef1d8d3 Update CHANGES and UPGRADE.txt for 16.24.0 2022-02-03 07:09:02 -05:00
Sean Bright 74d8616cd2 build_tools/make_version: Fix bashism in comparison.
In POSIX sh (which we indicate in the shebang), there is no ==
operator.

Change-Id: Ic03d38214d14cdf329b0ba272279a815bb532965
2022-02-01 14:31:31 -06:00
George Joseph 2d0152236b bundled_pjproject: Add additional multipart search utils
Added the following APIs:
pjsip_multipart_find_part_by_header()
pjsip_multipart_find_part_by_header_str()
pjsip_multipart_find_part_by_cid_str()
pjsip_multipart_find_part_by_cid_uri()

Change-Id: I6aee3dcf59eb171f93aae0f0564ff907262ef40d
2022-02-01 10:28:38 -06:00
Mark Petersen e03b313fe9 chan_sip.c Fix pickup on channel that are in AST_STATE_DOWN
resolve issue with pickup on device that uses "183" and not "180"

ASTERISK-29832

Change-Id: I4c7d223870f8ce9a7354e0f73d4e4cb2e8b58841
2022-02-01 08:13:44 -06:00
George Joseph 8e592dc767 res_pjsip_outbound_authenticator_digest: Prevent ABRT on cleanup
In dev mode, if you call pjsip_auth_clt_deinit() with an auth_sess
that hasn't been initialized, it'll assert and abort.  If
digest_create_request_with_auth() fails to find the proper
auth object however, it jumps to its cleanup which does exactly
that.  So now we no longer attempt to call pjsip_auth_clt_deinit()
if we never actually initialized it.

ASTERISK-29888

Change-Id: Ib6171c25c9fe8e61cc8d11129e324c021bc30b62
2022-02-01 07:39:46 -06:00
George Joseph 48fb5c73b7 build: Add "basebranch" to .gitreview
If you have a development branch for a major project that
will receive gerrit reviews it'll probably be named something
like "development/16/newproject".  That will necessitate setting
"defaultbranch=development/16/newproject" in .gitreview.  The
make_version script uses that variable to construct the asterisk
version however, which results in versions like
"GIT-development/16/newproject-ee582a8c7b" which is probably not
what you want.  Worse, since the download_externals script uses
make_version to construct the URL to download the binary codecs
or DPMA.  Since it's expecting a simple numeric version, the
downloads will fail.

To get this to work, a new variable "basebranch" has been added
to .gitreview and make_version has been updated to use that instead
of defaultversion:

.gitreview:
defaultbranch=development/16/myproject
basebranch=16

Now git-review will send the reviews to the proper branch
(development/16/myproject) but the version will still be
constructed using the simple branch number (16).

If "basebranch" is missing from .gitreview, make_version will
fall back to using "defaultbranch".

Change-Id: I2941a3b21e668febeb6cfbc1a7bb51a67726fcc4
2022-02-01 07:30:07 -06:00
Naveen Albert c2db810735 cdr: allow disabling CDR by default on new channels
Adds a new option, defaultenabled, to the CDR core to
control whether or not CDR is enabled on a newly created
channel. This allows CDR to be disabled by default on
new channels and require the user to explicitly enable
CDR if desired. Existing behavior remains unchanged.

ASTERISK-29808 #close

Change-Id: Ibb78c11974bda229bbb7004b64761980e0b2c6d1
2022-01-31 09:37:24 -06:00
Naveen Albert 1af8acaf4a func_frame_drop: Fix typo referencing wrong buffer
In order to get around the issue of certain frames
having names that could overlap, func_frame_drop
surrounds names with commas for the purposes of
comparison.

The buffer is allocated and printed to properly,
but the original buffer is used for comparison.
In most cases, this wouldn't have had any effect,
but that was not the intention behind the buffer.
This updates the code to reference the modified
buffer instead.

ASTERISK-29854 #close

Change-Id: I430b52e14e712d0e62a23aa3b5644fe958b684a7
2022-01-31 08:54:44 -06:00
Naveen Albert 304503c02b res_tonedetect: Fixes some logic issues and typos
Fixes some minor logic issues with the module:

Previously, the OPT_END_FILTER flag was getting
tested before options were parsed, so it could
never evaluate to true (wrong ordering).

Additionally, the initially parsed timeout (float)
needs to be compared with 0, not the result int
which is set afterwards (wrong variable).

ASTERISK-29857 #close

Change-Id: I0062bce3b391c15e5df7a714780eeaa96dd93d4c
2022-01-31 08:41:16 -06:00
Torrey Searle ed95dc3282 res/res_rtp_asterisk: fix skip in rtp sequence numbers after dtmf
When generating dtmfs, asterisk can incorrectly think packet loss
occured during the dtmf generation, resulting in a jump in sequence
numbers when forwarding voice frames resumes.  This patch forces
asterisk to re-learn the expected sequence number after each DTMF
to avoid this

ASTERISK-29869 #close

Change-Id: Icc7de3d947b207b82c99d3c327af8095884df853
2022-01-31 07:58:20 -06:00
Sean Bright 3260847e4f build: Rebuild configure and autoconfig.h.in
autoconfigh.h.in was missed in the original review for this
issue. Additionally it looks like I have newer pkg-config autoconf
macros on my development machine.

ASTERISK-29817

Change-Id: I3c85a4de82c5d7d6e0e23dad4c33bb650a86a57b
2022-01-31 07:18:12 -06:00
Kevin Harwell a4ebfe8492 res_http_websocket: Add a client connection timeout
Previously there was no way to specify a connection timeout when
attempting to connect a websocket client to a server. This patch
makes it possible to now do such.

Change-Id: I5812f6f28d3d13adbc246517f87af177fa20ee9d
2022-01-31 07:04:21 -06:00
Mike Bradeen ee887b66bb sched: fix and test a double deref on delete of an executing call back
sched: Avoid a double deref when AST_SCHED_DEL_UNREF is called on an
executing call-back. This is done by adding a new variable 'rescheduled'
to the struct sched which is set in ast_sched_runq and checked in
ast_sched_del_nonrunning. ast_sched_del_nonrunning is a replacement for
now deprecated ast_sched_del which returns a new possible value -2
if called on an executing call-back with rescheduled set. ast_sched_del
is modified to call ast_sched_del_nonrunning to maintain existing code.
AST_SCHED_DEL_UNREF is also updated to look for the -2 in which case it
will not throw a warning or invoke refcall.
test_sched: Add a new unit test sched_test_freebird that will check the
reference count in the resolved scenario.

ASTERISK-29698

Change-Id: Icfb16b3acbc29cf5b4cef74183f7531caaefe21d
2022-01-28 13:35:29 -06:00
Luke Escude 14156f9827 res_pjsip_sdp_rtp.c: Support keepalive for video streams.
ASTERISK-28890 #close

Change-Id: Iad269a8dc36f892ede90fe8ceb3010560c0f70d1
2022-01-20 11:30:43 -06:00
Mark Petersen 8c230ebb87 app_queue.c: Queue don't play "thank-you" when here is no hold time announcements
if holdtime is (0 min, 0 sec) there is no hold time announcements
we should then also not playing queue-thankyou

ASTERISK-29831

Change-Id: Ic7e51dcde526b23f1cd8d24e1d1e2d81e10f9d2c
2022-01-20 11:25:31 -06:00
Michał Górny 9e36e57b93 main: Enable rdtsc support on NetBSD
Enable the Linux rdtsc implementation on NetBSD as well.  The assembly
works correctly there.

ASTERISK-29851

Change-Id: I460ad9b4d971913420ecb84186f5ba5ab03f6f37
2022-01-19 16:25:37 -06:00
Michał Górny 8789344c4e build_tools/make_version: Fix sed(1) syntax compatibility with NetBSD
Fix the sed(1) invocation used to process git-svn-id not to use "\s"
that is a GNU-ism and is not supported by NetBSD sed.  As a result,
this call did not work properly and make_version did output the full
git-svn-id line rather than the revision.

ASTERISK-29852

Change-Id: Ie4b406e2748920643446851a0a252a4ca7245772
2022-01-19 16:24:17 -06:00
Michał Górny 96156b7fa2 main/utils: Implement ast_get_tid() for NetBSD
Implement the ast_get_tid() function for NetBSD system.  NetBSD supports
getting the TID via _lwp_self().

ASTERISK-29850

Change-Id: If57fd3f9ea15ef5d010bfbdcbbbae9b379f72f8c
2022-01-19 11:39:27 -06:00
Michał Górny e65f7e50b8 BuildSystem: Fix misdetection of gethostbyname_r() on NetBSD
Fix the configure script not to detect the presence of gethostbyname_r()
on NetBSD incorrectly.  NetBSD includes it as an internal libc symbol
that is not exposed in system headers and that is incompatible with
other implementations.  In order to avoid misdetecting it, perform
the symbol check only if the declaration is found in the public header
first.

ASTERISK-29817

Change-Id: Iafa359b09908251bcd299ff54be003ea129b9eda
2022-01-19 10:35:35 -06:00
Michał Górny 01d85e0f82 include: Remove unimplemented HMAC declarations
Remove the HMAC declarations from the includes.  They are
not implemented nor used anywhere, and their presence breaks the build
on NetBSD that delivers an incompatible hmac() function in <stdlib.h>.

ASTERISK-29818

Change-Id: I0c4b88645e30174b1b63846a6b328625b69c2ea7
2022-01-19 09:47:19 -06:00
Naveen Albert 23a1512a75 frame.h: Fix spelling typo
Fixes CNG description from "noice" to "noise".

ASTERISK-29855 #close

Change-Id: Ie7cbbd7d72b426693df7447384ff8700318cd36d
2022-01-19 09:27:23 -06:00
George Joseph f17df8c569 bundled_pjproject: Fix srtp detection
Reverted recent change that set '--with-external-srtp' instead
of '--without-external-srtp'.  Since Asterisk handles all SRTP,
we don't need it enabled in pjproject at all.

ASTERISK-29867

Change-Id: I2ce1bdd30abd21c062eac8f8fefe9b898787b801
2022-01-19 08:48:37 -06:00
Naveen Albert 67a87c01ff res_rtp_asterisk: Fix typo in flag test/set
The code currently checks to see if an RFC3389
warning flag is set, except if it is, it merely
sets the flag again, the logic of which doesn't
make any sense.

This adjusts the if comparison to check if the
flag has NOT been set, and if so, emit a notice
log event and set the flag so that future frames
do not cause an event to be logged.

ASTERISK-29856 #close

Change-Id: Ib7098c947c63537d087a03b4646199fbb963f8e1
2022-01-17 15:31:21 -06:00
George Joseph 9e975d4c18 res_pjsip: Make message_filter and session multipart aware
Neither pjsip_message_filter's filter_on_tx_message() nor
res_pjsip_session's session_outgoing_nat_hook() were multipart
aware and just assumed that an SDP would be the only thing in
a message body.  Both were changed to use the new
pjsip_get_sdp_info() function which searches for an sdp in
both single- and multi- part message bodies.

ASTERISK-29813

Change-Id: I8f5b8cfdc27f1d4bd3e7491ea9090951a4525c56
2022-01-17 11:19:18 -06:00
George Joseph 5fdf6e4e18 build: Fix issues building pjproject
The change to allow easier hacking on bundled pjproject created
a few issues:

* The new Makefile was trying to run the bundled make even if
  PJPROJECT_BUNDLED=no.  third-party/Makefile now checks for
  PJPROJECT_BUNDLED and JANSSON_BUNDLED and skips them if they
  are "no".

* When building with bundled, config_site.h was being copied
  only if a full make or a "make main" was done.  A "make res"
  would fail all the pjsip modules because they couldn't find
  config_site.h.  The Makefile now copies config_site.h and
  asterisk_malloc_debug.h into the pjproject source tree
  when it's "configure" is performed.  This is how it used
  to be before the big change.

ASTERISK-29858

Change-Id: I9427264fa3cb8b3f59a95e5f9693eac236a6f76d
2022-01-17 08:46:53 -06:00
George Joseph 2f2af26e96 res_pjsip: Add utils for checking media types
Added two new functions to assist checking media types...

* ast_sip_are_media_types_equal compares two pjsip_media_types.
* ast_sip_is_media_type_in tests if one media type is in a list
  of others.

Added static definitions for commonly used media types to
res_pjsip.h.

Changed several modules to use the new functions and static
definitions.

ASTERISK_29813
(not ready to close)

Change-Id: Ief77675235bd3bf00a6b095d4673fd878d0801b9
2022-01-17 08:27:18 -06:00
Sean Bright 96c2a7932d say.c: Prevent erroneous failures with 'say' family of functions.
A regression was introduced in ASTERISK~29531 that caused 'say'
functions to fail with file lists that would previously have
succeeded. This caused affected channels to hang up where previously
they would have continued.

We now explicitly check for the empty string to restore the previous
behavior.

ASTERISK-29859 #close

Change-Id: Ia2e5769868e2792313c2d7c07996efe009c6f8d5
2022-01-17 07:25:34 -06:00
George Joseph 6dbed99435 bundled_pjproject: Create generic pjsip_hdr_find functions
pjsip_msg_find_hdr(), pjsip_msg_find_hdr_by_name(), and
pjsip_msg_find_hdr_by_names() require a pjsip_msg to be passed in
so if you need to search a header list that's not in a pjsip_msg,
you have to do it yourself.  This commit adds generic versions of
those 3 functions that take in the actual header list head instead
of a pjsip_msg so if you need to search a list of headers in
something like a pjsip_multipart_part, you can do so easily.

Change-Id: I6f2c127170eafda48e5e0d5d4d187bcd52b4df07
2022-01-17 06:41:11 -06:00
Naveen Albert 902c70530c documentation: Document built-in system and channel vars
Documentation for built-in special system and channel
vars is currently outdated, and updating is a manual
process since there is no XML documentation for these
anywhere.

This adds documentation for system vars to func_env
and for channel vars to func_channel so that they
appear along with the corresponding fields that would
be accessed using a function.

ASTERISK-29848 #close

Change-Id: I6997f925c4a45fffe71321861f5898a8b7182fa9
2022-01-12 08:21:31 -06:00
Naveen Albert 1859388341 pbx_variables: add missing ASTSBINDIR variable
Every config variable in the directories
section of asterisk.conf currently has a
counterpart built-in variable containing
the value of the config option, except
for the last one, astsbindir, which should
have an ASTSBINDIR variable.

However, the actual corresponding ASTSBINDIR
variable is missing in pbx_variables.c.

This adds the missing variable so that all
the config options have their corresponding
variable.

ASTERISK-29847 #close

Change-Id: I36006faf471825b36ebc8aa5e87a3bcb38d446fc
2022-01-11 09:29:45 -06:00
George Joseph d014cedf5d bundled_pjproject: Make it easier to hack
There are times when you need to troubleshoot issues with bundled
pjproject or add new features that need to be pushed upstream
but...

* The source directory created by extracting the pjproject tarball
  is not scanned for code changes so you have to keep forcing
  rebuilds.
* The source directory isn't a git repo so you can't easily create
  patches, do git bisects, etc.
* Accidentally doing a make distclean will ruin your day by wiping
  out the source directory, and your changes.
* etc.

This commit makes that easier.
See third-party/pjproject/README-hacking.md for the details.

ASTERISK-29824

Change-Id: Idb1251040affdab31d27cd272dda68676da9b268
2022-01-07 09:57:43 -06:00
Sean Bright 6060b9ccb0 utils.c: Remove all usages of ast_gethostbyname()
gethostbyname() and gethostbyname_r() are deprecated in favor of
getaddrinfo() which we use in the ast_sockaddr family of functions.

ASTERISK-29819 #close

Change-Id: Ie277c0ef768d753b169c121ef570a71665692ab7
2022-01-06 14:04:01 -06:00
Naveen Albert 75b9b93ca3 say.conf: fix 12pm noon logic
Fixes 12pm noon incorrectly returning 0/a.m.
Also fixes a misspelling typo in the config.

ASTERISK-29695 #close

Change-Id: Ie40f9618636eb4c483b449bd707a5dcffca5c406
2022-01-06 05:49:54 -06:00
Sean Bright 85881d84dc pjproject: Fix incorrect unescaping of tokens during parsing
ASTERISK-29664 #close

Change-Id: I29dcde52e9faeaf2609c604eada61c6a9e49d8f5
2022-01-05 13:14:51 -06:00
Mark Petersen ac9607d03b app_queue.c: Support for Nordic syntax in announcements
adding support for playing the correct en/et for nordic languages
by adding 'n' for neuter gender in the relevant ast_say_number

ASTERISK-29827

Change-Id: I03ebc827d2f0dc95132ab2f42799893c70edc5b1
2022-01-05 12:35:42 -06:00
Naveen Albert 57d5964d77 dsp: Add define macro for DTMF_MATRIX_SIZE
Adds the macro DTMF_MATRIX_SIZE to replace
the magic number 4 sprinkled throughout
dsp.c.

ASTERISK-29815 #close

Change-Id: Ie3bddb92c6b16204ece0f758009e9490eb33b9ba
2022-01-05 12:23:26 -06:00
Naveen Albert 06eff7d5d0 ami: Add AMI event for Wink
Adds an AMI event for a wink frame.

ASTERISK-29830 #close

Change-Id: I83e426de5e37baed79a4dbcc91e9e8d030ef1b56
2022-01-05 11:44:53 -06:00
Naveen Albert ef00ff4e1e cli: Add module refresh command
Adds a command to the CLI to unload and then
load a module. This makes it easier to perform
these operations which are often done
subsequently to load a new version of a module.

"module reload" already refers to reloading of
configuration, so the name "refresh" is chosen
instead.

ASTERISK-29807 #close

Change-Id: I595f6f11774a0de2565a1fba38da22309ce93a2c
2022-01-05 11:22:11 -06:00
Naveen Albert dc5d70f29b app_mp3: Throw warning on nonexistent stream
Currently, the MP3Player application doesn't
emit a warning if attempting to play a stream
which no longer exists. This can be a common
scenario as many mp3 streams are valid at some
point but can disappear at any time.

Now a warning is thrown if attempting to play
a nonexistent MP3 stream, instead of silently
exiting.

ASTERISK-29829 #close

Change-Id: I53a0bf1ed1740166655eb66fe7675f6f808bf535
2022-01-05 10:55:42 -06:00
Naveen Albert 6eeb7ab7d0 documentation: Add missing AMI documentation
Adds missing documentation for some channel,
bridge, and queue events.

ASTERISK-24427
ASTERISK-29515

Change-Id: I92b06b88c8cadc0155f95ebe3e870b3e795a8c64
2022-01-05 10:54:58 -06:00
Kevin Harwell a3fcda5a05 tcptls.c: refactor client connection to be more robust
The current TCP client connect code, blocks and does not handle EINTR
error case.

This patch makes the client socket non-blocking while connecting,
ensures a connect does not immediately fail due to EINTR "errors",
and adds a connect timeout option.

The original client start call sets the new timeout option to
"infinite", thus making sure old, orginal behavior is retained.

ASTERISK-29746 #close

Change-Id: I907571843a83e43c0742b95a64785f4411f02671
2022-01-05 09:41:23 -06:00
Naveen Albert 2ed004846a app_sf: Add full tech-agnostic SF support
Adds tech-agnostic support for SF signaling
by adding SF sender and receiver applications
as well as Dial integration.

ASTERISK-29802 #close

Change-Id: I7ec50752e9a661af639425e5d1e339f17411bcad
2022-01-05 09:01:08 -06:00
Steve Davies 076d502694 app_queue: Fix hint updates, allow dup. hints
A previous patch for ASTERISK_29578 caused a 'leak' of
extension state information across queues, causing the
state of the first member of unrelated queues to be
updated in addition to the correct member. Which queues
and members depended on the order of queues in the
iterator.

Additionally, it is possible to use the same 'hint:' on
multiple queue members, so the update cannot break out
of the update loop early when a match is found.

ASTERISK-29806 #close

Change-Id: If2c1d1cc2a752afd9286d79710fc818596e7a7ad
2022-01-05 08:07:57 -06:00
Sean Bright 3f398c319f say.c: Honor requests for DTMF interruption.
SayAlpha, SayAlphaCase, SayDigits, SayMoney, SayNumber, SayOrdinal,
and SayPhonetic all claim to allow DTMF interruption if the
SAY_DTMF_INTERRUPT channel variable is set to a truthy value, but we
are failing to break out of a given 'say' application if DTMF actually
occurs.

ASTERISK-29816 #close

Change-Id: I6a96e0130560831d2cb45164919862b9bcb6287e
2022-01-05 07:56:32 -06:00
Joshua C. Colp a363153fa8 bridge: Unlock channel during Local peer check.
It's not safe to keep the channel locked while locking
the peer Local channel, as it can result in a deadlock.

This change unlocks it during this time but keeps the
bridge locked to ensure nothing changes about the bridge.

ASTERISK-29821

Change-Id: Ib68eb7037e5a479bcc2aceee77337cdde1fbdde6
2022-01-05 07:09:08 -06:00
Josh Soref d8d4ac87a5 test_time.c: Tolerate DST transitions
When test_timezone_watch runs very near a DST transition,
two time zones that would otherwise be expected to report the same
time can differ because of the DST transition.

Instead of having the test fail when this happens, report the
times, time zones, and dst flags.

ASTERISK-29722

Change-Id: Id59bdac8b277e14343ccdf0c99b89e92f79f316a
2022-01-04 05:55:44 -06:00
George Joseph f2cfce147b bundled_pjproject: Add more support for multipart bodies
Adding upstream patch for pull request...
https://github.com/pjsip/pjproject/pull/2920
---------------------------------------------------------------

sip_inv:  Additional multipart support (#2919)

sip_inv.c:inv_check_sdp_in_incoming_msg() deals with multipart
message bodies in rdata correctly. In the case where early media is
involved though, the existing sdp has to be retrieved from the last
tdata sent in this transaction. This, however, always assumes that
the sdp sent is in a non-multipart body. While there's a function
to retrieve the sdp from multipart and non-multpart rdata bodies,
no similar function for tdata exists.  So...

* The existing pjsip_rdata_get_sdp_info2 was refactored to
  find the sdp in any body, multipart or non-multipart, and
  from either an rdata or tdata.  The new function is
  pjsip_get_sdp_info.  This new function detects whether the
  pjsip_msg->body->data is the text representation of the sdp
  from an rdata or an existing pjmedia_sdp_session object
  from a tdata, or whether pjsip_msg->body is a multipart
  body containing either of the two sdp formats.

* The exsting pjsip_rdata_get_sdp_info and pjsip_rdata_get_sdp_info2
  functions are now wrappers that get the body and Content-Type
  header from the rdata and call pjsip_get_sdp_info.

* Two new wrappers named pjsip_tdata_get_sdp_info and
  pjsip_tdata_get_sdp_info2 have been created that get the body
  from the tdata and call pjsip_get_sdp_info.

* inv_offer_answer_test.c was updated to test multipart scenarios.

ASTERISK-29804

Change-Id: I483c7c3d413280c9e247a96ad581278347f9c71b
2021-12-22 06:27:19 -07:00
Frederic Van Espen 144e4772e4 ast_coredumper: Fix deleting results when output dir is set
When OUTPUTDIR is set to another directory and the
--delete-results-after is set, the resulting txt files are
not deleted.

ASTERISK-29794 #close

Change-Id: I1c0071f6809a1e3f5cfc455d6eb08378bc0d7286
2021-12-15 12:38:52 -06:00
Naveen Albert ffb98d764c pbx_variables: initialize uninitialized variable
The variable cp4 in a variable substitution function
can potentially be used without being initialized
currently. This causes Asterisk to no longer compile.

This initializes cp4 to NULL to make the compiler
happy.

ASTERISK-29803 #close

Change-Id: I392579cbb76db2795d5820c9427cf55fbcee9e72
2021-12-15 10:49:49 -06:00
Mark Petersen 0dbf313a76 app_queue.c: added DIALEDPEERNUMBER on outgoing channel
added that we set DIALEDPEERNUMBER on the outgoing channels
so it is avalible in b(content^extension^line)
this add the same behaviour as Dial

ASTERISK-29795

Change-Id: Icbc589ea2066f0c401a892bf478f6b2fd44e62f6
2021-12-15 10:17:46 -06:00
Kevin Harwell b37fd02201 http.c: Add ability to create multiple HTTP servers
Previously, it was only possible to have one HTTP server in Asterisk.
With this patch it is now possible to have multiple HTTP servers
listening on different addresses.

Note, this behavior has only been made available through an API call
from within the TEST_FRAMEWORK. Specifically, this feature has been
added in order to allow unit test to create/start and stop servers,
if one has not been enabled through configuration.

Change-Id: Ic5fb5f11e62c019a1c51310f4667b32a4dae52f5
2021-12-15 09:59:03 -06:00
Naveen Albert 1e7bcc27df app.c: Throw warnings for nonexistent options
Currently, Asterisk doesn't throw warnings if options
are passed into applications that don't accept them.
This can confuse users if they're unaware that they
are doing something wrong.

This adds an additional check to parse_options so that
a warning is thrown anytime an option is parsed that
doesn't exist in the parsing application, so that users
are notified of the invalid usage.

ASTERISK-29801 #close

Change-Id: Id029274a57135caca193c913307a63fd75e24679
2021-12-14 18:09:00 -06:00
Mark Petersen ff0b048543 app_voicemail.c: Support for Danish syntax in VM
added support for playing the correct plural sound file
dependen on where you have 1 or multipe messages
based on the existing SE/NO code

ASTERISK-29797

Change-Id: I88aa814d02f3772bb80b474204b1ffb26fe438c2
2021-12-14 18:02:58 -06:00
Naveen Albert 3c08ce4f72 configs: Updates to sample configs
Includes some minor updates to extensions.conf
and iax.conf. In particular, the demonstration
of macros in extensions.conf is removed, as
Macro is deprecated and will be removed soon.
These examples have been replaced with examples
demonstrating the usage of Gosub instead.

The older exten => ...,n syntax is also mostly
replaced with the same keyword to demonstrate the
newer, more concise way of defining extensions.

IAXTEL no longer exists, so this example is replaced
with something more generic.

Some documentation is also added to extensions.conf
and iax.conf to clarify some of the new expanded
encryption capabilities with IAX2.

ASTERISK-29758 #close

Change-Id: I04fba9671aa1ee9ba1bd5027061f80bbe38e7b46
2021-12-13 15:12:16 -06:00
Naveen Albert 216a18b291 strings: Fix enum names in comment examples
The enum values for ast_strsep_flags includes
AST_STRSEP_STRIP. However, some comments reference
AST_SEP_STRIP, which doesn't exist. This fixes
these comments to use the correct value.

ASTERISK-29800 #close

Change-Id: If7bbd0c0e6226a211d25ddf9d1629347e2674943
2021-12-13 14:22:06 -06:00
Naveen Albert 85dc5214e3 app_sendtext: Add ReceiveText application
Adds a ReceiveText application that can be used in
conjunction with SendText. Currently, there is no
way in Asterisk to receive text in the dialplan
(or anywhere else, really). This allows for Asterisk
to be the recipient of text instead of just the sender.

ASTERISK-29759 #close

Change-Id: Ica2c354a42bff69f323a0493d3a7cd0fb129d52d
2021-12-13 14:14:40 -06:00
Naveen Albert 3629b7f825 pbx_variables: Increase parsing capabilities of MSet
Currently MSet can only parse a maximum of 24 variables.
If more variables are provided to MSet, the 24th variable
will simply contain the remainder of the string and the
remaining variables thereafter will never get set.

This increases the number of variables that can be parsed
in one go from 24 to 99. Additionally, documentation is added
since this limitation is currently undocumented and is
confusing to users who encounter this limitation.

ASTERISK-29766 #close

Change-Id: I3fe35b462dedec0a452fd9ea7f92c920a3939f16
2021-12-13 13:46:08 -06:00
Naveen Albert 1ac89e0875 chan_sip: Fix crash when accessing RURI before initiating outgoing call
Attempting to access ${CHANNEL(ruri)} in a pre-dial handler before
initiating an outgoing call will cause Asterisk to crash. This is
because a null field is accessed, resulting in an offset from null and
subsequent memory access violation.

Since RURI is not guaranteed to exist, we now check if the base
pointer is non-null before calculating an offset.

ASTERISK-29772

Change-Id: Icd3b02f07256bbe6615854af5717074087b95a83
2021-12-13 13:11:09 -06:00
Naveen Albert 0eaa214be9 func_json: Adds JSON_DECODE function
Adds the JSON_DECODE function for parsing JSON in the
dialplan. JSON parsing already exists in the Asterisk
core and is used for many different things. This
function exposes the basic parsing capability to
the user in the dialplan, for instance, in conjunction
with CURL for using API responses.

ASTERISK-29706 #close

Change-Id: Iea60c49a7358dfdc2db60803cdc9a742f808ba2c
2021-12-13 12:34:04 -06:00
Sean Bright 33f0500359 CHANGES: Correct reference to configuration file.
Change-Id: I22a788ebf11168fff7fbf9ea956ebcd705ab63dd
2021-12-13 11:23:19 -06:00
Naveen Albert bf28c2901d pbx: Add variable substitution API for extensions
Currently, variable substitution involving dialplan
extensions is quite clunky since it entails obtaining
the current dialplan location, backing it up, storing
the desired variables for substitution on the channel,
performing substitution, then restoring the original
location.

In addition to being clunky, things could also go wrong
if an async goto were to occur and change the dialplan
location during a substitution.

Fundamentally, there's no reason it needs to be done this
way, so new API is added to allow for directly passing in
the dialplan location for the purposes of variable
substitution so we don't need to mess with the channel
information anymore. Existing API is not changed.

ASTERISK-29745 #close

Change-Id: I23273bf27fa0efb64a606eebf9aa8e2f41a065e4
2021-12-13 11:18:04 -06:00
Naveen Albert 9eba9f44d6 app_mf: Add full tech-agnostic MF support
Adds tech-agnostic support for MF signaling by adding
MF sender and receiver applications as well as Dial
integration.

ASTERISK-29496-mf #do-not-close

Change-Id: I61962b359b8ec4cfd05df877ddf9f5b8f71927a4
2021-12-13 10:05:19 -06:00
Alexander Traud a7688c0216 xmldoc: Avoid whitespace around value for parameter/required.
Otherwise, the value 'false' was not found in the enumerated set of
the XML DTD for the XML attribute 'required' in the XML element
'parameter'. Therefore, DTD validation of the runtime XML failed.

ASTERISK-29790

Change-Id: Id13f230ad65a70dd8c2e3ae9ac85d1e841aed03e
2021-12-13 09:11:38 -06:00
Alexander Traud ca64087486 progdocs: Fix Doxygen left-overs.
Change-Id: I5b5cf9c9cbbe00ba8b379a8d162ac67445d39016
2021-12-13 08:52:33 -06:00
Alexander Traud 090c56d80c xmldoc: Correct definition for XML element 'matchInfo'.
ASTERISK-29791

Change-Id: I7c656498427fcadd0a5d61a54ff67e6036609725
2021-12-13 07:59:14 -06:00
Alexander Traud b49ae92fe7 progdocs: Update Makefile.
In developer mode, use internal documentation as well.
This should produce no warnings. Fix yours!

In noisy mode, output all possible warnings of Doxygen.
This creates zillion of warnings. Double-check your current module!

Any warnings are in the file './doxygen.log'. Beside that, this change
avoids deprecated parameters because the configuration file for Doxygen
contains only those parameters which differ from the default. This
avoids the need to update the file on each run. Furthermore, it adds
AST_VECTOR to be expanded. Finally, the default name for that file is
Doxyfile. Therefore, let us use that!

ASTERISK-26991
ASTERISK-20259

Change-Id: I4129092a199d5e24c319a09cd088614b121015af
2021-12-08 11:26:16 -05:00
Alexander Traud 65387cd442 res_pjsip_sdp_rtp: Do not warn on unknown sRTP crypto suites.
res_sdp_crypto_parse_offer(.) emits many log messages already.

ASTERISK-29785

Change-Id: I1a191ebe4fec1102946d4e31887e5197ca02dfe8
2021-12-07 07:16:32 -06:00
Sean Bright 00c3d60881 channel: Short-circuit ast_channel_get_by_name() on empty arg.
We know that passing a NULL or empty argument to
ast_channel_get_by_name() will never result in a matching channel and
will always result in an error being emitted, so just short-circuit
out in that case.

ASTERISK-28219 #close

Change-Id: I88eadc748e9c6996fc17467b0a05881bbfd00bce
2021-12-06 10:14:32 -06:00
Mike Bradeen a64129943b res_rtp_asterisk: Addressing possible rtp range issues
res/res_rtp_asterisk.c: Adding 1 to rtpstart if it is deteremined
that rtpstart was configured to be an odd value. Also adding a loop
counter to prevent a possible infinite loop when looking for a free
port.

ASTERISK-27406

Change-Id: I90f07deef0716da4a30206e9f849458b2dbe346b
2021-12-06 10:01:33 -06:00
Mark Petersen caa12fecb1 apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING
changed that when we recive a CANCEL that we set HANGUPCAUSE to AST_CAUSE_NORMAL_CLEARING

ASTERISK-28053
Reported by: roadkill

Change-Id: Ib653aec2282f55b59d87484391cc07c8e6612b89
2021-12-06 09:22:21 -06:00
Alexander Traud 14736ae6d4 res: Fix for Doxygen.
These are the remaining issues found in /res.

ASTERISK-29761

Change-Id: I572e6019c422780dde5ce8448b6c85c77af6046d
2021-12-03 10:43:22 -06:00
Dustin Marquess 3162f6dfdd res_fax_spandsp: Add spandsp 3.0.0+ compatibility
Newer versions of spandsp did refactoring of code to add new features
like color FAXing. This refactoring broke backwards compatibility.
Add support for the new version while retaining support for 0.0.6.

ASTERISK-29729 #close

Change-Id: I3bd74550604ebcf0304528d647fa39abc62fbaa1
2021-12-03 07:46:16 -06:00
Alexander Traud 37c29b6a28 main: Fix for Doxygen.
ASTERISK-29763

Change-Id: Ib8359e3590a9109eb04a5376559d040e5e21867e
2021-12-02 15:00:33 -06:00
Asterisk Development Team 191b92a69e Update CHANGES and UPGRADE.txt for 16.23.0 2021-12-02 12:55:56 -05:00
Alexander Traud 3489f926e7 progdocs: Fix for Doxygen, the hidden parts.
ASTERISK-29779

Change-Id: If338163488498f65fa7248b60e80299c0a928e4b
2021-12-02 10:37:51 -06:00
Alexander Traud 0398daf4cb progdocs: Fix grouping for latest Doxygen.
Since Doxygen 1.8.16, a special comment block is required. Otherwise
(pure C comment), the group command is ignored. Additionally, several
unbalanced group commands were fixed.

ASTERISK-29732

Change-Id: I780ed8e0e8acdbdd8f8b75fb7baf5ef657af7a3f
2021-12-02 10:25:37 -06:00
Naveen Albert 6296f645a2 documentation: Standardize examples
Most examples in the XML documentation use the
example tag to demonstrate examples, which gets
parsed specially in the Wiki to make it easier
to follow for users.

This fixes a few modules to use the example
tag instead of vanilla para tags to bring them
in line with the standard syntax.

ASTERISK-29777 #close

Change-Id: I9acb6cc5faf1d220e73c6dd28592371d768d279b
2021-11-30 11:49:38 -05:00
Sean Bright 1dce155f07 config.c: Prevent UB in ast_realtime_require_field.
A backend's implementation of the realtime 'require' function may call
va_arg() and then fail, leaving the va_list in an undefined
state. Pass a copy of the va_list instead.

ASTERISK-29771 #close

Change-Id: I555565a72af84e96d49f62fe8cb66ba5a78461f4
2021-11-30 09:51:39 -06:00
Naveen Albert 14c2121243 app_voicemail: Refactor email generation functions
Refactors generic functions used for email generation
into utils.c so that they can be used by multiple
modules, including app_voicemail and app_minivm,
to avoid code duplication.

ASTERISK-29715 #close

Change-Id: I1de0ed3483623e9599711129edc817c45ad237ee
2021-11-30 09:34:56 -06:00
Alexander Traud 6659f8e192 stir/shaken: Avoid a compiler extension of GCC.
ASTERISK-29776

Change-Id: I86e5eca66fb775a5744af0c929fb269e70575a73
2021-11-29 09:43:56 -06:00
Alexander Traud 16291d972e progdocs: Remove outdated references in doxyref.h.
ASTERISK-29773

Change-Id: Ica93160d9158cc0e80c5fda829b80d1b49a6b9b9
2021-11-29 09:32:43 -06:00
Alexander Traud 17c3a30ff7 xmldoc: Fix for Doxygen.
ASTERISK-29765

Change-Id: I654ba0debe8351038d4433716434a09370f04c9d
2021-11-29 09:05:26 -06:00
Jaco Kroon 0790a67877 logger: use __FUNCTION__ instead of __PRETTY_FUNCTION__
This avoids a few long-name overflows, at the cost of less instructive
names in the case of C++ (specifically overloaded functions and class
methods).  This in turn is offset against the fact that we're logging
the filename and line numbers in any case.

Change-Id: I54101a0bb5f8cb9ef63ec12c5e0d4c8edafff9ed
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-11-29 08:51:33 -06:00
Alexander Traud 5f9c9ba8c3 chan_misdn: Fix for Doxygen.
ASTERISK-29764

Change-Id: I6e5466cce03e25695c5c7d8b68c305184dcf5375
2021-11-20 05:17:58 -05:00
Alexander Traud 10a0e3d4d6 channels: Fix for Doxygen.
ASTERISK-29762

Change-Id: Ia8811ac12b93ff8c18164699c6fbc604cb0a23f7
2021-11-19 09:07:51 -06:00
Mike Bradeen abf5085a97 astobj2.c: Fix core when ref_log enabled
In the AO2_ALLOC_OPT_LOCK_NOLOCK case the referenced obj
structure is freed, but is then referenced later if ref_log is
enabled. The change is to store the obj->priv_data.options value
locally and reference it instead of the value from the freed obj

ASTERISK-29730

Change-Id: I60cc5dc1f5a4330e7ad56976fc38a42de0ab6072
2021-11-19 09:05:25 -06:00
Joshua C. Colp 42a1d98a13 bridge: Deny full Local channel pair in bridge.
Local channels are made up of two pairs - the 1 and 2
sides. When a frame goes in one side, it comes out the
other. Back and forth. When both halves are in a
bridge this creates an infinite loop of frames.

This change makes it so that bridging no longer
allows both of these sides to exist in the same
bridge.

ASTERISK-29748

Change-Id: I29928b6de87cd9be996a77daccefd7c360fef651
2021-11-19 08:41:53 -06:00
Naveen Albert 876e647232 res_tonedetect: Add call progress tone detection
Makes basic call progress tone detection available
in a tech-agnostic manner with the addition of the
ToneScan application. This can determine if the channel
has encountered a busy signal, SIT tones, dial tone,
modem, fax machine, etc. A few basic async progress
tone detect options are also added to the TONE_DETECT
function.

ASTERISK-29720 #close

Change-Id: Ia02437e0450473031e294798b8cb421fb8f24e90
2021-11-19 08:12:38 -06:00
Boris P. Korzun 2534cb34e4 rtp_engine: Add type field for JSON RTCP Report stasis messages
ASTERISK-29727 #close

Change-Id: I2eca8aeb591cb63ac2238d08eab662367453cb82
2021-11-18 17:39:35 -06:00
Alexander Traud d5a088f267 parking: Fix for Doxygen.
ASTERISK-29753

Change-Id: I7a61974584f6169502e6860fc711919fe7bbfaa7
2021-11-18 16:59:49 -06:00
Alexander Traud 06f7d7f4cc odbc: Fix for Doxygen.
ASTERISK-29754

Change-Id: Ia09eb68d283d201d9a6fbeccfc0efe83fe0502a5
2021-11-18 16:55:13 -06:00
Alexander Traud 17d5ef3a94 res_ari: Fix for Doxygen.
ASTERISK-29756

Change-Id: I2f1c1eea1c902492b77b74de9950f20ebbb7e758
2021-11-18 16:25:25 -06:00
Alexander Traud 97a653518d frame: Fix for Doxygen.
ASTERISK-29755

Change-Id: I8240013ec3db0669c0acf67e26bf6c9cbb5b72af
2021-11-18 16:12:45 -06:00
Alexander Traud e3c2288432 ari-stubs: Avoid 'is' as comparism with an literal.
Python 3.9.7 gave a syntax warning.

Change-Id: I3e3a982fe720726bc0015bcdb0e638a626ec89d4
2021-11-18 15:09:17 -06:00
Alexander Traud 5221b321fd BuildSystem: Consistently allow 'ye' even for Jansson.
Furthermore, consistently use not 'No' but ':' for non-existent file
paths. Finally, use the same pattern for checking file paths:
  a)  = ":"
  b) != "x:"

Change-Id: I0c80c76d2cc98b0e5c859131290f4e3141a1a544
2021-11-18 15:07:40 -06:00
Alexander Traud ed851cbba8 channel: Fix for Doxygen.
ASTERISK-29751

Change-Id: Ie04da5029c57ebee44733bdf05013156abe80176
2021-11-18 14:47:38 -06:00
Alexander Traud 6b0cee202b stasis: Fix for Doxygen.
ASTERISK-29750

Change-Id: Iea50173e785b2e9d49bc24c0af7111cfd96d44a9
2021-11-18 14:46:57 -06:00
Alexander Traud 773a60cda6 app: Fix for Doxygen.
ASTERISK-29752

Change-Id: If40cbd01d47a6cfd620b18206dedb8460216c8af
2021-11-18 14:45:56 -06:00
Alexander Traud 5689143827 res_xmpp: Fix for Doxygen.
ASTERISK-29749

Change-Id: I7885793b63bdeaa883e76edb899bbba9660eb1c5
2021-11-18 14:44:07 -06:00
Alexander Traud c29bf45863 chan_iax2: Fix for Doxygen.
ASTERISK-29737

Change-Id: I282003cc553989fd5c19ceeac9e478fa4ee06cec
2021-11-18 12:48:37 -06:00
Alexander Traud 2dd2bfe146 res_pjsip: Fix for Doxygen.
ASTERISK-29747

Change-Id: Ic7a1e9453f805a6264fe86c96b7d18b87b376084
2021-11-18 12:46:37 -06:00
Alexander Traud ed8d5dfb27 bridges: Fix for Doxygen.
ASTERISK-29743

Change-Id: I6e1bbbaa5875e19994a328ab40a5d429c6010e8b
2021-11-18 11:14:31 -06:00
Alexander Traud ea42985301 addons: Fix for Doxygen.
ASTERISK-29742

Change-Id: Ie752cb9638ced1ebe3a55d710c6c18ef6bd0aafc
2021-11-18 11:10:02 -06:00
Alexander Traud ebc404fb8c tests: Fix for Doxygen.
ASTERISK-29741

Change-Id: I012d72b237bda2ef2d0f86307dfc6dc7add4b54b
2021-11-18 10:38:52 -06:00
Alexander Traud 07e4c686cc apps: Fix for Doxygen.
ASTERISK-29740

Change-Id: Icb6fbcfea0a5f1c82caa5001902b6a786adbf307
2021-11-18 10:37:18 -06:00
Alexander Traud 94d8d124fe bridge_channel: Fix for Doxygen.
ASTERISK-29736

Change-Id: Ia5370289e6526001a6b52754b533bcea1a9d7e5c
2021-11-18 09:22:34 -06:00
Alexander Traud 79cb1cdb65 progdocs: Avoid 'name' with Doxygen \file.
Fixes one misuse of the parameter 'name'. Additionally, for
consistency and to avoid such an issue in future, those few other
places, which used '\file name', were changed just to '\file'. Then,
Doxygen uses the name of the current file.

ASTERISK-29733

Change-Id: I1a915713d39223b03532549e6c16a98cefb4fc23
2021-11-18 09:20:49 -06:00
Alexander Traud 94575f9a9a progdocs: Use Doxygen \example correctly.
ASTERISK-29734

Change-Id: I83b51e85cd71867645ab3a8a820f8fd1f065abd2
2021-11-18 09:14:04 -06:00
Alexander Traud c73901308f progdocs: Avoid multiple use of section labels.
ASTERISK-29735

Change-Id: I56935e73f7bd1d4ae2721d11040f4835da64b810
2021-11-18 09:08:29 -06:00
Josh Soref 10384133f4 bridges: Spelling fixes
Correct typos of the following word families:

multiplication
potentially
iteration
interaction
virtual
synthesis
convolve
initializes
overlap

ASTERISK-29714

Change-Id: Ia40f1aca8f2996ab407c6ed9d24cb10a67c6684b
(cherry picked from commit 2a8fb4695e)
2021-11-17 04:37:28 -06:00
Naveen Albert a9e2d9b5f1 app_morsecode: Fix deadlock
Fixes a deadlock in app_morsecode caused by locking
the channel twice when reading variables from the
channel. The duplicate lock is simply removed.

ASTERISK-29744 #close

Change-Id: I204000701f123361d7f85e0498fedc90243c75e4
2021-11-16 18:41:48 -06:00
Naveen Albert ac2c984f22 app_read: Fix custom terminator functionality regression
Currently, when the t option is specified with no arguments,
the # character is still treated as a terminator, even though
no character should be treated as a terminator.

This is because a previous regression fix was modified to
remove the use of NULL as a default altogether. However,
NULL and an empty string actually refer to different
arrangements and should be treated differently. NULL is the
default terminator (#), while an empty string removes the
terminator altogether. This is the behavior being used by
the rest of the core.

Additionally, since S_OR catches empty strings as well as
NULL (not intended), this is changed to a ternary operator
instead, which fixes the behavior.

ASTERISK-29705 #close

Change-Id: I9b6b72196dd04f5b1e0ab5aa1b0adf627725e086
2021-11-16 15:44:10 -06:00
Naveen Albert 406e8af300 res_pjsip_callerid: Fix OLI parsing
Fix parsing of ANI2/OLI information, since it was previously
parsing the user, when it should have been parsing other_param.

Also improves the parsing by using pjproject native functions
rather than trying to parse the parameters ourselves like
chan_sip did. A previous attempt at this caused a crash, but
this works correctly now.

ASTERISK-29703 #close

Change-Id: I8f3c79032d9ea1a21d16f8e11f22bd8d887738a1
2021-11-16 07:15:10 -05:00
Josh Soref 7ee6f515f9 rest-api-templates: Spelling fixes
Correct typos of the following word families:

overwritten
descendants

ASTERISK-29714

Change-Id: I2307e35887a3437e50317a4b86f0893f25f9fd3b
2021-11-16 05:42:03 -06:00
Josh Soref 9aa88723e3 funcs: Spelling fixes
Correct typos of the following word families:

effectively
emitted
expect
anthony

ASTERISK-29714

Change-Id: Ic16f9ec855bb6d14ec8e170b90af9a36b06d488a
2021-11-16 05:41:50 -06:00
Josh Soref 923f5ee308 utils: Spelling fixes
Correct typos of the following word families:

command-line
immediately
extensions
momentarily
mustn't
numbered
bytes
caching

ASTERISK-29714

Change-Id: I8b2b125c5d4d2f9e87a58515c97468ad47ca44f8
2021-11-16 05:39:56 -06:00
Josh Soref ec31cf02fc CREDITS: Spelling fixes
Correct typos of the following word families:

contributors

ASTERISK-29714

Change-Id: I6f46dae8bf8125a21ce8ff318380b2b412d9d2f9
2021-11-16 05:38:50 -06:00
Josh Soref 5d1e3cb17f doc: Spelling fixes
Correct typos of the following word families:

transparent
roughly

ASTERISK-29714

Change-Id: I2b90c68dfde4aa3f0d58f64f8187465336acb1b3
2021-11-16 05:38:15 -06:00
Josh Soref 4aadd5573d build_tools: Spelling fixes
Correct typos of the following word families:

binutils

ASTERISK-29714

Change-Id: I2f676ab48cd50edc400c43307cb53679e4c09b97
2021-11-16 05:37:59 -06:00
Josh Soref ebd56c8bf3 apps: Spelling fixes
Correct typos of the following word families:

simultaneously
administrator
directforward
attachfmt
dailplan
automatically
applicable
nouns
explicit
outside
sponsored
attachment
audio
spied
doesn't
counting
encoded
implements
recursively
emailaddress
arguments
queuerules
members
priority
output
advanced
silencethreshold
brazilian
debugging
argument
meadmin
formatting
integrated
sneakiness

ASTERISK-29714

Change-Id: Ie5ecaec91c00b26309da4e51cfc0991a5bb7d092
2021-11-16 05:36:41 -06:00
Josh Soref e3dfd4c097 menuselect: Spelling fixes
Correct typos of the following word families:

dependency
unless
random
dependencies
delimited
randomly
modules

ASTERISK-29714

Change-Id: I3920603a8dc7c0a1852d2f885e06b1144692d40e
2021-11-16 05:36:11 -06:00
Josh Soref d887c9fb5b CHANGES: Spelling fixes
Correct typos of the following word families:

issuing
execution
bridging
alert
respective
unlikely
confbridge
offered
negotiation
announced
engineer
systems
inherited
passthrough
functionality
supporting
conflicts
semantically
monitor
specify
specifiable

ASTERISK-29714

Change-Id: Ia6b1cf634f52c5f7b1b8769dc54dae78106ed98c
2021-11-16 05:33:49 -06:00
Josh Soref e5d4de1f3f include: Spelling fixes
Correct typos of the following word families:

activities
forward
occurs
unprepared
association
compress
extracted
doubly
callback
prometheus
underlying
keyframe
continue
convenience
calculates
ignorepattern
determine
subscribers
subsystem
synthetic
applies
example
manager
established
result
microseconds
occurrences
unsuccessful
accommodates
related
signifying
unsubscribe
greater
fastforward
itself
unregistering
using
translator
sorcery
implementation
serializers
asynchronous
unknowingly
initialization
determining
category
these
persistent
propagate
outputted
string
allocated
decremented
second
cacheability
destructor
impaired
decrypted
relies
signaling
based
suspended
retrieved
functions
search
auth
considered

ASTERISK-29714

Change-Id: I542ce887a16603f886a915920d5710d4a0a1358d
2021-11-16 05:33:15 -06:00
Josh Soref aa98237e46 tests: Spelling fixes
Correct typos of the following word families:

mounting
jitterbuffer
thrashing
original
manipulating
entries
actual
possibility
tasks
options
positives
taskprocessor
other
dynamic
declarative

ASTERISK-29714

Change-Id: I6b94659d045eec5d8d020fce2e9b6e2f593dfeb6
2021-11-15 22:17:52 -06:00
Josh Soref 4dd7ae3962 contrib: Spelling fixes
Correct typos of the following word families:

standard
increase
comments
valgrind
promiscuous
editing
libtonezone
storage
aggressive
whitespace
russellbryant
consecutive
peternixon

ASTERISK-29714

Change-Id: I9cafbf41b579c9c0c84c81719d2c4f900beec245
2021-11-15 21:33:50 -06:00
Josh Soref 76c043a48c configs: Spelling fixes
Correct typos of the following word families:

password
excludes
undesirable
checksums
through
screening
interpreting
database
causes
initiation
member
busydetect
defined
severely
throughput
recognized
counter
require
indefinitely
accounts

ASTERISK-29714

Change-Id: Ie8f2a7b274a162dd627ee6a2165f5e8a3876527e
2021-11-15 21:33:43 -06:00
Josh Soref c99df39b03 UPGRADE.txt: Spelling fixes
Correct typos of the following word families:

themselves
support
received

ASTERISK-29714

Change-Id: Ibd0a7996d5801c754d3d44fba31fe788a13dba95
2021-11-15 20:25:21 -06:00
Josh Soref f818f39825 pbx: Spelling fixes
Correct typos of the following word families:

process
populate
with
africa
accessing
contexts
exercise
university
organizations
withhold
maintaining
independent
rotation
ignore
eventname

ASTERISK-29714

Change-Id: I90eacc5bc3dcf75a9c898cfb85164f37dec08345
2021-11-15 19:49:39 -06:00
Josh Soref 714018e59a formats: Spelling fixes
Correct typos of the following word families:

truncate

ASTERISK-29714

Change-Id: I6507760c72b919873cff7cac22b3781036cd4955
2021-11-15 19:29:00 -06:00
Josh Soref 47c50aa47e main: Spelling fixes
Correct typos of the following word families:

analysis
nuisance
converting
although
transaction
desctitle
acquire
update
evaluate
thousand
this
dissolved
management
integrity
reconstructed
decrement
further on
irrelevant
currently
constancy
anyway
unconstrained
featuregroups
right
larger
evaluated
encumbered
languages
digits
authoritative
framing
blindxfer
tolerate
traverser
exclamation
perform
permissions
rearrangement
performing
processing
declension
happily
duplicate
compound
hundred
returns
elicit
allocate
actually
paths
inheritance
atxferdropcall
earlier
synchronization
multiplier
acknowledge
across
against
thousands
joyous
manipulators
guaranteed
emulating
soundfile

ASTERISK-29714

Change-Id: I926ba4b11e9f6dd3fdd93170ab1f9b997910be70
2021-11-15 18:31:44 -06:00
Josh Soref f0ad84390a Makefile: Spelling fixes
Correct typos of the following word families:

libraries
install
overwrite

ASTERISK-29714

Change-Id: I6488814f79186d6c23dfd7b7f9bba0a046126174
2021-11-15 18:25:43 -06:00
Josh Soref 3d766cd96b agi: Spelling fixes
Correct typos of the following word families:

pretend
speech

ASTERISK-29714

Change-Id: I7d0527c329cda07552247ea11b2d7db207a3d87d
2021-11-15 18:07:36 -06:00
Josh Soref 024e0dbc23 addons: Spelling fixes
Correct typos of the following word families:

definition
listener
fastcopy
logical
registration
classify
documentation
explicitly
dialed
endpoint
elements
arithmetic
might
prepend
byte
terminal
inquiry
skipping
aliases
calling
absent
authentication
transmit
their
ericsson
disconnecting
redir
items
client
adapter
transmitter
existing
satisfies
pointer
interval
supplied

ASTERISK-29714

Change-Id: I8548438246f7b718d88e0b9e0a1eb384bbec88e4
2021-11-15 18:04:11 -06:00
Josh Soref 1aae1d2215 codecs: Spelling fixes
Correct typos of the following word families:

voiced
denumerator
codeword
upsampling
constructed
residual
subroutine
conditional
quantizing
courtesy
number

ASTERISK-29714

Change-Id: I471fb8086a5277d8f05047fedee22cfa97a4252d
2021-11-15 17:22:09 -06:00
Josh Soref 636d3dc4be channels: Spelling fixes
Correct typos of the following word families:

appease
permanently
overriding
residue
silliness
extension
channels
globally
reference
japanese
group
coordinate
registry
information
inconvenience
attempts
cadence
payloads
presence
provisioning
mimics
behavior
width
natively
syslabel
not owning
unquelch
mostly
constants
interesting
active
unequipped
brodmann
commanding
backlogged
without
bitstream
firmware
maintain
exclusive
practically
structs
appearance
range
retransmission
indication
provisional
associating
always
whether
cyrillic
distinctive
components
reinitialized
initialized
capability
switches
occurring
happened
outbound

ASTERISK-29714

Change-Id: Ife52ee89cd2170b684fa651ca72b1cb911a57339
2021-11-15 17:14:36 -06:00
Josh Soref 923c836886 res: Spelling fixes
Correct typos of the following word families:

identifying
structures
actcount
initializer
attributes
statement
enough
locking
declaration
userevent
provides
unregister
session
execute
searches
verification
suppressed
prepared
passwords
recipients
event
because
brief
unidentified
redundancy
character
the
module
reload
operation
backslashes
accurate
incorrect
collision
initializing
instance
interpreted
buddies
omitted
manually
requires
queries
generator
scheduler
configuration has
owner
resource
performed
masquerade
apparently
routable

ASTERISK-29714

Change-Id: I88485116d2c59b776aa2e1f8b4ce8239a21decda
2021-11-15 11:10:43 -05:00
George Joseph 6bd2fa8511 CI: Rename 'master' node to 'built-in'
Jenkins renamed the 'master' node to 'built-in' in version
2.319 so we have to adjust as well.

Change-Id: Ice663c3a66d0eedf76e8e5fe530328455991ec25
2021-11-09 09:01:44 -06:00
Naveen Albert 6d242723bb sig_analog: Fix truncated buffer copy
Fixes compiler warning caused by a truncated copy of the ANI2 into a
buffer of size 10. This could prevent the null terminator from being
copied if the copy value exceeds the size of the buffer. This increases
the buffer size to 101 to ensure there is no way for truncation to occur.

ASTERISK-29702 #close

Change-Id: Ief9052212952840fa44de6463b8699fdb3e163d0
2021-11-08 13:14:05 -06:00
Alexander Traud 0766023be4 BuildSystem: In POSIX sh, == in place of = is undefined.
ASTERISK-29724

Change-Id: I59aa0e52effdc16992f3a736ccf73430a6ef135b
2021-11-08 13:13:45 -06:00
Sean Bright 74ad80609e pbx.c: Don't remove dashes from hints on reload.
When reloading dialplan, hints created dynamically would lose any dash
characters. Now we ignore those dashes if we are dealing with a hint
during a reload.

ASTERISK-28040 #close

Change-Id: I95e48f5a268efa3c6840ab69798525d3dce91636
2021-11-08 13:12:55 -06:00
Naveen Albert 54b41fcfd2 app_voicemail: Fix phantom voicemail bug on rerecord
If users are able to press # for options while leaving
a message and then press 3 to rerecord the message, if
the caller hangs up during the rerecord prompt but before
Asterisk starts recording a message, then an "empty"
voicemail gets processed whereby an email gets sent out
notifying the user of a 0:00 duration message. The file
doesn't actually exist, so playback will fail since there
was no message to begin with.

This adds a check after the streaming of the rerecord
announcement to see if the caller has hung up. If so,
we bail out early so that we can clean up properly.

ASTERISK-29391 #close

Change-Id: Id965d72759a2fd3b39afb76fec08aaebebe75c31
2021-11-08 11:29:11 -06:00
Naveen Albert 530e89655e chan_iax2: Allow both secret and outkey at dial time
Historically, the dial syntax for IAX2 has held that
an outkey (used only for RSA authenticated calls)
and a secret (used only for plain text and MD5 authenticated
calls, historically) were mutually exclusive, and thus
the same position in the dial string was used for both
values.

Now that encryption is possible with RSA authentication,
this poses a limitation, since encryption requires a
secret and RSA authentication requires an outkey. Thus,
the dial syntax is extended so that both a secret and
an outkey can be specified.

The new extended syntax is backwards compatible with the
old syntax. However, a secret can now be specified after
the outkey, or the outkey can be specified after the secret.
This makes it possible to spawn an encrypted RSA authenticated
call without a corresponding peer being predefined in iax.conf.

ASTERISK-29707 #close

Change-Id: I1f8149313ed760169d604afbb07720a8b07dd00e
2021-11-08 11:27:00 -06:00
Alexander Traud f81c4ff3c9 res_snmp: As build tool, prefer pkg-config over net-snmp-config.
ASTERISK-29709

Change-Id: Ie169df878bdfc3a06b3097c5c38d185b480f54d4
2021-11-04 10:49:53 -05:00
Alexander Traud 45266c66d5 stasis: Avoid 'dispatched' as unused variable in normal mode.
ASTERISK-29710

Change-Id: Ia849f1172e4e694c5d5d7f0cad449f936ee12216
2021-11-01 12:59:10 -05:00
Sean Bright 11f291f6f0 various: Fix GCC 11.2 compilation issues.
* Initialize some variables that are never used anyway.

* Use valid pointers instead of integers cast to void pointers when
  calling pthread_setspecific().

ASTERISK-29711 #close
ASTERISK-29713 #close

Change-Id: I8728cd6f2f4b28e0e48113c5da450b768c2a6683
2021-10-29 12:15:53 -05:00
George Joseph ecb46511cc ast_coredumper: Refactor to better find things
The search for a running asterisk when --running is used
has been greatly simplified and in the event it doesn't
work, you can now specify a pid to use on the command
line with --pid.

The search for asterisk modules when --tarball-coredumps
is used has been enhanced to have a better chance of finding
them and in the event it doesn't work, you can now specify
--libdir on the command line to indicate the library directory
where they were installed.

The DATEFORMAT variable was renamed to DATEOPTS and is now
passed to the 'date' utility rather than running DATEFORMAT
as a command.

The coredump and output files are now renamed with DATEOPTS.
This can be disabled by specifying --no-rename.

Several confusing and conflicting options were removed:
--append-coredumps
--conffile
--no-default-search
--tarball-uniqueid

The script was re-structured to make it easier for follow.

Change-Id: I674be64bdde3ef310b6a551d4911c3b600ffee59
2021-10-29 09:48:14 -05:00
Kevin Harwell d112916e98 strings/json: Add string delimter match, and object create with vars methods
Add a function to check if there is an exact match a one string between
delimiters in another string.

Add a function that will create an ast_json object out of a list of
Asterisk variables. An excludes string can also optionally be passed
in.

Also, add a macro to make it easier to get object integers.

Change-Id: I5f34f18e102126aef3997f19a553a266d70d6226
2021-10-28 09:37:07 -05:00
Ben Ford 669e16b3dc STIR/SHAKEN: Option split and response codes.
The stir_shaken configuration option now has 4 different choices to pick
from: off, attest, verify, and on. Off and on behave the same way they
do now. Attest will only perform attestation on the endpoint, and verify
will only perform verification on the endpoint.

Certain responses are required to be sent based on certain conditions
for STIR/SHAKEN. For example, if we get a Date header that is outside of
the time range that is considered valid, a 403 Stale Date response
should be sent. This and several other responses have been added.

Change-Id: I4ac1ecf652cd0e336006b0ca638dc826b5b1ebf7
2021-10-27 09:56:20 -05:00
Rodrigo Ramírez Norambuena b12e8b5924 app_queue: Add LoginTime field for member in a queue.
Add a time_t logintime to storage a time when a member is added into a
queue.

Also, includes show this time (in seconds) using a 'queue show' command
and the field LoginTime for response for AMI events.

ASTERISK-18069 #close

Change-Id: Ied6c3a300f78d78eebedeb3e16a1520fc3fff190
2021-10-25 08:30:36 -05:00
Kevin Harwell 04e79fd0e3 res_speech: Add a type conversion, and new engine unregister methods
Add a new function that converts a speech results type to a string.
Also add another function to unregister an engine, but returns a
pointer to the unregistered engine object instead of a success/fail
integer.

Change-Id: I0f7de17cb411021c09fb03988bc2b904e1380192
2021-10-22 08:14:59 -05:00
Mike Bradeen 8031b6c9e6 various: Fix GCC 11 compilation issues.
test_voicemail_api: Use empty char* for empty_msg_ids.
chan_skinny: Fix size of calledParty to be maximum extension.
menuselect: Change Makefile to stop deprecated warnings. Added comments
test_linkedlist: 'bogus' variable was manually allocated from a macro
and the test fails if this happens but the compiler couldn't 'see' this
and returns a warning. memset to all 0's after allocation.
chan_ooh323: Fixed various indentation issues that triggered misleading
 indentation warnings.

ASTERISK-29682
Reported by: George Joseph

Change-Id: If4fe42222c8444dc16828a42731ee53b4ce5cbbe
2021-10-21 11:38:45 -05:00
Shloime Rosenblum a68ef6aafd apps/app_playback.c: Add 'mix' option to app_playback
I am adding a mix option that will play by filename and say.conf unlike
say option that will only play with say.conf. It
will look on the format of the name, if it is like say it play with
say.conf if not it will play the file name.

ASTERISK-29662

Change-Id: I815816916a308f0fa8f165140dc15772dcbd547a
2021-10-21 10:47:15 -05:00
George Joseph 362b7f2411 BuildSystem: Check for alternate openssl packages
OpenSSL is one of those packages that often have alternatives
with later versions.  For instance, CentOS/EL 7 has an
openssl package at version 1.0.2 but there's an openssl11
package from the epel repository that has 1.1.1.  This gets
installed to /usr/include/openssl11 and /usr/lib64/openssl11.
Unfortunately, the existing --with-ssl and --with-crypto
./configure options expect to point to a source tree and
don't work in this situation.  Also unfortunately, the
checks in ./configure don't use pkg-config.

In order to make this work with the existing situation, you'd
have to run...
./configure --with-ssl=/usr/lib64/openssl11 \
    --with-crypto=/usr/lib64/openssl11 \
    CFLAGS=-I/usr/include/openssl11

BUT...  those options don't get passed down to bundled pjproject
so when you run make, you have to include the CFLAGS again
which is a big pain.

Oh...  To make matters worse, although you can specify
PJPROJECT_CONFIGURE_OPTS on the ./configure command line,
they don't get saved so if you do a make clean, which will
force a re-configure of bundled pjproject, those options
don't get used.

So...

* In configure.ac... Since pkg-config is installed by install_prereq
  anyway, we now use it to check for the system openssl >= 1.1.0.
  If that works, great.  If not, we check for the openssl11
  package. If that works, great.  If not, we fall back to just
  checking for any openssl.  If pkg-config isn't installed for some
  reason, or --with-ssl=<dir> or --with-crypto=<dir> were specified
  on the ./configure command line, we fall back to the existing
  logic that uses AST_EXT_LIB_CHECK().

* The whole OpenSSL check process has been moved up before
  THIRD_PARTY_CONFIGURE(), which does the initial pjproject
  bundled configure, is run.  This way the results of the above
  checks, which may result in new include or library directories,
  is included.

* Although not strictly needed for openssl, We now save the value of
  PJPROJECT_CONFIGURE_OPTS in the makeopts file so it can be used
  again if a re-configure is triggered.

ASTERISK-29693

Change-Id: I341ab7603e6b156aa15a66f43675ac5029d5fbde
2021-10-21 07:26:13 -05:00
Sean Bright a4d533d132 func_talkdetect.c: Fix logical errors in silence detection.
There are 3 separate changes here:

1. The documentation erroneously stated that the dsp_talking_threshold
   argument was a number of milliseconds when it is actually an energy
   level used by the DSP code to classify talking vs. silence.

2. Fixes a copy paste error in the argument handling code.

3. Don't erroneously switch to the talking state if we aren't actively
   handling a frame we've classified as talking.

Patch inspired by one provided by Moritz Fain (License #6961).

ASTERISK-27816 #close

Change-Id: I5953fd570b98b49c41cee55bfe3b941753fb2511
2021-10-19 10:21:57 -05:00
Sebastien Duthil fe0b5aed7b main/stun.c: fix crash upon STUN request timeout
Some ast_stun_request users do not provide a destination address when
sending to a connection-mode socket.

ASTERISK-29691

Change-Id: Idd9114c3380216ba48abfc3c68619e79ad37defc
2021-10-15 13:40:34 -05:00
Sean Bright 0c71619f8a configure: Remove unused OpenSSL SRTP check.
Discovered while looking at ASTERISK~29684. Usage was removed in change
I3c77c7b00b2ffa2e935632097fa057b9fdf480c0.

Change-Id: Iaf2f7a16ea5a7eee6375319347e4b40b8e7b10e3
2021-10-15 10:47:00 -05:00
Mike Bradeen d553da5c70 build: prevent binary downloads for non x86 architectures
download_externals: Add check for i686 and i386 (in addition
to the current x86_64) and exit if not one of the three.

ASTERISK-26497

Change-Id: Ia4d429fcefa5b2f5b6e99159d4607de8e8325b2f
2021-10-15 09:57:20 -05:00
Asterisk Development Team 448739fe63 Update CHANGES and UPGRADE.txt for 16.22.0 2021-10-13 05:19:35 -05:00
Sean Bright b64b120bf5 Makefile: Use basename in a POSIX-compliant way.
If you aren't using GNU coreutils, chances are that your basename
doesn't know about the -s argument. Luckily for us, basename does what
we need it do even without the -s argument.

Change-Id: I8b81a429bb037b997ee6640ff8a2b5e860962bb7
2021-10-11 10:03:44 -05:00
Mark Murawski 4cd2679c5e pbx_ael: Fix crash and lockup issue regarding 'ael reload'
Avoid infinite recursion and crash

Change-Id: I8ed05ec3aa2806c50c77edc5dd0cd4e4fa08b3f4
2021-10-08 09:40:43 -05:00
Naveen Albert 8ad4cb901b chan_iax2: Add encryption for RSA authentication
Adds support for encryption to RSA-authenticated
calls. Also prevents crashes if an RSA IAX2 call
is initiated to a switch requiring encryption
but no secret is provided.

ASTERISK-20219

Change-Id: I18f1f9d7c59b4f9cffa00f3b94a4c875846efd40
2021-10-07 18:23:04 -05:00
Matthew Kern 39824c7a96 res_pjsip_t38: bind UDPTL sessions like RTP
In res_pjsip_sdp_rtp, the bind_rtp_to_media_address option and the
fallback use of the transport's bind address solve problems sending
media on systems that cannot send ipv4 packets on ipv6 sockets, and
certain other situations. This change extends both of these behaviors
to UDPTL sessions as well in res_pjsip_t38, to fix fax-specific
problems on these systems, introducing a new option
endpoint/t38_bind_udptl_to_media_address.

ASTERISK-29402

Change-Id: I87220c0e9cdd2fe9d156846cb906debe08c63557
2021-10-01 08:55:56 -05:00
Naveen Albert 7ee4136dcf app_read: Fix null pointer crash
If the terminator character is not explicitly specified
and an indications tone is used for reading a digit,
there is no null pointer check so Asterisk crashes.
This prevents null usage from occuring.

ASTERISK-29673 #close

Change-Id: Ie941833e123c3dbfb88371b5de5edbbe065514ac
2021-09-30 11:07:32 -05:00
Jean Aunis 0c17fd802b res_rtp_asterisk: fix memory leak
Add missing reference decrement in rtp_deallocate_transport()

ASTERISK-29671

Change-Id: I8d22dbedb90e8dade0829b7a28372f404b07caa9
2021-09-30 01:43:24 -05:00
Shloime Rosenblum e8ad58217f main/say.c: Support future dates with Q and q format params
The current versions do not support future dates in all say application when using the 'Q' or 'q' format parameter and says "today" for everything that is greater than today

ASTERISK-29637

Change-Id: I1fb1cef0ce3c18d87b1fc94ea309d13bc344af02
2021-09-28 12:08:54 -05:00
Joseph Nadiv 722b81904e res_pjsip_registrar: Remove unavailable contacts if exceeds max_contacts
The behavior of max_contacts and remove_existing are connected.  If
remove_existing is enabled, the soonest expiring contacts are removed.
This may occur when there is an unavailable contact.  Similarly,
when remove_existing is not enabled, registrations from good
endpoints are rejected in favor of retaining unavailable contacts.

This commit adds a new AOR option remove_unavailable, and the effect
of this setting will depend on remove_existing.  If remove_existing
is set to no, we will still remove unavailable contacts when they
exceed max_contacts, if there are any. If remove_existing is set to
yes, we will prioritize the removal of unavailable contacts before
those that are expiring soonest.

ASTERISK-29525

Change-Id: Ia2711b08f2b4d1177411b1be23e970d7fdff5784
2021-09-24 09:48:52 -05:00
Naveen Albert b0027c65f9 func_vmcount: Add support for multiple mailboxes
Allows multiple mailboxes to be specified for VMCOUNT
instead of just one.

ASTERISK-29661 #close

Change-Id: I9108528300795fd5b607efa9d4dd7b74be031813
2021-09-22 10:49:23 -05:00
Sean Bright 97ce647afd message.c: Support 'To' header override with AMI's MessageSend.
The MessageSend AMI action has been updated to allow the Destination
and the To addresses to be provided separately. This brings the
MessageSend manager command in line with the capabilities of the
MessageSend dialplan application.

ASTERISK-29663 #close

Change-Id: I8513168d3e189a9fed88aaab6f5547ccb50d332c
2021-09-22 10:16:04 -05:00
Naveen Albert 228c97d3bf func_channel: Add CHANNEL_EXISTS function.
Adds a function to check for the existence of a channel by
name or by UNIQUEID.

ASTERISK-29656 #close

Change-Id: Ib464e9eb6e13dc683a846286798fecff4fd943cb
2021-09-21 18:20:25 -05:00
Naveen Albert 9a427d4f5f app_queue: Fix hint updates for included contexts
Previously, if custom hints were used with the hint:
format in app_queue, when device state changes occured,
app_queue would only do a literal string comparison of
the context used for the hint in app_queue and the context
of the hint which just changed state. This caused hints
to not update and become stale if the context associated
with the agent included the context which actually changes
state, essentially completely breaking device state for
any such agents defined in this manner.

This fix adds an additional check to ensure that included
contexts are also compared against the context which changed
state, so that the behavior is correct no matter whether the
context is specified to app_queue directly or indirectly.

ASTERISK-29578 #close

Change-Id: I8caf2f8da8157ef3d9ea71a8568c1eec95592b78
2021-09-21 14:30:45 -05:00
Sean Bright 28d8b9e067 res_http_media_cache.c: Compare unaltered MIME types.
Rather than stripping parameters from Content-Type headers before
comparison, first try to compare the whole string. If no match is
found, strip the parameters and try that way.

ASTERISK-29275 #close

Change-Id: I2963c8ecbb3a9605b78b6421c415108d77a66a0f
2021-09-21 13:10:37 -05:00
Naveen Albert 41ba9f5f31 logger: Add custom logging capabilities
Adds the ability for users to log to custom log levels
by providing custom log level names in logger.conf. Also
adds a logger show levels CLI command.

ASTERISK-29529

Change-Id: If082703cf81a436ae5a565c75225fa8c0554b702
2021-09-21 11:52:00 -05:00
Sean Bright d406cc2acd app_externalivr.c: Fix mixed leading whitespace in source code.
No functional changes.

Change-Id: I46514152c0af67f395526374aaa847ccd6a85378
2021-09-21 11:46:07 -05:00
Guido Falsi 5f4d3e2822 res_rtp_asterisk.c: Fix build failure when not building with pjproject.
Some code has been added referencing symbols defined in a block
protected by #ifdef HAVE_PJPROJECT. Protect those code parts in
ifdef blocks too.

ASTERISK-29660

Change-Id: Ib18d4392d51ac80ca5481dabf6e498a4e3e49e6f
2021-09-20 22:45:35 +02:00
Asterisk Development Team 9b17523c4b Update CHANGES and UPGRADE.txt for 16.21.0 2021-09-16 08:31:42 -05:00
George Joseph 551068deb6 pjproject: Add patch to fix trailing whitespace issue in rtpmap
An issue was found where a particular manufacturer's phones add a
trailing space to the end of the rtpmap attribute when specifying
a payload type that has a "param" after the format name and clock
rate. For example:

a=rtpmap:120 opus/48000/2 \r\n

Because pjmedia_sdp_attr_get_rtpmap currently takes everything after
the second '/' up to the line end as the param, the space is
included in future comparisons, which then fail if the param being
compared to doesn't also have the space.

We now use pj_scan_get() to parse the param part of rtpmap so
trailing whitespace is automatically stripped.

ASTERISK-29654

Change-Id: Ibd0a4e243a69cde7ba9312275b13ab62ab86bc1b
2021-09-15 12:44:59 -05:00
Carlos Oliva 72790f5455 app_mp3: Force output to 16 bits in mpg123
In new mpg123 versions (since 1.26) the default output is 32 bits
Asterisk expects the output in 16 bits, so we force the output to be on 16 bits.
It will work wit new and old versions of mpg123.
Thanks Thomas Orgis <thomas-forum@orgis.org> for giving the key!

ASTERISK-29635 #close

Change-Id: I88c7740118b5af4e895bd8b765b68ed5c11fc816
2021-09-15 12:19:23 -05:00
Naveen Albert 425bd97f0d app_mf: Add channel agnostic MF sender
Adds a SendMF application and PlayMF manager
event to send arbitrary R1 MF tones on the
current or specified channel.

ASTERISK-29496

Change-Id: I5d89afdbccee3f86cc702ed96d882f3d351327a4
2021-09-15 10:11:58 -05:00
Naveen Albert 7feee9c65b res_pjsip_caller_id: Add ANI2/OLI parsing
Adds parsing of ANI II digits (Originating
Line Information) to PJSIP, on par with
what currently exists in chan_sip.

ASTERISK-29472

Change-Id: Ifc938a7a7d45ce33999ebf3656a542226f6d3847
2021-09-14 15:16:00 -05:00
Sean Bright a03b10cb09 test_http_media_cache.c: Fix copy/paste error during test deregistration.
Change-Id: I9a3a978b2f818be464e062d97b93831b127ef28c
2021-09-13 07:15:35 -05:00
Naveen Albert a3a28b9168 app_stack: Include current location if branch fails
Previously, the error emitted when app_stack tries
to branch to a dialplan location that doesn't exist
has included only the information about the attempted
branch in the error log. This adds the current location
as well so users can see where the branch failed in
the logs.

ASTERISK-29626

Change-Id: Ia23502ab2ad21485a1ac74295063a8f25a6df5ce
2021-09-13 07:12:31 -05:00
Naveen Albert 249fe0f37e func_strings: Add STRBETWEEN function
Adds the STRBETWEEN function, which can be used to insert a
substring between each character in a string. For instance,
this can be used to insert pauses between DTMF tones in a
string of digits.

ASTERISK-29627

Change-Id: Ice23009d4a8e9bb9718d2b2301d405567087d258
2021-09-10 16:31:52 -05:00
Sean Bright 4aac9ffcd4 test_abstract_jb.c: Fix put and put_out_of_order memory leaks.
We can't rely on RAII_VAR(...) to properly clean up data that is
allocated within a loop.

ASTERISK-27176 #close

Change-Id: Ib575616101230c4f603519114ec62ebf3936882c
2021-09-10 14:26:21 -05:00
Naveen Albert b8e2b2ed5e func_env: Add DIRNAME and BASENAME functions
Adds the DIRNAME and BASENAME functions, which are
wrappers around the corresponding C library functions.
These can be used to safely and conveniently work with
file paths and names in the dialplan.

ASTERISK-29628 #close

Change-Id: Id3aeb907f65c0ff96b6e57751ff0cb49d61db7f3
2021-09-10 11:47:28 -05:00
Naveen Albert 11516e4b8e func_sayfiles: Retrieve say file names
Up until now, all of the logic used to translate
arguments to the Say applications has been
directly coupled to playback, preventing other
modules from using this logic.

This refactors code in say.c and adds a SAYFILES
function that can be used to retrieve the file
names that would be played. These can then be
used in other applications or for other purposes.

Additionally, a SayMoney application and a SayOrdinal
application are added. Both SayOrdinal and SayNumber
are also expanded to support integers greater than
one billion.

ASTERISK-29531

Change-Id: If9718c89353b8e153d84add3cc4637b79585db19
2021-09-10 11:45:29 -05:00
Naveen Albert 698604a064 res_tonedetect: Tone detection module
dsp.c contains arbitrary tone detection functionality
which is currently only used for fax tone recognition.
This change makes this functionality publicly
accessible so that other modules can take advantage
of this.

Additionally, a WaitForTone and TONE_DETECT app and
function are included to allow users to do their
own tone detection operations in the dialplan.

ASTERISK-29546

Change-Id: Ie38c395000f4fd4d04e942e8658e177f8f499b26
2021-09-10 11:08:47 -05:00
George Joseph 9a9e5f0f25 res_snmp: Add -fPIC to _ASTCFLAGS
With gcc 11, res/res_snmp.c and res/snmp/agent.c need the
-fPIC option added to its _ASTCFLAGS.

ASTERISK-29634

Change-Id: I34649c85e075fd954e578378fabf798c3f038f50
2021-09-10 10:38:49 -05:00
Sean Bright 7a7b9e47ca term.c: Add support for extended number format terminfo files.
ncurses 6.1 introduced an extended number format for terminfo files
which the terminfo parsing in Asterisk is not able to parse. This
results in some TERM values that do support color (screen-256color on
Ubuntu 20.04 for example) to not get a color console.

ASTERISK-29630 #close

Change-Id: I27a4fcfab502219924af2d6b1c46feba92903cb3
2021-09-09 06:49:01 -05:00
Sean Bright 5c28f881aa app_voicemail.c: Ability to silence instructions if greeting is present.
There is an option to silence voicemail instructions but it does not
take into consideration if a recorded greeting exists or not. Add a
new 'S' option that does that.

ASTERISK-29632 #close

Change-Id: I03f2f043a9beb9d99deab302247e2a8686066fb4
2021-09-08 19:10:18 -05:00
Jasper Hafkenscheid 84ec6ab275 res_srtp: Disable parsing of not enabled cryptos
When compiled without extended srtp crypto suites also disable parsing
these from received SDP. This prevents using these, as some client
implementations are not stable.

ASTERISK-29625

Change-Id: I7dafb29be1cdaabdc984002573f4bea87520533a
2021-09-08 18:20:50 -05:00
Sean Bright fb72158f46 dns.c: Load IPv6 DNS resolvers if configured.
IPv6 nameserver addresses are stored in different part of the
__res_state structure, so look there if we appear to have support for
it.

ASTERISK-28004 #close

Change-Id: I67067077d8a406ee996664518d9c8fbf11f6977d
2021-09-08 18:17:53 -05:00
George Joseph e4de46e847 bridge_softmix: Suppress error on topology change failure
There are conditions under which a failure to change topology
is expected so there's no need to print an ERROR message.

ASTERISK-29618
Reported by: Alexander

Change-Id: Idc168b8588e018bf3a23769f08c4ad646086d481
2021-09-08 06:52:43 -06:00
sungtae kim f9b8a3a8c8 resource_channels.c: Fix wrong external media parameter parse
Fixed ARI external media handler to accept body parameters.

ASTERISK-29622

Change-Id: I49509c48a6cbc0fb4165bfa4f834b5e8b9ace20d
2021-09-02 15:09:52 -05:00
Sean Bright 1bd642db7f config_options: Handle ACO arrays correctly in generated XML docs.
There are 3 separate changes here but they are all closely related:

* Only try to set matchfield attributes on 'field' nodes

* We need to adjust how we treat the category pointer based on the
  value of the category_match, to avoid memory corruption. We now
  generate a regex-like string when match types other than
  ACO_WHITELIST and ACO_BLACKLIST are used.

* Switch app_agent_pool from ACO_BLACKLIST_ARRAY to
  ACO_BLACKLIST_EXACT since we only have one category we need to
  ignore, not two.

ASTERISK-29614 #close

Change-Id: I7be7bdb1bb9814f942bc6bb4fdd0a55a7b7efe1e
2021-09-02 15:09:29 -05:00
Naveen Albert 38cc3160d3 chan_iax2: Add ANI2/OLI information element
Adds an information element for ANI2 so that
Originating Line Information can be transmitted
over IAX2 channels.

ASTERISK-29605 #close

Change-Id: Iaeacdf6ccde18eaff7f776a0f49fee87dcb549d2
2021-09-02 14:16:50 -05:00
Mark Murawski efcde5c582 pbx_ael: Fix crash and lockup issue regarding 'ael reload'
Currently pbx_ael does not check if a reload is currently pending
before proceeding with a reload. This can cause multiple threads to
operate at the same time on what should be mutex protected data. This
change adds protection to reloading to ensure only one ael reload is
executing at a time.

ASTERISK-29609 #close

Change-Id: I5ed392ad226f6e4e7696ad742076d3e45c57af35
2021-09-02 14:15:57 -05:00
Naveen Albert c5c5171ec8 app_read: Allow reading # as a digit
Allows for the digit # to be read as a digit,
just like any other DTMF digit, as opposed to
forcing it to be used as an end of input
indicator. The default behavior remains
unchanged.

ASTERISK-18454 #close

Change-Id: I3033432adb9d296ad227e76b540b8b4a2417665b
2021-09-01 10:30:51 -05:00
Sebastien Duthil 166556961b res_rtp_asterisk: Automatically refresh stunaddr from DNS
This allows the STUN server to change its IP address without having to
reload the res_rtp_asterisk module.

The refresh of the name resolution occurs first when the module is
loaded, then recurringly, slightly after the previous DNS answer TTL
expires.

ASTERISK-29508 #close

Change-Id: I7955a046293f913ba121bbd82153b04439e3465f
2021-09-01 10:29:09 -05:00
Naveen Albert 220ce865db app_queue: Don't reset queue stats on reload
Prevents reloads of app_queue from also resetting
queue statistics.

Also preserves individual queue agent statistics
if we're just reloading members.

ASTERISK-28701

Change-Id: Ib5d4cdec175e44de38ef0f6ede4a7701751766f1
2021-08-30 07:26:56 -05:00
Naveen Albert 398a686fac bridge_basic: Change warning to verbose if transfer cancelled
The attended transfer feature will emit a warning if the user
cancels the transfer or the attended transfer doesn't complete
for any reason. Changes the warning to a verbose message,
since nothing is actually wrong here.

ASTERISK-29612 #close

Change-Id: I64c93cdb21360a0a8d45e9cb6db3af8168f66e6d
2021-08-26 08:51:43 -05:00
Alexander Traud f516c57401 res_rtp_asterisk: sqrt(.) requires the header math.h.
ASTERISK-29616

Change-Id: I6c01623926bf10ccac32612687a50fdab3ba0900
2021-08-25 18:03:55 -05:00
Alexander Traud e2fe0a049a dialplan: Add one static and fix two whitespace errors.
Change-Id: Ia14d515ab63e773097adc6af772ca7123a392f83
2021-08-25 09:31:51 -05:00
Sarah Autumn b731b810b9 sig_analog: Changes to improve electromechanical signalling compatibility
This changeset is intended to address compatibility issues encountered
when interfacing Asterisk to electromechanical telephone switches that
implement ANI-B, ANI-C, or ANI-D.

In particular the behaviours that this impacts include:

 - FGC-CAMA did not work at all when using MF signaling. Modified the
   switch case block to send calls to the correct part of the
   signaling-handling state machine.

 - For FGC-CAMA operation, the delay between called number ST and
   second wink for ANI spill has been made configurable; previously
   all calls were made to wait for one full second.

 - After the ANI spill, previous behavior was to require a 'ST' tone
   to advance the call.  This has been changed to allow 'STP' 'ST2P'
   or 'ST3P' as well, for compatibility with ANI-D.

 - Store ANI2 (ANI INFO) digits in the CALLERID(ANI2) channel variable.

 - For calls with an ANI failure, No. 1 Crossbar switches will send
   forward a single-digit failure code, with no calling number digits
   and no ST pulse to terminate the spill.  I've made the ANI timeout
   configurable so to reduce dead air time on calls with ANI fail.

 - ANI info digits configurable.  Modern digital switches will send 2
   digits, but ANI-B sends only a single info digit.  This caused the
   ANI reported by Asterisk to be misaligned.

 - Changed a confusing log message to be more informative.

ASTERISK-29518

Change-Id: Ib7e27d987aee4ed9bc3663c57ef413e21b404256
2021-08-20 15:30:30 -05:00
Andre Barbosa f57fc18657 media_cache: Don't lock when curl the remote file
When playing a remote sound file, which is not in cache, first we need
to download it with ast_bucket_file_retrieve.

This can take a while if the remote host is slow. The current CURL
timeout is 180secs, so in extreme situations, it can take 3 minutes to
return.

Because ast_media_cache_retrieve has a lock on all function, while we
are waiting for the delayed download, Asterisk is not able to play any
more files, even the files already cached locally.

ASTERISK-29544 #close

Change-Id: I8d4142b463ae4a1d4c41bff2bf63324821567408
2021-08-20 11:47:31 -05:00
George Joseph 18c467686c res_pjproject: Allow mapping to Asterisk TRACE level
Allow mapping pjproject log messages to the Asterisk TRACE
log level.  The defaults were also changes to log pjproject
levels 3,4 to DEBUG and 5,6 to TRACE.  Previously 3,4,5,6
all went to DEBUG.

ASTERISK-29582

Change-Id: I859a37a8dec263ed68099709cfbd3e665324c72d
2021-08-20 09:49:41 -05:00
Naveen Albert 9ee7b884f1 app_milliwatt: Timing fix
The Milliwatt application uses incorrect tone timings
that cause it to play the 1004 Hz tone constantly.

This adds an option to enable the correct timing
behavior, so that the Milliwatt application can
be used for milliwatt test lines. The default behavior
remains unchanged for compatability reasons, even
though it is incorrect.

ASTERISK-29575 #close

Change-Id: I73ccc6c6fcaa31931c6fff3b85ad1805b2ce9d8c
2021-08-19 11:17:48 -05:00
Naveen Albert 7f4433f8c6 app_morsecode: Add American Morse code
Previously, the Morsecode application only supported international
Morse code. This adds support for American Morse code and adds an
option to configure the frequency used in off intervals.

Additionally, the application checks for hangup between tones
to prevent application execution from continuing after hangup.

ASTERISK-29541

Change-Id: I172431a2e18e6527d577e74adfb05b154cba7bd4
2021-08-19 11:15:02 -05:00
Naveen Albert 4bd5757123 func_math: Return integer instead of float if possible
The MIN, MAX, and ABS functions all support float
arguments, but currently return floats even if the
arguments are all integers and the response is
a whole number, in which case the user is likely
expecting an integer. This casts the float to an integer
before printing into the response buffer if possible.

ASTERISK-29495

Change-Id: I902d29eacf3ecd0f8a6a5e433c97f0421d205488
2021-08-19 11:13:04 -05:00
Naveen Albert 1055660252 func_scramble: Audio scrambler function
Adds a function to scramble audio on a channel using
whole spectrum frequency inversion. This can be used
as a privacy enhancement with applications like
ChanSpy or other potentially sensitive audio.

ASTERISK-29542

Change-Id: I01020769d91060a1f56a708eb405f87648d1a67e
2021-08-19 09:54:20 -05:00
Naveen Albert 4606fb604a app_originate: Add ability to set codecs
A list of codecs to use for dialplan-originated calls can
now be specified in Originate, similar to the ability
in call files and the manager action.

Additionally, we now default to just using the slin codec
for originated calls, rather than all the slin* codecs up
through slin192, which has been known to cause issues
and inconsistencies from AMI and call file behavior.

ASTERISK-29543

Change-Id: I96a1aeb83d54b635b7a51e1b4680f03791622883
2021-08-19 09:09:42 -05:00
Alexander Traud 478c4fa588 BuildSystem: Remove two dead exceptions for compiler Clang.
Commit 305ce3d added -Wno-parentheses-equality to Makefile.rules,
turning the previous two warning suppressions from commit e9520db
redundant. Let us remove the latter.

Change-Id: I0b471254b31e6e05902062761dded4b3e626c7ac
2021-08-19 08:40:55 -05:00
Sean Bright b02538de2e mgcp: Remove dead debug code
ASTERISK-20339 #close

Change-Id: I36f364aaa1971241d8f3ea1a5909b463d185a2d5
2021-08-16 12:33:19 -05:00
Joshua C. Colp 68adc2304f policy: Add deprecation and removal versions to modules.
app_meetme is deprecated in 19, to be removed in 21.
app_osplookup is deprecated in 19, to be removed in 21.
chan_alsa is deprecated in 19, to be removed in 21.
chan_mgcp is deprecated in 19, to be removed in 21.
chan_skinny is deprecated in 19, to be removed in 21.
res_pktccops is deprecated in 19, to be removed in 21.
cdr_mysql was deprecated in 1.8, to be removed in 19.
app_mysql was deprecated in 1.8, to be removed in 19.
app_ices was deprecated in 16, to be removed in 19.
app_macro was deprecated in 16, to be removed in 21.
app_fax was deprecated in 16, to be removed in 19.
app_url was deprecated in 16, to be removed in 19.
app_image was deprecated in 16, to be removed in 19.
app_nbscat was deprecated in 16, to be removed in 19.
app_dahdiras was deprecated in 16, to be removed in 19.
cdr_syslog was deprecated in 16, to be removed in 19.
chan_oss was deprecated in 16, to be removed in 19.
chan_phone was deprecated in 16, to be removed in 19.
chan_sip was deprecated in 17, to be removed in 21.
chan_nbs was deprecated in 16, to be removed in 19.
chan_misdn was deprecated in 16, to be removed in 19.
chan_vpb was deprecated in 16, to be removed in 19.
res_config_sqlite was deprecated in 16, to be removed in 19.
res_monitor was deprecated in 16, to be removed in 21.
conf2ael was deprecated in 16, to be removed in 19.
muted was deprecated in 16, to be removed in 19.

ASTERISK-29548
ASTERISK-29549
ASTERISK-29550
ASTERISK-29551
ASTERISK-29552
ASTERISK-29553
ASTERISK-29554
ASTERISK-29555
ASTERISK-29557
ASTERISK-29558
ASTERISK-29559
ASTERISK-29560
ASTERISK-29561
ASTERISK-29562
ASTERISK-29563
ASTERISK-29564
ASTERISK-29565
ASTERISK-29566
ASTERISK-29567
ASTERISK-29568
ASTERISK-29569
ASTERISK-29570
ASTERISK-29571
ASTERISK-29572
ASTERISK-29573
ASTERISK-29574

Change-Id: Ic3bee31a10d42c4b3bbc913d893f7b2a28a27131
2021-08-16 11:48:40 -05:00
Asterisk Development Team 4bf9b2d279 Update CHANGES and UPGRADE.txt for 16.20.0 2021-08-12 10:56:21 -05:00
Naveen Albert af17973bda func_frame_drop: New function
Adds function to selectively drop specified frames
in the TX or RX direction on a channel, including
control frames.

ASTERISK-29478

Change-Id: I8147c9d55d74e2e48861edba6b22f930920541ec
2021-08-09 07:49:21 -05:00
Alexander Traud 9a225692fe aelparse: Accept an included context with timings.
With Asterisk 1.6.0, in the main parser for the configuration file
extensions.conf, the separator was changed from vertical bar to comma.
However, the first separator was not changed in aelparse; it still had
to be a vertical bar, and no comma was allowed.

Additionally, this change allows the vertical bar for the first and
last parameter again, even in the main parser, because the vertical bar
was still accepted for the other parameters.

ASTERISK-29540

Change-Id: I882e17c73adf4bf2f20f9046390860d04a9f8d81
2021-08-06 09:19:52 -05:00
Kevin Harwell b2aab2891c format_ogg_speex: Implement a "not supported" write handler
This format did not specify a "write" handler, so when attempting to write
to it (ast_writestream) a crash would occur.

This patch adds a default handler that simply issues a "not supported"
warning, thus no longer crashing.

ASTERISK-29539

Change-Id: I8f6ddc7cc3b15da30803be3b1cf68e2ba0fbce91
2021-08-06 07:52:28 -05:00
Naveen Albert 75c01f4bef cdr_adaptive_odbc: Prevent filter warnings
Previously, if CDR filters were used so that
not all CDR records used all sections defined
in cdr_adaptive_odbc.conf, then warnings will
always be emitted (if each CDR record is unique
to a particular section, n-1 warnings to be
specific).

This turns the offending warning log into
a verbose message like the other one, since
this behavior is intentional and not
indicative of anything wrong.

ASTERISK-29494

Change-Id: Ifd314fa9298722bc99494d5ca2658a5caa94a5f8
2021-08-04 07:59:46 -05:00
Naveen Albert 1298c02665 app_queue: Allow streaming multiple announcement files
Allows multiple files comprising an agent announcement
to be played by separating on the ampersand, similar
to the multi-file support in other Asterisk applications.

ASTERISK-29528

Change-Id: Iec600d8cd5ba14aa1e4e37f906accb356cd7891a
2021-08-04 07:47:17 -05:00
Igor Goncharovsky 8da1466478 res_pjsip_header_funcs: Add PJSIP_HEADERS() ability to read header by pattern
PJSIP currently does not provide a function to replace SIP_HEADERS() function to get a list of headers from INVITE request.
It may be used to get all X- headers in case the actual set and names of headers unknown.

ASTERISK-29389

Change-Id: Ic09d395de71a0021e0d6c5c29e1e19d689079f8b
2021-08-03 09:40:04 -05:00
Rijnhard Hessel b40e97b1d7 res_statsd: handle non-standard meter type safely
Meter types are not well supported,
lacking support in telegraf, datadog and the official statsd servers.
We deprecate meters and provide a compliant fallback for any existing usages.

A flag has been introduced to allow meters to fallback to counters.


ASTERISK-29513

Change-Id: I5fcb385983a1b88f03696ff30a26b55c546a1dd7
2021-08-03 08:44:45 -05:00
Naveen Albert 0460e77e51 app_dtmfstore: New application to store digits
Adds application to asynchronously collect digits
dialed on a channel in the TX or RX direction
using a framehook and stores them in a specified
variable, up to a configurable number of digits.

ASTERISK-29477

Change-Id: I51aa93fc9507f7636ac44806c4420ce690423e6f
2021-08-02 14:33:21 -05:00
under 56e6486aa6 codec_builtin.c: G729 audio gets corrupted by Asterisk due to smoother
If Asterisk gets G.729 6-byte VAD frames inbound, then at outbound Asterisk sends this G.729 stream with non-continuous timestamps.
This makes the audio stream not-playable at the receiver side.
Linphone isn't able to play such an audio - lots of disruptions are heard.
Also I had complains of bad audio from users which use other types of phones.

After debugging, I found this is a regression connected with RTP Smoother (main/smoother.c).

Smoother has a special code to handle G.729 VAD frames (search for AST_SMOOTHER_FLAG_G729 in smoother.c).

However, this flag is never set in Asterisk-12 and newer.
Previously it has been set (see Asterisk-11).

ASTERISK-29526 #close

Change-Id: I6f51ecb1a3ecd9c6d59ec5a6811a27446e17065d
2021-08-02 14:10:15 -05:00
Joshua C. Colp aec2087d25 docs: Remove embedded macro in WaitForCond XML documentation.
Change-Id: I40c6514e1843e320f3cbe0b2c70d4a98c0e35b9c
2021-07-27 09:54:59 -03:00
Asterisk Development Team b7f0d83698 Update CHANGES and UPGRADE.txt for 16.19.1 2021-07-22 16:53:50 -05:00
Kevin Harwell 7168aaf0dd AST-2021-009 - pjproject-bundled: Avoid crash during handshake for TLS
If an SSL socket parent/listener was destroyed during the handshake,
depending on timing, it was possible for the handling callback to
attempt access of it after the fact thus causing a crash.

ASTERISK-29415 #close

Change-Id: I105dacdcd130ea7fdd4cf2010ccf35b5eaf1432d
2021-07-22 16:20:01 -05:00
Kevin Harwell dbfde090ea AST-2021-008 - chan_iax2: remote crash on unsupported media format
If chan_iax2 received a packet with an unsupported media format, for
example vp9, then it would set the frame's format to NULL. This could
then result in a crash later when an attempt was made to access the
format.

This patch makes it so chan_iax2 now ignores/drops frames received
with unsupported media format types.

ASTERISK-29392 #close

Change-Id: Ifa869a90dafe33eed8fd9463574fe6f1c0ad3eb1
2021-07-22 16:16:37 -05:00
Joshua C. Colp 662e731b33 AST-2021-007 - res_pjsip_session: Don't offer if no channel exists.
If a re-INVITE is received after we have sent a BYE request then it
is possible for no channel to be present on the session. If this
occurs we allow PJSIP to produce the offer instead. Since the call
is being hung up if it produces an incorrect offer it doesn't
actually matter. This also ensures that code which produces SDP
does not need to handle if a channel is not present.

ASTERISK-29381

Change-Id: I673cb88c432f38f69b2e0851d55cc57a62236042
2021-07-22 13:13:55 -05:00
Andre Barbosa e52fd18c80 res_stasis_playback: Check for chan hangup on play_on_channels
Verify `ast_check_hangup` before looping to the next sound file.
If the call is already hangup we just break the cycle.
It also ensures that the PlaybackFinished event is sent if the call was hangup.

This is also use-full when we are playing a big list of file for a channel that is hangup.
Before this patch Asterisk will give a warning for every sound not played and fire a PlaybackStart for every sound file on the list tried to be played.

With the patch we just break the playback cycle when the chan is hangup.

ASTERISK-29501 #close

Change-Id: Ic4e1c01b974c9a1f2d9678c9d6b380bcfc69feb8
2021-07-20 03:00:26 -05:00
Sean Bright c86b4c573b res_pjsip_stir_shaken: RFC 8225 compliance and error message cleanup.
From RFC 8225 Section 5.2.1:

    The "dest" claim is a JSON object with the claim name of "dest"
    and MUST have at least one identity claim object.  The "dest"
    claim value is an array containing one or more identity claim JSON
    objects representing the destination identities of any type
    (currently "tn" or "uri").  If the "dest" claim value array
    contains both "tn" and "uri" claim names, the JSON object should
    list the "tn" array first and the "uri" array second.  Within the
    "tn" and "uri" arrays, the identity strings should be put in
    lexicographical order, including the scheme-specific portion of
    the URI characters.

Additionally, make it clear that there was a failure to sign the JWT
payload and not necessarily a memory allocation failure.

Change-Id: Ia8733b861aef6edfaa9c2136e97b447a01578dc9
2021-07-19 10:48:29 -05:00
Sebastien Duthil acc3b8ba75 stun: Emit warning message when STUN request times out
Without this message, it is not obvious that the reason is STUN timeout.

ASTERISK-29507 #close

Change-Id: I26e4853c23a1aed324552e1b9683ea3c05cb1f74
2021-07-19 06:54:55 -05:00
Sean Bright 68dbcd5ef5 res_http_media_cache.c: Parse media URLs to find extensions.
Use the URI parsing functions to parse playback URLs in order to find
their file extensions.

For backwards compatibility, we first look at the full URL, then at
any Content-Type header, and finally at just the path portion of the
URL.

ASTERISK-27871 #close

Change-Id: I16d0682f6d794be96539261b3e48f237909139cb
2021-07-16 17:10:39 -05:00
Sean Bright f0fd0e7675 main/cdr.c: Correct Party A selection.
This appears to just have been a copy/paste error from 6258bbe7. Fix
suggested by Ross Beer in ASTERISK~29166.

Change-Id: I51e0de92042e53f37597c6f83a75621ef0d1ae37
2021-07-16 10:23:54 -05:00
Naveen Albert cb67bc2ebb app_reload: New Reload application
Adds an application to reload modules
from within the dialplan.

ASTERISK-29454

Change-Id: Ic8ab025d8b38dd525b872b41c465c999c5810774
2021-07-15 10:05:20 -05:00
Sean Bright 6f135c0ef4 res_pjsip_config_wizard.c: Add port matching support.
In f8b0c2c9 we added support for port numbers in 'match' statements
but neglected to include that support in the PJSIP config wizard.

The removed code would have also prevented IPv6 addresses from being
successfully used in the config wizard as well.

ASTERISK-29503 #close

Change-Id: Idd5bbfd48009e7a741757743dbaea68e2835a34d
2021-07-08 10:31:07 -05:00
Naveen Albert 7bc9a05059 app_waitforcond: New application
While several applications exist to wait for
a certain event to occur, none allow waiting
for any generic expression to become true.
This application allows for waiting for a condition
to become true, with configurable timeout and
checking interval.

ASTERISK-29444

Change-Id: I08adf2824b8bc63405778cf355963b5005612f41
2021-07-08 10:29:49 -05:00
Andre Barbosa 884d863c08 res_stasis_playback: Send PlaybackFinish event only once for errors
When we try to play a list of sound files in the same Play command,
we get only one PlaybackFinish event, after all sounds are played.

But in the case where the Play fails (because channel is destroyed
for example), Asterisk will send one PlaybackFinish event for each
sound file still to be played. If the list is big, Asterisk is
sending many events.

This patch adds a failed state so we can understand that the play
failed. On that case we don't send the event, if we still have a
list of sounds to be played.

When we reach the last sound, we send the PlaybackFinish with
the failed state.

ASTERISK-29464 #close

Change-Id: I4c2e5921cc597702513af0d7c6c2c982e1798322
2021-06-24 08:54:20 -05:00
George Joseph 987eb8a5ea jitterbuffer: Correct signed/unsigned mismatch causing assert
If the system time has stepped backwards because of a time
adjustment between the time a frame is timestamped and the
time we check the timestamps in abstract_jb:hook_event_cb(),
we get a negative interval, but we don't check for that there.
abstract_jb:hook_event_cb() then calls
fixedjitterbuffer:fixed_jb_get() (via abstract_jb:jb_get_fixed)
and the first thing that does is assert(interval >= 0).

There are several issues with this...

 * abstract_jb:hook_event_cb() saves the interval in a variable
   named "now" which is confusing in itself.

 * "now" is defined as an unsigned int which converts the negative
   value returned from ast_tvdiff_ms() to a large positive value.

 * fixed_jb_get()'s parameter is defined as a signed int so the
   interval gets converted back to a negative value.

 * fixed_jb_get()'s assert is NOT an ast_assert but a direct define
   that points to the system assert() so it triggers even in
   production mode.

So...

 * hook_event_cb()'s "now" was renamed to "relative_frame_start" and
   changed to an int64_t.
 * hook_event_cb() now checks for a negative value right after
   retrieving both the current and framedata timestamps and just
   returns the frame if the difference is negative.
 * fixed_jb_get()'s local define of ASSERT() was changed to call
   ast_assert() instead of the system assert().

ASTERISK-29480
Reported by: Dan Cropp

Change-Id: Ic469dec73c2edc3ba134cda6721a999a9714f3c9
2021-06-24 08:19:49 -05:00
Naveen Albert bee710121e app_dial: Expanded A option to add caller announcement
Hitherto, the A option has made it possible to play
audio upon answer to the called party only. This option
is expanded to allow for playback of an audio file to
the caller instead of or in addition to the audio
played to the answerer.

ASTERISK-29442

Change-Id: If6eed3ff5c341dc8c588c8210987f2571e891e5e
2021-06-23 09:36:23 -05:00
Joshua C. Colp 4470838d89 core: Don't play silence for Busy() and Congestion() applications.
When using the Busy() and Congestion() applications the
function ast_safe_sleep is used by wait_for_hangup to safely
wait on the channel. This function may send silence if Asterisk
is configured to do so using the transmit_silence option.

In a scenario where an answered channel dials a Local channel
either directly or through call forwarding and the Busy()
or Congestion() dialplan applications were executed with the
transmit_silence option enabled the busy or congestion
tone would not be heard.

This is because inband generation of tones (such as busy
and congestion) is stopped when other audio is sent to
the channel they are being played to. In the given
scenario the transmit_silence option would result in
silence being sent to the channel, thus stopping the
inband generation.

This change adds a variant of ast_safe_sleep which can be
used when silence should not be played to the channel. The
wait_for_hangup function has been updated to use this
resulting in the tones being generated as expected.

ASTERISK-29485

Change-Id: I066bfc987a3ad6f0ccc88e0af4cd63f6a4729133
2021-06-22 09:47:01 -05:00
Bernd Zobl 1b8f9a08d9 res_pjsip_sdp_rtp: Evaluate remotely held for Session Progress
With the fix for ASTERISK_28754 channels are no longer put on hold if an
outbound INVITE is answered with a "Session Progress" containing
"inactive" audio.

The previous change moved the evaluation of the media attributes to
`negotiate_incoming_sdp_stream()` to have the `remotely_held` status
available when building the SDP in `create_outgoing_sdp_stream()`.
This however means that an answer to an outbound INVITE, which does not
traverse `negotiate_incoming_sdp_stream()`, cannot set the
`remotely_held` status anymore.

This change moves the check so that both, `negotiate_incoming_sdp_stream()` and
`apply_negotiated_sdp_stream()` can do the checks.

ASTERISK-29479

Change-Id: Icde805a819399d5123b688e1ed1d2bcd9d5b0f75
2021-06-22 08:06:30 -05:00
Asterisk Development Team d41c4db68d Update CHANGES and UPGRADE.txt for 16.19.0 2021-06-17 09:38:32 -05:00
George Joseph b6bf6d091e res_pjsip_messaging: Overwrite user in existing contact URI
When the MessageSend destination is in the form
PJSIP/<number>@<endpoint> and the endpoint's contact
URI already has a user component, that user component
will now be replaced with <number> when creating the
request URI.

ASTERISK_29404

Change-Id: I80e5910fa25c803d1440da0594a0d6b34b6b4ad5
2021-06-16 08:28:19 -06:00
Bernd Zobl fe40c3cc74 res_pjsip/pjsip_message_filter: set preferred transport in pjsip_message_filter
Set preferred transport when querying the local address to use in
filter_on_tx_messages(). This prevents the module to erroneously select
the wrong transport if more than one transports of the same type (TCP or
TLS) are configured.

ASTERISK-29241

Change-Id: I598e60257a7f92b29efce1fb3e9a2fc06f1439b6
2021-06-15 09:11:48 -05:00
Naveen Albert 80be0edae7 pbx_builtins: Corrects SayNumber warning
Previously, SayNumber always emitted a warning if the caller hung up
during execution. Usually this isn't correct, so check if the channel
hung up and, if so, don't emit a warning.

ASTERISK-29475

Change-Id: Ieea4a67301c6ea83bbc7690c1d4808d79a704594
2021-06-15 09:01:36 -05:00
Jaco Kroon 2dbf8cd135 func_lock: Add "dialplan locks show" cli command.
For example:

arthur*CLI> dialplan locks show
func_lock locks:
Name                                     Requesters Owner
uls-autoref                              0          (unlocked)
1 total locks listed.

Obviously other potentially useful stats could be added (eg, how many
times there was contention, how many times it failed etc ... but that
would require keeping the stats and I'm not convinced that's worth the
effort.  This was useful to troubleshoot some other issues so submitting
it.

Change-Id: Ib875e56feb49d523300aec5f36c635ed74843a9f
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-06-11 13:26:39 -05:00
Jaco Kroon 5d7d174e1f func_lock: Prevent module unloading in-use module.
The scenario where a channel still has an associated datastore we
cannot unload since there is a function pointer to the destroy and fixup
functions in play.  Thus increase the module ref count whenever we
allocate a datastore, and decrease it during destroy.

In order to tighten the race that still exists in spite of this (below)
add some extra failure cases to prevent allocations in these cases.

Race:

If module ref is zero, an LOCK or TRYLOCK is invoked (near)
simultaneously on a channel that has NOT PREVIOUSLY taken a lock, and if
in such a case the datastore is created *prior* to unloading being set
to true (first step in module unload) then it's possible that the module
will unload with the destructor being called (and segfault) post the
module being unloaded.  The module will however wait for such locks to
release prior to unloading.

If post that we can recheck the module ref before returning the we can
(in theory, I think) eliminate the last of the race.  This race is
mostly theoretical in nature.

Change-Id: I21a514a0b56755c578a687f4867eacb8b59e23cf
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-06-11 13:24:47 -05:00
Jaco Kroon 4040095ea4 func_lock: Fix memory corruption during unload.
AST_TRAVERSE accessess current as current = current->(field).next ...
and since we free current (and ast_free poisons the memory) we either
end up on a ast_mutex_lock to a non-existing lock that can never be
obtained, or a segfault.

Incidentally add logging in the "we have to wait for a lock to release"
case, and remove an ineffective statement that sets memory that was just
cleared by ast_calloc to zero.

Change-Id: Id19ba3d9867b23d0e6783b97e6ecd8e62698b8c3
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-06-11 13:04:57 -05:00
Jaco Kroon 5008d9fee1 func_lock: Fix requesters counter in error paths.
In two places we bail out with failure after we've already incremented
the requesters counter, if this occured then it would effectively result
in unload to wait indefinitely, thus preventing clean shutdown.

Change-Id: I362a6c0dc424f736d4a9c733d818e72d19675283
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-06-11 13:02:45 -05:00
Naveen Albert b4e77b7f10 app_originate: Allow setting Caller ID and variables
Caller ID can now be set on the called channel and
Variables can now be set on the destination
using the Originate application, just as
they can be currently using call files
or the Manager Action.

ASTERISK-29450

Change-Id: Ia64cfe97d2792bcbf4775b3126cad662922a8b66
2021-06-11 11:29:58 -05:00
Sean Bright e824138a26 menuselect: Fix description of several modules.
The text description needs to be the last thing on the AST_MODULE_INFO
line to be pulled in properly by menuselect.

Change-Id: I0c913e36fea8b661f42e56920b6c5513ae8fd832
2021-06-10 17:28:43 -04:00
Naveen Albert 2c2dc7d97d app_confbridge: New ConfKick() application
Adds a new ConfKick() application, which may
be used to kick a specific channel, all channels,
or all non-admin channels from a specified
conference bridge, similar to existing CLI and
AMI commands.

ASTERISK-29446

Change-Id: I5d96b683880bfdd27b2ab1c3f2e897c5046ded9b
2021-06-08 16:39:41 -05:00
Naveen Albert 17b9c5c5cf res_pjsip_dtmf_info: Hook flash
Adds hook flash recognition support
for application/hook-flash.

ASTERISK-29460

Change-Id: I1d060fa89a7cf41244c98f892fff44eb1c9738ea
2021-06-08 15:45:38 -05:00
Naveen Albert 2376425785 sip_to_pjsip: Fix missing cases
Adds the "auto" case which is valid with
both chan_sip dtmfmode and chan_pjsip's
dtmf_mode, adds subscribecontext to
subscribe_context conversion, and accounts
for cipher = ALL being invalid.

ASTERISK-29459

Change-Id: Ie27d6606efad3591038000e5f3c34fa94730f6f2
2021-06-08 15:17:04 -05:00
Naveen Albert 95f588496d app_confbridge: New option to prevent answer supervision
A new user option, answer_channel, adds the capability to
prevent answering the channel if it hasn't already been
answered yet.

ASTERISK-29440

Change-Id: I26642729d0345f178c7b8045506605c8402de54b
2021-06-08 14:46:11 -05:00
George Joseph 6cd89c4f0a res_pjsip_messaging: Refactor outgoing URI processing
* Implemented the new "to" parameter of the MessageSend()
   dialplan application.  This allows a user to specify
   a complete SIP "To" header separate from the Request URI.

 * Completely refactored the get_outbound_endpoint() function
   to actually handle all the destination combinations that
   we advertized as supporting.

 * We now also accept a destination in the same format
   as Dial()...  PJSIP/number@endpoint

 * Added lots of debugging.

ASTERISK-29404
Reported by Brian J. Murrell

Change-Id: I67a485196d9199916468f7f98bfb9a0b993a4cce
2021-05-27 10:15:19 -06:00
Naveen Albert 8236f2f155 func_math: Three new dialplan functions
Introduces three new dialplan functions, MIN and MAX,
which can be used to calculate the minimum or
maximum of up to two numbers, and ABS, an absolute
value function.

ASTERISK-29431

Change-Id: I2bda9269d18f9d54833c85e48e41fce0e0ce4d8d
2021-05-26 13:46:09 -05:00
Ben Ford cee88c9826 STIR/SHAKEN: Add Date header, dest->tn, and URL checking.
STIR/SHAKEN requires a Date header alongside the Identity header, so
that has been added. Still on the outgoing side, we were missing the
dest->tn section of the JSON payload, so that has been added as well.
Moving to the incoming side, URL checking has been added to the public
cert URL to ensure that it starts with http.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Idee5b1b5e45bc3b483b3070e46ce322dca5b3f1c
2021-05-26 12:46:10 -05:00
Joshua C. Colp e07fd35238 res_pjsip: On partial transport reload also move factories.
For connection oriented transports PJSIP uses factories to
produce transports. When doing a partial transport reload
we need to also move the factory of the transport over so
that anything referencing the transport (such as an endpoint)
has the factory available.

ASTERISK-29441

Change-Id: Ieae0fb98eab2d9257cad996a1136e5a62d307161
2021-05-26 11:31:29 -05:00
Naveen Albert d1305af137 func_volume: Add read capability to function.
Up until now, the VOLUME function has been write
only, so that TX/RX values can be set but not
read afterwards. Now, previously set TX/RX values
can be read later.

ASTERISK-29439

Change-Id: Ia23e92fa2e755c36e9c8e69f2940d2703ccccb5f
2021-05-26 11:25:07 -05:00
Joshua C. Colp bb8e868066 res_rtp_asterisk: Set correct raddr port on RTCP srflx candidates.
RTCP ICE candidates use a base address derived from the RTP
candidate. The port on the base address was not being updated to
the RTCP port.

This change sets the base port to the RTCP port and all is well.

ASTERISK-29433

Change-Id: Ide2d2115b307bfd3c2dfbc4d187515d724519040
2021-05-26 10:35:18 -05:00
Evgenios_Greek 6d5f087138 stasis: Fix "FRACK!, Failed assertion bad magic number" when unsubscribing
When unsubscribing from an endpoint technology a FRACK
would occur due to incorrect reference counting. This fixes
that issue, along with some other issues.

Fixed a typo in get_subscription when calling ao2_find as it
needed to pass the endpoint ID and not the entire object.

Fixed scenario where a subscription would get returned when
it shouldn't have been when searching based on endpoint
technology.

A doulbe unreference has also been resolved by only explicitly
releasing the reference held by tech_subscriptions.

ASTERISK-28237 #close
Reported by: Lucas Tardioli Silveira

Change-Id: Ia91b15f8e5ea68f850c66889a6325d9575901729
2021-05-26 10:34:42 -05:00
Joseph Nadiv a123e8cb0e res_pjsip.c: Support endpoints with domain info in username
In multidomain environments, it is desirable to create
PJSIP endpoints with the domain info in the endpoint name
in pjsip_endpoint.conf.  This resulted in an error with
registrations, NOTIFY, and OPTIONS packet generation.

This commit will detect if there is an @ in the endpoint
identifier and generate the URI accordingly so NOTIFY and
OPTIONS From headers will generate correctly.

ASTERISK-28393

Change-Id: I96f8d01dfdd5573ba7a28299e46271dd4210b619
2021-05-26 10:30:34 -05:00
Joshua C. Colp 0ee56cc2bd asterisk: We've moved to Libera Chat!
Change-Id: I48c1933dd79b50ddc0a6793acec4754b4e95c575
2021-05-25 07:38:58 -03:00
Jeremy Lainé 0cd5d5150a res_rtp_asterisk: make it possible to remove SOFTWARE attribute
By default Asterisk reports the PJSIP version in a SOFTWARE attribute
of every STUN packet it sends. This may not be desired in a production
environment, and RFC5389 recommends making the use of the SOFTWARE
attribute a configurable option:

https://datatracker.ietf.org/doc/html/rfc5389#section-16.1.2

This patch adds a `stun_software_attribute` yes/no option to make it
possible to omit the SOFTWARE attribute from STUN packets.

ASTERISK-29434

Change-Id: Id3f2b1dd9584536ebb3a1d7e8395fd8b3e46860b
2021-05-24 08:20:48 -05:00
George Joseph 7c0b8f0701 res_pjsip_outbound_authenticator_digest: Be tolerant of RFC8760 UASs
RFC7616 and RFC8760 allow more than one WWW-Authenticate or
Proxy-Authenticate header per realm, each with different digest
algorithms (including new ones like SHA-256 and SHA-512-256).
Thankfully however a UAS can NOT send back multiple Authenticate
headers for the same realm with the same digest algorithm.  The
UAS is also supposed to send the headers in order of preference
with the first one being the most preferred.  We're supposed to
send an Authorization header for the first one we encounter for a
realm that we can support.

The UAS can also send multiple realms, especially when it's a
proxy that has forked the request in which case the proxy will
aggregate all of the Authenticate headers and then send them all
back to the UAC.

It doesn't stop there though... Each realm can require a
different username from the others.  There's also nothing
preventing each digest algorithm from having a unique password
although I'm not sure if that adds any benefit.

So now... For each Authenticate header we encounter, we have to
determine if we support the digest algorithm and, if not, just
skip the header.  We then have to find an auth object that
matches the realm AND the digest algorithm or find a wildcard
object that matches the digest algorithm. If we find one, we add
it to the results vector and read the next Authenticate header.
If the next header is for the same realm AND we already added an
auth object for that realm, we skip the header. Otherwise we
repeat the process for the next header.

In the end, we'll have accumulated a list of credentials we can
pass to pjproject that it can use to add Authentication headers
to a request.

NOTE: Neither we nor pjproject can currently handle digest
algorithms other than MD5.  We don't even have a place for it in
the ast_sip_auth object. For this reason, we just skip processing
any Authenticate header that's not MD5.  When we support the
others, we'll move the check into the loop that searches the
objects.

Changes:

 * Added a new API ast_sip_retrieve_auths_vector() that takes in
   a vector of auth ids (usually supplied on a call to
   ast_sip_create_request_with_auth()) and populates another
   vector with the actual objects.

 * Refactored res_pjsip_outbound_authenticator_digest to handle
   multiple Authenticate headers and set the stage for handling
   additional digest algorithms.

 * Added a pjproject patch that allows them to ignore digest
   algorithms they don't support.  This patch has already been
   merged upstream.

 * Updated documentation for auth objects in the XML and
   in pjsip.conf.sample.

 * Although res_pjsip_authenticator_digest isn't affected
   by this change, some debugging and a testsuite AMI event
   was added to facilitate testing.

Discovered during OpenSIPit 2021.

ASTERISK-29397

Change-Id: I3aef5ce4fe1d27e48d61268520f284d15d650281
2021-05-21 06:59:57 -05:00
Joseph Nadiv 48851279a8 res_pjsip_dialog_info_body_generator: Add LOCAL/REMOTE tags in dialog-info+xml
RFC 4235 Section 4.1.6 describes XML elements that should be
sent to subscribed endpoints to identify the local and remote
participants in the dialog.

This patch adds this functionality to PJSIP by iterating through the
ringing channels causing the NOTIFY, and inserts the channel info
into the dialog so that information is properly passed to the endpoint
in dialog-info+xml.

ASTERISK-24601
Patch submitted: Joshua Elson
Modified by: Joseph Nadiv and Sean Bright
Tested by: Joseph Nadiv

Change-Id: I20c5cf5b45f34d7179df6573c5abf863eb72964b
2021-05-19 12:16:40 -05:00
Naveen Albert 10aa4f9876 app_voicemail: Configurable voicemail beep
Hitherto, VoiceMail() played a non-customizable beep tone to indicate
the caller could leave a message. In some cases, the beep may not
be desired, or a different tone may be desired.

To increase flexibility, a new option allows customization of the tone.
If the t option is specified, the default beep will be overridden.
Supplying an argument will cause it to use the specified file for the tone,
and omitting it will cause it to skip the beep altogether. If the option
is not used, the default behavior persists.

ASTERISK-29349

Change-Id: I1c439c0011497e28a28067fc1cf1e654c8843280
2021-05-19 08:03:12 -05:00
Naveen Albert ea117be4c6 AMI: Add AMI event to expose hook flash events
Although Asterisk can receive and propogate flash events, it currently
provides no mechanism for doing anything with them itself.

This AMI event allows flash events to be processed by Asterisk.
Additionally, AST_CONTROL_FLASH is included in a switch statement
in channel.c to avoid throwing a warning when we shouldn't.

ASTERISK-29380

Change-Id: Ie17ffe65086e0282c88542e38eed6a461ec79e81
2021-05-19 08:02:46 -05:00
Naveen Albert 859cd2a56b main/file.c: Don't throw error on flash event.
AST_CONTROL_FLASH isn't accounted for in a switch statement in file.c
where it should be ignored. Adding this to the switch ensures a
warning isn't thrown on RFC2833 flash events, since nothing's amiss.

ASTERISK-29372

Change-Id: I4fa549bfb7ba1894a4044de999ea124877422fbc
2021-05-17 08:55:11 -05:00
Joshua C. Colp 8f8b4e7e41 pjsip: Add patch for resolving STUN packet lifetime issues.
In some cases it was possible for a STUN packet to be destroyed
prematurely or even destroyed partially multiple times.

This patch provided by Teluu fixes the lifetime of these
packets and ensures they aren't partially destroyed multiple
times.

https://github.com/pjsip/pjproject/pull/2709

ASTERISK-29377

Change-Id: Ie842ad24ddf345e01c69a4d333023f05f787abca
2021-05-17 08:54:51 -05:00
Naveen Albert 11e61217a0 chan_sip: Expand hook flash recognition.
Some ATAs send hook flash events as application/hook-flash, rather than a DTMF
event. Now, we also recognize hook-flash as a flash event.

ASTERISK-29370

Change-Id: I1c3b82a040dff3affcd94bad8ce33edc90c04725
2021-05-13 09:50:02 -04:00
Sean Bright f557126998 chan_pjsip: Correct misleading trace message
ASTERISK-29358 #close

Change-Id: I050daff67066873df4e8fc7f4bd977c1ca06e647
2021-05-12 22:16:45 -04:00
Ben Ford 0b4b207076 STIR/SHAKEN: Switch to base64 URL encoding.
STIR/SHAKEN encodes using base64 URL format. Currently, we just use
base64. New functions have been added that convert to and from base64
encoding.

The origid field should also be an UUID. This means there's no reason to
have it as an option in stir_shaken.conf, as we can simply generate one
when creating the Identity header.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Icf094a2a54e87db91d6b12244c9f5ba4fc2e0b8c
2021-05-12 06:43:22 -05:00
Ben Ford d00bedba81 STIR/SHAKEN: OPENSSL_free serial hex from openssl.
We're getting the serial number of the certificate from openssl and
freeing it with ast_free(), but it needs to be freed with OPENSSL_free()
instead. Now we duplicate the string and free the one from openssl with
OPENSSL_free(), which means we can still use ast_free() on the returned
string.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Ia6e1a4028c1933a0e1d204b769ebb9f5a11f00ab
2021-05-11 13:16:06 -05:00
Ben Ford 184a027eaa STIR/SHAKEN: Fix certificate type and storage.
During OpenSIPit, we found out that the public certificates must be of
type X.509. When reading in public keys, we use the corresponding X.509
functions now.

We also discovered that we needed a better naming scheme for the
certificates since certificates with the same name would cause issues
(overwriting certs, etc.). Now when we download a public certificate, we
get the serial number from it and use that as the name of the cached
certificate.

The configuration option public_key_url in stir_shaken.conf has also
been renamed to public_cert_url, which better describes what the option
is for.

https://wiki.asterisk.org/wiki/display/AST/OpenSIPit+2021

Change-Id: Ia00b20835f5f976e3603797f2f2fb19672d8114d
2021-05-11 09:29:18 -05:00
George Joseph 63c25d3821 Updates for the MessageSend Dialplan App
Enhancements:

 * The MessageSend dialplan application now takes an optional
   third argument that can set the message's "To" field on
   outgoing messages.  It's an alternative to using the
   MESSAGE(to) dialplan function.

   NOTE: No channel driver currently implements this field.  A
   follow-on commit for res_pjsip_messaging will implement it for
   the chan_pjsip channel driver.

 * To prevent confusion with the first argument, currently named
   "to", it's been renamed to "destination". Its function,
   creating the request URI, hasn't changed.

 * The documentation for MessageSend was updated to be
   more clear about the parameters and how they interact
   the MESSAGE() dialplan function.

 * With the rename of MessageSend's first parameter, and the fact
   that message.c references <info> elements in chan_sip.c,
   res_pjsip_messaging.c and res_xmpp, they each needed
   documentation updates to use MessageDestinationInfo instead of
   MessageToInfo.

 * appdocsxml.dtd was updated to include a missing element
   declaration for "dataType".  This was showing up as an error
   in Eclipse's dtd editor.

 * Despite the changes in this commit, there should be
   no impact to current users of MessageSend.

Change-Id: I6fb5b569657a02866a66ea352fd53d30d8ac965a
2021-05-06 06:24:27 -05:00
Sean Bright d72c7d2d66 translate.c: Avoid refleak when checking for a translation path
Change-Id: Idbd61ff77545f4a78b06a5064b55112e774b70e6
2021-04-30 16:26:40 -04:00
Sean Bright 0eb5c58bd4 res_rtp_asterisk: More robust timestamp checking
We assume that a timestamp value of 0 represents an 'uninitialized'
timestamp, but 0 is a valid value. Add a simple wrapper to be able to
differentiate between whether the value is set or not.

This also removes the fix for ASTERISK~28812 which should not be
needed if we are checking the last timestamp appropriately.

ASTERISK-29030 #close

Change-Id: Ie70d657d580d9a1f2877e25a6ef161c5ad761cf7
2021-04-30 09:03:24 -05:00
Joshua C. Colp d2b8141d26 chan_local: Skip filtering audio formats on removed streams.
When a stream topology is provided to chan_local when dialing
it filters the audio formats down. This operation did not skip
streams which were removed (that have no formats) resulting in
calling being aborted.

This change causes such streams to be skipped.

ASTERISK-29407

Change-Id: I1de8b98727cb2d10f4bc287da0b5fdcb381addd6
2021-04-30 09:02:34 -05:00
Asterisk Development Team 0fd9c6588b Update CHANGES and UPGRADE.txt for 16.18.0 2021-04-29 10:22:40 -05:00
Sean Bright 5a2939a5d6 res_pjsip.c: OPTIONS processing can now optionally skip authentication
ASTERISK-27477 #close

Change-Id: I68f6715bba92a525149e35d142a49377a34a1193
2021-04-29 07:44:41 -05:00
Jean Aunis 080d0eb72c translate.c: Take sampling rate into account when checking codec's buffer size
Up/down sampling changes the number of samples produced by a translation.
This must be taken into account when checking the codec's buffer size.

ASTERISK-29328

Change-Id: I9aebe2f8788e00321a7f5c47aa97c617f39e9055
2021-04-28 01:15:13 -05:00
Joshua C. Colp c43094f1cb svn: Switch to https scheme.
Some versions of SVN seemingly don't follow the redirect
to https.

Change-Id: Ia7c76c18cb620bcf56f08e1211a7d80d321fe253
2021-04-25 06:45:57 -03:00
George Joseph 5ace782583 res_pjsip: Update documentation for the auth object
Change-Id: I2f76867ce02ec611964925159be099de83346e38
2021-04-20 07:47:25 -06:00
George Joseph a4a63db253 bridge_channel_write_frame: Check for NULL channel
There is a possibility, when bridge_channel_write_frame() is
called, that the bridge_channel->chan will be NULL.  The first
thing bridge_channel_write_frame() does though is call
ast_channel_is_multistream() which had no check for a NULL
channel and therefore caused a segfault. Since it's still
possible for bridge_channel_write_frame() to write the frame to
the other channels in the bridge, we don't want to bail before we
call ast_channel_is_multistream() but we can just skip the
multi-channel stuff.  So...

bridge_channel_write_frame() only calls ast_channel_is_multistream()
if bridge_channel->chan is not NULL.

As a safety measure, ast_channel_is_multistream() now returns
false if the supplied channel is NULL.

ASTERISK-29379
Reported-by: Vyrva Igor
Reported-by: Ross Beer

Change-Id: Idfe62dbea8c69813ecfd58e113a6620dc42352ce
2021-04-05 07:49:04 -05:00
Sean Bright 84115fe657 loader.c: Speed up deprecation metadata lookup
Only use an XPath query once per module, then just navigate the DOM for
everything else.

Change-Id: Ia0336a7185f9180ccba4b6f631a00f9a22a36e92
2021-04-01 11:38:09 -04:00
Joshua C. Colp a9e1e0e1c8 loader: Output warnings for deprecated modules.
Using the information from the MODULEINFO XML we can
now output useful information at the end of module
loading for deprecated modules. This includes the
version it was deprecated in, the version it will be
removed in, and the replacement if available.

ASTERISK-29339

Change-Id: I2080dab97d2186be94c421b41dabf6d79a11611a
2021-04-01 10:01:51 -05:00
Kevin Harwell bd426397bb res_rtp_asterisk: Fix standard deviation calculation
For some input to the standard deviation algorithm extremely large,
and wrong numbers were being calculated.

This patch uses a new formula for correctly calculating both the
running mean and standard deviation for the given inputs.

ASTERISK-29364 #close

Change-Id: Ibc6e18be41c28bed3fde06d612607acc3fbd621f
2021-04-01 07:59:26 -05:00
Kevin Harwell 473e648fca res_rtp_asterisk: Don't count 0 as a minimum lost packets
The calculated minimum lost packets represents the lowest number of
lost packets missed during an RTCP report interval. Zero of course
is the lowest, but the idea is that this value contain the lowest
number of lost packets once some have been missed.

This patch checks to make sure the number of lost packets over an
interval is not zero before checking and setting the minimum value.

Also, this patch updates the rtp lost packet test to check for
packet loss over several reports vs one.

Change-Id: I07d6e21cec61e289c2326138d6bcbcb3c3d5e008
2021-03-31 15:07:09 -05:00
Kevin Harwell 07f8456dcb res_rtp_asterisk: Statically declare rtp_drop_packets_data object
This patch makes the drop_packets_data object static.

Change-Id: If4f9b21fa0c47d41a35b6b05941d978efb4da87b
2021-03-31 15:01:41 -05:00
Joshua C. Colp 3d4564dc16 res_pjsip: Give error when TLS transport configured but not supported.
Change-Id: I058af496021ff870ccec2d8cbade637b348ab80b
2021-03-31 10:29:39 -05:00
Joshua C. Colp 8953152b97 res_rtp_asterisk: Only raise flash control frame on end.
Flash in RTP is conveyed the same as DTMF, just with a
specific digit. In Asterisk however we do flash as a
single control frame.

This change makes it so that only on end do we provide
the flash control frame to the core. Previously we would
provide a flash control frame on both begin and end,
causing flash to work improperly.

ASTERISK-29373

Change-Id: I1accd9c6e859811336e670e698bd8bd124f33226
2021-03-31 09:52:05 -05:00
Kevin Harwell d607afd8d3 res_rtp_asterisk: Add a DEVMODE RTP drop packets CLI command
This patch makes it so when Asterisk is compiled in DEVMODE a CLI
command is available that allows someone to drop incoming RTP
packets. The command allows for dropping of packets once, or on a
timed interval (e.g. drop 10 packets every 5 seconds). A user can
also specify to drop packets by IP address.

Change-Id: I25fa7ae9bad6ed68e273bbcccf0ee51cae6e7024
2021-03-31 09:31:44 -05:00
Kevin Harwell 20af6d23df time: Add timeval create and unit conversion functions
Added a TIME_UNIT enumeration, and a function that converts a
string to one of the enumerated values. Also, added functions
that create and initialize a timeval object using a specified
value, and unit type.

Change-Id: Ic31a1c3262a44f77a5ef78bfc85dcf69a8d47392
2021-03-31 09:19:56 -05:00
Sean Bright 72fb6fd757 app_queue: Add alembic migration to add ringinuse to queue_members.
ASTERISK-28356 #close

Change-Id: I53a1bfdd3113d620bea88349019173a2f3f0ae39
2021-03-30 04:41:25 -05:00
Ben Ford 464ecc1d82 logger.conf.sample: Add more debug documentation.
Change-Id: Iff0e713f2120d8dce8e1e26924b99ed17f9d9dff
2021-03-25 08:40:33 -05:00
Sean Bright cd090efde6 queues.conf.sample: Correct 'context' documentation.
ASTERISK-24631 #close

Change-Id: I8bf8776906a72ee02f24de6a85345940b9ff6b6f
2021-03-25 08:38:10 -05:00
Sean Bright 7215895590 app_queue.c: Remove dead 'updatecdr' code.
Also removed the sample documentation, and some oddly-placed
documentation about the timeout argument to the Queue() application
itself. There is a large section on the timeout behavior below.

ASTERISK-26614 #close

Change-Id: I8f84e8304b50305b7c4cba2d9787a5d77c3a6217
2021-03-23 16:23:04 -04:00
Mark Murawski 98d149b4ce logger: Console sessions will now respect logger.conf dateformat= option
The 'core' console (ie: asterisk -c) does read logger.conf and does
use the dateformat= option.

Whereas 'remote' consoles (ie: asterisk -r -T) does not read logger.conf
and uses a hard coded dateformat option for printing received verbose messages:
  main/logger.c: static char dateformat[256] = "%b %e %T"

This change will load logger.conf for each remote console session and
use the dateformat= option to set the per-line timestamp for verbose messages

Change-Id: I3ea10990dbd920e9f7ce8ff771bc65aa7f4ea8c1
ASTERISK-25358: #close
Reported-by: Igor Liferenko
2021-03-22 11:18:14 -05:00
Sean Bright 9e19d98f45 app_queue.c: Don't crash when realtime queue name is empty.
ASTERISK-27542 #close

Change-Id: If0b9719380a25533d2aed1053cff845dc3a4854a
2021-03-22 09:41:12 -05:00
George Joseph 3c8a7597b3 res_pjsip_session: Make reschedule_reinvite check for NULL topologies
When the check for equal topologies was added to reschedule_reinvite()
it was assumed that both the pending and active media states would
actually have non-NULL topologies.  We since discovered this isn't
the case.

We now only test for equal topologies if both media states have
non-NULL topologies.  The logic had to be rearranged a bit to make
sure that we cloned the media states if their topologies were
non-NULL but weren't equal.

ASTERISK-29215

Change-Id: I61313cca7fc571144338aac826091791b87b6e17
2021-03-22 09:39:05 -05:00
Joshua C. Colp a8042f2a4c app_queue: Only send QueueMemberStatus if status changes.
If a queue member was updated with the same status multiple
times each time a QueueMemberStatus event would be sent
which would be a duplicate of the previous.

This change makes it so that the QueueMemberStatus event is
only sent if the status actually changes.

ASTERISK-29355

Change-Id: I580c60d992a0a8f2bea8b91c868771b3b490d116
2021-03-22 07:50:59 -05:00
Joshua C. Colp 73a52c53ce core_unreal: Fix deadlock with T.38 control frames.
When using the ast_unreal_lock_all function no channel
locks can be held before calling it.

This change unlocks the channel that indicate was
called on before doing so and then relocks it afterwards.

ASTERISK-29035

Change-Id: Id65016201b5f9c9519a216e250f9101c629e19e9
2021-03-22 07:48:49 -05:00
Joshua C. Colp 720a39eb9e res_pjsip: Add support for partial transport reload.
Some configuration items for a transport do not result in
the underlying transport changing, but instead are just
state we keep ourselves and use. It is perfectly reasonable
to change these items.

These include local_net and external_* information.

ASTERISK-29354

Change-Id: I027857ccfe4419f460243e562b5f098434b3d43a
2021-03-22 04:07:53 -05:00
Jaco Kroon eff26ffe42 menuselect: exit non-zero in case of failure on --enable|disable options.
ASTERISK-29348

Change-Id: I77e3466435f5a51a57538b29addb68d811af238d
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-03-19 08:14:08 -05:00
Joshua C. Colp 7f29dd0a53 res_rtp_asterisk: Force resync on SSRC change.
When an SSRC change occurs the timestamps are likely
to change as well. As a result we need to reset the
timestamp mapping done in the calc_rxstamp function
so that they map properly from timestamp to real
time.

This previously occurred but due to packet
retransmission support the explicit setting
of the marker bit was not effective.

ASTERISK-29352

Change-Id: I2d4c8f93ea24abc1030196706de2d70facf05a5a
2021-03-18 15:44:52 -05:00
Joshua C. Colp 0ae922e48b menuselect: Add ability to set deprecated and removed versions.
The "deprecated_in" and "removed_in" information can now be
set in MODULEINFO for a module and is then displayed in
menuselect so users can be aware of when a module is slated
to be deprecated and then removed.

ASTERISK-29337

Change-Id: I6952889cf08e0e9e99cf8b43f99b3cef4688087a
2021-03-17 10:07:06 -05:00
Joshua C. Colp ea3d4e0343 xml: Allow deprecated_in and removed_in for MODULEINFO.
ASTERISK-29337

Change-Id: I2211b7da8d29369f8649aeabce07679da0787f2b
2021-03-16 10:33:12 -05:00
Joshua C. Colp e42417e910 xml: Embed module information into core XML documentation.
This change embeds the MODULEINFO block of modules
into the core XML documentation. This provides a shared
mechanism for use by both menuselect and Asterisk for
information and a definitive source of truth.

ASTERISK-29335

Change-Id: Ifbfd5c700049cf320a3e45351ac65dd89bc99d90
2021-03-16 10:30:13 -05:00
Joshua C. Colp ee8c9017a7 documentation: Fix non-matching module support levels.
Some modules have a different support level documented in their
MODULEINFO XML and Asterisk module definition. This change
brings the two in sync for the modules which were not matching.

ASTERISK-29336

Change-Id: If2f819103d4a271e2e0624ef4db365e897fa3d35
2021-03-16 10:26:43 -05:00
Kevin Harwell ec8b030bd7 manager: Increase the non breaking AMI version number
ASTERISK~29244 added three new AMI events, so bump the version number.

Change-Id: I0e77fa36d38fb27dec3481d4ef08131330da0632
2021-03-11 10:54:49 -06:00
Asterisk Development Team fb17a41641 Update CHANGES and UPGRADE.txt for 16.17.0 2021-03-11 11:38:54 -05:00
Joshua C. Colp ceb8404667 channel: Fix crash in suppress API.
There exists an inconsistency with framehook usage
such that it is only on reads that the frame should
be freed, not on writes as well.

ASTERISK-29071

Change-Id: I5ef918ebe4debac8a469e8d43bf9d6b673e8e472
2021-03-10 11:07:42 -06:00
Jaco Kroon 59129bfab8 func_callerid+res_agi: Fix compile errors related to -Werror=zero-length-bounds
Change-Id: I75152cece8a00b7523d542e5ac22796f9595692b
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-03-10 08:57:01 -06:00
Jaco Kroon fce875cf46 app.h: Fix -Werror=zero-length-bounds compile errors in dev mode.
Change-Id: I5c104dc1f8417ccd3d01faf86e84ccbf89bc3b31
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-03-10 04:24:40 -06:00
Sean Bright dcfcf7d70a app_dial.c: Only send DTMF on first progress event.
ASTERISK-29329 #close

Change-Id: Ic58e7a17f1ff3f785a5b21dced88682581149601
2021-03-10 04:22:53 -06:00
Alexander Traud f875175815 res_format_attr_*: Parameter Names are Case-Insensitive.
see RFC 4855:
parameter names are case-insensitive both in media type strings and
in the default mapping to the SDP a=fmtp attribute.

This change is required for H.263+ because some implementations are
known to use even mixed-case. This does not fix ASTERISK~29268 because
H.264 was not fixed. This approach here lowers/uppers both parameter
names and parameter values. H.264 needs a different approach because
one of its parameter values is not case-insensitive:
sprop-parameter-sets is Base64.

Change-Id: Idf2a73457be231647aed3c87b1da197afba86892
2021-03-10 04:22:27 -06:00
Alexander Traud 10c0d9e711 chan_iax2: System Header strings is included via asterisk.h/compat.h.
The system header strings was included mistakenly with commit 3de0204.
That header is included via asterisk.h and there via the compat.h.

Change-Id: I3dc49060e275295f785670c87cc65fd3c3abd24a
2021-03-10 04:21:09 -06:00
Sean Bright 526917bf61 modules.conf: Fix differing usage of assignment operators.
ASTERISK-24434 #close

Change-Id: I0144e8d65d878128da59dcf3df12ca8cee47d6db
2021-03-10 04:19:10 -06:00
Sean Bright 08b94d5837 strings.h: ast_str_to_upper() and _to_lower() are not pure.
Because they modify their argument they are not pure functions and
should not be marked as such, otherwise the compiler may optimize
them away.

ASTERISK-29306 #close

Change-Id: Ibec03a08522dd39e8a137ece9bc6a3059dfaad5f
2021-03-10 04:18:14 -06:00
Sean Bright 1fc4ab38b8 res_musiconhold.c: Plug ref leak caused by ao2_replace() misuse.
ao2_replace() bumps the reference count of the object that is doing the
replacing, which is not what we want. We just want to drop the old ref
on the old object and update the pointer to point to the new object.

Pointed out by George Joseph in #asterisk-dev

Change-Id: Ie8167ed3d4b52b9d1ea2d785f885e8c27206743d
2021-03-08 18:19:40 -05:00
Torrey Searle b90ecc6b31 res/res_rtp_asterisk: generate new SSRC on native bridge end
For RTCP to work, we update the ssrc to be the one corresponding to
the native bridge while active.  However when the bridge ends we
should generate a new SSRC as the sequence numbers will not continue
from the native bridge left off.

ASTERISK-29300 #close

Change-Id: I23334b6934d2bf6490bda4bbf6414d96b8d17d10
2021-03-08 08:14:10 -06:00
Joshua C. Colp 11b53aecc8 sorcery: Add support for more intelligent reloading.
Some sorcery objects actually contain dynamic content
that can change despite the underlying configuration
itself not changing. A good example of this is the
res_pjsip_endpoint_identifier_ip module which allows
specifying hostnames. While the configuration may not
change between reloads the DNS information of the
hostnames can.

This change adds the ability for a sorcery object to be
marked as having dynamic contents which is then taken
into account when reloading by the sorcery file based
config module. If there is an object with dynamic content
then a reload will be forced while if there are none
then the existing behavior of not reloading occurs.

ASTERISK-29321

Change-Id: I9342dc55be46cc00204533c266a68d972760a0b1
2021-03-05 10:32:59 -06:00
George Joseph 90a456e6d2 res_pjsip_refer: Move the progress dlg release to a serializer
Although the dlg session count was incremented in a pjsip servant
thread, there's no guarantee that the last thread to unref this
progress object was one.  Before we decrement, we need to make
sure that this is either a servant thread or that we push the
decrement to a serializer that is one.

Because pjsip_dlg_dec_session requires the dialog lock, we don't
want to wait on the task to complete if we had to push it to a
serializer.

Change-Id: I8ff2d5d94be3ff04298394070434e22a7d3cbc41
2021-03-05 08:18:43 -06:00
Joshua C. Colp 13b1ee8aa5 res_pjsip_registrar: Include source IP and port in log messages.
When registering it can be useful to see the source IP address and
port in cases where multiple devices are using the same endpoint
or when anonymous is in use.

ASTERISK-29325

Change-Id: Ie178a6f55f53f8473035854c411bc3d056e0a2e0
2021-03-05 08:13:43 -06:00
Joshua C. Colp 4083aa6546 asterisk: Update copyright.
ASTERISK-29326

Change-Id: Ia95dbfb66e2d11ac4d1228444283bb2e4d77396a
2021-03-04 13:48:14 -06:00
Ben Ford b409fa1fff AST-2021-006 - res_pjsip_t38.c: Check for session_media on reinvite.
When Asterisk sends a reinvite negotiating T38 faxing, it's possible a
crash can occur if the response contains a m=image and zero port. The
reinvite callback code now checks session_media to see if it is null or
not before trying to access the udptl variable on it.

ASTERISK-29305

Change-Id: I1dfc51c5fa586e38579ede4bc228edee213ccaa9
2021-03-04 07:50:15 -07:00
Alexander Traud fcf1bec363 res_format_attr_h263: Generate valid SDP fmtp for H.263+.
Fixed:
* RFC 4629 does not allow the value "0" for MPI, K, and N.
* Allow value "0" for PAR.
* BPP is printed only when specified because "0" has a meaning.

New:
* Added CPCF and MaxBR.
* Some implementations provide CIF without MPI: a=fmtp:xx CIF;F=1
  Although a violation of RFC 3555 section 3, we can support that.

Changed:
* Resorts the CIFs from large to small which partly fixes ASTERISK~29267.

Change-Id: I95a650c715007b8dde11a77cb37d9c6c123a441e
2021-03-03 12:27:47 -06:00
Joshua C. Colp d65041ebea res_pjsip_nat: Don't rewrite Contact on REGISTER responses.
When sending a SIP response to an incoming REGISTER request
we don't want to change the Contact header as it will
contain the Contacts registered to the AOR and not our own
Contact URI.

ASTERISK-29235

Change-Id: I35a0723545281dd01fcd5cae497baab58720478c
2021-03-03 12:08:30 -06:00
Joshua C. Colp c81c4f3ae2 channel: Fix memory leak in suppress API.
A frame suppression API exists as part of channels
which allows audio frames to or from a channel to
be dropped. The MuteAudio AMI action uses this
API to perform its job.

This API uses a framehook to intercept flowing
audio and drop it when appropriate. It is the
responsibility of the framehook to free the
frame it is given if it changes the frame. The
suppression API failed to do this resulting in
a leak of audio frames.

This change adds the freeing of these frames.

ASTERISK-29071

Change-Id: Ie50acd454d672d36af914050c327d2e120d8ba7b
2021-03-03 10:15:10 -06:00
Salah Ahmed 6c065088be res_rtp_asterisk: Check remote ICE reset and reset local ice attrb
This change will check is the remote ICE session got reset or not by
checking the offered ufrag and password with session. If the remote ICE
reset session then Asterisk reset its local ufrag and password to reject
binding request with Old ufrag and Password.

ASTERISK-29266

Change-Id: I9c55e79a7af98a8fbb497d336b828ba41bc34eeb
2021-03-03 09:54:24 -06:00
Holger Hans Peter Freyther 4ceb07434c pjsip: Generate progress (once) when receiving a 180 with a SDP
ASTERISK-29105

Change-Id: If1615fe7115fe544ef974b044d3cea5c48b94a38
2021-03-02 11:22:23 -06:00
Nico Kooijman 980cc0d364 main: With Dutch language year after 2020 is not spoken in say.c
Implemented the english way of saying the year in ast_say_date_with_format_nl.
Currently the numbers are spoken correctly until 2020 and stopped working
this year.

ASTERISK-29297 #close
Reported-by: Jacek Konieczny

Change-Id: If5918eed5ab05df31df4dd23f08a909a60f6aba4
2021-03-02 11:20:05 -06:00
Alexei Gradinari d7eaf44501 res_fax: validate the remote/local Station ID for UTF-8 format
If the remote Station ID contains invalid UTF-8 characters
the asterisk fails to publish the Stasis and ReceiveFax status messages.

json.c: Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.
0: /usr/sbin/asterisk(ast_json_vpack+0x98) [0x4f3f28]
1: /usr/sbin/asterisk(ast_json_pack+0x8c) [0x4f3fcc]
2: /usr/sbin/asterisk(ast_channel_publish_varset+0x2b) [0x57aa0b]
3: /usr/sbin/asterisk(pbx_builtin_setvar_helper+0x121) [0x530641]
4: /usr/lib64/asterisk/modules/res_fax.so(+0x44fe) [0x7f27f4bff4fe]
...
stasis_channels.c: Error creating message

json.c: Error building JSON from '{s: s, s: s, s: s, s: s, s: s, s: s, s: o}': Invalid UTF-8 string.
0: /usr/sbin/asterisk(ast_json_vpack+0x98) [0x4f3f28]
1: /usr/sbin/asterisk(ast_json_pack+0x8c) [0x4f3fcc]
2: /usr/lib64/asterisk/modules/res_fax.so(+0x5acd) [0x7f27f4c00acd]
...
res_fax.c: Error publishing ReceiveFax status message

This patch replaces the invalid UTF-8 Station IDs with an empty string.

ASTERISK-29312 #close

Change-Id: Ieb00b6ecf67db3bfca787649caa8517f29d987db
2021-03-02 11:17:14 -06:00
Sean Bright 8604867857 app_page.c: Don't fail to Page if beep sound file is missing
ASTERISK-16799 #close

Change-Id: I40367b0d6dbf66a39721bde060c8b2d734a61cf4
2021-02-26 09:35:48 -06:00
George Joseph 1c1d4b2c68 res_pjsip_refer: Refactor progress locking and serialization
Although refer_progress_notify() always runs in the progress
serializer, the pjproject evsub module itself can cause the
subscription to be destroyed which then triggers
refer_progress_on_evsub_state() to clean it up.  In this case,
it's possible that refer_progress_notify() could get the
subscription pulled out from under it while it's trying to use
it.

At one point we tried to have refer_progress_on_evsub_state()
push the cleanup to the serializer and wait for its return before
returning to pjproject but since pjproject calls its state
callbacks with the dialog locked, this required us to unlock the
dialog while waiting for the serialized cleanup, then lock it
again before returning to pjproject. There were also still some
cases where other callers of refer_progress_notify() weren't
using the serializer and crashes were resulting.

Although all callers of refer_progress_notify() now use the
progress serializer, we decided to simplify the locking so we
didn't have to unlock and relock the dialog in
refer_progress_on_evsub_state().

Now, refer_progress_notify() holds the dialog lock for its
duration and since pjproject also holds the dialog lock while
calling refer_progress_on_evsub_state() (which does the cleanup),
there should be no more chances for the subscription to be
cleaned up while still being used to send NOTIFYs.

To be extra safe, we also now increment the session count on
the dialog when we create a progress object and decrement
the count when the progress is destroyed.

ASTERISK-29313

Change-Id: I97a8bb01771a3c85345649b8124507f7622a8480
2021-02-26 08:12:37 -06:00
Kevin Harwell 11fa7f6e0c res_rtp_asterisk: Add packet subtype during RTCP debug when relevant
For some RTCP packet types the report count is actually the packet's subtype.
This was not being reflected in the packet debug output.

This patch makes it so for some RTCP packet types a "Packet Subtype" is
now output in the debug replacing the "Reception reports" (i.e count).

Change-Id: Id4f4b77bb37077a4c4f039abd6a069287bfefcb8
2021-02-26 08:05:56 -06:00
Joshua C. Colp 7acb6e2194 res_pjsip_session: Always produce offer on re-INVITE without SDP.
When PJSIP receives a re-INVITE without an SDP offer the INVITE
session library will first call the on_create_offer callback and
if unavailable then use the active negotiated SDP as the offer.

In some cases this would result in a different SDP then was
previously used without an incremented SDP version number. The two
known cases are:

1. Sending an initial INVITE with a set of codecs and having the
remote side answer with a subset. The active negotiated SDP would
have the pruned list but would not have an incremented SDP version
number.

2. Using re-INVITE for unhold. We would modify the active negotiated
SDP but would not increment the SDP version.

To solve these, and potential other unknown cases, the on_create_offer
callback has now been implemented which produces a fresh offer with
incremented SDP version number. This better fits within the model
provided by the INVITE session library.

ASTERISK-28452

Change-Id: I2d81048d54edcb80fe38fdbb954a86f0a58281a1
2021-02-25 08:50:44 -06:00
Ben Ford 88461a23bb res_pjsip_session.c: Check topology on re-invite.
Removes an unnecessary check for the conditional that compares the
stream topologies to see if they are equal to suppress re-invites. This
was a problem when a Digium phone received an INVITE that offered codecs
different than what it supported, causing Asterisk to send the
re-invite.

ASTERISK-29303

Change-Id: I04dc91befb2387904e28a9aaeaa3bcdbcaa7fa63
2021-02-25 08:44:29 -06:00
Boris P. Korzun 3096dcee15 res_config_pgsql: Limit realtime_pgsql() to return one (no more) record.
Added a SELECT 'LIMIT' clause to realtime_pgsql() and refactored the function.

ASTERISK-29293 #close

Change-Id: If5a6d4b1072ea2e6e89059b21139d554a74b34f5
2021-02-25 07:53:49 -06:00
Jaco Kroon 9a1cf7fb77 res_odbc_transaction: correctly initialise forcecommit value from DSN.
Also improve the in-process documentation to clarify that the value is
initialised from the DSN and not default false, but that the DSN's value
is default false if unset.

ASTERISK-29311 #close

Change-Id: I46e2379f7b0656034442bce77cb37ccd4e61098d
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-02-23 14:52:56 -06:00
Ivan Poddubnyi c63ab5580c app_queue: Fix conversion of complex extension states into device states
Queue members using dialplan hints as a state interface must handle
INUSE+RINGING hint as RINGINUSE devstate, and INUSE + ONHOLD as INUSE.

ASTERISK-28369

Change-Id: I127e06943d4b4f1afc518f9e396de77449992b9f
2021-02-23 13:37:51 -06:00
Jaco Kroon a63c7883b4 app.h: Restore C++ compatibility for macro AST_DECLARE_APP_ARGS
This partially reverts commit 3d1bf3c537,
specifically for app.h.

This works with both gcc 9.3.0 and 10.2.0 now, both for C and C++ (as
tested with external modules).

ASTERISK-29287

Change-Id: I5b9f02a9b290675682a1d13f1788fdda597c9fca
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-02-23 13:01:54 -06:00
Alexander Traud 99666117be chan_sip: Filter pass-through audio/video formats away, again.
Instead of looking for pass-through formats in the list of transcodable
formats (which is going to find nothing), go through the result which
is going to be the jointcaps of the tech_pvt of the channel. Finally,
only with that list, ast_format_cap_remove(.) is going to succeed.

This restores the behaviour of Asterisk 1.8. However, it does not fix
ASTERISK_29282 because that issue report is about chan_sip and PJSIP.
Here, only chan_sip is fixed because PJSIP does not even call
ast_rtp_instance_available_formats -> ast_translate_available_format.

Change-Id: Icade2366ac2b82935b95a9981678c987da2e8c34
2021-02-23 12:41:56 -06:00
Jaco Kroon d847f7e8f8 func_odbc: Introduce minargs config and expose ARGC in addition to ARGn.
minargs enables enforcing of minimum count of arguments to pass to
func_odbc, so if you're unconditionally using ARG1 through ARG4 then
this should be set to 4.  func_odbc will generate an error in this case,
so for example

[FOO]
minargs = 4

and ODBC_FOO(a,b,c) in dialplan will now error out instead of using a
potentially leaked ARG4 from Gosub().

ARGC is needed if you're using optional argument, to verify whether or
not an argument has been passed, else it's possible to use a leaked ARGn
from Gosub (app_stack).  So now you can safely do
${IF($[${ARGC}>3]?${ARGV}:default value)} kind of thing.

Change-Id: I6ca0b137d90b03f6aa9c496991f6cbf1518f6c24
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-02-23 12:18:00 -06:00
Sebastien Duthil 435d68be97 app_mixmonitor: Add AMI events MixMonitorStart, -Stop and -Mute.
ASTERISK-29244

Change-Id: I1862d58264c2c8b5d8983272cb29734b184d67c5
2021-02-18 17:17:00 -06:00
Kevin Harwell 5699eb7b0f AST-2021-002: Remote crash possible when negotiating T.38
When an endpoint requests to re-negotiate for fax and the incoming
re-invite is received prior to Asterisk sending out the 200 OK for
the initial invite the re-invite gets delayed. When Asterisk does
finally send the re-inivite the SDP includes streams for both audio
and T.38.

This happens because when the pending topology and active topologies
differ (pending stream is not in the active) in the delayed scenario
the pending stream is appended to the active topology. However, in
the fax case the pending stream should replace the active.

This patch makes it so when a delay occurs during fax negotiation,
to or from, the audio stream is replaced by the T.38 stream, or vice
versa instead of being appended.

Further when Asterisk sent the re-invite with both audio and T.38,
and the endpoint responded with a declined T.38 stream then Asterisk
would crash when attempting to change the T.38 state.

This patch also puts in a check that ensures the media state has a
valid fax session (associated udptl object) before changing the
T.38 state internally.

ASTERISK-29203 #close

Change-Id: I407f4fa58651255b6a9030d34fd6578cf65ccf09
2021-02-18 10:38:09 -06:00
Alexander Traud c98de279b2 rtp: Enable srtp replay protection
Add option "srtpreplayprotection" rtp.conf to enable srtp
replay protection.

ASTERISK-29260
Reported by: Alexander Traud

Change-Id: I5cd346e3c6b6812039d1901aa4b7be688173b458
2021-02-18 10:36:25 -06:00
Ivan Poddubnyi 872c1786e6 res_pjsip_diversion: Fix adding more than one histinfo to Supported
New responses sent within a PJSIP sessions are based on those that were
sent before. Therefore, adding/modifying a header once causes it to be
sent on all responses that follow.

Sending 181 Call Is Being Forwarded many times first adds "histinfo"
duplicated more and more, and eventually overflows past the array
boundary.

This commit adds a check preventing adding "histinfo" more than once,
and skipping it if there is no more space in the header.

Similar overflow situations can also occur in res_pjsip_path and
res_pjsip_outbound_registration so those were also modified to
check the bounds and suppress duplicate Supported values.

ASTERISK-29227
Reported by: Ivan Poddubny

Change-Id: Id43704a1f1a0293e35cc7f844026f0b04f2ac322
2021-02-18 10:35:05 -06:00
Sean Bright 76125bec4a res_rtp_asterisk.c: Fix signed mismatch that leads to overflow
ASTERISK-29205 #close

Change-Id: Ib7aa65644e8df76e2378d7613ee7cf751b9d0bea
2021-02-18 10:33:08 -06:00
Joshua C. Colp 5a4531782c pjsip: Make modify_local_offer2 tolerate previous failed SDP.
If a remote side is broken and sends an SDP that can not be
negotiated the call will be torn down but there is a window
where a second 183 Session Progress or 200 OK that is forked
can be received that also attempts to negotiate SDP. Since
the code marked the SDP negotiation as being done and complete
prior to this it assumes that there is an active local and remote
SDP which it can modify, while in fact there is not as the SDP
did not successfully negotiate. Since there is no local or remote
SDP a crash occurs.

This patch changes the pjmedia_sdp_neg_modify_local_offer2
function to no longer assume that a previous SDP negotiation
was successful.

ASTERISK-29196

Change-Id: I22de45916d3b05fdc2a67da92b3a38271ee5949e
2021-02-18 10:08:14 -06:00
George Joseph 3be7de5b11 res_pjsip_refer: Always serialize calls to refer_progress_notify
refer_progress_notify wasn't always being called from the progress
serializer.  This could allow clearing notification->progress->sub
in one thread while another was trying to use it.

* Instances where refer_progress_notify was being called in-line,
  have been changed to use ast_sip_push_task().

Change-Id: Idcf1934c4e873f2c82e2d106f8d9f040caf9fa1e
2021-02-17 11:02:47 -06:00
Ben Ford 215550ed4b core_unreal: Fix T.38 faxing when using local channels.
After some changes to streams and topologies, receiving fax through
local channels stopped working. This change adds a stream topology with
a stream of type IMAGE to the local channel pair and allows fax to be
received.

ASTERISK-29035 #close

Change-Id: Id103cc5c9295295d8e68d5628e76220f8f17e9fb
2021-02-16 18:11:07 -06:00
Boris P. Korzun f996c7a48f format_wav: Support of MIME-type for wav16
Provided a support of a MIME-type for wav16. Added new MIME-type
for classic wav.

ASTERISK-29275 #close

Change-Id: I749bda287ba1ab20c1e0af5e4c0153817d47873b
2021-02-12 07:20:44 -06:00
Alexander Traud 2bcec10db8 chan_sip: Allow [peer] without audio (text+video).
Two previous commits, 620d9f4 and 6d980de, allow to set up a call
without audio, again. That was introduced originally with commit f04d5fb
but changed and broke over time. The original commit missed one
scenario: A [peer] section in sip.conf, which does not allow audio at
all. In that case, chan_sip rejected the call, although even when the
requester offered no audio. Now, chan_sip does not check whether there
is no audio format but checks whether there is no format in general. In
other words, if there is at least one format to offer, the call succeeds.

However, to prevent calls with no-audio, chan_sip still rejects calls
when both call parties (caller = requester of the call *and* callee =
[peer] section in sip.conf) included audio. In such a case, it is
expected that the call should have audio.

ASTERISK-29280

Change-Id: I0fb74faf51ef22a60c10b467df6a4d1c1943b73e
2021-02-12 07:18:50 -06:00
George Joseph 10c2e1749b chan_iax2.c: Require secret and auth method if encryption is enabled
If there's no secret specified for an iax2 peer and there's no secret
specified in the dial string, Asterisk will crash if the auth method
requested by the peer is MD5 or plaintext.  You also couldn't specify
a default auth method in the [general] section of iax.conf so if you
don't have static peers defined and just use the dial string, Asterisk
will still crash even if you have a secret specified in the dial string.

* Added logic to iax2_call() and authenticate_reply() to print
  a warning and hanhup the call if encryption is requested and
  there's no secret or auth method.  This prevents the crash.

* Added the ability to specify a default "auth" in the [general]
  section of iax.conf.

ASTERISK-29624
Reported by: N A

Change-Id: I5928e16137581f7d383fcc7fa04ad96c919e6254
2021-02-09 09:15:28 -06:00
Sean Bright 62ca911d29 app_read: Release tone zone reference on early return.
Change-Id: I350939f2220f9e5d44ddf4c8d9a4c99fde4d169a
2021-02-04 09:57:02 -06:00
Alexander Traud 4a341f288d chan_sip: Set up calls without audio (text+video), again.
The previous commit 6d980de fixed this issue in the core of Asterisk.
With that, each channel technology can be used without audio
theoretically. Practically, the channel-technology driver chan_sip
turned out to have an invalid check preventing that. chan_sip tested
whether there is at least one audio format. However, chan_sip has to
test whether there is at least one format. More cannot be tested while
requesting chan_sip because only the [general] capabilities but not the
[peer] caps are known yet. And the [peer] caps might not be a subset or
show any intersection with the [general] caps. This change here fixes
this.

The original commit f04d5fb, thirteen years ago, contained a software
bug as it passed ANY audio capability to the channel-technology driver.
Instead, it should have passed NO audio format. Therefore, this
addressed issue here was not noticed in Asterisk 1.6.x and Asterisk 1.8.
Then, Asterisk 10 changed that from ANY to NO, but nobody reported since
then.

ASTERISK-29265

Change-Id: Ic16a3bf13cd1b5c4fc4041ed74961177d96b600f
2021-02-03 03:02:16 -06:00
Dan Cropp a5364ac69b chan_pjsip, app_transfer: Add TRANSFERSTATUSPROTOCOL variable
When a Transfer/REFER is executed, TRANSFERSTATUSPROTOCOL variable is
0 when no protocl specific error
SIP example of failure, 3xx-6xx for the SIP error code received

This allows applications to perform actions based on the failure
reason.

ASTERISK-29252 #close
Reported-by: Dan Cropp

Change-Id: Ia6a94784b4925628af122409cdd733c9f29abfc4
2021-01-27 11:46:39 -06:00
Alexander Traud 8a2f0fbbd1 channel: Set up calls without audio (text+video), again.
ASTERISK-29259

Change-Id: Ib6a6550e0e08355745d66da8e60ef49e81f9c6c5
2021-01-27 11:05:00 -06:00
roadkill 97400d063d res/res_pjsip.c: allow user=phone when number contain *#
if From number contain * or # asterisk will not add user=phone

Currently only number that uses AST_DIGIT_ANYNUM can have "user=phone" but the validation should use AST_DIGIT_ANY
this is a problem when you want to send call to ISUP
as they will disregard the From header and either replace From with anonymous or with p-asserted-identity

ASTERISK-29261
Reported by: Mark Petersen
Tested by: Mark Petersen

Change-Id: I3307bdbf757582740bfee4110e85f7b6c9291cc4
2021-01-27 11:03:31 -06:00
Ivan Poddubnyi 0a5141f2f3 main/frame: Add missing control frame names to ast_frame_subclass2str
Log proper control frame names instead of "Unknown control '14'", etc.

Change-Id: I1724f2f4d1b064b25a5c93a7da0cb03be5143935
2021-01-27 10:41:09 -06:00
Alexander Traud 7dc0cded86 chan_sip: SDP: Reject audio streams correctly.
This completes the fix for ASTERISK_24543. Only when the call is an
outgoing call, consult and append the configured format capabilities
(p->caps). When all audio formats got rejected the negotiated format
capabilities (p->jointcaps) contain no audio formats for incoming
calls. This is required when there are other accepted media streams.

ASTERISK-29258

Change-Id: I8bab31c7f3f3700dce204b429ad238a524efebb9
2021-01-27 10:14:43 -06:00
Boris P. Korzun e78239e6f5 res_musiconhold: Add support of various URL-schemes by MoH.
Provided a support of variuos URL-schemes for res_musiconhold,
registered by ast_bucket_scheme_register().

ASTERISK-29262 #close

Change-Id: If0ea8697587353dce358a70035d82649fd4632b6
2021-01-25 10:49:46 -06:00
Robert Cripps ff037a135c res/res_pjsip_session.c: Check that media type matches in
function ast_sip_session_media_state_add.

Check ast_media_type matches when a ast_sip_session_media is found
otherwise when transitioning from say image to audio, the wrong
session is returned in the first if statement.

ASTERISK-29220 #close

Change-Id: I6f6efa9b821ebe8881bb4c8c957f8802ddcb4b5d
2021-01-18 11:15:05 -06:00
Jaco Kroon aa03d07a08 AC_HEADER_STDC causes a compile failure with autoconf 2.70
From https://www.mail-archive.com/bug-autoconf@gnu.org/msg04408.html

> ... the long-obsolete AC_HEADER_STDC, previously used internally by
> AC_INCLUDES_DEFAULT, used AC_EGREP_HEADER.  The AC_HEADER_STDC macro
> is now a no-op (and is not used at all within Autoconf anymore), so
> that change is likely what made the first use of AC_EGREP_HEADER the
> one inside the if condition, causing the observed results.

The implication is that the test does nothing anyway, and due to it
being a no-op from 2.70 onwards, results in the required not being set
to yes, resulting in ./configure to fail.

Change-Id: Ic1ff38d87f791fbf1f2a80512f81bb7110392460
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-01-18 11:10:00 -06:00
Alexander Traud 6915106cc1 pjsip_scheduler: Fix pjsip show scheduled_tasks like for compiler Clang.
Otherwise, Clang 10 warned because of logical-not-parentheses.

Change-Id: Ia8fb493f727b08070eb2dcf520c08df34ed11d79
2021-01-18 10:37:13 -06:00
Alexander Traud 3b1cab26a5 res_pjsip_session: Avoid sometimes-uninitialized warning with Clang.
ASTERISK-29248

Change-Id: I2b17bd5ffb246bc64c463402c9831413da78a556
2021-01-18 10:36:13 -06:00
Ben Ford 0520f8320c chan_pjsip.c: Add parameters to frame in indicate.
There are a couple of parameters (datalen and data) that do not get set
in chan_pjsip_indicate which could cause an Invalid message to pop up
for things such as fax. This patch adds them to the frame.

Change-Id: Ia51be086a0708be905e73d1f433572c49c7e38f8
2021-01-18 09:59:26 -06:00
Sean Bright 2c533dc76f res_pjsip_pubsub: Fix truncation of persisted SUBSCRIBE packet
The last argument to ast_copy_string() is the buffer size, not the
number of characters, so we add 1 to avoid stamping out the final \n
in the persisted SUBSCRIBE message.

Change-Id: I019b78942836f57965299af15d173911fcead5b2
2021-01-18 09:58:45 -06:00
Asterisk Development Team 6056818467 Update CHANGES and UPGRADE.txt for 16.16.0 2021-01-14 10:51:50 -05:00
Jean Aunis 45e1d89135 Stasis/messaging: tech subscriptions conflict with endpoint subscriptions.
When both a tech subscription and an endpoint subscription exist for a given
endpoint, TextMessageReceived events are dispatched to the tech subscription
only.

ASTERISK-29229

Change-Id: I9eac4cba5f9e27285a282509395347abc58fc2b8
2021-01-13 09:35:47 -06:00
Alexander Traud 34b0960310 chan_sip: SDP: Sidestep stream parsing when its media is disabled.
Previously, chan_sip parsed all known media streams in an SDP offer
like video (and text) even when videosupport=no (and textsupport=no).
This wasted processor power. Furthermore, chan_sip accepted SDP offers,
including no audio but just video (or text) streams although
videosupport=no (or textsupport=no). Finally, chan_sip denied the whole
offer instead of individual streams when they had encryption (SDES-sRTP)
unexpectedly enabled.

ASTERISK-29238
ASTERISK-29237
ASTERISK-29222

Change-Id: Ie49e4e2a11f0265f914b684738348ba8c0f89755
2021-01-13 08:29:37 -06:00
Ivan Poddubnyi 97afc9055f chan_pjsip: Assign SIPDOMAIN after creating a channel
session->channel doesn't exist until chan_pjsip creates it, so intead of
setting a channel variable every new incoming call sets one and the same
global variable.

This patch moves the code to chan_pjsip so that SIPDOMAIN is set on
a newly created channel, it also removes a misleading reference to
channel->session used to fetch call pickup configuraion.

ASTERISK-29240

Change-Id: I90c9bbbed01f5d8863585631a29322ae4e046755
2021-01-13 07:39:02 -06:00
Ivan Poddubnyi 17fa9c93d0 chan_pjsip: Stop queueing control frames twice on outgoing channels
The fix for ASTERISK-27902 made chan_pjsip process SIP responses twice.
This resulted in extra noise in logs (for example, "is making progress"
and "is ringing" get logged twice by app_dial), as well as in noise in
signalling: one incoming 183 Session Progress results in 2 outgoing 183-s.

This change splits the response handler into 2 functions:
 - one for updating HANGUPCAUSE, which is still called twice,
 - another that does the rest, which is called only once as before.

ASTERISK-28016
Reported-by: Alex Hermann

ASTERISK-28549
Reported-by: Gant Liu

ASTERISK-28185
Reported-by: Julien

Change-Id: I0a1874be5bb5ed12d572d17c7f80de6e5e542940
2021-01-11 11:33:09 -06:00
Jaco Kroon 7df88c98d0 contrib/systemd: Added note on common issues with systemd and asterisk
With newer version of linux /var/run/ is a symlink to /run/ that has
been turned into tmpfs.

Added note that if asterisk has to bind to a specific IP that
systemd has to wait until the network is up.

Added note on how to make sure that the environment variable
HOSTNAME is included.

ASTERISK-29216
Reported by: Mark Petersen
Tested by: Mark Petersen

Change-Id: Ib3e560655befd3e99eec743687144f5569533379
2021-01-11 10:25:06 -06:00
George Joseph 7ed20b9d3b Revert "res_pjsip_outbound_registration.c: Use our own scheduler and other stuff"
This reverts commit e1fd51cd2c.

Reason for revert: Too many issues reported.  Need to research and correct.

ASTERISK-29230
ASTERISK-29231
Reported by: Michael Maier

Change-Id: Ie2356c1cd74436603600599885286b98055b8a17
2021-01-11 09:26:42 -06:00
Jaco Kroon aca435dfe7 pbx_lua: Add LUA_VERSIONS environment variable to ./configure.
On Gentoo it's possible to have multiple lua versions installed, all
with a path of /usr, so it's not possible to use the current --with-lua
option to determisticly pin to a specific version as is required by the
Gentoo PMS standards.

This environment variable allows to lock to specific versions,
unversioned check will be skipped if this variable is supplied.

Change-Id: I8c403eda05df25ee0193960262ce849c7d2fd088
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-01-06 11:58:29 -06:00
Jaco Kroon 32e36144c7 func_lock: fix multiple-channel-grant problems.
Under contention it becomes possible that multiple channels will be told
they successfully obtained the lock, which is a bug.  Please refer

ASTERISK-29217

This introduces a couple of changes.

1.  Replaces requesters ao2 container with simple counter (we don't
    really care who is waiting for the lock, only how many).  This is
    updated undex ->mutex to prevent memory access races.
2.  Correct semantics for ast_cond_timedwait() as described in
    pthread_cond_broadcast(3P) is used (multiple threads can be released
    on a single _signal()).
3.  Module unload races are taken care of and memory properly cleaned
    up.

Change-Id: I6f68b5ec82ff25b2909daf6e4d19ca864a463e29
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2021-01-06 11:58:08 -06:00
Dan Cropp e127a57761 chan_pjsip: Incorporate channel reference count into transfer_refer().
Add channel reference count for PJSIP REFER. The call could be terminated
prior to the result of the transfer. In that scenario, when the SUBSCRIBE/NOTIFY
occurred several minutes later, it would attempt to access a session which was
no longer valid.  Terminate event subscription if pjsip_xfer_initiate() or
pjsip_xfer_send_request() fails in transfer_refer().

ASTERISK-29201 #close
Reported-by: Dan Cropp

Change-Id: I3fd92fd14b4e3844d3d7b0f60fe417a4df5f2435
2021-01-06 11:06:46 -06:00
Kevin Harwell e96f744816 app_mixmonitor: cleanup datastore when monitor thread fails to launch
launch_monitor_thread is responsible for creating and initializing
the mixmonitor, and dependent data structures. There was one off
nominal path after the datastore gets created that triggers when
the channel being monitored is hung up prior to monitor starting
itself.

If this happened the monitor thread would not "launch", and the
mixmonitor object and associated objects are freed, including the
underlying datastore data object. However, the datastore itself was
not removed from the channel, so when the channel eventually gets
destroyed it tries to access the previously freed datastore data
and crashes.

This patch removes and frees datastore object itself from the channel
before freeing the mixmonitor object thus ensuring the channel does
not call it when destroyed.

ASTERISK-28947 #close

Change-Id: Id4f9e958956d62473ed5ff06c98ae3436e839ff8
2021-01-06 10:52:14 -06:00
Sean Bright 2b7af3eb27 app_voicemail: Prevent deadlocks when out of ODBC database connections
ASTERISK-28992 #close

Change-Id: Ia7d608924036139ee2520b840d077762d02668d0
2021-01-06 10:50:39 -06:00
Sean Bright 4c5bffb217 asterisk: Export additional manager functions
Rename check_manager_enabled() and check_webmanager_enabled() to begin
with ast_ so that the symbols are automatically exported by the
linker.

ASTERISK~29184

Change-Id: I85762b9a5d14500c15f6bad6507138c8858644c9
2021-01-06 09:11:20 -06:00
Richard Mudgett 89cf7899be res_pjsip_session.c: Fix compiler warnings.
AST_VECTOR_SIZE() returns a size_t.  This is not always equivalent to an
unsigned long on all machines.

Change-Id: I0a4189a104e6e3a2e2273de06620eaef19df9338
2020-12-28 08:21:29 -06:00
Sungtae Kim ab3f57d88f res_pjsip_session: Fixed NULL active media topology handle
Added NULL pointer check to prevent Asterisk crash.

ASTERISK-29215

Change-Id: If07e50ea8d78cb610af9195fc13b5dca4bfcef95
2020-12-23 07:44:44 -06:00
Torrey Searle 9196e0d1d5 res/res_pjsip_diversion: prevent crash on tel: uri in History-Info
Add a check to see if the URI is a Tel URI and prevent crashing on
trying to retrieve the reason parameter.

ASTERISK-29191
ASTERISK-29219

Change-Id: I0320aa205f22cda511d60a2edf2b037e8fd6cc37
2020-12-22 11:49:15 -07:00
Sean Bright 0a23296834 app_chanspy: Spyee information missing in ChanSpyStop AMI Event
The documentation in the wiki says there should be spyee-channel
information elements in the ChanSpyStop AMI event.

    https://wiki.asterisk.org/wiki/x/Xc5uAg

However, this is not the case in Asterisk <= 16.10.0 Version. We're
using these Spyee* arguments since Asterisk 11.x, so these arguments
vanished in Asterisk 12 or higher.

For maximum compatibility, we still send the ChanSpyStop event even if
we are not able to find any 'Spyee' information.

ASTERISK-28883 #close

Change-Id: I81ce397a3fd614c094d043ffe5b1b1d76188835f
2020-12-17 12:07:52 -06:00
Sungtae Kim a47e6965b3 res_ari: Fix wrong media uri handle for channel play
Fixed wrong null object handle in
/channels/<channel_id>/play request handler.

ASTERISK-29188

Change-Id: I6691c640247a51ad15f23e4a203ca8430809bafe
2020-12-17 09:54:59 -06:00
George Joseph 5a2867efa9 logger.c: Automatically add a newline to formats that don't have one
Scope tracing allows you to not specify a format string or
variable, in which case it just prints the indent, file,
function, and line number.  The trace output automatically
adds a newline to the end in this case.  If you also have
debugging turned on for the module, a debug message is
also printed but the standard log functionality which
prints it doesn't add the newline so you have messages
that don't break correctly.

 * format_log_message_ap(), which is the common log
   message formatter for all channels, now adds a
   newline to the end of format strings that don't
   already have a newline.

ASTERISK-29209
Reported by: Alexander Traud

Change-Id: I994a7df27f88df343b7d19f3e81a4b562d9d41da
2020-12-17 09:12:35 -06:00
Pirmin Walthert 11def974a8 res_pjsip_nat.c: Create deep copies of strings when appropriate
In rewrite_uri asterisk was not making deep copies of strings when
changing the uri. This was in some cases causing garbage in the route
header and in other cases even crashing asterisk when receiving a
message with a record-route header set. Thanks to Ralf Kubis for
pointing out why this happens. A similar problem was found in
res_pjsip_transport_websocket.c. Pjproject needs as well to be patched
to avoid garbage in CANCEL messages.

ASTERISK-29024 #close

Change-Id: Ic5acd7fa2fbda3080f5f36ef12e46804939b198b
2020-12-17 09:10:41 -06:00
Joshua C. Colp 7e4bb4ed11 res_pjsip_pidf_digium_body_supplement: Support Sangoma user agent.
This adds support for both Digium and Sangoma user agent strings
for the Sangoma specific body supplement.

Change-Id: Ib99362b24b91d3cbe888d8b2fce3fad5515d9482
2020-12-16 09:21:52 -06:00
Nathan Bruning bb46595799 res_musiconhold: Don't crash when real-time doesn't return any entries
ASTERISK-29211 #close

Change-Id: Ifbf0a4f786ab2a52342f9d1a1db4c9907f069877
2020-12-15 09:06:57 -05:00
lvl 8d2558209b Introduce astcachedir, to be used for temporary bucket files
As described in the issue, /tmp is not a suitable location for a
large amount of cached media files, since most distributions make
/tmp a RAM-based tmpfs mount with limited capacity.

I opted for a location that can be configured separately, as opposed
to using a subdirectory of spooldir, given the different storage
profile (transient files vs files that might stay there indefinitely).

This commit just makes the cache directory configurable, but leaves
it at /tmp by default, to ensure backwards compatibility.

A future commit that only targets master could change the default
location to something more sensible such as /var/tmp/asterisk. At
that point, the cachedir could be created and cleaned up during
uninstall by the Makefile script.

ASTERISK-29143

Change-Id: Ic54e95199405abacd9e509cef5f08fa14c510b5d
2020-12-09 13:06:27 -06:00
Joshua C. Colp ea744ca7c2 pjsip: Match lifetime of INVITE session to our session.
In some circumstances it was possible for an INVITE
session to be destroyed while we were still using it.
This occurred due to the reference on the INVITE session
being released internally as a result of its state
changing to DISCONNECTED.

This change adds a reference to the INVITE session
which is released when our own session is destroyed,
ensuring that the INVITE session remains valid for
the lifetime of our session.

ASTERISK-29022

Change-Id: I300c6d9005ff0e6efbe1132daefc7e47ca6228c9
2020-12-09 13:06:14 -06:00
Sean Bright 0c185c9e21 res_http_media_cache.c: Set reasonable number of redirects
By default libcurl does not follow redirects, so we explicitly enable
it by setting CURLOPT_FOLLOWLOCATION. Once that is enabled, libcurl
will follow up to CURLOPT_MAXREDIRS redirects, which by default is
configured to be unlimited.

This patch sets CURLOPT_MAXREDIRS to a more reasonable default (8). If
we determine at some point that this needs to be increased on
configurable it is a trivial change.

ASTERISK-29173 #close

Change-Id: I4925ebbcf0c7d728bb9252b3795b3479ae225b30
2020-12-03 10:28:13 -06:00
Sean Bright ddbf3a7f73 media_cache: Fix reference leak with bucket file metadata
Change-Id: Ia0e4124110df613ce5fdfa9ef8780016ebaa52c6
2020-12-03 08:35:20 -06:00
Stanislav 159522003a res_pjsip_stir_shaken: Fix module description
the 'J' is missing in module description.
"PSIP STIR/SHAKEN Module for Asterisk" -> "PJSIP STIR/SHAKEN Module for Asterisk"

ASTERISK-29175 #close

Change-Id: I17da008540ee2e8496b644d05f995b320b54ad7a
2020-12-01 11:24:27 -06:00
Joshua C. Colp 15566494f9 voicemail: add option 'e' to play greetings as early media
When using this option, answering the channel is deferred until
all prompts/greetings have been played and the caller is about
to leave their message.

ASTERISK-29118 #close

Change-Id: I41b9f0428783c0bd697c8c994f906d1e75ce9ddb
2020-12-01 11:23:22 -06:00
Alexander Traud 4c79bc19d1 loader: Sync load- and build-time deps.
In MODULEINFO, each depend has to be listed in .requires of AST_MODULE_INFO.

ASTERISK-29148

Change-Id: I254dd33194ae38d2877b8021c57c2a5deb6bbcd2
2020-11-20 13:51:19 -06:00
Sean Bright a360150ee0 CHANGES: Remove already applied CHANGES update
Change-Id: Iee7163bc732d58c5cbaa2cfab1f5aab4a412060a
2020-11-20 13:49:58 -06:00
Alexander Traud f667c5a781 chan_sip: Remove unused sip_socket->port.
12 years ago, with ASTERISK_12115 the last four get/uses of socket.port
vanished. However, the struct member itself and all seven set/uses
remained as dead code.

ASTERISK-28798

Change-Id: Ib90516a49eca3d724a70191278aaf2144fb58c59
2020-11-19 15:36:58 -06:00
Alexander Greiner-Baer a8f6238cc8 res_pjsip: set Accept-Encoding to identity in OPTIONS response
RFC 3261 says that the Accept-Encoding header should be present
in an options response. Permitted values according to RFC 2616
are only compression algorithms like gzip or the default identity
encoding. Therefore "text/plain" is not a correct value here.
As long as the header is hard coded, it should be set to "identity".

Without this fix an Alcatel OmniPCX periodically logs warnings like
"[sip_acceptIncorrectHeader] Header Accept-Encoding is malformed"
on a SIP Trunk.

ASTERISK-29165 #close

Change-Id: I0aa2211ebf0b4c2ed554ac7cda794523803a3840
2020-11-19 13:38:24 -06:00
Boris P. Korzun 89d3de37ca bridge_basic: Fixed setup of recall channels
Fixed a bug (like a typo) in retransfer_enter()
at main/bridge_basic.c:2641. common_recall_channel_setup() setups
common things on the recalled transfer target, but used same target
as source instead trasfered.

ASTERISK-29161 #close

Change-Id: Ieb549654a621c38b1ad5e9d15b9f18823d9cc31f
2020-11-18 10:12:39 -06:00
Alexander Traud d1a78e047d
modules.conf: Align the comments for more conclusiveness.
Change-Id: I79cc693cd5a6e5dd7d403b7e91d970ff1ddf8306
2020-11-16 11:38:04 +01:00
George Joseph 8d8c9db618 app_queue: Fix deadlock between update and show queues
Operations that update queues when shared_lastcall is set lock the
queue in question, then have to lock the queues container to find the
other queues with the same member. On the other hand, __queues_show
(which is called by both the CLI and AMI) does the reverse. It locks
the queues container, then iterates over the queues locking each in
turn to display them.  This creates a deadlock.

* Moved queue print logic from __queues_show to a separate function
  that can be called for a single queue.

* Updated __queues_show so it doesn't need to lock or traverse
  the queues container to show a single queue.

* Updated __queues_show to snap a copy of the queues container and iterate
  over that instead of locking the queues container and iterating over
  it while locked.  This prevents us from having to hold both the
  container lock and the queue locks at the same time.  This also
  allows us to sort the queue entries.

ASTERISK-29155

Change-Id: I78d4dc36728c2d7bc187b97d82673fc77f2bcf41
2020-11-12 16:17:18 -06:00
Asterisk Development Team 3366956139 Update CHANGES and UPGRADE.txt for 16.15.0 2020-11-12 06:48:03 -05:00
George Joseph e1fd51cd2c res_pjsip_outbound_registration.c: Use our own scheduler and other stuff
* Instead of using the pjproject timer heap, we now use our own
  pjsip_scheduler.  This allows us to more easily debug and allows us to
  see times in "pjsip show/list registrations" as well as being able to
  see the registrations in "pjsip show scheduled_tasks".

* Added the last registration time, registration interval, and the next
  registration time to the CLI output.

* Removed calls to pjsip_regc_info() except where absolutely necessary.
  Most of the calls were just to get the server and client URIs for log
  messages so we now just save them on the client_state object when we
  create it.

* Added log messages where needed and updated most of the existong ones
  to include the registration object name at the start of the message.

Change-Id: I4534a0fc78c7cb69f23b7b449dda9748c90daca2
2020-11-10 07:07:38 -07:00
George Joseph 80f116c156 pjsip_scheduler.c: Add type ONESHOT and enhance cli show command
* Added a ONESHOT type that never reschedules.

* Added "like" capability to "pjsip show scheduled_tasks" so you can do
  the following:

  CLI> pjsip show scheduled_tasks like outreg
  PJSIP Scheduled Tasks:

  Task Name                                     Interval  Times Run ...
  ============================================= ========= ========= ...
  pjsip/outreg/testtrunk-reg-0-00000074            50.000   oneshot ...
  pjsip/outreg/voipms-reg-0-00000073              110.000   oneshot ...

* Fixed incorrect display of "Next Start".

* Compacted the displays of times in the CLI.

* Added two new functions (ast_sip_sched_task_get_times2,
  ast_sip_sched_task_get_times_by_name2) that retrieve the interval,
  next start time, and next run time in addition to the times already
  returned by ast_sip_sched_task_get_times().

Change-Id: Ie718ca9fd30490b8a167bedf6b0b06d619dc52f3
2020-11-09 14:46:53 -06:00
Alexei Gradinari 728cd55cde sched: AST_SCHED_REPLACE_UNREF can lead to use after free of data
The data can be freed if the old object '_data' is the same object as
new 'data'. Because at first the object is unreferenced which can lead
to destroying it.

This could happened in res_pjsip_pubsub when the publication is updated
which could lead to segfault in function publish_expire.

Change-Id: I0164f57c387243510bdbd2f8dcf33377b6c202da
2020-11-09 09:00:07 -06:00
Alexander Traud ddfb76a864 res_pjsip/config_transport: Load and run without OpenSSL.
ASTERISK-28933
Reported-by: Walter Doekes

Change-Id: I65eac49e5b0a79261ea80e2b9b38a836886ed59f
2020-11-09 08:51:14 -06:00
Alexander Traud 277aa0ced6 res_stir_shaken: Include OpenSSL headers where used actually.
This avoids the inclusion of the OpenSSL headers in the public header,
which avoids one external library dependency in res_pjsip_stir_shaken.

Change-Id: I6a07e2d81d2b5442e24e99b8cc733a99f881dcf4
2020-11-09 08:35:51 -06:00
Dovid Bender 5046e1fb06 func_curl.c: Allow user to set what return codes constitute a failure.
Currently any response from res_curl where we get an answer from the
web server, regardless of what the response is (404, 403 etc.) Asterisk
currently treats it as a success. This patch allows you to set which
codes should be considered as a failure by Asterisk. If say we set
failurecodes=404,403 then when using curl in realtime if a server gives
a 404 error Asterisk will try to failover to the next option set in
extconfig.conf

ASTERISK-28825

Reported by: Dovid Bender
Code by: Gobinda Paul

Change-Id: I94443e508343e0a3e535e51ea6e0562767639987
2020-11-06 11:47:16 -06:00
Kevin Harwell 8973fe5cf3 AST-2020-001 - res_pjsip: Return dialog locked and referenced
pjproject returns the dialog locked and with a reference. However,
in Asterisk the method that handles this decrements the reference
and removes the lock prior to returning. This makes it possible,
under some circumstances, for another thread to free said dialog
before the thread that created it attempts to use it again. Of
course when the thread that created it tries to use a freed dialog
a crash can occur.

This patch makes it so Asterisk now returns the newly created
dialog both locked, and with an added reference. This allows the
caller to de-reference, and unlock the dialog when it is safe to
do so.

In the case of a new SIP Invite the lock, and reference are now
held for the entirety of the new invite handling process.
Otherwise it's possible for the dialog, or its dependent objects,
like the transaction, to disappear. For example if there is a TCP
transport error.

ASTERISK-29057 #close

Change-Id: I5ef645a47829596f402cf383dc02c629c618969e
2020-11-05 11:02:20 -06:00
Ben Ford 58aa6a7057 AST-2020-002 - res_pjsip: Stop sending INVITEs after challenge limit.
If Asterisk sends out an INVITE and receives a challenge with a
different nonce value each time, it will continuously send out INVITEs,
even if the call is hung up. The endpoint must be configured for
outbound authentication for this to occur. A limit has been set on
outbound INVITEs so that, once reached, Asterisk will stop sending
INVITEs and the transaction will terminate.

ASTERISK-29013

Change-Id: I2d001ca745b00ca8aa12030f2240cd72363b46f7
2020-11-05 10:30:26 -06:00
Sean Bright e067d5c8fd sip_to_pjsip.py: Handle #include globs and other fixes
* Wildcards in #includes are now properly expanded

* Implement operators for Section class to allow sorting

ASTERISK-29142 #close

Change-Id: I9b9cd95f4cbe5c24506b75d17173c5aa1a83e5df
2020-11-05 08:36:41 -06:00
Alexander Traud 13b56c4be6 Compiler fixes for GCC with -Og
ASTERISK-29144

Change-Id: I2a72c072083b4492a223c6f9d73d21f4f424db62
2020-11-03 16:35:08 -06:00
Alexander Traud 334661601a Compiler fixes for GCC when printf %s is NULL
ASTERISK-29146

Change-Id: Ib04bdad87d729f805f5fc620ef9952f58ea96d41
2020-11-03 15:46:44 -06:00
Alexander Traud 92ca48d54c Compiler fixes for GCC with -Os
ASTERISK-29145

Change-Id: I9af705f2b9725c53141aef5d0ff512a1800f073c
2020-11-03 15:15:31 -06:00
Alexander Traud 951ce0524d chan_sip: On authentication, pick MD5 for sure.
RFC 8760 added new digest-access-authentication schemes. Testing
revealed that chan_sip does not pick MD5 if several schemes are offered
by the User Agent Server (UAS). This change does not implement any of
the new schemes like SHA-256. This change makes sure, MD5 is picked so
UAS with SHA-2 enabled, like the service www.linphone.org/freesip, can
still be used. This should have worked since day one because SIP/2.0
already envisioned several schemes (see RFC 3261 and its augmented BNF
for 'algorithm' which includes 'token' as third alternative; note: if
'algorithm' was not present, MD5 is still assumed even in RFC 7616).

Change-Id: I61ca0b1f74b5ec2b5f3062c2d661cafeaf597fcd
2020-11-03 14:40:35 -06:00
Walter Doekes f98eed17c1 main/say: Work around gcc 9 format-truncation false positive
Version: gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Warning:
  say.c:2371:24: error: ‘%d’ directive output may be truncated writing
    between 1 and 11 bytes into a region of size 10
    [-Werror=format-truncation=]
  2371 |     snprintf(buf, 10, "%d", num);
  say.c:2371:23: note: directive argument in the range [-2147483648, 9]

That's not possible though, as the if() starts out checking for (num < 0),
making this Warning a false positive.

(Also replaced some else<TAB>if with else<SP>if while in the vicinity.)

Change-Id: Ic7a70120188c9aa525a6d70289385bfce878438a
2020-10-29 08:27:04 -05:00
Kevin Harwell 92e1de458a res_pjsip, res_pjsip_session: initialize local variables
This patch initializes a couple of local variables to some default values.
Interestingly, in the 'pj_status_t dlg_status' case the value not being
initialized caused memory to grow, and not be recovered, in the off nominal
path (at least on my machine).

Change-Id: I22ee65e1e1bff8efacea8a167c6c8428898523f7
2020-10-28 09:51:19 -05:00
Alexander Traud 65426f4312 install_prereq: Add GMime 3.0.
Ubuntu 20.10 does not come with GMime 2.6. Ubuntu 16.04 LTS does not
come with GMime 3.0. aptitude ignores any missing package. Therefore,
it installs the correct package(s). However, in Ubuntu 18.04 LTS and
Ubuntu 20.04 LTS, both versions are installed alongside although only
one is really needed.

Change-Id: Ic58aa9f2e131d94671f286f17dbd61e1ccbabcb7
2020-10-28 09:36:33 -05:00
Alexander Traud fb721ce82c BuildSystem: Enable Lua 5.4.
Note to maintainers: Lua 5.4, Lua 5.3, and Lua 5.2 have not been tested
at runtime with pbx_lua. Until then, use the lowest available version
of Lua, if you enabled the module pbx_lua at all.

Change-Id: Ie5270448b11fcb4e2a53d899e4fe7fea793ce7e0
2020-10-28 08:36:16 -05:00
Sean Bright e326b133dc features.conf.sample: Sample sound files incorrectly quoted
ASTERISK-29136 #close

Change-Id: I3186536d65a50014c8da4780c9224919caa81440
2020-10-22 11:23:46 -05:00
Asterisk Development Team 69356a7895 Update CHANGES and UPGRADE.txt for 16.14.0 2020-10-19 13:06:13 -05:00
Andrew Siplas 606bd35060 logger.conf.sample: add missing comment mark
Add missing comment mark from stock configuration.

ASTERISK-29123 #close

Change-Id: I4f94eb4544166bca8af4c17fd11edee3c6980620
2020-10-16 07:10:24 -05:00
Kevin Harwell e051806e80 Logging: Add debug logging categories
Added debug logging categories that allow a user to output debug
information based on a specified category. This lets the user limit,
and filter debug output to data relevant to a particular context,
or topic. For instance the following categories are now available for
debug logging purposes:

  dtls, dtls_packet, ice, rtcp, rtcp_packet, rtp, rtp_packet,
  stun, stun_packet

These debug categories can be enable/disable via an Asterisk CLI command.

While this overrides, and outputs debug data, core system debugging is
not affected by this patch. Statements still output at their appropriate
debug level. As well backwards compatibility has been maintained with
past debug groups that could be enabled using the CLI (e.g. rtpdebug,
stundebug, etc.).

ASTERISK-29054 #close

Change-Id: I6e6cb247bb1f01dbf34750b2cd98e5b5b41a1849
(cherry picked from commit 56028426de)
2020-10-12 10:50:10 -05:00
Jean Aunis 0b835f2156 resource_endpoints.c: memory leak when providing a 404 response
When handling a send_message request to a non-existing endpoint, the response's
body is overriden and not properly freed.

ASTERISK-29108

Change-Id: Ie1d3d70065f80793445b60f5e4a7eb31b4b9c5c8
2020-10-08 04:55:53 -05:00
Sean Bright d0313d8b12 tcptls.c: Don't close TCP client file descriptors more than once
ASTERISK-28430 #close

Change-Id: Ib556b0a0c95cca939e956886214ec8d828d89606
2020-10-08 04:01:39 -05:00
Ben Ford 681a1624b5 utils.c: NULL terminate ast_base64decode_string.
With the addition of STIR/SHAKEN, the function ast_base64decode_string
was added for convenience since there is a lot of converting done during
the STIR/SHAKEN process. This function returned the decoded string for
you, but did not NULL terminate it, causing some issues (specifically
with MALLOC_DEBUG). Now, the returned string is NULL terminated, and the
documentation has been updated to reflect this.

Change-Id: Icdd7d05b323b0c47ff6ed43492937a03641bdcf5
2020-10-06 09:07:51 -05:00
Ben Ford df7c4ed0ed res_stir_shaken: Fix memory allocation error in curl.c
Fixed a memory allocation that was not passing in the correct size for
the struct in curl.c.

Change-Id: I5fb92fbbe84b075fa6aefa2423786df80e114c3a
2020-10-06 09:07:51 -05:00
Ben Ford 21ab0a450b res_stir_shaken: Add stir_shaken option and general improvements.
Added a new configuration option for PJSIP endpoints - stir_shaken. If
set to yes, then STIR/SHAKEN support will be added to inbound and
outbound INVITEs. The default is no. Alembic has been updated to include
this option.

Previously the dialplan function was not trimming the whitespace from
the parameters it recieved. Now it does.

Also added a conditional that, when TEST_FRAMEWORK is enabled, the
timestamp in the identity header will be overlooked. This is just for
testing, since the testsuite will rely on a SIPp scenario with a preset
identity header to trigger the MISMATCH result.

Change-Id: I43d67f1489b8c1c5729ed3ca8d71e35ddf438df1
2020-10-06 09:07:51 -05:00
Ben Ford d979bdf87a res_stir_shaken: Add outbound INVITE support.
Integrated STIR/SHAKEN support with outgoing INVITEs. When an INVITE is
sent, the caller ID will be checked to see if there is a certificate
that corresponds to it. If so, that information will be retrieved and an
Identity header will be added to the SIP message. The format is:

header.payload.signature;info=<public_key_url>alg=ES256;ppt=shaken

Header, payload, and signature are all BASE64 encoded. The public key
URL is retrieved from the certificate. Currently the algorithm and ppt
are ES256 and shaken, respectively. This message is signed and can be
used for verification on the receiving end.

Two new configuration options have been added to the certificate object:
attestation and origid. The attestation is required and must be A, B, or
C. origid is the origination identifier.

A new utility function has been added as well that takes a string,
allocates space, BASE64 encodes it, then returns it, eliminating the
need to calculate the size yourself.

Change-Id: I1f84d6a5839cb2ed152ef4255b380cfc2de662b4
2020-10-06 09:07:51 -05:00
Ben Ford 746ce16b16 res_stir_shaken: Add inbound INVITE support.
Integrated STIR/SHAKEN support with incoming INVITES. Upon receiving an
INVITE, the Identity header is retrieved, parsing the message to verify
the signature. If any of the parsing fails,
AST_STIR_SHAKEN_VERIFY_NOT_PRESENT will be added to the channel for this
caller ID. If verification itself fails,
AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED will be added. If anything in
the payload does not line up with the SIP signaling,
AST_STIR_SHAKEN_VERIFY_MISMATCH will be added. If all of the above steps
pass, then AST_STIR_SHAKEN_VERIFY_PASSED will be added, completing the
verification process.

A new config option has been added to the general section for
stir_shaken.conf. "signature_timeout" is the amount of time a signature
will be considered valid. If an INVITE is received and the amount of
time between when it was received and when it was signed is greater than
signature_timeout, verification will fail.

Some changes were also made to signing and verification. There was an
error where the whole JSON string was being signed rather than the
header combined with the payload. This has been changed to sign the
correct thing. Verification has been changed to do this as well, and the
unit tests have been updated to reflect these changes.

A couple of utility functions have also been added. One decodes a BASE64
string and returns the decoded string, doing all the length calculations
for you. The other retrieves a string value from a header in a rdata
object.

Change-Id: I855f857be3d1c63b64812ac35d9ce0534085b913
2020-10-06 09:07:51 -05:00
Ben Ford 9d7628829c res_stir_shaken: Add unit tests for signing and verification.
Added two unit tests, one for signing and another for verifying.
stir_shaken_sign checks to make sure that all the required parameters
are passed in and then signs the actual payload. If a signature is
produced and a payload returned as a result, the test passes.
stir_shaken_verify takes the signature from a signed payload to verify.
This unit test also verifies that all the required information is passed
in, and then attempts to verify the signature. If verification is
successful and a payload is returned, the test passes.

Change-Id: I9fa43380f861ccf710cd0f6b6c102a517c86ea13
2020-10-06 09:07:51 -05:00
Ben Ford 035b463c93 res_stir_shaken: Added dialplan function and API call.
Adds the "STIR_SHAKEN" dialplan function and an API call to add a
STIR_SHAKEN verification result to a channel. This information will be
held in a datastore on the channel that can later be queried through the
"STIR_SHAKEN" dialplan funtion to get information on STIR_SHAKEN results
including identity, attestation, and verify_result. Here are some
examples:

STIR_SHAKEN(count)
STIR_SHAKEN(0, identity)
STIR_SHAKEN(1, attestation)
STIR_SHAKEN(2, verify_result)

Getting the count can be used to iterate through the results and pull
information by specifying the index and the field you want to retrieve.

Change-Id: Ice6d52a3a7d6e4607c9c35b28a1f7c25f5284a82
2020-10-06 09:07:51 -05:00
Joshua C. Colp 0392a8e620 res_stir_shaken: Use ast_asprintf for creating file path.
Change-Id: Ice5d92ecea2f1101c80487484f48ef98be2f1824
2020-10-06 09:07:51 -05:00
Ben Ford 70af7e1311 res_stir_shaken: Implemented signature verification.
There are a lot of moving parts in this patch, but the focus of it is on
the verification of the signature using a public key located at the
public key URL provided in the JSON payload. First, we check the
database to see if we have already downloaded the key. If so, check to
see if it has expired. If it has, redownload from the URL. If we don't
have an entry in the database, just go ahead and download the public
key. The expiration is tested each time we download the file. After
that, read the public key from the file and use it to verify the
signature. All sanity checking is done when the payload is first
received, so the verification is complete once this point is reached.

The XML has also been added since a new config option was added to
general (curl_timeout). The maximum amount of time to wait for a
download can be configured through this option, with a low value by
default.

Change-Id: I3ba4c63880493bf8c7d17a9cfca1af0e934d1a1c
2020-10-06 09:07:51 -05:00
Alexander Traud 971b125fc0 res_stir_shaken: Do not build without OpenSSL.
Change-Id: Idba5151a3079f9dcc0076d635422c5df5845114f
2020-10-06 09:07:51 -05:00
Ben Ford e9ee9a381b res_stir_shaken: Implemented signing of JSON payload.
This change provides functions that take in a JSON payload, verify that
the contents contain all the mandatory fields and required values (if
any), and signs the payload with the private key. Four fields are added
to the payload: x5u, attest, iat, and origid. As of now, these are just
placeholder values that will be set to actual values once the logic is
implemented for what to do when an actual payload is received, but the
functions to add these values have all been implemented and are ready to
use. Upon successful signing and the addition of those four values, a
ast_stir_shaken_payload is returned, containing other useful information
such as the algorithm and signature.

Change-Id: I74fa41c0640ab2a64a1a80110155bd7062f13393
2020-10-06 09:07:51 -05:00
Ben Ford 716e51a3f3 res_stir_shaken: Initial commit and reading private key.
This commit sets up some of the initial framework for the module and
adds a way to read the private key from the specified file, which will
then be appended to the certificate object. This works fine for now, but
eventually some other structure will likely need to be used to store all
this information. Similarly, the caller_id_number is specified on the
certificate config object, but in the end we will want that information
to be tied to the certificate itself and read it from there.

A method has been added that will retrieve the private key associated
with the caller_id_number passed in. Tab completion for certificates and
stores has also been added.

Change-Id: Ic4bc1416fab5d6afe15a8e2d32f7ddd4e023295f
2020-10-06 09:07:51 -05:00
Sean Bright 7a64868118 pbx.c: On error, ast_add_extension2_lockopt should always free 'data'
In the event that the desired extension already exists,
ast_add_extension2_lockopt() will free the 'data' it is passed before
returning an error, so we should not be freeing it ourselves.

Additionally, there were two places where ast_add_extension2_lockopt()
could return an error without also freeing the 'data' pointer, so we
add that.

ASTERISK-29097 #close

Change-Id: I904707aae55169feda050a5ed7c6793b53fe6eae
2020-10-02 10:10:58 -05:00
Sean Bright 9ac933fbba app_voicemail.c: Document VMSayName interruption behavior
ASTERISK-26424 #close

Change-Id: I797ad0ed302d0b3d2c90543eff5b7207ed08ecf0
2020-10-02 08:02:25 -05:00
George Joseph 3b0a53f257 app_confbridge/bridge_softmix: Add ability to force estimated bitrate
app_confbridge now has the ability to set the estimated bitrate on an
SFU bridge.  To use it, set a bridge profile's remb_behavior to "force"
and set remb_estimated_bitrate to a rate in bits per second.  The
remb_estimated_bitrate parameter is ignored if remb_behavior is something
other than "force".

Change-Id: Idce6464ff014a37ea3b82944452e56cc4d75ab0a
2020-10-01 08:01:17 -05:00
lvl 374d18cb97 res_musiconhold: Load all realtime entries, not just the first
ASTERISK-29099

Change-Id: I45636679c0fb5a5f59114c8741626631a604e8a6
2020-09-30 08:26:47 -05:00
Holger Hans Peter Freyther cd793c7c81 res_pjsip_sdp_rtp: Fix accidentally native bridging calls
Stop advertising RFC2833 support on the rtp_engine when DTMF mode is
auto but no tel_event was found inside SDP file.

On an incoming call create_rtp will be called and when session->dtmf is
set to AST_SIP_DTMF_AUTO, the AST_RTP_PROPERTY_DTMF will be set without
looking at the SDP file.

Once get_codecs gets called we move the DTMF mode from RFC2833 to INBAND
but continued to advertise RFC2833 support.

This meant the native_rtp bridge would falsely consider the two channels
as compatible. In addition to changing the DTMF mode we now set or
remove the AST_RTP_PROPERTY_DTMF.

The property is checked in ast_rtp_dtmf_compatible and called by
native_rtp_bridge_compatible.

ASTERISK-29051 #close

Change-Id: I1e0c1e324598a437932c0b7836bcb626aba8e287
2020-09-30 07:08:34 -05:00
Jasper van der Neut efcc6d6f6b channels: Don't dereference NULL pointer
Check result of ast_translator_build_path against NULL before dereferencing.

ASTERISK-29091

Change-Id: Ia3538ea190bd371f70c9dd49984b021765691b29
2020-09-30 07:08:26 -05:00
Torrey Searle 14b483dd5e res_pjsip_diversion: fix double 181
Arming response to both AST_SIP_SESSION_BEFORE_REDIRECTING and
AST_SIP_SESSION_BEFORE_MEDIA causes 302 to to be handled twice,
resulting in to 181 being generated.

Change-Id: I866e5461564644ffb8a5e12b6f1330b50a7b63ab
2020-09-29 07:24:11 -05:00
Sean Bright fccf360fcb res_musiconhold: Clarify that playlist mode only supports HTTP(S) URLs
Change-Id: I41e77a04e4a523f4ed61a7a20b738ffd42be441e
2020-09-28 13:20:12 -05:00
Sean Bright cba132a797 dsp.c: Update calls to ast_format_cmp to check result properly
ASTERISK-28311 #close

Change-Id: Ib1ce8fc1a8752751f5bf3615c59245532dfd9aa2
2020-09-23 15:21:30 -05:00
Joshua C. Colp baa6e8f112 res_pjsip_session: Fix stream name memory leak.
When constructing a stream name based on the media type
and position the allocated name was not being freed
causing a leak.

Change-Id: I52510863b24a2f531f0a55b440bb2c81844029de
2020-09-23 10:50:09 -05:00
Sean Bright 799426cd58 func_curl.c: Prevent crash when using CURLOPT(httpheader)
Because we use shared thread-local cURL instances, we need to ensure
that the state of the cURL instance is correct before each invocation.

In the case of custom headers, we were not resetting cURL's internal
HTTP header pointer which could result in a crash if subsequent
requests do not configure custom headers.

ASTERISK-29085 #close

Change-Id: I8b4ab34038156dfba613030a45f10e932d2e992d
2020-09-23 10:05:18 -05:00
Sean Bright 4a7bbac0ed res_musiconhold: Start playlist after initial announcement
Only track our sample offset if we are playing a non-announcement file,
otherwise we will skip that number of samples when we start playing the
first MoH file.

ASTERISK-24329 #close

Change-Id: Ib6b3c84fcaa1063889ab38ba7e7fc50050a3ccfc
2020-09-23 10:03:32 -05:00
Joshua C. Colp e6ed74347c res_pjsip_session: Fix session reference leak.
The ast_sip_dialog_get_session function returns the session
with reference count increased. This was not taken into
account and was causing sessions to remain around when they
should not be.

ASTERISK-29089

Change-Id: I430fa721b0a824311a59effec6056e9ec528e3e8
2020-09-23 09:59:40 -05:00
Michal Hajek f7285140b4 res_stasis.c: Add compare function for bridges moh container
Sometimes not play MOH on bridge.

ASTERISK-29081
Reported-by: Michal Hajek <michal.hajek@daktela.com>

Change-Id: I760c73e0c9be1d340303b5d1c18a00c4759e8232
2020-09-23 09:55:50 -05:00
George Joseph fb6f2157e7 logger.h: Fix ast_trace to respect scope_level
ast_trace() was always emitting messages when it's level was set to -1
because it was ignoring scope_level.

Change-Id: I849c8f4f4613899c37f82be0202024e7d117e506
2020-09-22 09:54:47 -05:00
George Joseph 8d9633074e bridge_softmix/sfu_topologies_on_join: Ignore topology change failures
When a channel joins a bridge, we do topology change requests on all
existing channels to add the new participant to them.  However the
announcer channel will return an error because it doesn't support
topology in the first place.  Unfortunately, there doesn't seem to be a
reliable way to tell if the error is expected or not so the error is
ignored for all channels.  If the request fails on a "real" channel,
that channel just won't get the new participant's video.

Change-Id: Ic95db4683f27d224c1869fe887795d6b9fdea4f0
2020-09-17 13:19:21 -06:00
Sean Bright 9458577f68 res_pjsip_session.c: Fix build when TEST_FRAMEWORK is not defined
Change-Id: Id4852c26e9c412af8e37b5dd3c15da9453ad3276
2020-09-16 09:09:01 -05:00
Torrey Searle 5a12463c07 res_pjsip_diversion: implement support for History-Info
Implemention of History-Info capable of interworking with Diversion
Header following RFC7544

ASTERISK-29027 #close

Change-Id: I2296369582d4b295c5ea1e60bec391dd1d318fa6
2020-09-16 09:06:33 -05:00
Sean Bright c9cc281484 format_cap: Perform codec lookups by pointer instead of name
ASTERISK-28416 #close

Change-Id: I069420875ebdbcaada52d92599a5f7de3cb2cdf4
2020-09-15 14:35:12 -05:00
George Joseph df429c97a1 res_pjsip_session: Fix issue with COLP and 491
The recent 491 changes introduced a check to determine if the active
and pending topologies were equal and to suppress the re-invite if they
were. When a re-invite is sent for a COLP-only change, the pending
topology is NULL so that check doesn't happen and the re-invite is
correctly sent. Of course, sending the re-invite sets the pending
topology.  If a 491 is received, when we resend the re-invite, the
pending topology is set and since we didn't request a change to the
topology in the first place, pending and active topologies are equal so
the topologies-equal check causes the re-invite to be erroneously
suppressed.

This change checks if the topologies are equal before we run the media
state resolver (which recreates the pending topology) so that when we
do the final topologies-equal check we know if this was a topology
change request.  If it wasn't a change request, we don't suppress
the re-invite even though the topologies are equal.

ASTERISK-29014

Change-Id: Iffd7dd0500301156a566119ebde528d1a9573314
2020-09-14 09:37:23 -06:00
George Joseph 6abf6f345d debugging: Add enough to choke a mule
Added to:
 * bridges/bridge_softmix.c
 * channels/chan_pjsip.c
 * include/asterisk/res_pjsip_session.h
 * main/channel.c
 * res/res_pjsip_session.c

There NO functional changes in this commit.

Change-Id: I06af034d1ff3ea1feb56596fd7bd6d7939dfdcc3
2020-09-11 10:43:18 -06:00
George Joseph 65088494cb res_pjsip_session: Handle multi-stream re-invites better
When both Asterisk and a UA send re-invites at the same time, both
send 491 "Transaction in progress" responses to each other and back
off a specified amount of time before retrying. When Asterisk
prepares to send its re-invite, it sets up the session's pending
media state with the new topology it wants, then sends the
re-invite.  Unfortunately, when it received the re-invite from the
UA, it partially processed the media in the re-invite and reset
the pending media state before sending the 491 losing the state it
set in its own re-invite.

Asterisk also was not tracking re-invites received while an existing
re-invite was queued resulting in sending stale SDP with missing
or duplicated streams, or no re-invite at all because we erroneously
determined that a re-invite wasn't needed.

There was also an issue in bridge_softmix where we were using a stream
from the wrong topology to determine if a stream was added.  This also
caused us to erroneously determine that a re-invite wasn't needed.

Regardless of how the delayed re-invite was triggered, we need to
reconcile the topology that was active at the time the delayed
request was queued, the pending topology of the queued request,
and the topology currently active on the session.  To do this we
need a topology resolver AND we need to make stream named unique
so we can accurately tell what a stream has been added or removed
and if we can re-use a slot in the topology.

Summary of changes:

 * bridge_softmix:
   * We no longer reset the stream name to "removed" in
     remove_all_original_streams().  That was causing  multiple streams
     to have the same name and wrecked the checks for duplicate streams.

   * softmix_bridge_stream_sources_update() was checking the old_stream
     to see if it had the softmix prefix and not considering the stream
     as "new" if it did.  If the stream in that slot has something in it
     because another re-invite happened, then that slot in old might
     have a softmix stream but the same stream in new might actually
     be a new one.  Now we check the new_stream's name instead of
     the old_stream's.

 * stream:
   * Instead of using plain media type name ("audio", "video", etc) as
     the default stream name, we now append the stream position to it
     to make it unique.  We need to do this so we can distinguish multiple
     streams of the same type from each other.

   * When we set a stream's state to REMOVED, we no longer reset its
     name to "removed" or destroy its metadata.  Again, we need to
     do this so we can distinguish multiple streams of the same
     type from each other.

 * res_pjsip_session:
   * Added resolve_refresh_media_states() that takes in 3 media states
     and creates an up-to-date pending media state that includes the changes
     that might have happened while a delayed session refresh was in the
     delayed queue.

   * Added is_media_state_valid() that checks the consistency of
     a media state and returns a true/false value. A valid state has:
     * The same number of stream entries as media session entries.
         Some media session entries can be NULL however.
     * No duplicate streams.
     * A valid stream for each non-NULL media session.
     * A stream that matches each media session's stream_num
       and media type.

   * Updated handle_incoming_sdp() to set the stream name to include the
     stream position number in the name to make it unique.

   * Updated the ast_sip_session_delayed_request structure to include both
     the pending and active media states and updated the associated delay
     functions to process them.

   * Updated sip_session_refresh() to accept both the pending and active
     media states that were in effect when the request was originally queued
     and to pass them on should the request need to be delayed again.

   * Updated sip_session_refresh() to call resolve_refresh_media_states()
     and substitute its results for the pending state passed in.

   * Updated sip_session_refresh() with additional debugging.

   * Updated session_reinvite_on_rx_request() to simply return PJ_FALSE
     to pjproject if a transaction is in progress.  This stops us from
     creating a partial pending media state that would be invalid later on.

   * Updated reschedule_reinvite() to clone both the current pending and
     active media states and pass them to delay_request() so the resolver
     can tell what the original intention of the re-invite was.

   * Added a large unit test for the resolver.

ASTERISK-29014

Change-Id: Id3440972943c611a15f652c6c569fa0e4536bfcb
2020-09-11 10:43:18 -06:00
Sungtae Kim af339d0adb res_stasis.c: Added video_single option for bridge creation
Currently, it was not possible to create bridge with video_mode single.
This made hard to put the bridge in a vidoe_single mode.
So, added video_single option for Bridge creation using the ARI.
This allows create a bridge with video_mode single.

ASTERISK-29055

Change-Id: I43e720e5c83fc75fafe10fe22808ae7f055da2ae
2020-09-10 10:34:38 -05:00
Sungtae Kim a353b76c75 realtime: Increased reg_server character size
Currently, the ps_contacts table's reg_server column in realtime database type is varchar(20).
This is fine for normal cases, but if the hostname is longer than 20, it returns error and then
failed to register the contact address of the peer.

Normally, 20 characters limitation for the hostname is fine, but with the cloud env.
So, increased the size to 255.

ASTERISK-29056

Change-Id: Iac52c8c35030303cfa551bb39f410b33bffc507d
2020-09-10 10:32:17 -05:00
Ben Ford e7620d034a Bridging: Use a ref to bridge_channel's channel to prevent crash.
There's a race condition with bridging where a bridge can be torn down
causing the bridge_channel's ast_channel to become NULL when it's still
needed. This particular case happened with attended transfers, but the
crash occurred when trying to publish a stasis message. Now, the
bridge_channel is locked, a ref to the ast_channel is obtained, and that
ref is passed down the chain.

Change-Id: Ic48715c0c041615d17d286790ae3e8c61bb28814
2020-09-10 05:54:49 -05:00
Asterisk Development Team bd0724c7ed Update CHANGES and UPGRADE.txt for 16.14.0 2020-09-09 09:01:46 -05:00
Patrick Verzele ab34417f7e res_pjsip_session: Deferred re-INVITE without SDP send a=sendrecv instead of a=sendonly
Building on ASTERISK-25854. When the device requests hold by sending SDP with attribute recvonly, asterisk places the session in sendonly mode. When the device later requests to resume the call by using a re-INVITE excluding SDP, asterisk needs to change the sendonly mode to sendrecv again.

Change-Id: I60341ce3d87f95869f3bc6dc358bd3e8286477a6
2020-09-03 08:14:54 -05:00
Kevin Harwell 7b441505dc conversions: Add string to signed integer conversion functions
Change-Id: Id603b0b03b78eb84c7fca030a08b343c0d5973f9
2020-09-02 06:38:32 -05:00
Kfir Itzhak ae718c975a app_queue: Fix leave-empty not recording a call as abandoned
This fixes a bug introduced mistakenly in ASTERISK-25665:
If leave-empty is enabled, a call may sometimes be removed from
a queue without recording it as abandoned.
This causes Asterisk to not generate an abandon event for that
call, and for the queue abandoned counter to be incorrect.

ASTERISK-29043 #close

Change-Id: I1a71b81df78adff59af587f1d8483cf57df430c7
2020-09-01 10:14:12 -05:00
George Joseph a14c5301e7 ast_coredumper: Fix issues with naming
If you run ast_coredumper --tarball-coredumps in the same directory
as the actual coredump, tar can fail because the link to the
actual coredump becomes recursive.  The resulting tarball will
have everything _except_ the coredump (which is usually what
you need)

There's also an issue that the directory name in the tarball
is the same as the coredump so if you extract the tarball the
directory it creates will overwrite the coredump.

So:

 * Made the link to the coredump use the absolute path to the
   file instead of a relative one.  This prevents the recursive
   link and allows tar to add the coredump.

 * The tarballed directory is now named <coredump>.output instead
   of just <coredump> so if you expand the tarball it won't
   overwrite the coredump.

Change-Id: I8b3eeb26e09a577c702ff966924bb0a2f9a759ea
2020-08-31 18:08:57 -05:00
Joshua C. Colp 075a7ee4a6 parking: Copy parker UUID as well.
When fixing issues uncovered by GCC10 a copy of the parker UUID
was removed accidentally. This change restores it so that the
subscription has the data it needs.

ASTERISK-29042

Change-Id: I7d396a14ea648bd26d3c363dd78e78bd386b544a
2020-08-31 12:19:40 -05:00
Sean Bright 53a88df076 app_voicemail: Fix pollmailboxes
The name of the voicemail context was overwriting the name of the
subscribed mailbox. Fix by simplifying how we create the MWI
subscription.

ASTERISK-29029 #close

Change-Id: Ie8a7db6a0b68f3995b0846bbb733a21909ba44e5
2020-08-31 08:55:01 -05:00
Alexander Traud afc5cf8d67 samples: Fix keep_alive_interval default in pjsip.conf.
Since ASTERISK_27978 the default is not off but 90 seconds. That change
happened because ASTERISK_27347 disabled the keep-alives in the bundled
PJProject and Asterisk should behave the same as before.

Change-Id: Ie63dc558ade6a5a2b969c30a4bd492d63730dc46
2020-08-28 15:47:38 -05:00
Alexander Traud 0fa20c8df6 sip_nat_settings: Update script for latest Linux.
With the latest Linux, 'ifconfig' is not installed on default anymore.
Furthermore, the output of the current net-tools 'ifconfig' changed.
Therefore, parsing failed. This update uses 'ip addr show' instead.
Finally, the service for the external IP changed.

Change-Id: I9b1a7c3f457e3553b50a3e9a55524e40d70245a0
2020-08-28 14:58:45 -05:00
Kevin Harwell 17258e0cdf chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution
This patch makes it so if the PJSIP_SEND_SESSION_REFRESH dialplan function
is called on a channel prior to answering a warning is issued and the
function returns unsuccessful.

ASTERISK-28878 #close

Change-Id: I053f767d10cf3b2b898fa9e3e7c35ff07e23c9bb
2020-08-28 12:57:00 -05:00
Joshua C. Colp 0452717645 pbx: Fix hints deadlock between reload and ExtensionState.
When the ExtensionState AMI action is executed on a pattern matched
hint it can end up adding a new hint if one does not already exist.
This results in a locking order of contexts -> hints -> contexts.

If at the same time a reload is occurring and adding its own hint
it will have a locking order of hints -> contexts.

This results in a deadlock as one thread wants a lock on contexts
that the other has, and the other thread wants a lock on hints
that the other has.

This change enforces a hints -> contexts locking order by explicitly
locking hints in the places where a hint is added when queried for.
This matches the order seen through normal adding of hints.

ASTERISK-29046

Change-Id: I49f027f4aab5d2d50855ae937bcf5e2fd8bfc504
2020-08-28 12:36:04 -05:00
George Joseph d28a44c33d logger.c: Added a new log formatter called "plain"
Added a new log formatter called "plain" that always prints
file, function and line number if available (even for verbose
messages) and never prints color control characters.  It also
doesn't apply any special formatting for verbose messages.
Most suitable for file output but can be used for other channels
as well.

You use it in logger.conf like so:
debug => [plain]debug
console => [plain]error,warning,debug,notice,pjsip_history
messages => [plain]warning,error,verbose

Change-Id: I4fdfe4089f66ce2f9cb29f3005522090dbb5243d
2020-08-28 12:32:40 -05:00
Nickolay Shmyrev 444c606161 res_speech: Bump reference on format object
Properly bump reference on format object to avoid memory corruption on double free

ASTERISK-29040 #close

Change-Id: Ic5a7faabfe2ef965ddb024186e1de7ca4542e2a3
2020-08-27 13:50:54 -05:00
Torrey Searle 75756ab850 res_pjsip_diversion: handle 181
Adapt the response handler so it also called when 181 is received.
In the case 181 is received, also generate the 181 response.

ASTERISK-29001 #close

Change-Id: I73cfee46a8ca85371280ebdb38674f8fde7510df
2020-08-26 13:14:05 -05:00
Evandro César Arruda aa93107444 app_queue: Member lastpause time reseting
This fixes the reseting members lastpause problem when realtime members is being used,
the function rt_handle_member_record was forcing the reset members lastpause because it
does not exist in realtime

ASTERISK-29034 #close

Change-Id: Ic9107e4456732a1f78412a32adb2ef87f5da40b5
2020-08-25 18:27:54 -05:00
Sean Bright 788b60d935 app_voicemail: Process urgent messages with mailcmd
Rather than putting messages into INBOX and then moving them to Urgent
later, put them directly in to the Urgent folder. This prevents
mailcmd from being skipped.

ASTERISK-27273 #close

Change-Id: I49934e093290d308506ab8d45a40ef705c5ae4f5
2020-08-25 16:43:29 -05:00
Joshua C. Colp eaed23b340 res_pjsip_session: Don't aggressively terminate on failed re-INVITE.
Per the RFC when an outgoing re-INVITE is done we should
only terminate the dialog if a 481 or 408 is received.

ASTERISK-29033

Change-Id: I6c3ff513aa41005d02de0396ba820083e9b18503
2020-08-25 13:39:42 -05:00
Sean Bright 32b593c325 bridge_channel: Ensure text messages are zero terminated
T.140 data in RTP is not zero terminated, so when we are queuing a text
frame on a bridge we need to ensure that we are passing a zero
terminated string.

ASTERISK-28974 #close

Change-Id: Ic10057387ce30b2094613ea67e3ae8c5c431dda3
2020-08-25 10:06:59 -05:00
Sean Bright 55358b1276 res_musiconhold.c: Use ast_file_read_dir to scan MoH directory
Two changes of note in this patch:

* Use ast_file_read_dir instead of opendir/readdir/closedir

* If the files list should be sorted, do that at the end rather than as
  we go which improves performance for large lists

Change-Id: Ic7e9c913c0f85754c99c74c9cf6dd3514b1b941f
2020-08-25 09:35:19 -05:00
George Joseph b9ba0f8da8 scope_trace: Added debug messages and added additional macros
The SCOPE_ENTER and SCOPE_EXIT* macros now print debug messages
at the same level as the scope level.  This allows the same
messages to be printed to the debug log when AST_DEVMODE
isn't enabled.

Also added a few variants of the SCOPE_EXIT macros that will
also call ast_log instead of ast_debug to make it easier to
use scope tracing and still print error messages.

Change-Id: I7fe55f7ec28069919a0fc0b11a82235ce904cc21
2020-08-24 08:45:26 -05:00
George Joseph 377caaed3c stream.c: Added 2 more debugging utils and added pos to stream string
* Added ast_stream_to_stra and ast_stream_topology_to_stra() macros
   which are shortcuts for
      ast_str_tmp(256, ast_stream_to_str(stream, &STR_TMP))

 * Added the stream position to the string representation of the
   stream.

 * Fixed some formatting in ast_stream_to_str().

Change-Id: Idaf4cb0affa46d4dce58a73a111f35435331cc4b
2020-08-20 08:42:37 -05:00
Dennis Buteyn 9c6d14b26b chan_sip: Clear ToHost property on peer when changing to dynamic host
The ToHost parameter was not cleared when a peer's host value was
changed to dynamic. This causes invites to be sent to the original host.

ASTERISK-29011 #close

Change-Id: I9678d512741f71baca8f131a65b7523020b07d5c
2020-08-18 09:01:15 -05:00
cmaj 5609d008da Makefile: Fix certified version numbers
Adds sed before awk to produce reasonable ASTERISKVERSIONNUM
on certified versions of Asterisk eg. 16.8-cert3 is 160803
instead of the previous 00800.

ASTERISK-29021 #close

Change-Id: Icf241df0ff6db09011b8c936a317a84b0b634e16
2020-08-14 14:50:09 -05:00
George Joseph 16afb0a05d scope_trace: Add/update utilities
* Added a AST_STREAM_STATE_END sentinel
* Add ast_stream_to_str()
* Add ast_stream_state_to_str()
* Add ast_stream_get_format_count()
* Add ast_stream_topology_to_str()
* Add ast_stream_topology_get_active_count()
* Add ast_format_cap_append_names()
* Add ast_sip_session_get_name()

Change-Id: I132eb5971ea41509c660f64e9113cda8c9013b0b
2020-08-13 06:34:45 -05:00
Sean Bright cd8e011670 res_musiconhold.c: Prevent crash with realtime MoH
The MoH class internal file vector is potentially being manipulated by
multiple threads at the same time without sufficient locking. Switch to
a reference counted list and operate on copies where necessary.

ASTERISK-28927 #close

Change-Id: I479c5dcf88db670956e8cac177b5826c986b0217
2020-08-11 16:05:46 -05:00
Sean Bright abad395098 vector.h: Fix implementation of AST_VECTOR_COMPACT() for empty vectors
The assumed behavior of realloc() - that it was effectively a free() if
its second argument was 0 - is Linux specific behavior and is not
guaranteed by either POSIX or the C specification.

Instead, if we want to resize a vector to 0, do it explicitly.

Change-Id: Ife31d4b510ebab41cb5477fdc7ea4e3138ca8b4f
2020-08-10 07:02:40 -05:00
Michael Neuhauser 1e58da7814 pjproject: clone sdp to protect against (nat) modifications
PJSIP, UDP transport with external_media_address and session timers
enabled. Connected to SIP server that is not in local net. Asterisk
initiated the connection and is refreshing the session after 150s
(timeout 300s). The 2nd refresh-INVITE triggered by the pjsip timer has
a malformed IP address in its SDP (garbage string). This only happens
when the SDP is modified by the nat-code to replace the local IP address
with the configured external_media_address.
Analysis: the code to modify the SDP (in
res_pjsip_session.c:session_outgoing_nat_hook() and also (redundantly?)
in res_pjsip_sdp_rtp.c:change_outgoing_sdp_stream_media_address()) uses
the tdata->pool to allocate the replacement string. But the same
pjmedia_sdp_stream that was modified for the 1st refresh-INVITE is also
used for the 2nd refresh-INVITE (because it is stored in pjmedia's
pjmedia_sdp_neg structure). The problem is, that at that moment, the
tdata->pool that holds the stringified external_media_address from the
1. refresh-INVITE has long been reused for something else.
Fix by Sauw Ming of pjproject (see
https://github.com/pjsip/pjproject/pull/2476): the local, potentially
modified pjmedia_sdp_stream is cloned in
pjproject/source/pjsip/src/pjmedia/sip_neg.c:process_answer() and the
clone is stored, thereby detaching from the tdata->pool (which is only
released *after* process_answer())

ASTERISK-28973
Reported-by: Michael Neuhauser

Change-Id: I272ac22436076596e06aa51b9fa23fd1c7734a0e
2020-08-10 06:25:12 -05:00
George Joseph 8c54be8fc9 res_pjsip_session: Ensure reused streams have correct bundle group
When a bundled stream is removed, its bundle_group is reset to -1.
If that stream is later reused, the bundle parameters on session
media need to be reset correctly it could mistakenly be rebundled
with a stream that was removed and never reused.  Since the removed
stream has no rtp instance, a crash will result.

Change-Id: Ie2b792220f9291587ab5f9fd123145559dba96d7
2020-07-28 12:05:34 -05:00
Joshua C. Colp 2196511121 res_pjsip_registrar: Don't specify an expiration for static contacts.
Statically configured contacts on an AOR don't have an expiration
time so when adding them to the resulting 200 OK if an endpoint
registers ensure they are marked as such.

ASTERISK-28995

Change-Id: I9f0e45eb2ccdedc9a0df5358634a19ccab0ad596
2020-07-28 09:46:04 -05:00
Sean Bright e9e441c399 utf8.c: Add UTF-8 validation and utility functions
There are various places in Asterisk - specifically in regards to
database integration - where having some kind of UTF-8 validation would
be beneficial. This patch adds:

* Functions to validate that a given string contains only valid UTF-8
  sequences.

* A function to copy a string (similar to ast_copy_string) stopping when
  an invalid UTF-8 sequence is encountered.

* A UTF-8 validator that allows for progressive validation.

All of this is based on the excellent UTF-8 decoder by Björn Höhrmann.
More information is available here:

    https://bjoern.hoehrmann.de/utf-8/decoder/dfa/

The API was written in such a way that should allow us to replace the
implementation later should we determine that we need something more
comprehensive.

Change-Id: I3555d787a79e7c780a7800cd26e0b5056368abf9
2020-07-27 17:36:23 -05:00
sungtae kim 15a3318f1f stasis_bridge.c: Fixed wrong video_mode shown
Currently, if the bridge has created by the ARI, the video_mode
parameter was
not shown in the BridgeCreated event correctly.

Fixed it and added video_mode shown in the 'bridge show <bridge id>'
cli.

ASTERISK-28987

Change-Id: I8c205126724e34c2bdab9380f523eb62478e4295
2020-07-24 11:32:26 -05:00
Sean Bright 7892bdec53 vector.h: Add AST_VECTOR_SORT()
Allows a vector to be sorted in-place, rather than only during
insertion.

Change-Id: I22cba9ddf556a7e44dacc53c4431bd81dd2fa780
2020-07-24 11:29:03 -05:00
George Joseph e91e2ec0da CI: Force publishAsteriskDocs to use python2
Change-Id: I7d951e75ad2d472fa096647dfb55670b11105e23
2020-07-24 08:56:53 -05:00
Joshua C. Colp e8deea38bd websocket / pjsip: Increase maximum packet size.
When dealing with a lot of video streams on WebRTC
the resulting SDPs can grow to be quite large. This
effectively doubles the maximum size to allow more
streams to exist.

The res_http_websocket module has also been changed
to use a buffer on the session for reading in packets
to ensure that the stack space usage is not excessive.

Change-Id: I31d4351d70c8e2c11564807a7528b984f3fbdd01
2020-07-23 07:30:38 -05:00
Sean Bright d78ccb800e acl.c: Coerce a NULL pointer into the empty string
If an ACL is misconfigured in the realtime database (for instance, the
"rule" is blank) and Asterisk attempts to read the ACL, Asterisk will
crash.

ASTERISK-28978 #close

Change-Id: Ic1536c4df856231bfd2da00128f7822224d77610
2020-07-20 11:37:29 -05:00
Joshua C. Colp 9ce6d46aea pjsip: Include timer patch to prevent cancelling timer 0.
I noticed this while looking at another issue and brought
it up with Teluu. It was possible for an uninitialized timer
to be cancelled, resulting in the invalid timer id of 0
being placed into the timer heap causing issues.

This change is a backport from the pjproject repository
preventing this from happening.

Change-Id: I1ba318b1f153a6dd7458846396e2867282b428e7
2020-07-20 11:34:16 -05:00
Nickolay Shmyrev 373e97ea4e res_http_websocket: Avoid reading past end of string
We read beyond the end of the buffer when copying the string out of the
buffer when we used ast_copy_string() because the original string was
not null terminated. Instead switch to ast_strndup() which does not
exhibit the same behavior.

ASTERISK-28975 #close

Change-Id: Ib4a75cffeb1eb8cf01136ef30306bd623e531a2a
2020-07-10 08:32:25 -05:00
Asterisk Development Team 21f2044d38 Update CHANGES and UPGRADE.txt for 16.12.0 2020-07-09 10:29:41 -05:00
George Joseph fdcb3e2ead frame.c: Make debugging easier
* ast_frame_subclass2str() and ast_frame_type2str() now return
   a pointer to the buffer that was passed in instead of void.
   This makes it easier to use these functions inline in
   printf-style debugging statements.

 * Added many missing control frame entries in
   ast_frame_subclass2str.

Change-Id: Ifd0d6578e758cd644c96d17a5383ff2128c572fc
2020-07-07 15:02:45 -05:00
George Joseph af595e918e Scope Trace: Make it easier to trace through synchronous tasks
Tracing through synchronous tasks was a little troublesome because
the new thread's stack counter reset to 0.  This change allows
a synchronous task to set its trace level to be the same as the
thread that pushed the task.  For now, the task's level has to be
passed in the task's data structure but a future enhancement to the
taskprocessor subsystem could automatically set the trace level
of the servant to be that of the caller.

This doesn't really make sense for async tasks because you never
know when they're going to run anyway.

Change-Id: Ib8049c0b815063a45d8c7b0cb4e30b7b87b1d825
2020-07-07 14:09:50 -05:00
sungtae kim e34da79c60 res_pjsip.c: Added disable_rport option for pjsip.conf
Currently when the pjsip making an outgoing request, it keep adding the
rport parameter in a request message as a default.

This causes unexpected rport handle at the other end.

Added option for disable this behaviour in the pjsip.conf.

This is a system option, but working as a gloabl option.

ASTERISK-28959

Change-Id: I9596675e52a742774738b5aad5d1fec32f477abc
2020-07-07 09:35:18 -05:00
Nickolay Shmyrev a700134f57 res_http_websocket.c: Continue reading after ping/pong
Do not return error if the client received ping frame
while looking for a string and just wait for another frame.

ASTERISK-28958 #close

Change-Id: I4d06b4827bd71e56cbaafc011ffdcef9f0332922
2020-07-07 09:33:26 -05:00
Kevin Harwell c356187969 PJSIP_MEDIA_OFFER: override configuration on refresh
When using the PSJIP_MEDIA_OFFER dialplan function it was not
overriding an endpoint's configured codecs on refresh unless
they had a shared codec between the two.

This patch makes it so whatever is set using PJSIP_MEDIA_OFFER
is used when creating the SDP for a refresh no matter what.

ASTERISK-28878 #close

Change-Id: I0f7dc86fd0fb607c308e6f98ede303c54d1eacb6
2020-07-06 09:06:19 -05:00
Kevin Harwell d9b8f04cd4 manager - Add Content-Type parameter to the SendText action
This patch allows a user of AMI to now specify the type of message
content contained within by setting the 'Content-Type' parameter.

Note, the AMI version has been bumped for this change.

ASTERISK-28945 #close

Change-Id: Ibb5315702532c6b954e1498beddc8855fabdf4bb
2020-07-06 05:27:19 -05:00
George Joseph 43ba72dea0 Scope Trace: Add some new tracing macros and an ast_str helper
Created new SCOPE_ functions that don't depend on RAII_VAR.  Besides
generating less code, the use of the explicit SCOPE_EXIT macros
capture the line number where the scope exited.  The RAII_VAR
versions can't do that.

 * SCOPE_ENTER(level, ...): Like SCOPE_TRACE but doesn't use
   RAII_VAR and therefore needs needs one of...

 * SCOPE_EXIT(...): Decrements the trace stack counter and optionally
   prints a message.

 * SCOPE_EXIT_EXPR(__expr, ...): Decrements the trace stack counter,
   optionally prints a message, then executes the expression.
   SCOPE_EXIT_EXPR(break, "My while got broken\n");

 * SCOPE_EXIT_RTN(, ...): Decrements the trace stack counter,
   optionally prints a message, then returns without a value.
   SCOPE_EXIT_RTN("Bye\n");

 * SCOPE_EXIT_RTN_VALUE(__return_value, ...): Decrements the trace
   stack counter, optionally prints a message, then returns the value
   specified.
   SCOPE_EXIT_RTN_VALUE(rc, "Returning with RC: %d\n", rc);

Create an ast_str helper ast_str_tmp() that allocates a temporary
ast_str that can be passed to a function that needs it, then frees
it.  This makes using the above macros easier.  Example:

   SCOPE_ENTER(1, Format Caps 1: %s  Format Caps 2: %s\n",
       ast_str_tmp(32, ast_format_cap_get_names(cap1, &STR_TMP),
       ast_str_tmp(32, ast_format_cap_get_names(cap2, &STR_TMP));

The calls to ast_str_tmp create an ast_str of the specified initial
length which can be referenced as STR_TMP.  It then calls the
expression, which must return a char *, ast_strdupa's it, frees
STR_TMP, then returns the ast_strdupa'd string.  That string is
freed when the function returns.

Change-Id: I44059b20d55a889aa91440d2f8a590865998be51
2020-06-30 08:12:46 -06:00
Joshua C. Colp f252eae438 res_pjsip: Apply AOR outbound proxy to static contacts.
The outbound proxy for an AOR was not being applied to
any statically configured Contacts. This resulted in the
OPTIONS requests being sent to the wrong target.

This change sets the outbound proxy on statically configured
contacts once the AOR configuration is done being
applied.

ASTERISK-28965

Change-Id: Ia60f3e93ea63f819c5a46bc8b54be2e588dfa9e0
2020-06-26 05:37:58 -05:00
Joshua C. Colp b39d3b5d70 menuselect: Resolve infinite loop in dependency scenario.
Given a scenario where a module has a dependency on both
an external library and a module if the external library was
available and the module was not an infinite loop would
occur. This happened due to the code changing the dependecy
status to no failure on each dependency checking loop
iteration, resulting in the code thinking that it had
gone from no failure to failure each time triggering another
dependency check.

This change makes it so that the old dependency status is
preserved throughout the dependency checking allowing it to
determine that after the first iteration the dependency
status does not transition from no failure to failure.

ASTERISK-28930

Change-Id: Iea06d45d9fd6d8bfd068882a0bb7e23a53ec3e84
2020-06-25 14:37:20 -05:00
Kevin Harwell 2148505f09 chan_pjsip: don't use PJSIP_SC_NULL as it only exists pjproject 2.8+
A patch made a reference to the PJSIP_SC_NULL enumeration value, which
was added to pjproject 2.8 and above thus making it so Asterisk would
fail to compile with prior versions of pjproject.

This patch removes the reference, and instead initializes the value
to '0'.

ASTERISK-28886 #close

Change-Id: I68491c80da1a0154b2286c9458440141c98db9d7
2020-06-25 09:48:23 -05:00
Frederic LE FOLL 5415606846 chan_sip: chan_sip does not process 400 response to an INVITE.
chan_sip handle_response() function, for a 400 response to an INVITE,
calls handle_response_invite() and does not generate ACK.
handle_response_invite() does not recognize 400 response and has no
default response processing for unexpected responses, thus it does not
generate ACK either.
The ACK on response repetition comes from handle_response() mechanism
"We must re-send ACKs to re-transmitted final responses".

According to code history, 400 response specific processing was
introduced with commit
"channels/chan_sip: Add improved support for 4xx error codes"
This commit added support for :
- 400/414/493 in handle_response_subscribe() handle_response_register()
  and handle_response().
- 414/493 only in handle_response_invite().

This fix adds 400 response support in handle_response_invite().

ASTERISK-28957

Change-Id: Ic71a087e5398dfc7273946b9ec6f9a36960218ad
2020-06-25 09:22:39 -05:00
Università di Bologna - CESIA VoIP a539ce7087 res_corosync: Fix crash in huge distributed environment.
1) Fix memory-leaks
   Added code to release ast_events extracted from corosync and stasis messages

2) Clean stasis cache when a member of the corosync cluster leaves the group
   Added code to remove from the stasis cache of the members remained on the
   group all the messages with the EID of the left member.
   If the device states of the left member remain in the stasis cache of other
   members, they will not be updated anymore and high priority cached values,
   like BUSY, will take precedence over current device states.

3) Stop corosync event propagation when node is not joined to the group
   Updated dispatch_thread_handler code to detect when asterisk is not joined
   to the corosync group and added some condition in publish_event_to_corosync
   code to send corosync messages only when joined.
   When a node is not joined its corosync daemon can't send messages:
   the cpg_mcast_joined function append new messages to the FIFO buffer until
   it's full and then it blocks indefinitely.
   In this scenario if the stasis_message_cb callback, registered by
   res_corosync to handle stasis messages, try to send a corosync messages,
   the thread of the stasis thread-pool will be blocked until the node join
   the corosync cluster.

ASTERISK-28888
Reported by: Università di Bologna - CESIA VoIP

Change-Id: Ie8e99bc23f141a73c13ae6fb1948d148d4de17f2
2020-06-22 13:05:35 -05:00
Moises Silva b986b629e4 res_http_websocket: Add payload masking to the websocket client
ASTERISK-28949

Change-Id: Id465030f2b1997b83d408933fdbabe01827469ca
2020-06-22 08:24:06 -05:00
Guido Falsi 10bc2d40e5 chan_dadhi: Fix setvar in dahdi channels
The change to how setvar works for various channels performed in
ASTERISK~23756 missed some required change in the dahdi channel,
where the variables are actually set while reading configuration.
This change should fix the issue.

ASTERISK-28955

Change-Id: Ibfeb7f8cbdd735346dc4028de6a265f24f9df274
2020-06-19 09:20:37 -05:00
Joshua C. Colp 397aa391b7 app_stream_echo: Fix state of added streams.
When stream support was added to Asterisk the stream state
was used inconsistently, resulting in odd behavior. This
was then standardized to be the state of a stream from the
perspective of Asterisk.

This change updates the StreamEcho dialplan application
to use the correct state, send only, since we are only
sending to the endpoint and not expecting them to send us
multiple video streams.

ASTERISK-28954

Change-Id: I35bfd533ef1184ffe62586b22bbd253c82872a56
2020-06-19 09:15:28 -05:00
Joshua C. Colp 419be23003 res_sorcery_memory_cache: Disallow per-object expire with full backend.
The AMI action and CLI command did not take into account the properties
of full backend caching. This resulted in an expired object remaining
removed until a full backend update occurred, instead of having the
object updated when needed.

This change makes it so that the AMI action and CLI command for object
expire will now fail instead of putting the cache into an undesired
state. If full backend caching is enabled then only operations
which act on the entire cache are available.

ASTERISK-28942

Change-Id: Id662d888f177ab566c8e802ad583083b742d21f4
2020-06-18 18:02:11 -05:00
Joshua C. Colp 63c82caebc res_pjsip_session: Preserve label on incoming re-INVITE.
When a re-INVITE is received we create a new set of
streams that are then swapped in as the active streams.
We did not preserve the SDP label from the previous
streams, resulting in the label getting lost.

This change ensures that if an SDP label is present
on the previous stream then it is set on the new stream.

ASTERISK-28953

Change-Id: I9dd63b88b562fe96ce5c791a3dae5bcaca258445
2020-06-18 17:51:40 -05:00
Walter Doekes 83b4507500 app_queue: Read latest wrapuptime instead of (possibly stale) copy
Before this changeset, it was possible that a queue member (agent) was
called even though they just got out of a call, and wrapuptime seconds
hadn't passed yet.

This could happen if a member ended a call _between_ a new call attempt
and asterisk trying that particular member for a new call.

In that case, Asterisk would check the hangup time of the
call-before-the-last-call instead of the hangup time of the-last-call.

ASTERISK-28952

Change-Id: Ie0cab8f0e8d639c01cba633d4968ba19873d80b3
2020-06-17 09:34:35 -05:00
Walter Doekes 32399abb82 res_pjsip: Include <pjsip_ua.h> instead of internal "pjsua-lib/pjsua.h"
Change-Id: I24b5453df412232cf7f9a171ea4a34b35ad3ae78
2020-06-17 09:33:35 -05:00
Walter Doekes e8cb8957ec app_queue: Remove stale code in try_calling
Because ring_entry() is not called, outgoing->chan is not touched here
either.

ASTERISK-28950
ASTERISK-28644

Change-Id: I564613715dfaf45af868251eb75a451f512af90f
2020-06-16 08:08:05 -05:00
Kevin Harwell 82ce3b7620 pjproject: Upgrade bundled version to pjproject 2.10
This patch makes the usual necessary changes when upgrading to a new
version pjproject. For instance, version number bump, patches removed
from third-party, new *.md5 file added, etc..

This patch also includes a change to the Asterisk pjproject Makefile to
explicitly create the 'source/pjsip-apps/lib' directory. This directory
is no longer there by default so needs to be added so the Asterisk
malloc debug can be built.

This patch also includes some minor changes to Asterisk that were a result
of the upgrade. Specifically, there was a backward incompatibility change
made in 2.10 that modified the "expires header" variable field from a
signed to an unsigned value. This potentially effects comparison. Namely,
those check for a value less than zero. This patch modified a few locations
in the Asterisk code that may have been affected.

Lastly, this patch adds a new macro PJSIP_MINVERSION that can be used to
check a minimum version of pjproject at compile time.

ASTERISK-28899 #close

Change-Id: Iec8821c6cbbc08c369d0e3cd2f14e691b41d0c81
2020-06-16 07:16:28 -05:00
sungtae kim 0b133a32ec res_ari: Fix create channel request channelId parameter parsing
If channelId parameters were passed in the body, the Asterisk doesn't parsing it correctly.

Fixed it to parse the channelId, other_channel_id parameter correclty.

ASTERISK-28948

Change-Id: I59b49161a94869169ee19c1ffab5afcef7026157
2020-06-15 08:53:09 -05:00
Joshua C. Colp 563f2f94d6 core_unreal / core_local: Add multistream and re-negotiation.
When requesting a Local channel the requested stream topology
or a converted stream topology will now be placed onto the
resulting channels.

Frames written in on streams will now also preserve the stream
identifier as they are queued on the opposite channel.

Finally when a stream topology change is requested it is
immediately accepted and reflected on both channels. Each
channel also receives a queued frame to indicate that the
topology has changed.

ASTERISK-28938

Change-Id: I4e9d94da5230d4bd046dc755651493fce1d87186
2020-06-15 08:50:54 -05:00
Joshua C. Colp 49b204ed8a res_rtp_asterisk: Don't assume setting retrans props means to enable.
The "value" passed in when setting an RTP property determines
whether it should be enabled or disabled. The RTP send and
receive retrans props did not examine this to know if the
buffers should be enabled. They assumed they always should be.

This change makes it so that the "value" passed in is
respected.

ASTERISK-28939

Change-Id: I9244cdbdc5fd065c7f6b02cbfa572bc55c7123dc
2020-06-11 18:06:22 -05:00
Joshua C. Colp ef608dec78 bridge_softmix: Add additional old states for adding new source.
There are three states that an old stream can be in to allow
becoming a source stream in a new stream:

1. Removed
2. Inactive
3. Sendonly

This change adds the two missing ones, inactive and sendonly,
so if a stream transitions from those to a state where they are
providing video to Asterisk we properly re-negotiate the other
participants.

ASTERISK-28944

Change-Id: Id8256b9b254b403411586284bbaedbf50452de01
2020-06-11 16:37:34 -05:00
George Joseph efeff59152 res_fax: Don't start a gateway if either channel is hung up
When fax_gateway_framehook is called and a gateway hasn't already
been started, the framehook gets the t38 state for both the current
channel and the peer.  That call trickles down to the channel
driver which determines the state.  If either channel is hung up
(or in the process of being hung up), the channel driver's tech_pvt
is going to be NULL which, in the case of chan_pjsip, will cause a
segfault.

* Added a hangup check for both the channel and peer channel
  before starting a fax gateway.

* Added a check for NULL tech_pvt to chan_pjsip_queryoption
  so we don't attempt to reference a tech_pvt that's already
  gone.

ASTERISK-28923
Reported by: Yury Kirsanov

Change-Id: I4e10e63b667bbb68c1c8623f977488f5d807897c
2020-06-10 13:59:30 -05:00
Kevin Harwell f59001d171 Compiler fixes for gcc 10
This patch fixes a few compile warnings/errors that now occur when using gcc
10+.

Also, the Makefile.rules check to turn off partial inlining in gcc versions
greater or equal to 8.2.1 had a bug where it only it only checked against
versions with at least 3 numbers (ex: 8.2.1 vs 10). This patch now ensures
any version above the specified version is correctly compared.

Change-Id: I54718496eb0c3ce5bd6d427cd279a29e8d2825f9
2020-06-10 13:56:45 -05:00
George Joseph c7406a5b48 app_confbridge: Plug ref leak of bridge channel with send_events
When send_events is enabled for a user, we were leaking a reference
to the bridge channel in confbridge_manager.c:send_message().  This
also caused the bridge snapshot to not be destroyed.

Change-Id: I87a7ae9175e3cd29f6d6a8750e0ec5427bd98e97
2020-06-10 10:27:20 -05:00
Ben Ford 68b2a2f1ab cli.c: Fix compiler error.
Added default variable value to fix a compiler error.

Change-Id: I7b592adbb1274dc5464dea1c5e5de0685c928553
2020-06-10 09:38:45 -05:00
sungtae kim a8cef78f09 res_ari: Fix create request body parameter parsing.
If parameters were passed in the body as JSON to the
create route they were not being parsed before checking
to ensure that required fields were set.

This change moves the parsing so it occurs before
checking.

ASTERISK-28940

Change-Id: I898b4c3c7ae1cde19a6840e59f498822701cf5cf
2020-06-09 07:27:25 -05:00
Joshua C. Colp 51f1f78069 bridge_channel: Don't queue unmapped frames.
If a frame is written to a channel in a bridge we
would normally queue this frame up and the channel
thread would then act upon it. If this frame had no
stream mapping on the channel it would then be
discarded.

This change adds a check before the queueing occurs
to determine if a mapping exists. If it does not
exist then the frame is not even queued at all. This
stops a frame duplication from happening and from
the channel thread having to wake up and deal with
it.

Change-Id: I17189b9b1dec45fc7e4490e8081d444a25a00bda
2020-06-08 09:57:29 -05:00
Walter Doekes b82fd4f236 pjsip: Prevent invalid memory access when attempting to contact a non-sip URI
You cannot cast a pjsip_uri to a pjsip_sip_uri using pjsip_uri_get_uri,
without checking that it's a PJSIP_URI_SCHEME_IS_SIP(S).

ASTERISK-28936

Change-Id: I9f572b3677e4730458e9402719e580f8681afe2a
2020-06-08 09:42:45 -05:00
Joshua C. Colp 73b5e09738 res_fax: Don't consume frames given to fax gateway on write.
In a particular fax gateway scenario whereby it would
have to translate using the read translation path on a
channel the frame being translated would be consumed.
When the frame is in the write path it is not permitted
to free the frame as the caller expects it to continue
to exist.

This change makes it so that the frame is only consumed
on the read path where it is acceptable to free it.

ASTERISK-28900

Change-Id: I011c321288a1b056d92b37c85e229f4a28ee737d
2020-06-05 13:34:29 -05:00
Alexander Traud a829658762 pjproject_bundled: Honor --without-pjproject.
The previous change missed that 'make' uses 'PJPROJECT_BUNDLED' anyway.

ASTERISK-28929

Change-Id: I7ef0e78a06ea391b59d95b99d46bbed3fec4fed9
2020-06-05 09:55:41 -05:00
Pirmin Walthert 905b05079b res_pjsip_logger: use the correct pointer when logging tx_messages to pcap
When writing tx messages to pcap files, Asterisk is using the wrong
pointer resulting in lots of wasted space. This patch fixes it to use
the correct pointer.

ASTERISK-28932 #close

Change-Id: I5b8253dd59a083a2ca2c81f232f1d14d33c6fd23
2020-06-04 05:52:34 -03:00
George Joseph 6a0c472374 Scope Tracing: A new facility for tracing scope enter/exit
What's wrong with ast_debug?

  ast_debug is fine for general purpose debug output but it's not
  really geared for scope tracing since it doesn't present its
  output in a way that makes capturing and analyzing flow through
  Asterisk easy.

How is scope tracing better?

  Scope tracing uses the same "cleanup" attribute that RAII_VAR
  uses to print messages to a separate "trace" log level.  Even
  better, the messages are indented and unindented based on a
  thread-local call depth counter.  When output to a separate log
  file, the output is uncluttered and easy to follow.

  Here's an example of the output. The leading timestamps and
  thread ids are removed and the output cut off at 68 columns for
  commit message restrictions but you get the idea.

--> res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001
	--> res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173
		--> res_pjsip_session.c:3669 handle_incoming_response PJSIP/
			--> chan_pjsip.c:3265 chan_pjsip_incoming_response_after
				--> chan_pjsip.c:3194 chan_pjsip_incoming_response P
					    chan_pjsip.c:3245 chan_pjsip_incoming_respon
				<-- chan_pjsip.c:3194 chan_pjsip_incoming_response P
			<-- chan_pjsip.c:3265 chan_pjsip_incoming_response_after
		<-- res_pjsip_session.c:3669 handle_incoming_response PJSIP/
	<-- res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173
<-- res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001

  The messages with the "-->" or "<--" were produced by including
  the following at the top of each function:

  SCOPE_TRACE(1, "%s\n", ast_sip_session_get_name(session));

  Scope isn't limited to functions any more than RAII_VAR is.  You
  can also see entry and exit from "if", "for", "while", etc blocks.

  There is also an ast_trace() macro that doesn't track entry or
  exit but simply outputs a message to the trace log using the
  current indent level.  The deepest message in the sample
  (chan_pjsip.c:3245) was used to indicate which "case" in a
  "select" was executed.

How do you use it?

  More documentation is available in logger.h but here's an overview:

  * Configure with --enable-dev-mode.  Like debug, scope tracing
    is #ifdef'd out if devmode isn't enabled.

  * Add a SCOPE_TRACE() call to the top of your function.

  * Set a logger channel in logger.conf to output the "trace" level.

  * Use the CLI (or cli.conf) to set a trace level similar to setting
    debug level... CLI> core set trace 2 res_pjsip.so

Summary Of Changes:

  * Added LOG_TRACE logger level.  Actually it occupies the slot
    formerly occupied by the now defunct "event" level.

  * Added core asterisk option "trace" similar to debug.  Includes
	ability to specify global trace level in asterisk.conf and CLI
	commands to turn on/off and set levels.  Levels can be set
	globally (probably not a good idea), or by module/source file.

  * Updated sample asterisk.conf and logger.conf.  Tracing is
    disabled by default in both.

  * Added __ast_trace() to logger.c which keeps track of the indent
    level using TLS. It's #ifdef'd out if devmode isn't enabled.

  * Added ast_trace() and SCOPE_TRACE() macros to logger.h.
    These are all #ifdef'd out if devmode isn't enabled.

Why not use gcc's -finstrument-functions capability?

  gcc's facility doesn't allow access to local data and doesn't
  operate on non-function scopes.

Known Issues:

  The only know issue is that we currently don't know the line
  number where the scope exited.  It's reported as the same place
  the scope was entered.  There's probably a way to get around it
  but it might involve looking at the stack and doing an 'addr2line'
  to get the line number.  Kind of like ast_backtrace() does.
  Not sure if it's worth it.

Change-Id: Ic5ebb859883f9c10a08c5630802de33500cad027
2020-06-02 11:36:12 -05:00
Pirmin Walthert f444f2495b res_pjsip_logger.c: correct the return value checks when writing to pcap
files

fwrite() does return the number of elements written and not the
number of bytes. However asterisk is currently comparing the return
value to the size of the written element what means that asterisk logs
five WARNING messages on every packet written to the pcap file.

This patch changes the code to check for the correct value, which will
always be 1.

ASTERISK-28921 #close

Change-Id: I2455032d9cb4c5a500692923f9e2a22e68b08fc2
2020-05-29 13:11:27 -05:00
Asterisk Development Team 2d14425e04 Update CHANGES and UPGRADE.txt for 16.11.0 2020-05-28 07:06:54 -05:00
Joshua C. Colp c0df04017f ARI: Bump non-breaking version number to 4.1.3
The channel create call now allows setting variables.

Change-Id: I5e5bd34e0eb3df6e7feb2095e00a91c742ad5113
2020-05-28 08:55:26 -03:00
Joshua C. Colp b37d7b5d0a res_pjsip: Use correct pool for storing the contact_user value.
When replacing the user portion of the Contact URI the code
was using the ephemeral pool instead of the tdata pool. This
could cause the Contact user value to become invalid after a
period of time.

The code will now use the tdata pool which persists for the
lifetime of the message instead.

ASTERISK-28794

Change-Id: I31e7b958e397cbdaeedd0ebb70bcf8dd2ed3c4d5
2020-05-27 09:36:28 -05:00
Pirmin Walthert 81929d478c res_pjsip_nat.c: remove x-ast-orig-host from request URI and To header
While asterisk is filtering out the x-ast-orig-host parameter from the
contact on response messages, it is not filtering it out from the
request URI and the to header on SIP requests (for example INVITE).

ASTERISK-28884 #close

Change-Id: Id032b33098a1befea9b243ca994184baecccc59e
2020-05-22 08:51:26 -05:00
Joshua C. Colp 420d38555e bridge: Don't try to match audio formats.
When bridging channels we were trying to match the audio
formats of both sides in combination with the configured
formats. While this is allowed in SDP in practice this
causes extra reinvites and problems. This change ensures
that audio streams use the formats of the first existing
active audio stream. It is only when other stream types
(like video) exist that this will result in re-negotiation
occurring for those streams only.

ASTERISK-28871

Change-Id: I22f5a3e7db29e00c165e74d05d10856f6086fe47
2020-05-21 10:37:01 -05:00
Joshua C. Colp dcad322562 res_sorcery_config: Always reload configuration on errors.
When a configuration file in Asterisk is loaded
information about it is stored such that on a
reload it is not reloaded if nothing has changed.
This can be problematic when an error exists in
a configuration file in PJSIP since the error
will be output at start and not subsequently on
reload if the file is unchanged.

This change makes it so that if an error is
encountered when res_sorcery_config is loading
a configuration file a reload will always read
in the configuration file, allowing the error
to be seen easier.

Change-Id: If2e05a017570f1f5f4f49120da09601e9ecdf9ed
2020-05-20 10:49:49 -05:00
Alexander Traud c00b032bbf res_srtp: Set all possible flags while selecting the Crypto Suite.
The flags of a previous selection could have been set within the
object 'srtp', for example, when the previous selection returned
failure after setting just 'some' flags. Now, not to clutter the
code, all possible flags are cleared first, and then the selected
flags are set as before.

ASTERISK-28903

Change-Id: I1b9d7aade7d5120244ce7e3a8865518cbd6e0eee
2020-05-20 10:11:53 -05:00
Joshua C. Colp 229cb16d52 res_pjsip_logger: Expand functionality to improve logging.
The PJSIP packet logger now has the following CLI commands:

pjsip set logger pcap <filename>

When used this will create a pcap file containing the incoming
and outgoing SIP packets, in unencrypted form.

pjsip set logger verbose <on / off>

This allows you to toggle logging to verbose on and off.

pjsip set logger host <IP/subnet mask> add

This allows you to add an additional IP address or subnet
mask to logging, allowing you to log multiple instead of
just a single IP address or all traffic.

The normal "pjsip set logger host" CLI command has also been
expanded to allow subnet masks as well.

ASTERISK-28895

Change-Id: If5859161a72b0d7dd2d1f92d45bed88e0cd07d0e
2020-05-20 09:18:17 -05:00
Joshua C. Colp 48a3182c42 bridge_softmix: Always remove audio from mixed frame.
When receiving audio from a channel we determine if it
is talking or silence based on a threshold value. If
this threshold is met we always mix the audio into the
conference bridge. If this threshold is not met we also
mix the audio into the conference bridge UNLESS the
drop silence option is enabled.

The code that removed the audio from the mixed frame
assumed that it was always not present if it did not
meet the threshold to be considered talking. This is
incorrect. If it has been stated that the audio was
mixed into the mixed frame then it has been mixed into
the mixed frame. By not removing audio that was
considered non-talking it was possible for a channel
to receive a slight echo of audio of itself at times.

This change ensures that the audio is always removed
from the mixed frame going back to the channel so it
no longer receives the slight echo.

ASTERISK-28898

Change-Id: I7b1b582cc1bcdb318ecc60c9d2e3d87ae31d55cb
2020-05-20 09:14:33 -05:00
Nicholas John Koch 7949343efb res_musiconhold: Added check for dot character in path of playlist entries to avoid warnings
A warning was triggered that there may be a problem regarding file
extension (which is correct and should not be set anyway). The warning
also appeared if there was dot within the path itself.

E.g.
[sales-queue-hold]
mode=playlist
entry=/var/www/domain.tld/moh/funky_music

The music played correctly but you get a warning message.

Now there will be a check if the position of a potential dot character
is after the last position of a slash character. This dot charachter
will be treated as a extension naming. Dots within the path then ignored.

ASTERISK-28892
Reported-By: Nicholas John Koch

Change-Id: I2ec35a613413affbf5fcc01c8c181eba24865b9e
2020-05-20 07:18:31 -05:00
sungtae kim 862b9fcce8 res_rtp_asterisk.c: Fixed memory leak
Added freeifaddrs() for memory releasing.

ASTERISK-28904

Change-Id: I109403866e85a30659351946903a679de9727a8f
2020-05-18 11:42:06 -05:00
Joshua C. Colp ed75fd14a3 ari: Allow variables to be set on channel create.
This change adds the same variable functionality that
is available for originating a channel to the create
call. Now when creating a channel you can specify
dialplan variables to set instead of having to do another
API call.

ASTERISK-28896

Change-Id: If13997ba818136d7c070585504fc4164378aa992
2020-05-18 10:50:43 -05:00
Roger James 110d563452 pjsip_resolver.c: Ensure AAAA dns requests are made.
1. Modify sip_resolve and sip_resolve_callback to request AAAA lookups
   when an IPV6 transport type has been requested.

2. Rename all occurrences of pjsip_transport_get_type_name to
   pjsip_transport_get_type_desc. This ensures that the log/debug info
   shows whether the transport is IPv6 or IPv4.

3. Do not add the constant PJSIP_TRANSPORT_IPV6 to existing transport
   types. This results in invalid values. Use a bitwise or instead.

ASTERISK-26780
Patches:
    pjsip_resolver.c uploaded by Peter Sokolov (License #7070)

Change-Id: I8b1e298f8efa682d0a7644113258fe76d9889c58
2020-05-12 09:36:05 -05:00
Guido Falsi 42301b266f pjproject: Fix race condition when building with parallel make
Pjproject makefiles miss some dependencies which can cause race
conditions when building with parallel make processes. This patch
adds such dependencies correctly.

ASTERISK-28879 #close
Reported-by: Dmitry Wagin <dmitry.wagin@ya.ru>

Change-Id: Ie1b0dc365dafe4a84c5248097fe8d73804043c22
2020-05-11 17:38:04 -05:00
Roger James 1249f911f3 res_pjsip_history.c: Fix to stop SIGSEGV when IPv6 addresses are encountered.
Changed source and destination address fields in struct
pjsip_history_entry so that they are long enough to hold an IPv6
address.

ASTERISK-28854

Change-Id: Id65bb9aa961e9ecbcb500815e18170f774e34d3e
2020-05-11 16:49:03 -05:00
traud a5100e7171 app_osplookup: Avoid a format truncation.
Ensure that output buffers for the osp_convert_inout
function have sufficient space for additional data
such as brackets and ports.

ASTERISK-28804

Change-Id: Ie54c8241ff0cc653910539c2db00ff2a4869750b
2020-05-11 05:29:22 -05:00
traud 023d73a0e7 tcptls: Fix notice when TLS is enabled but not supported.
ASTERISK-28797

Change-Id: Iab364a2c2519fd9d11d1c28293fda43d61b64c28
2020-05-11 05:24:09 -05:00
Pirmin Walthert 6649b13b91 app.c: make sure that no non-async-signal-safe syscalls are used after
fork before exec

Posix does only allow async-signal-safe syscalls after fork before exec.
As asterisk ignores this, functions like TrySystem or System sometimes
end up in a deadlocked child process. The patch prevents the use of
non-async-signal-safe syscalls.

ASTERISK-28776

Change-Id: Idc76365c0592ee3f3b3bd72a4f48f7a098978e8e
2020-05-08 13:43:43 -05:00
George Joseph f56149d019 streams: Fix one memory leak and one formats ref issue
ast_stream_topology_create_from_format_cap() was setting the
stream->formats directly but not freeing the default formats.  This
causes a memory leak.

* ast_stream_topology_create_from_format_cap() now calls
  ast_stream_set_formats() which properly cleans up the existing
  stream formats.

When cloning a stream, the source stream's format caps _pointer_ is
copied to the new stream and it's reference count bumped.  If
either stream is set to "removed", this will cause _both_ streams
to have their format caps cleared.

* ast_stream_clone() now creates a new format caps object and copies
  the formats from the source stream instead of just copying the
  pointer.

ASTERISK-28870

Change-Id: If697d81c3658eb7baeea6dab413b13423938fb53
2020-05-06 07:29:16 -05:00
Nathan Bruning 92169e6f8a app_queue: track masquerades in app_queue to avoid leaked stasis subscriptions
Add a new "masquarade" channel event, and use it in app_queue to track unique id's.

Testcase is submitted as https://gerrit.asterisk.org/c/testsuite/+/14210

ASTERISK-28829 #close
ASTERISK-25844 #close

Change-Id: Ifc5f9f9fd70903f3c6e49738d3bc632b085d2df6
2020-05-05 10:09:15 -05:00
Guido Falsi 17a8d86e1e pjproject: Remove bashism from configure.m4 script
The configure.m4 script for pjproject contains some += syntax, which
is specific to bash, replacing it with string substitutions makes
the script compatible with traditional Bourne shells.

ASTERISK-28866 #close
Reported-by: Christoph Moench-Tegeder <cmt@FreeBSD.org>

Change-Id: I382a78160e028044598b7da83ec7e1ff42b91c05
2020-05-05 09:29:03 -05:00
Jaco Kroon 9e7fc21086 Remove #include <sys/cdefs.h>
These are not provided by standards, and as a result causes failure to
compile on musl.

https://wiki.musl-libc.org/faq.html#Q:-When-compiling-something-against-musl,-I-get-error-messages-about-%3Ccode%3Esys/cdefs.h%3C/code%3E

Change-Id: I6a357cefd106c72cfecafd898638f6b5692c2e05
2020-05-05 08:56:28 -04:00
George Joseph cf5e30dd0e app_voicemail: Add workaround for a gcc 10 issue with -Wrestrict
The gcc 10 -Wrestrict option was causing "overlap" errors when
snprintf was copying one char[256] structure member to another
char[256] member in the same structure.

Using ast_alloca instead of declaring the structure inline
solves the issue.

Here's a link to the "enhancement":
https://gcc.gnu.org/legacy-ml/gcc-patches/2019-10/msg00570.html

We may follow up with a gcc bug report.

Change-Id: Ie0099adcb0a9727bd9aa99e024dd912a67eaf534
2020-04-30 11:09:48 -05:00
Alexander Traud 0ce4a77367 core_local: Local calls are always secure.
In a Dialplan, the channel drivers 'chan_sip' and 'chan_iax2' support
the channel items 'secure_bridge_media' and 'secure_bridge_signaling'.
That way, a channel can be forced to use encryption even if not
specified in its configuration.

However, when the Local Proxy kicks in, for example, in case of a
forwarding (SIP status 302), Local Proxy stated it does not know those
items. Consequently, such a call could not be proxied how clever your
Dialplan was. Because local calls within Asterisk are always secure,
Local Proxy accepts such a request now.

ASTERISK-22920

Change-Id: I4c143bb70f686790953cc04c5a4b810bbb03636c
2020-04-29 13:06:42 -05:00
Joshua C. Colp 4374f86219 pjsip: Increase maximum ICE candidate count.
In practice it has been seen that some users come
close to our maximum ICE candidate count of 32.
In case people have gone over this increases the
count to 64, giving ample room.

ASTERISK-28859

Change-Id: I35cd68948ec0ada86c14eb53092cdaf8b62996cf
2020-04-29 13:05:21 -05:00
Guido Falsi 858d3216dd res_rtp_asterisk: Protect access to nochecksums with #ifdef
Recently code accessing nochecksums variable has been added without including #ifdef SO_NO_CHECK protection, while the variable is created only when such constant is defined.

ASTERISK-28852 #close

Change-Id: I381718893b80599ab8635f2b594a10c1000d595e
2020-04-28 13:37:57 -05:00
Guido Falsi ca5c1e6336 core/dns: Add system include required on FreeBSD
While testing the latest RC on FreeBSD I noticed this new file fails to build. On FreeBSD inlcuding resolv.h requires sockaddr_in to be defined, and it's defined in netinet/in.h. So I added this include.

ASTERISK-28853 #close

Change-Id: I6997daf3956e6eb70ab6cb358628d162fad80079
2020-04-28 13:06:53 -05:00
Peter Turczak 3bde9dcc80 chan_mobile: Add smoother to make SIP/RTP endpoints happy.
In contrast to RFC 3551, section 4.2, several SIP/RTP clients misbehave
severly (up to crashing). This patch adds another smoother for the audio
received via bt. Therefore the audio frames sent to the core will be
CHANNEL_FRAME_SIZE.

ASTERISK-28832 #close

Change-Id: Ic5f9e2f35868ae59cc9356afbd1388b779a1267f
2020-04-27 17:01:57 -05:00
Alexander Traud 302c20546a app_fax: SpanDSP headers do not use ast_malloc; ignore that.
Since Asterisk 14, app_fax did not compile at all because Asterisk
requires that not malloc but ast_malloc is used everywhere. However,
the system headers of SpanDSP use malloc. Because we cannot (and do
not need to) change system headers, let us ignore this.

ASTERISK-28848

Change-Id: I31f7a6b92a07032c5cef1c16b8901b107fe35546
2020-04-24 05:18:57 -05:00
Asterisk Development Team bbd0835482 Update CHANGES and UPGRADE.txt for 16.10.0 2020-04-23 11:03:08 -05:00
Joshua C. Colp 2128eb1f47 stream: Enforce formats immutability and ensure formats exist.
Some places in Asterisk did not treat the formats on a stream
as immutable when they are.

The ast_stream_get_formats function is now const to enforce this
and parts of Asterisk have been updated to take this into account.
Some violations of this were also fixed along the way.

An additional minor tweak is that streams are now allocated with
an empty format capabilities structure removing the need in various
places to check that one is present on the stream.

ASTERISK-28846

Change-Id: I32f29715330db4ff48edd6f1f359090458a9bfbe
2020-04-23 09:11:04 -05:00
sungtae kim 64e0ce67fc res_ari_channels: Fixed endpoint 80 characters limit
Fixed it to copy the entire string from the requested endpoint body except tech-prefix.

ASTERISK-28847

Change-Id: I91b5f6708a1200363f3267b847dd6a0915222c25
2020-04-22 16:01:20 -05:00
Joshua C. Colp f3ac42b9bd fax: Fix crashes in PJSIP re-negotiation scenarios.
This change fixes a few re-negotiation issues
uncovered with fax.

1. The fax support uses its own mechanism for
re-negotiation by conveying T.38 information in
its own frames. The new support for re-negotiating
when adding/removing/changing streams was also
being triggered for this causing multiple re-INVITEs.
The new support will no longer trigger when
transitioning between fax.

2. In off-nominal re-negotiation cases it was
possible for some state information to be left
over and used by the next re-negotiation. This
is now cleared.

ASTERISK-28811
ASTERISK-28839

Change-Id: I8ed5924b53be9fe06a385c58817e5584b0f25cc2
2020-04-22 10:08:54 -05:00
DanielYK c36f34aa90 res_pjsip: Fixed format of IPv6 addresses for external media addresses
ASTERISK-28835

Change-Id: I66289afd164c5cdd6c5caa39e79d629a467e7a26
2020-04-21 17:44:50 -05:00
Alexander Traud d53925c98a chan_sip: externhost/externaddr with non-default TCP/TLS ports.
ASTERISK-28372
Reported by: Anton Satskiy

ASTERISK-24428
Reported by: sstream

Change-Id: I2b7432a9bf3b09dc8515297ff955636db7a6224c
2020-04-20 13:44:17 -05:00
Alexander Traud 7eb3c2d5ff cdr_odbc: Sync load- and build-time deps.
MODULEINFO is checked while buidling/linking the module.
AST_MODULE_INFO is checked while loading/running the module.

ASTERISK-28838

Change-Id: I55dc05ce19552d0415c9045021b42bd82ef44e52
2020-04-20 11:43:26 -05:00
Alexander Traud 63f57e044d res_pjsip: Sync load- and build-time deps.
MODULEINFO is checked while buidling/linking the module.
AST_MODULE_INFO is checked while loading/running the module.

ASTERISK-28838

Change-Id: I4bb868532ca217fec1351885d99eb55c21b58042
2020-04-20 11:03:05 -05:00
Alexander Traud 905f8ddc3e res_pjsip_refer: Add build-time dependency.
ASTERISK-28838

Change-Id: Ic693c3f464e35ec0db242afdb0a1415806af4e25
2020-04-20 10:57:51 -05:00
Alexander Traud d89968fc96 app_getcpeid: Add build-time dependency.
ASTERISK-28838

Change-Id: I68b78e7e4718be82507247433127ce3992a5ba96
2020-04-20 10:06:33 -05:00
Alexander Traud ea102bd1a7 curl: Add build-time dependency.
ASTERISK-28838

Change-Id: I34724e799e1ffaf723eb2c358abe8934dbadcd52
2020-04-20 10:06:08 -05:00
Alexander Traud 5c5f7223ec res_pjsip: Add build-time dependency.
ASTERISK-28838

Change-Id: Icb08304744ae3f34dce6ccb76f94379b8382a074
2020-04-20 09:19:35 -05:00
Joshua C. Colp 62183bc777 confbridge: Add support for disabling text messaging.
When in a conference bridge it may be necessary to have
text messages disabled for specific participants or for
all. This change adds a configuration option, "text_messaging",
which can be used to enable or disable this on the
user profile. By default existing behavior is preserved
as it defaults to "yes".

ASTERISK-28841

Change-Id: I30b5d9ae6f4803881d1ed9300590d405e392bc13
2020-04-20 09:12:46 -05:00
Alexander Traud dd65a66ecb pjproject_bundled: Honor --without-pjproject.
ASTERISK-28837

Change-Id: Id057324912a3cfe6f50af372675626bb515907d9
2020-04-17 06:48:14 -05:00
Pirmin Walthert a7c4579979 res_rtp_asterisk: Resolve loop when receive buffer is flushed
When the receive buffer was flushed by a received packet while it
already contained a packet with the same sequence number, Asterisk
never left the while loop which tried to order the packets.

This change makes it so if the packet is in the receive buffer it
is retrieved and freed allowing the buffer to empty.

ASTERISK-28827

Change-Id: Idaa376101bc1ac880047c49feb6faee773e718b3
2020-04-17 06:06:38 -05:00
Alexander Traud 338990d973 chan_sip: DiffServ/ToS not only on UDP but also on TCP and TLS sockets.
ASTERISK-27195
Reported by: Joshua Roys

Change-Id: I6e72ecb874200dec7a3865c7babaf5ac0d3101de
2020-04-16 10:35:20 -05:00
Alexander Traud c2f18323fe install_prereq: Add libcap for high bits in DiffServ/ToS.
works automatically; see Mantis 7047 (now ASTERISK-6863)

Change-Id: I27d2c109180bd857b6757fd532de48eddb78aee6
2020-04-16 10:31:40 -05:00
Alexander Traud f44cab8b82 BuildSystem: Only if found LibPRI, check its optional parts.
Change-Id: If8445f899ee4ce0c606c484943d4ce0c8e43b5da
2020-04-16 09:53:07 -05:00
Pirmin Walthert 9a928cae86 res_rtp_asterisk: Free payload when error on insertion to data buffer
When the ast_data_buffer_put rejects to add a packet, for example because
the buffer already contains a packet with the same sequence number, the
payload will never be freed, resulting in a memory leak.

The data buffer will now return an error if this situation occurs
allowing the caller to free the payload. The res_rtp_asterisk module
has also been updated to do this.

ASTERISK-28826

Change-Id: Ie6c49495d1c921d5f997651c7d0f79646f095cf1
2020-04-15 14:00:47 -05:00
Alexander Traud dafb58aafd
BuildSystem: Only if found external PJProject, check its optional parts.
Change-Id: I11d5693d25c166c99d8cebffc16184d58f6362de
2020-04-15 09:38:23 +02:00
bernard merindol 4af84c5675 res_rtp_asterisk.c: Check for first DTMF having timestamp set to 0
When the first DTMF receive in RF2833 codec have TimeStamp at 0
is not processed.

ASTERISK-28812

Change-Id: I3196803a062dd2daee4938c9a778c3810cb7e504
2020-04-14 10:31:46 -05:00
Jean Aunis ef4255f6ed func_volume: Accept decimal number as argument
Allow voice volume to be multiplied or divided by a floating point number.

ASTERISK-28813

Change-Id: I5b42b890ec4e1f6b0b3400cb44ff16522b021c8c
2020-04-14 09:29:42 -05:00
Jaco Kroon 7a00db673a res_rtp_asterisk: iterate all local addresses looking to populate ICE.
By using pjproject to give us a list of candidates, and then filtering,
if the host has >32 addresses configured, then it is possible that we
end up filtering out all 32 of those, and ending up with no candidates
at all.  Instead, get getifaddrs (which pjsip is using underlying
anyway) to retrieve all local addresses, and iterate those, adding the
first 32 addresses not excluded by the ICE ACL.

In our setup at any point in time We've got between 6 and 328 addresses
on any given system.  The lower limit is the lower limit but the upper
limit is growing on a near daily basis currently.

Change-Id: I109eaffc3e2b432f00bf958e3caa0f38cacb4edb
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2020-04-13 19:47:00 -05:00
Alexander Traud e02290ed4f pjproject_bundled: Repair ./configure --with-ssl without ARG.
ASTERISK-28758
Reported by: Patrick Wakano
Reported by: Dmitriy Serov

Change-Id: Ifb6b85c559d116739af00bc48d1f547caa85efac
2020-04-13 18:23:36 -05:00
Jaco Kroon c9e1b4d142 res_pjsip: document legal dtls_verify endpoint options.
Change-Id: I7fa7c5c8a7ddb0bd525982f58bff3264ebbd9a1b
2020-04-13 17:31:45 -05:00
Alexander Traud dfdff0f9ec BuildSystem: Search for Python/C API when possibly needed only.
The Python/C API is used only if the Test Framework was enabled in Asterisk
'make menuselect'. The Test Framework is available only if the Developer Mode
was enabled in Asterisk './configure --enable-dev-mode'. And that Python/C API
is used only if the PJProject was found and not disabled in Asterisk; the user
did not go for './configure --without-pjproject'.

Furthermore, because version 2 of that Python/C API is required (currently) and
because some platforms do not offer a generic version 2, the script searches
for 2.7 explicitly as well.

To avoid version mismatch between the Python/C API and the Python environment,
the script searches for the latter in the same versions, in the same the order
as well. Because this Python/C API is just for (some) Asterisk contributors,
the script also goes for the Python 3 environment as a last resort for all
other Asterisk users. This allows 'make full' even on minimal installations of
Ubuntu 18.04 LTS and newer.

Because the Python/C API is Asterisk contributor specific, the Python packages
are removed from the script './contrib/scripts/install_prereq' as this script
is intended for Asterisk users. Asterisk contributors have to install much more
packages in any case, like:
sudo apt install autoconf automake git git-review python2.7-dev

ASTERISK-28824
ASTERISK-27717

Change-Id: Id46d357e18869f64dcc217b8fdba821b63eeb876
2020-04-13 16:50:11 -05:00
traud 9e0995b1b7 chan_sip: TCP/TLS client without server.
It is possible to configure a TCP/TLS client without having a TCP/TLS
server. In that case, no error or warning was printed but the headers
Contact and Via in SIP REGISTER were "(null)".

ASTERISK-28798

Change-Id: I387ca5cb6a65f1eb675a29c5e41df8ec6c242ab2
2020-04-13 16:48:01 -05:00
Alexander Traud 2b2fe947ce res_rtp_asterisk: Build without PJProject.
Change-Id: Ifc5059cd867e77b9c92ed9f4b895a9a91200d3ec
2020-04-13 15:32:32 -05:00
Alexander Traud bde6be092c _pjsua: Build even with Clang.
Change-Id: Iebf7687613aa0295ea3c82256460b337f1595be2
2020-04-13 12:06:53 -05:00
Kevin Harwell 48669ea81b chan_pjsip: digit_begin - constant DTMF tone if RTP is not setup yet
If chan_pjsip is configured for DTMF_RFC_4733, and the core triggers a
digit begin before media, or rtp has been setup then it's possible the
outgoing channel will hear a constant DTMF tone upon answering.

This happens because when there is no media, or rtp chan_pjsip notifies
the core to initiate inband DTMF. However, upon digit end if media, and
rtp become available then chan_pjsip does not notify the core to stop
inband DTMF. Thus the tone continues playing.

This patch makes it so chan_pjsip only notifies the core to start
inband DTMF in only the required cases. Now if there is no media, or
rtp availabe upon digit begin chan_pjsip does nothing, but tells the
core it handled it.

ASTERISK-28817 #close

Change-Id: I0dbea9fff444a2595fb18c64b89653e90d2f6eb5
2020-04-13 10:56:32 -05:00
Alexander Traud 375a578ef1 bridge_softmix_binaural: Show state in menuselect.
ASTERISK-28819

Change-Id: Iba7ee7bc7936d7a156171c8fc0f1670e864e7600
2020-04-13 10:29:55 -05:00
traud b4edb063e5 BuildSystem: Remove doc/tex and doc/pdf leftovers.
Furthermore, the nowhere used compress is removed.

ASTERISK-28816

Change-Id: I77daab80cfabb56d51c3ea6b1d14bd9b9fbc577c
2020-04-13 10:24:30 -05:00
Alexander Traud 33921fd426 BuildSystem: Allow space in path.
ASTERISK-28818

Change-Id: Ib7f246896457d9e3b14d7f5199136d6545ce0b6f
2020-04-09 07:08:01 -05:00
Sebastien Duthil 3513be1e79 func_channel: allow reading 4 fields from dialplan
The following fields return an error when read from dialplan:

- exten
- context
- userfield
- channame

ASTERISK-28796 #close

Change-Id: Ieacaac629490f8710fdacc9de80ed5916c5f6ee2
2020-04-08 09:47:26 -05:00
traud fdb6370759 res_rtp_asterisk: Avoid absolute value on unsigned subtraction.
ASTERISK-28809

Change-Id: I269731715347c8e5ef7db1b6ffd3f8d15fc04be4
2020-04-08 09:31:14 -05:00
traud 8021924a46 chan_unistim: Avoid tautological warnings with clang.
ASTERISK-28803

Change-Id: I15449621b68d0ad4d57b7c337c1167adb15135af
2020-04-08 08:32:51 -05:00
Sean Bright bfc9337ab4 Revert "res_config_odbc: Preserve empty strings returned by the database"
This reverts commit a3a2fbaec6.

Reason for revert: There is a lot of code that relies on the broken
behavior that this fixes.

Change-Id: I410c395a0168acbdaf89e616e3cb5e1312d190cb
2020-04-08 08:32:44 -05:00
traud 7039b764e4 test_stasis: Avoid always true warning with clang.
ASTERISK-28808

Change-Id: I5e76831373532d7b8065d024e66cd1fb75dedd80
2020-04-07 19:05:10 -05:00
Jaco Kroon 1e6b10c137 main/backtrace: binutils-2.34 fix.
My tester missed this one previously, have confirmed a positive build
this time round.

Change-Id: Id06853375954a200f03f9a1b9c97fe0b10d31fbf
2020-04-06 10:58:41 -05:00
Joshua C. Colp 06aa51d14e res_pjsip: Don't set endpoint to unavailable in all cases.
When an AOR is modified endpoints are updated that reference
the AOR so they can start receiving updates and reflect the
correct state. If this is the case then we shouldn't change
the endpoint to be offline if it does not reference the AOR
but instead only when the endpoint is completely updated for
all its AORs.

ASTERISK-28056
patches:
  pjsip_options-aor.diff submitted by jhord (license 6978)

Change-Id: I3ee00023be2393113cd4e056599f23f3499ef164
2020-04-06 09:16:09 -05:00
Kevin Harwell 267583f18d channel: write to a stream on multi-frame writes
If a frame handling routine returns a list of frames (vs. a single frame)
those frames are never passed to a tech's write_stream handler even if one is
available. For instance, if a codec translation occurred and that codec
returned multiple frames then those particular frames were always only sent
to the tech's "write" handler. If that tech (pjsip for example) was stream
capable then those frames were essentially ignored. Thus resulting in bad
audio.

This patch makes it so the "write_stream" handler is appropriately called
for all cases, and for all frames if available.

ASTERISK-28795 #close

Change-Id: I868faea0b73a07ed5a32c2b05bb9cf4b586f739d
2020-04-02 12:05:06 -05:00
traud 19d31636cf test_utils: Avoid incorrect error message on load.
In case of no OpenSSL headers, the module was built but did not load.

ASTERISK-28789

Change-Id: Ie007e84296bcf2bd4237f19d68ba5f932b84cd02
2020-03-31 12:48:31 -05:00
sungtae kim eb0493cfb8 dial.c: Removed dial string 80 character limitation
The dial application had 80 characters of destination length
limitation. But this limitation causes unexpected dial string
cut if the dial string is long.

Removed unnecessary limited buffer to support longer dial
destination.

ASTERISK-27946

Change-Id: I72c8f0319a4b47e8180817a66a7e9bde063cb330
2020-03-31 12:24:10 -05:00
traud 81d271f76a func_aes: Avoid incorrect error message on load.
In case of no OpenSSL headers, the module func_aes was built but did not load.

ASTERISK-28788

Change-Id: I0b99b8468cbeb3b0eab23069cbd64062ef885ffc
2020-03-31 11:47:57 -05:00
Torrey Searle bd091949cc res_pjsip_session: implement processing of Content-Disposition
RFC5621 requires any content type with a Content-Disposition
with handling=required to be rejected with a 415 response

ASTERISK-28782 #close

Change-Id: Iad969df75936730254b95c1a8bc3b48497070bb4
2020-03-31 11:07:57 -05:00
Jaco Kroon 85fca26c24 acl: implement a centralized ACL output mechanism for HAs and ACLs.
named_acl.c (which is really a named_ha) now uses ast_ha_output.

I've also updated main/manager.c to output the actual ACL on "manager
show user <username>" if one is set.  If this works then we can add
similar to other modules as required.

Change-Id: I0ec9876a90dddd379c80ec078d48e3ee6991eb0f
2020-03-31 10:45:16 -05:00
Joshua C. Colp ebe7749127 chan_sip: Send 403 when ACL fails.
Change-Id: I0910c79196f2b7c7e5ad6f1db95e83800ac737a2
2020-03-31 10:12:23 -05:00
Joshua C. Colp 99869810a1 CHANGES: Change md file extension to txt.
Change-Id: I168e2d3a65d444fb0961bd228257441fe718f6a7
(cherry picked from commit c9cd681261)
2020-03-26 11:53:25 -05:00
Joshua C. Colp 1c5129bca4 res_pjsip_session: Apply intention behind requested formats.
When an outgoing channel is created a list of formats may
optionally be provided which is used as a request that the
formats be used if possible. If an endpoint is not configured
for any of the formats we ignore this request and use what is
configured. This has the side effect of also including other
stream types (such as video) that were not present in the
requested formats.

This change makes it so that the intention of the request is
preserved - that is if only an audio format is requested then
even if there is no joint audio format between the request and
the configuration we will still only place an audio stream in
the outgoing call.

ASTERISK-28787

Change-Id: Ia54c0c63e94aca176169b9bae4bb8a8380ea245f
2020-03-26 11:53:05 -05:00
Joshua C. Colp 7771a198d5 res_rtp_asterisk: Ensure sufficient space for worst case NACK.
ASTERISK-28790

Change-Id: I10df52f98b19ed62575f25dab36e82d136dccd99
2020-03-26 08:36:37 -05:00
Kevin Harwell ebddff3453 ast_coredumper: add Asterisk information dump
This patch makes it so ast_coredumper now outputs the following information to
a *-info.txt file when processing a core file:

  asterisk version and "built by" string
  BUILD_OPTS
  system start, and last reloaded date/time
  taskprocessor list
  equivalent of "bridge show all"
  equivalent of "core show channels verbose"

Also a slight modification was made when trying to obtain the pid(s) of a
running Asterisk. If it fails to retrieve any it now reports an error.

Change-Id: I54f35c19ab69b8f8dc78cc933c3fb7c99cef346b
2020-03-26 08:28:28 -05:00
Jaco Kroon ff0e685eea netsock2: compile fixes.
This fixes ast_addressfamily_to_sockaddrsize to reference the
provided argument, and ast_sockaddr_from_sockaddr to not use the name of
a structure as argument.

Change-Id: Ibf5db469c47c3b4214edf8456326086174e8edd7
2020-03-26 07:44:29 -05:00
Jaco Kroon d278350768 dahdiras: Only set plugin dahdi.so to pppd if we're running as root.
Users of this should set plugin dahdi.so in their options file.

ASTERISK-16676

Change-Id: I6d01ad0a10e9fea477876d0941c3f38aac357e91
2020-03-25 17:24:09 -05:00
Jaco Kroon 9cd46ec118 dundi: fix NULL dereference.
If a negative (error) return is received from dundi_lookup_internal,
this is not handled correctly when assigning the result to the buffer.
As such, use a signed integer in the assignment and do a proper
comparison.

ASTERISK-21205

Change-Id: I5214ebb6491e2bd14f90c7d3ce229da86888f739
2020-03-25 17:21:48 -05:00
Joshua C. Colp 0b92aa4c49 res_pjsip_sdp_rtp: Only do hold/unhold on default audio stream.
When examining a stream to determine hold/unhold information we
only care about the default audio stream. Other streams aren't
used for hold/unhold.

ASTERISK-28784

Change-Id: I7a1f10f07822c4aee1f98a38b9628849b578afe4
2020-03-25 15:21:46 -05:00
Sungtae Kim ac3a81992a res_pjsip_session: Fixed wrong session termination
When the Asterisk receives 200 OK with invalid SDP,
the Asterisk/PJPROJECT terminating the session.
But if the channel was in the Bridge, Asterisk tries send
the Re-Invite before terminating the session.
And when the Asterisk sending the Re-Invite, it doesn't check
the SDP is NULL or not. This crashes the Asterisk.

Fixed it to close the session correctly if the UAS sends the
200 OK with wrong SDP.

ASTERISK-28743

Change-Id: Ifa864e0e125b1a7ed2f3abd4164187e1dddc56da
2020-03-25 07:55:13 -05:00
Jaco Kroon 21c9f30ba8 build: enable building with uClibc
This patch has been included in Gentoo distribution for at least since
asterisk 1.8, but there are references in the logs going back as far as
1.0.0 - not sure if this is still required in any way, it does apply,
and it doesn't (as far as we can determine) cause build failures.

Change-Id: I46d8845e30200205e80580680bf060aa3012ba54
2020-03-25 07:30:06 -05:00
Jaco Kroon 6262b74303 build: search from newest to oldest for gmime.
We (Gentoo distribution) reckon that in the case of multiple versions of
gmime installed we should prefer the newest one.

Change-Id: Idf7be613230232eb1d573d93c4a5a8297f4ecd2d
2020-03-25 06:41:43 -05:00
Joshua C. Colp c86af00ce1 res_pjsip_session: Don't restrict non-audio default streams to sendrecv.
The state of the default audio stream is used for hold/unhold so we
restrict it to sendrecv as the core does not handle when it changes as
a result of hold/unhold.

This restriction does not apply to other media types though so we now
only restrict it to audio. This allows the other default streams to
store their state at all values, and not just sendrecv and removed.

ASTERISK-28783

Change-Id: I139740f38cea7f7d92a876ec2631ef50681f6625
2020-03-25 05:38:45 -05:00
Michael Neuhauser b2e0c6cacc chan_psip, res_pjsip_sdp_rtp: ignore rtptimeout if direct-media is active
Do not hang up a PJSIP channel on RTP timeout if that channel is in
a direct-media bridge. Also reset the time of the last received RTP packet when
direct-media ends (wait full rtp_timeout period before checking first time after
audio came back to Asterisk).

ASTERISK-28774
Reported-by: Michael Neuhauser

Change-Id: I8b62012be7685849e8fb2b1c5dd39d35313ca2d1
2020-03-20 10:17:14 -05:00
Jaco Kroon 351b2be00a res_rtp_asterisk: implement ACL mechanism for ICE and STUN addresses.
A pure blacklist is not good enough, we need a whitelist mechanism as
well, and the simplest way to do that is to re-use existing ACL
infrastructure.

This makes it simpler to blacklist say an entire block (/24) except a
smaller block (eg, a /29 or even a /32).  Normally you'd need to
recursively split the block, so if you want to blacklist a /24 except
for a /29 you'd end up with a blacklit for a /25, /26, /27 and /28.  I
feel that having an ACL instead of a blacklist only is clearer.

Change-Id: Id57a8df51fcfd3bd85ea67c489c85c6c3ecd7b30
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2020-03-20 08:40:23 -05:00
Jaco Kroon 33b2c7f79b Update main/backtrace.c to deal with changes in binutils 2.34.
binutils 2.34 merged this commit:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;\
	h=fd3619828e94a24a92cddec42cbc0ab33352eeb4

Which effectively does things like:

-#define bfd_section_size(bfd, ptr) ((ptr)->size)
-#define bfd_get_section_size(ptr) ((ptr)->size)

+#define bfd_section_size(sec) ((sec)->size)

So in order to remain backwards compatible we need to detect this API
change, and adjust accordingly.  The simplest is to notice that the
bfd_get_section_size and bfd_get_section_vma MACROs are no longer
defined, and define then onto the new API.  The alternative is to litter
the code with a number of #ifdef #else #endif splatters right through
the code.

Change-Id: I3efe0f8e8f3e338d16fcbc2b26a505367b6e172f
2020-03-17 09:14:03 -05:00
Sean Bright 268b0a3085 func_odbc.conf.sample: Clarify sample documentation
ASTERISK-20325 #close

Change-Id: I06cb9b467b0fd06c8af2a5aee049f872c09cc4b6
2020-03-17 08:19:08 -05:00
Sean Bright 2a3b2d5781 chan_vpb: Fix 'catching polymorphic type ... by value' error
Fixes the following compile error:

    chan_vpb.cc:2688:26: error: catching polymorphic type
        ‘class std::exception’ by value

Change-Id: Ic87bc357d72427d77626735c83200fd278a7a649
2020-03-13 13:44:49 -05:00
Sean Bright 479723f3cc dns_txt: Add TXT record parsing support
Change-Id: Ie0eca23b8e6f4c7d9846b6013d79099314d90ef5
2020-03-13 10:01:01 -05:00
Joshua C. Colp c40050d350 audiohook: Don't allow audiohooks to attach to hung up channels.
Given a scenario where MixMonitor was initiated over AMI it
was possible for the channel and MixMonitor thread to remain
alive past hang up of the channel. This scenario required
the AMI initiated MixMonitor to retrieve the channel, a
hangup to occur on the channel in another thread, and then
for MixMonitor to actually start. If this occurred the
MixMonitor thread would remain alive indefinitely and
the channel reference would remain.

This change ensures that audiohooks are never able to
be attached to channels that have been hung up. An
additional fix has also been done in app_mixmonitor to
properly release the channel reference if this occurs.

ASTERISK-28780

Change-Id: I8044c06daa06f0f16607788c596f55623be26f58
2020-03-13 09:57:02 -05:00
George Joseph 59a708a935 CI: Create generic jenkinsfile
This is a generic jenkinsfile to build Asterisk and optionally
perform one or more of the following:
 * Publish the API docs to the wiki
 * Run the Unit tests
 * Run Testsuite Tests

This job can be triggered manually from Jenkins or be triggered
automatically on a schedule based on a cron string.

Change-Id: Id9d22a778a1916b666e0e700af2b9f1bacda0852
2020-03-13 08:37:42 -05:00
Torrey Searle f2ba1919e6 res_rtp_asterisk: Send correct sender SSRC when p2p bridge in use
bridge_p2p_rtp_write will forward rtp to the bridged rtp instance
without modifying the ssrc.  However, it is not updating the SSRC
in the bridged rtp.  Thus, when SSRC packets are generated, they
have the correct SSRC for the sender.

ASTERISK-28773 #close

Change-Id: I39f923bde28ebb4f0fddc926b92494aed294a478
2020-03-12 10:32:15 -05:00
George Joseph 90e5dc2959 Merge "res_pjsip_sdp_rtp: Don't wait for ICE if not negotiated" into 16 2020-03-10 13:37:07 -05:00
George Joseph c60f45ef4c Merge "chan_pjsip: Check audio frame when remote SSRC changes." into 16 2020-03-10 11:59:31 -05:00
George Joseph 5e7055d082 Merge "enum.c: Make ast_get_txt() actually do something." into 16 2020-03-09 10:04:27 -05:00
George Joseph 35545a4c8f Merge "enum.c: Add support for regular expression flag in NAPTR record" into 16 2020-03-09 10:00:21 -05:00
Joshua Colp dbc315dfc7 Merge "res_rtp_asterisk: Add 'rtp show settings' cli command" into 16 2020-03-09 08:57:33 -05:00
Torrey Searle 1efd90b72b res_pjsip_sdp_rtp: Don't wait for ICE if not negotiated
If ICE support is enabled but not negotiated, the rtp->ice structure is
not being destroyed. This leads to Asterisk waiting for ICE to complete
instead of immediately starting the DTLS handshake, resulting in the
call leg having no RTP.

ASTERISK-28769 #close

Change-Id: I17c137546dc9ecfb9583c24dcf4c2ced8bbd7a27
2020-03-09 13:31:40 +01:00
Paulo Vicentini 4495e64b7c chan_pjsip: Check audio frame when remote SSRC changes.
If the SSRC of a received RTP packet differed from the previous SSRC
an SSRC change control frame would be queued ahead of the media
frame. In the case of audio this would result in the format of the
audio frame not being checked, and if it differed or was not allowed
then it could cause the call to drop due to failure to set up a
translation path.

The chan_pjsip module will now no longer assume the first frame
will be the audio frame and instead goes through the complete list
to find it.

ASTERISK-28759

Change-Id: I6d854cc523f343e299a615636fc65bdbd5f809ec
2020-03-09 11:34:05 +01:00
Sean Bright acaf24e23c enum.c: Add support for regular expression flag in NAPTR record
A regular expression in a NAPTR response record can have a trailing
'i' flag to indicate that the expression should be evaluated in a
case-insensitive way. We were not checking for that flag which caused
the record parsing to fail on otherwise valid input.

Although this change will initially go into Asterisk 13, 16, and 17,
it is my intention to replace the majority of this code in 16 and up -
including this fix - by changing enum.c to consume the new DNS API
which duplicates most of this logic already. Asterisk 13 doesn't have
the DNS API, so this fix will be as good as it gets.

ASTERISK-26711 #close
Reported by: Vitold

Change-Id: I33943a5b3e7539c6dca3a5079982ee15a08186f0
2020-03-06 15:06:25 -06:00
Jared Smith a9abe55e0b indications.conf.sample: Add indication tones for Indonesia
These tones come from http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf

ASTERISK-23407

Change-Id: I48e2285f1e5bb29b3335f762006f66c423d0fcb8
2020-03-06 08:41:52 -06:00
Rodrigo Ramírez Norambuena 7dcabaef08 res_rtp_asterisk: Add 'rtp show settings' cli command
This change introduce a CLI command for the RTP to display the general
configuration.

In the first step add the follow fields of the configurations:
  - rtpstart
  - rtpend
  - dtmftimeout
  - rtpchecksum
  - strictrtp
  - learning_min_sequential
  - icesupport

Change-Id: Ibe5450898e2c3e1ed68c10993aa1ac6bf09b821f
2020-03-05 14:16:45 -06:00
Asterisk Development Team 1522c4467c Update CHANGES and UPGRADE.txt for 16.9.0 2020-03-05 12:23:01 -05:00
Kevin Harwell 44a8615e22 Merge "res_pjsip_refer: ensure refer progress is still sent after Proceeding()" into 16 2020-03-05 11:03:01 -06:00
Sean Bright 9a111d188f enum.c: Make ast_get_txt() actually do something.
The ast_get_txt() API function (and by extension, the TXTCIDNAME
dialplan function) were broken in
65b8381550 such that we would never
actually make a DNS TXT query as described.

This patch restores the documented behavior.

ASTERISK-19460 #close
Reported by: George Joseph

Change-Id: I1b19aea711488cb1ecd63843cddce05010e39376
2020-03-04 17:02:07 -06:00
Joshua Colp 92b464556f Merge "check_expr2: fix cross-compile/hardening issues" into 16 2020-03-04 06:57:17 -06:00
Joshua Colp 1affc17d95 Merge "message & stasis/messaging: make text message variables work in ARI" into 16 2020-03-04 06:12:08 -06:00
Kevin Harwell 47658a0a2b Merge "res_rtp_asterisk: Improve video performance in certain networks." into 16 2020-03-03 14:40:32 -06:00
lvl f529d56f76 res_pjsip_refer: ensure refer progress is still sent after Proceeding()
ASTERISK-28766 #close

Change-Id: I5ce2210062f9325db762edbf6e46075079bb2cd1
2020-03-03 17:00:59 +00:00
Sebastian Kemper 06e8d5ad8e check_expr2: fix cross-compile/hardening issues
When building check_expr2 with ASLR PIE hardening enabled the linker
fails. This is resolved by adding the regular compiler flags when
building the object files from ast_expr2f.c and ast_expr2.c.

Note: The STANDALONE define is removed because it is already defined in
_ASTCFLAGS. YY_NO_INPUT is defined so that the compile survives
'--enable-dev-mode'.

Also, a Makefile variable "CROSS_COMPILING" is added so that the
build system doesn't try to run check_expr2 when cross-compiling,
because that will fail the build as will.

ASTERISK-28685 #close

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
Change-Id: If435b7db9f9ad8266245bda51c81c220f9658915
2020-03-03 08:17:54 -06:00
Joshua C. Colp f295af447d res_rtp_asterisk: Improve video performance in certain networks.
The receive buffer will now grow if we end up flushing the
receive queue after not receiving the expected packet in time.
This is done in hopes that if this is encountered again the
extra buffer size will allow more time to pass and any missing
packets to be received.

The send buffer will now grow if we are asked for packets and
can't find them. This is done in hopes that the packets are
from the past and have simply been expired. If so then in
the future with the extra buffer space the packets should be
available.

Sequence number cycling has been handled so that the
correct sequence number is calculated and used in
various places, including for sorting packets and
for determining if a packet is old or not.

NACK sending is now more aggressive. If a substantial number
of missing sequence numbers are added a NACK will be sent
immediately. Afterwards once the receive buffer reaches 25%
a single NACK is sent. If the buffer continues to grow and
reaches 50% or greater a NACK will be sent for each received
future packet to aggressively ask the remote endpoint to
retransmit.

ASTERISK-28764

Change-Id: I97633dfa8a09a7889cef815b2be369f3f0314b41
2020-03-03 06:50:49 -04:00
Kevin Harwell 9617e530b6 Merge "res/res_pjsip_sdp_rtp: Fix MOH transitions" into 16 2020-03-02 14:17:09 -06:00
Kevin Harwell fc1d93cf97 message & stasis/messaging: make text message variables work in ARI
When a text message was received any associated variable was not written to
the ARI TextMessageReceived event. This occurred because Asterisk only wrote
out "send" variables. However, even those "send" variables would fail ARI
validation due to a TextMessageVariable formatting bug.

Since it seems the TextMessageReceived event has never been able to include
actual variables it was decided to remove the TextMessageVariable object type
from ARI, and simply return a JSON object of key/value pairs for variables.
This aligns more with how the ARI sendMessage handles variables, and other
places in ARI.

That being the case, and since this is technically an API breaking change (no
one should really be affected since things never really worked) the ARI version
was updated to reflect that.

ASTERISK-28755 #close

Change-Id: Ia6051c01a53b30cf7edef84c27df4ed4479b8b6f
2020-03-02 12:11:50 -06:00
Kevin Harwell d86cd96c87 Merge "addons/res_config_mysql: silense warnings about printf format errors." into 16 2020-02-27 14:44:29 -06:00
Kevin Harwell 082f571668 Merge "app_queue: Refactor odd placement of if's around say_position" into 16 2020-02-27 14:42:10 -06:00
Torrey Searle 9ecb651564 res/res_pjsip_sdp_rtp: Fix MOH transitions
Update the state of remote_hold immediately on receipt of remote
SDP so that the information is available when building the SDP
answer

ASTERISK-28754 #close

Change-Id: I7026032a807e9c95081cb8f060400b05deb4836f
2020-02-27 14:21:51 -06:00
Kevin Harwell ed68feeca4 Merge "say: Remove unused "plural" option from main/say" into 16 2020-02-27 13:42:51 -06:00
Kevin Harwell a421759d63 Merge "format_cap: make function parameters 'const'" into 16 2020-02-27 13:15:33 -06:00
Kevin Harwell 333f64ce83 Merge "pjsip: Update ACLs on named ACL changes." into 16 2020-02-27 12:53:32 -06:00
Walter Doekes ad5a81aac4 say: Remove unused "plural" option from main/say
There are exceptions for plural objects, but they are detected using the
supplied NUMBER, not using an extra option.

Change-Id: I95d1d1b2796b1aba92048a2dbae8a3856ed8a113
2020-02-25 10:00:25 -06:00
Walter Doekes b12ecbe27f app_queue: Refactor odd placement of if's around say_position
Change-Id: Icba97905e331812f129e5966e91a59b104c7a748
2020-02-25 09:59:31 -06:00
Kevin Harwell dd959bf8d0 format_cap: make function parameters 'const'
There were a couple places where the format cap function parameter was not
'const' when it should have been. This patch makes them 'const'.

Change-Id: Ife753fb16a962d842a6b44f45363a61a66bfdb2e
2020-02-24 13:37:31 -06:00
Jaco Kroon 7d1305ac21 addons/res_config_mysql: silense warnings about printf format errors.
Warnings without this:

res_config_mysql.c: In function 'update2_mysql':
res_config_mysql.c:741:15: warning: format '%llu' expects argument of type
    'long long unsigned int', but argument 6 has type 'my_ulonglong'
    {aka 'long unsigned int'} [-Wformat=]
ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n",
    numrows, tablename);

(reformatted for readability within line-wrap)

Change-Id: I2af4d419a37c1a7eeee750cf9ae4a9a2b3a37fd3
2020-02-24 08:21:51 -06:00
George Joseph dd313ceda5 Merge "tcptls.c: Log more informative OpenSSL errors" into 16 2020-02-21 09:01:21 -06:00
George Joseph 0cf988e72b Merge "bridging: Add better support for adding/removing streams." into 16 2020-02-20 13:43:07 -06:00
George Joseph 75648945a2 Merge "ast_tls_cert: Allow private key size to be set on command line" into 16 2020-02-20 10:52:07 -06:00
George Joseph 97789b1749 Merge "app_mixmonitor: Set MIXMONITOR_FILENAME to correct value when wav49 is used" into 16 2020-02-20 10:51:01 -06:00
George Joseph 0319e80ff6 Merge "RTP/ICE: Send on first valid pair." into 16 2020-02-20 09:23:29 -06:00
Joshua C. Colp b20a215ea7 pjsip: Update ACLs on named ACL changes.
This change extends the Sorcery API to allow a wizard to be
told to explicitly reload objects or a specific object type
even if the wizard believes that nothing has changed.

This has been leveraged by res_pjsip and res_pjsip_acl to
reload endpoints and PJSIP ACLs when a named ACL changes.

ASTERISK-28697

Change-Id: Ib8fee9bd9dd490db635132c479127a4114c1ca0b
2020-02-19 19:32:16 +00:00
Sean Bright c32b4c7dc0 tcptls.c: Log more informative OpenSSL errors
Dump OpenSSL's error stack to the error log when things fail.

ASTERISK-28750 #close
Reported by: Martin Zeh

Change-Id: Ib63cd0df20275586e68ac4c2ddad222ed7bd9c0a
2020-02-19 14:32:04 -05:00
Sean Bright cf1f2dfe8e ast_tls_cert: Allow private key size to be set on command line
The default size in release branches will be 1024 but we'll use 2048 in master.

ASTERISK~28750

Change-Id: I435cea18bdd58824ed2b55259575c7ec7133842a
2020-02-19 08:39:21 -06:00
George Joseph c255dbd836 Merge "res_pjsip_outbound_registration: Fix SRV failover on timeout" into 16 2020-02-18 14:53:41 -06:00
George Joseph 7eab841093 res_pjsip_outbound_registration: Fix SRV failover on timeout
In order to retry outbound registrations for some situations, we
need access to the tdata from the original request.  For instance,
for 401/407 responses we need it to properly construct the
subsequent request with the authentication.  We also need it if
we're iterating over a DNS SRV response record set so we can skip
entries we've already tried.

We've been getting the tdata from the server response rdata and
transaction but that only works for the failures where there was
actually a response (4XX, 5XX, etc).  For timeouts there's no
response and therefore no rdata or transaction from which to get
the tdata.  When processing a single A/AAAA record for a server,
this wasn't an issue as we just retried that same server after the
retry timer expired.  If we got an SRV record set for the server
though, without the state from the tdata, we just kept trying the
first entry in the set repeatedly instead of skipping to the next
one in the list.

* Added a "last_tdata" member to the client state structure to keep
  track of the sent tdata.

* Updated registration_client_send() to save the tdata it used into
  the client_state.

* Updated sip_outbound_registration_response_cb() to use the tdata
  saved in client_state when we don't get a response from the
  server. We still use the tdata from the transaction when we DO
  get a response from the server so we can properly handle 4XX
  responses where our new request depends on it.

General note on timeouts:

Although res_pjsip_outbound_registration skips to the next record
immediately when a timeout occurs during SRV set traversal, it's
pjproject that determines how long to wait before a timeout is
declared.  As with other SIP message types, pjproject will continue
trying the same server at an interval specified by "timer_t1" until
"timer_b" expires.  Both of those timers are set in the pjsip.conf
"system" section.

ASTERISK-28746

Change-Id: I199b8274392d17661dd3ce3b4d69a3968368fa06
2020-02-18 12:05:57 -07:00
Joshua C. Colp 423b0e68ce bridging: Add better support for adding/removing streams.
This change adds support to bridge_softmix to allow the addition
and removal of additional video source streams. When such a change
occurs each participant is renegotiated as needed to reflect the
update. If another video source is added then each participant
gets another source. If a video source is removed then it is
removed from each participant. This functionality allows you to
have both your webcam and screenshare providing video if you
desire, or even more streams. Mapping has been changed to use
the topology index on the source channel as a unique identifier
for outgoing participant streams, this will never change and
provides an easy way to establish the mapping.

The bridge_simple and bridge_native_rtp modules have also been
updated to renegotiate when the stream topology of a party changes
allowing the same behavior to occur as added to bridge_softmix.
If a screen share is added then the opposite party is renegotiated.
If that screen share is removed then the opposite party is
renegotiated again.

Some additional fixes are also included in here. Stream state is
now conveyed in SDP so sendonly/recvonly/inactive streams can
be requested. Removed streams now also remove previous state
from themselves so consumers don't get confused.

ASTERISK-28733

Change-Id: I93f41fb41b85646bef71408111c17ccea30cb0c5
2020-02-18 16:22:27 +00:00
George Joseph e213bc530f Merge "res_pjsip_sdp_rtp: implement hold state handling on moh_passthrough" into 16 2020-02-18 10:08:26 -06:00
Ben Ford 411d3a2f75 RTP/ICE: Send on first valid pair.
When handling ICE negotiations, it's possible that there can be a delay
between STUN binding requests which in turn will cause a delay in ICE
completion, preventing media from flowing. It should be possible to send
media when there is at least one valid pair, preventing this scenario
from occurring.

A change was added to PJPROJECT that adds an optional callback
(on_valid_pair) that will be called when the first valid pair is found
during ICE negotiation. Asterisk uses this to start the DTLS handshake,
allowing media to flow. It will only be called once, either on the first
valid pair, or when ICE negotiation is complete.

ASTERISK-28716

Change-Id: Ia7b68c34f06d2a1d91c5ed51627b66fd0363d867
2020-02-18 09:50:32 -06:00
George Joseph 4c3721afa8 Merge "res_rtp_asterisk: bad audio (static) due to incomplete dtls/srtp setup" into 16 2020-02-17 11:27:51 -06:00
Sean Bright cd8b27dcc2 app_mixmonitor: Set MIXMONITOR_FILENAME to correct value when wav49 is used
When opening a file for writing, Asterisk silently converts filenames
ending with 'wav49' to 'WAV.' We aren't taking that in to account when
setting the MIXMONITOR_FILENAME variable in MixMonitor.

* If the user wants to write to a wav49 file, make sure that it is
  reflected properly in MIXMONITOR_FILENAME.

* Add a note to the documentation describing this behavior.

* Add a note in main/file.c indicating that app_mixmonitor needs to be
  changed if the logic in build_filename was changed.

ASTERISK-24798 #close
Reported by: xrobau

Change-Id: I384691ce624eb55c80a125b9ca206d2d691c574c
2020-02-17 10:58:25 -06:00
Torrey Searle afcc838796 res_pjsip_sdp_rtp: implement hold state handling on moh_passthrough
When moh_passthrough is used, asterisk is only generating invites
of type sendonly and sendrecv instead of taking fully into account
the on hold state of the local and remote parties

ASTERISK-28738 #close

Change-Id: Iaaad9fbc033cb14803d433b8a4071bc337047761
2020-02-17 08:33:51 -06:00
Joshua C. Colp df52f713f5 stasis: Use format specifier for size_t.
Change-Id: Ic9b4afcc5398e7f46314419fc3c90433d818e35c
2020-02-15 08:04:35 -06:00
Kevin Harwell bb783b0c11 res_rtp_asterisk: bad audio (static) due to incomplete dtls/srtp setup
There was a race condition between client initiated DTLS setup, and handling
of server side ice completion that caused the underlying SSL object to get
cleared during DTLS initialization. If this happened Asterisk would be left
in a partial DTLS setup state. RTP packets were sent and received, but were
not being encrypted and decrypted. This resulted in no audio, or static.

Specifically, this occurred when '__rtp_recvfrom' was processing the handshake
sequence from the client to the server, and then 'ast_rtp_on_ice_complete'
gets called from another thread and clears the SSL object when calling the
'dtls_perform_setup' function. The timing had to be just right in the sense
that from the external SSL library perspective SSL initialization completed
(rtp recv), Asterisk clears/resets the SSL object (ice done), and then checks
to see if SSL is intialized (rtp recv). Since it was cleared, Asterisk thinks
it is not finished, thus not completing 'dtls_srtp_setup'.

This patch removes calls to 'dtls_perform_setup', which clears the SSL object,
in 'ast_rtp_on_ice_complete'. When ice completes, there is no reason to clear
the underlying SSL object. If an ice candidate changes a full protocol level
renegotiation occurs. Also, in the case of bundled ICE candidates are reused
when a stream is added. So no real reason to have to clear, and reset in this
instance.

Also, this patch adds a bit of extra logging to aid in diagnosis of any future
problems.

ASTERISK-28742 #close

Change-Id: I34c9e6bad5a39b087164646e2836e3e48fe6892f
2020-02-14 10:52:28 -06:00
Joshua Colp 0d0f2b4569 Merge "res_pjsip_session: Fix off-nominal session refreshes." into 16 2020-02-13 19:02:10 -06:00
Joshua Colp 1b3de98db5 Merge "res_musiconhold: Avoid spurious warning when 'format' is the empty string" into 16 2020-02-13 19:01:39 -06:00
George Joseph 918e79aae5 Merge "doc: Fix CHANGES entries to have .txt suffix and update READMEs" into 16 2020-02-13 08:30:26 -06:00
Sean Bright 1e94cfdf4c res_musiconhold: Avoid spurious warning when 'format' is the empty string
The change to res_config_odbc that allowed empty strings to be
returned to realtime consumers¹ causes a warning to be emitted when
loading MoH classes. So we need to treat an empty 'format' as if it
was not specified to avoid the warning.

ASTERISK-28735 #close
Reported by: Ross Beer

[1] https://gerrit.asterisk.org/c/asterisk/+/13722

Change-Id: I9a271d721e1a0973e80ebe7d75b46a0d8fa0e5a5
2020-02-11 08:55:31 -05:00
Sean Bright 65ff4d80a1 func_odbc: Prevent snprintf() truncation warning
For reasons that are not clear to me - this only appears for me when
_not_ building in dev-mode.

Change-Id: Ib45c54daaea8e0d571cb470cab1daaae2edba968
2020-02-10 15:42:37 -06:00
Joshua C. Colp b438d1d9ad res_pjsip_session: Fix off-nominal session refreshes.
Given a scenario where session refreshes occur close to
each other while another is finishing it was possible for
the session refreshes to occur out of order. It was
also possible for session refreshes to be delayed for
quite some time if a session refresh did not result in
a topology change.

For the out of order session refreshes the first session
refresh would be queued due to a transaction in progress.
This transaction would then finish. When finished a
separate task to process the delayed requests queue
would be queued for handling. A second refresh would
be requested internally before this delayed request
queued task was processed. As no transaction was in
progress this session refresh would be immediately
handled before the queued session refresh.

The code will now check if any delayed requests exist
before allowing a session refresh to immediately occur.
If any exist then the session refresh is queued.

For the delayed session refreshes if a session refresh
did not result in a topology change the attempt would
be immediately stopped and no other delayed requests would
be processed.

The code will now go through the entire delayed requests
queue until a delayed request results in a request
actually being sent.

ASTERISK-28730

Change-Id: Ied640280133871f77d3f332be62265e754605088
2020-02-10 08:10:48 -04:00
George Joseph 1544f74932 doc: Fix CHANGES entries to have .txt suffix and update READMEs
Although the wiki page for the new CHANGES and UPGRADE scheme
states that the files must have the ".txt" suffix, the READMEs
didn't.

Change-Id: I490306aa2cc24d6f014738e9ebbc78592efe0f05
(cherry picked from commit 7416703f04)
2020-02-07 14:08:21 -06:00
Joshua Colp b3360fa5df Merge "pjproject_bundled: Allow brackets in via parameters" into 16 2020-02-07 07:05:56 -06:00
Joshua Colp ba8a9b5eed Merge "chan_sip: Return 503 if we're out of RTP ports" into 16 2020-02-06 07:24:24 -06:00
Friendly Automation 40751c2769 Merge "install_prereq: Install aptitude non-interactively" into 16 2020-02-06 07:22:36 -06:00
Friendly Automation 3d20251085 Merge "chan_sip: Clarify in sample docs how directmediapermit/-acl should be used" into 16 2020-02-05 10:25:10 -06:00
Friendly Automation bb73edad37 Merge "res_config_odbc: Preserve empty strings returned by the database" into 16 2020-02-05 09:48:50 -06:00
Friendly Automation 98f451771f Merge "res_stasis_playback: Prevent media_index from going out of bounds" into 16 2020-02-05 09:45:09 -06:00
Sylvain Afchain 40b834ad8c install_prereq: Install aptitude non-interactively
Currently aptitude is installed using interactive mode. This patch
changes this to use the non-interactive mode as it can block
automatic dependencies installation, ex: CI, Docker build.

ASTERISK-28726 #close

Change-Id: I271ee00d230513a6f044810351a32d83b2181133
(cherry picked from commit 0c02d0a450)
2020-02-05 14:21:47 +01:00
Walter Doekes 34ce90a9e7 chan_sip: Return 503 if we're out of RTP ports
If you're for some reason out of RTP ports, chan_sip would previously
responde to an INVITE with a 403, which will fail the call.

Now, it returns a 503, allowing the device/proxy to retry the call on a
different machine.

ASTERISK-28718

Change-Id: I968dcf6c1e30ecddcce397dcda36db727c83ca90
2020-02-05 06:32:59 -06:00
Walter Doekes 35b4f1686b chan_sip: Clarify in sample docs how directmediapermit/-acl should be used
It said "restrict [...] which peers should be able to pass [audio]
to each other".

However, these settings are not global (for which you would expect
signaling IPs to be checked). These settings are available per peer
only, and the IPs being checked, are the RTP IPs.

Change-Id: I2a6c6cd7c2f5f30d1df4844e3e0308a077021660
2020-02-05 06:27:06 -06:00
Joshua C. Colp f4132eec19 res_rtp_asterisk: Don't produce transport-cc if no packets.
The code assumed that when the transport-cc feedback
function was called at least one packet will have been
received. In practice this isn't always true, so now
we just reschedule the sending and do nothing.

Change-Id: Iabe7b358704da446fc3b0596b847bff8b8a0da6a
2020-02-04 10:18:13 -04:00
George Joseph d6574cb7c7 message.c: Add option to suppress the Message channel AMI and ARI events
In order to reduce the amount of AMI and ARI events generated,
the global "Message/ast_msg_queue" channel can be set to suppress
it's normal channel housekeeping events such as "Newexten",
"VarSet", etc. This can greatly reduce load on the manager
and ARI applications when the Digium Phone Module for Asterisk
is in use.  To enable, set "hide_messaging_ami_events" in
asterisk.conf to "yes"  In Asterisk versions <18, the default
is "no" preserving existing behavior.  Beginning with
Asterisk 18, the option will default to "yes".

NOTE:  This change does not affect UserEvents or the ARI
TextMessageReceived events.

* Added the "hide_messaging_ami_events" option to asterisk.conf.

* Changed message.c to set the AST_CHAN_TP_INTERNAL property on
  the "Message/ast_msg_queue" channel if the option is set in
  asterisk.conf.  This suppresses the reporting of the events.

Change-Id: Ia2e3516d43f4e0df994fc6598565d6bba2d7018b
2020-02-03 12:57:59 -07:00
Friendly Automation 48d5433cdd Merge "res_pjsip_messaging: Allow Content-Type to be overridden" into 16 2020-02-03 06:06:56 -06:00
Friendly Automation 88e67b51f2 Merge "res_stasis: trigger cleanup after update" into 16 2020-01-30 10:02:16 -06:00
George Joseph b5b00e5299 Merge "stasis/app: don't lock an app before a call to send" into 16 2020-01-30 09:24:24 -06:00
George Joseph 1e78b2cf0a Merge "res_pjsip_pubsub: Increment persistence data ref when recreating." into 16 2020-01-30 09:22:39 -06:00
Sean Bright d8d989b9bf res_config_odbc: Preserve empty strings returned by the database
When res_config_odbc (and perhaps other realtime backends) reads a SQL
NULL from the database, it coalesces the value to the empty string
which prevents it from being returned to the realtime core.

However, if it instead reads the empty string from the database, it
needs a way to encode that fact without having the value omitted
entirely. It does this by changing the value to a string with a single
space. The realtime code in main/config.c recognizes this special case
and _turns the string back into the empty string_ before passing it to
realtime API consumers.

For all of this to work, we need to ensure that we actually pass the
single-space-string back to the realtime core, which is currently
failing because we are trimming the value before checking its
content. So instead we now special case the single-space-string case
so that empty values are returned properly.

ASTERISK-28719 #close
Reported by: EDV O-TON

Change-Id: I673ed8c31ad037aa224e80c78c7a1dc4e4a4e3de
2020-01-29 09:14:55 -06:00
Sean Bright 2a6b09e2e8 res_stasis_playback: Prevent media_index from going out of bounds
Incrementing stasis_app_playback.media_index directly in our playback
loop means that when we reach the end of our playlist the index into
the vector will be outside of the bounds of the vector.

Instead use a temporary variable and only assign when we're sure that
we are in bounds.

ASTERISK-28713 #close
Reported by: Sébastien Duthil

Change-Id: Ib53f7f156097e0607eb5871d9d78d246ed274928
2020-01-29 08:11:18 -05:00
Friendly Automation 35a782d58a Merge "res_pjsip_messaging: Ensure MESSAGE_SEND_STATUS is set properly" into 16 2020-01-28 10:17:45 -06:00
Joshua C. Colp 4d32f5747c res_pjsip_pubsub: Increment persistence data ref when recreating.
Each subscription needs to have a reference to the persisted data
for it, as well as the main JSON contained within the tree. When
recreating a subscription this did not occur and they both shared
the same reference.

ASTERISK-28714

Change-Id: I706abd49ea182ea367a4ac3feca2706460ae9f4a
2020-01-28 15:18:45 +00:00
Sean Bright 2a9a1789e7 res_pjsip_messaging: Allow Content-Type to be overridden
ASTERISK-26082 #close
Reported by: Alex

Change-Id: I6549e90932016349bc72b0f053432dc25286f4fb
2020-01-28 08:16:32 -06:00
Friendly Automation de3b98fcc4 Merge "chan_sip: Always process updated SDP on media source change" into 16 2020-01-27 18:28:38 -06:00
Kevin Harwell e103339f02 stasis/app: don't lock an app before a call to send
Calling 'app_send' eventually calls the app's message handler. It's possible
for a handler to obtain a lock on another object, and then need/want to lock
the app object. If the caller of 'app_send' locks the app object prior to
calling then there's a potential for a deadlock, if another thread calls
'app_send' without locking.

This patch makes it so 'app_send' is not called with the app object locked in
the section of code doing such.

ASTERISK-28423 #close

Change-Id: I6767c6d0933c7db1b984018966eefca4c0638a27
2020-01-27 12:01:15 -06:00
Kevin Harwell dc9875815c res_stasis: trigger cleanup after update
The cleanup code in stasis shuts down applications if they are in a deactivated
state, and no longer have explicit subscriptions. When registering an app the
cleanup code was running before calling 'update'. When it should be executed
after 'update' since a call to register may re-activate the app. We don't want
it to shutdown before the 'update' otherwise the app won't be re-activated,
or registered.

This patch makes it so the cleanup code is executed post 'update'.

ASTERISK-28679 #close

Change-Id: I8f2c0b17e33bb8128441567b97fd4c7bf74a327b
2020-01-27 11:59:27 -06:00
Sean Bright 4bbf24d2ff res_pjsip_messaging: Ensure MESSAGE_SEND_STATUS is set properly
We need to wait for the message sending callback to finish to know if
we succeeded or failed.

ASTERISK-25421 #close
Reported by:  Dmitriy Serov

Change-Id: I22b954398821d2caf4c6fe58f0607c8cfa378059
2020-01-27 11:07:01 -06:00
Joshua Colp 57bb9dc83c Merge "chan_pjsip: Ignore RTP that we haven't negotiated" into 16 2020-01-27 06:05:06 -06:00
Walter Doekes ad9a40a539 chan_sip: Always process updated SDP on media source change
Fixes no-audio issues when the media source is changed and
strictrtp is enabled (default).

If the peer media source changes, the SDP session version also changes.
If it is lower than the one we had stored, chan_sip would ignore it.

This changeset keeps track of the remote media origin identifier,
comparing that as well. If it changes, the session version needn't be
higher for us to accept the SDP.

Common scenario where this would've caused problems: a separate media
gateway that informs the caller about premium rates before handing off
the call to the final destination.

(An alternative fix would be to set ignoresdpversion=yes on the peer.)

ASTERISK-28686

Change-Id: I88fdbc5aeb777b583e7738c084254c482a7776ee
2020-01-24 10:28:44 -06:00
Asterisk Development Team eb1ec0498d Update CHANGES and UPGRADE.txt for 16.8.0 2020-01-23 11:12:30 -05:00
Sean Bright 1532da3008 chan_pjsip: Ignore RTP that we haven't negotiated
If chan_pjsip receives an RTP packet whose payload differs from the
channel's native format, and asymmetric_rtp_codec is disabled (the
default), Asterisk will switch the channel's native format to match
that of the incoming packet without regard to the negotiated payloads.

We now check that the received frame is in a format we have negotiated
before switching payloads which results in these packets being dropped
instead of causing the session to terminate.

ASTERISK-28139 #close
Reported by: Paul Brooks

Change-Id: Icc3b85cee1772026cee5dc1b68459bf9431c14a3
2020-01-23 10:53:07 -05:00
Joshua Colp 60d4230eec Merge "http: Add ability to disable /httpstatus URI" into 16 2020-01-23 08:47:38 -06:00
George Joseph 1b452ebb51 cdr.c: Set event time on party b when leaving a parking bridge
When Alice calls Bob and Bob does a blind transfer to Charlie,
Bob's bridge leave event generates a finalize on both the party_a
and party_b CDRs but while the party_a CDR has the correct end time
set from the event time, party_b's leg did not. This caused that
CDR's end time to be equal to the answered time and resulted in a
billsec of 0.

* We now pass the bridge leave message event time to
cdr_object_party_b_left_bridge_cb() and set it on that CDR before
calling cdr_object_finalize() on it.

NOTE:  This issue affected transfers using chan_sip most of the
time but also occasionally affected chan_pjsip probably due to
message timing.

ASTERISK-28677
Reported by: Maciej Michno

Change-Id: I790720f1e7326f9b8ce8293028743b0ef0fb2cca
2020-01-22 13:08:36 -06:00
Sean Bright a2a4e1026c http: Add ability to disable /httpstatus URI
Add a new configuration option 'enable_status' which allows the
/httpstatus URI handler to be administratively disabled.

We also no longer unconditionally register the /static and /httpstatus
URI handlers, but instead do it based upon configuration.

Behavior change: If enable_static was turned off, the URI handler was
still installed but returned a 403 when it was accessed. Because we
now register/unregister the URI handlers as appropriate, if the
/static URI is disabled we will return a 404 instead.

Additionally:

* Change 'enablestatic' to 'enable_static' but keep the former for
  backwards compatibility.
* Improve some internal variable names

ASTERISK-28710 #close

Change-Id: I647510f796473793b1d3ce1beb32659813be69e1
2020-01-22 10:09:54 -06:00
Friendly Automation 1b2d305178 Merge "func_odbc.conf.sample: Add example lookup" into 16 2020-01-22 08:44:18 -06:00
Friendly Automation 479781a582 Merge "res_statsd: Document that res_statsd does nothing on its own" into 16 2020-01-22 08:38:15 -06:00
Friendly Automation 567d572b98 Merge "chan_dahdi: Change 999999 to INT_MAX to better reflect "no timeout"" into 16 2020-01-22 07:48:38 -06:00
Joshua Colp fe18c83296 Merge "translate.c: Fix silk 24kHz truncation in 'core show translation'" into 16 2020-01-22 07:45:41 -06:00
Friendly Automation cfaf8dfc4d Merge "chan_sip.c: Stop handling continuation lines after reading headers" into 16 2020-01-21 08:27:26 -06:00
Andrew Siplas 9895e94dba chan_dahdi: Change 999999 to INT_MAX to better reflect "no timeout"
The no-entry timeout set to 999999 == 16⅔ minutes, change to INT_MAX
to match behavior of "no timeout" defined in comment.

ASTERISK-28702 #close

Change-Id: I4ea015986e061374385dba247b272f7aac60bf11
2020-01-21 09:08:37 -05:00
Sean Bright efecc9d139 translate.c: Fix silk 24kHz truncation in 'core show translation'
SILK @ 24kHz is not shown in the 'core show translation' output because of an
off-by-one-error. Discovered while looking into ASTERISK~19871.

ASTERISK-28706
Reported by: Sean Bright

Change-Id: Ie1a551a8a484e07b45c8699cc0c90f1061029510
2020-01-20 15:58:08 -06:00
Sean Bright a7aaca9eaa func_odbc.conf.sample: Add example lookup
Change-Id: Ia05aab1f579597963d2ea23920d2210cfcb97c84
2020-01-20 15:26:29 -06:00
Sean Bright 04c81f9748 res_statsd: Document that res_statsd does nothing on its own
ASTERISK-24484 #close
Reported by: Dan Jenkins

Change-Id: I05f298904511d6739aefb1486b6fcbee27efa9ec
2020-01-20 11:58:51 -06:00
Joshua Colp c67de25d6c Merge "queue_log: Add alembic script for generate db table for queue_log" into 16 2020-01-20 11:32:32 -06:00
Joshua Colp 5166088628 Merge "app_voicemail, say: Fix various leading whitespace problems" into 16 2020-01-20 09:32:36 -06:00
Friendly Automation f66885225a Merge "app_voicemail: Prevent crash when saving message with realtime voicemail" into 16 2020-01-20 09:20:49 -06:00
Rodrigo Ramírez Norambuena f49517efb9 queue_log: Add alembic script for generate db table for queue_log
Change-Id: I35b928a6251f9da9a1742b2cd14c63a00c3d0f0c
2020-01-20 09:16:39 -06:00
Joshua Colp 766342eedc Merge "pbx.c: Include filesystem cache in free memory calculation" into 16 2020-01-20 07:11:04 -06:00
Friendly Automation 23515dea5c Merge "app_voicemail: Set globals to default values when voicemail.conf missing" into 16 2020-01-17 08:37:51 -06:00
Joshua Colp 18b0e81b61 Merge "res_realtime: Fix 'realtime update2' argument handling" into 16 2020-01-17 08:36:34 -06:00
Sean Bright 13fa33588f app_voicemail, say: Fix various leading whitespace problems
In af90afd90c, Japanese language support
was added to app_voicemail and main/say.c, but the leading whitespace
is not consistent with Asterisk coding guidelines. This patch fixes
that.

Whitespace only, no functional change.

ASTERISK~23324
Reported by: Kevin McCoy

Change-Id: I72c725f5930084673749bd7c9cc426a987f08e87
2020-01-16 13:55:18 -06:00
Sean Bright f5a1e8b04d pbx.c: Include filesystem cache in free memory calculation
ASTERISK-28695 #close
Reported by: Kevin Flyn

Change-Id: Ief098bb6eb77378daeace8f97ba30701c8de55b8
2020-01-16 12:37:57 -06:00
Sean Bright 50d91ad707 pjproject_bundled: Allow brackets in via parameters
ASTERISK-26955 #close
Reported by: Peter Sokolov

Change-Id: Ib2803640905a77b65d0cee2d0ed2c7b310d470ac
2020-01-16 10:52:59 -05:00
Sean Bright 31027f33db chan_sip.c: Stop handling continuation lines after reading headers
lws2sws() does not stop trying to handle header continuation lines
even after all headers have been found. This is problematic if the
first character of a SIP message body is a space or tab character, so
we update to recognize the end of the message header.

ASTERISK-28693 #close
Reported by: Frank Matano

Change-Id: Idec8fa58545cd3fd898cbe0075d76c223f8d33df
2020-01-16 09:17:09 -06:00
Sean Bright 293600724d app_voicemail: Prevent crash when saving message with realtime voicemail
ast_store_realtime() is not NULL tolerant, so we need to initialize
the field values we pass to it to the empty string to avoid a crash.

ASTERISK-23739 #close
Reported by: Stas Kobzar

Change-Id: I756c5dd0299c77f4274368f7c99eb0464367466c
2020-01-15 15:52:11 -06:00
Joshua Colp c5fc1bf39f Merge "app_queue: Deprecate the QueueMemberPause.Reason field" into 16 2020-01-15 07:20:54 -06:00
Friendly Automation ddf8e6de79 Merge "res_pjsip_notify: Only allow a single Event header to be added to a NOTIFY" into 16 2020-01-15 06:42:53 -06:00
Sean Bright e379fe48e1 app_voicemail: Set globals to default values when voicemail.conf missing
If voicemail.conf exists but is empty, the config parsing process will
default a number of global variables to non-zero values. On the other
hand, if voicemail.conf is missing (arguably semantically equivalent
to an empty file), this process is skipped and the globals are
defaulted to 0.

Set the globals to the same values they would be set to if a
configuration were present. This allows voicemail configuration to be
done completely by Realtime without the need to create an empty
voicemail.conf file.

ASTERISK-27622 #close
Reported by: Jim Van Meggelen

Change-Id: Id907d280f310f12e542ca527e6a025432b9fb409
2020-01-14 16:31:26 -06:00
Sean Bright 5fded77e7f app_queue: Deprecate the QueueMemberPause.Reason field
The QueueMemberPause AMI event includes two fields that return the
reason a member was paused.

* In release branches, deprecate Reason in favor of PausedReason.
* In master, remove the Reason field entirely.

ASTERISK-28349 #close
Reported by: Niksa Baldun

Change-Id: I01da58f2b0ab927baeee754870f62b51b7b3d296
2020-01-14 13:51:33 -06:00
Joshua Colp 448124b17c Merge "res_pjsip_endpoint_identifier_ip: Document support for hostnames" into 16 2020-01-14 12:36:25 -06:00
Joshua Colp 874fff8dc0 Merge "func_curl: Add 'followlocation' option to CURLOPT()" into 16 2020-01-14 12:35:54 -06:00
Sean Bright fbe18165d5 res_realtime: Fix 'realtime update2' argument handling
The change in 9b99ef50b5 updated the
syntax of the 'realtime update2' CLI command but did not correctly
update the calls to ast_update2_realtime().

The issue this addresses was originally opened because we aren't
allowing a SQL NULL to be set as part of the update, but this is a
limitation of the Realtime API and is not a bug.

Additionally, this patch:

* Corrects the example in the command documentation to reflect
  'update2' instead of 'update.'

* Fixes the leading spacing of the command documentation.

* Checks that the required 'NULL' literal argument is present where we
  expect it to be.

ASTERISK-21794 #close
Reported by: Cédric Bassaget

Change-Id: Idda63a5dc50d5f9bcb34c27ea3238d90f733b2cd
2020-01-14 10:07:06 -06:00
Joshua Colp 6dc9239367 Merge "app_record: Do not hang up if beep audio is missing" into 16 2020-01-14 09:10:57 -06:00
Sean Bright f69da94fab func_curl: Add 'followlocation' option to CURLOPT()
We allow for 'maxredirs' to be set, but this value is ignored when
followlocation is not enabled which, by default, it is not.

ASTERISK-17491 #close
Reported by: candrews

Change-Id: I96a4ab0142f2fb7d2e96ff976f6cf7b2982c761a
2020-01-13 08:26:30 -06:00
Sean Bright 8d87fef5a1 res_pjsip_endpoint_identifier_ip: Document support for hostnames
ASTERISK-25429 #close
Reported by: Joshua C. Colp

Change-Id: I7cdfc6026821636acc2465094b7fcde8471a3824
2020-01-10 15:15:46 -06:00
Sean Bright 0a56edca4d res_pjsip_notify: Only allow a single Event header to be added to a NOTIFY
ASTERISK-27775 #close
Reported by: AvayaXAsterisk

Change-Id: Iad158e908e34675ad98f74d09c5e73024e50c257
2020-01-10 14:49:41 -06:00
Jaco Kroon b92b0469ff netsock2: ast_addressfamily_to_sockaddrsize and ast_sockaddr_from_sockaddr.
ast_addressfamily_to_sockaddrize will determine the size that's
required, and ast_sockaddr_from_sockaddr then wraps this new function
and ast_sockaddr_copy_sockaddr to copy arbitrary sockaddr's (without
knowing the address family) into the ast_sockaddr structure.

Change-Id: Iee604e96e9096c79b477d6e5ff310cf0b06dae86
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2020-01-10 01:57:35 -06:00
Friendly Automation 3746b1e09e Merge "res_pjsip_pubsub: Add ability to persist generator state information." into 16 2020-01-09 16:25:17 -06:00
Joshua Colp 521f534712 Merge "res_pjsip_endpoint_identifier_ip.c: Add port matching support" into 16 2020-01-09 15:08:19 -06:00
Joshua Colp 52f701fd01 Merge "app_agent_pool: Update XML docs for AgentLogin" into 16 2020-01-09 15:06:35 -06:00
Corey Farrell 0c07a7ee00 app_record: Do not hang up if beep audio is missing
Additionally alter the warning to mention that it was "beep" which could
not be streamed to give admins a better clue about what the warning
means.

ASTERISK-28682

Change-Id: If5aed21226a173117ed17589f44826dd1ba6576e
2020-01-09 05:32:32 -06:00
Kevin Harwell de078debab app_agent_pool: Update XML docs for AgentLogin
This patch fixes some wrongly formatted documentation for the AgentLogin
application. A couple of "see also" links should contain only the function
name, and no parameters.

Change-Id: I3f788b47dce3292e311f8a9856938d59a0bd0661
2020-01-08 14:01:50 -06:00
George Joseph 4cf32f2578 CI: Update buildAsterisk.sh to do a "make full"
If you do a "make all" when building Asterisk the xml documentation
produced will be missing certain AMI events where their
documentation is located not at the top of the c source file but
embedded further down next to the event's manager_event()
registration call.  See main/manager_mwi.c for an example.

"make full" does produce the correct documentation so we're changing
it in the build script.  A separate commit/issue will address the
problem with "make all".

ASTERISK-28507
Reported by: David Lee

Change-Id: I4a22635d6eef99eacecc0efb69e28360eebdb86c
2020-01-08 12:17:42 -06:00
Joshua Colp 324a6098e6 Merge "sig_pri: Fix deadlock caused by sig_pri_queue_hangup" into 16 2020-01-08 09:41:38 -06:00
Joshua C. Colp 8318b05f25 res_pjsip_pubsub: Add ability to persist generator state information.
Some body generators, such as dialog-info+xml, require storing state
information which is then conveyed in the NOTIFY request itself. Up
until now there was no way for such body generators to persist this
information.

Two new API calls have been added to allow body generators to set and
get persisted data. This data is persisted out alongside the normal
persistence information and allows the body generator to restore
state information or to simply use this for normal storage of state.
State is stored in the form of JSON and it is up to the body
generator to interpret this as needed.

The dialog-info+xml body generator has been updated to take advantage
of this to persist the version number.

ASTERISK-27759

Change-Id: I5fda56c624fd13c17b3c48e0319b77079e9e27de
2020-01-08 15:19:19 +00:00
Friendly Automation 932271939b Merge "stasis.c: Use correct topic name in stasis_topic_pool_delete_topic" into 16 2020-01-08 08:59:01 -06:00
Sean Bright f8b0c2c933 res_pjsip_endpoint_identifier_ip.c: Add port matching support
Adds source port matching support when IP matching is used:

  [example]
  type = identify
  match = 1.2.3.4:5060/32, 1.2.3.4:6000/32, asterisk.org:4444

If the IP matches but the source port does not, we reject and search for
alternatives. SRV lookups are still performed if enabled (srv_lookups = yes),
unless the configured FQDN includes a port number in which case just a host
lookup is performed.

ASTERISK-28639 #close
Reported by: Mitch Claborn

Change-Id: I256d5bd5d478b95f526e2f80ace31b690eebba92
2020-01-08 08:37:37 -06:00
Friendly Automation 7c227aa130 Merge "app_chanisavail.c: Simplify dialplan using ChanIsAvail." into 16 2020-01-07 13:58:25 -06:00
George Joseph 42eeb6bbe0 Merge "res_pjsip_config_wizard: Fix change detection for wizard settings" into 16 2020-01-07 13:04:35 -06:00
Friendly Automation 86585cbb64 Merge "features.c: Make Bridge application tolerate unspecified channel." into 16 2020-01-07 12:21:35 -06:00
Friendly Automation 077bb05528 Merge "app_dial.c: Simplify dialplan using Dial." into 16 2020-01-07 11:45:41 -06:00
Joshua Colp 5352022b2c Merge "app_softhangup.c: Reduce unnecessary warning to verbose message." into 16 2020-01-07 11:14:32 -06:00
Friendly Automation ab042335f5 Merge "app_page.c: Simplify dialplan using Page." into 16 2020-01-07 11:03:11 -06:00
George Joseph a71f32943c Merge "app_chanspy.c: Reduce log message level from notice to verbose." into 16 2020-01-07 10:38:16 -06:00
George Joseph fb7efe34a6 Merge "contrib/valgrind: Fix use of frame-level suppression" into 16 2020-01-07 09:59:36 -06:00
Friendly Automation 09fc6e24e3 Merge "websocket: Consider pending SSL data when waiting for socket input" into 16 2020-01-07 09:59:10 -06:00
George Joseph 64692a3c72 sig_pri: Fix deadlock caused by sig_pri_queue_hangup
The change to add setting hangupsource to sig_pri_queue_hangup()
made in https://gerrit.asterisk.org/c/asterisk/+/12857 casued
deadlocks when a hangup request was received from the core at the
same time a hanguprequest was received from the remote end via the
D channel.

Although the PRI's channel private structure was being unlocked
before setting the hangupsource, the PRI's own lock was still being
held during the process.  If channel actions were also coming from
the core, a deadlock on the PRI could result.  This deadlock could
then escalate to the entire DAHDI subsystem via DAHDI's global
interface list lock, especially if someone used the PRI CLI commands.

Fix:

* We now unlock the PRI as well as the PRI's channel private
  structure before setting the hangupsource, then relock both
  afterwards.

ASTERISK-28605
Reported by: Dirk Wendland

Change-Id: Id74aaa5d4e3746063dbe9deed188eb65193cb9c9
2020-01-07 06:19:49 -07:00
Richard Mudgett a7692ce2f4 app_chanisavail.c: Simplify dialplan using ChanIsAvail.
Dialplan has to be careful about passing an empty device list or empty
positions in the list.  As a result, dialplan has to check for these
conditions before using ChanIsAvail.  Simplify dialplan by making
ChanIsAvail handle these conditions gracefully.

* Made tolerate empty positions in the device list.

* Simplified the code and eliminated some unnecessary indention.

ASTERISK-28638

Change-Id: I9e4b67e2cbf26b2417c2d03485b8568e898931d3
2020-01-06 19:10:53 -06:00
George Joseph dd82ebecd3 stasis.c: Use correct topic name in stasis_topic_pool_delete_topic
When a topic is created for an object, its name is only
<object>:<uniqueid>
For example:
bridge:cb68b3a8-fce7-4738-8a17-d7847562f020

When a topic is added to a pool, its name has the pool's topic
name prepended.  For example:
bridge:all/bridge:cb68b3a8-fce7-4738-8a17-d7847562f020

The topic_pool_entry's name however, is only what was passed
in to stasis_topic_pool_get_topic which is
bridge:cb68b3a8-fce7-4738-8a17-d7847562f020
That's actually correct because the entry is qualified by the
pool that's in.

When you're ready to delete the entry from the pool, you retrieve
the tropic name from the object but since it now has the pool's
topic name prepended, it won't be found in the pool container.

Fix:

* Modified stasis_topic_pool_delete_topic() to skip past the
pool topic's name, if it was prepended to the topic name,
before searching the container for a pool entry.

ASTERISK-28633
Reported by: Joeran Vinzens

Change-Id: I4396aa69dd83e4ab84c5b91b39293cfdbcf483e6
2020-01-06 09:52:34 -06:00
Richard Mudgett 144b774b85 app_dial.c: Simplify dialplan using Dial.
Dialplan has to be careful about passing an empty destination list or
empty positions in the list.  As a result, dialplan has to check for
these conditions before using Dial.  Simplify dialplan by making Dial
handle these conditions gracefully.

* Made tolerate empty positions in the dialed device list.

* Reduced some message log levels from notice to verbose.

ASTERISK-28638

Change-Id: I6edc731aff451f8bdfaee5498078dd18c3a11ab9
2020-01-05 21:23:33 -06:00
Richard Mudgett 2780be334d app_page.c: Simplify dialplan using Page.
Dialplan has to be careful about passing an empty destination list or
empty positions in the list.  As a result, dialplan has to check for
these conditions before using Page.  Simplify dialplan by making Page
handle these conditions gracefully.

* Made tolerate empty positions in the paged device list.

* Reduced some warnings associated with the 's' option to verbose
messages.  The warning level for those messages really serves no purpose
as that is why the 's' option exists.

ASTERISK-28638

Change-Id: I95b64a6d6800cd1a25279c88889314ae60fc21e3
2020-01-05 21:20:38 -06:00
Richard Mudgett 11753d94d8 features.c: Make Bridge application tolerate unspecified channel.
The Bridge application was inconsistent if the channel to bridge with is
not specified.  If no parameters are given then a warning is issued and
the current channel is hung up.  If options are given but no channel is
specified then a warning is issued and the current channel is not hung up.

* Made the Bridge application give a verbose message instead of a warning
if the channel to bridge with is not specified and made not hang up the
current channel.  As a result dialplan no longer needs to check if a
channel name is passed before calling Bridge and simply needs to check the
BRIDGERESULT channel variable instead.  This is something you likely want
your dialplan to do anyway.

* Fixed up L() option warning message.  It is up to the caller to
determine if the channel is hung up because of the warning.  Dial() hangs
up the current channel while Bridge() does not.

Change-Id: I44349a8dc3912397f28852777de04f19e7bb9c73
2020-01-05 21:15:40 -06:00
Richard Mudgett 00e745066c app_chanspy.c: Reduce log message level from notice to verbose.
Change-Id: Ica5f38ccd8cdc077aef14d0c50425e0b29ac7e0a
2020-01-05 21:12:12 -06:00
Richard Mudgett 198f4cbdbf app_softhangup.c: Reduce unnecessary warning to verbose message.
Why log a warning for something your dialplan explicitly asked for?

Change-Id: I167b90daf4c7d75dd4b7ef94849f6cef05aa43a7
2020-01-05 21:05:33 -06:00
Sean Bright 992dcdf780 res_pjsip_config_wizard: Fix change detection for wizard settings
ast_sorcery_changeset_create() is not commutative and will fail to detect
differences between two variable lists depending on what changed, so switch to
ast_variable_lists_match().

ASTERISK-28492 #close
Reported by: Jean-Denis Girard

Change-Id: I7b3256983ddfaa2138d3de92a444a53b5193a4e1
2020-01-05 10:12:44 -06:00
Sean Bright 60fd1322d7 res_agi: Improve GET FULL VARIABLE documentation
ASTERISK-28673 #close
Reported by: Jonathan Harris

Change-Id: I591afdec669622bfa19243aabec31b579652c92f
2020-01-03 10:28:48 -06:00
Sean Bright 47ba42f4a0 websocket: Consider pending SSL data when waiting for socket input
When TLS is in use, checking the readiness of the underlying FD is insufficient
for determining if there is data available to be read. So before polling the
FD, check if there is any buffered data in the TLS layer and use that first.

ASTERISK-28562 #close
Reported by: Robert Sutton

Change-Id: I95fcb3e2004700d5cf8e5ee04943f0115b15e10d
2020-01-02 16:51:14 -05:00
Snuffy b9b50774f5 contrib/valgrind: Fix use of frame-level suppression
Fix use of frame-level wildcard usage in suppression file.

ASTERISK-27243 #close
Reported-by: Richard Kenner

Change-Id: I1c0c64c5f305d2c9aa124e11f1f64a2eec52dc51
2020-01-02 09:44:11 -06:00
Friendly Automation 3818759e9c Merge "func_odbc: acf_odbc_read() and cli_odbc_read() unicode support" into 16 2020-01-02 09:39:57 -06:00
Friendly Automation a992180091 Merge "res_fax: wrap v21 detected Asterisk initiated negotiation with config option" into 16 2020-01-02 08:41:28 -06:00
Boris P. Korzun e54299cd3e func_odbc: acf_odbc_read() and cli_odbc_read() unicode support
Added ast_odbc_ast_str_SQLGetData() considers SQL_DESC_OCTET_LENGTH
column attribute for correct allocating the buffer.

ASTERISK-28497 #close

Change-Id: I50e86c8a277996f13d4a4b9b318ece0d60b279bf
2020-01-02 08:28:49 -06:00
George Joseph 66ae6f7194 Merge "chan_sip: voice frames are no longer transmitted after emitting a COLP" into 16 2019-12-31 08:38:36 -06:00
Jean Aunis 82a870c8c7 chan_sip: voice frames are no longer transmitted after emitting a COLP
The SIP transaction state was reset when emitting an UPDATE or a re-INVITE
related to a COLP, preventing RTP packets to be emitted.

ASTERISK-28647

Change-Id: Ie7a30fa7a97f711e7ba6cc17f221a0993d48bd8b
2019-12-30 01:44:39 -06:00
Sean Bright efa13eb0a0 db: Initialize condition primitive before use
The db_init() function ultimately calls db_sync() which signals the
condition before it is initialized.

Change-Id: Id4a4e025b637bc4ac7d90557fcb71d56598892ab
2019-12-27 17:31:50 -06:00
George Joseph c6dc24fc8e Merge "config.c: Skip UTF-8 BOMs if present when reading config files" into 16 2019-12-27 13:12:30 -06:00
Joshua C. Colp 3e0a2485c4 Merge "app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR." into 16 2019-12-19 18:40:33 -06:00
Friendly Automation 2770830495 Merge "main/file.c: Limit media cache usage to remote files." into 16 2019-12-19 10:59:27 -06:00
Friendly Automation 7172230cd0 Merge "chan_sip: in case of tcp/tls, be less annoying about tx errors." into 16 2019-12-19 10:05:11 -06:00
Friendly Automation a3edac10a6 Merge "confbridge: Add support for specifying maximum sample rate." into 16 2019-12-19 10:00:25 -06:00
Sean Bright a78758d0a2 config.c: Skip UTF-8 BOMs if present when reading config files
ASTERISK-28667 #close

Change-Id: I4767ed365c98f3e1587b7653321048a31d8a53b2
2019-12-19 04:48:20 -06:00
George Joseph 4b658c82b9 Merge "res_rtp_asterisk: Add frame list cleanups to ast_rtp_read" into 16 2019-12-18 09:01:36 -06:00
Joshua C. Colp a55566b680 Merge "sip_to_pjsip.py: Fix trustrpid typo" into 16 2019-12-18 07:32:29 -06:00
Joshua C. Colp 82e2f0c662 Merge "configure: Add check for MySQL client bool and my_bool type usage." into 16 2019-12-18 06:37:29 -06:00
Friendly Automation d11534515b Merge "res_pjsip_session: Set stream state on created streams for incoming SDP." into 16 2019-12-18 05:42:46 -06:00
Pascal Cadotte Michaud b8e635916f
sip_to_pjsip.py: Fix trustrpid typo
ASTERISK-28664 #close

Change-Id: I6c28b1002fd7075ae0ed36f026f8c1855c9418a6
2019-12-17 13:18:09 -05:00
George Joseph b058e2b409 Merge "res_pjsip_nat: Restore original contact for REGISTER responses" into 16 2019-12-16 11:03:10 -06:00
Joshua C. Colp 7167fd6d46 configure: Add check for MySQL client bool and my_bool type usage.
Instead of trying to use the defined MySQL client version from the
header use a configure check to determine whether the bool or my_bool
type should be used for defining a boolean.

ASTERISK-28604

Change-Id: Id2225b3785115de074c50c123ff1a68005b4a9c7
2019-12-16 12:36:02 -04:00
Joshua C. Colp 5622df0a94 confbridge: Add support for specifying maximum sample rate.
ConfBridge has the ability to move between different sample
rates for mixing the conference bridge. Up until now there has
only been the ability to set the conference bridge to mix at
a specific sample rate, or to let it move between sample rates
as necessary. This change adds the ability to configure a
conference bridge with a maximum sample rate so it can move
between sample rates but only up to the configured maximum.

ASTERISK-28658

Change-Id: Idff80896ccfb8a58a816e4ce9ac4ebde785963ee
2019-12-16 15:54:05 +00:00
Friendly Automation 298dd7832b Merge "PJSIP_CONTACT: add missing argument documentation" into 16 2019-12-16 06:57:42 -06:00
Joshua Colp 8af35e7aa4 Merge "ACL: ast_apply_acl_nolog - identical to ast_apply_acl but without logging." into 16 2019-12-16 06:05:09 -06:00
Joshua C. Colp 186c4e9b36 res_pjsip_session: Set stream state on created streams for incoming SDP.
A previous review, 13174, made a change whereby on an incoming offer SDP
the pending topology was initialized to the configured. This caused a problem
for bundle with WebRTC where bundle could reference a stream that did not
actually exist if the configuration had both audio and video but the
offer SDP only contained audio.

This change undoes that review and instead fixes the original problem it
sought to solve by setting the state of created streams based on the
contents of the offer SDP. This way the stream state is not inactive
until negotiation later completes.

ASTERISK-28659

Change-Id: Ic5ae5a86437d3e686ac5afd91d133cc916198355
2019-12-16 07:23:33 -04:00
Kevin Harwell d17bbcb9f1 res_fax: wrap v21 detected Asterisk initiated negotiation with config option
A previous patch:

Gerrit Change-Id: I73bb24799bfe1a48adae9c034a2edbae54cc2a39

made it so a T.38 Gateway tries to negotiate with both sides by sending T.38
negotiation request to both endpoints supported T.38 versus the previous
behavior of forwarding negotiation to the "other" channel once a preamble
was detected.

This had the unfortunate side effect of breaking some setups. Specifically
ones that set the max datagram option on an endpoint configuration (configured
max datagram was not propagated since Asterisk now initiates negotiations).

This patch adds a configuration option, "negotiate_both", that when enabled
makes it so Asterisk initiates the negotiation requests to both endpoints vs.
the previous behavior of waiting, and forwarding the request.

The default is disabled keeping with the old behavior.

ASTERISK-28660

Change-Id: I5deb875f3485e20bc75119ec743090655d864a1a
2019-12-13 14:05:23 -06:00
Frederic LE FOLL aa06c6ea29 app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.
Temporary channel lifespan is very short and CDR deactivation request
through ast_cdr_set_property() may happen when CDR is not available
yet. Use CDR_PROP() dialplan function instead, it will first wait
for pending CDR insertion requests to be processed.

ASTERISK-28636

Change-Id: I1cbe09e8d2169c0962c1195133ff260d291f2074
2019-12-12 19:21:22 +01:00
Asterisk Development Team 9240fcd8bb Update CHANGES and UPGRADE.txt for 16.7.0 2019-12-12 06:03:22 -05:00
Jaco Kroon 77941efad9 ACL: ast_apply_acl_nolog - identical to ast_apply_acl but without logging.
Due to use in res_rtp_asterisk there is a need to be able to apply an
ACL without logging any invalid/denies.  It's probably sensible to at
least validate the ACL once directly after load and report invalid ACLs.

Change-Id: I256169229d945ca7c1bbf228fc492d91df345843
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2019-12-12 01:42:59 -06:00
Pascal Cadotte Michaud 2d2b28bfa4 PJSIP_CONTACT: add missing argument documentation
add missing argument "rtt" and "status" to the documentation

The change to the dtd file allow an enumlist to contain one or many
configOptionToEnum or enum.

This is different from the previous patch I submitted when you could have a
configOptionToEnum or (a configOptionToEnum followed by one or manu enums) or
(one or many enums)

ASTERISK-28626

Change-Id: Ia71743ee7ec813f40297b0ddefeee7909db63b6d
2019-12-11 11:16:08 -06:00
George Joseph 4631e77078 Merge "Revert "PJSIP_CONTACT: add missing argument documentation"" into 16 2019-12-11 10:35:59 -06:00
Joshua Colp 9c29c3fb3e Revert "PJSIP_CONTACT: add missing argument documentation"
This reverts commit 174e6426aa.

Reason for revert: Regression in XML validation.

validity error : Content model of enumlist is not determinist:
(configOptionToEnum | (configOptionToEnum , enum+) | enum+)

As we are preparing to do releases and this is not critical
I am reverting this for now until resolved.

Change-Id: I2c9656fb40b2d2f56f54caa35c8be02cc92babd0
2019-12-11 07:01:12 -06:00
George Joseph 8af0dea0c7 res_rtp_asterisk: Add frame list cleanups to ast_rtp_read
In Asterisk 16+, there are a few places in ast_rtp_read where we've
allocated a frame list but return a null frame instead of the list.
In these cases, any frames left in the list won't be freed.  In the
vast majority of the cases, the list is empty when we return so
there's nothing to free but there have been leaks reported in the
wild that can be traced back to frames left in the list before
returning.

The escape paths now all have logic to free frames left in the
list.

ASTERISK-28609
Reported by: Ted G

Change-Id: Ia1d7075857ebd26b47183c44b1aebb0d8f985f7a
2019-12-10 11:48:35 -07:00
Friendly Automation 59799b10bf Merge "res_pjsip_registrar.c: Prevent potential double free if AOR is not found" into 16 2019-12-09 10:28:31 -06:00
Joshua Colp 585e5288c8 Merge "app_queue: Fix old confusing comment about when the members are called" into 16 2019-12-09 05:43:23 -06:00
Jaco Kroon 055737d645 chan_sip: in case of tcp/tls, be less annoying about tx errors.
chan_sip.c:3782 __sip_xmit: sip_xmit of 0x7f1478069230 (len 600) to
213.150.203.60:1492 returned -2: Interrupted system call

returned -2 implies this wasn't actually an OS error, so errno makes no
sense either.  Internal error was already logged higher up, and -2
generally means that either there isn't a valid connection available, or
the pipe notification failed, and that is already correctly logged.

ASTERISK-28651 #close

Change-Id: I46eb82924beeff9dfd86fa6c7eb87d2651b950f2
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
2019-12-07 13:58:32 +02:00
George Joseph 63b8664bfa res_pjsip_nat: Restore original contact for REGISTER responses
RFC3261 Section 10 "Registrations", specifically paragraph
"10.2.4: Refreshing Bindings", states that a user agent compares
each contact address (in a 200 REGISTER response) to see if it
created the contact.  If the Asterisk endpoint has the
rewrite_contact option set however, the contact host and port sent
back in the 200 response will be the rewritten one and not the
one sent by the user agent.  This prevents the user agent from
matching its own contact.  Some user agents get very upset when
this happens and will not consider the registration successful.
While this is rare, it is acceptable behavior especially if more
than 1 user agent is allowed to register to a single endpoint/aor.

This commit updates res_pjsip_nat (where rewrite_contact is
implemented) to store the original incoming Contact header in
a new "x-ast-orig-host" URI parameter before rewriting it, and to
restore the original host and port to the Contact headers in the
outgoing response.

This is only done if the request is a REGISTER and rewrite_contact
is enabled.

pjsip_message_filter was also updated to ensure that if a request
comes in with any existing x-ast-* URI parameters, we remove them
so they don't conflict.  Asterisk will never send a request
with those headers in it but someone might just decide to add them
to a request they craft and send to Asterisk.

NOTE: If a device changes its contact address and registers again,
it's a NEW registration.  If the device didn't unregister the
original registration then all existing behavior based
on aor/remove_existing and aor/max_contacts apply.

ASTERISK-28502
Reported-by: Ross Beer

Change-Id: Idc263ad2d2d7bd8faa047e5804d96a5fe1cd282e
2019-12-06 12:47:42 -06:00
George Joseph 7f2bbff48c Merge "channel.c: Resolve issue with receiving SIP INFO packets for DTMF" into 16 2019-12-06 12:40:42 -06:00
Friendly Automation 439d42a594 Merge "res_pjsip_outbound_registration: add support for SRV failover" into 16 2019-12-06 09:20:15 -06:00
Friendly Automation c1176286a2 Merge "res_pjsip_registrar.c: Prevent possible buffer overflow with domain aliases" into 16 2019-12-06 08:55:24 -06:00
Joshua Colp 440ffa4b3d Merge "chan_sip+native_bridge_rtp: no directmedia for ptime other than default ptime." into 16 2019-12-05 07:53:41 -06:00
Friendly Automation 7620d1256c Merge "PJSIP_CONTACT: add missing argument documentation" into 16 2019-12-04 18:33:36 -06:00
Kevin Harwell 1ea4f0e7c5 Merge "res_pjsip_session.c: Prevent use-after-free with TEST_FRAMEWORK enabled" into 16 2019-12-04 18:02:50 -06:00
Kevin Harwell 7f843116d3 Merge "parking: Fall back to parker channel name even if it matches parkee." into 16 2019-12-04 17:34:46 -06:00
Sean Bright 68ce999351 res_pjsip_registrar.c: Prevent potential double free if AOR is not found
The simple fix here is simply to NULL out username and password after we call
ast_free on them. Unfortunately, I noticed that we weren't checking for
allocation failures for username and password, and adding those checks made
things noisy and cumbersome.

So instead we partially rollback the recent LGTM patch, and move the alloca
calls into find_aor_name().

ASTERISK-28641 #close
Reported by: Ross Beer

Change-Id: Ic9d01624e717a020be0b0aee31f0814e7f1ffbe2
2019-12-04 16:18:24 -06:00
Sean Bright 5c20cc4c3a res_pjsip_registrar.c: Prevent possible buffer overflow with domain aliases
We're appropriately sizing the id_domain_alias buffer, but then copying the data
into the id_domain one. We were then using the uninitialized id_domain_alias
buffer we just allocated.

This is ASTERISK~28641 adjacent, but significant enough to warrant its own
patch.

Change-Id: I81c38724d18deab8c6573153e2b99dbb6e2f33d9
2019-12-04 16:15:09 -06:00
Walter Doekes 161e762742 app_queue: Fix old confusing comment about when the members are called
ASTERISK-28644

Change-Id: I2771a931d00a8fc2b9f9a4d1a33ea8f1ad24e06b
2019-12-04 11:38:40 -06:00
Sean Bright fbc80db350 res_pjsip_session.c: Prevent use-after-free with TEST_FRAMEWORK enabled
We need to copy the endpoint name before we call ao2_cleanup() on it,
otherwise we might try to access memory that has been reclaimed.

ASTERISK-28445 #close
Reported by: Bernhard Schmidt

Change-Id: I404b952608aa606e0babd3c4108346721fb726b3
2019-12-03 16:42:03 -05:00
George Joseph dd07ac6a3a Merge "media_cache.c: Various CLI improvements" into 16 2019-12-02 16:02:13 -06:00
George Joseph 43d4c0e3c9 channel.c: Resolve issue with receiving SIP INFO packets for DTMF
The problem is essentially the same as in ASTERISK~28245. Besides
the direct media scenario we have an additional scenario where a
special client is involved. This device mutes audio by default in
transmit direction (no rtp frames) and activates audio only by a
foot switch. In this situation dtmf input (pin for conferences,
transfer features codes , etc) using SIP INFO mode is not
understood properly especially when SIP INFO messages are sent
quickly.

This patch ensures that SIP INFO frames are properly queued and
processed in the above scenario. The patch also corrects situations
where successive dtmf events are received quicker than the
signalled event duration (plus minimum gap/pause) allows, i.e. DTMF
events have to be buffered in the ast channel read queue and
emulation has to be processed asynchronously at slower speed.

Reported by: Thomas Arimont
patches:
  trigger_dtmf_emulation.patch submitted by Thomas Arimont (license 5525)

Change-Id: I309bf61dd065c9978c8e48f5b9a936ab47de64c2
2019-12-02 08:39:26 -06:00
George Joseph 80199cd67f CI: Turn off shallow cloning altogether
Change-Id: I73ed4aef33a92f20080128aafc34e19fd4457196
2019-12-02 07:53:36 -05:00
Joshua Colp 328a6b2381 Merge "res_pjsip_t38: T.38 error correction mode selection at 200 ok received" into 16 2019-12-02 06:41:18 -06:00
Frederic LE FOLL 31173f6586 chan_sip+native_bridge_rtp: no directmedia for ptime other than default ptime.
During capabilities selection (joint capabilities of us and peer,
configured capability for this peer, or general configured
capabilities), if sip_new() does not keep framing information,
then directmedia activation will fail for any framing different
from default framing.

ASTERISK-28637

Change-Id: I99257502788653c2816fc991cac7946453082466
2019-11-27 19:16:59 +01:00
Joshua Colp c91b28c72d parking: Fall back to parker channel name even if it matches parkee.
ASTERISK-28631

Change-Id: Ia74d084799fbb9bee3403e30d2391aacd46243cc
2019-11-25 07:57:12 -05:00
Sean Bright bd3cb1b300 media_cache.c: Various CLI improvements
* Use ast_cli_completion_add() to improve performance when large number of
  cached items are present.

* Only complete one URI for commands that only accept a single URI.

* Change command documentation to wrap at 80 characters to improve
  readability.

Change-Id: Iedb0a2c3541e49561bc231dca2dcc0ebd8612902
2019-11-22 16:38:12 -05:00
Asterisk Development Team 9eb86a8110 Update CHANGES and UPGRADE.txt for 16.6.2 2019-11-21 16:11:21 -05:00
Salah Ahmed efef44985d res_pjsip_t38: T.38 error correction mode selection at 200 ok received
if asterisk offer T38 SDP with none error correction scheme and
the endpoint respond with redundancy EC scheme, asterisk switch
to that mode. Since we configure the endpoint as none EC mode
we should not switch to any other mode except none.
following logic implemented in code.

1. If asterisk offer none, and anything except none in answer
   will be ignored.
2. If asterisk offer fec, answer with fec, redundancy and none will
   be accepted.
3. If asterisk offer redundancy, answer with redundancy and none
   will be accepted.

ASTERISK-28621

Change-Id: I343c62253ea4c8b7ee17abbfb377a4d484a14b19
2019-11-21 16:09:40 -05:00
Friendly Automation 5802e32d47 Merge "chan_sip.c: Prevent address change on unauthenticated SIP request." into 16 2019-11-21 13:36:30 -06:00
Kevin Reeves e013f502b1 main/file.c: Limit media cache usage to remote files.
When testing for the existance of a file, the media cache is searched even if
the file has no chance of being in it.  This can cause performance issues
as the media cache size increases.

As a result, calls to applications like Read and Playback using local files
must scan through the media cache before playing.  Under load and with a
large cache, this can delay the playback of those files.

This patch updates the function that checks for the existance of a file to
only consult the media cache database if the requested file is a remote path.
It introduces a new is_remote_path() function in main/file.c.

ASTERISK-28625  #close
Reported-by: kevin@phoneburner.com

Change-Id: If91137493732d9034dafa381c081c69274a7dcc9
2019-11-21 12:48:42 -06:00
Ben Ford 8cdaa93e65 chan_sip.c: Prevent address change on unauthenticated SIP request.
If the name of a peer is known and a SIP request is sent using that
peer's name, the address of the peer will change even if the request
fails the authentication challenge. This means that an endpoint can
be altered and even rendered unusuable, even if it was in a working
state previously. This can only occur when the nat option is set to the
default, or auto_force_rport.

This change checks the result of authentication first to ensure it is
successful before setting the address and the nat option.

ASTERISK-28589 #close

Change-Id: I581c5ed1da60ca89f590bd70872de2b660de02df
2019-11-21 09:46:05 -06:00
George Joseph 7574be5110 manager.c: Prevent the Originate action from running the Originate app
If an AMI user without the "system" authorization calls the
Originate AMI command with the Originate application,
the second Originate could run the "System" command.

Action: Originate
Channel: Local/1111
Application: Originate
Data: Local/2222,app,System,touch /tmp/owned

If the "system" authorization isn't set, we now block the
Originate app as well as the System, Exec, etc. apps.

ASTERISK-28580
Reported by: Eliel Sardañons

Change-Id: Ic4c9dedc34c426f03c8c14fce334a71386d8a5fa
2019-11-21 09:40:41 -06:00
George Joseph a1eb0d7355 Merge "chan_dahdi: PRI span status may stay "Down, Active" after a short alarm" into 16 2019-11-21 09:22:01 -06:00
Friendly Automation 17f52679b2 Merge "app_senddtmf: Add receive mode to AMI Action PlayDTMF" into 16 2019-11-21 08:34:24 -06:00
Pascal Cadotte Michaud 174e6426aa
PJSIP_CONTACT: add missing argument documentation
add missing argument "rtt" and "status" to the documentation

ASTERISK-28626
Change-Id: I8419e4c8203e411b87d93dc395acdbcf7526dedf
2019-11-21 08:59:50 -05:00
Kevin Harwell f8e4473e16 Merge "func_curl.c: Support custom http headers" into 16 2019-11-20 16:17:33 -06:00
Kevin Harwell 3cd57aaff2 res_pjsip_outbound_registration: add support for SRV failover
ASTERISK-28624

Change-Id: I8da7c300dd985ab7b10dbd5194aff2f737808561
2019-11-20 12:56:08 -06:00
Friendly Automation 337d735ab8 Merge "app_amd: Fixed timeout issue" into 16 2019-11-20 09:58:58 -06:00
Friendly Automation a78bc75714 Merge "res_pjsip_registrar: Fix uninitlized variable warning" into 16 2019-11-20 08:06:52 -06:00
George Joseph d075d8913b CI: Fix missing script block in jenkinsfiles
Change-Id: I9f44a3d5085ea7880fad1a3883a4820907e29ea3
(cherry picked from commit 95213b01d2)
2019-11-19 13:13:07 -05:00
George Joseph ce8a23fdf9 CI: Fix missing script block in jenkinsfiles
Change-Id: Ib4b6e4887695f230ea7a5b0c879b29fc5a13be4f
(cherry picked from commit d60f23ecbd)
2019-11-19 13:03:31 -05:00
George Joseph e649d6f33d Merge "CI: Increase clone depth and do better cleanup" into 16 2019-11-19 11:16:33 -06:00
George Joseph 919bc0c7be CI: Increase clone depth and do better cleanup
The original clone depth of 10 was causing the need to rebase
changes whose parent was older than the 10 commits.  The clone
depth has been increased to 100.

Workspace cleanup was only happening for successful builds which
wasn't enough to keep the 8G workspace in-memory drives on the
docker slaves from filling up.  Now the workspaces are cleaned up
after every build regardless of success/failure.  If you need to
preserve builds temporarily, you can log into Jenkins/Manage
Jenkins/Configure System and change the CLEANUP_WS_* environment
variable for the job type you're troubleshooting to "FALSE".

Change-Id: I0d7366e87cea714e5dbc9488caf718802fce75ca
2019-11-19 11:58:18 -05:00
Friendly Automation b7c0711c5c Merge "serializer: set high/low alert levels on whole pool" into 16 2019-11-19 10:14:20 -06:00
Sean Bright 61a3e7e79b res_pjsip_registrar: Fix uninitlized variable warning
Fixes: error: ‘domain_name’ may be used uninitialized in this function

Found with gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008

Change-Id: I44413b49ea1205aa25538142161deb73883c79e8
2019-11-19 10:32:49 -05:00
George Joseph 46cc0a3660 Merge "parking: Fix case where we can't get the parker." into 16 2019-11-19 09:23:42 -06:00
Michael Cargile cf5b7f3a0b app_amd: Fixed timeout issue
ASTERISK_28143 attempted to fix an issue where calls with no audio would never
timeout. It did so by adding AST_FRAME_NULL as a frame type to process in its
calculations. Unfortunately these frames seem to show up at irregular time
intervals. This resulted in app_amd returning prematurely most of the time.

* Removed AST_FRAME_NULL from the calculations
* Added a check to see how much time has actually passed since app_amd began

ASTERISK-28608

Change-Id: I642a21b02d389b17e40ccd5357754b034c3daa42
2019-11-19 09:58:08 -05:00
Frederic LE FOLL faf353e931 chan_dahdi: PRI span status may stay "Down, Active" after a short alarm
Upon a short PRI disconnection, libpri may maintain Q.921 layer 'up' and
may thus not send PRI_EVENT_DCHAN_DOWN / PRI_EVENT_DCHAN_UP events.
If pri_event_alarm() clears DCHAN_UP status bit upon alarm detection
and no Q.921 reconnection sequence occurs, chan_dahdi will keep
seeing span status "Down" at the end of alarm.

This patch modifies pri_event_alarm() in order to keep DCHAN_UP bit
unchanged. libpri will send a PRI_EVENT_DCHAN_DOWN event if it detects
a disconnection of Q.921 layer and this will clear DCHAN_UP if required.

ASTERISK-28615

Change-Id: Ibe27df4971fd4c82cc6850020bce4a8b2692c996
2019-11-19 02:17:20 -05:00
George Joseph eb8f255d44 Merge "func_env: Prevent FILE() from reading garbage at end-of-file" into 16 2019-11-18 13:03:25 -06:00
George Joseph 921ad6b7c8 Merge "res_rtp_asterisk: Always return provided DTLS packet length." into 16 2019-11-18 13:02:45 -06:00
George Joseph 9f9b3d8af0 Merge "bridge_softmix: clear hold when joining a softmix bridge" into 16 2019-11-18 11:49:10 -06:00
lvl 8894a56452 app_senddtmf: Add receive mode to AMI Action PlayDTMF
ASTERISK-28614

Change-Id: I183501297ae1dc294ae56b34acac9b0343eb2664
2019-11-18 09:33:59 -06:00
Joshua Colp eb54e381fd res_rtp_asterisk: Always return provided DTLS packet length.
OpenSSL can not tolerate if the packet sent out does not
match the length that it provided to the sender. This change
lies and says that each time the full packet was sent. If
a problem does occur then a retransmission will occur as
appropriate.

ASTERISK-28576

Change-Id: Id42455b15c9dc4eb987c8c023ece6fbf3c22a449
2019-11-18 08:34:05 -06:00
Sean Bright e39ddb1cb1 func_env: Prevent FILE() from reading garbage at end-of-file
If the last line of a file does not have a terminating EOL sequence, we
potentially add garbage to the value returned from the FILE() function.

There is no overflow potential here as we are reading from a buffer of a
known size, we are just reading too much of it.

ASTERISK-26481 #close

Change-Id: I50dd4fcf416fb3c83150040a1a79a59d9eb1ae01
2019-11-18 08:32:27 -06:00
Kevin Harwell 3891a953cf bridge_softmix: clear hold when joining a softmix bridge
MOH continues to play to a channel if that channel was on hold prior to
entering a softmix bridge. MOH will not stop even if the original "holder"
attempts an unhold.

For the most part a softmix bridge ignores holds, so a participating channel
shouldn't join while on hold. This patch checks to see if the channel joining
the softmix bridge is currently on hold. If so then it indicates an unhold.

ASTERISK-28618

Change-Id: I66ccd4efc80f5b4c3dd68186b379eb442916392b
2019-11-18 08:31:02 -06:00
Kevin Harwell 30c0af7257 various files - fix some alerts raised by lgtm code analysis
This patch fixes several issues reported by the lgtm code analysis tool:

https://lgtm.com/projects/g/asterisk/asterisk

Not all reported issues were addressed in this patch. This patch mostly fixes
confirmed reported errors, potential problematic code points, and a few other
"low hanging" warnings or recommendations found in core supported modules.
These include, but are not limited to the following:

* innapropriate stack allocation in loops
* buffer overflows
* variable declaration "hiding" another variable declaration
* comparisons results that are always the same
* ambiguously signed bit-field members
* missing header guards

Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
2019-11-18 08:30:05 -06:00
Martin Tomec 37dcdd485a func_curl.c: Support custom http headers
When user wants to send json data, the default Content-Type header
is incorect (application/x-www-form-urlencoded). This patch allows
to set any custom headers so the Content-Type header can be
overriden. User can set multiple headers by multiple calls of
curlopt(). This approach is not consistent with other parameters,
but is more readable in dialplan than one call with multiple
headers.

ASTERISK-28613

Change-Id: I4dd68c3f4e25362ef941d73a3861f58348dcfbf9
2019-11-18 05:54:06 -06:00
Joshua Colp b9bbf39449 parking: Fix case where we can't get the parker.
ASTERISK-28616

Change-Id: Iabe31ae38d01604284fcc5c2438d44e29a32ea4d
2019-11-15 05:46:53 -05:00
Joshua Colp e7320bbbf0 parking: Use channel snapshot instead of channel.
There exists a scenario where a thread can hold a lock on the
channels container while trying to lock a bridge. At the same
time another thread can hold the lock for said bridge while
attempting to retrieve a channel. This causes a deadlock.

This change fixes this scenario by retrieving a channel snapshot
instead of a channel, as information present in the snapshot
is all that is needed.

ASTERISK-28616

Change-Id: I68ceb1d62c7378addcd286e21be08a660a7cecf2
2019-11-14 17:19:57 -06:00
Friendly Automation e3959a2fe1 Merge "stasis: Don't hold app_registry and session locks unnecessarily" into 16 2019-11-14 11:13:31 -06:00
Kevin Harwell 6f0a69c51a res_pjsip_session: initialize pending's topology to endpoint's
Found during some testing, there is a race condition between selecting an
appropriate bridge type for a call versus the applying of media on the callee's
session. In some instances a native bridge type would have been chosen, but
due to the callee's media not yet being established at bridge compatibility
check time the simple bridge type is picked instead.

When using chan_pjsip this initiates a topology change event. The topologies
are then compared for the two sessions. However, when the topology was created
for the caller its streams are initialized to "inactive". This topology is then
used as a base when creating the callee's topology, and streams. Soon after
the caller's topology's stream(s) get updated based on the sdp (get set to
sendrecv in the failing scenario).

Now when the topology change event is raised, and the two topologies are
compared, the comparison fails due to a stream state mismatch (sendrecv vs
inactive). And since they differ a reinvite is sent out (to the caller in
this case).

This patch makes it such that when the caller's topology is initially created
it gets created based on its configured endpoint's media topology. When the
endpoint's topology is created its stream's state(s) are initialized to
sendrecv instead of inactive. Subsequently, now when the callee's topology is
created its topology streams are now initialized to sendrecv. Thus when the
topology change event occurs due to the mentioned scenario the stream states
match for the given sessions, and the reinvite is not sent unless due to some
other valid mismatch.

Note, this patch only changes one pending media state's creation point. It's
possible other places *could* be changed, however for now it was deemed best
to only alter what's here.

Change-Id: I6ba3a6a75f64824a1b963044c37acbe951c389c7
2019-11-12 12:36:37 -06:00
George Joseph 40c49ec64f stasis: Don't hold app_registry and session locks unnecessarily
resource_events:stasis_app_message_handler() was locking the session,
then attempting to determine if the app had debug enabled which
locked the app_registry container.  res_stasis:__stasis_app_register
was locking the app_registry container then calling app_update
which caused app_handler (which locks the session) to run.
The result was a deadlock.

* Updated resource_events:stasis_app_message_handler() to determine
  if debug was set (which locks the app_registry) before obtaining the
  session lock.

* Updated res_stasis:__stasis_app_register to release the app_registry
  container lock before calling app_update (which locks the sesison).

ASTERISK-28423
Reported by Ross Beer

Change-Id: I58c69d08cb372852a63933608e4d6c3e456247b4
2019-11-10 17:42:16 -07:00
Alexei Gradinari 6be18dfb72 serializer: set high/low alert levels on whole pool
The current code sets alert levels starting from index 1.
Need to set on whole pool starting from index 0.

Change-Id: I5decbb43160954fb9a512f04302637fc666b6f5d
2019-11-07 12:01:47 -05:00
George Joseph be4c6f3f35 cdr_mysql: Fix missing use of 'my_bool' with MySql >= 8.0.1
MySql 8.0.1 replaced the "my_bool" type with "bool" so an #if
was added to use "bool" with MYSQL_VERSION_ID >= 80001.

ASTERISK-28604

Change-Id: I66a28d8f0011e33774edee13a6f8efd2302bb920
2019-11-07 07:31:08 -06:00
Joshua Colp 95bc698b85 res_pjsip_outbound_registration: Extend documentation for "max_retries".
If the "max_retries" option is set to 0 then upon failure no
further attemps are made, so explicitly document the behavior.

ASTERISK-28602

Change-Id: I1e30daae9dd6c49ce18744164214d3def505acbf
2019-10-31 11:54:47 -05:00
Joshua Colp 80a28170b5 Merge "res_calendar: Resolve memory leak on calendar destruction" into 16 2019-10-29 10:24:27 -05:00
Sean Bright ccaf735d1f res_calendar: Resolve memory leak on calendar destruction
Calling ne_uri_parse allocates memory that needs to be freed with a
corresponding call to ne_uri_free.

ASTERISK-28572 #close

Change-Id: I8a6834da27000a6807d89cb7a157b2a88fcb5e61
2019-10-24 09:18:19 -05:00
Joshua Colp 6e22e1213e res_ari_events: Add module reference when a WebSocket is open.
This change ensures that the module isn't unloaded when a
WebSocket is open. Previously it was possible to unload the
module manually or during shutdown which could cause a crash
when any active WebSockets were terminated.

ASTERISK-28585

Change-Id: I85c71ab112f99875b586419a34c08c8b34c14c5c
2019-10-24 05:26:27 -05:00
George Joseph ea8d8e9a13 Merge "ExternalMedia: Change return object from ExternalMedia to Channel" into 16 2019-10-21 13:53:25 -05:00
Kevin Harwell c6b78a06cb Merge "utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN" into 16 2019-10-21 13:51:28 -05:00
Joshua Colp eacadc4dc5 Merge "app_voicemail.c: Support multiple file formats for forwarded messages." into 16 2019-10-21 10:32:05 -05:00
Friendly Automation fcead9c802 Merge "Crash during "pjsip show channelstats" execution" into 16 2019-10-21 07:19:23 -05:00
Sean Bright e627db7928 utils.h: Set lower bound for thread stack size to PTHREAD_STACK_MIN
ASTERISK-28590 #close

Change-Id: I51abce00c04d0a06550bda5205580705185b9c1c
2019-10-18 14:52:53 -04:00
Joshua Colp c0b699e556 Merge "README-SERIOUSLY.bestpractices.md: Speling correetions." into 16 2019-10-18 09:37:33 -05:00
George Joseph bfd0e05e59 ExternalMedia: Change return object from ExternalMedia to Channel
When we created the External Media addition to ARI we created an
ExternalMedia object to be returned from the channels/externalMedia
REST endpoint.  This object contained the channel object that was
created plus local_address and local_port attributes (which are
also in the Channel variables).  At the time, we thought that
creating an ExternalMedia object would give us more flexibility
in the future but as we created the sample speech to text
application, we discovered that it doesn't work so well with ARI
client libraries that a) don't have the ExternalMedia object
defined and/or b) can't promote the embedded channel structure
to a first-class Channel object.

This change causes the channels/externalMedia REST endpoint to
return a Channel object (like channels/create and channels/originate)
instead of the ExternalMedia object.

Change-Id: If280094debd35102cf21e0a31a5e0846fec14af9
2019-10-18 07:03:07 -06:00
Salah Ahmed c73aaa2760 Crash during "pjsip show channelstats" execution
During execution "pjsip show channelstats" cli command by an
external module asterisk crashed. It seems this is a separate
thread running to fetch and print rtp stats. The crash happened on
the ao2_lock method, just before it going to read the rtp stats on
a rtp instance. According to gdb backtrace log, it seems the
session media was already cleaned up at that moment.

ASTERISK-28578

Change-Id: Ib7c7f39996d942984394782296bb99aae67862e5
2019-10-18 10:21:32 +02:00
Joshua Colp ef2eb064b2 res_rtp_asterisk: Remove a log message that slipped in.
This was only supposed to be for testing, so now it can be
removed.

Change-Id: I3dfc2e776e70b3196aeed5688372ea80c0214b59
2019-10-17 07:50:28 -03:00
Sean Bright 2666a5e111 README-SERIOUSLY.bestpractices.md: Speling correetions.
ASTERISK-28586 #close

Change-Id: I43dc4e8bd9dc685b17695b215a5360314074734f
2019-10-16 16:07:07 -05:00
Joshua Colp 1659d56a7f Merge "test_res_rtp: Enable FIR and REMB nominal tests." into 16 2019-10-16 07:50:24 -05:00
cmaj b41a8fd0f3 app_voicemail.c: Support multiple file formats for forwarded messages.
If you specify multiple formats in voicemail.conf, eg. "format = gsm|wav"
and are using realtime ODBC backend, only the first format gets stored
in the database. So when you forward a message later on, there is a bug
generating the email, related to the stored format (GSM) being different
than the desired email format (WAV) specified for the user. Sox can
handle this, but Asterisk needs to tell sox exactly what to do.

ASTERISK-22192

Change-Id: I7321e7f7e7c58adbf41dd4fd7191c887b9b2eafd
2019-10-14 17:19:45 -05:00
George Joseph a339c3fdc5 Merge "res_pjsip_mwi: potential double unref, and potential unwanted double link" into 16 2019-10-14 13:32:57 -05:00
Friendly Automation e7e03e0e2e Merge "pbx: deadlock when outgoing dialed channel hangs up too quickly" into 16 2019-10-14 06:49:46 -05:00
Joshua Colp ed12715cbe test_res_rtp: Enable FIR and REMB nominal tests.
Now that both FIR and REMB are being sent in compound packets
these tests can be enabled.

This also extends the REMB nominal test to cover the REMB
contents itself.

Change-Id: Ibfee526ad780eefcce5dd787f53785382210024a
2019-10-14 11:42:13 +00:00
Friendly Automation 7895389a57 Merge "cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12" into 16 2019-10-14 06:29:13 -05:00
Christoph Moench-Tegeder 6c54bd704e cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12
PostgreSQL 12 finally removed column adsrc from table pg_catalog.pg_attrdef
(column default values), which has been deprecated since version 8.0.
Since then, the official/correct/supported way to retrieve the column
default value from the catalog is function pg_catalog.pg_get_expr().

This change breaks compatibility with pre-8.0 PostgreSQL servers,
but has reached end-of-support more than a decade ago.
cdr_pgsql and res_config_pgsql still have support for pre-7.3
servers, but cleaning that up is perhaps a topic for a major release,
not this bugfix.

ASTERISK-28571

Change-Id: I834cb3addf1937e19e87ede140bdd16cea531ebe
2019-10-14 05:07:15 -05:00
Friendly Automation d04ed09e57 Merge "pjproject_bundled: Replace earlier reverts with official fixes." into 16 2019-10-11 09:30:26 -05:00
George Joseph ab8835b8b7 Merge "test_taskprocessor.c: Fix test failure on Ubuntu" into 16 2019-10-11 08:42:53 -05:00
Kevin Harwell 17e71b6abe res_pjsip_mwi: potential double unref, and potential unwanted double link
When creating an unsolicited MWI aggregate subscription it was possible for
the subscription object to be double unref'ed. This patch removes the explicit
unref as it is not needed since the RAII_VAR will handle it at function end.

Less concerning there was also a bug that could potentially allow the aggregate
subscription object to be added to the unsolicited container twice. This patch
ensures it is added only once.

ASTERISK-28575

Change-Id: I9ccfdb5ea788bc0c3618db183aae235e53c12763
2019-10-10 15:30:05 -05:00
csavinovich 867c8b2879 test_taskprocessor.c: Fix test failure on Ubuntu
Fixes a failure in /main/taskprocesor unit test, only occurring in Ubuntu.
Newer versions of GCC require variable initialization.

Change-Id: I2994d8aab9307a8c2c7330584f287a27144a580c
2019-10-10 15:21:30 -05:00
Friendly Automation 6b8423821f Merge "Revert "app_voicemail: Cleanup stale lock files on module load"" into 16 2019-10-10 10:06:45 -05:00
George Joseph 7f0fc630ae Merge changes from topic "pjsip_shutdown" into 16
* changes:
  res_pjsip_mwi: use an ao2_global object for mwi containers
  res_pjsip/res_pjsip_mwi: use centralized serializer pools
2019-10-10 09:14:25 -05:00
George Joseph 4e44ffc623 Merge "serializer: move/add asterisk serializer pool functionality" into 16 2019-10-10 09:10:09 -05:00
Friendly Automation 983bebb680 Merge "chan_pjsip: Prevent segfault when running PlayDTMF on hungup channel" into 16 2019-10-10 07:26:20 -05:00
George Joseph cb6e0d36ae pjproject_bundled: Replace earlier reverts with official fixes.
Issues in pjproject 2.9 caused us to revert some of their changes
as a work around.  This introduced another issue where pjproject
wouldn't build with older gcc versions such as that found on
CentOS 6.  This commit replaces the reverts with the official
fixes for the original issues and allows pjproject to be built
on CentOS 6 again.

ASTERISK-28574
Reported-by: Niklas Larsson

Change-Id: I06f8507bea553d1a01b0b8874197d35b9d47ec4c
2019-10-10 06:43:00 -05:00
Kevin Harwell a66848c92f pbx: deadlock when outgoing dialed channel hangs up too quickly
Here's the basic scenario that occurred when executing an AMI fast originate
while at the same time something else locks the channels container, and also
wants a lock on the dialed channel:

1. pbx_outgoing_attempt obtains a lock on a dialed channel
2. concurrently another thread obtains a lock on the channels container, and
   subsequently requests a lock on the dialed channel. It waits on #1. For
   instance, "core show channel <dialed channel"
3. the outgoing call does not fail, but ends before the pbx_outgoing_attempt
   function exits
4. pbx_outgoing_attempt function exits, the outgoing structure destructs, and
   attempts to hang up the dialed channel
5. hang up tries to obtain the channels container lock, but can't due to #2.
6. Asterisk is deadlocked.

The solution was to allow the pbx_outgoing_exec function to "steal" ownership
of the dialed channel, and handle hanging it up. The channel now is either hung
up prior to it being potentially locked by the initiating thread, or if locked
the hang up takes place in a different thread, thus alleviating the deadlock.

ASTERISK-28561
patches:
  iliketrains.diff submitted by Joshua Colp (license 5000)

Change-Id: I51b42b92dde8f2215b69bb509e28667ee3a3853a
2019-10-09 16:06:50 -05:00
George Joseph ff293d0ff0 Merge "cdr_mysql: Don't clean up on unload unless we can unregister from CDRs" into 16 2019-10-08 08:24:40 -05:00
Sean Bright 68855f6a7b Revert "app_voicemail: Cleanup stale lock files on module load"
This reverts commit fd2e8d0da7.

Reason for revert: Problematic for users who store their voicemail
on network storage devices, or share voicemail storage between
multiple Asterisk instances.

ASTERISK-28567 #close

Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41
2019-10-08 06:34:44 -05:00
Kevin Harwell 3f12cd7711 res_pjsip_mwi: use an ao2_global object for mwi containers
On shutdown it's possible for the unsolicited mwi container to be freed before
other dependent threads are done using it. This patch ensures this can no
longer happen by wrapping the container in an ao2_global object. The solicited
container was also changed too.

ASTERISK-28552

Change-Id: I8f812286dc19a34916acacd71ce2ec26e1042047
2019-10-07 16:49:39 -05:00
Kevin Harwell afc10c25ac serializer: move/add asterisk serializer pool functionality
Serializer pools have previously existed in Asterisk. However, for the most
part the code has been duplicated across modules. This patch abstracts the
code into an 'ast_serializer_pool' object. As well the code is now centralized
in serializer.c/h.

In addition serializer pools can now optionally be monitored by a shutdown
group. This will prevent the pool from being destroyed until all serializers
have completed.

Change-Id: Ib1e906144b90ffd4d5ed9826f0b719ca9c6d2971
2019-10-07 16:49:39 -05:00
Kevin Harwell 931ef77e21 res_pjsip/res_pjsip_mwi: use centralized serializer pools
Both res_pjsip and res_pjsip_mwi made use of serializer pools. However, they
both implemented their own serializer pool functionality that was pretty much
identical in each of the source files. This patch removes the duplicated code,
and uses the new 'ast_serializer_pool' object instead.

Additionally res_pjsip_mwi enables a shutdown group on the pool since if the
timing was right the module could be unloaded while taskprocessor threads still
needed to execute, thus causing a crash.

Change-Id: I959b0805ad024585bbb6276593118be34fbf6e1d
2019-10-07 16:49:39 -05:00
Friendly Automation 6ef806ca60 Merge "channel/chan_pjsip: add dialplan function for music on hold" into 16 2019-10-07 07:55:33 -05:00
Sean Bright 495bc77a6a cdr_mysql: Don't clean up on unload unless we can unregister from CDRs
ASTERISK-28566 #close

Change-Id: I6daa4e5128e9406d04d3aed670c3bae98d38d40c
2019-10-04 16:00:37 -05:00
Joshua Colp ce1e0714ba stasis: Pass bumped topic_all reference to proxy_dtor.
This avoids use of the global variable and ensures topic_all remains
active until all topics are freed.

ASTERISK-28553
patches:
  ASTERISK-28553.patch by coreyfarrell (license 5909)

Change-Id: I9a8cd8977f3c3a6aa00783f8336d2cfb9c2820f1
2019-10-01 14:01:17 +00:00
lvl 19565e0b90 chan_pjsip: Prevent segfault when running PlayDTMF on hungup channel
ASTERISK-28086 #close

Change-Id: Ib3baadc89b9f0477a6f25a63861433812368c5ea
2019-10-01 15:14:21 +02:00
George Joseph 82e8033e39 Merge "res_pjsip_pubsub: add endpoint to some warning" into 16 2019-10-01 06:32:52 -05:00
Torrey Searle 9a933c3adc channel/chan_pjsip: add dialplan function for music on hold
Add a new dialplan function PJSIP_MOH_PASSTHROUGH that allows
the on-hold behavior to be controlled on a per-call basis

ASTERISK-28542 #close

Change-Id: Iebe905b2ad6dbaa87ab330267147180b05a3c3a8
2019-10-01 02:05:34 -05:00
Sean Bright 1f10ca76da res_pjsip_transport_websocket: Don't put brackets around local_name if IPv6
ASTERISK-28544 #close

Change-Id: I8e62c444d107674c298f472e3545661de8a80dce
2019-09-27 13:07:35 -05:00
George Joseph ac331bff34 Merge "pbx: Prevent Realtime switch crash on invalid priority" into 16 2019-09-27 08:58:51 -05:00
George Joseph 072c63f575 Merge "taskprocessor.c: Added "like" support to 'core show taskprocessors'" into 16 2019-09-27 08:55:40 -05:00
Friendly Automation b62f156261 Merge "basic-pbx: Bring forward queue configuration from 13" into 16 2019-09-27 08:37:24 -05:00
Friendly Automation 1903dcb43d Merge "res_musiconhold: Add new 'playlist' mode" into 16 2019-09-27 07:44:52 -05:00
Alexei Gradinari 04f7d136d8 res_pjsip_pubsub: add endpoint to some warning
There are some warning messages which are not informative without endpoint:
"No registered subscribe handler for event presence.winfo"
"No registered publish handler for event presence"

This patch adds an endpoint name to these messages.

Change-Id: Ia2811ec226d8a12659b4f9d4d224b48289650827
2019-09-26 13:12:40 -04:00
root d146ec7e83 Revert "Update CHANGES and UPGRADE.txt for 16.6.0-rc2"
This reverts commit a0844a9b9b.

Correcting/reverting accidental
upgrade on release process.

Change-Id: I08746eda578effa6e64054690fad48a17d2f42e7
2019-09-26 10:52:52 -05:00
Jonathan Rose 85c7326d08 basic-pbx: Bring forward queue configuration from 13
Original commit: cfbf5fbe91

Change-Id: I34a841d73c429ca8d944481f8dccb756ee231c9c
2019-09-26 09:20:36 -04:00
Joshua Colp ddb2c90713 Merge "res_pjsip_registrar: Validate Contact URI before adding to responses" into 16 2019-09-26 04:49:39 -05:00
Sean Bright 0514559005 pbx: Prevent Realtime switch crash on invalid priority
pbx_extension_helper takes two 'context' arguments. One (con) is a
pointer directly to a 'struct ast_context' and the other (context) is
the name of the context. In all cases, one of these arguments is NULL
and the other is non-NULL.

Functions that are ultimately called by pbx_extension_helper expect that
'context' will be non-NULL, so we set it unconditionally on entry into
this function.

ASTERISK-28534 #close

Change-Id: Ifbbc5e71440afd80efd441f7a9d72e8b10b6f47d
2019-09-26 04:47:49 -05:00
Ben Ford 827dd754b2 taskprocessor.c: Added "like" support to 'core show taskprocessors'
Added "like" support for 'core show taskprocessors'. Now you
can specify a specific set of taskprocessors (or just one) by
adding the keyword "like" to the above command, followed by
your search criteria.

Change-Id: I021e740201e9ba487204b5451e46feb0e3222464
2019-09-25 14:01:34 -05:00
Asterisk Development Team a0844a9b9b Update CHANGES and UPGRADE.txt for 16.6.0-rc2 2019-09-25 12:53:26 -05:00
George Joseph 28542da3dc Merge "res_pjsip_pubsub: change warning to debug" into 16 2019-09-25 11:34:59 -05:00
Friendly Automation 0b34551af0 Merge "core: Fix ABI mismatch of ao2_global_obj." into 16 2019-09-25 07:41:35 -05:00
George Joseph cce4dd2e71 Merge "taskprocessor.c: Add CLI commands to reset taskprocessor stats." into 16 2019-09-25 06:24:45 -05:00
Sean Bright 41cd1ff454 res_pjsip_registrar: Validate Contact URI before adding to responses
If a permanent contact URI associated with an AOR is invalid, we add a
Contact header to REGISTER responses with a NULL URI, causing a crash.

ASTERISK-28463 #close

Change-Id: Id2b643e58b975bc560aab1c111e6669d54db9102
2019-09-25 06:20:55 -05:00
George Joseph d799217867 Merge "core: Add AO2_ALLOC_OPT_NO_REF_DEBUG option." into 16 2019-09-25 06:03:45 -05:00
George Joseph e929b21368 Merge "pjproject_bundled: Revert pjproject 2.9 commits causing leaks" into 16 2019-09-24 15:38:04 -05:00
Kevin Harwell 9ff11c2f00 res_pjsip_pubsub: change warning to debug
The following message:

"Subscription request from endpoint <blah> rejected. Expiration of 0 is invalid"

Would sometimes spam the log with warnings if Asterisk restarted and a bunch
of clients sent unsubscribes. This patch changes it from a warning to a debug
message.

Change-Id: I841ec42f65559f3135e037df0e55f89b6447a467
2019-09-24 11:21:12 -05:00
Corey Farrell cd51f5b876 core: Fix ABI mismatch of ao2_global_obj.
astobj2.c declares DEBUG_THREADS_LOOSE_ABI to avoid overhead of debug
threads tracking information in the internal structures of astobj2.
Unfortunately this means that ao2_global_obj contains the statically
allocated debug threads tracking fields which are used by initialization
and cleanup but main/astobj2.c believed those fields and associated
space did not exist.

Change-Id: Icef41ad97d88a8c1d1515e034ec8133cab3b1527
2019-09-24 11:20:21 -05:00
Ben Ford 5ea667e03a taskprocessor.c: Add CLI commands to reset taskprocessor stats.
Added two new CLI commands to reset stats for taskprocessors. You can
reset stats for a single, specific taskprocessor ('core reset
taskprocessor <taskprocessor>'), or you can reset all taskprocessors
('core reset taskprocessors'). These commands will reset the counter for
the number of tasks processed as well as the max queue size.

Change-Id: Iaf17fc4ae29396ab0c6ac92408fc7bdc2f12362d
2019-09-24 10:42:08 -05:00
Friendly Automation 2bb6334098 Merge "res_sorcery_memory_cache: stale item update leak" into 16 2019-09-24 08:44:49 -05:00
George Joseph b41e1e8928 Merge "astmm.c: Display backtrace with memory show allocations" into 16 2019-09-24 08:28:19 -05:00
George Joseph 789c51ac8a pjproject_bundled: Revert pjproject 2.9 commits causing leaks
We've found a connection re-use regression in pjproject 2.9
introduced by commit
"Close #1019: Support for multiple listeners."
https://trac.pjsip.org/repos/changeset/6002
https://trac.pjsip.org/repos/ticket/1019

Normally, multiple SSL requests should reuse the same connection
if one already exists to the remote server.  When a transport
error occurs, the next request should establish a new connection
and any following requests should use that same one.  With this
patch, when a transport error occurs, every new request creates
a new connection so you can wind up with thousands of open tcp
sockets, possibly exhausting file handles, and increasing memory
usage.

Reverting pjproject commit 6002 (and related 6021) restores the
expected behavior.

We also found a memory leak in SSL processing that was introduced by
commit
"Fixed #2204: Add OpenSSL remote certificate chain info"
https://trac.pjsip.org/repos/changeset/6014
https://trac.pjsip.org/repos/ticket/2204

Apparently the remote certificate chain is continually recreated
causing the leak.

Reverting pjproject commit 6014 (and related 6022) restores the
expected behavior.

Both of these issues have been acknowledged by Teluu.

ASTERISK-28521

Change-Id: I8ae7233c3ac4ec29a3b991f738e655dabcaba9f1
2019-09-24 08:16:01 -05:00
Kevin Harwell bd440fcaa5 Merge "app_voicemail: Fix module unload leak." into 16 2019-09-23 15:28:13 -05:00
Kevin Harwell 258f9e6ecc Merge "res_pjsip_mwi: Remove inappropriate topic unreference." into 16 2019-09-23 15:19:07 -05:00
Corey Farrell fec6e1bd87 core: Add AO2_ALLOC_OPT_NO_REF_DEBUG option.
Previous to this patch passing a NULL tag to ao2_alloc or ao2_ref based
functions would result in the reference not being logged under
REF_DEBUG.  This could sometimes cause inaccurate logging if NULL was
accidentally passed to a reference action.  Now reference logging is
only disabled by option passed to the allocation method.

Change-Id: I3c17d867d901d53f9fcd512bef4d52e342637b54
2019-09-23 12:34:41 -05:00
Kevin Harwell bd96a0b79d res_sorcery_memory_cache: stale item update leak
When a stale item was being updated the object was being retrieved, but its
reference was not being decremented after the update. This patch makes it so
the object is now appropriately de-referenced.

ASTERISK-28523

Change-Id: I9d8173d3a0416a242f4eba92fa0853279c500ec7
2019-09-23 11:01:36 -05:00
George Joseph 9c5a8066a6 astmm.c: Display backtrace with memory show allocations
You can currently capture backtraces of memory allocations but they
only get displayed when you stop asterisk and the atexit hooks
are enabled.  Now, if memory backtrace is on and you issue a
"memory show allocations" CLI command for a specific file, then
a backtrace will show for each allocation that occurred after
you turned "memory backtrace on".  The backtrace display is shown
only when a specific file's allocations are displayed to prevent
a massive CLI dump of every file's allocations.

Change-Id: Ic657afc1fc6ec7205e16eb36a97a611d235a2b4f
2019-09-23 06:23:05 -06:00
Corey Farrell 5b8c1ed0d3
stasis: refcounter.py can incorrectly report skewed objects.
It is possible for topic->name to be NULL, this causes the allocation
reference to not be logged.  Use the name variable instead which has
been verified to be a non-empty.

Change-Id: I3d0031d03c8356e4808f00cdf2d5428712575883
2019-09-20 09:34:22 -04:00
Corey Farrell 76d4a42ae1 res_pjsip_mwi: Remove inappropriate topic unreference.
ast_mwi_topic() returns a borrowed reference which should not be
unreferenced, doing so leads to a FRACK.  This was hidden by the fact
that stasis_cache.c leaked the result of cache_remove in
caching_topic_exec.

Change-Id: I51101bf7d07b8dc8ce8fc46b6cb31fbbd213fbc7
2019-09-19 15:30:58 -05:00
Corey Farrell 256db889f2 app_voicemail: Fix module unload leak.
Change-Id: Ib9a06565b9a178822d3bbb67eccf51432e12d84a
2019-09-19 11:15:32 -05:00
Friendly Automation a687c7919d Merge "func_jitterbuffer: Add audio/video sync support." into 16 2019-09-19 08:10:52 -05:00
Joshua Colp 120f2fb5f9 Merge "core: Add H.265/HEVC passthrough support" into 16 2019-09-19 06:34:07 -05:00
Joshua Colp 6647be69ac func_jitterbuffer: Add audio/video sync support.
This change adds support to the JITTERBUFFER dialplan function
for audio and video synchronization. When enabled the RTCP SR
report is used to produce an NTP timestamp for both the audio and
video streams. Using this information the video frames are queued
until their NTP timestamp is equal to or behind the NTP timestamp
of the audio. The audio jitterbuffer acts as the leader deciding
when to shrink/grow the jitterbuffer when adaptive is in use. For
both adaptive and fixed the video buffer follows the size of the
audio jitterbuffer.

ASTERISK-28533

Change-Id: I3fd75160426465e6d46bb2e198c07b9d314a4492
2019-09-18 15:26:00 -05:00
Sean Bright 9f304170f6 res_musiconhold: Add new 'playlist' mode
Allow the list of files to be played to be provided explicitly in the
music class's configuration. The primary driver for this change is to
allow URLs to be used for MoH.

Change-Id: I9f43b80b43880980b18b2bee26ec09429d0b92fa
2019-09-18 14:07:37 -05:00
Friendly Automation f9f17f3bfe Merge "chan_pjsip: Relock correct channel during "fax" redirect." into 16 2019-09-18 07:39:25 -05:00
George Joseph 51e315765b Merge "res_rtp_asterisk.c: Send RTCP as compound packets." into 16 2019-09-17 09:26:40 -05:00
Joshua Colp 49e1346185 chan_pjsip: Relock correct channel during "fax" redirect.
When fax detection occurs on an outbound PJSIP channel the
redirect operation will result in a masquerade occurring and
the underlying channel on the session changing. The code
incorrectly relocked the new channel instead of the old
channel when returning. This resulted in the new channel
being locked indefinitely. The code now always acts on the
expected channel.

ASTERISK-28538

Change-Id: I2b2e60d07e74383ae7e90d752c036c4b02d6b3a3
2019-09-16 08:42:16 -05:00
Guido Falsi 448b8c9bc2 chan_dahdi: Fix build with clang/llvm
On FreeBSD using the clang/llvm compiler build fails to build due
to the switch statement argument being a non integer type expression.
Switch to an if/else if/else construct to sidestep the issue.

ASTERISK-28536 #close

Change-Id: Idf4a82cc1e94580a2d017fe9e351c226f23e20c8
2019-09-14 10:10:30 -05:00
Ben Ford a95cef7140 res_rtp_asterisk.c: Send RTCP as compound packets.
According to RFC3550, ALL RTCP packets must be sent in a compond packet
of at least two individual packets, including SR/RR and SDES. REMB,
FIR, and NACK were not following this format, and as a result, would
fail the packet check in ast_rtcp_interpret. This was found from writing
unit tests for RTCP. The browser would accept the way we were
constructing these RTCP packets, but when sending directly from one
Asterisk instance to another, the above mentioned problem would occur.

Change-Id: Ieb140e9c22568a251a564cd953dd22cd33244605
2019-09-13 09:48:17 -05:00
George Joseph 913c8b48b7 Merge "channels: Allow updating variable value" into 16 2019-09-13 09:43:58 -05:00
George Joseph c2dbba39a6 Merge "res_rtp: Add unit tests for RTCP stats." into 16 2019-09-13 07:05:08 -05:00
Asterisk Development Team 688908fe7a Update CHANGES and UPGRADE.txt for 16.6.0 2019-09-12 16:04:11 -05:00
Sean Bright 518b6bfb5c channels: Allow updating variable value
When modifying an already defined variable in some channel drivers they
add a new variable with the same name to the list, but that value is
never used, only the first one found.

Introduce ast_variable_list_replace() and use it where appropriate.

ASTERISK-23756 #close
Patches:
  setvar-multiplie.patch submitted by Michael Goryainov

Change-Id: Ie1897a96c82b8945e752733612ee963686f32839
2019-09-12 15:58:49 -05:00
Florian Floimair f85631cf82 core: Add H.265/HEVC passthrough support
This change adds H.265/HEVC as a known codec and creates a cached
"h265" media format for use.

Note that RFC 7798 section 7.2 also describes additional SDP
parameters. Handling of these is not yet supported.

ASTERISK-28512

Change-Id: I26d262cc4110b4f7e99348a3ddc53bad0d2cd1f2
2019-09-12 11:16:09 +02:00
Joshua Colp cb90d1cd7c Merge "ChanIsAvail() generates a CDR when unanswered=yes in cdr.conf." into 16 2019-09-11 09:26:59 -05:00
George Joseph c49696462a Merge "res_musiconhold: Added unregister realtime moh class" into 16 2019-09-11 09:02:44 -05:00
Friendly Automation ce5029a4db Merge "chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up" into 16 2019-09-11 07:07:32 -05:00
sungtae kim b478f46d59 res_musiconhold: Added unregister realtime moh class
This fix allows a realtime moh class to be unregistered from the command
line. This is useful when the contents of a directory referenced by a
realtime moh class have changed.
The realtime moh class is then reloaded on the next request and uses the
new directory contents.

ASTERISK-17808

Change-Id: Ibc4c6834592257c4bb90601ee299682d15befbce
2019-09-11 02:31:08 -05:00
Friendly Automation a30e2ea305 Merge "codec_resample: Ensure OUTSIDE_SPEEX is defined when necessary" into 16 2019-09-10 18:55:08 -05:00
Ben Ford 922d3e02df res_rtp: Add unit tests for RTCP stats.
Added unit tests for RTCP video stats. These tests include NACK, REMB,
FIR/FUR/PLI, SR/RR/SDES, and packet loss statistics. The REMB and FIR
tests are currently disabled due to a bug. We expect to receive a
compound packet, but the code sends this out as a single packet, which
the browser accepts, but makes Asterisk upset.

While writing these tests, I noticed an issue with NACK as well. Where
it is handling a received NACK request, it was reading in only the first
8 bits of following packets that were also lost. This has been changed
to the correct value of 16 bits.

Also made a minor fix to the data buffer unit test.

Change-Id: I56107c7411003a247589bbb6086d25c54719901b
2019-09-10 13:10:34 -05:00
Friendly Automation 55fbf9b2c3 Merge "ARI: External Media" into 16 2019-09-10 11:56:38 -05:00
George Joseph d566314e38 ARI: External Media
The Channel resource has a new sub-resource "externalMedia".
This allows an application to create a channel for the sole purpose
of exchanging media with an external server.  Once created, this
channel could be placed into a bridge with existing channels to
allow the external server to inject audio into the bridge or
receive audio from the bridge.
See https://wiki.asterisk.org/wiki/display/AST/External+Media+and+ARI
for more information.

Change-Id: I9618899198880b4c650354581b50c0401b58bc46
2019-09-10 09:44:04 -06:00
George Joseph f4726e8b16 Merge "chan_unistim: Fix clang warning: variable sized type not at end of a struct" into 16 2019-09-10 08:41:42 -05:00
Friendly Automation c4cefb8073 Merge "test_utils.c: Skip test adsi_loaded_test if module not loaded." into 16 2019-09-10 08:37:07 -05:00
Sean Bright bf527810ef codec_resample: Ensure OUTSIDE_SPEEX is defined when necessary
ASTERISK-28511

Change-Id: If0d58598ce14aad3c786a1c0127b5f7b200b737d
2019-09-08 11:52:42 -04:00
Frederic LE FOLL c6b17b5212 chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up
When the remote ISDN party ends an ISDN call on a PRI link
(DISCONNECT), CHANNEL(hangupsource) information is not available.

chan_dahdi already contains an ast_set_hangupsource() in
__dahdi_exception() function but it seems that ISDN message processing
does not use this part of code.

Two other channel modules associate ast_queue_hangup() and
ast_set_hangupsource() functions calls:
- chan_pjsip in chan_pjsip_session_end() function,
- chan_sip in sip_queue_hangup_cause() function.
chan_iax2 separates them, in iax2_queue_hangup()/iax2_destroy() and
set_hangup_source_and_cause().

Thus, I propose to add ast_set_hangupsource() beside
ast_queue_hangup() in sig_pri_queue_hangup(), like chan_pjsip and
chan_sip already do.

ASTERISK-28525

Change-Id: I0f588a4bcf15ccd0648fd69830d1b801c3f21b7c
2019-09-05 20:20:15 +02:00
Frederic LE FOLL c8cf3ad389 ChanIsAvail() generates a CDR when unanswered=yes in cdr.conf.
ChanIsAvail() creates a temporary channel with ast_request() to test
resource availability. It should not generate a CDR when it hangs up
this temporary channel.

This patch disables CDR generation for the temporary channel with
ast_cdr_set_property().

ASTERISK-28527

Change-Id: I7b0555c6909c7d322e452dde97c9ea5b111552d1
2019-09-05 18:09:28 +02:00
George Joseph 1158411f53 Merge "AST-2019-005 - translate: Don't assume all frames will have a src." into 16 2019-09-05 07:52:49 -05:00
Joshua Colp 2691ee7e10 AST-2019-005 - translate: Don't assume all frames will have a src.
This change removes the assumption that a frame will always have
a src set on it. This assumption is incorrect.

Given a scenario where an RTP packet is received with no payload
the resulting audio frame will have no samples. If this frame goes
through a signed linear translation path an interpolated frame can
be created (if generic packet loss concealment is enabled) that has
minimal data on it, including no src. If this frame is given to a
translation path a crash will occur due to the lack of src.

ASTERISK-28499

Change-Id: I024d10dd98207eb8a6b35b59880bcdf1090538f8
2019-09-05 05:28:12 -05:00
Kevin Harwell 965df3c228 AST-2019-004 - res_pjsip_t38.c: Add NULL checks before using session media
After receiving a 200 OK with a declined stream in response to a T.38
initiated re-invite Asterisk would crash when attempting to dereference
a NULL session media object.

This patch checks to make sure the session media object is not NULL before
attempting to use it.

ASTERISK-28495
patches:
  ast-2019-004.patch submitted by Alexei Gradinari (license 5691)

Change-Id: I168f45f4da29cfe739acf87e597baa2aae7aa572
2019-09-05 05:16:08 -05:00
Chris-Savinovich a321225fa4 test_utils.c: Skip test adsi_loaded_test if module not loaded.
Module res_adsi.so is deprecated, therefore it does not load by default.
Module not loaded causes it to yield a FAIL when tested by tests/test_utils.c.
This fix checks if the corresponding module is loaded at the start of the test,
and if not, it passes the test and exits with a message.

This fix is applied to all versions where the module is marked deprecated.

Change-Id: I52be64c8f6af222e15148a856d1f10cb113e1e94
2019-09-04 16:49:49 -05:00
Igor Goncharovsky 92261d60c8 chan_unistim: Fix clang warning: variable sized type not at end of a struct
On reading information about initial client packet unistim use dirty
implementation of destination ip address retrieval. This fix uses
CMSG_*(..) to get ip address and make clang compile without warning.

ASTERISK-25592 #close
Reported-by: Alexander Traud

Change-Id: Ic1fd34c2c2bcc951da65bf62e3f7a8adff8351b1
2019-09-03 22:59:38 -05:00
George Joseph 260969f5ad Merge "res_pjsip_mwi: add better handling of solicited vs unsolicited subscriptions" into 16 2019-09-03 05:34:29 -05:00
George Joseph cc1b57a51d Merge "chan_unistim: Fix code, causing all incoming DTMF sent back to asterisk" into 16 2019-09-03 05:31:25 -05:00
George Joseph 712bf5edee Merge "codec_resample: Upgrade speex_resample to fix up-sampling bug" into 16 2019-08-30 07:45:56 -05:00
Kevin Harwell 7db5f5df6a res_pjsip_mwi: add better handling of solicited vs unsolicited subscriptions
res_pjsip_mwi allows both solicited and unsolicited MWI subscription types.
While both can be set in the configuration for a given endpoint/aor, only
one is allowed. Precedence is given to unsolicited. Meaning if an endpoint/aor
is configured to allow both types then the solicited subscription is rejected
when it comes in. However, there is a configuration option to override that
behavior:

mwi_subscribe_replaces_unsolicited

When set to "yes" then when a solicited subscription comes in instead of
rejecting it Asterisk is suppose to replace the unsolicited one if it exists.
Prior to this patch there was a bug in Asterisk that allowed the solicted one
to be added, but did not remove the unsolicited. As a matter of fact a new
unsolicited subscription got added everytime a SIP register was received.
Over time this eventually could "flood" a phone with SIP notifies.

This patch fixes that behavior to now make it work as expected. If configured
to do so a solicited subscription now properly replaces the unsolicited one.
As well when an unsubscribe is received the unsolicited subscription is
restored. Logic was also put in to handle reloads, and any configuration changes
that might result from that. For instance, if a solicited subscription had
previously replaced an unsolicited one, but after reload it was configured to
not allow that then the solicited one needs to be shutdown, and the unsolicited
one added.

ASTERISK-28488

Change-Id: Iec2ec12d9431097e97ed5f37119963aee41af7b1
2019-08-28 18:21:26 -05:00
Igor Goncharovsky 78d00c277c chan_unistim: Fix code, causing all incoming DTMF sent back to asterisk
Current implementation of ast_channel_tech send_digit_begin hook uses
same function for tone playback as key press handler. This cause every
incoming dtmf send back to asterisk. In case of two unistim phones
connected to each other, it'll cause indefinite DTMF loop. Fix add
separate function for dtmf tone phone play.

Change-Id: I5795db468df552f0c89c7576b6b3858b26c4eab4
2019-08-27 02:52:50 -05:00
Igor Goncharovsky 821b7561f8 chan_unistim: Fix RTP port byte order for big-endian arch
This patch fixes one-way oudio that users expirienced on
big-endian architechtires. RTP port number bytes was stored
in improper order and phone sent RTP to wrong RTP port.

Reported-by: Andrey Ionov
Change-Id: I9a9ca7f26e31a67bbbceff12923baa10dfb8a3be
2019-08-26 04:48:44 -05:00
Sean Bright cdbb9800e3 codec_resample: Upgrade speex_resample to fix up-sampling bug
ASTERISK-28511 #close

Change-Id: Idd07bf341e89ac999c7f5701d9b72b8a9cb11e82
2019-08-23 17:36:32 -04:00
Friendly Automation 94dfb9c7ac Merge "Fix misname 'res_external_mwi' to 'res_mwi_external' in comments." into 16 2019-08-23 07:56:31 -05:00
Friendly Automation d29e16ce52 Merge "pjproject: Configurable setting for cnonce to include hyphens or not" into 16 2019-08-22 19:55:07 -05:00
George Joseph b5eb13c23b Merge "chan_rtp: Accept hostname as well as ip address as destination" into 16 2019-08-22 19:01:49 -05:00
George Joseph 38d1d0726c Merge "dns_core: Create new API ast_dns_resolve_ipv6_and_ipv4" into 16 2019-08-22 19:00:21 -05:00
Alexei Gradinari aaaa1695ca Fix misname 'res_external_mwi' to 'res_mwi_external' in comments.
Change-Id: Ic784be8500e5cb75dcb34bae9f03cfd93b6b34fb
2019-08-22 14:26:24 -04:00
George Joseph c00a010fe8 chan_rtp: Accept hostname as well as ip address as destination
The UnicastRTP channel driver provided by chan_rtp now accepts
"<hostname>:<port>" as an alternative to "<ip_address>:<port>"
in the destination. The first AAAA (preferred) or A record resolved
will be used as the destination. The lookup is synchronous so beware
of possible dialplan delays if you specify a hostname.

Change-Id: Ie6f95b983a8792bf0dacc64c7953a41032dba677
2019-08-22 06:36:51 -06:00
George Joseph 6407ccd2d9 dns_core: Create new API ast_dns_resolve_ipv6_and_ipv4
The new function takes in a pointer to an ast_sockaddr structure,
a hostname and an optional port and then dispatches parallel
"AAAA" and "A" record queries.  If an "AAAA" record is returned,
it's parsed into the ast_sockaddr structure along with the port
if it was supplied.  If no "AAAA" record was returned, the
first "A" record returned (if any) is parsed instead.

This is a synchronous call.  If you need asynchronous lookups,
use ast_dns_query_set_resolve_async and roll your own.

Change-Id: I194b0b0e73da94b35cc35263a868ffac3a8d0a95
2019-08-22 06:32:54 -06:00
George Joseph 23882ddb3e Merge "res_pjsip: Channel variable SIPFROMDOMAIN" into 16 2019-08-21 18:42:06 -05:00
Dan Cropp c8cc530726 pjproject: Configurable setting for cnonce to include hyphens or not
NEC SIP Station interface with authenticated registration only supports cnonce
up to 32 characters.  In Linux, PJSIP would generate 36 character cnonce
which included hyphens.  Teluu developed this patch adding a compile time
setting to default to not include the hyphens.  They felt it best to still
generate the UUID and strip the hyphens.
They have indicated it will be part of PJSIP 2.10.

ASTERISK-28509
Reported-by: Dan Cropp

Change-Id: Ibdfcf845d4f8c0a14df09fd983b11f2d72c5f470
2019-08-21 11:34:42 -05:00
Friendly Automation ad63cb7cef Merge "res_ari.c: Prefer exact handler match over wildcard" into 16 2019-08-21 07:56:12 -05:00
Stas Kobzar fb984eda40 res_pjsip: Channel variable SIPFROMDOMAIN
In chan_sip, there was variable SIPFROMDOMAIN that allows to set
From header URI domain per channel. This patch introduces res_pjsip
variable SIPFROMDOMAIN for backward compatibility with chan_sip.

ASTERISK-28489

Change-Id: I715133e43172ce2a1e82093538dc39f9e99e5f2e
2019-08-21 07:04:57 -05:00
George Joseph f82d0b74fd res_ari.c: Prefer exact handler match over wildcard
Given the following request path and 2 handler paths...
Request: /channels/externalMedia
Handler: /channels/{channelId}      "wildcard"
Handler: /channels/externalmedia    "non-wildcard"

...if /channels/externalMedia was registered as a handler after
/channels/{channelId} as shown above, the request would automatically
match the wildcard handler and attempt to parse "externalMedia" into
the channelId variable which isn't what was intended.  It'd work
if the non-wildard entry was defined in rest-api/api-docs/channels.json
before the wildcard entry but that makes the json files
order-dependent which isn't a good thing.

To combat this issue, the search loop saves any wildcard match but
continues looking for exact matches at the same level.  If it finds
one, it's used.  If it hasn't found an exact match at the end of
the current level, the wildcard is used.  Regardless, after
searching the current level, the wildcard is cleared so it won't
accidentally match for a different object or a higher level.

BTW, it's currently not possible for more than 1 wildcard entry
to be defined for a level.  For instance, there couldn't be:
Handler: /channels/{channelId}
Handler: /channels/{channelName}
We wouldn't know which one to match.

Change-Id: I574aa3cbe4249c92c30f74b9b40e750e9002f925
2019-08-20 13:19:02 -05:00
Sean Bright 51fd43206b audiohook.c: Substitute silence for unavailable audio frames
There are 4 scenarios to consider when capturing audio from a channel
with an audiohook:

 1. There is no rx and no tx audio, so return nothing.
 2. There is rx but no tx audio, so return rx.
 3. There is tx but no rx audio, so return tx.
 4. There is rx and tx audio, so mix them and return.

The file passed as the primary argument to MixMonitor will be written to
in scenarios 2, 3, and 4. However, if you pass the r() and t() options
to MixMonitor, a frame will only be written to the r() file if there was
rx audio and a frame will only be written to the t() file if there was
tx audio.

If you subsequently take the r() and t() files and try to mix them, the
sides of the conversation will 'drift' and be non-representative of the
user experience.

This patch adds a new 'S' option to MixMonitor that injects a frame of
silence on either the r() side or the t() side of the channel so that
when later mixed, there is no such drift.

Change-Id: Ibf5ed73a811087727bd561a89a59f4447b4ee20e
2019-08-20 08:43:39 -05:00
Alexei Gradinari ff180a5bfc app_voicemail/IMAP: check mailstream not NULL in leave_voicemail
The function leave_voicemail checks if expungeonhangup is set,
but does not check if IMAP stream is closed,
so it could call imap function with NULL stream.
This leads to segfault.

ASTERISK-28505 #close

Change-Id: Ib66c57c1f1ba97774e447b36349198e2626a8d7c
2019-08-14 15:57:15 -04:00
Sean Bright 8399211eaf menuselect: Fix curses build on Gentoo Linux
Because keypad() is exported by libtinfo, it needs to be explicitly
added to the linker options.

ASTERISK-28487 #close

Change-Id: I6c2ad5b95f422c263d078b5c0e84c111807dffc6
2019-08-09 10:08:32 -05:00
George Joseph c8c33c9a0b Merge "srtp: Fix possible race condition, and add NULL checks" into 16 2019-08-09 07:51:26 -05:00
George Joseph b0208d6e2f Merge "cdr / cel: Use event time at event creation instead of processing." into 16 2019-08-08 13:26:46 -05:00
George Joseph 92066b8746 CI: Escape backslashes in printenv/sort/tr
Change-Id: I52be64c8f6af2bbe15148a856d1f10cb113e1e94
(cherry picked from commit c6558e09af)
2019-08-08 12:15:17 -05:00
Kevin Harwell d4766a82a2 srtp: Fix possible race condition, and add NULL checks
Somehow it's possible for the srtp session object to be NULL even though the
Asterisk srtp object itself is valid. When this happened it would cause a
crash down in the srtp code when attempting to protect or unprotect data.

After looking at the code there is at least one spot that makes this situation
possible. If Asterisk fails to unprotect the data, and after several retries
it still can't then the srtp->session gets freed, and set to NULL while still
leaving the Asterisk srtp object around. However, according to the original
issue reporter this does not appear to be their situation since they found
no errors logged stating the above happened (which Asterisk does for that
situation).

An issue was found however, where a possible race condition could occur between
the pjsip incoming negotiation, and the receiving of RTP packets. Both places
could attempt to create/setup srtp for the same rtp instance at the same time.
This potentially could be the cause of the problem as well.

Given the above this patch adds locking around srtp setup for a given rtp, or
rtcp instance. NULL checks for the session have also been added within the
protect and unprotect functions as a precaution. These checks should at least
stop Asterisk from crashing if it gets in this situation again.

This patch also fixes one other issue noticed during investigation. When doing
a replace the old object was freed before creating the replacement. If the new
replacement object failed to create then the rtp/rtcp instance would now point
to freed srtp data which could potentially cause a crash as well when the next
attempt to reference it was made. This is now fixed so the old srtp object is
kept upon replacement failure.

Lastly, more logging has been added to help diagnose future issues.

ASTERISK-28472

Change-Id: I240e11cbb1e9ea8083d59d50db069891228fe5cc
2019-08-08 11:30:49 -05:00
George Joseph db9684ad1e CI: Add "throttle" label and "skip_gate" capability
To make throttling by label fully active, the "throttle" option
has to be specified with a specific label.

You can now specify "skip_gate" in the Gerrit comments when you
do a +2 code review to tell Jenkins not to actually run the
gate.  You'd do this if you plan to manually merge the change.

Also updated the "printenv" debug output to better sort multi-line
comments.

Change-Id: I4c0b1085acec4805f2ca207eebac50aad81f27e2
2019-08-08 09:48:25 -05:00
Friendly Automation d7c826af92 Merge "CI: Make node labels job-specific" into 16 2019-08-07 11:19:20 -05:00
Joshua Colp 6350f4e278 cdr / cel: Use event time at event creation instead of processing.
When updating times on CDR or CEL records using the time at which
it is done can result in times being incorrect if the system is
heavily loaded and stasis message processing is delayed.

This change instead makes it so CDR and CEL use the time at which
the stasis messages that drive the systems are created. This allows
them to be backed up while still producing correct records.

ASTERISK-28498

Change-Id: I6829227e67aefa318efe5e183a94d4a1b4e8500a
2019-08-07 04:47:12 -06:00
George Joseph 9feb13c5b1 Merge "various modules: json integer overflow" into 16 2019-08-06 11:07:22 -05:00
George Joseph 2641081caa CI: Make node labels job-specific
Originally, the eligible nodes for a job were labelled only by
"swdev-docker".  So basically any node could run any job.  We had
found that allowing a node to run more than 1 gate at a time was
problematic so we limited the nodes to processing 1 job at a time.
With the creation of the Asterisk 17 branches however, we now have
so many active branches that getting checks and gates through in
a timely manner is problematic when a node can run only 1 job
at a time.

Now the nodes are also labelled by the job type they can run.
For instance: "asterisk-check", "asterisk-gate", etc.  With the
"Throttle Concurrent Builds" plugin, we can now allow a node to
run more than 1 job BUT throttle by job type.  For instance:
  Allow 2 jobs but only 1 asterisk-gate at a time.
Now a node can run 2 checks or 1 check and 1 gate or 1 gate but
not 2 gates at a time.

Change-Id: I2032bf6afbcec5c341d9b852214c0c812d3d6db5
2019-08-06 09:51:09 -06:00
Friendly Automation 27deec9ee2 Merge "res_musiconhold: Use a vector instead of custom array allocation" into 16 2019-08-06 10:17:06 -05:00
George Joseph ef38087532 Merge "main/udptl.c: correctly handle udptl sequence wrap around" into 16 2019-08-06 09:48:25 -05:00
Kevin Harwell 6bb14150c4 various modules: json integer overflow
There were still a few places in the code that could overflow when "packing"
a json object with a value outside the base type integer's range. For instance:

unsigned int value = INT_MAX + 1
ast_json_pack("{s: i}", value);

would result in a negative number being "packed". In those situations this patch
alters those values to a ast_json_int_t, which widens the value up to a long or
long long.

ASTERISK-28480

Change-Id: Ied530780d83e6f1772adba0e28d8938ef30c49a1
2019-08-01 15:31:23 -06:00
Sean Bright 9718376902 res_musiconhold: Use a vector instead of custom array allocation
Change-Id: Ic476a56608b1820ca93dcf68d10cd76fc0b94141
2019-08-01 15:43:46 -04:00
Joshua Colp c2b135729c res_pjsip: Fix multiple of the same contact in "pjsip show contacts".
The code for gathering contacts could result in the same contact
being retrieved and added to the list multiple times. The container
which stores the contacts to display will now only allow a contact
to be added to it once instead of multiple times.

ASTERISK-28228

Change-Id: I805185cfcec03340f57d2b9e6cc43c49401812df
2019-08-01 05:21:38 -05:00
Friendly Automation 8de36bfa41 Merge "res_musiconhold: Use ast_pipe_nonblock() wrapper" into 16 2019-07-31 07:58:45 -05:00
Friendly Automation d3508f5b51 Merge "manager: Send fewer packets" into 16 2019-07-31 07:34:38 -05:00
Torrey Searle 83390327b2 main/udptl.c: correctly handle udptl sequence wrap around
incorrect handling of UDPTL squence number wrap arounds causes
loss of packets every time the wrap around occurs

ASTERISK-28483 #close

Change-Id: I33caeb2bf13c574a1ebb81714b58907091d64234
2019-07-30 06:48:31 -06:00
Sean Bright 0ebfc4a19d manager: Send fewer packets
The functions that build manager message headers do so in a way that
results in a single messages being split across multiple packets. While
this doesn't matter to the remote end, it makes network captures noisier
and harder to follow, and also means additional system calls.

With this patch, we build up more of the message content into the TLS
buffer before flushing to the network. This change is completely
internal to the manager code and does not affect any of the existing
API's consumers.

Change-Id: I50128b0769060ca5272dbbb5e60242d131eaddf9
2019-07-29 14:09:50 -04:00
Sean Bright d6af1acb8c res_musiconhold: Use ast_pipe_nonblock() wrapper
Change-Id: Ib0a4b41e5ececbe633079e2d8c2b66c031d2d1f2
2019-07-29 09:04:30 -06:00
George Joseph 05cf9c9912 loader.c: Fix possible SEGV when a module fails to register
When a module fails to register itself (usually a coding error
in the module), dlerror() can return NULL.  We weren't checking
for that in load_dlopen() before trying to strdup the error message
so a SEGV was thrown.  dlerror() is now surrounded with an S_OR
so we don't SEGV.

Change-Id: Ie0fb9316f08a321434f3f85aecf3c7d2ede8b956
2019-07-29 07:38:36 -06:00
George Joseph 50453846b6 Merge "CI: Don't enable non-core modules in Certified branches" into 16 2019-07-26 09:47:47 -05:00
George Joseph 06780d2bc4 CI: Don't enable non-core modules in Certified branches
We don't support non-core modules for Certified releases but we
were enabling them for CI builds which was causing lots of test
failures.  Now we don't.

Change-Id: I0b3254c08a2479f3d39151690350cce5ce5ad766
2019-07-24 14:23:54 -06:00
Sean Bright 28654308ef res_config_sqlite3: Only join threads that we started
ASTERISK-28477 #close
Reported by: Dennis

ASTERISK-28478 #close
Reported by: Dennis

Change-Id: I77347ad46a86dc5b35ed68270cee56acefb4f475
2019-07-24 04:51:20 -06:00
George Joseph 85dcc699fa Merge "openr2(6/6): Set hangup cause" into 16 2019-07-23 19:41:56 -05:00
George Joseph d2a2131447 Merge "openr2(5/6): added cli command -- mfcr2 destroy link <index>" into 16 2019-07-23 18:43:13 -05:00
Friendly Automation f7c30bc93d Merge "openr2(4/6): added new cli command -- mfcr2 show links" into 16 2019-07-23 16:45:10 -05:00
Friendly Automation 24219c8d1d Merge "openr2(3/6): Convert r2links to standard Asterisk AST_LIST*" into 16 2019-07-23 15:34:43 -05:00
George Joseph 2b407cb531 Merge "openr2(2/6): Stop polling channels when DAHDI returns -ENODEV (e.g: plug-out)" into 16 2019-07-23 14:25:50 -05:00
Friendly Automation 6e33772432 Merge "openr2(1/6): bugfix in configuration saving" into 16 2019-07-23 12:00:19 -05:00
George Joseph fcd0c9c325 Merge "chan_pjsip: Transmit REFER waits for the REFER result setting TRANSFERSTATUS" into 16 2019-07-23 09:18:30 -05:00
Leonid Fainshtein 3814faf848 openr2(6/6): Set hangup cause
Change-Id: I94dc38920e6e77cc73062648f62fdd613d0d1452
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2019-07-22 20:45:03 +03:00
Tzafrir Cohen 06515707df openr2(5/6): added cli command -- mfcr2 destroy link <index>
Change-Id: I452d6a853bcd8c6e194455b19e5e017713e9c0fe
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2019-07-22 20:44:54 +03:00
Tzafrir Cohen 93a093f6c4 openr2(4/6): added new cli command -- mfcr2 show links
* This command show the MFC/R2 links

Change-Id: I213822e1b7ef9c05bd89a2ba62df8e0856ce9f84
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2019-07-22 20:44:44 +03:00
Tzafrir Cohen a45cfefb77 openr2(3/6): Convert r2links to standard Asterisk AST_LIST*
Change-Id: Ibcb2401515a58782a1488c0b9efbed201c3f3a17
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2019-07-22 20:44:34 +03:00
Tzafrir Cohen ec6e88592a openr2(2/6): Stop polling channels when DAHDI returns -ENODEV (e.g: plug-out)
Otherwise, OpenR2 threads go crazy and consume almost all CPU resources

Change-Id: I10a41f617613fe7399c5bdced5c64a2751173f28
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2019-07-22 20:43:17 +03:00
Tzafrir Cohen 7b6df814a6 openr2(1/6): bugfix in configuration saving
Details:
  - The memcpy() call copied part of "dahdi_conf" and not "dahdi_conf.mfcr2"
  - As a result, the memcmp() in dahdi_r2_get_link() always fails
  - This cause dahdi_r2_get_link() to create new link for every channel
    (instead of a new link for every ~30 channels)
  - With the fix, far less links are generated -- so we use far less threads

Change-Id: I7259dd6272f5e46e8a6c7f5bf3e8c2ec01b8c132
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2019-07-22 20:42:25 +03:00
George Joseph 356f4256cc CI: Add cleanWs to cleanup steps in jenkinsfiles
We're at the point where there are enough Jenkins jobs for
Asterisk branches than even cleaned checkouts of Asterisk
will add up to more disk space than is available on the
in-memory workspace mount.  Since we archive all relevent
artifacts anyway, there's no need to keep the workspace
around after the job finishes, whether it succeeds or fails.

Change-Id: I1cd3b73ebb045a987df0f62526d152a510210c39
2019-07-19 10:20:38 -06:00
George Joseph 979e4119d6 Merge "CI: Add install-headers to the install make targets" into 16 2019-07-19 11:05:08 -05:00
Dan Cropp f4896703b9 chan_pjsip: Transmit REFER waits for the REFER result setting TRANSFERSTATUS
Previously, when a Transfer (REFER) was performed, chan_pjsip would set
the TRANSFERSTATUS to SUCCESS when the REFER was queued up.  This did not
reflect a successful/unsuccessful transfer the way chan_sip did.
Added a callback module to process the refer subscription information.

Now depends on res_pjsip_pubsub so call transfer progress can be monitored
and reported

ASTERISK-26968 #close
Reported-by: Dan Cropp

Change-Id: If6c27c757c66f71e8b75e3fe49da53ebe62395dc
2019-07-19 09:05:32 -05:00
Rodrigo Ramírez Norambuena 9d69469203 README.md: Update year
Change-Id: I746fb94d112c7d797e206bca0fd1e13fcd26bae3
2019-07-19 07:43:25 -06:00
Friendly Automation f73fb5fdb1 Merge "sched: Don't allow ast_sched_del to deadlock ast_sched_runq from same thread" into 16 2019-07-19 08:41:32 -05:00
George Joseph c86c0973ff CI: Add install-headers to the install make targets
The testsuite actually needs the headers installed to run
it's self_test.

Change-Id: Ice41d331131b876ad4a9c056085fe6aac34b32b2
2019-07-19 07:40:57 -06:00
Joshua Colp eed3336f89 Merge "Build: Add separate header install/uninstall targets" into 16 2019-07-19 07:42:39 -05:00
Friendly Automation fcd598c310 Merge "manager: Log AMI actions" into 16 2019-07-19 07:30:11 -05:00
Asterisk Development Team cb831a18d1 Update CHANGES and UPGRADE.txt for 16.5.0 2019-07-18 06:07:20 -05:00
Walter Doekes 64d25d36fb sched: Don't allow ast_sched_del to deadlock ast_sched_runq from same thread
When fixing ASTERISK~24212, a change was done so a scheduled callback could not
be removed while it was running. The caller of ast_sched_del would have to wait.

However, when the caller of ast_sched_del is the callback itself (however wrong
this might be), this new check would cause a deadlock: it would wait forever
for itself.

This changeset introduces an additional check: if ast_sched_del is called
by the callback itself, it is immediately rejected (along with an ERROR log and
a backtrace). Additionally, the AST_SCHED_DEL_UNREF macro is adjusted so the
after-ast_sched_del-refcall function is only run if ast_sched_del returned
success.

This should fix the following spurious race condition found in chan_sip:
- thread 1: schedule sip_poke_peer_now (using AST_SCHED_REPLACE)
- thread 2: run sip_poke_peer_now
- thread 2: blank out sched-ID (too soon!)
- thread 1: set sched-ID (too late!)
- thread 2: try to delete the currently running sched-ID

After this fix, an ERROR would be logged, but no deadlocks (in do_monitor) nor
excess calls to sip_unref_peer(peer) (causing double frees of rtp_instances and
other madness) should occur.

(Thanks Richard Mudgett for reviewing/improving this "scary" change.)

Note that this change does not fix the observed race condition: unlocked
access to peer->pokeexpire (and potentially other scheduled items in chan_sip),
causing AST_SCHED_DEL_UNREF to look at a changing id. But it will make the
deadlock go away. And in the observed case, it will not have adverse affects
(like memory leaks) because the scheduled item is removed through a different
path.

ASTERISK-28282

Change-Id: Ic26777fa0732725e6ca7010df17af77a012aa856
2019-07-18 01:22:30 -06:00
George Joseph f62d9013c1 Build: Add separate header install/uninstall targets
Two new Makefile targets have been added... "install-headers" and
"uninstall-headers" to separately control header installation.
The existing behavior has not changed so "make install" and
"make uninstall" will continue to also install/uninstall the headers.
The new targets were added for forward compatibility with Asterisk 17
in which the headers are no longer installed/uninstalled with the
"install" and "uninstall" targets.

Also corrects an issue where /usr/include/asterisk.h was never
being removed at all.

Change-Id: Ia7399f3a0203a4825fc4a9f43b9034dae9a2b643
2019-07-16 08:16:31 -06:00
Kevin Harwell 88ea395c33 manager: Log AMI actions
When manager debugging is turned on, this patch makes it so incoming AMI actions
are now also logged.

Change-Id: I8047524510e7ac97d99482b2448f8e368f29cd47
2019-07-15 10:10:39 -06:00
Joshua Colp 1756029237 res_rtp_asterisk: Move where DTLS MTU variable is defined.
The DTLS MTU variable is not dependent on pjproject and should
not exist in its block.

Change-Id: I7e97d64dc192f2ac81bfe2b72b8229d321c7d026
2019-07-14 12:27:00 -06:00
Friendly Automation 0e3a3a5cb7 Merge "chan_sip: Handle invalid SDP answer to T.38 re-invite" into 16 2019-07-11 15:15:49 -05:00
George Joseph 2126dc3021 res_pjsip_messaging: Check for body in in-dialog message
We now check that a body exists and it has a length > 0 before
attempting to process it.

ASTERISK-28447
Reported-by: Gil Richard

Change-Id: Ic469544b22ab848734636588d4c93426cc6f4b1f
2019-07-11 11:36:47 -05:00
Francesco Castellano 6c59df17a5 chan_sip: Handle invalid SDP answer to T.38 re-invite
The chan_sip module performs a T.38 re-invite using a single media
stream of udptl, and expects the SDP answer to be the same.

If an SDP answer is received instead that contains an additional
media stream with no joint codec a crash will occur as the code
assumes that at least one joint codec will exist in this
scenario.

This change removes this assumption.

ASTERISK-28465

Change-Id: I8b02845b53344c6babe867a3f0a5231045c7ac87
2019-07-11 11:22:07 -05:00
Joshua Colp 1b832c3b60 Merge "chan_dahdi.c: crash in chan_dahdi" into 16 2019-07-02 08:26:40 -05:00
Chris-Savinovich da1db4f842 chan_dahdi.c: crash in chan_dahdi
Fixes a crash in chan_dahdi occurring on 32-bit systems. A previous
patch introduced a variable of type unassigned long long which is 64-bits.
Casting it as 'ast_json_int_t' along with JSON type 'I' makes it work
with 32-bit systems.

ASTERISK-28457

Change-Id: I9cef6b5f2d826fc5c93f2f6a1c997c4e3e6c93fe
2019-07-01 16:06:18 -06:00
Kevin Harwell 83aba363fe res_pjsip_sdp_rtp: Remove unused variable
The variable 'endpoint_caps' in function 'set_caps' is not used, so remove.

ASTERISK-28458

Change-Id: Ia8766d05a0738aecb29dd018302c2dafca5cab34
2019-07-01 10:49:56 -05:00
George Joseph 31ef22ead1 Merge "tcptls.c: Add peer hostname and port to some error messages" into 16 2019-07-01 10:19:50 -05:00
George Joseph 205a255b27 Merge "pjproject_bundled: Add peer information to most SSL/TLS errors" into 16 2019-07-01 10:18:52 -05:00
Kevin Harwell 323b1e5fe5 Merge "pjproject: Update to 2.9 release" into 16 2019-06-27 16:52:50 -05:00
George Joseph 0dc61e41fa tcptls.c: Add peer hostname and port to some error messages
Where possble, hostname and port has been added to error
messages, mostly on the server side.

ASTERISK-26006
Reported by: Oleksandr Natalenko

Change-Id: Iff4f897277bc36ce8c5b493b71d0a4a7b74e62f0
2019-06-27 15:04:20 -06:00
George Joseph 2db5173b88 pjproject_bundled: Add peer information to most SSL/TLS errors
Most SSL/TLS error messages coming from pjproject now have either
the peer address:port or peer hostname, depending on what was
available at the time and code location where the error was
generated.

ASTERISK-28444
Reported by: Bernhard Schmidt

Change-Id: I41770e8a1ea5e96f6e16b236692c4269ce1ba91e
2019-06-27 12:52:48 -05:00
Kevin Harwell d2a696cc04 Merge "app_amd: issue with silence suppression fixed" into 16 2019-06-27 11:33:51 -05:00
George Joseph 7d48e086ca Merge "sig_pri: Address gcc9 issues" into 16 2019-06-25 09:08:09 -05:00
George Joseph 33b3f8b09f Merge "CI: New way to determnine libdir" into 16 2019-06-25 09:06:45 -05:00
Friendly Automation 635affeac5 Merge "res_fax: gateway sends T.38 request to both endpoints if V.21 detected" into 16 2019-06-24 14:11:14 -05:00
George Joseph 31d755e805 sig_pri: Address gcc9 issues
A few more format truncation issues addressed.

Change-Id: I047f373169caaca0eec4889d3c0e5e10f130017a
2019-06-24 07:31:01 -06:00
Friendly Automation a464847a1b Merge "app_confbridge: Attended transfer event fixup" into 16 2019-06-21 11:24:11 -05:00
Friendly Automation 25c6890864 Merge "translate.c do not log WARNING on empty audio frame" into 16 2019-06-21 10:37:49 -05:00
Nasir Iqbal 52a3d4a761 app_amd: issue with silence suppression fixed
Now AMD algorithm will not ignore AST_FRAME_NULL, As I think using manual
wait time instead of `framelength` is enough to fix timeout / TOOLONG issue.

ASTERISK-28419 #close

Change-Id: I16ea2d6295bc99b975e8c092e5f9fbd9214debdb
2019-06-20 23:44:08 -06:00
George Joseph 01712bbdc9 CI: New way to determnine libdir
We were using the presence of /usr/lib64 to determine where
shared libraries should be installed.  This only existed on
Redhat based systems and was safe.  If it existed, use it,
otherwise use /usr/lib.

Unfortunately, Ubuntu 19 decided to create a /usr/lib64 BUT
NOT INCLUDE IT IN THE DEFAULT ld.so.conf.  So if anything is
installed there, it won't work.

The new method, just looks for $ID in /etc/os-release and if it's
centos or fedora, uses /usr/lib64 and if ubuntu, uses /usr/lib.

NOTE:  This applies only to the CI scripts.  Normal asterisk
build and install is not affected.

Change-Id: Iad66374b550fd89349bedbbf2b93f8edd195a7c3
2019-06-19 11:03:35 -06:00
George Joseph 1ee2f01f62 chan_dahdi: Address gcc9 issues
Fixed format-truncation issues in chan_dahdi.c and
sig_analog.c.  Since they're related to fields provided
by dahdi-tools we can't change the buffer sizes so we're just
checking the return from snprintf and printing an errior if we
overflow.

Change-Id: Idc1f3c1565b88a7d145332a0196074b5832864e5
2019-06-17 12:58:40 -06:00
Alexei Gradinari 8b77318a2c translate.c do not log WARNING on empty audio frame
There is WARNING "no samples for ..." on each Playtones.
The function ast_playtones_start calls ast_activate_generator,
which calls ast_prod.
The function ast_prod calls ast_write with empty audio frame.
In this case it's spam log.

Change-Id: Id4ac309489d9ff281bad02abdef341cecdede660
2019-06-14 17:06:06 -04:00
George Joseph ccc92b6ecb app_confbridge: Attended transfer event fixup
When a channel already in a conference bridge is attended transfered
to another extension, or when an existing call is attended
transferred into a conference bridge, we now generate ConfbridgeJoin
and ConfbridgeLeave events for the entering and departing channels.

Change-Id: Id7709cfbceb26fbcb828b2d0d2a6b2fbeaf028e1
2019-06-13 14:06:08 -06:00
Sean Bright 694097ee68 pjproject: Update to 2.9 release
Relies on https://github.com/asterisk/third-party/pull/4

Change-Id: Iec9cad42cb4ae109a86a3d4dae61e8bce4424ce3
2019-06-13 09:16:44 -06:00
Joshua Colp 82789aafd6 res_rtp_asterisk: Add support for DTLS packet fragmentation.
This change adds support for larger TLS certificates by allowing
OpenSSL to fragment the DTLS packets according to the configured
MTU. By default this is set to 1200.

This is accomplished by implementing our own BIO method that
supports MTU querying. The configured MTU is returned to OpenSSL
which fragments the packet accordingly. When a packet is to be
sent it is done directly out the RTP instance.

ASTERISK-28018

Change-Id: If2d5032019a28ffd48f43e9e93ed71dbdbf39c06
2019-06-13 07:51:39 -06:00
George Joseph ca462f6e15 Merge "app_attended_transfer: new application AttendedTransfer" into 16 2019-06-12 10:43:46 -05:00
George Joseph 5c2bf122ed Merge "app_blind_transfer: new application BlindTransfer" into 16 2019-06-12 10:43:17 -05:00
George Joseph da5874ec47 Merge "chan_pjsip.c: Check for channel and session to not be NULL in hangup" into 16 2019-06-12 08:50:14 -05:00
Joshua Colp 5c32680bb7 Merge "cdr_pgsql: fix error in connection string" into 16 2019-06-11 08:03:23 -05:00
George Joseph e7d0ca1591 Merge "pbx_dundi: added IPv4/IPv6 dual bind support to DUNDi" into 16 2019-06-10 07:37:23 -05:00
agupta 72f26aa8eb chan_pjsip.c: Check for channel and session to not be NULL in hangup
We have seen some rare case of segmentation fault in hangup function
and we could notice that channel pointer was NULL.  Debug log shows
that there is a 200 OK answer and SIP timeout at the same time.  It
looks that while the SIP session was being destroyed due to timeout
call hangup due to answer event lead to race condition and channel
is being destroyed from two different places.  The check ensures we
check it not to be NULL before freeing it.

ASTERISK-25371

Change-Id: I19f6566830640625e08f7b87bfe15758ad33a778
2019-06-06 13:24:04 -06:00
Kirsty Tyerman a1c84709b8 pbx_dundi: added IPv4/IPv6 dual bind support to DUNDi
ASTERISK-28234
Reported-by: Kirsty Tyerman

Change-Id: I5d6e6b52dbe51415046bb3953fd16f5b421bc2e1
2019-06-05 11:56:22 -06:00
Chris-Savinovich c2621aa190 cdr_pgsql: fix error in connection string
Fixes an error occurring in function pgsql_reconnect() caused when value of
hostname is blank. Which in turn will cause the connection string to look
like this: "host= port=xx", which creates a sintax error. This fix now checks
if the corresponding values for host, port, dbname, and user are blank. Note
that since this is a reconnect function the database library will replace any
missing value pairs with default ones.

ASTERISK-28435

Change-Id: I0a921f99bbd265768be08cd492f04b30855b8423
2019-06-04 13:37:34 -05:00
Alexei Gradinari 86cd77ec0a app_attended_transfer: new application AttendedTransfer
AttendedTransfer queues up attended transfer to the given extension.

This application can be useful with Custom Dynamic Features.
For example to make attended transfer to a predefined number.

features.conf
;;;
[applicationmap]
my_atxfer => *7,self,GoSub,"my_atxfer,s,1",default
;;;

extensions.conf
;;;
[globals]
DYNAMIC_FEATURES=my_atxfer
TRANSFER_CONTEXT=my_transfer

[my_atxfer]
exten => s,1,AttendedTransfer(1234567890)
   same => n,Return()

[my_transfer]
include => default
;;;

This application also can be used to completly redefine Attended transfer
feature using dialplan. For example:

features.conf
;;;
[featuremap]
atxfer => *7

[applicationmap]
custom_atxfer => *2,self,GoSub,"custom_atxfer,s,1",default
;;;

extensions.conf
;;;
[globals]
DYNAMIC_FEATURES=custom_atxfer
TRANSFER_CONTEXT=my_transfer

[custom_atxfer]
exten => s,1,
   same => n,Playback(pbx-transfer)
   same => n,Read(dest,dial,10,i,3,3)
   same => n,AttendedTransfer(${dest})
   same => n,Return()

[my_transfer]
include => default
;;;

Change-Id: Ie5cfa455d0813cffd5c85a6fb117f07d8f0b903b
2019-06-04 13:42:54 -04:00
Alexei Gradinari 6321b559b9 res_fax: gateway sends T.38 request to both endpoints if V.21 detected
According T.38 Gateway 'Use case 3'
https://wiki.asterisk.org/wiki/display/AST/T.38+Gateway
T.38 Gateway should send T.38 negotiation request to called endpoint
if FAX preamble (using V.21 detector) generated by called endpoint.
But it does not, because fax_gateway_detect_v21 constructs T.38
negotiation request, but forwards it only to other channel,
not to the channel on which FAX preamble is detected.

Some SIP endpoints could be improperly configured to rely on the other side
to initiate T.38 re-INVITEs.

With this patch the T.38 Gateway tries to negotiate with both sides
by sending T.38 negotiation request to both endpoints supported T.38.

Change-Id: I73bb24799bfe1a48adae9c034a2edbae54cc2a39
2019-06-04 11:46:16 -04:00
Joshua Colp de38c9c3b3 Merge "res_fax: fix segfault on inactive "reserved" fax session" into 16 2019-06-04 05:29:39 -05:00
Friendly Automation eefd53b718 Merge "app_readexten: new option 'p' to stop reading on '#' key" into 16 2019-06-03 09:41:19 -05:00
Friendly Automation c945d3d9c8 Merge "res_fax: add channel name to CLI 'fax show session'" into 16 2019-06-03 09:33:32 -05:00
Friendly Automation 53df0ff200 Merge "pjsip: replace 180 by 183 if SDP negotiation has completed" into 16 2019-06-03 08:56:48 -05:00
Asterisk Development Team d2c07aceca Update CHANGES and UPGRADE.txt for 16.4.0 2019-05-30 12:08:23 -05:00
Friendly Automation 7053104222 Merge "build: Fix file format in CHANGES-staging." into 16 2019-05-30 05:22:33 -05:00
Alexei Gradinari e77704f45c res_fax: add channel name to CLI 'fax show session'
This patch adds a channel name to output of CLI 'fax show session'
and also expands the channel name field up to 30 characters on
CLI 'fax show sessions'

Change-Id: Id059c43ff41811f5e76712b83fb63b8f246da953
2019-05-28 18:21:15 -04:00
Alexei Gradinari e0a574253e res_fax: fix segfault on inactive "reserved" fax session
The change #10017 "Handle fax gateway being started more than once"
introdiced a bug which leads to segfault in res_fax_spandsp.

The res_fax_spandsp module does not support reserving sessions, so
fax_session_reserve returns a fax session with state AST_FAX_STATE_INACTIVE.

The fax_gateway_start does not create a real fax session if the fax session
is already present and the state is not AST_FAX_STATE_RESERVED.
But the "reserved" session created for res_fax_spandsp has state
AST_FAX_STATE_INACTIVE, so fax_gateway_start not starting.

Then when fax_gateway_framehook is called and gateway T.38 state is
NEGOTIATED the call of gateway->s->tech->write(gateway->s, f) leads to
segfault, because session tech_pvt is not set, i.e. the tech session
was not initialized/started.

This patch adds check also on AST_FAX_STATE_INACTIVE to the "reserved"
session created for res_fax_spandsp will start.

This patch also adds extra check and log ERROR if tech_pvt is not set
before call tech->write.

ASTERISK-27981 #close

Change-Id: Ife3e65e5f18c902db2ff0538fccf7d28f88fa803
2019-05-28 17:10:21 -04:00
Ben Ford ec74fd56a7 build: Fix file format in CHANGES-staging.
One of the change files doesn't conform to the format that the release
scripts need in order to parse it.

Change-Id: Ie0b634cf27e4cbc671b9fe92993b6f2ecf60254c
2019-05-24 08:03:40 -06:00
Guido Falsi 86fb72c4d0 chan_dahdi: add missing include.
After some definitions have been moved to asterisk/mwi.h the files
channels/chan_dahdi.h channels/sig_pri.c are missing this new
include.

ASTERISK-28427 #close

Change-Id: Ia8cc595eeda653324643f40dcd9799d4c3f0ac91
2019-05-23 08:49:11 -06:00
Friendly Automation 0fc6617246 Merge "res_rtp_asterisk: timestamp should be unsigned instead of signed int" into 16 2019-05-23 09:06:17 -05:00
George Joseph a99f814414 Merge "res_rtp_asterisk: Add ability to propose local address in ICE" into 16 2019-05-22 12:47:17 -05:00
Morten Tryfoss 9351aa3f0e res_rtp_asterisk: timestamp should be unsigned instead of signed int
Using timestamp with signed int will cause timestamps exceeding max value
to be negative.
This causes the jitterbuffer to do passthrough of the packet.

ASTERISK-28421

Change-Id: I9dabd0718180f2978856c50f43aac4e52dc3cde9
2019-05-22 08:46:55 -06:00
Alexei Gradinari db5bc0fabf app_blind_transfer: new application BlindTransfer
BlindTransfer redirects all channels currently bridged to the
caller channel to the specified destination.

This application can be useful with Custom Dynamic Features.
For example to make blind transfer to a predefined number.

features.conf
;;;
[applicationmap]
my_blindxfer => *6,self,GoSub,"my_blindxfer,s,1",default
;;;

extensions.conf
;;;
[globals]
DYNAMIC_FEATURES=my_blindxfer

[my_blindxfer]
exten => s,1,BlindTransfer(1234567890,default)
   same => n,Return()
;;;

This application also can be used to completly redefine Blind transfer
feature using dialplan. For example:

features.conf
;;;
[featuremap]
blindxfer =>

[applicationmap]
custom_blindxfer => ##,self,GoSub,"custom_blindxfer,s,1",default
;;;

extensions.conf
;;;
[globals]
DYNAMIC_FEATURES=custom_blindxfer

[custom_blindxfer]
exten => s,1,
   same => n,Playback(pbx-transfer)
   same => n,Read(dest,dial,10,i,3,3)
   same => n,BlindTransfer(${dest},default)
   same => n,Return()
;;;

Change-Id: I9d55e7f69ccfd4472dec00d62771d6de8803215a
2019-05-21 16:02:54 -04:00
Alexei Gradinari 9516fb64c9 app_readexten: new option 'p' to stop reading on '#' key
This patch adds the 'p' option.
The extension entered will be considered complete when a # is entered.

Change-Id: If77c40c9c8b525885730821e768f5dea71cf04c1
2019-05-21 10:29:27 -04:00
Joshua Colp 33ed2e1bb8 pjproject-bundled: Add upstream timer fixes
Fixed #2191:
  - Stricter double timer entry scheduling prevention.
  - Integrate group lock in SIP transport, e.g: for add/dec ref,
    for timer scheduling.

ASTERISK-28161
Reported-by: Ross Beer

Change-Id: I2e09aa66de0dda9414d8a8259a649c4d2d96a9f5
2019-05-20 14:46:38 -03:00
George Joseph 79b15d0b30 res_rtp_asterisk: Add ability to propose local address in ICE
You can now add the "include_local_address" flag to an entry in
rtp.conf "[ice_host_candidates]" to include both the advertized
address and the local address in ICE negotiation:

[ice_host_candidates]
192.168.1.1 = 1.2.3.4,include_local_address

This causes both 192.168.1.1 and 1.2.3.4 to be advertized.

Change-Id: Ide492cd45ce84546175ca7d557de80d9770513db
2019-05-17 17:49:57 -06:00
Joshua Colp 2aa9bc6d2c Merge "res_rtp_asterisk: Fix sequence number cycling and packet loss count." into 16 2019-05-15 17:48:51 -05:00
Friendly Automation 2de4f668be Merge "conversions.c: Add conversions for largest max sized integer" into 16 2019-05-15 07:01:43 -05:00
Friendly Automation a1a8c47f53 Merge "Fixes for GCC 9" into 16 2019-05-15 06:27:01 -05:00
Friendly Automation 790b9223ed Merge "build: Pass --fno-partial-inlining to third-party when appropriate" into 16 2019-05-15 05:47:32 -05:00
Alexei Gradinari de82bdd746 pjsip: replace 180 by 183 if SDP negotiation has completed
The caller endpoint hears dead silence if a callee replies 180 (without SDP)
and the caller already received 183 (with SDP).
It happens because Asterisk sends 180 (WITH SDP) to the caller,
there are not incoming RTP packets from the callee
and Asterisk does not generate inband ringing,
so there are not any outgoing RTP packets to the caller.

This patch replaces 180 by 183 if SDP negotiation has completed,
as if the caller endpoint is configured with "inband_progress=yes".

In this case Asterisk will generate inband ringing untill Asterisk receive
incoming RTP packets from the callee.

ASTERISK-27994 #close

Change-Id: I7450b751083ec30d68d6abffe922215a15ae5a73
2019-05-13 17:09:08 -04:00
Joshua Colp cf2f8db1b7 Merge "pjsip_options.c: Allow immediate qualifies for new contacts." into 16 2019-05-13 14:14:45 -05:00
George Joseph e7734476c6 Fixes for GCC 9
Various fixes for issues caught by gcc 9.  Mostly snprintf
trying to copy to a buffer potentially too small.

ASTERISK-28412

Change-Id: I9e85a60f3c81d46df16cfdd1c329ce63432cf32e
2019-05-10 10:17:27 -06:00
Joshua Colp ece29db9bd res_rtp_asterisk: Fix sequence number cycling and packet loss count.
This change fixes two bugs which both resulted in the packet loss
count exceeding 65,000.

The first issue is that the sequence number check to determine if
cycling had occurred was using the wrong variable resulting in the
check never seeing that cycling has occurred, throwing off the
packet loss calculation. It now uses the correct variable.

The second issue is that the packet loss calculation assumed that
the received number of packets in an interval could never exceed
the expected number. In practice this isn't true due to delayed
or retransmitted packets. The expected will now be updated to
the received number if the received exceeds it.

ASTERISK-28379

Change-Id: If888ebc194ab69ac3194113a808c414b014ce0f6
2019-05-08 15:41:43 +00:00
Ben Ford 941dead08d pjsip_options.c: Allow immediate qualifies for new contacts.
When multiple endpoints try to register close together using the same
AOR with qualify_frequency set, one contact would qualify immediately
while the other contacts would have to wait out the duration of the
timer before being able to qualify. Changing the conditional to check
the contact container count for a non-zero value allows all contacts to
qualify immediately.

Change-Id: I79478118ee7e0d6e76af7c354d66684220db9415
2019-05-07 10:26:10 -06:00
Kevin Harwell edc3e0df1a conversions.c: Add conversions for largest max sized integer
Added a conversion for umax (largest maximum sized integer allowed). Adjusted
the other current conversion functions (uint and ulong) to be derivatives of
the umax conversion since they are simply subsets of umax.

Also made the negative check move the pointer on spaces since strtoumax does it
anyways.

Change-Id: I56c2ef2629d49b524c8df58af12951c181f81f08
2019-05-06 16:26:46 -05:00
agupta 9a0fa51443 stasis: Hangup channel for Local channel No such extension error
When we use early bridge with create and dial from stasis using Local channel
and the dialplan does not any entry the it is returned from core_local.c with
No such extension .

In such case asterisk locks up till the channel is not hangup with the error
Exceptionally long voice queue length

* Found that in such case app_control_dial fails on ast_call method and
  return -1
* Since it is called from stasis_app_send_command_async and return -1 does
  not cause resources to be freed and since no PBX exist it is not able to
  read from channel causing exceptionally long queue
* After putting this code found that the channel was releasing immediately
  and resources were freed.

ASTERISK-28399
Reported by: Abhay Gupta
Tested by: Abhay Gupta

Change-Id: I0a55c923fc6995559f808d63b9488762b4489318
2019-05-06 07:26:55 -03:00
George Joseph 543d487746 build: Pass --fno-partial-inlining to third-party when appropriate
When the gcc version is >= 8.2.1, we were already setting the
--fno-partial-inlining flag for Asterisk source files to get around
a gcc bug but we weren't passing the flag down to the bundled
builds of pjproject and jansson.

ASTERISK-28392

Change-Id: I99ede9bc35408ecd096f7d5369e8192d3dc75704
2019-05-03 12:36:38 -06:00
Joshua Colp 8357ab7e9a Merge "app_confbridge: Add "all" variants of REMB behavior." into 16 2019-05-03 10:53:21 -05:00
Friendly Automation 27696cbda6 Merge "stasis: Only place stasis created and dialed channels into dial bridge." into 16 2019-05-03 10:47:18 -05:00
Friendly Automation 748f1d64a1 Merge "stasis: Call callbacks when imparting fails" into 16 2019-05-03 10:13:16 -05:00
Friendly Automation 7bddfdbfa6 Merge "rtp: Add support for transport-cc in receiver direction." into 16 2019-05-03 10:08:16 -05:00
George Joseph 5002169d6a res_pjsip: Check return from pjsip_parse_uri calls
Updated ast_sip_create_rdata_with_contact and registrar_find_contact
to check the return from pjsip_parse_uri before attempting to
use the uri returned.

ASTERISK-28402
Reported-by: Ross Beer

Change-Id: I9810b3b163c45ed5a56ec743586e5ce107f13ba7
2019-05-02 12:32:31 -06:00
agupta 39c5188bec stasis: Only place stasis created and dialed channels into dial bridge.
The dial bridge is meant to hold channels which have been created
and dialed in stasis. It handles the frames coming from them and raises
the appropriate events.

It was possible for the code to mistakenly place calls which came
from the dialplan into the dial bridge if they were not in an
answered state. These channels are not outgoing channels and
should not be placed into the dial bridge.

The code now checks to ensure that only stasis created channels are
placed into the dial bridge by checking that a PBX does not exist
on the channel.

ASTERISK-27756

Change-Id: Ideee69ff06c9a0b31f7ed61165f5c055f51d21b6
2019-05-02 15:41:14 +00:00
Holger Hans Peter Freyther f599ebd29e stasis: Call callbacks when imparting fails
After a bridge has been deleted the stasis control will depart
the channel and might attempt to re-add it to the dial bridge.

The later can fail and this can lead to a situation that the stasis
control is unlinked but the after_bridge_cb_failed cb is executed trying
to access a dangling control object.

Fix it by calling the after_cb's before bridge_channel_impart_signal.

ASTERISK-26718

Change-Id: Ib4e8f70d7a21bd54afe3cb51cc6717ef7c355496
2019-05-02 15:28:21 +00:00
Joshua Colp d861ebdca8 app_confbridge: Add "all" variants of REMB behavior.
When producing a combined REMB value the normal behavior
is to have a REMB value which is unique for each sender
based on all of their receivers. This can result in one
sender having low bitrate while all the rest are high.

This change adds "all" variants which produces a bridge
level REMB value instead. All REMB reports are combined
together into a single REMB value that is the same for
each sender.

ASTERISK-28401

Change-Id: I883e6cc26003b497c8180b346111c79a131ba88c
2019-05-02 13:29:09 +00:00
Joshua Colp 5023f02b2d rtp: Add support for transport-cc in receiver direction.
The transport-cc draft is a mechanism by which additional information
about packet reception can be provided to the sender of packets so
they can do sender side bandwidth estimation. This is accomplished
by having a transport specific sequence number and an RTCP feedback
message. This change implements this in the receiver direction.

For each received RTP packet where transport-cc is negotiated we store
the time at which the RTP packet was received and its sequence number.
At a 1 second interval we go through all packets in that period of time
and use the stored time of each in comparison to its preceding packet to
calculate its delta. This delta information is placed in the RTCP
feedback message, along with indicators for any packets which were not
received.

The browser then uses this information to better estimate available
bandwidth and adjust accordingly. This may result in it lowering the
available send bandwidth or adjusting how "bursty" it can be.

ASTERISK-28400

Change-Id: I654a2cff5bd5554ab94457a14f70adb71f574afc
2019-04-30 20:27:24 +00:00
Friendly Automation f2cb892d7c Merge "mwi core: Move core MWI functionality into its own files" into 16 2019-04-30 10:12:23 -05:00
Friendly Automation a6863e5beb Merge "app_amd: Fix infinite loop on silent calls" into 16 2019-04-30 10:03:59 -05:00
Friendly Automation 60d13c3d56 Merge "stasis: Fix crash at shutdown." into 16 2019-04-30 05:50:18 -05:00
agupta 1d214a3623 app_amd: Fix infinite loop on silent calls
The total time logic will now be executed on calls which
do not pass any media.

ASTERISK-28143

Change-Id: I24726bd29d7e467fc721ca265363417234b22855
2019-04-30 10:14:36 +00:00
Ben Ford 8d35a30a3f stasis: Fix crash at shutdown.
When compiling in dev mode, stasis statistics are enabled and can cause
a crash at shutdown due to the following:
- Containers are freed
- Topics and subscriptions remain
- When those topics and subscriptions are deallocated, they go to do
  things with the container

This changes the containers to global ao2 objects, and whenever needed
in the code, a reference must be obtained and checked before any
operations can be done.

ASTERISK-28353 #close

Change-Id: Ie7d5e907fcfcb4d65bd36d5e4eb923126fde8d33
2019-04-24 07:47:49 -06:00
Antoni Goldstein d6b37e2926 app_dial.c: RINGTIME, PROGRESSTIME and ms resolution dial timings
Added RINGTIME, RINGTIME_MS, PROGRESSTIME, PROGRESSTIME_MS variables filled
at the earliest received PROGRESS or RINGING.
Added millisecond versions of DIALEDTIME and ANSWEREDTIME.

Added millisecond versions of ast_channel_get_up_time and
ast_channel_get_duration in channel.c.

ASTERISK-28363

Change-Id: If95f1a7d8c4acbac740037de0c6e3109ff6620b1
2019-04-24 06:27:33 -06:00
Kevin Harwell e3a758975d mwi core: Move core MWI functionality into its own files
There is enough MWI functionality to warrant it having its own 'c' and header
files. This patch moves all current core MWI data structures, and functions
into the following files:

main/mwi.h
main/mwi.c

Note, code was simply moved, and not modified. However, this patch is also in
preparation for core MWI changes, and additions to come.

Change-Id: I9dde8bfae1e7ec254fa63166e090f77e4d3097e0
2019-04-23 17:39:57 -05:00
Friendly Automation 92712891f9 Merge "ARI: Bump non-breaking version number to 4.0.2" into 16 2019-04-23 16:42:44 -05:00
Friendly Automation 641414faf9 Merge "core/buildsystem: check the actual compiler being version" into 16 2019-04-23 15:26:12 -05:00
George Joseph e281911667 ARI: Bump non-breaking version number to 4.0.2
main/json.c: Added app_name, app_data to channel type
res/res_ari: Added ARI resource /ari/channels/{channelId}/rtp_statistics
res/res_ari: Added timestamp as a requirement for all ARI events

Change-Id: I6363f2a3e757cfd59b2ee5d056388ec47659a0c9
2019-04-22 10:17:54 -06:00
Guido Falsi 4dcfa8d127 core/buildsystem: check the actual compiler being version
Make compiler check use the output of the actual compiler being
used as reported by the CC variable, instead of unconditionally
running the "gcc" binary.  Also only run the check if the compiler
is gcc or a cross-compile gcc.

ASTERISK-28374

Change-Id: Icaacf6d93686ad21076878aa1504a23b4fc9d0f4
2019-04-22 07:05:26 -06:00
Lucas Mendes daed593cfa res_indications: Fix indications remove command autocomplete
We changed the validation of autocomplete parameter in the "indications
remove" command to avoid continue the execution of the command after
asking for autocomplete out of range parameters.

ASTERISK-28391
Reported by: lmendes86

Change-Id: I92b24131fd02f2e3c7fec966eea6f7a663310d40
2019-04-19 09:33:11 -06:00
Friendly Automation 6ec4b113c1 Merge "loader: support for permanent dlopen()" into 16 2019-04-19 08:32:13 -05:00
Friendly Automation 74d79bdf71 Merge "res_pjsip: Added a norefersub configuration setting" into 16 2019-04-19 08:27:53 -05:00
Friendly Automation 93d36953fb Merge "res_remb_modifier: Propertly initialize bitrate to 0.0" into 16 2019-04-18 11:44:23 -05:00
George Joseph 7487fc88d2 res_remb_modifier: Propertly initialize bitrate to 0.0
...and return the frame unaltered if bitrate can't be determined.

Change-Id: Ib2175ab84f85a3d7060d31625f5a2c7fbcc2ba4c
2019-04-18 11:04:00 -03:00
Friendly Automation bc45d0497c Merge "res_mwi_devstate: Specify AST_MODFLAG_LOAD_ORDER to enable load priority" into 16 2019-04-18 05:46:02 -05:00
Dan Cropp eca8c440d2 res_pjsip: Added a norefersub configuration setting
Added a new PJSIP global setting called norefersub.
Default is true to keep support working as before.

res_pjsip_refer:  Configures PJSIP norefersub capability accordingly.

Checks the PJSIP global setting value.
If it is true (default) it adds the norefersub capability to PJSIP.
If it is false (disabled) it does not add the norefersub capability
to PJSIP.

This is useful for Cisco switches that do not follow RFC4488.

ASTERISK-28375 #close
Reported-by: Dan Cropp

Change-Id: I0b1c28ebc905d881f4a16e752715487a688b30e9
2019-04-17 11:09:12 -05:00
Friendly Automation c9ca88ae7d Merge "pbx.c: Ignore dashes in extensions when using extenpatternmatchnew" into 16 2019-04-16 12:16:28 -05:00
Friendly Automation ff7b0acc4e Merge "app_voicemail: Don't split mailbox options on comma" into 16 2019-04-16 11:36:27 -05:00
Sean Bright 022e784b7a res_mwi_devstate: Specify AST_MODFLAG_LOAD_ORDER to enable load priority
Suggested by abelbeck on the issue tracker.

ASTERISK~28384
Reported by: abelbeck

Change-Id: Icee0fff2b58dbfaa80f2b68270fe69dfb0463fc0
2019-04-16 10:05:12 -06:00
Benjamin Keith Ford 873280c708 Merge "build: Revise CHANGES and UPGRADE.txt handling." into 16 2019-04-16 10:52:34 -05:00
Joshua Colp 7a6895baf5 Merge "res_ael: Use Gosub in for loop expressions" into 16 2019-04-16 08:11:40 -05:00
Joshua Colp d734e1bbfa Merge "ARI: Run 'make ari-stubs'" into 16 2019-04-16 07:29:41 -05:00
Joshua Colp 95dac45148 Merge "res_ael: Fix pattern matching against literal '+'" into 16 2019-04-16 07:25:48 -05:00
George Joseph 18fe583d12 CI: Move test group config files to Jenkins
One of the downaides of having things like test configuration
in the git repo is that it can't be changed at runtime.  You have
to create a review for the changes and merge it mefore it will
take effect.

This review moves the data currently held in
tests/CI/periodic-dailyTestGroups.json and
tests/CI/gateTestGroups.json into a Jenkins Config File attached
to the job definitions.  This allows us to alter it from the
Jenkins UI at runtime.  The original files stay in the repo
as documentation.

Change-Id: I14b9702f6285ce1fb2420287ba0e7d3b59109763
2019-04-15 06:51:26 -06:00
Sean Bright d0a8334e4f app_voicemail: Don't split mailbox options on comma
Because the per-mailbox options are the last thing on a line, don't look
for or stomp on any subsequent commas.

ASTERISK-27935 #close
Reported by: Sébastien Duthil

Change-Id: I07b2eb4a33c303d0c7114d5b906f8c067c60a153
2019-04-13 12:39:30 -06:00
George Joseph 03b6d18e99 Merge "res_ael: Create consistent label names across reloads" into 16 2019-04-12 14:16:27 -05:00
George Joseph 62cf7eae92 Merge "pbx.c: Properly parse labels with leading digits" into 16 2019-04-12 14:16:06 -05:00
George Joseph a53f54856d Merge "app_voicemail: Cleanup stale lock files on module load" into 16 2019-04-12 11:10:03 -05:00
Sean Bright 9b7a64cbf0 pbx.c: Ignore dashes in extensions when using extenpatternmatchnew
Because hyphens are not matched literally in Asterisk dialplan, we need
to ignore them in our candidate extensions as well.

ASTERISK-17695 #close
Reported by: test011

Change-Id: I227f02301577b1633e8a55b9fe9dc149935c03f0
2019-04-12 09:23:18 -06:00
Friendly Automation 49b751d153 Merge "chan_ooh323: fix h323 log file path" into 16 2019-04-12 09:18:36 -05:00
Sean Bright 34b9b65098 app_voicemail: Cleanup stale lock files on module load
If Asterisk crashes while a VM directory is locked, lock files in the VM
spool directory will not get properly cleaned up. We now clear them on
module load.

ASTERISK-20207 #close
Reported by: Steven Wheeler

Change-Id: If40ccd508e2f6e5ade94dde2f0bcef99056d0aaf
2019-04-12 07:13:56 -06:00
George Joseph 898765d919 ARI: Run 'make ari-stubs'
An earlier contributor apparently forgot to run 'make ari-stubs'
before committing after making ARI model changes.

Change-Id: I7813e5638e2821d11f4b968dc2aeab4f725190a6
2019-04-12 06:33:10 -06:00
Sean Bright 116dc9c9b3 res_ael: Create consistent label names across reloads
Reset the internal counter that the AEL2 compiler uses for unique label
names before compiling. This keeps dialplan labels consistent across
reloads assuming the AEL2 has not changed.

ASTERISK-17799 #close
Reported by: Kirill Katsnelson

Change-Id: I30b3cc887d1ee0644d3f341e2fef16f525d7fae5
2019-04-11 14:53:45 -06:00
Sean Bright ea3109beaa res_ael: Use Gosub in for loop expressions
In AEL2, if a 'for' statement contains macro* calls, like:

    for (&iterator(${TRY},A); "${A}" != ""; &iterate(A)) {

The AEL2 parser will translate these into calls to the deprecated Macro
dialplan application and use the antiquated pipe delimiter.

Instead, convert these into calls to the Gosub dialplan application and
use commas as argument separators.

ASTERISK-18593 #close
Reported by: Luke-Jr

* 'macro' in this context means AEL2 macros, not the 'Macro' application

Change-Id: I3d73716033b8e3e42e0209d355bf5f10c97045fc
2019-04-11 14:38:12 -06:00
Sean Bright 71c7864d1d res_ael: Fix pattern matching against literal '+'
When generating the regular expression that matches against existing
extensions, we need to escape literal characters that can also be
regular expression metacharacters. This was already being done for '*'
but we need to do the same for '+'.

In passing, remove some unreachable code - strcmp() is already run
immediately when entering extension_matches().

ASTERISK-14939 #close
Reported by: klaus3000

Change-Id: I8d2cccb3479168fba1b0a6704c52198b396468f1
2019-04-11 14:10:33 -06:00
Friendly Automation fbed32a1a5 Merge "res_pjsip: Fix transport_states ref leak" into 16 2019-04-11 14:57:27 -05:00
Sean Bright f91262272e pbx.c: Properly parse labels with leading digits
If the target of a Goto is a label that starts with a number, we
erroneously treat the leading digits as a priority.

ASTERISK-20182 #close
Reported by: Janu

Change-Id: Ia78408c0805a729103917247ecfc802f6fafc94b
2019-04-11 12:37:54 -06:00
Alexander Anikin eec16b8e99 chan_ooh323: fix h323 log file path
Change h323 log path relative to AST_LOG_DIR instead of
/var/log/asterisk hardcoded
Add return back error message from OOH323EP initialize

ASTERISK-28348 #close

Reported by: Dmitry Shubin

Change-Id: Ib102dd36bbe6c2a7a4ce6870ae9110d9000d7e98
2019-04-11 11:28:02 -06:00
George Joseph b414cf09ac Merge "chan_pjsip: DTMF Mode auto_info fallback lead to both inband and info" into 16 2019-04-10 12:43:04 -05:00
Alexei Gradinari acfbfef8ad res_pjsip: Fix transport_states ref leak
Add missing ao2_ref(transport_state, -1) while iterate on a transport_states
container.

Change-Id: I40e35b5a339121300c80075c30db47201a6c374e
2019-04-10 10:24:11 -04:00
Joshua Colp 0dde010f13 Merge "config.c: Fix a crash in extconfig parsing" into 16 2019-04-10 06:41:02 -05:00
Ben Ford ef404fef91 build: Revise CHANGES and UPGRADE.txt handling.
This changes the way that we handle adding changes to CHANGES and
UPGRADE.txt. The reason for this is because whenever someone needed to
make a change to one of these files and someone else had already done
so, you would run into merge conflicts. With this new setup, there will
never be merge conflicts since all changes will be documented in the
doc/<file>-staging directory. The release script is now responsible for
merging all of these changes into the appropriate files.

There is a special format that these files have to follow in order to be
parsed. The files do not need to have a meaningful name, but it is
strongly recommended. For example, if you made a change to pjsip, you
may have something like this "res_pjsip_relative_title", where
"relative_title" is something more descriptive than that. Inside each
file, you will need a subject line for your change, followed by a
description. There can be multiple subject lines. The file may look
something like this:

   Subject: res_pjsip
   Subject: Core

   A description that explains the changes made and why. The release
   script will handle the bulleting and section separators!

   You can still separate with new lines within your
   description.

The headers ("Subject" and "Master-Only") are case sensative, but the
value for "Master-Only" ("true" or "True") is not.

For more information, check out the wiki page:
https://wiki.asterisk.org/wiki/display/AST/CHANGES+and+UPGRADE.txt

ASTERISK-28111 #close

Change-Id: I19cf4b569321c88155a65e9b0b80f6d58075dd47
2019-04-09 09:43:00 -05:00
George Joseph 0fb456d2ae Merge "CI: Add --no-dev-mode option to buildAsterisk.sh" into 16 2019-04-08 11:09:13 -05:00
George Joseph 1988cf795c Merge "stasis.c: Added topic_all container" into 16 2019-04-08 10:53:08 -05:00
Friendly Automation 777ee8290a Merge "main/json.c: Added app_name, app_data to channel type" into 16 2019-04-08 10:32:34 -05:00
Friendly Automation 90781674ad Merge "res/res_ari: Added ARI resource /ari/channels/{channelId}/rtp_statistics" into 16 2019-04-08 10:05:36 -05:00
Chris-Savinovich 85bbb7a3e8 config.c: Fix a crash in extconfig parsing
When extconfig.conf file is parsed, the code previously searched for
character comma without verifying if error (null or blank).  This caused
a segmentation error.

Change-Id: Id76b452d8f330d11c2742c37232761ad71472a8b
2019-04-05 16:40:23 -05:00
Salah Ahmed 7e5b4b8616 chan_pjsip: DTMF Mode auto_info fallback lead to both inband and info
When the dtmf_mode on an endpoint is configured as "auto_info"
Asterisk will produce an inband DTMF tone alongside an INFO
message when sending DTMF.

ASTERISK-28371

Change-Id: I1380b82f006e110a1b83fbb50c9873edd13a5d9a
2019-04-05 09:42:25 -06:00
sungtae kim d5a318f148 main/json.c: Added app_name, app_data to channel type
It was difficult to check the channel's current application and
parameters using ARI for current channels. Added app_name, app_data
items to show the current application information.

ASTERISK-28343

Change-Id: Ia48972b3850e5099deab0faeaaf51223a1f2f38c
2019-04-05 02:33:14 +02:00
Sebastian Kemper 8ec4de7501 loader: support for permanent dlopen()
Asterisk assumes that dlopen() will always run the constructor of a
shared library and every dlclose() will run its destructor. But dlopen()
may be permanent, meaning the constructor will only be run once, as is
the case with musl libc.

With a permanent dlopen() the Asterisk module loader does not work
correctly, because it's expectations regarding when the constructors and
destructors are run are not met. In fact a segmentation fault will occur
when the first module is "re-opened" that has AST_MODFLAG_GLOBAL_SYMBOLS
set (the dlopen() does not call the constructor, resource_being_loaded
is not set to NULL, then strlen is called with NULL instead of a string,
see issue ASTERISK-28319).

This commit adds code to the loader that will manually run the
constructors/destructors of the (non-builtin) modules where needed. To
achieve this a new ao2 container (linked list) is started and filled
with objects that contain the names of the modules and the pointers to
their respective info structs.

This behavior can be activated when configuring Asterisk
(--enable-permanent-dlopen). By default this is disabled, of course.

ASTERISK-28319 #close

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
Change-Id: I86693a0ecf25d5ba81c73773a03df4abc3426875
2019-04-04 13:14:58 -06:00
Joshua Colp 4f0b8c3ed3 Merge "bridge_softmix: use a float type to store the internal REMB bitrate" into 16 2019-04-04 08:57:12 -05:00
Friendly Automation b394eed481 Merge "res/res_rtp_asterisk: Enable rxjitter calculation for video" into 16 2019-04-04 08:33:43 -05:00
George Joseph 1464a6b80f CI: Add --no-dev-mode option to buildAsterisk.sh
The new option disables dev mode, TEST_FRAMEWORK and
MALLOC_DEBUG making the build more production-like.

Change-Id: Ieb72497d4d91d5416684aaed702cc3f532099738
2019-04-03 16:56:34 -06:00
Ben Ford 8961d9ca8b build: Fix compiler warnings/errors.
The compiler complained about a couple of variables that weren't
initialized but were being used. Initializing them to NULL resolves the
warnings/errors.

ASTERISK-28362 #close

Change-Id: I6243afc5459b416edff6bbf571b0489f6b852e4b
2019-04-03 09:36:42 -06:00
Kevin Harwell 94eeba6147 bridge_softmix: use a float type to store the internal REMB bitrate
REMB's exponent is 6-bits (0..63) and has a mantissa of 18-bits. We were using
an unsigned integer to represent the bitrate. However, that type is not large
enough to hold all potential bitrate values. If the bitrate is large enough
bits were being shifted off the "front" of the mantissa, which caused the
wrong value to be sent to the browser.

This patch makes it so it now uses a float type to hold the bitrate. Using a
float allows for all bitrate values to be correctly represented.

ASTERISK-28255

Change-Id: Ice00fdd16693b16b41230664be5d9f0e465b239e
2019-04-02 11:32:58 -05:00
George Joseph 5f21b5f3df Merge "pjproject: Add timer patch from pjproject r5934" into 16 2019-04-02 10:28:44 -05:00
Matthew Fredrickson ae1aeb930e res/res_rtp_asterisk: Enable rxjitter calculation for video
It looks like we're not properly calculating jitter values on received
video streams.  This patch enables the code that does jitter calculations
for those streams.

Change-Id: Iaac985808829c8f034db8c57318789c4c8c11392
2019-04-02 08:53:54 -06:00
Sean Bright 6f5a6072ab app_queue: Fix a few member pause bugs
* Always set member->lastpause when setting member->paused

* Fixed typo (using member->lastcall instead of member->lastpause) in
  'queue show' output.

* Use a constant 'now' in 'queue show' output for a better point-in-time
  view of time based stats.

ASTERISK-27541 #close
Reported by: César Benjamín García Martínez

Change-Id: Ib41ced90cfdb66f9bb1e7b263d0f6fc1ac6e18fa
2019-03-29 09:13:23 -04:00
Ben Ford 64279e5992 alembic: Fix errors during upgrade head.
When trying to upgrade using alembic, a couple different errors kept
popping up that prevented the upgrade. An additional parameter was
needed when changing the schema for mwi_subscribe_replaces_unsolicited
from an integer to an enum. When changing from a string to an enum, the
type needed to be cast for postgresql. The other issue was a parameter
being used during column creation that did not exist.

After fixing the upgrade process, it revealed errors with the downgrade
process. One was a variable not being defined in the downgrade function,
and the other was tables not existing when using MySQL. This was due to
a context check that should have encompassed MySQL, but in the end was
not doing so.

Change-Id: Ib4d70cf3ce5080023a50be496272a777b55d6c8e
2019-03-28 08:17:50 -06:00
George Joseph bc06a13123 Merge "pjsip: restrict function PJSIP_PARSE_URI to parse only SIP/SIPS URIs" into 16 2019-03-28 08:04:31 -05:00
sungtae kim 5815597a21 stasis.c: Added topic_all container
Added topic_all container for centralizing the topic. This makes more
easier to managing the topics.

Added cli commands.
stasis show topics : It shows all registered topics.
stasis show topic <name> : It shows speicifed topic's detail info.

ASTERISK-28264

Change-Id: Ie86d125d2966f93de74ee00f47ae6fbc8c081c5f
2019-03-27 17:57:30 -06:00
Friendly Automation eebc98fa44 Merge "manager: Use separate lock for session event notification." into 16 2019-03-27 17:42:56 -05:00
sungtae kim bbc13b1f1f res/res_ari: Added ARI resource /ari/channels/{channelId}/rtp_statistics
Added ARI resource for channel statistics.
GET /ari/channels/{channelId}/rtp_statistics : It returns given
channel's rtp statistics detail.

ASTERISK-28320

Change-Id: I4343eec070438cec13f2a4f22e7fd9e574381376
2019-03-27 15:07:26 -06:00
George Joseph 0bcbf97cb7 Merge "build: Add staging directories for future changes." into 16 2019-03-27 14:25:21 -05:00
Friendly Automation 5592ae465e Merge "app_queue: Fix documentation for QUEUE_MEMBER function." into 16 2019-03-27 13:32:59 -05:00
Ben Ford 636e301f91 build: Add staging directories for future changes.
This is the first step in changing the release process so that changes
made to the CHANGES and UPGRADE.txt files do not result in merge
conflicts every time multiple people modify these files. The changes
made will go in these new directories: doc/CHANGES-staging and
doc/UPGRADE-staging. The README.md files explain how things will work,
but here's a little overview. When you make a change that would go in
either CHANGES or UPGRADE.txt, this should instead be documented in a
new file in the doc/CHANGES-staging or doc/UPGRADE-staging directory,
respectively. The format will look like this:

   Subject: res_pjsip

   A description that explains the changes made and why. The release
   script will handle the bulleting and section separators! The
   'Subject:' header is case-sensitive.

   You can still separate with new lines within your description.

   Subject: res_ari
   Master-Only: true

   You can have more than one subject, and they don't have to be the
   same! Also, the 'Master-Only' header should always be true and is
   also case-sensitive (but the value is not - you can have 'true' or
   'True'). This header will only ever be present in the master branch.

For more information, check out the wiki page:
https://wiki.asterisk.org/wiki/display/AST/CHANGES+and+UPGRADE.txt

This is an initial change for ASTERISK_28111. Functionally, this will
make no difference, but it will prep the directories for when the
changes from CHANGES and UPGRADE.txt are extracted.

Change-Id: I8d852f284f66ac456b26dcb899ee46babf7d15b6
2019-03-27 12:32:48 -06:00
Sean Bright d4cd2a9706 pjproject: Add timer patch from pjproject r5934
ASTERISK-28161 #close
Reported by: Ross Beer

Change-Id: I65331d554695753005eaa66c1d5d4807fe9009c8
2019-03-27 08:09:50 -06:00
Friendly Automation e1b0961fce Merge "chan_sip: Ensure 'qualifygap' isn't negative" into 16 2019-03-27 06:02:12 -05:00
Sean Bright 3e5b26ae0a app_queue: Fix documentation for QUEUE_MEMBER function.
It was a copy/paste of the QUEUE_MEMBER_COUNT function's synopsis.

ASTERISK-20986 #close
Reported by: Olivier Krief

Change-Id: If51ec481feb35824a4e78ab5600b197b819b10be
2019-03-26 15:57:04 -06:00
Friendly Automation 03c5b916ff Merge "res/res_ari: Added timestamp as a requirement for all ARI events" into 16 2019-03-26 08:52:45 -05:00
George Joseph 4ec943fdee Merge "res_config_odbc: set empty extended field as a single whitespace" into 16 2019-03-26 08:48:12 -05:00
Joshua Colp 4d8cd2efbe manager: Use separate lock for session event notification.
When notifying a manager session that new events were available
the same lock was used that was also held when doing things within
the session (such as sending events out). If the manager session
blocked for a period of time this would cause a back up of messages
in Stasis and would also block any other sessions from receiving
events.

This change adds a separate lock to the manager session which is
strictly used for notifying it that new events are available.

ASTERISK-28350

Change-Id: Ifbcac007faca9ad0231640f5e82a6ca9228f261b
2019-03-26 07:37:29 -06:00
Alexei Gradinari e51bd0726b pjsip: restrict function PJSIP_PARSE_URI to parse only SIP/SIPS URIs
The next usage of PJSIP_PARSE_URI will crash asterisk
${PJSIP_PARSE_URI(tel:+1234567890,host)}
or
${PJSIP_PARSE_URI(192.168.1.1:5060,host)}

The function pjsip_parse_uri successfully parses then, but returns
struct pjsip_other_uri *.

This patch restricts parsing only SIP/SIPS URIs.

Change-Id: I16f255c2b86a80a67e9f9604b94b129a381dd25e
2019-03-25 19:17:02 -04:00
sungtae kim 6d455487d9 res/res_ari: Added timestamp as a requirement for all ARI events
Changed to requirement to having timestamp for all of ARI events.
The below ARI events were changed to having timestamp.
PlaybackStarted, PlaybackContinuing, PlaybackFinished,
RecordingStarted, RecordingFinished, RecordingFailed,
ApplicationReplaced, ApplicationMoveFailed

ASTERISK-28326

Change-Id: I382c2fef58f5fe107e1074869a6d05310accb41f
2019-03-25 14:09:18 -06:00
Sean Bright d905602a04 chan_sip: Ensure 'qualifygap' isn't negative
Passing negative intervals to the scheduler rips a hole in the
space-time continuum.

ASTERISK-25792 #close
Reported by: Paul Sandys

Change-Id: Ie706f21cee05f76ffb6f7d89e9c867930ee7bcd7
2019-03-25 13:32:38 -06:00
Alexei Gradinari 634314c727 res_config_odbc: set empty extended field as a single whitespace
If Realtime @ variable value is NULL or empty or contains only whitespaces
then when we try to retrieve it using PJSIP_ENDPOINT we get WARNING
pjsip_endpoint_function_read: Unknown property @my_var for PJSIP endpoint.
And the variable is missing in the result of CLI pjsip show endpoint.

This patch keeps empty sorcery extended field.

ASTERISK-28341 #close

Change-Id: I221fccc04cbfa2be17ce971f64ae0e74e465eea0
2019-03-25 12:43:25 -04:00
Matthew Fredrickson ce5bed44e4 main/taskprocessor: Increase max name length of taskprocessors
Since the new names went in, the maximum taskprocessor name is too
short.  This patch increases the name field to a length to better
handle the new names.

Change-Id: I32f32d6926f25c8ef5a91303fd2988d2c2858877
2019-03-25 07:14:44 -06:00
Friendly Automation c7d29cdcf2 Merge "sorcery.c: Sorcery enhancements for wizard management" into 16 2019-03-19 09:51:29 -05:00
George Joseph 396dac8888 Merge "res/res_stasis: Fixed wrong StasisEnd timestamp" into 16 2019-03-19 09:27:05 -05:00
George Joseph 7bdde83f2c sorcery.c: Sorcery enhancements for wizard management
Added ability to specifiy a wizard is read-only when applying
it to a specific object type.  This allows you to specify
create, update and delete callbacks for the wizard but limit
which object types can use them.

Added the ability to allow an object type to have multiple
wizards of the same type.  This is indicated when a wizard
is added to a specific object type.

Added 3 new sorcery wizard functions:

* ast_sorcery_object_type_insert_wizard which does the same thing
  as the existing ast_sorcery_insert_wizard_mapping function but
  accepts the new read-only and allot-duplicates flags and also
  returns the ast_sorcery_wizard structure used and it's internal
  data structure. This allows immediate use of the wizard's
  callbacks without having to register a "wizard mapped" observer.

* ast_sorcery_object_type_apply_wizard which does the same
  thing as the existing ast_sorcery_apply_wizard_mapping function
  but has the added capabilities of
  ast_sorcery_object_type_insert_wizard.

* ast_sorcery_object_type_remove_wizard which removes a wizard
  matching both its name and its original argument string.

* The original logic in __ast_sorcery_insert_wizard_mapping was moved
  to __ast_sorcery_object_type_insert_wizard and enhanced for the
  new capabilities, then __ast_sorcery_insert_wizard_mapping was
  refactored to just call __ast_sorcery_insert_wizard_mapping.

* Added a unit test to test_sorcery.c to test the read-only
  capability.

Change-Id: I40f35840252e4313d99e11dbd80e270a3aa10605
2019-03-18 11:39:31 -06:00
Friendly Automation f151f72870 Merge "vector: Add AST_VECTOR_COMPACT() to reclaim wasted space" into 16 2019-03-18 06:29:10 -05:00
Joshua Colp 67db353598 Merge "Variable ALTCONF ignored when service is used in Debian" into 16 2019-03-18 05:33:17 -05:00
George Joseph aba1053a12 Merge "app.c: Remove deletion of pool topic on mwi state delete" into 16 2019-03-15 18:30:20 -05:00
sungtae kim 9e36707dca res/res_stasis: Fixed wrong StasisEnd timestamp
Because StasisEnd's timestamp created it's own timestamp, it makes
wrong timestamp, compare to other channel event(ChannelDestroyed).
Fixed to getting a timestamp from the Channel's timestamp.

ASTERISK-28333

Change-Id: I5eb8380fc472f1100535a6bc4983c64767026116
2019-03-15 15:38:17 -06:00
Sean Bright 057c7380be vector: Add AST_VECTOR_COMPACT() to reclaim wasted space
This might be useful in situations where you are loading an undetermined number
of items into a vector and don't want to keep (potentially) 2x the necessary
memory around indefinitely.

Change-Id: I9711daa0fe01783fc6f04c5710eba84f2676d7b9
2019-03-15 14:53:33 -06:00
Richard Mudgett 0426e0fede taskprocessor.c: Fix printf type mismatch
A size_t is not always an unsigned long.

* Use the %zu format specifier in the ast_cli() printf format string since
AST_VECTOR_SIZE() returns a size_t value.

Change-Id: Ib102dd36bbe6c2a7a4ce6870ae9110d978dd7e98
2019-03-14 12:46:16 -06:00
Joshua C. Colp 6f10c9cf4f Merge "AMI/ARI: Bump non-breaking version numbers" into 16 2019-03-14 09:48:38 -05:00
George Joseph f5f977baec app.c: Remove deletion of pool topic on mwi state delete
As part of an earlier voicemail refactor, ast_delete_mwi_state_full
was modified to remove the pool topic for a mailbox when the state
was deleted.  This was an attempt to prevent stale topics from
accumulating when app_voicemail was reloaded and a mailbox went
away.  Unfortunately because of the fact that when app_voicemail
reloads, ALL mailboxes are deleted then only current ones recreated,
topics were being removed from the pool that still had subscribers
on them, then recreated as new topics of the same name.  So now
modules like res_pjsip_mwi are listening on a topic that will
never receive any messages because app_voicemail is publishing on
a different topic that happens to have the same name.  The solutiuon
to this is not easy and given that accumulating topics for
deleted mailboxes is less evil that not sending NOTIFYs...

* Removed the call to stasis_topic_pool_delete_topic in
  ast_delete_mwi_state_full.

Also:

* Fixed a topic reference leak in res_pjsip_mwi
  mwi_stasis_subscription_alloc.

* Added some debugging to mwi_stasis_subscription_alloc,
  stasis_topic_create, and topic_dtor.

* Fixed a topic reference leak in an error path in
  internal_stasis_subscribe.

ASTERISK-28306
Reported-by: Jared Hull

Change-Id: Id7da0990b3ac4be4b58491536b35f41291247b27
2019-03-14 08:31:22 -06:00
Joshua C. Colp de3f28ec8a Merge "res_musiconhold: Remove redundant option parsing" into 16 2019-03-14 09:20:19 -05:00
Joshua C. Colp 3e5dcc9dcf Merge "stasis: Improve topic/subscription names and statistics." into 16 2019-03-14 09:19:37 -05:00
cirillor 342550e0ea Variable ALTCONF ignored when service is used in Debian
When variable ALTCONF is defined, the command start prints the message
"Unable to open specified master config file '"/etc/asterisk/asteris..."
and use default configurations.

ASTERISK-28332

Change-Id: I7595e582a0ee2c1051ea35435e247e27906957ef
2019-03-13 10:36:53 -06:00
Joshua C. Colp d3c971c315 Merge "stasis: Allow empty application arguments to move." into 16 2019-03-13 11:32:09 -05:00
Kevin Harwell 19957fc60e Merge "app_queue: fix ring_entry to access nativeformats with a channel lock" into 16 2019-03-13 11:17:40 -05:00
Kevin Harwell 0e053fe4e3 Merge "chan_dahdi: Add logical group at DAHDIChannel event and CHANNEL function" into 16 2019-03-13 10:55:11 -05:00
Joshua Colp 03c0d19cc8 stasis: Allow empty application arguments to move.
Change-Id: I1e4d37415f3034abe36496dc30209c2303e6af5c
2019-03-13 07:55:48 -06:00
Joshua C. Colp c8a1f8bfaa Merge "partial-inlining: disable partial-inlining if gcc>=8.2.1" into 16 2019-03-13 06:29:48 -05:00
Kevin Harwell 6a435723f7 AMI/ARI: Bump non-breaking version numbers
Increasing the non-breaking AMI and ARI version numbers due to changes and
additions in those API's. Note, some changes may be forthcoming (will be added
between now and the next release of Asterisk), thus not listed here. As well
a few changes listed below may have been released in a previous release of
Asterisk, but the API version numbers were not increased at that time, so
including here.

AMI:

 * app_queue: set the wrapuptime from AddQueueMember application - e806990
 * res_pjsip: option for ContactStatus event updates - 7f22c9f

ARI:

 * bridging: Add creation timestamps - 0d70120
 * res_stasis: Add ability to switch applications - 50a4b61
 * ARI event type filtering - 1c5def4
 * Added ARI resource /ari/asterisk/ping - 19fc99a

ASTERISK-28314

Change-Id: Iebc813840f8230afa6b20579772e15549064b787
2019-03-12 15:58:01 -05:00
George Joseph a71ae3dc44 Makefile.moddir_rules: Pass PJPROJECT_BUNDLED to download_externals
The download_externals script wasn't getting the PJPROJECT_BUNDLED
environment variable passed down to it so it wasn't downloading
the appropriate variant of res_digium_phone.  This could cause
crashes in the DPMA.

Change-Id: I5daa9369c7af1fd556d892e89a85f279a2533425
2019-03-12 12:28:01 -06:00
Chris-Savinovich 47c853f8e1 partial-inlining: disable partial-inlining if gcc>=8.2.1
Apply flag -fno-partial-inlining on default optimization if and only if
gcc version >= 8.2.1 (this is the current ver on Fedora and Ubuntu).
This is done to avoid a bug that causes arithmetic calculations to fail
if the following conditions are met:
1. TEST_FRAMEWORK on
2. DONT_OPTIMIZE off
3. Fedora and Ubuntu
4. GCC 8.2.1
5. There must exist a certain combination of multithreading.
6. Optimization level -O2 and -O3
7. Flag -fpartial-inline activated (default when optimization level>=2)
The following link points to a similar gcc bug reported in 2015. This leads me
to believe the bug has regressed. Note I am not able to replicate this bug
in an environment other than Asterisk + Test Framework + Test_cel because the
multithreading combination that causes it seems to be unique. Therefore I
am temporarily abandoning any thoughts of reporting the new occurrence of this
bug to gcc.gnu.org.  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65307

Change-Id: Ibd1afe60e0a38b88e85fdcd9b051004601c2f102
2019-03-11 12:09:54 -05:00
Friendly Automation b428363cd5 Merge "res/res_rtp_asterisk.c: Fixing possible divide by zero" into 16 2019-03-11 10:06:56 -05:00
George Joseph 9b15e04011 Merge "jansson: json_pack with new format to verify required runtime version." into 16 2019-03-11 09:49:30 -05:00
Joshua Colp b886fef66e stasis: Improve topic/subscription names and statistics.
Topic names now follow: <subsystem>:<functionality>[/<object>]

This ensures that they are all unique, and also provides better
insight in to what each topic is for.

Subscriber ids now also use the main topic name they are
subscribed to and an incrementing integer as their identifier to
make it easier to understand what the subscription is primarily
responsible for.

Both the CLI commands for listing topic and subscription statistics
now sort to make it a bit easier to see what is going on.

Subscriptions will now show all topics that they are receiving messages
from, not just the main topic they were subscribed to.

ASTERISK-28335

Change-Id: I484e971a38c3640f2bd156282e532eed84bf220d
2019-03-11 08:39:39 -06:00
Friendly Automation 13cca7bb11 Merge "app_meetme: Don't mute joining admins if conference is muted" into 16 2019-03-11 09:14:48 -05:00
sungtae kim ca8f254f0f res/res_rtp_asterisk.c: Fixing possible divide by zero
Currently, when the Asterisk calculates rtp statistics, it uses
sample_count as a unsigned integer parameter. This would be fine
for most of cases, but in case of large enough number of sample_count,
this might be causing the divide by zero error.

ASTERISK-28321

Change-Id: If7e0629abaceddd2166eb012456c53033ea26249
2019-03-11 06:09:31 -06:00
cirillor c9459b1875 chan_dahdi: Add logical group at DAHDIChannel event and CHANNEL function
Add logical group at DAHDIChannel event
and create "dahdi_group" at CHANNEL function.

ASTERISK-28317

Change-Id: Ic1f834cd53982a9707a9748395ee746d6575086a
2019-03-09 08:29:49 -06:00
Sean Bright 8ca74d73f1 res_musiconhold: Remove redundant option parsing
Change-Id: I481fabd8eaf2e4e7ffb5c8285b294742826e7d12
2019-03-08 15:15:01 -05:00
Torrey Searle 4ca41caf38 chan_pjsip: add a flag to ignore 183 responses if no SDP present
chan_sip will always ignore 183 responses that do not contain SDP
however, chan_pjsip will currently always translate it into a
183 with SDP.  This new flag allows chan_pjsip to have the same
behavior as chan_sip.

ASTERISK-28322 #close

Change-Id: If81cfaa17c11b6ac703e3d71696f259d86c6be4a
2019-03-08 13:13:41 -06:00
Corey Farrell 641b6041c7
jansson: json_pack with new format to verify required runtime version.
Add a json_pack at startup that will fail if runtime links against a
library older than jansson-2.11.

Change-Id: I101aebafe0f9407650206f7c552dad3d69377b5a
2019-03-08 13:46:34 -05:00
George Joseph 255e374254 Merge "samples: Fix comment typo in pjsip.conf.sample" into 16 2019-03-08 12:44:37 -06:00
Friendly Automation 70cd169fb1 Merge "Replace calls to strtok() with strtok_r()" into 16 2019-03-08 12:33:23 -06:00
Friendly Automation afe16021ef Merge "res_stasis: Add ability to switch applications." into 16 2019-03-08 11:40:49 -06:00
Friendly Automation 7566d9bb61 Merge "bridging: Add creation timestamps" into 16 2019-03-08 11:08:09 -06:00
Sean Bright 5b5aa05bd9 app_meetme: Don't mute joining admins if conference is muted
ASTERISK-28328 #close

Change-Id: I4f6069fb34923b7521520c2a205a1e56227e592b
2019-03-08 10:43:51 -06:00
Sean Bright 4860954540 Replace calls to strtok() with strtok_r()
strtok() uses a static buffer, making it not thread safe.

Change-Id: Icce265153e1e65adafa8849334438ab6d190e541
2019-03-07 16:42:22 -06:00
Sean Bright 90f06ad169 samples: Fix comment typo in pjsip.conf.sample
Change-Id: I84a45c3d9fd26ca61aca99927eec83b57f1de857
2019-03-07 16:06:31 -06:00
Ben Ford 50a4b618fc res_stasis: Add ability to switch applications.
Added the ability to move between Stasis applications within Stasis.
This can be done by calling 'move' in an application, providing (at
minimum) the channel's id and the application to switch to. If the
application is not registered or active, nothing will happen and the
channel will remain in the current application, and an event will be
triggered to let the application know that the move failed. The event
name is "ApplicationMoveFailed", and provides the "destination" that the
channel was attempting to move to, as well as the usual channel
information. Optionally, a list of arguments can be passed to the
function call for the receiving application. A full example of a 'move'
call would look like this:

client.channels.move(channelId, app, appArgs)

The control object used to control the channel in Stasis can now switch
which application it belongs to, rather than belonging to one Stasis
application for its lifetime. This allows us to use the same control
object instead of having to tear down the current one and create
another.

ASTERISK-28267 #close

Change-Id: I43d12b10045a98a8d42541889b85695be26f288a
2019-03-07 07:41:14 -06:00
Dömsödi Gergely e7dd4bd4a9 app_queue: fix ring_entry to access nativeformats with a channel lock
Fixes an intermittent segmentation fault which occured when accessing
nativeformats of a channel which entered into a queue.

ASTERISK-27964
Reported by: Francisco Seratti

Change-Id: Ic87fa7a363f3b487c24ce07032f4b2201c22db9e
2019-03-06 14:26:12 +01:00
Joshua Colp 24b94aa27f Merge "sip_to_pjsip: Make multiline comment parsing consistent with Asterisk" into 16 2019-03-05 09:20:17 -06:00
Joshua Colp 293df3c7ac Merge "app_queue: Handle empty 'interface' in queue member config" into 16 2019-03-05 08:55:26 -06:00
Joshua Colp f9bc474ab0 Merge "res_pjsip_registrar: blocked threads on reliable transport shutdown take 3" into 16 2019-03-05 07:15:40 -06:00
Joshua Colp 7bdbccc64a Merge "basic-pbx: Update configuration to work with current modules." into 16 2019-03-05 07:05:06 -06:00
Sean Bright 88681ba9bb app_queue: Handle empty 'interface' in queue member config
While the 'interface' column is a NOT NULL, the empty string is still
allowed. res_config_odbc treats the empty string as a NULL and we crash
when trying to dereference.

Also cleaned up an adjacent error message for consistency.

ASTERISK-28168 #close

Change-Id: I55e012b540fbcda99bb40bede3099b7ae5db8202
2019-03-04 16:07:37 -06:00
Sean Bright 0cfafb89b5 sip_to_pjsip: Make multiline comment parsing consistent with Asterisk
In Asterisk configuration, a multiline comment starts with ;-- as long as it is
not followed by another dash (i.e. ;--- is not a multiline comment).

ASTERISK-28323 #close

Change-Id: I32dc38e0fac01d3c0805d27d35d2365a7c37ca72
2019-03-04 13:40:34 -06:00
Joshua Colp 90f0f6659d Merge "res_pjsip_diversion: Use static pj_str_t for Diversion header names" into 16 2019-03-04 06:15:47 -06:00
Joshua Colp 6a714c0e9f basic-pbx: Update configuration to work with current modules.
The res_pjsip_websocket module requires the res_http_websocket
module so ensure it is loaded. As well the res_pjsip_notify
module needs the pjsip_notify.conf configuration file so
ensure it is installed.

ASTERISK-28272

Change-Id: I261659b84e7a6ac4cb49990d9badb4b2ad01bacd
2019-03-04 05:02:53 -06:00
sungtae kim 0d7012044a bridging: Add creation timestamps
This small feature will help to checking the bridge's status to
figure out which bridge is in old/zombie or not. Also added
detail items for the 'bridge show *' cli to provide more detail
info. And added creation item to the ARI as well.

ASTERISK-28279

Change-Id: I460238c488eca4d216b9176576211cb03286e040
2019-03-03 12:22:56 +01:00
Rodrigo Ramírez Norambuena 63a3321c46 CHANGES: Document addition of 'wrapuptime' argument to AddQueueMember()
Change-Id: Ieb332d018ae3f2fc82b9465381fde0f299af1611
2019-03-02 07:34:05 -06:00
Sean Bright ffe07772e6 res_pjsip_diversion: Use static pj_str_t for Diversion header names
PJSIP assumes that these header names are not allocated, and does not
clone the name strings when reusing headers.

Block unload of res_pjsip_diversion until shutdown to ensure static
memory stays valid.

ASTERISK-28312 #close

Change-Id: Ibd6ea55ec4a604bbd43ac07f8d0b54da2c39b8b9
2019-03-01 17:46:54 -05:00
Friendly Automation 2a387f04db Merge "res_config_odbc: Avoid deadlock when max_connections = 1" into 16 2019-03-01 15:24:23 -06:00
Kevin Harwell 436975dd6e Merge "menuselect: Add license header to menuselect_gtk.c" into 16 2019-03-01 15:17:25 -06:00
Joshua Colp a08ee6c962 Merge "Revert "pjsip_message_filter: Only do interface lookup for wildcard addresses."" into 16 2019-03-01 08:03:27 -06:00
Sean Bright 625af27a28 menuselect: Add license header to menuselect_gtk.c
This file was added to the Subversion repository on 2007-03-15 by
Russell Bryant, a Digium employee at the time.

ASTERISK-24173 #close

Change-Id: Ie866fa9d31d550467613d362b35b03c031ee594d
2019-02-28 15:38:48 -06:00
George Joseph 61585af9bd res_pjsip_sdp_rtp: Fix return code from apply_negotiated_sdp_stream
apply_negotiated_sdp_stream was returning a "1" when no joint
capabilities were found on an outgoing call instead of a "-1".
This indicated to res_pjsip_session that the handler DID handle
the sdp when in fact it didn't.  Without the appropriate setup,
a subsequent media frame coming in would have an invalid stream_num
and cause a seg fault when the stream was attempted to be retrieved.

apply_negotiated_sdp_stream now returns the correct "-1" and any
media is now discarded before it reaches the core stream processing.

ASTERISK-28260
Reported by: Sotiris Ganouris

Change-Id: Ia095cb16b4862f2f6ad6d2d2a77453fa2542371f
2019-02-28 11:34:40 -06:00
Joshua Colp 1d7df1d3f1 Merge "res_pjsip_config_wizard: Don't crash if misconfigured" into 16 2019-02-28 07:47:17 -06:00
Sean Bright 6f1c0e787c Revert "pjsip_message_filter: Only do interface lookup for wildcard addresses."
This reverts commit d524ad523d.

Reason for revert: This causes Contact and Via headers to have the wrong
transport address.

ASTERISK-28309 #close

Change-Id: Ibba4d6176f68e39279fcd9a545f81d56e747bed8
2019-02-28 06:57:50 -06:00
Joshua Colp ae1b12b834 Merge "res/res_rtp_asterisk: smoother can cause wrong timestamps if dtmf happen" into 16 2019-02-28 05:48:33 -06:00
Joshua Colp c268b3592c Merge "res_mwi_devstate.c: New module to allow presence subs to VM boxes" into 16 2019-02-28 05:02:15 -06:00
Sean Bright fe694de299 res_pjsip_config_wizard: Don't crash if misconfigured
If both send_registrations and send_auth are both set to yes,
outbound_auth/username must be set or we crash.

ASTERISK-27992 #close

Change-Id: I6418d56de1ae53f80393b314c2584048fbf7f11d
2019-02-27 19:54:19 -06:00
Sean Bright edf31624a2 res_config_odbc: Avoid deadlock when max_connections = 1
Rather than calling ast_odbc_find_table() in the prepare callback, call
it beforehand and pass it in to the callback to avoid the need for a
second connection.

ASTERISK-28166 #close

Change-Id: I6f8a0b9990d636fd6bc1a92ed70f7050d2436202
2019-02-27 20:16:49 -05:00
Kevin Harwell b3ebb51086 res_pjsip_registrar: blocked threads on reliable transport shutdown take 3
When a contact was removed by the registrar it did not always check to see if
the circumstances involved a monitored reliable transport. For instance, if the
'remove_existing' option was set to 'true' then when existing contacts were
removed due to 'max_contacts' being reached, those existing contacts being
removed did not unregister the transport monitor.

Also, it was possible to add more than one monitor on a reliable transport for
a given aor and contact.

This patch makes it so all contact removals done by the registrar also remove
any associated transport monitors if necessary. It also makes it so duplicate
monitors cannot be added for a given transport.

ASTERISK-28213

Change-Id: I94b06f9026ed177d6adfd538317c784a42c1b17a
2019-02-27 17:02:23 -06:00
George Joseph 6e8cba39a4 CI: Update jenkinsfiles with new Gerrit URLs
The recent upgrade of Gerrit to 2.16 elimiated referencing a
repository in a way the jenkinsfiles were relying on so
the URL references were changed to a more consistent and supported
format.

Change-Id: I2e8e3f213b9a96bb1b27665eca4a9a24bc49820e
(cherry picked from commit 5ce084579f)
2019-02-27 10:56:02 -06:00
Joshua C. Colp cc8aa4eee1 Merge "rest-api-templates/asterisk_processor - replace http line breaks with line feed" into 16 2019-02-26 09:12:56 -06:00
George Joseph 8402189892 res_mwi_devstate.c: New module to allow presence subs to VM boxes
This module allows presence subscriptions to voicemail boxes.  This
allows common BLF keys to act as voicemail waiting indicators.

ASTERISK-28301

Change-Id: I62a246c24f3d7d432e33e22d7a4a57c15c292fdd
2019-02-26 08:31:54 -06:00
Torrey Searle 5b8db4e422 res/res_rtp_asterisk: smoother can cause wrong timestamps if dtmf happen
Delivery timeval in the smoother object will fall behind while a DTMF is
being generated.  This can eventually lead to invalid rtp timestamps.
To prevent this from happening the smoother needs to be reset after every
DTMF to keep the timing up to date.

ASTERISK-28303 #close

Change-Id: Iaba3f7b428ebd72a4caa90e13b829ab4f088310f
2019-02-26 08:13:19 -06:00
Joshua C. Colp aefc501913 Merge "http.c: Support separated HTTP request" into 16 2019-02-26 07:30:51 -06:00
Joshua C. Colp 8b3579a7e5 Merge "taskprocessor: Enable subsystems and overload by subsystem" into 16 2019-02-26 07:04:41 -06:00
Joshua C. Colp b5426cb111 Merge "app_queue: Enable set the wrapuptime from AddQueueMember application" into 16 2019-02-26 06:34:51 -06:00
Friendly Automation db5ff02982 Merge "res_ari_applications: Fix incorrect call to ao2_lock." into 16 2019-02-26 06:27:27 -06:00
Joshua C. Colp 4378c4ee72 Merge "Core: Increase AST_PBX_MAX_STACK to 512 if not LOW_MEMORY" into 16 2019-02-26 06:08:30 -06:00
Kevin Harwell cab8a76ae3 rest-api-templates/asterisk_processor - replace http line breaks with line feed
Including line breaks (<br>, <br/>, <br />) in certain parts of the rest-api
json definition (e.g. summary, notes) displays them correctly in swagger.
However, when the field gets converted to the wiki format those breaks get
escaped and show up in the text as the actual string literal "<br>" etc...

This patch makes it so when converting to the wiki format it replaces all line
break values (<br>, etc...) with line feeds ('\n').

Change-Id: Ie1c9faa0d1c5d622804cc0a21ce769095b08aa3d
2019-02-25 17:31:51 -06:00
Joshua C. Colp 9905cccb7b res_ari_applications: Fix incorrect call to ao2_lock.
When listing the applications the apps lock was incorrectly
locked twice instead of being locked and then unlocked.

ASTERISK-28302

Change-Id: If7d064592a9e88c0f1049214c50e02be6dabf79e
2019-02-25 06:12:04 -06:00
Joshua C. Colp a2254c5878 Merge "res_pjsip_sdp_rtp: Allow only single ssrc attribute." into 16 2019-02-22 10:44:04 -06:00
Joshua Colp 0896e4cdc6 res_pjsip_sdp_rtp: Allow only single ssrc attribute.
When processing SSRC attributes we were iterating through
all of them, even though we only need to know the remote
SSRC once. This was problematic because some browsers group
SSRCs together on a stream, and due to our negotiation only
end up using the first one. Since we set the second one as
the remote SSRC we would drop the received media from them
instead of allowing it through.

In the future this may be extended to allow SSRC groups
and to use information from the attributes.

Change-Id: I4dc87087dbe56a83aa65f0f897bbd4ca75ec1270
2019-02-21 18:06:23 +00:00
Friendly Automation bd992f686d Merge "stasis: Store subscriber uniqueids with topic statistics." into 16 2019-02-21 09:59:44 -06:00
Friendly Automation 2846b54ee2 Merge "res_pjsip_session Added rtcp stats result vector into the session" into 16 2019-02-20 15:32:33 -06:00
Sungtae Kim a1391aa26b http.c: Support separated HTTP request
Currently, the Asterisk does not support seperated HTTP request.
This patch make the Asterisk enables to wait lest part of HTTP request.
Also increases acceptable HTTP body length to 40k to support more
larger request.

ASTERISK-28236

Change-Id: I48a401aa64a21c3b37bf3cb4e0486d64b7dd8aa1
2019-02-20 15:28:54 -06:00
George Joseph bb8903b00e Core: Increase AST_PBX_MAX_STACK to 512 if not LOW_MEMORY
The current settings AST_PBX_MAX_STACK is 128 entries which is
too low for some FreePBX installations with complex parking
arrangements.  Increased to 512 if LOW_MEMORY is not defined.

ASTERISK-28300

Change-Id: I7c4b540bc92e6642df0f3da639b003f7da8b1299
2019-02-20 12:52:40 -06:00
Joshua C. Colp 4b6c60b362 stasis: Store subscriber uniqueids with topic statistics.
This change provides an easier mechanism to determine which
subscribers are subscribed to a topic. Using this you can
inspect the specific subscribers for further details.

Change-Id: I8deea21703cd5c5357b85593b46c3eaf24e18c0c
2019-02-20 12:24:00 -06:00
George Joseph 2f8def1453 taskprocessor: Enable subsystems and overload by subsystem
To prevent one subsystem's taskprocessors from causing others
to stall, new capabilities have been added to taskprocessors.

* Any taskprocessor name that has a '/' will have the part
  before the '/' saved as its "subsystem".
  Examples:
  "sorcery/acl-0000006a" and "sorcery/aor-00000019"
  will be grouped to subsystem "sorcery".
  "pjsip/distributor-00000025" and "pjsip/distributor-00000026"
  will bn grouped to subsystem "pjsip".
  Taskprocessors with no '/' have an empty subsystem.

* When a taskprocessor enters high-water alert status and it
  has a non-empty subsystem, the subsystem alert count will
  be incremented.

* When a taskprocessor leaves high-water alert status and it
  has a non-empty subsystem, the subsystem alert count will be
  decremented.

* A new api ast_taskprocessor_get_subsystem_alert() has been
  added that returns the number of taskprocessors in alert for
  the subsystem.

* A new CLI command "core show taskprocessor alerted subsystems"
  has been added.

* A new unit test was addded.

REMINDER: The taskprocessor code itself doesn't take any action
based on high-water alerts or overloading.  It's up to taskprocessor
users to check and take action themselves.  Currently only the pjsip
distributor does this.

* A new pjsip/global option "taskprocessor_overload_trigger"
  has been added that allows the user to select the trigger
  mechanism the distributor uses to pause accepting new requests.
  "none": Don't pause on any overload condition.
  "global": Pause on ANY taskprocessor overload (the default and
  current behavior)
  "pjsip_only": Pause only on pjsip taskprocessor overloads.

* The core pjsip pool was renamed from "SIP" to "pjsip" so it can
  be properly grouped into the "pjsip" subsystem.

* stasis taskprocessor names were changed to "stasis" as the
  subsystem.

* Sorcery core taskprocessor names were changed to "sorcery" to
  match the object taskprocessors.

Change-Id: I8c19068bb2fc26610a9f0b8624bdf577a04fcd56
2019-02-20 10:46:47 -07:00
Kevin Harwell 1c5def4b18 ARI event type filtering
Event type filtering is now enabled, and configurable per application. An app is
now able to specify which events are sent to the application by configuring an
allowed and/or disallowed list(s). This can be done by issuing the following:

PUT /applications/{applicationName}/eventFilter

And then enumerating the allowed/disallowed event types as a body parameter.

ASTERISK-28106

Change-Id: I9671ba1fcdb3b6c830b553d4c5365aed5d588d5b
2019-02-20 09:56:03 -06:00
Friendly Automation 4a871c4b79 Merge "json.c/strings.c - Add a couple of utility functions" into 16 2019-02-20 09:31:48 -06:00
Friendly Automation 3ae7dada41 Merge "chan_pjsip: Changed to continued after invalid media for pjsip show channelstats" into 16 2019-02-20 09:02:46 -06:00
George Joseph c0e2a93e42 Merge "CI: Use tmpfs option to Docker instead of mount." into 16 2019-02-20 08:46:05 -06:00
Rodrigo Ramírez Norambuena e806990be2 app_queue: Enable set the wrapuptime from AddQueueMember application
This change add ability to set the wrapuptime per-member using the
AddQueueMember application.

The feature to set wrapuptime per member was include in the issue
ASTERISK-27483 for static member by configuration file and was not
added to set from AddQueueMember.

ASTERISK-28055 #close

Change-Id: I7c7ee4a6f804922cd7c42cb02eea26eb3806c6cf
2019-02-19 20:47:43 -06:00
sungtae kim 08ba504e99 chan_pjsip: Changed to continued after invalid media for pjsip show channelstats
Currently, the pjsip show channelstats cli does not show channel's
stats after hits the invalid channel info. This makes hard to use
this cli. Changed to keep iterate after hits the invalid channel
info.

ASTERISK-28292

Change-Id: I3efdff1c9e1b1efd3c971fb82ae77aa133a6f43c
2019-02-19 22:40:52 +01:00
Sungtae Kim 3fe40c0c05 res_pjsip_session Added rtcp stats result vector into the session
Currently, the Asterisk's pjsip_session module does not keeping the
rtcp's stats info after it was removed. But by adding the results
vector and keeping it until session is destroying, it can give more
useful information for other modules.

ASTERISK-28253

Change-Id: Ib25c2d3fc4da084aecfde2a82c1b1d733bd64fa5
2019-02-19 15:08:24 -06:00
Joshua Colp 3a2db0ee04 CI: Use tmpfs option to Docker instead of mount.
Some tests require Asterisk to execute scripts which
are stored in /tmp. When mount is used for tmpfs there
is no ability to allow scripts to be executed from
that location.

This change switches to using tmpfs which can be told
to allow executables to be run from /tmp.

Change-Id: I0e598ca2b76af1f7f2d29f0da7b1731a214a291a
2019-02-19 10:23:02 -06:00
Kevin Harwell e85f92f37a json.c/strings.c - Add a couple of utility functions
Added 'ast_json_object_string_get' to the JSON wrapper in order to make it a
little easier to retrieve a string field from the JSON object.

Also added an 'ast_strings_equal' function that safely checks (checks for NULLs)
for equality between two strings.

Change-Id: I26f0a16d61537505eb41b4b05ef2e6d67fc2541b
2019-02-19 09:44:08 -06:00
Torrey Searle 01b781b4dc res/res_rtp_asterisk: clear smoother when local bridging
p2p_write updates txformat but doesn't require a smoother.  If a smoother
was created by another bridge type the smoother could fall out of date causing
one way audio issues.  To prevent this the smoother is now destroyed on the
start of native bridge.

ASTERISK-28284 #close

Change-Id: I84e67f144963787fff9b4d79ac500514fb40cdc6
2019-02-19 01:37:20 -06:00
Chris Savinovich b327b0bbda Revert "Test_cel: Fails when DONT_OPTIMIZE is off"
This reverts commit 05b79d16ab.

Change-Id: I2e64fc22c33b10cfd592681732fc67ae0669a301
2019-02-14 11:03:21 -06:00
George Joseph aaee80adfe Merge "ci: Rerun unit tests when non-code changes occur." into 16 2019-02-11 09:28:24 -06:00
Joshua C. Colp 2070f62bb6 Merge "res_odbc: Add basic query logging." into 16 2019-02-11 08:39:31 -06:00
Joshua Colp 1084b6e1a1 ci: Rerun unit tests when non-code changes occur.
This change makes it so that even if non-code changes
occur (such as commit message changing) unit tests
will still be run and result in a verification.

ASTERISK-28251

Change-Id: I6491fff7c93e5d5cd8e41054486968bf66c4f608
2019-02-08 07:10:23 -06:00
Kevin Harwell 2cf3931379 res_pjsip_registrar: lock transport monitor when setting 'removing' flag
A previous patch attempt to mitigate blocked threads on transport shutdown for
a given contact. It was thought that a second lock could be avoided by checking
the 'removing' flag on the transport monitor twice (once before and once after
the normal named aor locking). However as with usual threading issues if the
timing was right the original problem still occured.

This patch adds locking around the first 'removing' flag check and set, thus
nullifying the secondary check, so it was removed.

ASTERISK-28213

Change-Id: Iaa8e36e5311789549b76d8de42dfcea96013b2ed
2019-02-07 14:27:25 -06:00
Joshua Colp 44254d548b res_odbc: Add basic query logging.
When Asterisk is connected and used with a database the response
time of the database can cause problems in Asterisk if it is long.
Normally the only way to see this problem would be to retrieve a
backtrace from Asterisk and examine where things are blocked, or
examine the database to see if there is any indication of a
problem.

This change adds some basic query logging to make it easier to
investigate such a problem. When logging is enabled res_odbc will
now keep track of the number of queries executed, as well as the
query that has taken the longest time to execute. There is also
an option which will cause a WARNING message to be output if a
query takes longer than a configurable amount of time to execute.

This makes it easier and clearer for users that their database may
be experiencing a problem that could impact Asterisk.

ASTERISK-28277

Change-Id: I173cf4928b10754478a6a8c27dfa96ede0f058a6
2019-02-07 08:23:04 -06:00
George Joseph c0b7b60ba1 Merge "sounds: Sort 'core show sounds' output" into 16 2019-02-06 07:13:25 -06:00
George Joseph 7e366e4d4b Merge "main/cdr: Fixed cdr start overwriting" into 16 2019-02-06 07:12:38 -06:00
Sungtae Kim e3e3027092 main/cdr: Fixed cdr start overwriting
The CDR was overwriting the start time when the call continued the
dialplan from the ARI stasis or a Local channel was originated.

This change fixes this by no longer reinitializing the CDR when
transitioning out of the dialed pending state to the single state.

ASTERISK-28181

Change-Id: I921bc04064b6cff1deb2eea56a94d86489561cdc
2019-02-05 21:26:06 +01:00
Giuseppe Sucameli 419db481d1 Fix deadlock handling subscribe req during res_parking reload
Split destroy_hint method to separate hint removal and extension hint
state changed callback, the latter now called via stasis.
This avoids deadlock between res_parking reload that is removing the
parking lot and the related hint and subscribe requests coming for the
same parking lot.

ASTERISK-28173

Change-Id: I5b03c3455b3b12b6f83cea4cc34f4b4b20444f7e
2019-02-05 10:14:36 -06:00
George Joseph 3d54ef5978 Merge "pjsip/config_global: regcontext context not created" into 16 2019-02-05 09:55:38 -06:00
George Joseph 29a77b337d Merge "Added ARI resource /ari/asterisk/ping" into 16 2019-02-05 08:41:20 -06:00
George Joseph c925742e8b Merge "res_stasis: Auto-create context and extens on Stasis app launch." into 16 2019-02-05 08:26:35 -06:00
sungtae kim 19fc99a2fb Added ARI resource /ari/asterisk/ping
Added ARI resource.
GET /ari/asterisk/ping : It returns "pong" message with timestamp
and asterisk id. It would be useful for simple heath check.

Change-Id: I8d24e1dcc96f60f73437c68d9463ed746f688b29
2019-02-05 07:46:48 -06:00
Sean Bright f29da72969 sounds: Sort 'core show sounds' output
Change-Id: Ib39052a745040f75eb635f15a042da15b20e22ab
2019-02-04 14:40:30 -06:00
Joshua C. Colp ffe6ecb40f Merge "bundled-jansson: On OpenSuse Leap libjansson.a was placed in lib64" into 16 2019-02-04 11:30:24 -06:00
Ben Ford 1051e1dd18 res_stasis: Auto-create context and extens on Stasis app launch.
At AstriCon, there was a strong desire for the ability to completely
bypass dialplan when using ARI. This is possible through the automatic
creation of a context and a couple of extensions whenever an application
is started.

For example, if you have an application named 'ari-example', a context
named 'stasis-ari-example' will be automatically created whenever this
application is started as long as one does not already exist. Two
extensions (a match-all extension for Stasis and a 'h' extension) are
created within this context. Any endpoint that registers to Asterisk
within this context will send all calls to the corresponding Stasis
application. When the application is destroyed, the context is removed.

ASTERISK-28104 #close

Change-Id: Ie35bd93075e05b05e3ae129a83c9426931b7ebac
2019-02-04 09:52:52 -06:00
Joshua C. Colp 6ccf1155d1 Merge "media_index.c: Refactored so it doesn't cache the index" into 16 2019-02-04 09:02:24 -06:00
George Joseph 70fa6e6955 bundled-jansson: On OpenSuse Leap libjansson.a was placed in lib64
On OpenSuse Leap, libjansson.a is installed in
third-party/jansson/dest/lib64 instead of lib (which is where
the top-level makeopts looks).  This causes a link failure.

* Updated jansson/Makefile to add an explicit --libdir to force
  the installation to third-party/jansson/dest/lib.

ASTERISK-28271
Reported by: David Wilcox

Change-Id: Ibf8af75e5da13562105fcc39ed898c6ef0b5a5f3
2019-02-04 07:17:41 -06:00
Kevin Harwell 9c3b4dcf80 pjsip/config_global: regcontext context not created
The context specified by 'regcontext' was not being created, so when Asterisk
attempted to later dynamically add an extension it would fail. This patch now
creates the context if a 'regcontext' is specified.

ASTERISK-28238

Change-Id: I0f36cf4ab0a93ff4b1cc5548d617ecfd45e09265
2019-01-29 11:33:31 -06:00
George Joseph 603143bd5a media_index.c: Refactored so it doesn't cache the index
Testing revealed that the cache added no benefit but that it could
consume excessive memory.

Two new index related functions were created:
ast_sounds_get_index_for_file() and ast_media_index_update_for_file()
which restrict index updating to specific sound files.

The original ast_sounds_get_index() and ast_media_index_update()
calls are still available but since they no longer cache the results
internally, developers should re-use an index they may already have
instead of calling ast_sounds_get_index() repeatedly.  If information
for only a single file is needed, ast_sounds_get_index_for_file()
should be called instead of ast_sounds_get_index().

The media_index directory scan code was elimininated in favor of
using the existing ast_file_read_dirs() function.

Since there's no more cache, ast_sounds_index_init now only
registers the sounds cli commands instead of generating the
initial index and subscribing to stasis format register/unregister
messages.

"sounds" is no longer a valid target for the "module reload"
command.

Both the sounds cli commands and the sounds ari resources were
refactored to only call ast_sounds_get_index() once per invocation
and to use ast_sounds_get_index_for_file() when a specific sound
file is requested.

Change-Id: I1cef327ba1b0648d85d218b70ce469ad07f4aa8d
2019-01-28 13:28:22 -06:00
George Joseph 36a10a3672 Merge "codecs.conf.sample: update codec opus docs" into 16 2019-01-28 07:47:09 -06:00
George Joseph d0087a8107 Merge "format_g726: add support for seeking" into 16 2019-01-28 07:45:56 -06:00
George Joseph 47a2b6d0f3 Merge "res_http_websocket: ensure control frames do not interfere with data" into 16 2019-01-28 07:22:18 -06:00
Kevin Harwell f6452f9656 codecs.conf.sample: update codec opus docs
The option value "sdp" for some of the settings was removed a while back,
however the sample conf was not updated.

This patch removes any wording with regards to the old "sdp" option value,
and adjusts the defaults to what they are now.

ASTERISK-28263

Change-Id: I41bfa44e9f69446bcc5c8fd92e3675c676fdc445
2019-01-25 14:31:53 -06:00
Joshua C. Colp e994dff064 Merge "build : Fix cross-compilation errors" into 16 2019-01-24 08:23:06 -06:00
eyalhasson c1da2e94a3 format_g726: add support for seeking
Added support for the seek function in format_g726
so playback can start from anywhere.
Before the fix, playback of g726 files
always started from the beginning.

ASTERISK-28246

Change-Id: I626235bc4642df1479050d3d06828412603a9b40
2019-01-24 07:59:32 -06:00
Joshua C. Colp fe4c6434c1 Merge "app_voicemail: Add Mailbox Aliases" into 16 2019-01-24 06:23:57 -06:00
Joshua C. Colp e2fb30245b Merge "res_pjsip_registrar: mitigate blocked threads on reliable transport shutdown" into 16 2019-01-24 05:49:53 -06:00
Joshua C. Colp a40fb7fa7f Merge "Test_cel: Fails when DONT_OPTIMIZE is off" into 16 2019-01-23 12:06:10 -06:00
Jean Aunis d3a6714158 build : Fix cross-compilation errors
Bundled pjproject and jansson must be configured with the host and build
parameters provided to the configure script.
Autotools do not permit to check for the existence of local header files, so
the control of hrirs.h must not be done when cross-compiling.

ASTERISK-28250

Change-Id: If0a76e52a87d4ab82b7d4c72d27d8759ca931880
2019-01-23 10:30:47 -06:00
Joshua C. Colp 6640ecfd39 Merge "manager_channels: Fix throwing of HangupHandler manager events" into 16 2019-01-23 09:51:38 -06:00
Jeremy Lainé 907d71b551 res_http_websocket: ensure control frames do not interfere with data
Control frames (PING / PONG / CLOSE) can be received in the middle of a
fragmented message. In order to ensure they do not interfere with the
reassembly buffer, we exit early and do not return the payload to the
caller.

ASTERISK-28257 #close

Change-Id: Ia5367144fe08ac6141bba3309517a48ec7f013bc
2019-01-23 09:02:02 -06:00
Joshua C. Colp 7d1736b59b Merge "stasis / manager / ari: Better filter messages." into 16 2019-01-22 18:59:11 -06:00
Joshua C. Colp 84bed54bd7 Merge "bridge_softmix: Use MSID:LABEL metadata as the cloned stream's appendix" into 16 2019-01-22 18:56:38 -06:00
Joshua C. Colp fc28aa2de6 Merge "pjsip_transport_management: Shutdown transport immediately on disconnect" into 16 2019-01-22 18:55:05 -06:00
Xiemin Chen f6cf837aed bridge_softmix: Use MSID:LABEL metadata as the cloned stream's appendix
To avoid the stream name collide if there're more than one video track
in one client. If client has multi video tracks, the name of ast_stream
which represents each video track may be the same. Use the MSID:LABEL
here because it's identifiable.

ASTERISK-28196 #close
Reported-by: xiemchen

Change-Id: Ib62b2886e8d3a30e481d94616b0ceaeab68a870b
2019-01-22 18:17:17 -06:00
Joshua C. Colp ef43bd0b43 Merge "res_http_websocket: respond to CLOSE opcode" into 16 2019-01-22 18:16:08 -06:00
Gerald Schnabel 735bd4d185 manager_channels: Fix throwing of HangupHandler manager events
The type value extracted from stasis message data in channel_hangup_handler_cb
isn't compared against the valid values "run", "pop" and "push". Thus the
manager events HangupHandlerPush, HangupHandlerPop and HangupHandlerRun are
never thrown.

This regression was introduced by ASTERISK_21462.

ASTERISK-28252

Change-Id: I9956e35e18da1873113644df1ddc3c7cd37bf524
2019-01-22 17:29:58 -06:00
Chris-Savinovich 05b79d16ab Test_cel: Fails when DONT_OPTIMIZE is off
A bug in GCC causes TEST_CEL to return failure under the following
conditions:
1. TEST_FRAMEWORK on
2. DONT_OPTIMIZE off
3. Fedora and Ubuntu
4. GCC 8.2.1
5. Test name: test_cel_dial_pickup
6. There must exist a certain combination of multithreading.
The bug affects arithmetic calculations when the optimization level
is bigger than O1 and the -fpartial-inline flag is on. Provided these
conditions, function ast_str_to_lower() fails to convert to lower case
due to said function being of type force_inline.  The solution is to
remove the "force_inline" type declaration from function ast_str_to_lower()

Change-Id: Ied32e0071f12ed9d5f3b4cdd878b2532a1c769d7
2019-01-22 15:41:33 -06:00
George Joseph dbef559e0b app_voicemail: Add Mailbox Aliases
You can now define an "aliases" context in voicemail.conf
whose entries point to actual mailboxes.  These can be used anywhere
the mailbox is specified.

Example:
[general]
aliasescontext = myaliases

[default]
1234 = yadayada

[myaliases]
4321@devices = 1234@default

Now you can use 4321@devices to refer to the 1234@default mailbox.

This can be useful to provide channel drivers with constant
mailbox specifications such as <extension>@devices leaving
app_voicemail to control exactly which mailbox the alias points to.
Now, only voicemail has to be reloaded to make changes instead of
individual channel drivers which are usually more expensive to
reload.

Change-Id: I395b9205c91523a334fe971be0d1de4522067b04
2019-01-22 13:32:00 -06:00
Kevin Harwell f1fb249132 res_pjsip_registrar: mitigate blocked threads on reliable transport shutdown
When a reliable transport is shutdown it's possible for the pjsip registrar
resource shutdown handler to get called multiple times. If this happens and one
of the threads is taking "too long" (slow database call for instance) then the
others get blocked waiting to delete.

Since it only takes one to delete the contact then the other threads should be
able to continue on if one of the threads is currently "deleting". This patch
makes it so now when a thread enters the shutdown handler it checks to see if a
thread is currently already "deleting". If so, then the thread does not attempt
to get the lock, and instead continues on thus avoiding the blockage.

ASTERISK-28213 #close

Change-Id: I7563ca596312b1dff4f3ab41483e89fe2862328a
2019-01-22 13:16:37 -06:00
George Joseph 9c11399be3 pjproject_bundled: Add patch for double free issue in timer heap
Fixed #2172: Avoid double reference counter decrements in
timer in the scenario of race condition between
pj_timer_heap_cancel() and pj_timer_heap_poll().

Change-Id: If000e9438c83ac5084b678eb811e902c035bd2d8
2019-01-22 09:04:33 -06:00
Sean Bright fb6e0df173 pjsip_transport_management: Shutdown transport immediately on disconnect
The transport management code that checks for idle connections keeps a
reference to PJSIP's transport for IDLE_TIMEOUT milliseconds (32000 by
default). Because of this, if the transport is closed before this
timeout, the idle checking code will keep the transport from actually
being shutdown until the timeout expires.

Rather than passing the AO2 object to the scheduler task, we just pass
its key and look it up when it is time to potentially close the idle
connection. The other transport management code handles cleaning up
everything else for us.

Additionally, because we use the address of the transport when
generating its name, we concatenate an incrementing ID to the end of the
name to guarantee uniqueness.

Related to ASTERISK~28231

Change-Id: I02ee9f4073b6abca9169d30c47aa69b5e8ae9afb
2019-01-21 07:57:07 -06:00
Valentin Vidic 6506c5b1d4 channel.c: Fix segfault with Monitor(wav,file,i)
If the Monitor is started with the i option the read_stream will be
NULL. One code path in channel.c checks if write_stream is set but than
uses read_stream instead causing a segfault.

ASTERISK-28249

Change-Id: I1bae9126537be54895c7fea2d08dd9488d8cc525
2019-01-20 12:51:36 -06:00
Joshua C. Colp fcd07c34fb stasis / manager / ari: Better filter messages.
Previously both AMI and ARI used a default route on
their stasis message router to handle some of the
messages for publishing out their respective
connection. This caused messages to be given to
their subscription that could not be formatted
into AMI or JSON.

This change adds an API call to the stasis message
router which allows a default route to be set as well
as formatters that the default route is expecting.
This allows both AMI and ARI to specify that their
default route only wants messages of their given
formatter. By doing so stasis can more intelligently
filter at publishing time so that they do not receive
messages which will not be turned into AMI or JSON.

ASTERISK-28244

Change-Id: I65272819a53ce99f869181d1d370da559a7d1703
2019-01-17 12:52:08 -06:00
Sean Bright 011e46d5a6 sched: Make sched_settime() return void because it cannot fail
Change-Id: I66b8b2b2778f186919d73ae9bf592104b8fb1cd5
2019-01-17 10:02:29 -06:00
Jeremy Lainé 21a1feece2 res_http_websocket: respond to CLOSE opcode
This ensures that Asterisk responds properly to frames received from a
client with opcode 8 (CLOSE) by echoing back the status code in its own
CLOSE frame.

Handling of the CLOSE opcode is moved up with the rest of the opcodes so
that unmasking gets applied. The payload is no longer returned to the
caller, but neither ARI nor the chan_sip nor pjsip made use of the
payload, which is a good thing since it was masked.

ASTERISK-28231 #close

Change-Id: Icb1b60205fc77ee970ddc91d1f545671781344cf
2019-01-16 00:24:55 +01:00
Sean Bright 44a862fb57 res_pjsip_transport_websocket: Don't assert on 0 length payloads
When --enable-dev-mode is used, pjsip_tpmgr_receive_packet() will assert
if passed a payload length of 0, so treat empty frames as if we didn't
receive them.

Change-Id: I9c5fdccd89cc8d2f3ed7e3ee405ef0fc78178f48
2019-01-14 09:36:38 -06:00
Joshua C. Colp 9e7e150a13 Merge "res_pjsip: add option to enable ContactStatus event when contact is updated" into 16 2019-01-14 08:30:05 -06:00
Friendly Automation d76896a30b Merge "stasis/endpoint: Fix memory leak of channel_ids in ast_endpoint structure." into 16 2019-01-14 08:26:53 -06:00
Joshua C. Colp 11d63c9e4f Merge "res_pjsip_sdp_rtp: Only enable abs-send-time when WebRTC is enabled." into 16 2019-01-14 08:04:10 -06:00
Joshua C. Colp 32934180f9 Merge "RTP: reset DTMF last seqno/timestamp on RTP renegotiation" into 16 2019-01-14 08:03:50 -06:00
Joshua C. Colp 72fdba63a8 Merge "app_voicemail: Fix Channel variable VM_MESSAGEFILE for "urgent" voicemail" into 16 2019-01-14 06:19:57 -06:00
mohitdhiman 4b24da607e stasis/endpoint: Fix memory leak of channel_ids in ast_endpoint structure.
During Bridging of two channels if masquerade operation is performed on a
channel (clone channel) which was created with endpoint details
(ast_channel_alloc_with_endpoint()) and the original channel which is created
without endpoint details (ast_channel_alloc()) then both the channels must
exchange their endpoint details or else after masquerade when clone channel
is being destroyed the endpoint cleanup callbacks will be destroyed too and
after call completion unique_id of original channel will still be there in
ast_endpoint structure's channel_ids container.

ASTERISK-28197

Change-Id: Ied0451f378a3f2a36acc8c0984959a69895efa17
2019-01-11 09:01:57 -05:00
Diederik de Groot d2c182b6ab RAII: Change order or variables in clang version
This prevents use-after-scope issues when unwinding the stack,
which happens in reverse order. The varname variable needs to
remain alive for the destruction to be able to access it.
Issue was found using clang + address-sanitizer.

ASTERISK-28232 #close

Change-Id: I00811c34ae910836a5fb6d22304528aef92624db
2019-01-08 20:34:27 -05:00
Alexei Gradinari 7f22c9f4b7 res_pjsip: add option to enable ContactStatus event when contact is updated
The commit I2f97ebfa79969a36a97bb7b9afd5b6268cf1a07d removed sending out
the ContactStatus AMI event when a contact is updated.
Thist change broke things which rely on old behavior.

This patch adds a new PJSIP global configuration option
'send_contact_status_on_update_registration' to be able to preserve old
ContactStatus behavior.
By default new behavior, i.e. the ContactStatus event will not be sent when a
device refreshes its registration.

Change-Id: I706adf7584e7077eb6bde6d9799ca408bc82ce46
2019-01-08 10:42:54 -05:00
Joshua Colp c6271155fb res_pjsip_sdp_rtp: Only enable abs-send-time when WebRTC is enabled.
For video streams it was possible for the abs-send-time information
to be placed into RTP streams even if not negotiated. Depending on
the endpoint in use this could cause video to not flow.

We now only enable abs-send-time for negotiation if WebRTC is enabled.

ASTERISK-28230

Change-Id: I0eb682302f8da3a4ea3c42e839208d55f825ed0c
2019-01-07 14:06:58 +00:00
Alexei Gradinari c0e57e458b RTP: reset DTMF last seqno/timestamp on RTP renegotiation
The remote side may start a new stream when renegotiating RTP.
Need to reset the DTMF last sequence number and the timestamp
of the last END packet on RTP renegotiation.

If the new time stamp is lower then the timestamp of the last DTMF END packet
the asterisk drops all DTMF frames as out of order.

This bug was caught using Cisco ip-phone SPA5XX and codec g722.
On SIP session update the SPA50X resets stream and a new timestamp is twice
smaller then the previous.

ASTERISK-28162 #close

Change-Id: Ic72b4497e74d801b27a635559c1cf29c16c95254
2019-01-04 10:59:00 -05:00
Joshua C. Colp 701cd2ee58 Merge "ast_coredumper: Refactor the pid determination process" into 16 2019-01-04 08:26:10 -06:00
Friendly Automation 140ed330ac Merge "stasis: Fix ABI between DEVMODE and non-DEVMODE." into 16 2019-01-03 17:39:18 -06:00
Joshua C. Colp 1e9da4dba6 Merge "stasic.c: Fix printf format type mismatches with arguments." into 16 2019-01-03 05:41:25 -06:00
Joshua C. Colp 92ee1bdfbb Merge "app_queue: Fix crash when using 'b' option on non-ringall queue." into 16 2019-01-03 05:12:49 -06:00
Bryan Boatright 92298434bd app_voicemail: Fix Channel variable VM_MESSAGEFILE for "urgent" voicemail
If a voicemail is marked "urgent" then the VM_MESSAGEFILE channel variable is
not updated correctly since urgent messages are in a different directory. The
fix is to update the channel variable when the path to the urgent message is
created.

ASTERISK-28225

Change-Id: I8efbace06e6122ea0793f7bdb073d4378e8274ca
2019-01-02 13:16:20 -05:00
Joshua Colp 2d9482695d app_queue: Fix crash when using 'b' option on non-ringall queue.
When using the 'b' option to Queue with a queue that was not configured
for ring all a crash would occur as the wrong pointer would be used.

ASTERISK-28218

Change-Id: If1390f64e321047dff24fd2410c95dde74904980
2019-01-02 17:34:44 +00:00
Richard Mudgett f196078705 stasic.c: Fix printf format type mismatches with arguments.
An int64_t is not likely the same size as a long.

* Changed the int64_t values in the statistics structs to longs so casting
is not necessary when generating the formatted CLI output.  The offending
members did not need to be int64_t anyway as they were only set by an int
type variable which was already truncating bits.

* Reordered the statistics structs to reduce potential padding bytes.

Change-Id: Ic090a070e9dc4ca650ebdb9c01ed50a581289962
2019-01-02 12:10:58 -05:00
George Joseph 4ff64bfc2c Merge "backtrace.c: Fix casting pointer to/from integral type." into 16 2019-01-02 09:51:19 -06:00
Corey Farrell 44a7faca21 stasis: Fix ABI between DEVMODE and non-DEVMODE.
Create compatibility stubs for maximum ABI compatibility.

ASTERISK-28212 #close

Change-Id: I872c04842ab6b61e9dd6d37e4166bc619aa20626
2018-12-26 13:37:16 -05:00
George Joseph ff2ed4eeee Revert "stasis_cache: Stop caching stasis subscription change messages"
This commit caused issues with polling when combined with
the revert commit "Revert "app_voicemail: Remove need to subscribe to stasis"

This reverts commit 17d6d9e1e7.

ASTERISK-28222
Reported by: abelbeck

Change-Id: Ib6a16cbe2c0b74c76c64264f525ab647959c1483
2018-12-26 10:29:51 -06:00
George Joseph 3efe5061d5 ast_coredumper: Refactor the pid determination process
In order to get a dump of the running process, we need to find the
pid of the main asterisk process.  This can be tricky if there are
also instances of "asterisk -r" running or if an alternate location
for asterisk.conf was specified on the command line with the -C
option that also specified an alternation location for the pid file.

So now...

1. We find the asterisk executable with "which" or the --asterisk-bin
   command line option.
2. If there's only 1 process with an executable path that matches,
   we use that pid.  If not...
3. We try "<asterisk-bin> -rx 'core show settings'" and parse the
   output to find the pidfile, then read that for the pid.  If that
   didn't work...
4. We get a list of all the pids matching <asterisk-bin> and look
   in /proc/<pid>/cmdline for a -C argument and retry the "core show
   settings" using the same -C option.  We can't parse the output
   of "ps" to get the -C path because it may contain spaces.  The
   contents of /proc/<pid>/cmdline are delimited by NULLs.  For BSDs
   we may have to mount /proc first. :(

ASTERISK-28221
Reported by: Andrew Nagy

Change-Id: I8aa1f3f912f949df2b5348908803c636bde1d57c
2018-12-24 14:17:32 -05:00
Richard Mudgett 59717b5e85 backtrace.c: Fix casting pointer to/from integral type.
The backtrace library bfd.h include file does not get the sizes of
pointers and ints right on some platforms.  On my old test box the size
of bfd_vma is 8 while the size of a pointer is 4.  gcc on the box
complains of the integer casting to/from pointers size mismatch.

* uintptr_t to the rescue by doing an appropriate two stage cast.

Change-Id: Icb2621583f50c8728de08a3c824d95fe53cc45d0
2018-12-19 13:50:51 -05:00
Joshua C. Colp 08e6cb6480 Merge "res/res_ari: Add additional hangup reasons" into 16 2018-12-19 05:14:41 -06:00
Friendly Automation 0110532bf9 Merge "app_voicemail: Don't delete mailbox state unless mailbox is deleted" into 16 2018-12-19 05:05:54 -06:00
George Joseph 4cbe04de77 Merge "res_pjsip: Patch for res_pjsip_* module load/reload crash" into 16 2018-12-18 10:43:11 -06:00
George Joseph 955129e9a4 Merge "res_rtp_asterisk: Remove some unused structure fields." into 16 2018-12-18 10:42:07 -06:00
George Joseph aebb822d1f app_voicemail: Don't delete mailbox state unless mailbox is deleted
The free_user function was automatically deleting the stasis mailbox
state but this only makes sense when the mailbox is actually
deleted, not just the structure freed.  This was causing issues
where leave_voicemail would publish the mwi message to stasis and
delete the state before the message could be processed by
res_pjsip_mwi.

* Removed the delete of state from free_user().

* Created a new free_user_final() function that both frees the data
  structure and deletes the state.  This function is only called
  during module load/unload where it's appropriate to delete the
  state.

ASTERISK-28215

Change-Id: I305e8b3c930e9ac41d901e5dc8a58fd7904d98dd
2018-12-18 11:40:12 -05:00
Friendly Automation 9b57199a7a Merge "res_format_attr_h264.c: Make sure profile-level-id fmtp attribute is set" into 16 2018-12-17 08:27:36 -06:00
Sean Bright 970805180e res_rtp_asterisk: Remove some unused structure fields.
All of the fields that were removed were no longer referenced except for
'lastrxts' and 'rxseqno' which were only ever written to.

Change-Id: I5a5d31eb33e97663843698f58d0d97f22a76627c
2018-12-14 12:56:27 -05:00
Joshua C. Colp 9e159914dc Merge "bridge_builtin_features.c: Set auto(mix)mon variables on both channels" into 16 2018-12-14 09:37:04 -06:00
Sean Bright f60afac587 res_format_attr_h264.c: Make sure profile-level-id fmtp attribute is set
The profile-iop octet (the 2nd) of profile-level-id can be zero
according to RFC 6184 Section 8.1. So we ignore its value when deciding
to include profile-level-id in the outgoing SDP.

ASTERISK-27959 #close
Reported by: David Kuehling

Change-Id: Id28cd916a3d7748058fe9609b585d07d9e243f73
2018-12-13 17:03:54 -05:00
Joshua C. Colp 84d693a689 Merge "utils: Don't set or clear flags that don't need setting or clearing" into 16 2018-12-13 08:23:42 -06:00
Joshua C. Colp b924594104 Merge "confbridge: announce to the marked users when they join an empty conference" into 16 2018-12-13 08:00:21 -06:00
Sean Bright 640aac768b bridge_builtin_features.c: Set auto(mix)mon variables on both channels
This is how features behaved up through Asterisk 11, but was changed
when the new bridging framework was implemented in Asterisk 12.

Reported by rrittgarn in #asterisk.

Change-Id: I72cf86223947a8118c75f46e2c603dbc11e3125b
2018-12-13 08:52:40 -05:00
Friendly Automation 67e91d012b Merge "stasis: Add statistics gathering in developer mode." into 16 2018-12-12 13:12:04 -06:00
Joshua C. Colp 36db878adc Merge "Use non-blocking socket() and pipe() wrappers" into 16 2018-12-12 11:31:20 -06:00
Alexei Gradinari 2610379605 confbridge: announce to the marked users when they join an empty conference
Currently the file sound_only_person is not played when a marked
user (with announce_only_user=yes) joins an empty conference.

This patch fixes it.

ASTERISK-28201 #close

Change-Id: I85b67687e6b220939c3af8091d83a70a7b174cf4
2018-12-12 12:16:15 -05:00
Joshua C. Colp 68ec7d93e8 stasis: Add statistics gathering in developer mode.
This change adds statistics gathering to Stasis topics,
subscriptions, and message types. These can be viewed using
CLI commands and provide insight into how Stasis is used
and how long certain operations take to execute.

These are only available when Asterisk is compiled in
developer mode and do not have any impact under normal
operation.

ASTERISK-28117

Change-Id: I94411b53767f89ee01714daaecf0c2f1666e863f
2018-12-12 12:14:44 -05:00
Friendly Automation ff147bcf92 Merge "stasis: Allow filtering by formatter" into 16 2018-12-12 11:09:28 -06:00
Joshua C. Colp 569e556656 Merge "pjproject_bundled: check whether UPDATE is supported on outgoing calls" into 16 2018-12-12 11:01:39 -06:00
Joshua C. Colp 88af756419 Merge "build: Update config.guess and config.sub" into 16 2018-12-12 11:01:18 -06:00
George Joseph 66820f19c2 Merge "Revert "RTP: reset DTMF last seqno/timestamp on voice packet with marker bit"" into 16 2018-12-11 14:17:35 -06:00
Sean Bright 9febdba05b Use non-blocking socket() and pipe() wrappers
Change-Id: I050ceffe5a133d5add2dab46687209813d58f597
2018-12-11 12:28:35 -05:00
Sean Bright 16ae8330d2 utils: Don't set or clear flags that don't need setting or clearing
Change-Id: I0e7fb507ac09b15e45e1ff8501ecfca67afa5217
2018-12-11 10:08:02 -05:00
George Joseph cd8101dbd1 Merge "CI: Various updates to buildAsterisk.sh" into 16 2018-12-11 09:07:49 -06:00
Joshua C. Colp 3336a348cc Merge "utils: Wrap socket() and pipe() to reduce syscalls" into 16 2018-12-11 09:02:16 -06:00
Sean Bright 9c9519796b build: Update config.guess and config.sub
Pulled from the authoritative respository at:

  https://git.savannah.gnu.org/cgit/config.git/tree/

Change-Id: I748708ce24d4d47ff1f395075d0b08d3da3355e0
2018-12-11 09:34:24 -05:00
George Joseph df0b59564e Revert "RTP: reset DTMF last seqno/timestamp on voice packet with marker bit"
This reverts commit 331c906c48.

Pending resolution of ASTERISK_28200

Change-Id: Ie7172707b603c1da3f200613bd4473335af75128
2018-12-11 09:28:18 -05:00
Sebastian Damm 59cf552dd3 res/res_ari: Add additional hangup reasons
The ARI DELETE /channels command takes a "reason" parameter
Previously, there were only five reasons implemented
This patch adds more reasons to choose from for more
complex setups

ASTERISK-28198 #close

Change-Id: I85996f1076c9946d65c778413f040a845a90fecc
2018-12-11 05:22:27 -05:00
Joshua C. Colp 29af7f37ac Merge "chan_sip: Fix leak using contact ACL" into 16 2018-12-10 07:05:10 -06:00
Sean Bright 8a18fb81c1 utils: Wrap socket() and pipe() to reduce syscalls
Some platforms provide an implementation of socket() and pipe2() that allow the
caller to specify that the resulting file descriptors should be non-blocking.

Using these allows us to potentially elide 3 calls into 1 by avoiding extraneous
calls to fcntl() to set the O_NONBLOCK flag afterwards.

In passing, change ast_alertpipe_init() to use pipe2() directly instead of the
wrapper if it is available.

Change-Id: I3ebe654fb549587537161506c6c950f4ab298bb0
2018-12-07 09:04:55 -05:00
George Joseph 79899db740 stasis: Allow filtering by formatter
A subscriber can now indicate that it only wants messages
that have formatters of a specific type.  For instance,
manager can indicate that it only wants messages that have a
"to_ami" formatter.  You can combine this with the existing
filter for message type to get only messages with specific
formatters or messages of specific types.

ASTERISK-28186

Change-Id: Ifdb7a222a73b6b56c6bb9e4ee93dc8a394a5494c
2018-12-07 08:58:51 -05:00
Giuseppe Sucameli 6071ad77f5 chan_sip: Fix leak using contact ACL
Free old peer's contactacl before overwrite it within build_peer.

ASTERISK-28194

Change-Id: Ie580db6494e50cee0e2a44b38e568e34116ff54c
2018-12-05 17:17:11 -05:00
David M. Lee 1657508ddd
Removing registrar_expire from basic-pbx config
The module has been removed, so it shouldn't be in the default config any more.

Change-Id: Ie7e09f00f9c9a885574e29478250de4c2cefd9f1
2018-12-05 15:28:03 -06:00
George Joseph a6c2662404 CI: Various updates to buildAsterisk.sh
* Added ---no-configure, --no-menuselect, --no-make and --no-alembic
  options that prevent those actions from being performed.  Useful
  for testing and re-running portions of the build after fixing
  earlier failures.

* Added "set -e" to abort the script on command failure.
  Not sure why this wasn't there in the first place.

* Fixed a few echos that were redirecting to stderr when they shouldn't
  have been.

* Catch more alembic failures by actually trying to generate the SQL.

Change-Id: I9f395fa4e9254be7299e7c1014f1a13db78faffb
2018-12-05 12:02:54 -05:00
George Joseph 36bf94c3a8 Merge "test_websocket_client.c: Disable websocket_client_create_and_connect test." into 16 2018-12-05 08:17:50 -06:00
Kevin Harwell 12a30c71d8 pjsip_add_use_callerid_contact: fixed alembic script
Change-Id: I413f1583c797fb79651786cd8d0b003599f8ed10
2018-12-03 17:45:57 -06:00
Sean Bright 27806fd04d core: Add some documentation to the malloc_trim code
This adds documentation to handle_cli_malloc_trim() indicating how it
can be useful when debugging OOM conditions.

Change-Id: I1936185e78035bf123cd5e097b793a55eeebdc78
2018-12-03 17:47:18 -05:00
George Joseph b5d3ddeef3 Merge "core: Merge malloc_trim patch" into 16 2018-12-03 16:26:42 -06:00
George Joseph 8071697653 Merge "app_queue: Revert broken queue channel reference patch" into 16 2018-12-03 15:08:46 -06:00
Chris-Savinovich 1f09c61804 core: Merge malloc_trim patch
We've had multiple opportunities where Richard Mudgett's
malloc_trim patch has been useful. Let's get it
pushed up to gerrit and merged.

Since malloc_trim is only available in libc, an entry is
added to configure.ac to create a definition for
HAVE_MALLOC_TRIM.

Change-Id: Ia38308c550149d9d6eae4ca414a649957de9700c
2018-12-03 15:07:17 -05:00
Chris-Savinovich 60e548ffa5 test_websocket_client.c: Disable websocket_client_create_and_connect test.
This test was occasionally failing, with:

  WARNING[5812]: http.c:1939 httpd_helper_thread: Failed to set
      TCP_NODELAY on HTTP connection: Bad file descriptor
  ERROR[5812]: iostream.c:91 ast_iostream_nonblock: Failed to get
      fcntl() flags for file descriptor: Bad file descriptor
  ERROR[5812]: iostream.c:569 ast_iostream_close: close() failed: Bad
      file descriptor

Disabled for now by making the test explicit only.

Change-Id: I778f6cbb6104c6b4e89737a2eaf1a9540888d351
2018-12-02 08:55:18 -05:00
Pirmin Walthert 5de36abd5a pjproject_bundled: check whether UPDATE is supported on outgoing calls
In ASTERISK-27095 an issue had been fixed because of which chan_pjsip was not
trying to send UPDATE messages when connected_line_method was set to invite.
However this only solved the issue for incoming INVITES. For outgoing INVITES
(important when transferring calls) the options variable needs to be updated
at a different place.

ASTERISK-28182 #close
Reported-by: nappsoft

Change-Id: I76cc06da4ca76ddd6dce814a8b97cc66b98aaf29
2018-11-30 09:33:49 -05:00
George Joseph a2a8a41db3 Revert "app_voicemail: Remove need to subscribe to stasis"
This reverts commit 29115e2384.

That commit closed a long standing hole which allowed subscriptions
to mailboxes that weren't configured in voicemail.conf.  This
caused an issue with FreePBX which depdended on that behavior.
The commit is being reverted until FreePBX can handle the new
behavior.

ASTERISK-28151
Reported by: Ronald Raikes

Change-Id: I57b7b85e75d7dd97c742b5c69d718a0f61260c15
2018-11-29 12:26:16 -07:00
Kevin Harwell 618f081c3c Merge "test_cel: Plug a few ref leaks" into 16 2018-11-29 12:57:19 -06:00
Jenkins2 e67537dd98 Merge "jansson: Upgrade to 2.12." into 16 2018-11-29 12:14:06 -06:00
lvl aa004295f9 app_queue: Revert broken queue channel reference patch
Revert commit 6409e7b11a, and add
NULL checks for all app_queue event handling code.

Related issues: ASTERISK~25185, ASTERISK~27006, ASTERISK~25844

ASTERISK-28125

Change-Id: I37334ea184ebb56e54471496b82937d4927815a0
2018-11-27 15:26:33 -05:00
George Joseph a5e77e9c37 test_cel: Plug a few ref leaks
These are only a few of the leaks.  The large number of macros
and return paths in this file would make a weeks worth of work
to plug them all.

Change-Id: Ie2369fa944023d44767871c5c30974cb077ffb56
2018-11-26 17:19:43 -05:00
George Joseph 0ad0e89ba3 Merge "astobj2: Create function to copy weak proxied objects from container." into 16 2018-11-26 13:49:47 -06:00
Joshua Colp 450ca98220 Merge "RTP: need to reset DTMF last seqno/timestamp on voice packet with marker bit" into 16 2018-11-26 13:47:10 -06:00
Joshua Colp 53d0664781 Merge "func_strings: HASHKEY - negative array index can cause corruption" into 16 2018-11-26 07:43:35 -06:00
Corey Farrell 606304eb54 jansson: Upgrade to 2.12.
This brings in jansson-2.12, removes all patches that were merged
upstream.  README is created in third-party/jansson/patches to explain
how to add patches but also because the patches folder must exist for
the build process to succeed.

Change-Id: If0f2d541c50997690660c21fb7b03d625a5cdadd
2018-11-26 07:16:07 -05:00
Alexei Gradinari 331c906c48 RTP: need to reset DTMF last seqno/timestamp on voice packet with marker bit
The marker bit set on the voice packet indicates the start
of a new stream and a new time stamp.
Need to reset the DTMF last sequence number and the timestamp
of the last END packet.

If the new time stamp is lower then the timestamp of the last DTMF END packet
the asterisk drops all DTMF frames as out of order.

This bug was caught using Cisco ip-phone SPA50X and codec g722.
On SIP session update the SPA50X resets stream indicating it with market bit
and a new timestamp is twice smaller then the previous.

ASTERISK-28162 #close

Change-Id: If9c5742158fa836ad549713a9814d46a5d2b1620
2018-11-23 11:18:47 -05:00
Corey Farrell ed7a5664b6
astobj2: Eliminate usage of legacy ao2_container_alloc routine.
Replace usage of ao2_container_alloc with ao2_container_alloc_hash or
ao2_container_alloc_list.

ao2_container_alloc is now restricted to modules only and is being
removed from Asterisk 17.

Change-Id: I0907d78bc66efc775672df37c8faad00f2f6c088
2018-11-21 09:56:12 -05:00
Corey Farrell 0d2b39065f astobj2: Create function to copy weak proxied objects from container.
Create ao2_container_dup_weakproxy_objs to perform a similar function to
ao2_container_dup.  This function expects the source container to have
weakproxy objects, inserts the associated non-weak objects into the
destination container.  Orphaned weakproxy objects are ignored.

Create test for this new function and for ao2_weakproxy_find.

Change-Id: I898387f058057e08696fe9070f8cd94ef3a27482
2018-11-21 08:48:25 -05:00
Sungtae Kim 1b6df87816
res_pjsip: Patch for res_pjsip_* module load/reload crash
The session_supplements for the pjsip makes crashes when the module
load/unload.

ASTERISK-28157

Change-Id: I5b82be3a75d702cf1933d8d1417f44aa10ad1029
2018-11-21 07:04:24 -05:00
Joshua Colp 0e096aefac Merge "app_queue: Cleanup queue_ref / queue_unref routines." into 16 2018-11-20 05:05:21 -06:00
Jenkins2 5f9a17bcdb Merge "stasis: Remove stringfields and lock from change message." into 16 2018-11-20 05:03:56 -06:00
Kevin Harwell 72e532136c func_strings: HASHKEY - negative array index can cause corruption
This patch makes it so only matching non-empty key names, and keys created by
the HASH function are eligible for inclusion in the comma separated string. It
also fixes a bug where it was possible to write to a negative index if the
result buffer was empty.

ASTERISK-28159
patches:
  ASTERISK-28159.diff submitted by Michael Walton (license 6502)

Change-Id: I6e57fe7307dfd856271753aed5ba64c59b511487
2018-11-19 14:41:52 -05:00
George Joseph 729967e99c CI: Get job timeouts from environment
The job timeouts were hard coded in the jenkinsfiles which
means changes had to go through gerrit.  Now they are taken
from the following environment variables (and their defaults) that
can be set in Jenkins configuration...

TIMEOUT_GATES =      "60 MINUTES"
TIMEOUT_DAILIES =    "3 HOURS"
TIMEOUT_REF_DEBUG =  "24 HOURS"
TIMEOUT_UNITTESTS =  "30 MINUTES"

Change-Id: I673a551c1780bf665a3bc160b245da574aa4bbab
2018-11-19 13:05:03 -05:00
Joshua C. Colp d05c219aad stasis: Remove stringfields and lock from change message.
When a subscribe or unsubscribe occurs a message is published
containing this information. This change makes it so that the
message no longer uses stringfields or a lock, as both are not
really needed for the message.

Change-Id: I3f4831931d79f94fd979baf48048738df5dc1632
2018-11-19 12:00:28 -05:00
Joshua Colp 3506f84a37 Merge "test_res_pjsip_scheduler: Fix possible write after free in scheduler_policy." into 16 2018-11-19 09:38:41 -06:00
Joshua Colp 2d4146d005 Merge "res/res_ari: Fix null endpoint handle" into 16 2018-11-19 09:37:32 -06:00
Joshua Colp d388977efb Merge "bridge_native_rtp.c: Fail native bridge if no framing match." into 16 2018-11-19 09:35:58 -06:00
Joshua Colp 7f813cdec8 Merge "res_pjsip_caller_id: Use static pj_str_t for fromto header names." into 16 2018-11-19 08:40:13 -06:00
Joshua Colp cc0157d0d3 Merge "stasis: Add internal filtering of messages." into 16 2018-11-19 08:37:05 -06:00
Corey Farrell f9b9bdd0b0
app_queue: Cleanup queue_ref / queue_unref routines.
This replaces the inline functions with macros.  This removes the need
to directly use __ao2_ref, opts instead for standard ao2_bump and
ao2_cleanup macros.

Change-Id: If4e04e9bab2e3c883188437cb9f487b3e498a21b
2018-11-19 08:00:03 -05:00
George Joseph 41eab5b3b8 backtrace: Refactor ast_bt_get_symbols so it doesn't crash
We've been seeing crashes in libbfd when we attempt to generate
a stack trace from multiple threads.  It turns out that libbfd
is NOT thread-safe.  It can cache the bfd structure and give it to
multiple threads without protecting itself.  To get around this,
we've added a global mutex around the bfd functions and also have
refactored the use of those functions to be more efficient and
to provide more information about inlined functions.

Also added a few more tests to test_pbx.c.  One just calls
ast_assert() and the other calls ast_log_backtrace().  Neither are
run by default.

WARNING:  This change necessitated changing the return value of
ast_bt_get_symbols() from an array of strings to a VECTOR of
strings.  However, the use of this function outside Asterisk is not
likely.

ASTERISK-28140

Change-Id: I79d02862ddaa2423a0809caa4b3b85c128131621
2018-11-19 05:48:42 -07:00
Sungtae Kim cb83350230 res/res_ari: Fix null endpoint handle
The res_ari(POST /channels/create handler) deos not check the endpoint
parameter length. And it causes core
dump.
Fixed it to check the parameter length. Also fixed memory leak.

ASTERISK-28169

Change-Id: Ibf10a9eb8a2e3a9ee1e13fbe748b2ecf955c3993
2018-11-19 06:22:10 -05:00
George Joseph e0a4df64cd Merge "pjsip: New function PJSIP_PARSE_URI to parse URI and return part of URI" into 16 2018-11-18 16:11:21 -06:00
Alexei Gradinari e6005f1227 pjsip: New function PJSIP_PARSE_URI to parse URI and return part of URI
New dialplan function PJSIP_PARSE_URI added to parse an URI and return
a specified part of the URI.

This is useful when need to get part of the URI instead of cutting it
using a CUT function.

For example to get 'user' part of Remote URI
${PJSIP_PARSE_URI(${CHANNEL(pjsip,remote_uri)},user)}

ASTERISK-28144 #close

Change-Id: I5d828fb87f6803b6c1152bb7b44835f027bb9d5a
2018-11-18 13:27:15 -07:00
George Joseph 2ca3813c52 Merge "pjproject-bundled: Use AST_DEVMODE for conditional compilation." into 16 2018-11-18 14:13:37 -06:00
Joshua Colp 8d436a95e7 stasis: Add internal filtering of messages.
This change adds the ability for subscriptions to indicate
which message types they are interested in accepting. By
doing so the filtering is done before being dispatched
to the subscriber, reducing the amount of work that has
to be done.

This is optional and if a subscriber does not add
message types they wish to accept and set the subscription
to selective filtering the previous behavior is preserved
and they receive all messages.

There is also the ability to explicitly force the reception
of all messages for cases such as AMI or ARI where a large
number of messages are expected that are then generically
converted into a different format.

ASTERISK-28103

Change-Id: I99bee23895baa0a117985d51683f7963b77aa190
2018-11-18 15:08:07 -05:00
George Joseph dd0a3c0bba CI: Add tmpfs to all jenkinsfiles
Change-Id: Ida29d70d48d5f39aabf0b25c66b51f79324a8cba
2018-11-18 11:39:13 -05:00
George Joseph 9bb155d95e Merge "res/res_pjsip_nat: Fix logic for REINVITES" into 16 2018-11-18 08:46:53 -06:00
George Joseph 7d11718a80 Merge "taskprocessor: Prevent race creating new taskprocessor." into 16 2018-11-17 17:28:21 -06:00
George Joseph 77e9c877b5 CI: Mount a tmpfs on /tmp for testsuite docker containers
Change-Id: I0566d81b0852f22066cd76d58eae5f1fda5602aa
(cherry picked from commit 73efe86436)
2018-11-17 17:07:25 -05:00
George Joseph 0552bc2a94 CI: Pass work directory to runTestsuite
The testsuite can now use a user-specified work directory for
all it's temp files.  This allows the docker containers to use
a tmpfs backed directory for the temp files instead of it's
own write-layer image.

* runTestsuite.sh now accepts a --work-dir command line argument
  that gets exported as AST_WORK_DIR before running the testsuite.

* gates.jenkinsfile now specifies --work-dir to be
  <testsuite_dir>/astroot.

Since the Asterisk CI docker hosts now mount /srv/jenkins/workspace
on a tmpfs, asterisk should be compiled and the testsuite run all in
memory.

Change-Id: If5ee905a15821296c355bb84cda38950ad8edc45
(cherry picked from commit a335f4c9ad)
2018-11-17 17:05:24 -05:00
George Joseph 0ba1993887 Merge "CI: Allow runUnittests to use 'expect' to run the tests" into 16 2018-11-17 11:30:21 -06:00
George Joseph ccf38b3e34 Merge "core: Fix handling of restart from remote console." into 16 2018-11-16 09:22:36 -06:00
George Joseph 7ba8f32632 CI: Allow runUnittests to use 'expect' to run the tests
There seems to be a race condition between starting the asterisk
daemon and attempting to use 'asterisk -r' that can cause the
control socket file to not be created.  Since all of the Jenkins
slaves have 'expect' installed, the runUnittests script can use
it to start asterisk in the forground and issue the commands
interactively.  This is much more reliable and it can also make
startup errors more visible since they'll be in the Jenkins console
output.

If 'expect' isn't installed, the original daemon/asterisk -r
process is used.

Also added a "core show settings" before running the tests
and added "notice,warning,error" to the console log.

Change-Id: Idd656085f854afede813ac241b9e312b31358160
2018-11-16 10:03:43 -05:00
Corey Farrell 699dfa9401 taskprocessor: Prevent race creating new taskprocessor.
Task processors are retrieved using a 'get or create' pattern.  The
singleton container was unlocked between the get and create steps so
it's possible that two threads could create task processors with the
same name at the same time.

Change-Id: Id64fae94a6a1e940ddf38fde622dcd4391635382
2018-11-16 08:55:52 -05:00
Corey Farrell 3bdf6ac918 pjproject-bundled: Use AST_DEVMODE for conditional compilation.
We previously allowed resample and g711 codecs to be built when
TEST_FRAMEWORK was enabled.  This could cause errors if the testsuite
was run without this option enabled.  Switch the build system to allow
those codecs to be built when --enable-dev-mode is used.  This removes a
chance for strange testsuite errors from use of an inadequate pjsua
binary.

Change-Id: Iee8a3613cdb711fa7e7d217c5a775a575907ae22
2018-11-16 08:27:07 -05:00
Corey Farrell 2a76489eba
res_pjsip_caller_id: Use static pj_str_t for fromto header names.
PJSIP assumes that these header names are not allocated, does not clone
the name strings when reusing headers.

Block unload of res_pjsip_caller_id until shutdown to ensure static
memory stays valid.  It was previously unsafe to unload while any
sessions are active.

Change-Id: I190854dea943d6e441cf03733f8a0da661aea27f
2018-11-15 15:48:31 -05:00
George Joseph 6e1471c0b2 Merge "pbx_config: Only the first [globals] section is seen." into 16 2018-11-15 07:48:38 -06:00
Torrey Searle 7b2282c890 res/res_pjsip_nat: Fix logic for REINVITES
The presence of Record-Route in re-invites is optional, thus it is
important to make sure the dialog doesn't have a routset before
rewriting the contact header.

ASTERISK-28129 #close

Change-Id: Ic8ceb54ccfc93f7e315e476c514a2c777f2da7dc
2018-11-15 06:35:14 -05:00
Corey Farrell a36cd6960c
core: Fix handling of restart from remote console.
We cannot use need_el_end and SIGURG when restarting.  Instead we need
to run el_end within the SIGHUP restartnow handler.

ASTERISK-28158

Change-Id: Ia852276363c81bdcf1aa29eb4558c5c2fa1218a0
2018-11-15 06:33:11 -05:00
George Joseph 009d67cd28 AST-2018-010: Fix length of buffer needed for SRV and NAPTR results
When dn_expand was being called on SRV and NAPTR results, the
return value was being used to calculate the size of the buffer
needed to store the host names.  Since dn_expand returns the
length of the COMPRESSED name the buffer could be too short
to hold the EXPANDED name.  The expanded name is NULL terminated
so using strlen() is the correct way to determine the length
actually needed for the buffer.

ASTERISK-28127
Reported by: Jan Hoffmann

patches:
  patch.diff submitted by janhoffmann (license 6986)

Change-Id: I4d35d6c431c6c6836cb61d37b1378cc47f0b414d
2018-11-14 09:25:06 -05:00
Joshua Colp bd5dde4e83 Merge "taskprocessor: Do not use separate allocation for stats or name." into 16 2018-11-14 07:05:42 -06:00
George Joseph 0785af921d Merge "jansson-bundled: Patch for off-nominal crash." into 16 2018-11-13 14:39:53 -06:00
Corey Farrell 89d97da8a4 test_res_pjsip_scheduler: Fix possible write after free in scheduler_policy.
It's possible for a 4th task to be spawned before we cancel.  This
results in a write to the already freed test_data1.  Wait long enough to
verify success of the cancelation before freeing test_data1.

Change-Id: I057e2fcbe97f8a175e50890be89c28c20490a20f
2018-11-13 13:26:01 -05:00
George Joseph ff7a772395 Merge "core: Ensure that el_end is always run when needed." into 16 2018-11-13 10:50:49 -06:00
Robert Cripps df703c1853 bridge_native_rtp.c: Fail native bridge if no framing match.
ASTERISK-28110 #close

Change-Id: Ic64b8fc6a140a93fbdb2f97550a40d0ff334e607
2018-11-13 04:07:22 -05:00
Corey Farrell 05c79fdf06 taskprocessor: Do not use separate allocation for stats or name.
Merge storage for the stats object and name string into the main
allocation for struct ast_taskprocessor.

Change-Id: I74fe9a7f357f0e6d63152f163cf5eef6428218e1
2018-11-12 08:15:48 -05:00
Joshua Colp 38e609656a Merge "res_pjsip.c: Make taskprocessor scheduling algorithm pick the shortest queue" into 16 2018-11-12 05:38:36 -06:00
Corey Farrell 3cde7e30ba
core: Ensure that el_end is always run when needed.
* Ignore console=yes configuration option in remote console processes.
* Use new flag to tell consolethread to run el_end and exit when needed.

ASTERISK-28158

Change-Id: I9e23b31d4211417ddc88c6bbfd83ea4c9f3e5438
2018-11-11 08:43:29 -05:00
Corey Farrell 1c008c6de5 jansson-bundled: Patch for off-nominal crash.
pack_string crashed on non-NULL strings returned when s->has_error was
true if the string was the result of 's' format without '#', '%' or '+'.

Change-Id: Ic125df691d81ba2cbc413e37bdae657b304d20d0
2018-11-08 18:02:03 -05:00
Kevin Harwell b969e7769d Merge "res_pjsip: Send a 503 response when overload state if reliable transport." into 16 2018-11-08 13:05:46 -06:00
Corey Farrell 07a59b783e
pbx_config: Only the first [globals] section is seen.
If multiple [globals] sections are used (for example via separate
included files), only the first one is processed.  This can result in
lost global variables when using a modular extensions.conf.

ASTERISK-28146 #close

Change-Id: Iaac810c0a7c4d9b1bf8989fcc041cdb910ef08a0
2018-11-08 06:43:06 -05:00
Chris-Savinovich 9c9bc5acca res_pjsip: Send a 503 response when overload state if reliable transport.
When Asterisk's taskprocessors get overloaded we need to reduce the work
load. res_pjsip currently ignores new SIP requests and relies on SIP
retransmissions in the hope that the overload condition will clear soon
enough to handle the retransmitted SIP request.
This change adds the following code after ast_taskprocessor_alert_get()
has returned TRUE:
1- identifies transport type. If non-udp then send a 503 response
2- if transport type is udp/udp6 then ignore, as before.

Change-Id: I1c230b40d43a254ea0f226b7acf9ee480a5d3836
2018-11-07 06:55:41 -06:00
Joshua Colp 907ea79a92 Merge "stasis: Clarify lifetime of topics." into 16 2018-11-07 06:08:39 -06:00
Kevin Harwell 03efafbd4d res_pjsip: formatting error in documentation
The use of a '|' in the "global/debug" synopsis documentation caused the
generated html table on the wiki to add an extra column that included the
text after the pipe.

This patch replaces the pipe with a comma.

ASTERISK-28150

Change-Id: I3d79a6ca6d733d9cb290e779438114884b98a719
2018-11-06 17:03:38 -06:00
Alexei Gradinari 3e3f3bfb07 res_pjsip.c: Make taskprocessor scheduling algorithm pick the shortest queue
The current round-robin method does not take the current taskprocessor
load into consideration when distributing requests.  Using the least-size
method the request goes to the taskprocessor that is servicing the least
number of active tasks at the current time.

Longer running tasks with the round-robin method can delay processing
tasks.

* Change the algorithm from round-robin to least-size for picking the
PJSIP taskprocessor from the default serializer pool.

Change-Id: I7b8d8cc2c2490494f579374b6af0a4868e3a37cd
2018-11-06 10:26:00 -05:00
George Joseph 5710cf7c94 Merge "chan_sip: Attempt ast_do_pickup in handle_invite_replaces" into 16 2018-11-05 09:32:34 -06:00
Joshua Colp 27897a850d stasis: Clarify lifetime of topics.
As mentioned in the comment I've added in the code there is no
ability to unsubscribe all subscribers from a topic and explicitly
destroy it. This is not currently a problem as we have two types of
topics:

Long lived topics which exist for the lifetime of the system.
Ephemeral topics which feed a long lived topic.

In the case of the ephemeral topics there is no subscriber which does
not have its lifetime managed by the same entity that has created
the topic. This ensures that when the topic is being unreferenced the
subscribers are also unsubscribed and destroyed, allowing the topic
to ultimately be destroyed as well.

Change-Id: Ic5e244da7b16b1895ba1fc5ece481ebba5809c9a
2018-11-05 09:46:45 -05:00
Jasper Hafkenscheid 7f6ac5dc2f chan_sip: Attempt ast_do_pickup in handle_invite_replaces
When a call pickup is performed using and invite with replaces header
the ast_do_pickup method is attempted and a PICKUP stasis message is sent.

ASTERISK-28081 #close
Reported-by: Luit van Drongelen

Change-Id: Ieb1442027a3ce6ae55faca47bc095e53972f947a
2018-11-02 10:21:37 -05:00
Pascal Cadotte Michaud a6d1723727
contrib/sip_to_pjsip: add a --quiet option to avoid prints
Using the --quiet or -q option in conjonction with /dev/stdout as the output
file allow the output to be used as a valid configuration.

Given a script that generates a valid sip.conf I can pipe the output of that
script into `sip_to_pjsip.py -q /dev/stdin /dev/stdout`. This allow me to use
that piped command in my pjsip.conf using the `exec` command.

ASTERISK-28136

Change-Id: I7b0e2e90e2549f3f8e01dc96701f111b5874c88d
2018-11-01 08:47:26 -04:00
George Joseph f9708adcc8 Merge "res_pjsip: Add XML documentation for "use_callerid_contact"" into 16 2018-10-31 13:59:15 -05:00
George Joseph 021a425011 Merge "alembic: Fix use_callerid_contact option add script." into 16 2018-10-31 13:58:21 -05:00
George Joseph 66a5d96c51 Merge "pjsip: new endpoint's options to control Connected Line updates" into 16 2018-10-31 13:57:00 -05:00
George Joseph b5245b6f36 Merge "contrib/sip_to_pjsip: handle setvar in conversion" into 16 2018-10-31 13:55:32 -05:00
Joshua Colp 9c5e75acb0 res_pjsip: Add XML documentation for "use_callerid_contact"
ASTERISK-28087

Change-Id: I69d48813ec514f5ef06c6de994cba52630e0a3b4
2018-10-31 08:22:28 -05:00
Richard Mudgett 719daf3299 alembic: Fix use_callerid_contact option add script.
ASTERISK-28087

Change-Id: I046d018015427d0916fab571b5a4f5367476f729
2018-10-30 10:57:29 -05:00
Alexei Gradinari 5cbe77cc46 pjsip: new endpoint's options to control Connected Line updates
This patch adds new options 'trust_connected_line' and 'send_connected_line'
to the endpoint.

The option 'trust_connected_line' is to control if connected line updates
are accepted from this endpoint.

The option 'send_connected_line' is to control if connected line updates
can be sent to this endpoint.

The default value is 'yes' for both options.

Change-Id: I16af967815efd904597ec2f033337e4333d097cd
2018-10-30 10:40:32 -05:00
George Joseph e8eb659afa Merge "res_pjsip_notify: improve realtime performance on CLI completion on the endpoint" into 16 2018-10-29 13:22:52 -05:00
Alexei Gradinari fbee505611 res_pjsip_notify: improve realtime performance on CLI completion on the endpoint
The module 'res_pjsip_notify' inefficiently makes a lot of DB requests
on CLI completion on the endpoint.

For example if there are 10k endpoints the module makes 10k requests
of these 10k records.

Even if a part of the endpoint entered
the module makes the same 10k requests and then filtered them by itself.

This patch gathers endpoints container by prefix
and adds all gathered endpoints to completion at once.

ASTERISK-28137 #close

Change-Id: Ic20024912cc77bf4d3e476c4cd853293c52b254b
2018-10-27 17:50:53 -05:00
Pascal Cadotte Michaud 6c2f9b730e
contrib/sip_to_pjsip: handle setvar in conversion
Given a sip.conf with the following content:

setvar FOO=1
setvar BAR=42

I want my generated pjsip.conf to containt the following set_vars

set_var FOO=1
set_var BAR=42

in the matching endpoint section.

Change-Id: I6c822401fda4133c3b44bf31e655b4eb939d4d26
2018-10-27 10:59:15 -04:00
Torrey Searle 3ba66b8a9d res_pjsip_session: add new flag use_callerid_contact
Add a new global flag to res_pjsip to allow the callerid to be used
as the username in the contact header.  This allows chan_pjsip to have
the same behavour as chan_sip

ASTERISK-28087 #close

Change-Id: I9a720e058323f6862a91c62f8a8c1a4b5c087b95
2018-10-26 02:42:27 -05:00
Joshua Colp 3f4f31fed6 Merge "app_dial/queue/followme: 'I' options to block initial updates in both directions" into 16 2018-10-25 07:46:16 -05:00
Joshua Colp d69a0cee03 Merge "bridge_softmix: Add SDP "label" attribute to streams" into 16 2018-10-25 07:45:40 -05:00
Joshua Colp b0b03c8295 Merge "modules.conf.sample: Update preload usage documentation." into 16 2018-10-25 06:56:21 -05:00
Richard Mudgett fbb577577c logger.c: Fix default console logging when no logger.conf available.
Default logging was not setup correctly when there was no logger.conf.
This resulted in many expected log messages not actually getting out to
the console.

Change-Id: I542e61c03b2f630ff5327f9de5641d776c6fa70c
2018-10-24 17:18:12 -05:00
Alexei Gradinari 190b3d7412 app_dial/queue/followme: 'I' options to block initial updates in both directions
The 'I' option currently blocks initial CONNECTEDLINE or REDIRECTING updates
from the called parties to the caller.

This patch also blocks updates in the other direction before call is
answered.

ASTERISK-27980

Change-Id: I6ce9e151a2220ce9e95aa66666933cfb9e2a4a01
2018-10-24 14:15:17 -05:00
Richard Mudgett 11427a9665 modules.conf.sample: Update preload usage documentation.
Change-Id: Id449d4435c38148b56ac4cfd61ae4d90ac66bb90
2018-10-24 12:50:08 -05:00
George Joseph fec66b8f01 bridge_softmix: Add SDP "label" attribute to streams
Adding the "label" attribute used for participant info correlation
was previously done in app_confbridge but it wasn't working
correctly because it didn't have knowledge about which video
streams belonged to which channel.  Only bridge_softmix has that
data so now it's set when the bridge topology is changed.

ASTERISK-28107

Change-Id: Ieddeca5799d710cad083af3fcc3e677fa2a2a499
2018-10-24 07:38:13 -06:00
George Joseph 4eef448acc Merge "astobj2: Eliminate usage of legacy container allocation macros." into 16 2018-10-24 08:30:56 -05:00
George Joseph 891a270275 Merge "app_dial/app_queue: Update application option documentation" into 16 2018-10-24 07:47:29 -05:00
George Joseph 7e6a7dcdc0 Merge "lock: Replace __ast_mutex_logger with private log_mutex_error." into 16 2018-10-24 07:46:30 -05:00
Richard Mudgett 1413200c7c Merge "samples: PARKINGSLOT -> PARKING_SPACE in parking sample config" into 16 2018-10-22 10:20:52 -05:00
Corey Farrell dee1165d31
astobj2: Eliminate usage of legacy container allocation macros.
These macros have been documented as legacy for a long time but are
still used in new code because they exist.  Remove all references to:
* ao2_container_alloc_options
* ao2_t_container_alloc_options
* ao2_t_container_alloc

These macro's are still available for use but only in modules.  Only
ao2_container_alloc remains due to it's use in over 100 places.

Change-Id: I1a26258b5bf3deb081aaeed11a0baa175c933c7a
2018-10-19 17:33:02 -04:00
Corey Farrell 90887af808 lock: Replace __ast_mutex_logger with private log_mutex_error.
__ast_mutex_logger used the variable `canlog` without accepting it as a
argument.  Replace with internal macro `log_mutex_error` which takes
canlog as the first arguement.  This will prevent confusion when working
with lock.c code, many of the function declare the canlog variable and
in some cases it previously appeared to be unused.

Change-Id: I83b372cb0654c5c18eadc512f65a57fa6c2e9853
2018-10-19 11:43:25 -05:00
Jenkins2 14d1e6ca2a Merge "Fix 'statement' typo throughout code." into 16 2018-10-19 09:05:56 -05:00
George Joseph a3116842ff Merge "modules: Add missing run time module support levels." into 16 2018-10-19 08:39:32 -05:00
George Joseph 6989915ab6 Merge "taskprocessor: Warn on unused result from pushing task." into 16 2018-10-19 08:38:40 -05:00
Richard Mudgett 00284352b3 app_dial/app_queue: Update application option documentation
* Update the post-answer documentation and example.  The Dial example was
incorrect and misleading for the post-answer subroutine useage.

* Fix note and warning paragraphs in option descriptions.  They don't show
up in the wiki.

Change-Id: I81019a1fd75d5b9151f76b52c38e2a90da682d14
2018-10-18 17:22:14 -05:00
Sean Bright 495a1e7e5c samples: PARKINGSLOT -> PARKING_SPACE in parking sample config
PARKINGSLOT was deprecated in Asterisk 12 but the sample config was not
updated to reflect that.

Change-Id: I3e087c19d9ee587094fa5304102d8084a79c2b3c
2018-10-18 14:57:58 -05:00
Richard Mudgett 2384d6eb87 Fix 'statement' typo throughout code.
Most were in comments.  A couple were in warning messages.

Pointed out by Jonathan H on the Asterisk users mailing list.

Change-Id: I6286939dff5d0a27a2758140570106f1cb351855
2018-10-18 12:44:03 -05:00
Richard Mudgett 718ccd51a3 res_rtp_asterisk.c: Add conditional module dependency to res_pjproject
* The dependency ensures that res_pjproject cannot be manually unloaded
before res_rtp_asterisk.
* The dependency allows startup loading errors to report that
res_rtp_asterisk depends upon res_pjproject.

Change-Id: Icf5e7581f4ddd6189929f6174c74dd951f887377
2018-10-17 16:08:19 -05:00
Richard Mudgett 7687630074 modules: Add missing run time module support levels.
Change-Id: I29b9dbfa4bbfc49f21eba356858e38b1d3041824
2018-10-17 14:34:55 -05:00
George Joseph 7c7cdab2af Merge "bundled pjproject: Remove timer cleanup usage patch." into 16 2018-10-17 10:15:43 -05:00
Corey Farrell abee4fd072 taskprocessor: Warn on unused result from pushing task.
Add attribute_warn_unused_result to ast_taskprocessor_push,
ast_taskprocessor_push_local and ast_threadpool_push.  This will help
ensure we perform the necessary cleanup upon failure.

Change-Id: I7e4079bd7b21cfe52fb431ea79e41314520c3f6d
2018-10-17 08:27:25 -05:00
George Joseph ebd8e0720d Merge "refdebug: Create refstats.py script." into 16 2018-10-16 13:43:19 -05:00
Richard Mudgett 3fe9c41342 bundled pjproject: Remove timer cleanup usage patch.
This patch is not in the upstream pjproject and does unsafe things with
the timer->_timer_id and timer->_grp_lock values in pj_timer_entry_reset()
outside of the timer heap lock.  pj_timer_entry_reset() is also called for
timers that are not about to be rescheduled in a few places.

Change-Id: I4fe0b4bc648f7be5903cf4531b94fc87275713c1
2018-10-16 12:37:36 -05:00
George Joseph 8c2c6ba913 Merge "threadpool: Eliminate pointless AO2 usage." into 16 2018-10-16 10:15:36 -05:00
Corey Farrell 35f44be460
refdebug: Create refstats.py script.
This allows us to process AO2 statistics for total objects, memory
usage, memory overhead and lock usage.

* Install refstats.py and reflocks.py into the Asterisk scripts folder.
* Enable support for reflocks.py without DEBUG_THREADS.

Steal a bit from the ao2 magic to flag when an object lock is used.
Remove 'lockobj' from reflocks.py since we can now record 'used' or
'unused' for those objects.

Add comments to explain thread safety of the 'struct __priv_data'
bitfields.

Change-Id: I84e9d679cc86d772cc97c888d9d856a17e0d3a4a
2018-10-15 16:35:20 -04:00
Alexei Gradinari 0f53930c05 res_pjsip: set callerid_tag to empty string
This patch sets the callerid_tag to empty string by default.

If the callerid_tag is set to NULL then the tag does not
become part of a connected line update.
For example:
Alice's tag is "Alice".
Bob's tag is empty.
Charlie's tag is "Charlie".
Alice calls Bob and then does attended transfer to Charlie.
When Alice hangs up the CONNECTEDLINE(tag) is "Alice"
on the interception routine on the Charlie's channel, but should be empty.

Ths patch also fix memory leaks if there are more then one options
"callerid", "callerid_tag", "voicemail_extension" and "contact_user"
in the pjsip.conf endpoint definition.

Change-Id: I86ba455c4677ca8d516d9a04ce7fb4d24dd576e4
2018-10-15 14:18:09 -05:00
George Joseph 649ee402e5 Merge "main/astfd: Fix GCC8 format-truncation warning." into 16 2018-10-15 10:34:47 -05:00
George Joseph a529aa9bfe Merge "res_statsd.c: Fix returned reload status." into 16 2018-10-15 10:31:35 -05:00
Corey Farrell 08e5bbfec0
threadpool: Eliminate pointless AO2 usage.
thread_worker_pair, set_size_data and task_pushed_data structures are
allocated with AO2 objects, passed to a taskprocessor, then released.
They never have multiple owners or use locking so AO2 only adds
overhead.

Change-Id: I2204d2615d9d952670fcb48e0a9c0dd1a6ba5036
2018-10-13 06:38:57 -04:00
Corey Farrell a5023d4f75
main/astfd: Fix GCC8 format-truncation warning.
The field used to store call arguments was not large enough to hold the
arguments string that can be constructed for 'open'.  Expand it to
prevent this warning/error.

Change-Id: I514927f256481bc84df10a51b19d5b5fb1bc387e
2018-10-12 13:21:24 -04:00
Kevin Harwell 31fed39078 Merge "loader: Flag module as declined in all cases where it fails to load." into 16 2018-10-10 14:22:13 -05:00
Corey Farrell 5ea517f80e
chan_sip: Tell module loader that chan_sip is extended support.
Change-Id: I33508c134b1be888b8884f5dcfee19087634e415
2018-10-10 07:38:08 -04:00
Richard Mudgett c001974f4f res_statsd.c: Fix returned reload status.
The return status when there was no change in statsd.conf was incorrect.
This resulted in the wrong status message on the CLI when reloading the
module.

* Fixed cleanup on initial load if initializing statsd failed.

Change-Id: Id24fae75f1a7ff584a444a5680e867d989792481
2018-10-09 16:30:27 -05:00
George Joseph b42c682213 Merge "core/frame: generate correct T.140 payload in ast_sendtext_data()" into 16 2018-10-05 14:33:19 -05:00
George Joseph f636d6d187 Merge "func_periodic_hook.c: Cleanup module resources on failure." into 16 2018-10-05 14:32:08 -05:00
George Joseph 04fcfe856a Merge "codec_speex.c: Cleanup module loading to DECLINE and not FAILURE." into 16 2018-10-05 14:31:17 -05:00
George Joseph 0e38d72b35 Merge "res_smdi.c: Fix module ref counting and inverted test." into 16 2018-10-05 10:52:43 -05:00
George Joseph 7b0ecf7274 Merge "res_statsd.c: Made use defaults if the statsd.conf file does not exist." into 16 2018-10-05 10:10:53 -05:00
George Joseph 46d8d8959c Merge "res_smdi.c: Made use defaults if the smdi.conf file does not exist." into 16 2018-10-05 10:09:16 -05:00
neutrino88 e0496fe062 core/frame: generate correct T.140 payload in ast_sendtext_data()
ast_sendtext_data() would create an incorrect T.140 text frame which
length include the null terminator byte. It causes ultimately RTP
packets to be send with this trailing 0. The proposed fix just set the
correct length to the text frame

ASTERISK-28089
Reported by: Emmanuel BUU
Tested by: Emmanuel BUU

Change-Id: I7ab1b9ed1e21683b2b667ea0a59d9aba3c77dd96
2018-10-05 08:57:41 -05:00
Corey Farrell c6ee3cf639 loader: Flag module as declined in all cases where it fails to load.
This has no effect on startup since AST_MODULE_LOAD_FAILURE aborts
startup, but it's possible for this code to be returned on manual load
of a module after startup.

It is an error for a module to not have a load callback but this is not
a fatal system error.  In this case flag the module as declined, return
AST_MODULE_LOAD_FAILURE only if a required module is broken.

Expand doxygen documentation for AST_MODULE_LOAD_*.

Change-Id: I3c030bb917f6e5a0dfd9d91491a4661b348cabf8
2018-10-04 18:45:26 -05:00
Richard Mudgett 77f151d927 func_periodic_hook.c: Cleanup module resources on failure.
* Make load_module() cleanup if it failed to setup the module.

* Make unload_module() always return 0.  It is silly to fail unloading if
the hook function we try to unregister was not even registered.

Change-Id: I280fc6e8ba2a7ee2588ca01d870eebaf74b4ffe6
2018-10-04 14:38:12 -05:00
Richard Mudgett bc335ceda8 codec_speex.c: Cleanup module loading to DECLINE and not FAILURE.
If codec_speex fails to register a translator it would cause Asterisk to
exit instead of continue as a DECLINED module.

* Make unload_module() always return 0.  It is silly to fail unloading if
any translators we try to unregister were not even registered.

Change-Id: Ia262591f68333dad17673ba7104d11c88096f51a
2018-10-04 14:35:43 -05:00
George Joseph 6fd21a6af6 CI: Fix missing () in gates.jenkinsfile
Change-Id: I2f252e0f8c7f1a6328438fbd2be5d6574b7dfa5b
2018-10-04 13:04:04 -05:00
George Joseph 1598c7a306 CI: Add timestamps and timeouts to jenkinsfiles
Change-Id: Ide83574dc957bc1df28e30a69079140050dfc35f
2018-10-04 10:14:21 -05:00
Jenkins2 f9cc33c821 Merge "ast_coredumper: Remove .gdbinit file on exit" into 16 2018-10-04 10:00:21 -05:00
George Joseph 1debf9e484 Merge "jenkins: Fix cleanup command redirection." into 16 2018-10-04 09:42:17 -05:00
George Joseph 24f44474b6 Merge "CI: Use brace expansion instead of calling out to seq" into 16 2018-10-04 09:41:23 -05:00
George Joseph 48bac78f3e Merge "CI: Look up configured kernel.core_pattern sysctl" into 16 2018-10-04 08:54:46 -05:00
George Joseph be88c768f4 Merge "astobj2: Comment on OBJ_NOLOCK in ao2_container_clone." into 16 2018-10-04 07:24:55 -05:00
George Joseph 99e05591fa Merge "http.c: Reload TLS even if http.conf hasn't changed" into 16 2018-10-04 07:24:34 -05:00
Sean Bright b2f96fdcfe ast_coredumper: Remove .gdbinit file on exit
Change-Id: I1297de78628773ca368e687c6f148bf74857cae9
2018-10-03 17:03:05 -05:00
Sean Bright d0a1237c19 CI: Look up configured kernel.core_pattern sysctl
Change-Id: I8246a0147df8d821fbbcabc1db1887104b8bedc4
2018-10-03 16:54:09 -05:00
Corey Farrell 48bb4543d9 jenkins: Fix cleanup command redirection.
Fix redirection to /dev/null of cleanup commands.  The '2' was being
interpreted as part of the command instead of part of the redirect.

Change-Id: I2e3a591b165e0288c4b82b9ef475fdfd5392a90a
2018-10-03 16:32:17 -05:00
George Joseph d027d193b8 ast_coredumper: Don't use "declare -n"
Change-Id: I7ddfed4cd6549a0cd458e4d5cf9ac95d784de6cb
2018-10-03 15:30:13 -05:00
George Joseph 26123b01cb Merge "core/frame: Fix ast_frdup() and ast_frisolate() for empty text frames" into 16 2018-10-03 13:57:08 -05:00
George Joseph 161ad96c3e Merge "CI: Use bindport instead of port in test http.conf" into 16 2018-10-03 13:56:42 -05:00
Richard Mudgett 7eda6263c2 res_smdi.c: Fix module ref counting and inverted test.
I think this module is so screwed up that it doesn't work anymore.  Even
with these attempts to fix things it still won't gracefully shut down.
The module refs will not go to zero to allow unloading the module.

* Fix module ref counting dealing with the SMDI interface object.  There
were several off-nominal paths that unbalanced the module ref count.  Also
the destructor freed the ao2 object itself which is bad.  Made the
smdi_read thread not hold its own ref to the SMDI interface object so when
all refs go away the destructor will stop the listener thread.

* Fixed the smdi_load() return code of 1 concerning the number of
listeners.  The test was inverted.

Change-Id: Ic288db51b58e395d6a2fc3847f77176c16988784
2018-10-03 11:41:03 -05:00
Richard Mudgett 5b72bb0278 res_smdi.c: Made use defaults if the smdi.conf file does not exist.
This module is an optional dependency of a couple of other modules.  If it
declines to load, it then forces other modules that can optionally use
this module to also decline.

* Made use the default configuration if the config file does not exist and
simplified some of the logic.

Change-Id: Ib93191f1fe28c0dd9ebe3d84c7762b32f83c4eb9
2018-10-03 11:40:53 -05:00
Corey Farrell fa9cd68589 astobj2: Comment on OBJ_NOLOCK in ao2_container_clone.
The test for OBJ_NOLOCK looks wrong but it isn't.  Add comments to
prevent confusion.

Change-Id: I9662b82eb39e7627a1f1944fd18f967a2b987344
2018-10-03 11:03:39 -05:00
George Joseph aae29f38ea Merge "loader: Fix result of module reload error." into 16 2018-10-03 10:19:40 -05:00
George Joseph dae4c4c95d Merge "astobj2: Record lock usage to refs log when DEBUG_THREADS is enabled." into 16 2018-10-03 10:19:17 -05:00
George Joseph e7b1de5150 Merge "core: Disable astobj2 locking for some common objects." into 16 2018-10-03 09:31:18 -05:00
George Joseph 0e93826e64 Merge "Resolve warning about duplicate 'dialplan' CLI." into 16 2018-10-03 09:28:44 -05:00
Sean Bright 8b3b504b79 CI: Use brace expansion instead of calling out to seq
Also make the shebang in publishAsteriskDocs.sh the first line.

Change-Id: I3fdd6f22e652e4fb5b5fe85df46fa34eb6d0cf08
2018-10-03 09:11:43 -05:00
Sean Bright 5f7350d68b CI: Use bindport instead of port in test http.conf
Change-Id: Ife9a6879da63a56e5b8348a2024eeed4e7b1615b
2018-10-03 09:00:50 -05:00
Sean Bright 2b4752911f http.c: Reload TLS even if http.conf hasn't changed
There is currently no way to indicate to Asterisk that TLS certificates
and/or keys have been updated other than by modifying http.conf or
restarting Asterisk.

There is already code in main/tcptls.c that determines if a reload is
actually necessary based on the hashes of the certicate and dependent
files, so this change merely gives us a way to request a reload without
explicitly modifying http.conf.

Change-Id: Ie795420dcc7eb3d91336820688a29adbcc321276
2018-10-03 08:35:08 -05:00
Corey Farrell 3b2310332d core: Disable astobj2 locking for some common objects.
* ACO options
* Indications
* Module loader ref_debug object
* Media index info and variants
* xmldoc items

These allocation locations were identified using reflocks.py on the
master branch.

Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8
2018-10-03 03:21:42 -05:00
Richard Mudgett c2e6efa63d res_statsd.c: Made use defaults if the statsd.conf file does not exist.
This module is an optional dependency of many modules.  If it declines to
load it then forces other modules that can optionally use this module to
also decline.

* Made use default configuration if there is a config error or the config
file does not exist.

Change-Id: If1068a582ec54ab7fb437265cb5370a97a825737
2018-10-02 17:01:34 -05:00
Corey Farrell 326574d4fc Resolve warning about duplicate 'dialplan' CLI.
Change-Id: I029db1b4a32ccfb38374d6fe944dc430866f4b30
2018-10-02 13:28:23 -05:00
Corey Farrell 65f06a4505 loader: Fix result of module reload error.
When a module reload fails we never set AST_MODULE_RELOAD_ERROR.  This
caused reload failures to incorrectly report 'No module found'.

Change-Id: I5f3953e0f7d135e53ec797f24c97ee3f73f232e7
2018-10-02 13:14:14 -05:00
Corey Farrell f066dbc353 loader: Improve error handling.
* Display list of unavailable dependencies when they cause another
  module to fail loading.
* When a module declines to load find all modules which depend on it so
  they can be declined and listed together.
* Prevent retry of declined modules during startup.
* When a module fails to dlopen try loading it with RTLD_LAZY so we can
  attempt to display the list of missing dependencies.

These changes are meant to reduce logger spam that is caused when a
module has many dependencies and declines to load.  This also fixes some
error paths which failed to recognize required modules.

Module load/start errors are delayed until the end of loader startup.

Change-Id: I046052c71331c556c09d39f47a3b92975f3e1758
2018-10-02 12:21:31 -05:00
neutrino88 406c5bef0a core/frame: Fix ast_frdup() and ast_frisolate() for empty text frames
If a channel creates an AST_TEXT_FRAME with datalen == 0, the ast_frdup()
and ast_frisolate() functions could create a clone frame with an invalid
data.ptr which would cause a crash.  The proposed fix is to make sure that
for such empty text frames, ast_frdup() and ast_frisolate() return cloned
text frames with a valid data.ptr.

ASTERISK-28076
Reported by: Emmanuel BUU
Tested by: Emmanuel BUU

Change-Id: Ib882dd028598f13c4c233edbfdd7e54ad44a68e9
2018-10-02 11:25:17 -05:00
Joshua Colp b351b903b9 Merge "Append CHANGES/UPGRADE.txt for module loader changes." into 16 2018-10-02 08:46:15 -05:00
Joshua Colp c69e5cd764 Merge "app_queue.c: Fix json ref leak" into 16 2018-10-02 07:59:32 -05:00
Corey Farrell 693e00eee6 astobj2: Record lock usage to refs log when DEBUG_THREADS is enabled.
When DEBUG_THREADS is enabled we can know if the astobj2 mutex / rwlock
was ever used, so it can be recorded in the REF_DEBUG destructor entry.

Create contrib/scripts/reflocks.py to process locking used by
allocator.  This can be used to identify places where
AO2_ALLOC_OPT_LOCK_NOLOCK should be used to reduce memory usage.

Change-Id: I2e3cd23336a97df2692b545f548fd79b14b53bf4
2018-10-01 21:45:48 -05:00
Corey Farrell 5a9230eacb app_page: Add dependency against app_confbridge.
Change-Id: I1946509f518961d23fb21229d91676ee3e441921
2018-10-01 12:12:45 -05:00
Richard Mudgett a2554d5e5a app_queue.c: Fix json ref leak
Declining the queue_member_status_type stasis message in stasis.conf
causes these messages to leak json objects.

* Add missing ast_json_unref() if the type is NULL in
queue_publish_member_blob().

ASTERISK-28084

Change-Id: I691ecf49bd1f7d9c29182e1eee8c4bb7103be9fc
2018-10-01 11:46:28 -05:00
Jenkins2 42b1e197c8 Merge "jansson-bundled: Add patches to improve json_pack error reporting." into 16 2018-10-01 10:17:01 -05:00
Jenkins2 68fe182e4f Merge "astobj2: Reduce memory overhead." into 16 2018-10-01 09:03:07 -05:00
George Joseph 8c72cd8459 Merge "lock: Improve performance of DEBUG_THREADS." into 16 2018-10-01 08:36:47 -05:00
Joshua Colp 339e248524 Merge "configure.ac: Check for unbound version >= 1.5" into 16 2018-10-01 07:18:58 -05:00
Joshua Colp 81fca7f7ac Merge "res_pjsip: improve realtime performance on CLI 'pjsip show contacts'" into 16 2018-10-01 06:51:15 -05:00
Joshua Colp ddbd902edf Merge "app_confbridge: Use bridge join hook to send join and leave events" into 16 2018-10-01 06:24:10 -05:00
Joshua Colp c87945c25d Merge "res_stasis: Fix stale data in ARI bridges" into 16 2018-10-01 04:34:59 -05:00
Corey Farrell 266ed3d68b
Append CHANGES/UPGRADE.txt for module loader changes.
Change-Id: Ib8db4e14187f5c11ecbff532df17d30c5d36fa3e
2018-10-01 04:18:43 -04:00
Alexei Gradinari ab90479642 res_pjsip: improve realtime performance on CLI 'pjsip show contacts'
CLI command 'pjsip show contacts' inefficiently make a lot of DB requests.

For example if there are 10k aors then asterisk requests these 10k records
of aor and then does 10k requests of contact - one request per aor.

Even if use 'like <pattern>' the asterisk requests all aor's and contact's
records and then filters them by itself.

This patch gathers contact's container by
- retrieving all dynamic contacts by regex (filtered by reg_server)
- retrieving all aors with permanent contacts
- finally filters container by regex

ASTERISK-28077 #close

Change-Id: Id0ad65d14952a02fb213273a90f3f680a8149618
2018-09-28 17:09:22 -05:00
Corey Farrell 3337fe85c5 jansson-bundled: Add patches to improve json_pack error reporting.
Change-Id: I045e420d5e73e60639079246e810da6ae21ae22b
2018-09-28 14:56:15 -05:00
Corey Farrell b3b95c8d36 lock: Improve performance of DEBUG_THREADS.
Add a volatile flag to lock tracking structures so we only need to use
the global lock when first initializing tracking.

Additionally add support for DEBUG_THREADS_LOOSE_ABI.  This is used by
astobj2.c to eliminate storage for tracking fields when DEBUG_THREADS is
not defined.

Change-Id: Iabd650908901843e9fff47ef1c539f0e1b8cb13b
2018-09-28 13:42:27 -05:00
George Joseph 0ad987168e Merge "config.c: Cleanup AST_INCLUDE_GLOB" into 16 2018-09-28 13:16:41 -05:00
Kevin Harwell 2ee1c0cec8 Merge "res_odbc: fix missing SQL error diagnostic" into 16 2018-09-28 10:39:00 -05:00
George Joseph 60754fb806 Merge "astobj2: Fix shutdown order." into 16 2018-09-28 08:34:46 -05:00
George Joseph 15f91a4789 Merge "app_queue: Fix Attended transfer hangup with removing pending member." into 16 2018-09-28 07:48:59 -05:00
George Joseph b4ab26e72f app_confbridge: Use bridge join hook to send join and leave events
The first attempt at publishing confbridge events to participants
involved publishing them at the same time stasis events were
created.  This caused issues with bridge and channel locks.  The
second attempt involved publishing them when the stasis events
were received by the code that published the confbridge AMI events.
This caused timing issues because, depending on resources available,
the event could be received before channels actually joined the
bridge and would therefore fail to send messages to the participant.

This attempt reverts to the original mechanism with one exception.
The join and leave events are published via bridge join and leave
hooks.  This guarantees the states of the channels and bridge and
provides deterministic timing for event publishing.

Change-Id: I2660074f8a30a5224cb953d5e047ee84484a9036
2018-09-28 06:32:39 -06:00
George Joseph de43d25716 Merge "res_rtp_asterisk.c: Add "seqno" strictrtp option" into 16 2018-09-28 07:28:39 -05:00
Corey Farrell 33455f8d6f astobj2: Reduce memory overhead.
Reduce options to 2-bit field, magic to 30 bit field.  Move ref_counter
next to options and explicitly use int32_t so the fields will pack.

This reduces memory overhead for every ao2 object by 8 bytes on x86_64.

Change-Id: Idc1baabb35ec3b3d8de463c4fa3011eaf7fcafb5
2018-09-27 18:42:19 -05:00
Sean Bright d1698b4e0b config.c: Cleanup AST_INCLUDE_GLOB
* In main/config.c, AST_INCLUDE_GLOB is fixed to '1' making the #ifdefs
  pointless.

* In utils/extconf.c, AST_INCLUDE_GLOB is never defined so there is a
  lot of dead code.

Change-Id: I1bad1a46d7466ddf90d52cc724e997195495226c
2018-09-27 15:07:05 -05:00
George Joseph 06fef54b5a Merge "res_rtp_asterisk: Raise event when RTP port is allocated" into 16 2018-09-27 09:21:56 -05:00
Joshua Colp 2e307ee0b7 Merge "CI: Add --test-timeout option to runTestsuite.sh" into 16 2018-09-27 06:22:47 -05:00
Corey Farrell 0fe08c5e79 astobj2: Fix shutdown order.
When REF_DEBUG and AO2_DEBUG are both enabled we closed the refs log
before we shutdown astobj2_container.  This caused the AO2_DEBUG
container registration container to be reported as a leak.

Change-Id: If9111c4c21c68064b22c546d5d7a41fac430430e
2018-09-27 05:42:13 -05:00
Cao Minh Hiep 958727cece app_queue: Fix Attended transfer hangup with removing pending member.
This issue related to setting of holdtime, announcements, member delays.
It works well if we set the member delays to "0" and no announcements
and no holdtime.This issue will happen if we set member delays to "1",
"2"... or announcements or holdtime and hangs up the call during
processing it.

And here is the reason:
(At the step of answering a phone.)
It takes care any holdtime, announcements, member delays,
or other options after a call has been answered if it exists.

Normally, After the call has been aswered,
and we wait for the processing one of the cases of the member delays
or hold time or announcements finished, "if (ast_check_hangup(peer))"
will be not executed, then queue will be updated at update_queue().
Here, pending member will be removed.

However, after the call has been aswered,
if we hangs up the call during one of the cases of the member delays
or hold time or announcements, "if (ast_check_hangup(peer))"
will be executed.
outgoing = NULL and at hangupcalls, pending members will not be removed.

* This fixed patch will remove the pending member from container
before hanging up the call with outgoing is NULL.

ASTERISK-27920

Reported by: Cao Minh Hiep
Tested by: Cao Minh Hiep

Change-Id: Ib780fbf48ace9d2d8eaa1270b9d530a4fc14c855
2018-09-26 20:04:06 -05:00
Moritz Fain 1f68614f3c res_stasis: Fix stale data in ARI bridges
Fixed an issue that resulted in "Allocation failed" each time an ARI
request was made to start playing MOH on a bridge.

In bridge_moh_create() we were attaching the after bridge callbacks to
chan which is the ;1 channel of the unreal channel pair.  We should have
attached them to the ;2 channel which is pushed into the bridge by
ast_unreal_channel_push_to_bridge().  The callbacks are called when the
specific channel leaves the bridging system.  Since the ;1 channel is
never put into a bridge the callbacks never get called.  The callbacks
then never remove the moh_wrapper from the app_bridges_moh container.  As
a result we cannot find the channel associated with the wrapper to start
MOH because it has hungup.  This is the reason causing the reported issue.

* Rather than using after bridge callbacks to cleanup, we now have
moh_channel_thread() doing the cleanup when the channel hangs up.

* Fixed moh_channel_thread() accumulating control frames on the stasis
bridge MOH channel until MOH is stopped.  Control frames are no longer
accumulated while MOH is playing.

* Fixed channel ref counting issue.  stasis_app_bridge_moh_channel() may
or may not return a channel ref.  As a result ast_ari_bridges_start_moh()
wouldn't know it may have a channel ref to release.
stasis_app_bridge_moh_channel() will now return a ref with the channel it
returns.

* Eliminated RAII_VAR in bridge_moh_create().

ASTERISK-26094 #close

Change-Id: Ibff479e167b3320c68aaabfada7e1d0ef7bd548c
2018-09-26 18:50:22 -05:00
Ben Ford 67e1e49e08 res_rtp_asterisk.c: Add "seqno" strictrtp option
When networks experience disruptions, there can be large gaps of time
between receiving packets. When strictrtp is enabled, this created
issues where a flood of packets could come in and be seen as an attack.
Another option - seqno - has been added to the strictrtp option that
ignores the time interval and goes strictly by sequence number for
validity.

Change-Id: I8a42b8d193673899c8fc22fe7f98ea87df89be71
2018-09-26 13:26:54 -05:00
George Joseph 94ef074cc7 Merge "jansson: Backport fixes to bundled, use json_vsprintf if available." into 16 2018-09-26 11:09:32 -05:00
George Joseph 7638366c2f Merge "chan_sip: SipNotify on Chan_Sip vi AMI behave different to CLI" into 16 2018-09-26 09:33:15 -05:00
Alexei Gradinari e04c49b517 res_odbc: fix missing SQL error diagnostic
On SQL error there is not diagnostic information about this error.
There is only
WARNING res_odbc.c: SQL Execute error -1!

The function ast_odbc_print_errors calls a SQLGetDiagField to get the number
of available diagnostic records, but the SQLGetDiagField returns 0.
However SQLGetDiagRec could return one diagnostic records in this case.

Looking at many example of getting diagnostics error information
I found out that the best way it's to use only SQLGetDiagRec
while it returns SQL_SUCCESS.

Also this patch adds calls of ast_odbc_print_errors on SQL_ERROR
to res_config_odbc.

ASTERISK-28065 #close

Change-Id: Iba5ae5470ac49ecd911dd084effbe9efac68ccc1
2018-09-26 09:24:53 -05:00
George Joseph 227d9719da CI: Add --test-timeout option to runTestsuite.sh
The default is 600 seconds.
Also added timeouts to the *TestGroups.json files.

Change-Id: I8ab6a69e704b6a10f06a0e52ede02312a2b72fe0
2018-09-26 08:15:02 -05:00
George Joseph a6c3984175 Merge "rtp_engine: rtcp_report_to_json can overflow the ssrc integer value" into 16 2018-09-26 08:08:06 -05:00
pk16208 681e115ff1 chan_sip: SipNotify on Chan_Sip vi AMI behave different to CLI
With tls and udp enabled asterisk generates a warning about sending
message via udp instead of tls.
sip notify command via cli works as expected and without warning.

asterisk has to set the connection information accordingly to connection
and not on presumption

ASTERISK-28057 #close

Change-Id: Ib43315aba1f2c14ba077b52d8c5b00be0006656e
2018-09-26 07:27:58 -05:00
George Joseph cc8e0dfabd configure.ac: Check for unbound version >= 1.5
In order to do this and provide good feedback, a new macro was
created (AST_EXT_LIB_EXTRA_CHECK) which does the normal check and
path setups for the library then compiles, links and runs a supplied
code fragment to do the final determination.  In this case, the
final code fragment compares UNBOUND_VERSION_MAJOR
and UNBOUND_VERSION_MINOR to determine if they're greater than or
equal to 1.5.

Since we require version 1.5, some code in res_resolver_unbound
was also simplified.

ASTERISK-28045
Reported by: Samuel Galarneau

Change-Id: Iee94ad543cd6f8b118df8c4c7afd9c4e2ca1fa72
2018-09-25 14:32:12 -05:00
Joshua Colp 7c49ea7cff res_rtp_asterisk: Raise event when RTP port is allocated
This change raises a testsuite event to provide what port
Asterisk has actually allocated for RTP. This ensures that
testsuite tests can remove any assumption of ports and instead
use the actual port in use.

ASTERISK-28070

Change-Id: I91bd45782e84284e01c89acf4b2da352e14ae044
2018-09-25 05:35:02 -05:00
Corey Farrell ede59966d9 jansson: Backport fixes to bundled, use json_vsprintf if available.
Use json_vsprintf from versions which contain fix for va_copy leak.

Apply fixes from jansson master:
* va_copy leak fix.
* Avoid potential invalid memory read in json_pack.
* Rename variable that shadowed another.

Change-Id: I7522e462d2a52f53010ffa1e7d705c666ec35539
2018-09-24 18:00:19 -05:00
Corey Farrell 7b0dbda936 json: Take advantage of new API's.
* Use "o*" format specifier for optional fields in ast_json_party_id.
* Stop using ast_json_deep_copy on immutable objects, it is now thread
  safe to just use ast_json_ref.

Additional changes to ast_json_pack calls in the vicinity:
* Use "O" when an object needs to be bumped.  This was previously
  avoided as it was not thread safe.
* Use "o?" and "O?" to replace NULL with ast_json_null().  The
  "?" is a new feature of ast_json_pack starting with Asterisk 16.

Change-Id: I8382d28d7d83ee0ce13334e51ae45dbc0bdaef48
2018-09-24 14:50:50 -05:00
George Joseph 3ddfeccf35 Merge "app_voicemail: Fix stack overrun in append_mailbox" into 16 2018-09-24 13:49:42 -05:00
George Joseph 685abce1d0 Merge "chan_sip.c: chan_sip unstable with TLS after asterisk start or reloads" into 16 2018-09-24 10:44:10 -05:00
George Joseph 6a0dc87b97 Merge "res_remb_modifier: Add module for controlling REMB from CLI." into 16 2018-09-24 10:12:01 -05:00
George Joseph 82f28106df Merge "app_voicemail: Cleanup mailbox topic and cache" into 16 2018-09-24 10:08:41 -05:00
George Joseph 64e3ed75ab Merge "stasis: Add function to delete topic from pool" into 16 2018-09-24 09:28:50 -05:00
George Joseph a389b020de Merge "res_rtp_asterisk: Fix crash on ast_rtp_new failure." into 16 2018-09-24 09:26:01 -05:00
George Joseph 361295f192 Merge "channel.c: Address stack overflow in does_id_conflict()" into 16 2018-09-24 09:24:31 -05:00
Kevin Harwell 755febe497 rtp_engine: rtcp_report_to_json can overflow the ssrc integer value
When writing an RTCP report to json the code attempts to pack the "ssrc" and
"source_ssrc" unsigned integer values as a signed int value type. This of course
means if the ssrc's unsigned value is greater than that which can fit into a
signed integer value it gets converted to a negative number. Subsequently, the
negative value goes out in the json report.

This patch now packs the value as a json_int_t, which is the widest integer type
available on a given system. This should make it so the value no longer
overflows.

Note, this was caught by two failing tests hep/rtcp-receiver/ and
hep/rtcp-sender.

Change-Id: I2af275286ee5e795b79f0c3d450d9e4b28e958b0
2018-09-21 17:06:52 -05:00
George Joseph ba91c73f8e app_voicemail: Fix stack overrun in append_mailbox
The append_mailbox function wasn't calculating the correct length
to pass to ast_alloca and it wasn't handling the case where context
might be empty.

Found by the Address Sanitizer.

Change-Id: I7eb51c7bd18a7a8dbdba261462a95cc69e84f161
2018-09-21 16:07:15 -05:00
George Joseph 0a1a96d331 channel.c: Address stack overflow in does_id_conflict()
does_id_conflict() was passing a pointer to an int to a callback
that expected a pointer to a size_t.

Found by the Address Sanitizer.

Change-Id: I0ff542067eef63a14a60301654d65d34fe2ad503
2018-09-21 15:32:16 -05:00
Corey Farrell 7a7b21f3a0 res_rtp_asterisk: Fix crash on ast_rtp_new failure.
ast_rtp_new free'd rtp upon failure, but rtp_engine.c would also call
the destroy callback.  Remove call to ast_free from ast_rtp_new, leave
it to rtp_engine.c to initiate the full cleanup.  Add error detection
for the ssrc_mapping vector initialization.  In rtp_allocate_transport
set rtp->s = -1 in the failure path where we close that FD to ensure we
don't try closing it twice.

ASTERISK-27854 #close

Change-Id: Ie02aecbb46228ca804e24b19cec2bb6f7b94e451
2018-09-21 10:30:32 -05:00
Sean Bright 880905e7eb res_rtp_asterisk: Reset all settings on module reload
'rtpchecksums' and 'rtcpinterval' are not being reset to their defaults
if they are not present in the updated configuration file.

Change-Id: I1162e40199314d46cf3225d5e1271c4c81176670
2018-09-20 15:28:54 -05:00
George Joseph fa1b836374 app_voicemail: Cleanup mailbox topic and cache
app_voicemail wasn't properly cleaning up the stasis cache or the
mwi topic pool when the module was unloaded or when a user was
deleted as a result of a reload.  This resulted in leaks in both
areas.

* app_voicemail now calls ast_delete_mwi_state_full when it frees
  a user structure and ast_delete_mwi_state_full in turn now calls
  the new stasis_topic_pool_delete_topic function to clear the topic
  from the pool.

Change-Id: Ide23144a4a810e7e0faad5a8e988d15947965df8
2018-09-20 13:47:27 -05:00
George Joseph dec6ebd9e1 Merge "stasis: No need to keep a stasis type ref in a stasis msg or cache object." into 16 2018-09-20 13:09:53 -05:00
Sean Bright 339bf0cf7b AST-2018-009: Fix crash processing websocket HTTP Upgrade requests
The HTTP request processing in res_http_websocket allocates additional
space on the stack for various headers received during an Upgrade request.
An attacker could send a specially crafted request that causes this code
to overflow the stack, resulting in a crash.

* No longer allocate memory from the stack in a loop to parse the header
values.  NOTE: There is a slight API change when using the passed in
strings as is.  We now require the passed in strings to no longer have
leading or trailing whitespace.  This isn't a problem as the only callers
have already done this before passing the strings to the affected
function.

ASTERISK-28013 #close

Change-Id: Ia564825a8a95e085fd17e658cb777fe1afa8091a
2018-09-20 11:18:57 -05:00
George Joseph 1a9c69d729 stasis: Add function to delete topic from pool
There's been a long standing leak when using topic pools.  The
topics in the pool get cleaned up when the last pool reference is
released but you can't remove a topic specifically.  If you reloaded
app_voicemail for instance, and mailboxes went away, their topics
were left in the pool.

* Added stasis_topic_pool_delete_topic() so modules can clean up
  topics from pools.
* Registered the topic pool containers so it can be examined from
  the CLI when AO2_DEBUG is enabled.  They'll be named
  "<topic_pool_name>-pool".

Change-Id: Ib7957951ee5c9b9b4482af7b9b4349112d62bc25
2018-09-20 08:48:55 -06:00
Joshua Colp 84b60aeb70 Merge "stasis_cache: Stop caching stasis subscription change messages" into 16 2018-09-20 09:20:56 -05:00
hajekd 8811ab1803 chan_sip.c: chan_sip unstable with TLS after asterisk start or reloads
Fixes random asterisk crash on start or reload with TLS phones.

ASTERISK-28034 #close
Reported-by: David Hajek

Change-Id: I2a859f97dc80c348e2fa56e918214ee29521c4ac
2018-09-20 09:00:46 -05:00
Joshua Colp 36898351e5 Merge "pjproject: Update initial 2.8 patches to apply cleanly." into 16 2018-09-20 06:24:59 -05:00
Joshua Colp 2f38bcdfc0 res_remb_modifier: Add module for controlling REMB from CLI.
This adds a module which registers a CLI command that can set the
REMB bitrate value for REMB as it enters or exits Asterisk. This
allows you to ignore what Asterisk or a client produces and is
useful for demonstrations.

This does not generate REMB frames, however, but just modifies
them as they flow to or from a channel.

Change-Id: Ib089427c46a4a36d645cecfe02406adb38c17bec
2018-09-20 04:55:23 -05:00
Joshua Colp e313ec3a7e Merge "alembic: fix suppress_q850_reason_headers column name" into 16 2018-09-20 04:53:58 -05:00
Joshua Colp 3c1a8be11e Merge "app_voicemail: Remove need to subscribe to stasis" into 16 2018-09-20 04:53:43 -05:00
Richard Mudgett f6695249a5 stasis: No need to keep a stasis type ref in a stasis msg or cache object.
Stasis message types are global ao2 objects and we make stasis messages
and cache entries hold references to them.  Since there are currently
situations where cache objects are never deleted, the reference count on
the types can exceed 100000 and generate a FRACK assertion message.  The
stasis message cache could conceivably also have that many messages
legitimately on large systems.

The only down side to not holding the message type ref in the stasis
message is it only makes a crash either at shutdown or when manually
unloading a busy module slightly more likely.  However, this is more
exposing a pre-existing stasis shutdown ordering issue than a problem with
not holding a message type ref in stasis messages.

* Made stasis messages and cache entries no longer hold a ref to the
message type.

Change-Id: Ibaa28efa8d8ad3836f0c65957192424c7f561707
2018-09-19 12:32:39 -05:00
Richard Mudgett c008c27c85 pjproject: Update initial 2.8 patches to apply cleanly.
ASTERISK-28059

Change-Id: I027472f2753391646dde594a709a75f14422db93
2018-09-19 10:30:06 -05:00
Joshua Colp 7912ad9bf7 Merge "res_pjsip_session: Don't add declined stream if one does not exist." into 16 2018-09-19 08:42:16 -05:00
George Joseph 40082f3e00 Merge "pjproject: Upgrade to 2.8." into 16 2018-09-19 08:06:21 -05:00
Richard Mudgett 192f71b7de stasis_message.c: Don't create immutable stasis objects with locks.
* Create the stasis message object without a lock as it is immutable.
* Create the stasis message type object without a lock as it is immutable.
* Creating the stasis message type could crash if the passed in type name
is NULL and REF_DEBUG is enabled.  Added missing NULL check when passing
the ao2 object tag string.

Change-Id: I28763c58bb9f0b427c11971d0103bf94055e7b32
2018-09-18 13:18:08 -05:00
Joshua Colp 60258b4ec1 pjproject: Upgrade to 2.8.
This change brings in PJSIP 2.8, removes all the patches
that were merged upstream, and makes a minor change to
support a breaking change that was done.

ASTERISK-28059

Change-Id: I5097772b11b0f95c3c1f52df6400158666f0a189
2018-09-18 11:32:11 -05:00
Florian Floimair 3e48c34f14 alembic: fix suppress_q850_reason_headers column name
In the original commit introducing the feature the column in the alembic
script was called 'suppress_q850_reason_header'.
In the code however the option is called 'suppress_q850_reason_headers'
(trailing 's'). This leads to errors when ARI push configuration is used.

Change-Id: Ie84808adbca6fcc9136556e4f5d741adbef5d14f
2018-09-18 09:46:03 -05:00
George Joseph 29115e2384 app_voicemail: Remove need to subscribe to stasis
app_voicemail was using the stasis cache to build and maintain a
list of mailboxes that had subscribers.  It then used this list
to determine if a mailbox should be polled for new messages if
polling was enabled.  For this to work, stasis had to cache every
subscription and unsubscription to the mailbox which caused a lot of
overhead, both cpu and memory related.

Since polling is only required when changes are being made to
mailboxes outside of app_voicemail and since the number of mailboxes
that don't have any subscribers is likely to be very low, all
mailboxes are now polled instead of just the ones with subscribers.

This paves the way for disabling the caching of stasis subscription
change messages.

Also fixed cleanup in some of the unit tests that not only left
test users in the users list but also caused segfaults if the tests
were run more than once.

ASTERISK-27121

Change-Id: I5cceb737246949f9782955c64425b8bd25a9e9ee
2018-09-18 07:44:00 -06:00
Joshua Colp 6e79e6b097 res_pjsip_session: Don't add declined stream if one does not exist.
Given a scenario where a session refresh was done with a removed
stream we would always add a removed stream to the outgoing SDP
even if one did not already exist.

This change makes it so that a removed stream is only placed into
the SDP if one already exists.

ASTERISK-28047

Change-Id: Ibb97d21cdeb87a8acae0c720861b0ff255708442
2018-09-18 06:10:59 -05:00
Sean Bright b0a0b975c5 autoconf: Check for srtp_get_version_string() before using it
Change-Id: Id2a916ff9448706090e72ff2c7fb3f5ba24a05df
2018-09-17 10:47:56 -05:00
George Joseph 0107e1aa5a Merge "res_srtp.c: Show linked version of libsrtp on module init" into 16 2018-09-17 09:24:31 -05:00
Jenkins2 4300410c9a Merge "res_pjsip: Log IPv6 addresses correctly" into 16 2018-09-17 08:11:34 -05:00
George Joseph 4a309839eb CI: Fix typo in testsuite git checkout
Change-Id: I30024515e5b00a5044fd39fbff27d818f016b719
2018-09-17 07:15:01 -05:00
Sean Bright 55ca51af21 res_srtp.c: Show linked version of libsrtp on module init
Change-Id: Ib0a645d6985de5757cc4399ed2524b2d02c4f342
2018-09-16 06:11:47 -05:00
Sean Bright 887a315e17 res_pjsip: Log IPv6 addresses correctly
Both pjsip_tx_data.tp_info.dst_name and pjsip_rx_data.pkt_info.src_name
store IPv6 addresses without enclosing brackets. This causes some log
output to be confusing because it is difficult to separate the IPv6
address from a port specification.

* Use pj_sockaddr_print() along with pjsip_tx_data.tp_info.dst_addr and
  pjsip_rx_data.pkt_info.src_addr where possible for consistent IPv6
  output.

* When a pj_sockaddr is not available, explicitly wrap IPv6 addresses
  in brackets.

* When assigning pjsip_rx_data.pkt_info.src_name ourselves, make sure
  to also set pjsip_rx_data.pkt_info.src_addr.

Change-Id: I5cfe997ced7883862a12b9c7d8551d76ae02fcf8
2018-09-14 14:59:19 -05:00
George Joseph 3f9544c1f5 CI: Use proper credentials for Security testsuite checkout
Can't do anonymous http checkout from Security-testsuite.
Need to use same credentials as the gerrit review checkout.

Change-Id: I87af68c995cb8926f5e87f9af245600d76984f05
2018-09-14 12:34:50 -05:00
George Joseph 349355f1f1 Merge "res_musiconhold.c: Restart MOH if previous hold just reached end-of-file" into 16 2018-09-14 11:12:40 -05:00
George Joseph 17d6d9e1e7 stasis_cache: Stop caching stasis subscription change messages
Since app_voicemail no longer uses the cache to maintain its state
there is no longer a need to cache these messages.

ASTERISK-27121

Change-Id: I321c708505f5ad8d00e1b0afc4c27dc2ac12ecb4
2018-09-14 06:04:50 -05:00
George Joseph 06d51a0408 Merge "optional_api: Remove unused nonoptreq fields" into 16 2018-09-13 13:09:17 -05:00
George Joseph 9db82309d5 Merge "CI: Use .gitreview to default BRANCH_NAME." into 16 2018-09-13 10:37:07 -05:00
Jenkins2 39829f0a78 Merge "res_pjproject: Fix sockaddr conversion routines for non-bundled PJSIP" into 16 2018-09-13 07:09:34 -05:00
Corey Farrell 5842741689 CI: Use .gitreview to default BRANCH_NAME.
This ensures that binary modules are avoided in the master branch even
if BRANCH_NAME is not set.

Change-Id: I79162d2063f22fa9d6b31fde4827ace2dd5bf0da
2018-09-12 19:11:57 -05:00
Walter Doekes 78453e65fd optional_api: Remove unused nonoptreq fields
As they're not actively used, they only grow stale. The moduleinfo field itself
is kept in Asterisk 13/15 for ABI compatibility.

ASTERISK-28046 #close

Change-Id: I8df66a7007f807840414bb348511a8c14c05a9fc
2018-09-12 19:33:08 +02:00
Joshua Colp 7ed02b4925 Merge "manager: Set AMI event "Newexten" to the EVENT_FLAG_DIALPLAN class" into 16 2018-09-12 11:01:14 -05:00
lvl f4bffe2326 manager: Set AMI event "Newexten" to the EVENT_FLAG_DIALPLAN class
The documentation already specified EVENT_FLAG_DIALPLAN for this
event, but the implementation was using EVENT_FLAG_CALL.

Using EVENT_FLAG_DIALPLAN allows AMI clients to opt out of receiving
this highly verbose event.

ASTERISK-28033

Change-Id: I45b3119f30e4dbc17b49831f2b1a4f2c1beadafe
2018-09-12 09:20:50 -05:00
Sean Bright e5739c494c res_pjproject: Fix sockaddr conversion routines for non-bundled PJSIP
The bundled version of pjproject has a patch for Solaris compatability
that changes the definition of various socket structures which we need
to account for when compiling against a non-bundled version.

ASTERISK-28049 #close

Change-Id: Ia1ea47c433fc2d915115193ee889a752373925f0
2018-09-12 07:26:23 -05:00
Corey Farrell ecb3b23b07 Build System: Resolve conflict between DESTDIR and bundled jansson.
If Asterisk is built using a DESTDIR this will cause the bundled jansson
to be installed to an unexpected location and we will fail to find it.

Change-Id: Id033e2813261e0d45232383d44c6391122169548
2018-09-10 22:36:25 -05:00
Frederic LE FOLL ccfd2e0f5d res_musiconhold.c: Restart MOH if previous hold just reached end-of-file
On MOH activation, moh_files_readframe() is called while the current
stream attached to the channel is NULL and it calls ast_moh_files_next()
immediately.  However, it won't call ast_moh_files_next() again if sample
reading fails.  The failure may occur because res_musiconhold retains the
last sample reading position in the channel data and MOH during the
previous hold/retrieve just reached EOF.  Obviously, a bit of bad luck is
required here.

* Restructured moh_files_readframe() to try a second time to start MOH if
there was no stream setup and the saved position was at EOF.  Also added
comments describing what is going on for each step.

ASTERISK-28029

Change-Id: I1508cf2c094f8feca22d6f76deaa9fdfa9944860
2018-09-07 07:58:35 -05:00
Jenkins2 c1a2c84361 Merge "core: Don't stop generators when writing RTCP frames." into 16 2018-09-07 07:02:24 -05:00
Joshua Colp 3c52cc32f1 Merge "stasis_cache: Prune stasis_subscription_change messages" into 16 2018-09-07 05:40:17 -05:00
Joshua Colp 6344cceed2 Merge "app_queue: Update realtime queuemembers after wait_a_bit(), not before" into 16 2018-09-07 04:48:40 -05:00
Joshua Colp af6a3d02e1 core: Don't stop generators when writing RTCP frames.
Generators provide such functionality as tone generation or
silence generation. RTCP frames provide RTCP information and
should not stop generators from operating.

ASTERISK-28005

Change-Id: Ieadada07b068a7aa426e8763f1b73a18e1ac34a9
2018-09-06 17:08:48 -05:00
lvl 034a3d8b86 app_queue: Update realtime queuemembers after wait_a_bit(), not before
This ensures the most up-to-date information is used for the next
call attempt.

ASTERISK-28032

Change-Id: I02fc17c6ffb50bb60ea97c2d2e6023e8061815ce
2018-09-06 16:13:44 -05:00
Sean Bright 3134fd95a9 res_pjproject: Add utility functions to convert between socket structures
Currently, to convert from a pj_sockaddr to an ast_sockaddr, the address
needs to be rendered to a string and then parsed into the correct
structure. This also involves a call to getaddrinfo(3). The same is true
for the inverse operation.

Instead, because we know the internal structure of both ast_sockaddr and
pj_sockaddr, we can translate directly between the two without the
need for an intermediate string.

Change-Id: If0fc4bba9643f755604c6ffbb0d7cc46020bc761
2018-09-06 14:29:44 -04:00
George Joseph ead0bc63da Merge "http.c: Give HTTP error response when received lines are too long." into 16 2018-09-06 11:50:30 -05:00
George Joseph 9fb166cf3b stasis_cache: Prune stasis_subscription_change messages
The stasis cache provides a way to reconstruct the current state
of topic subscribers.  Unfortunately, since every subscribe and
unsubscribe is cached, the cache continues to grow unabated while
asterisk is running.  This patch removes subscribe messages from
the cache when the corresponding unsubscribe is received.

This patch also registers the cache containers with ao2 so that if
AO2_DEBUG is turned on, you can list the container and get its
stats from the CLI.

ASTERISK-27121

Change-Id: I3d18905e477f3721815da91f30da8d3fbb2d4f56
2018-09-05 13:52:08 -05:00
George Joseph 85a7c33acf Merge "app_dial: set the comment for OPT_ARG_ANNOUNCE to really what is done" into 16 2018-09-05 11:00:52 -05:00
George Joseph 597f612645 Merge "res_pjsip: Fix mwi_subscribe_replaces_unsolicited type mismatch" into 16 2018-09-05 09:55:55 -05:00
George Joseph 10460501ca Merge "iostream.c: Fix ast_iostream_gets() needlessly returning failure." into 16 2018-09-05 09:53:29 -05:00
Rodrigo Ramírez Norambuena 8879a62c1c app_dial: set the comment for OPT_ARG_ANNOUNCE to really what is done
Change-Id: I08f88adb09f7e5813f37e70fecd787468cdb32c8
2018-09-04 07:51:58 -05:00
Chris-Savinovich cfb854e241 pbx_config.c: Fix reloading module if initially declined to load
Added decline if extensions.conf file not available
when loading pbx_config, and also made sure everything
gets properly unregistered and/or destroyed on unload.

Change-Id: Ib00665106043b1be5148ffa7a477396038915854
2018-08-31 17:04:11 -05:00
Joshua Colp ed7cef7d06 Merge "make config: os-release output error." into 16 2018-08-31 04:55:10 -05:00
Richard Mudgett 4fcdcfaa37 http.c: Give HTTP error response when received lines are too long.
Added a check when we receive a HTTP request line or header line that is
too long.  We now return an error response to the sender because we are
not able to process the request.

Change-Id: I6df2705435fd7dde4d5d3bdf7acec859cfb7c12d
2018-08-30 17:22:32 -05:00
Richard Mudgett f6a165208b iostream.c: Fix ast_iostream_gets() needlessly returning failure.
Providing a buffer larger than the internal buffer of ast_iostream_gets()
fails to get lines longer than the internal buffer.

* Made ast_iostream_gets() fill the supplied buffer with read data until
either a '\n' is found or the supplied buffer is filled just like fgets().

Change-Id: If18b3f6ee500e22f0633a68779ed09f7e0f305ed
2018-08-30 17:12:00 -05:00
Joshua Colp 62afa54977 Merge "res_fax: Handle fax gateway being started more than once." into 16 2018-08-30 05:43:46 -05:00
Joshua Colp ad37ab9a8f Merge "res_pjsip_transport_websocket: Properly set src_name for IPv6" into 16 2018-08-30 05:08:56 -05:00
Richard Mudgett 4dd8b5bbb4 res_pjsip: Fix mwi_subscribe_replaces_unsolicited type mismatch
ASTERISK-27988

Change-Id: Iccafdd0552ea8aaed647620fb14499f1bf341843
2018-08-29 09:47:51 -05:00
Rodrigo Ramírez Norambuena 1edd9eb309 make config: os-release output error.
Fix not show the error
"/bin/sh: /etc/os-release: No such file or directory" when the command
'make config' is run in a System without systemv.

The instruction 'make config' pre execute the syntax
"$(shell . /etc/os-release && echo $$ID)" to identified if system is a
Slackware and Opensuse.

This change prevent show the message and is send to the /dev/null

Change-Id: I7f43e281a8d9405b2519fc653de82d9b8b645fdf
2018-08-29 08:27:02 -05:00
Joshua Colp 6f27ad59f5 Merge "Create --disable-binary-modules option." into 16 2018-08-29 06:09:33 -05:00
Joshua Colp 390d0b42ca res_fax: Handle fax gateway being started more than once.
The T.38 fax gateway state machine can cause the fax gateway
to be started more than once on a channel depending on the
responses of the remote endpoint. This would previously leak
the channel name, channel unique id, and underlying fax engine
state. This change instead makes it so that if the fax gateway
session is already present and not reserved the fax gateway
is not started again.

ASTERISK-27981

Change-Id: I552d95086860cb18f2522ee40ef47b13b6da2e0e
2018-08-29 05:20:24 -05:00
George Joseph a52b56b4d1 Merge "alembic: increase uri column size" into 16 2018-08-28 09:17:31 -05:00
Sean Bright 245fb462d6 res_pjsip_transport_websocket: Properly set src_name for IPv6
SIP responses over WebSockets when the client is using IPv6 have invalid
Via headers according to RFC 3261. The 'received' header parameter
should not be wrapped in brackets if it is an IPv6 address.

When src_name is populated by the built-in PJSIP transports, the code
uses pj_sockaddr_print() with 'flags' set to 0, meaning that the
brackets are not rendered around IPv6 addresses.

This may be related to ASTERISK~27101.

See also: https://github.com/onsip/SIP.js/pull/594

ASTERISK-28020 #close

Change-Id: I8ea9d289901b837512bee2ca2535e3dc14f04d77
2018-08-28 08:02:38 -05:00
Corey Farrell 1b1f47bef6 Create --disable-binary-modules option.
This new option can be passed for ./configure or
./tests/CI/buildAsterisk.sh to prevent download/install of binary
modules.

Normally enabling the categories MENUSELECT_CODECS or MENUSELECT_RES
will result in binary modules being enabled even if the build target is
incompatible with those modules.  This includes CI scripts which enable
categories before disabling specific modules.

If more binary modules are offered in the future this will help avoid
accidentally downloading them if unwanted or incompatible.  Adding a
binary module will only require creating a new menuselect entry similar
to the existing ones, it will not be necessary to modify the CI scripts.

Change-Id: I6b1bd1c75a2e48f05b8b8a45b7a7a2d00a079166
2018-08-27 13:45:08 -05:00
neutrino88 aa2755cbb3 res/res_rtp_asterisk: remove debug traces generated by an empty frame
The realtime text timer pops regularly and sends text frames even if
the buffer is empty. This causes a lot of unecessary debug logging.

* Made red_write() test if we need to send a frame before calling
ast_rtp_write()

ASTERISK-28002
Reported by: Emmanuel BUU
Tested by: Emmanuel BUU

Change-Id: Icf81310c3b8080b615a42060afc02ab41f9523dd
2018-08-27 12:02:54 -05:00
Joshua Colp 3d495f89bc Merge "pbx_dundi: Added IPv6 support for dundi" into 16 2018-08-27 09:59:02 -05:00
Jenkins2 14c84efbfe Merge "chan_sip: improved ip:port finding of peers for non-UDP transports." into 16 2018-08-27 07:02:21 -05:00
Jenkins2 777d125516 Merge "sample_configs: noload res_hep.so by default" into 16 2018-08-27 05:58:17 -05:00
Jaco Kroon 46442aa9e5 chan_sip: improved ip:port finding of peers for non-UDP transports.
Also remove function peer_ipcmp_cb since it's not used (according to
rmudgett).

Prior to b2c4e8660a (ASTERISK_27457)
insecure=port was the defacto standard.  That commit also prevented
insecure=port from being applied for sip/tcp or sip/tls.

Into consideration there are three sets of behaviour:

1.  "previous" - before the above commit.
2.  "current" - post above commit, pre this one.
3.  "new" - post this commit.

The problem that the above commit tried to address was guests over TCP.
It succeeded in doing that but broke transport!=udp with host!=dynamic.

This commit attempts to restore sane behaviour with respect to
transport!=udp for host!=dynamic whilst still retaining the guest users
over tcp.

It should be noted that when looking for a peer, two passes are made, the
first pass doesn't have SIP_INSECURE_PORT set for the searched-for peer,
thus looking for full matches (IP + Port), the second pass sets
SIP_INSECURE_PORT, thus expecting matches on IP only where the matched
peer allows for that (in the author's opinion:  UDP with insecure=port,
or any TCP based, non-dynamic host).

In previous behaviour there was special handling for transport=tcp|tls
whereby a peer would match during the first pass if the utilized
transport was TCP|TLS (and the peer allowed that specific transport).

This behaviour was wrong, or dubious at best.  Consider two dynamic tcp
peers, both registering from the same IP (NAT), in this case either peer
could match for connections from an IP.  It's also this behaviour that
prevented SIP guests over tcp.

The above referenced commit removed this behaviour, but kept applying
the SIP_INSECURE_PORT only to WS|WSS|UDP.  Since WS and WSS is also TCP
based, the logic here should fall into the TCP category.

This patch updates things such that the previously non-explicit (TCP
behaviour) transport test gets performed explicitly (ie, matched peer
must allow for the used transport), as well as the indeterministic
source-port nature of the TCP protocol is taken into account.  The new
match algorithm now looks like:

1.  As per previous behaviour, IP address is matched first.

2.  Explicit filter with respect to transport protocol, previous
    behaviour was semi-implied in the test for TCP pure IP match - this now
    made explicit.

3.  During first pass (without SIP_INSECURE_PORT), always match on port.

4.  If doing UDP, match if matched against peer also has
    SIP_INSECURE_PORT, else don't match.

5.  Match if not a dynamic host (for non-UDP protocols)

6.  Don't match if this is WS|WSS, or we can't trust the Contact address
    (presumably due to NAT)

7.  Match (we have a valid Contact thus if the IP matches we have no
    choice, this will likely only apply to non-NAT).

To logic-test this we need a few different scenarios.  Towards this end,
I work with a set number of peers defined in sip.conf:

[peer1]
host=1.1.1.1
transport=tcp

[peer2]
host=1.1.1.1
transport=udp

[peer3]
host=1.1.1.1
port=5061
insecure=port
transport=udp

[peer4]
host=1.1.1.2
transport=udp,tcp

[peer5]
host=dynamic
transport=udp,tcp

Test cases for UDP:

1 - incoming UDP request from 1.1.1.1:
  - previous:
    - pass 1:
      * peer1 or peer2 if from port 5060 (indeterminate, depends on peer
        ordering)
      * peer3 if from port 5061
      * peer5 if registered from 1.1.1.1 and source port matches
    - pass 2:
      * peer3
  - current: as per previous.
  - new:
    - pass 1:
      * peer2 if from port 5060
      * peer3 if from port 5061
      * peer5 if registered from 1.1.1.1 and source port matches
    - pass 2:
      * peer3

2 - incoming UDP request from 1.1.1.2:
  - previous:
    - pass 1:
      * peer5 if registered from 1.1.1.2 and port matches
      * peer4 if source port is 5060
    - pass 2:
      * no match (guest)
  - current: as previous.
  - new as previous (with the variation that if peer5 didn't have udp as
          allowed transport it would not match peer5 whereas previous
          and current code could).

3 - incoming UDP request from anywhere else:
  - previous:
    - pass 1:
      * peer5 if registered from that address and source port matches.
    - pass 2:
      * peer5 if insecure=port is additionally set.
      * no match (guest)
  - current - as per previous
  - new - as per previous

Test cases for TCP based transports:

4 - incoming TCP request from 1.1.1.1
  - previous:
    - pass 1 (indeterministic, depends on ordering of peers in memory):
      * peer1; or
      * peer5 if peer5 registered from 1.1.1.1 (irrespective of source port); or
      * peer2 if the source port happens to be 5060; or
      * peer3 if the source port happens to be 5061.
    - pass 2: cannot happen since pass 1 will always find a peer.
  - current:
    - pass 1:
      * peer1 or peer2 if from source port 5060
      * peer3 if from source port 5060
      * peer5 if registered as 1.1.1.1 and source port matches
    - pass 2:
      * no match (guest)
  - new:
    - pass 1:
      * peer 1 if from port 5060
      * peer 5 if registered and source port matches
    - pass 2:
      * peer 1

5 - incoming TCP request from 1.1.1.2
  - previous (indeterminate, depends on ordering):
    - pass 1:
      * peer4; or
      * peer5 if peer5 registered from 1.1.1.2
    - pass 2: cannot happen since pass 1 will always find a peer.
  - current:
    - pass 1:
      * peer4 if source port is 5060
      * peer5 if peer5 registered as 1.1.1.2 and source port matches
    - pass 2:
      * no match (guest).
  - new:
    - pass 1:
      * peer4 if source port is 5060
      * peer5 if peer5 registered as 1.1.1.2 and source port matches
    - pass 2:
      * peer4

6 - incoming TCP request from anywhere else:
  - previous:
    - pass 1:
      * peer5 if registered from that address
    - pass 2: cannot happen since pass 1 will always find a peer.
  - current:
    - pass 1:
      * peer5 if registered from that address and port matches.
    - pass 2:
      * no match (guest)
  - new: as per current.

It should be noted the test cases don't make explicit mention of TLS, WS
or WSS.  WS and WSS previously followed UDP semantics, they will now
enforce source port matching.  TLS follow TCP semantics.

The previous commit specifically tried to address test-case 6, but broke
test-cases 4 and 5 in the process.

ASTERISK-27881 #close

Change-Id: I61a9804e4feba9c7224c481f7a10bf7eb7c7f2a2
2018-08-24 02:31:59 -05:00
Jaco Kroon d84de695ed AMI: be less verbose when adding HTTP headers to AMI/HTTP messages.
All HTTP/AMI message headers are being sent to the verbose channel.
There are multiple places this is happening.  Consolidate the loop into
a function.  Drop the debug/verbose message.

Convert to using ast_asprintf to perform the length calculation, memory
allocation and snprintf all in one step.

Change-Id: Ic45e673fde05bd544be95ad5cdbc69518207c1a1
2018-08-23 14:57:13 -05:00
Matthew Fredrickson 4188e7d6dd sample_configs: noload res_hep.so by default
Change disables loading of res_hep.so in default installation.  Loading
res_hep has a performance impact whether it's used or not.  This disables
loading of it in sample config files.

Change-Id: I5ec150cf941634fabc72973e5bf1a965cb0ef9d0
(cherry picked from commit c8bacd45f1)
2018-08-23 10:11:37 -05:00
Florian Floimair 595e358761 alembic: increase uri column size
When mobile SIP clients register with Asterisk that use some sort of
push notifications, the URI can get quite lengthy due to the
additional push-service annotations (things like tokens, pn-type, etc.)
contained in it.

ASTERISK-28022 #close

Change-Id: I6c55013bafe79f7e7a1fb6722d2558f553709f2e
2018-08-23 14:04:02 +02:00
Joshua Colp bd650b6a49 Merge "app_queue: Silence GCC 8 compiler warning" into 16 2018-08-22 11:35:49 -05:00
Joshua Colp 378964f403 Merge "res_pjsip: Reduce processing when a Contact is updated." into 16 2018-08-22 11:17:58 -05:00
Sean Bright 4b88cb383d app_queue: Silence GCC 8 compiler warning
I'm only seeing an error in 14+, so I assume it is due to different
compiler options:

app_queue.c: In function ‘handle_queue_add_member’:
app_queue.c:10234:19: error: ‘%d’ directive writing between 1 and 11
    bytes into a region of size 3 [-Werror=format-overflow=]
     sprintf(num, "%d", state);
                   ^~
app_queue.c:10234:18: note: directive argument in the range
    [-2147483648, 99]
     sprintf(num, "%d", state);
                  ^~~~

Compiler: gcc version 8.0.1 20180414 (experimental)
    [trunk revision 259383] (Ubuntu 8-20180414-1ubuntu2) 

Change-Id: I18577590da46829c1ea7d8b82e41d69f105baa10
2018-08-22 08:53:00 -05:00
Joshua Colp 6b527d11ae Merge "pbx_dundi.c: Handle thread shutdown better." into 16 2018-08-21 18:53:01 -05:00
Joshua Colp b0db0df7b8 Merge "AMI: Remove docs for nonexistent AMI ContactStatus event headers" into 16 2018-08-21 08:07:35 -05:00
Joshua Colp 2454c1d310 Merge "pbx_dundi: Fix debug frame decode string." into 16 2018-08-21 08:00:52 -05:00
Joshua Colp b880b50922 Merge "pbx_dundi.c: Misc memory management fixes when destroying peers" into 16 2018-08-21 06:55:25 -05:00
Richard Mudgett fb2f242c49 AMI: Remove docs for nonexistent AMI ContactStatus event headers
Change-Id: I5736965c64c44338f7330e85a24bb46818607f19
2018-08-20 12:32:46 -05:00
George Joseph 5645dc6894 Merge "pbx_dundi: Update sample config documentation." into 16 2018-08-20 11:30:40 -05:00
George Joseph b523aaf699 Merge "res_sorcery_realtime.c: Fix unqualified fetch warning." into 16 2018-08-20 10:57:24 -05:00
George Joseph 0fe2eadbc3 Merge "res_pjsip_t38.c: Fix crash if already saw a final T.38 reINVITE response." into 16 2018-08-20 10:55:22 -05:00
Joshua Colp b9cd4c6d92 res_pjsip: Reduce processing when a Contact is updated.
When a Contact is updated the only material change that qualify
support cares about is the underlying configuration for the AOR.
In this case we will update things with the new AOR information but
otherwise the callback to indicate the Contact has changed can be
ignored.

This is because it is only when a Contact is added or deleted that
material changes occur within the qualify support. An update can't
change the URI since it would result in a new Contact so it can be
ignored.

Change-Id: I2f97ebfa79969a36a97bb7b9afd5b6268cf1a07d
2018-08-18 18:08:22 -03:00
Richard Mudgett 236826a111 res_pjsip_t38.c: Fix crash if already saw a final T.38 reINVITE response.
We were still getting crashes after the first fix.  Somehow we receive a
non-2xx final response before we get a 200 final response.  With the
failure response we had already cleaned up and destroyed some data
structures.  When the unexpected 200 response comes in we crash.

* Add protection code to prevent processing another final T.38 reINVITE
response.

ASTERISK-27944

Change-Id: I8b5baba8d07fe4d63f0d7d05d3eb9a3d27d40a74
2018-08-17 18:56:12 -05:00
Richard Mudgett 19298141cf res_sorcery_realtime.c: Fix unqualified fetch warning.
The allow_unqualified_fetch option for the sorcery realtime backend
blocked actually fetching all rows when the option is set to warn.

* Made issue a warning and actually do the request when
allow_unqualified_fetch=warn is set.

Change-Id: I74456c80a03a62dce66fc3dc3cb0cf2351ac4312
2018-08-17 16:33:13 -05:00
Kirsty Tyerman f6c1d94d91 pbx_dundi: Added IPv6 support for dundi
Change includes move to netsock2 library.

ASTERISK-27164
Reported-by: Adam Secombe

Change-Id: Ia9e8dc3d153de7a291dbda4bd87fc827dd2bb846
2018-08-17 16:03:12 -05:00
Richard Mudgett 4e43823d19 pbx_dundi.c: Misc memory management fixes when destroying peers
* In destroy_peer(), fixed memory leaks of lookup history strings and
qualify transactions when destroying peers.

* In destroy_peer(), fixed leaving the registerexpire scheduled callback
active when a peer is destroyed on a reload.  The reload marks and sweeps
peers so any peers not explicitly configured get destroyed.  Peers created
dynamically from the '*' peer will not exist until they re-register after
the reload.  These destroyed peers caused memory corruption when the
registerexpire timer expired.

* Made build_peer() not schedule any callbacks on the '*' peer
(empty_eid).  It is a special peer that is cloned to dynamically created
peers so it doesn't actually get involved in any message transactions.

* Made do_register_expire() remove the dundi/dpeers AstDB entry when a
peer registration expires.

* Fix deep_copy_peer() to not copy some things that cannot be copied to
the cloned peer structure.  Timers, message transactions, and lookup
history are specific to a peer instance.

* Made set_config() lock around processing the mappings configuration.

* Reordered unload_module() to handle load_module() declining the load due
to error.

Change-Id: Ib846b2b60d027f3a2c2b3b563d9a83a357dce1d6
2018-08-17 14:44:13 -05:00
Richard Mudgett 857926d197 pbx_dundi.c: Handle thread shutdown better.
Change-Id: Id52f99bd6a948fe6dd82acc0a28b2447a224fe87
2018-08-17 14:42:29 -05:00
Richard Mudgett 111e73678e pbx_dundi: Fix debug frame decode string.
* Fixed a typo in the name of the REGREQ frame decode string array.
* Fixed off by one range check indexing into the frame decode string
array.
* Removed some unneeded casts associated with the decode string array.

Change-Id: I77435e81cd284bab6209d545919bf236ad7933c2
2018-08-17 14:40:45 -05:00
Richard Mudgett a7ace944ae pbx_dundi: Update sample config documentation.
Change-Id: I33d0ad0611c2124ca3440f0f811fa0f45e4e2849
2018-08-17 14:39:19 -05:00
Richard Mudgett 0874d5b316 res_rtp_asterisk.c: Fix unused variable warnings
Compiling without SRTP support installed resulted in some unused variable
warnings.  These warnings also showed that the srtp variable was obtained
and passed around some functions but not really used even when a system
has SRTP installed.

Change-Id: I6daad34be3e89b19adef6e2fbe738018975155fc
2018-08-17 14:36:04 -05:00
Joshua Colp 7d8e2389d6 Merge "res_resolver_unbound: Fix leak of config nameserver strings." into 16 2018-08-17 05:39:53 -05:00
Joshua Colp 14da6be84d Merge "res_pjsip: Resolve transport management leak at shutdown." into 16 2018-08-17 05:38:30 -05:00
Kevin Harwell 80a331d96b Merge "res_odbc: Allow unload at shutdown." into 16 2018-08-16 17:47:40 -05:00
George Joseph df78227e4a CI: Fixup for non-13 branches
Change-Id: I5e1d4a09e58b92b541bc8ed6f9e10e54c4e5101f
2018-08-16 12:51:51 -06:00
George Joseph 4ca959c72c CI: Final version of setting correct gerrit creds
Change-Id: I7729ecceedceb12f52bf18dae259846aa1d993b3
2018-08-16 12:33:37 -06:00
George Joseph 33a5b8ccaf CI: Add https credentials to gerrit checkouts
If the review to be tested is in a project with restricted access,
we need to use the jenkins user's gerrit https credentials when we
do the checkout or the checkout will fail.

Change-Id: I9dc9994763c5ebfeb9f1cff60fb53f6902b7fd5f
2018-08-16 12:33:37 -06:00
George Joseph 4f95992d36 Merge "res/res_pjsip_sdp_rtp: put rtcp-mux in answer only if offered" into 16 2018-08-16 09:46:09 -05:00
Torrey Searle 0d4bde84d1 res/res_pjsip_sdp_rtp: put rtcp-mux in answer only if offered
If in the initial sdp the caller doesn't include the line
a=rtcp-mux

Then asterisk shoud not include rtcp-mux in the response regardless
of rtcp-mux being enabled on the endpoint

ASTERISK-28007 #close

Change-Id: I58e9b9f40a139afc0da5de41906cc608fb62adc7
2018-08-16 02:06:24 -05:00
Corey Farrell 167efe3a47 res_resolver_unbound: Fix leak of config nameserver strings.
Change-Id: I3f396316bb40d1ae6e91f5f688042420f1a540ed
2018-08-15 16:32:48 -04:00
Corey Farrell 72dbc9fb70 res_pjsip: Resolve transport management leak at shutdown.
Cleanup idle check scheduled events at shutdown.

Change-Id: I61bfbb56bac69fe840c3242927d31ff3593be461
2018-08-15 14:55:48 -04:00
Corey Farrell 6e0f4a2127 res_pjsip: Fix leak in pjsip_options.
sip_options_get_endpoint_state_compositor_state leaked a reference to
the first available endpoint state compositor that was found.

Change-Id: Idb6be19f7219b6eed1dfb19c1e740dd40cb3fdc7
2018-08-15 11:33:17 -05:00
Corey Farrell b370482786 res_odbc: Allow unload at shutdown.
This makes it possible for REF_DEBUG to report no leaks when loading
res_odbc.

Change-Id: I1a3dea786bd6e7f4820a6dd5cbaa197fa783ce93
2018-08-15 12:31:00 -04:00
George Joseph 100ffc6866 Merge "res_pjsip/rtp: No joint capabilities between streams." into 16 2018-08-15 09:44:57 -05:00
Jenkins2 c03ab4c4b1 Merge "res_pjsip_caller_id: Add "party" parameter to RPID header." into 16 2018-08-15 08:57:07 -05:00
George Joseph aee6d12f15 Merge "contrib/scripts: Make astgenkey executable" into 16 2018-08-15 07:50:56 -05:00
Corey Farrell d61a8791b5 Build System: Improve ccache matching for different menuselect options.
Changing any Menuselect option in the `Compiler Flags` section causes a
full rebuild of the Asterisk source tree.  Every enabled option causes
a #define to be added to buildopts.h, thus breaking ccache caching for
every source file that includes "asterisk.h".  In most cases each option
only applies to one or two files.  Now we only define those options for
the specific sources which use them, this causes much better cache
matching when working with multiple builds.  For example testing code
with an without MALLOC_DEBUG will now use just over half the ccache
size, only main/astmm.o will have two builds cached instead of every
file.

Reorder main/Makefile so _ASTCFLAGS set on specific object files are all
together, sorted by filename.  Stop adding -DMALLOC_DEBUG to CFLAGS of
bundled pjproject, this define is no longer used by any header so only
serves to break cache.

The only code change is a slight adjustment to how main/astmm.c is
initialized.  Initialization functions always exist so main/asterisk.c
can call them unconditionally.  Additionally rename the astmm
initialization functions so they are not exported.

Change-Id: Ie2085237a964f6e1e6fff55ed046e2afff83c027
2018-08-14 12:45:10 -05:00
Richard Mudgett 0e4f5f5189 contrib/scripts: Make astgenkey executable
Change-Id: I11641d65592536dea9cbca5aa94a24c25d24dd5f
2018-08-14 12:09:56 -05:00
Joshua Colp 56c1285b8a res_pjsip_caller_id: Add "party" parameter to RPID header.
This change adds the "party" parameter to the Remote-Party-ID header
which indicates which party the header information is applicable
to. In Asterisk this is determined on whether we are the calling
or called party. This is added to improve interoperability with some
implementations.

ASTERISK-28006

Change-Id: I1eec3e377ffff8633b5c1dd59a05e9533122cfca
2018-08-14 08:55:30 -05:00
Corey Farrell 3bf968470b CI: Add support for coverage processing.
Enable coverage with `./tests/CI/buildAsterisk.sh --coverage`.  This
will cause Asterisk to be compiled with coverage support.  It also
initializes 'before' coverage data for all sources.  Accept
--tested-only to disable modules which are not run by any test.
Enabling coverage also sets tested-only true by default.  To build
everything with coverage enabled use `--coverage --tested-only=0`.

./tests/CI/processCoverage.sh is used to process the coverage and
generate HTML reports.

Fix utils/check_expr2 which failed to compiled with coverage enabled.

Add status output 5 times per stage of astobj2_test_perf to ensure
remote CLI does not timeout when compiled with coverage.  Remote CLI
disconnects if no output is received for 60 seconds.  When coverage is
enabled it takes about 70 seconds for my laptop to run the stages of
this test, so with the change a message is printed every 14 seconds.

Change-Id: I890f7d5665087426ad7d3e363187691b9afc2222
2018-08-14 07:06:46 -05:00
Ben Ford a46fcaca7b res_pjsip/rtp: No joint capabilities between streams.
When a conference contained a mixture of audio/video and audio-only
users, a NOTICE message would pop up stating there are no joint
capabilities between streams. This happens because streams can never be
removed, but they can be in a REMOVED state. If we have the scenario
where user A joins with audio/video, user B joins with audio-only, and
user C joins with audio/video, then user A leaves, the message would
be triggered. That removed stream is still in the SDP, but Asterisk
would pass it through, causing it to be seen as a ulaw stream. A check
has been added for removed streams, setting their status to REMOVED when
handling negotiated SDPs.

Also addressed an issue where user A joins, then user B joins but does
not receive video until much later. Full frames were not being sent,
causing some PLI from the browser. Because the video was flowing in one
direction, the browser sets the SSRC to 1, but Asterisk was dropping the
PLI because of that. Added a check to see if the SSRC is 1 or not, which
sends full frames and allows video to flow between user A and user B.
This should only happen when dealing with PSFB or FUR, and in the case
of PSFB, only for PLI.

ASTERISK-27398

Change-Id: I26e7c6f101bc119549eeca406b5bcd25ad8ebc5e
2018-08-13 14:01:53 -05:00
Ivan Poddubny fce68efbbe app_queue: set QUEUESTATUS to LEAVEEMPTY instead of CONTINUE
When a call leaves a queue on leaveempty condition, QUEUESTATUS
must be set to LEAVEEMPTY, no matter whether Queue was executed with or
without the "c" (continue) option.

The regression was introduced in the fix for ASTERISK_25665.
The following fix (ASTERISK_27065) was incomplete, as QUEUESTATUS was
overwritten in case when "c" is set, regardless of what was the cause
for leaving the queue.

ASTERISK-27973 #close
Reported-by: Valentin Safonov

Change-Id: Iec013fe6a26a4e825ca572a1dda4f3cee5f6f80c
2018-08-13 12:45:09 -05:00
Corey Farrell 661273a078 Sample configs: Fix pjsip.conf syntax error.
It is valid for a config file to be empty or contain only comments, but
not valid for a config value to be set when no uncommented context
exists.  This caused an error to be loged numerous times during start
when loading the default pjsip.conf.

Change-Id: Icf3b0d69b4ecb6e935eecd43c99ed8b32a5a1cf6
2018-08-09 16:42:24 -05:00
Kevin Harwell 1d1473d408 Merge "res_pjsip_registrar: Improve performance on inbound handling." into 16 2018-08-08 12:22:33 -05:00
Joshua Colp 4202fbdc51 Merge "stasis: Reduce calculation of stasis message type hash." into 16 2018-08-08 05:52:47 -05:00
Joshua Colp 0df8ab0adc Merge "res_pjsip: Make pjlib.h consistently included." into 16 2018-08-08 05:46:56 -05:00
Joshua Colp f568428111 Merge "res_pjsip.h: Fix doxygen comments." into 16 2018-08-08 05:11:27 -05:00
Joshua Colp ef029a3224 Merge "pjproject_bundled: Fix for Solaris builds. Do not undef s_addr." into 16 2018-08-08 05:10:54 -05:00
Richard Mudgett eb87a98a1a res_pjsip.h: Fix doxygen comments.
Change-Id: I9cf97bdc756012d1f552ab007f4aa85e0ddb4e62
2018-08-07 10:29:29 -05:00
Joshua Colp 5030756bfa stasis: Reduce calculation of stasis message type hash.
When the stasis cache is used a hash is calculated for
retrieving or inserting messages. This change calculates
a hash when the message type is initialized that is then
used each time needed. This ensures that the hash is
calculated only once for the message type.

Change-Id: I4fe6bfdafb55bf5c322dd313fbd8c32cce73ef37
2018-08-06 11:17:54 -05:00
Joshua Colp fcece326ed Merge "dialplan_functions: wrong srtp use status report of a dialplan function" into 16 2018-08-06 08:34:25 -05:00
Joshua Colp baae4a5e48 Merge "pjproject_bundled: Find shared libraries in root --with-ssl=PATH." into 16 2018-08-06 05:29:08 -05:00
Alexander Traud 04974a0ca2 pjproject_bundled: Fix for Solaris builds. Do not undef s_addr.
The authors of PJProject undef s_addr because of some issue in Microsoft
Windows. However in Oracle Solaris, s_addr is not a structure member, but
defined to map to the real structure member.

Updates the patch from ASTERISK_20366

ASTERISK-27997

Change-Id: I8223026d4d54e2a46521085fcc94bfa6ebe35b11
2018-08-03 16:58:27 -05:00
Richard Mudgett 99a0586ec1 res_pjsip: Make pjlib.h consistently included.
* Don't include pjlib.h twice in res_pjsip.h
* Consistently use #include <> form for pjproject includes.
(pjsip.h and pjlib.h)

Change-Id: I3f7b42044840de64edf7e9d7695cb60c45990dc7
2018-08-03 16:07:13 -05:00
Salah Ahmed 523b7b2ffc dialplan_functions: wrong srtp use status report of a dialplan function
If asterisk offer an endpoint with SRTP and that endpoint respond
with non srtp, in that case channel(rtp,secure,audio) reply wrong
status.

Why delete flag AST_SRTP_CRYPTO_OFFER_OK while check identical remote_key:
Currently this flag has being set redundantly. In either case identical
or different remote_key this flag has being set. So if we
don't set it while we receive identical remote_key or non SRTP SDP
response then we can take decision of srtp use by using that flag.

ASTERISK-27999

Change-Id: I29dc2843cf4e5ae2604301cb4ff258f1822dc2d7
2018-08-03 13:49:52 -05:00
Kevin Harwell ec813a3fdb Merge "BuildSystem: Enable ncurses for menuselect in Solaris 11." into 16 2018-08-03 13:29:01 -05:00
Kevin Harwell fb862c4066 Merge "pjsip_wizard.conf.sample: Update remote_hosts description." into 16 2018-08-03 13:28:00 -05:00
Kevin Harwell 07c23cea37 Merge "res_pjsip_endpoint_identifier_ip.c: Added regex support to match_header" into 16 2018-08-03 13:26:19 -05:00
Alexander Traud e9d41572b3 pjproject_bundled: Find shared libraries in root --with-ssl=PATH.
The script configure from Teluu expects shared libraries (.so) in a subfolder
called 'lib', when --with-xyz=PATH is specified. However for OpenSSL, the
default location is the root of the source folder = PATH. Furthermore, Asterisk
supports both, 'lib' and root. For consistency and because Asterisk is using
(only) OpenSSL in PJProject, it is enhanced to support both locations, just
like Asterisk.

ASTERISK-27995

Change-Id: I8eb916a88b6b8c22e29bb40bee8faaca6c73406f
2018-08-03 09:19:35 -05:00
Joshua Colp 1e837e13f5 res_pjsip_registrar: Improve performance on inbound handling.
This change removes a sorcery lookup for retrieving all
contacts at the end of the registration process by keeping
track of the contacts that are added/updated/deleted.

This ensures at the end of the process the container of
contacts we have is the current state.

Pool usage has also been reduced by allocating one for
usage throughout the handling of a REGISTER and resetting
it to a clean state. This ensures that in most cases
we allocate once and just reuse it.

ASTERISK-28001

Change-Id: I1a78b2d46f9a2045dbbff1a3fd6dba84b612b3cb
2018-08-03 04:09:08 -05:00
Joshua Colp 19494d9481 Merge "thirdparty/pjproject: fix deadlock in response retransmissions" into 16 2018-08-02 07:13:48 -05:00
Joshua Colp 4462990ce7 Merge "BuildSystem: Enable Jansson in Solaris 11." into 16 2018-08-02 06:16:32 -05:00
Torrey Searle e818925a58 thirdparty/pjproject: fix deadlock in response retransmissions
The tdata containing the response can be shared by both the dialog
object and the tsx object.  In order to prevent the race condition
between the tsx retransmission and the dialog sending a response,
clone the tdata before modifying it for the dialog send response.

ASTERISK-27966 #close

Change-Id: Ic381004a3a212fe1d8eca0e707fe09dba4a6ab4e
2018-08-01 11:12:09 -05:00
Joshua Colp 927f68bb9d Merge "res_rtp_asterisk: In Developer Mode, do not require OpenSSL." into 16 2018-08-01 04:23:15 -05:00
Joshua Colp 8a8569cb81 Merge "res_pjsip_pubsub: Use ast_true for "prune_on_boot"." into 16 2018-07-31 16:11:16 -05:00
Richard Mudgett 20b53b5cee pjsip_wizard.conf.sample: Update remote_hosts description.
Remove the note that SRV records are not supported as that is no longer
true.

ASTERISK-27993

Change-Id: Id0dd6ef40e52702be9727a2b6122216cb00bb4ca
2018-07-31 11:29:15 -05:00
George Joseph 914b9e1934 CI: Add optional uninstall step before installing asterisk
Change-Id: I7dedf1e925eafc3a0adf01dd9dfbe44eb642aab7
2018-07-30 08:44:25 -05:00
Alexander Traud 93d1c34efe BuildSystem: Enable ncurses for menuselect in Solaris 11.
The check for the library ncurses should use not use the header <curses.h> but
<ncurses.h>, because on some platforms <curses.h> is not a drop-in replacement
for <ncurses.h>: For example in Solaris, the symbol initscr is a typedef in
<curses.h> to a symbol which does not exist in the library ncurses (initscr32).
Simply use <ncurses.h> when you link to ncurses.

Furthermore in Solaris, the header <ncurses.h> is in a subdirectory
/usr/include/ncurses and not available via pkg-config.

ASTERISK-15331
ASTERISK-14935
ASTERISK-12382
ASTERISK-9107

Change-Id: Ife367776b0ccf17d3fefed868245376bfb93745d
2018-07-29 03:21:19 -05:00
Joshua Colp ee9794d741 res_pjsip_pubsub: Use ast_true for "prune_on_boot".
Change-Id: Iedec4e7390b3e821987681da24d0298632b9873d
2018-07-28 08:01:10 -05:00
Alexander Traud c10b3ccd5f BuildSystem: Enable Jansson in Solaris 11.
In Solaris, the header <jansson.h> is in /usr/include/jansson. To find
Jansson even in such a subdirectory, the tool pkg-config is queried via
AST_PKG_CONFIG_CHECK. For those platforms, which do not list Jansson via
pkg-config, the previous check remains and is executed thereafter.

Because the check for the NetBSD Editline library uses the tool pkg-config
the code of PKG_PROG_PKG_CONFIG must be used. Because that check happens
earlier than Jansson, it must be placed in front of that.

ASTERISK-27991

Change-Id: I69ea0f379f87a50049654b2487c76ee1c04fa53a
2018-07-28 07:48:16 -05:00
Richard Mudgett 32ce8e5cf3 res_pjsip_endpoint_identifier_ip.c: Added regex support to match_header
This patch adds regular expression support to make the identify section's
match_header option more useful when attempting to match complex headers
like the 'To' or 'From' headers.  The 'From' header has variable
components such as the tag parameter that you cannot predict.  To specify
a regular expression put slashes around the regular expression in place of
the header value.

[identify-alice]
type=identify
endpoint=alice
match_header=From: /<sip:alice@127\\.0\\.0\\.1>/

* Added regex support to match_header so you could match a 'To' header
among other complex headers.

Fixed reported crashes when trying to match special headers like 'Contact'.
The identify section's match_header method used code that assumed you were
matching a generic header.  Any other type of header could cause a crash
if the header structure variant did not match the generic header enough.

* Made use code that will work for any header type instead of code
specific to generic headers.

Other fixes while in the area:

* Made check all headers of the requested name.
* Added some more sanity checks to the configured identify matching
options when applying the configuration.

ASTERISK-27548

Change-Id: I27dfd4ff5e2259b906640e3c330681b76b4ed1f1
2018-07-27 10:58:30 -05:00
Joshua Colp 59f53514ce res_pjsip_pubsub: Treat "prune_on_boot" as a yes / no.
The alembic for the PJSIP subscription persistence table has the
"prune_on_boot" field as a boolean. While in Asterisk we are
tolerant of many different definitions of true and false in the
database we only accept "yes" and "no". This change makes the
field treated as a yes/no instead of an integer, thus storing
"yes" and "no" instead of "1" and "0".

Change-Id: Ic8b9211b36babefe78f70def6828a135a6ae7ab6
2018-07-27 10:47:17 -05:00
Alexander Traud 8da81a208f res_rtp_asterisk: In Developer Mode, do not require OpenSSL.
OpenSSL is an optional external library and should stay optional even when
Developer Mode is configured.

ASTERISK-27990

Change-Id: Ia68a4cd5474b26d45e0f43b04032ad598022853b
2018-07-27 08:49:28 -05:00
Joshua Colp a31e877502 Merge "loader: Process dependencies for built-in modules." into 16 2018-07-27 06:04:34 -05:00
Joshua Colp f5dbcf122f Merge "Build System: Create 'make install-configs' target." into 16 2018-07-27 05:51:36 -05:00
Joshua Colp 3ce7f3a441 Merge "devicestate: Don't create topic when change isn't cached." into 16 2018-07-27 05:37:35 -05:00
Joshua Colp e449bc32de Merge "res_rtp_asterisk: Avoid merging command and regular T.140 text packets" into 16 2018-07-27 05:34:50 -05:00
George Joseph e097dca4d7 CI: Fix placement of job summary statments
Change-Id: Iace19e718f4e8fb48eb7dc9f98af53b115cc45f3
2018-07-26 17:56:41 -06:00
Corey Farrell e5de8a70f8 loader: Process dependencies for built-in modules.
With the new module loader it was missed that built-in modules never
parsed dependencies from mod->info into vectors of mod.  This caused
manager to be initialized before acl (named_acl).  If manager.conf
used any named ACL's they would not be found and result in no ACL being
applied to the AMI user.

In addition to the manager ACL fix this adds "extconfig" to all builtin
modules which support realtime configuration.  This only matters if one
of the builtin modules is configured with 'preload', depending on
"extconfig" will cause config.c to automatically be initialize during
the preload stage.

Change-Id: I482ed6bca6c1064b05bb538d7861cd7a4f02d9fc
2018-07-26 15:29:39 -04:00
neutrino88 d3809d61cb res_rtp_asterisk: Avoid merging command and regular T.140 text packets
When realtime text packets are to be sent, the text is accumulated in a
buffer and sent regularly by a timer.  It can happen that commands such as
a backspace, CR, or LF get merged with regular text.  This breaks some
UAs.

The proposed change:
* We test if the current packet contains a command.  If so we send the
buffer immediately.
* We test if the buffer contained a command.  If so we send the buffer
immediately.
* We accumulate the text (or the command) in the buffer.

ASTERISK-27970

Change-Id: Ifbe993311410fa855cb8aa4a12084db75f413462
2018-07-26 13:58:11 -05:00
George Joseph 798f049e82 CI: Add docker info to job summary
Change-Id: I45d52005a9b692ad303c11792f226ace1e449901
2018-07-26 10:35:41 -06:00
Corey Farrell 7578881b3d Build System: Create 'make install-configs' target.
This target requires specifying CONFIG_SRC=path_to_configs.  This can be
used to install custom configs for the Asterisk build while still
performing directory replacements on asterisk.conf.

Modify internal INSTALL_CONFIGS so first argument requires full path to
the config sources relative to Asterisk source root.

Change-Id: Idcd841df3c8d5bfe23d566bb9e2e448e9df4f8ab
2018-07-26 10:19:25 -05:00
Kevin Harwell 8ea13d62cd json.c: improve ast_json_to_ast_variables performance
When converting from a json object to an ast variables list the conversion
algorithm was doing a complete traversal of the entire variables list for
every item appended from the json structure.

This patch makes it so the list is no longer traversed for each new ast
variable being appended.

Change-Id: I8bf496a1fc449485150d6db36bfc0354934a3977
2018-07-25 15:37:08 -05:00
Joshua Colp e5c0ac6a64 devicestate: Don't create topic when change isn't cached.
When publishing a device state the change can be marked as being
cachable or not. If it is not cached the change is just published
to all interested and not stored away for later query. This was not
fully taken into account when publishing in stasis. The act of
publishing would create a topic for the device even if it may be
ephemeral.

This change makes it so messages which are not cached won't create
a topic for the device. If a topic does already exist it will be
published to but otherwise the change will only be published to
the device state all topic.

ASTERISK-27591

Change-Id: I18da0e8cbb18e79602e731020c46ba4101e59f0a
2018-07-25 14:20:57 -05:00
George Joseph 4a51f2792e Merge "Build System: Silence build of bundled jansson." into 16 2018-07-25 13:59:43 -05:00
Joshua Colp 84b5245476 Merge "res_pjsip: Change log message from error to warning for valid use cases" into 16 2018-07-25 13:59:13 -05:00
Jenkins2 166aa49664 Merge "CI: Explicitly pass BRANCH_NAME to buildAsterisk and installAsterisk" into 16 2018-07-25 12:48:53 -05:00
Jenkins2 6e2ce299c3 Merge "CI: Add options to initialize and cleanup database to runTestsuite.sh" into 16 2018-07-25 12:48:19 -05:00
George Joseph 93997f9698 CI: Explicitly pass BRANCH_NAME to buildAsterisk and installAsterisk
Change-Id: I652f4a0ea5107c778e27a78bccb67b18b0c4e087
2018-07-25 09:21:19 -06:00
George Joseph 0baf660bde CI: Add options to initialize and cleanup database to runTestsuite.sh
Change-Id: I352333233bab5377723bf37d490ba84fc55bc853
2018-07-25 09:12:59 -06:00
Corey Farrell 74cbeabb97 CI: Do not `mkdir 2`.
Change-Id: Ib7377d26a6c98b38bad463f47c84f1875ac84eb7
2018-07-25 10:07:51 -04:00
Corey Farrell adf3c569a2 Build System: Silence build of bundled jansson.
Change-Id: I7392c79c0173057f5378010bf1fe65e300e8fc56
2018-07-25 08:34:54 -04:00
George Joseph e4b0f09bcc CI: RefDebug: Fix reference to testsuite URL
Change-Id: I0ee41d95a87f0d97b01f2757012b846bcfe6443d
2018-07-25 06:14:35 -06:00
Corey Farrell 5537048d60 Build System: Fix bundled jansson install.
Update the bundled jansson Makefile to do nothing during Asterisk
install, use a target that is not phony to initiate the jansson make and
install.

Change-Id: I7643cc3d39af9feba8fc0da676b646efc5f8b3bb
2018-07-24 15:28:04 -04:00
Jenkins2 18a074e540 Merge "CI: Use bundled jansson if needed." into 16 2018-07-24 10:51:24 -05:00
George Joseph cecff1f7ab Merge "Enable bundling of jansson, require 2.11." into 16 2018-07-24 10:50:41 -05:00
Corey Farrell 9f3620a578 CI: Use bundled jansson if needed.
Use pkg-config to determine if jansson is at least 2.11, enabled bundled
version otherwise.

Change-Id: Ib555a8b72ff6f6925f9280ef035caa0b91ca4bd2
2018-07-24 10:47:43 -05:00
George Joseph 835489f76d Merge "res_pjsip: Update default keepalive interval to 90 seconds." into 16 2018-07-24 08:30:34 -05:00
Florian Floimair 1f46e2e91c res_pjsip: Change log message from error to warning for valid use cases
If a SIP MESSAGE is triggered for an endpoint that is currently not registered
- and therefore has no valid contact associated - an error message was logged.
Since this is a valid request in a valid use cases this is now changed to a
warning, as discussed with Matt Fredrickson on the asterisk-dev mailing list.

Change-Id: I55eb62d2712818a58c7532119dec288bd98cf0c0
2018-07-24 07:20:06 -05:00
Jenkins2 b9630a9591 Merge "CI: Add --privileged flag to docker options" into 16 2018-07-24 06:03:02 -05:00
Jenkins2 9913a4fcca Merge "CI: Set correct user:group when publishing docs" into 16 2018-07-24 06:02:59 -05:00
George Joseph 393428be7b Merge "build_tools/make_version: Get MAINLINE_BRANCH from .gitreview." into 16 2018-07-24 05:40:41 -05:00
George Joseph 8550fad21a CI: Add --privileged flag to docker options
Change-Id: If92d55f15306e55dd7091ac3c47b13ebbbb03488
2018-07-24 04:40:31 -06:00
George Joseph f2580d037f CI: Set correct user:group when publishing docs
Change-Id: Ibabeb9ac730d9755cf54318d0da74771c939b86b
2018-07-24 04:32:03 -06:00
Richard Mudgett 35d06e46ae core: AST_DEVMODE no longer affects ABI.
Remove AST_DEVMODE from the AST_BUILDOPTS list and the AST_BUILDOPTS_SUM
calculation as it no longer affects API/ABI compatibility.

Change-Id: Id5bd6dfade173a53b3a49f715586b86e3fb24acb
2018-07-23 13:48:18 -05:00
Jenkins2 fb6af6dbd2 Merge "CI: Split --test-command argument." into 16 2018-07-23 13:45:21 -05:00
George Joseph 03b1078117 Merge "sched: Make ABI compatible between dev mode and non-dev mode." into 16 2018-07-23 13:32:24 -05:00
Corey Farrell 09b258fd69 CI: Split --test-command argument.
The --test-command argument has now been split, unit tests now use
`--unittest-command` and the testsuite uses --testsuite-command.

This will make it easier to create a script which run everything by
forwarding the same arguments to all CI scripts.

Change-Id: Ia54aa4848eaffbdf13175fcda40fc0b23080ad71
2018-07-23 10:34:35 -05:00
George Joseph 648541fe89 Merge "asterisk.c: Update displayed copyright year for v16 release." into 16 2018-07-23 09:40:28 -05:00
George Joseph ebbc29f9f5 Merge "res_pjsip: Update endpoint transport option documentation." into 16 2018-07-23 09:15:39 -05:00
Jenkins2 bd879a6c28 Merge "CI: Fix mkdir CACHE_DIR." into 16 2018-07-23 08:39:12 -05:00
Jenkins2 549aa07265 Merge "CI: Fix logger.conf for unit tests." into 16 2018-07-23 08:37:31 -05:00
George Joseph 460ef41f7a xmldoc.c: Fix dump of xml document
The "xmldoc dump" cli command was simply concatenating xml documents
into the output file.  The resulting file had multiple "xml"
processing instructions and multiple root elements which is illegal.
Normally this isn't an issue because Asterisk has only 1 main xml
documentation file but codec_opus has its own file so if it's
downloaded and you do "xmldoc dump", the result is invalid.

* Added 2 new functions to xml.c:
    ast_xml_copy_node_list creates a copy of a list of children.
    ast_xml_add_child_list adds a list to an existing list.

* Modified handle_dump_docs to create a new output document and
  add to it the children from each input file.  It then dumps the
  new document to the output file.

Change-Id: I3f182d38c75776aee76413dadd2d489d54a85c07
2018-07-23 06:47:31 -05:00
Jenkins2 4f1953da7e Merge "CI: Add wiki doc publish to periodics" into 16 2018-07-23 06:46:53 -05:00
Corey Farrell fd1f74af40 CI: Fix mkdir CACHE_DIR.
Change-Id: Ic9f9a61e230047836c836206731f8ff7eb3538c9
2018-07-22 12:35:42 -04:00
Corey Farrell 9b3267641f build_tools/make_version: Get MAINLINE_BRANCH from .gitreview.
Use .gitreview defaultbranch setting to determine the mainline branch.
This allows the script to be used against other directories which might
not be on the same defaultbranch.  This can be used by CI scripts to
report the testsuite version being used:
./build_tools/make_version ${TESTSUITE_DIR}

Change-Id: Ifdad4a9d8a26138c41bc6b630ecc3e34ea1c2758
2018-07-22 12:21:05 -04:00
Joshua Colp 0f999a834f sched: Make ABI compatible between dev mode and non-dev mode.
In the past there was an assertion in the ast_sched_del function
and in order to ensure it was useful the calling function name,
line number, and filename had to be passed in. This cause the ABI
to be different between dev mode and non-dev mode.

This assertion is no longer present so the special logic can be
removed to make it the same between them both.

Change-Id: Icbc69c801e357d7004efc5cf2ab936d9b83b6ab8
2018-07-22 10:46:21 -05:00
Richard Mudgett aea0a0294d asterisk.c: Update displayed copyright year for v16 release.
Change-Id: I60622731d928ee9506b1d28934095f0dc3e5306e
2018-07-20 15:52:12 -05:00
Kevin Harwell a459b560c5 Merge "pjsip_resolver.c: Use replacement function" into 16 2018-07-20 14:43:49 -05:00
Corey Farrell d2dace81d4 Enable bundling of jansson, require 2.11.
Change-Id: Ib3111b151d37cbda40768cf2a8a9c6cf6c5c7cbd
2018-07-20 13:35:57 -04:00
Corey Farrell c8bd8f6ce9 CI: Fix logger.conf for unit tests.
Change-Id: Idea59d60eab20105de50b34f0f0d506e6ef55d5c
2018-07-20 09:30:00 -05:00
George Joseph 0f82db82cb CI: Add wiki doc publish to periodics
Change-Id: I29ba26134e5083bc6788ede235f1a5d4383c148a
2018-07-20 06:55:42 -06:00
Joshua Colp a2a3ad2438 res_pjsip: Update default keepalive interval to 90 seconds.
A change recently went in which disabled the built-in PJSIP
keepalive. This defaulted to 90 seconds and kept TCP/TLS
connections alive. Disabling this functionality has resulted
in a behavior change of not doing keepalives by default resulting
in TCP/TLS connections dropping for some people.

This change makes our default keepalive interval 90 seconds
to match the previous behavior and preserve it.

ASTERISK-27978

Change-Id: Ibd9a45f3cbe5d9bb6d2161268696645ff781b1d6
2018-07-20 06:55:37 -05:00
Richard Mudgett dbffcdc561 res_pjsip: Update endpoint transport option documentation.
Change-Id: I5394fdff6a296efc8e1695a156e616acd932ae52
2018-07-19 16:40:13 -05:00
Richard Mudgett 709b795cb0 pjsip_resolver.c: Use replacement function
* Use the replacement function ast_sip_push_task_wait_servant() instead of
the deprecated ast_sip_push_task_synchronous().

Change-Id: I145b550ba7054640c7faa3b644e63137f505c612
2018-07-19 13:54:20 -05:00
Corey Farrell c40412bd13 contrib: Update systemd README.txt.
Mention need to compile Asterisk with systemd development package
installed.

ASTERISK-27968

Change-Id: Ib3a973be403c61cbe09572b0f912fb1aa1bff026
2018-07-19 09:52:35 -05:00
George Joseph 0353c34c61 Merge "Update mainline version for the 16 branch." into 16 2018-07-19 06:14:27 -05:00
Joshua Colp 0b3bc4852f Update mainline version for the 16 branch.
Change-Id: I4d36277d10335349d83ae218fa10fee99c3e4c14
2018-07-19 11:09:53 +00:00
1097 changed files with 93581 additions and 29623 deletions

87
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,87 @@
name: Bug
description: File a bug report
title: "[bug]: "
labels: ["bug", "triage"]
#assignees:
# - octocat
body:
- type: markdown
attributes:
value: |
Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.
A good first step is for you to review the Asterisk Issue Guidelines if you haven't already. The guidelines detail what is expected from an Asterisk issue report.
Then, if you are submitting a patch, please review the Patch Contribution Process.
Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.
Please note that by submitting data, code, or documentation to Sangoma through GitHub, you accept the Terms of Use present at
https://www.asterisk.org/terms-of-use/.
Thanks for taking the time to fill out this bug report!
- type: dropdown
id: severity
attributes:
label: Severity
options:
- Trivial
- Minor
- Major
- Critical
- Blocker
validations:
required: true
- type: input
id: versions
attributes:
label: Versions
description: Enter one or more versions separated by commas.
validations:
required: true
- type: input
id: components
attributes:
label: Components/Modules
description: Enter one or more components or modules separated by commas.
validations:
required: true
- type: textarea
id: environment
attributes:
label: Operating Environment
description: OS, Disribution, Version, etc.
validations:
required: true
- type: dropdown
id: frequency
attributes:
label: Frequency of Occurrence
options:
- "Never"
- "One Time"
- "Occasional"
- "Frequent"
- "Constant"
- type: textarea
id: description
attributes:
label: Issue Description
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: markdown
attributes:
value: |
[Asterisk Issue Guidelines](https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines)
- type: checkboxes
id: guidelines
attributes:
label: Asterisk Issue Guidelines
options:
- label: Yes, I have read the Asterisk Issue Guidelines
required: true

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Asterisk Community Support
url: https://community.asterisk.org
about: Please ask and answer questions here.
- name: Feature Requests
url: https://github.com/asterisk/asterisk-feature-requests/issues
about: Please submit feature requests here.

27
.github/ISSUE_TEMPLATE/improvement.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Improvement
description: Submit an improvement to existing functionality
title: "[improvement]: "
labels: ["improvement", "triage"]
body:
- type: markdown
attributes:
value: |
Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.
A good first step is for you to review the Asterisk Issue Guidelines if you haven't already. The guidelines detail what is expected from an Asterisk issue report.
Then, if you are submitting a patch, please review the Patch Contribution Process.
Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.
Please note that by submitting data, code, or documentation to Sangoma through GitHub, you accept the Terms of Use present at
https://www.asterisk.org/terms-of-use/.
Thanks for taking the time to fill out this bug report!
- type: textarea
id: description
attributes:
label: Improvement Description
description: Describe the improvement in as much detail as possible
validations:
required: true

27
.github/ISSUE_TEMPLATE/new-feature.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: New Feature Submission
description: Submit a New Feature
title: "[new-feature]: "
labels: ["new-feature", "triage"]
body:
- type: markdown
attributes:
value: |
Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.
A good first step is for you to review the Asterisk Issue Guidelines if you haven't already. The guidelines detail what is expected from an Asterisk issue report.
Then, if you are submitting a patch, please review the Patch Contribution Process.
Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.
Please note that by submitting data, code, or documentation to Sangoma through GitHub, you accept the Terms of Use present at
https://www.asterisk.org/terms-of-use/.
Thanks for taking the time to fill out this bug report!
- type: textarea
id: description
attributes:
label: Feature Description
description: Describe the new feature in as much detail as possible
validations:
required: true

167
.github/workflows/CherryPickTest.yml vendored Normal file
View File

@ -0,0 +1,167 @@
name: CherryPickTest
run-name: "Cherry-Pick Tests for PR ${{github.event.number}}"
on:
pull_request_target:
types: [ labeled ]
concurrency:
group: ${{github.workflow}}-${{github.event.number}}
cancel-in-progress: true
env:
PR_NUMBER: ${{ github.event.number }}
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }} ${{ vars.UNITTEST_MODULES_BLACKLIST }}
jobs:
IdentifyBranches:
name: IdentifyBranches
if: ${{ github.event.label.name == vars.CHERRY_PICK_TEST_LABEL }}
outputs:
branches: ${{ steps.getbranches.outputs.branches }}
branch_count: ${{ steps.getbranches.outputs.branch_count }}
runs-on: ubuntu-latest
steps:
- name: Remove Trigger Label, Add InProgress Label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.CHERRY_PICK_TEST_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}} \
--remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \
${{env.PR_NUMBER}} || :
- 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: Check Branch Count
if: ${{ steps.getbranches.outputs.branch_count > 0 }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \
${{env.PR_NUMBER}} || :
CherryPickUnitTestMatrix:
needs: [ IdentifyBranches ]
if: ${{ needs.IdentifyBranches.outputs.branch_count > 0 && ( success() || failure() ) }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.IdentifyBranches.outputs.branches) }}
runs-on: ubuntu-latest
steps:
- name: Run Unit Tests for branch ${{matrix.branch}}
uses: asterisk/asterisk-ci-actions/AsteriskUnitComposite@main
with:
asterisk_repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{matrix.branch}}
is_cherry_pick: true
modules_blacklist: ${{env.MODULES_BLACKLIST}}
github_token: ${{secrets.GITHUB_TOKEN}}
unittest_command: ${{vars.UNITTEST_COMMAND}}
CherryPickUnitTests:
needs: [ IdentifyBranches, CherryPickUnitTestMatrix ]
if: ${{ needs.IdentifyBranches.outputs.branch_count > 0 && ( success() || failure() ) }}
runs-on: ubuntu-latest
steps:
- name: Check unit test matrix status
env:
RESULT: ${{needs.CherryPickUnitTestMatrix.result}}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
case $RESULT in
success)
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.CHERRY_PICK_CHECKS_PASSED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::notice::All tests passed"
exit 0
;;
skipped)
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \
--add-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::notice::Unit tests were skipped because of an earlier failure"
exit 1
;;
*)
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \
--add-label ${{vars.CHERRY_PICK_CHECKS_FAILED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::error::One or more tests failed ($RESULT)"
exit 1
esac
CherryPickGateTestMatrix:
needs: [ IdentifyBranches, CherryPickUnitTests ]
if: ${{ success() }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.IdentifyBranches.outputs.branches) }}
group: ${{ fromJSON(vars.GATETEST_LIST) }}
runs-on: ubuntu-latest
steps:
- name: Run Gate Tests for ${{ matrix.group }}-${{matrix.branch}}
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
with:
test_type: Gate
asterisk_repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{matrix.branch}}
is_cherry_pick: true
modules_blacklist: ${{env.MODULES_BLACKLIST}}
github_token: ${{secrets.GITHUB_TOKEN}}
testsuite_repo: ${{vars.TESTSUITE_REPO}}
gatetest_group: ${{matrix.group}}
gatetest_commands: ${{vars.GATETEST_COMMANDS}}
CherryPickGateTests:
needs: [ IdentifyBranches, CherryPickGateTestMatrix ]
if: ${{ success() || failure() }}
runs-on: ubuntu-latest
steps:
- name: Check test matrix status
env:
RESULT: ${{needs.CherryPickGateTestMatrix.result}}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.CHERRY_PICK_TESTING_IN_PROGRESS}} \
${{env.PR_NUMBER}} || :
case $RESULT in
success)
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.CHERRY_PICK_GATES_PASSED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::notice::All Testsuite tests passed"
exit 0
;;
skipped)
echo "::error::Testsuite tests were skipped because of an earlier failure"
exit 1
;;
*)
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.CHERRY_PICK_GATES_FAILED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::error::One or more Testsuite tests failed ($RESULT)"
exit 1
esac

123
.github/workflows/CreateDocs.yml vendored Normal file
View File

@ -0,0 +1,123 @@
name: CreateDocs
on:
workflow_dispatch:
inputs:
branches:
description: "JSON array of branches: ['18','20'] (no spaces)"
required: false
type: string
schedule:
# Times are UTC
- cron: '0 04 * * *'
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-inputs: ${{toJSON(inputs)}}
action-vars: ${{ toJSON(steps.setup.outputs) }}
CreateDocsScheduledMatrix:
needs: [ CreateDocsDebug ]
if: ${{github.event_name == 'schedule' && fromJSON(vars.WIKIDOCS_ENABLE) == true }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(vars.WIKIDOC_BRANCHES) }}
runs-on: ubuntu-latest
steps:
- name: CreateDocs for ${{matrix.branch}}
uses: asterisk/asterisk-ci-actions/CreateAsteriskDocsComposite@main
with:
asterisk_repo: ${{env.ASTERISK_REPO}}
base_branch: ${{matrix.branch}}
docs_dir: docs_dir/${{matrix.branch}}
github_token: ${{secrets.GITHUB_TOKEN}}
CreateDocsScheduled:
needs: [ CreateDocsScheduledMatrix ]
if: ${{ success() || failure() }}
runs-on: ubuntu-latest
steps:
- name: Check CreateDocsScheduledMatrix status
env:
RESULT: ${{needs.CreateDocsScheduledMatrix.result}}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
case $RESULT in
success)
echo "::notice::Docs created"
exit 0
;;
skipped)
echo "::notice::Skipped"
exit 1
;;
*)
echo "::error::One or CreateDocs failed ($RESULT)"
exit 1
esac
CreateDocsManualMatrix:
needs: [ CreateDocsDebug ]
if: ${{github.event_name == 'workflow_dispatch'}}
continue-on-error: false
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(vars.WIKIDOC_MANUAL_BRANCHES) }}
runs-on: ubuntu-latest
steps:
- name: CreateDocs for ${{matrix.branch}}
uses: asterisk/asterisk-ci-actions/CreateAsteriskDocsComposite@main
with:
asterisk_repo: ${{env.ASTERISK_REPO}}
base_branch: ${{matrix.branch}}
docs_dir: docs_dir/${{matrix.branch}}
github_token: ${{secrets.GITHUB_TOKEN}}
CreateDocsManual:
needs: [ CreateDocsManualMatrix ]
if: ${{ success() || failure() }}
runs-on: ubuntu-latest
steps:
- name: Check CreateDocsManualMatrix status
env:
RESULT: ${{needs.CreateDocsManualMatrix.result}}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
case $RESULT in
success)
echo "::notice::Docs created"
exit 0
;;
skipped)
echo "::notice::Skipped"
exit 1
;;
*)
echo "::error::One or CreateDocs failed ($RESULT)"
exit 1
esac

15
.github/workflows/IssueOpened.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: Issue Opened
run-name: "Issue ${{github.event.number}} ${{github.event.action}} by ${{github.actor}}"
on:
issues:
types: opened
jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: initial labeling
uses: andymckay/labeler@master
with:
add-labels: "triage"
ignore-if-labeled: true

190
.github/workflows/MergeApproved.yml vendored Normal file
View File

@ -0,0 +1,190 @@
name: MergeApproved
run-name: "Merge Approved for PR ${{github.event.number}}"
on:
pull_request_target:
types: [labeled]
env:
PR_NUMBER: ${{ github.event.number }}
BASE_BRANCH: ${{github.event.pull_request.base.ref}}
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }} ${{ vars.UNITTEST_MODULES_BLACKLIST }}
FORCE: ${{ endsWith(github.event.label.name, '-force') }}
jobs:
IdentifyBranches:
if: contains(fromJSON(vars.MERGE_APPROVED_LABELS), github.event.label.name)
outputs:
branches: ${{ steps.getbranches.outputs.branches }}
all_branches: ${{ steps.checkbranches.outputs.all_branches }}
branch_count: ${{ steps.getbranches.outputs.branch_count }}
runs-on: ubuntu-latest
steps:
- name: Clean up labels
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--remove-label ${{github.event.label.name}} \
--remove-label ${{vars.PRE_MERGE_CHECKS_PASSED_LABEL}} \
--remove-label ${{vars.PRE_MERGE_CHECKS_FAILED_LABEL}} \
--remove-label ${{vars.PRE_MERGE_GATES_PASSED_LABEL}} \
--remove-label ${{vars.PRE_MERGE_GATES_FAILED_LABEL}} \
--remove-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \
${{env.PR_NUMBER}} || :
- 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: Check Branch Count
id: checkbranches
env:
BRANCH_COUNT: ${{ steps.getbranches.outputs.branch_count }}
BRANCHES: ${{ steps.getbranches.outputs.branches }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \
${{env.PR_NUMBER}} || :
all_branches=$(echo "$BRANCHES" | jq -c "[ \"$BASE_BRANCH\" ] + .")
echo "all_branches=${all_branches}" >>${GITHUB_OUTPUT}
- name: Pre Check Cherry-Picks
if: ${{ steps.getbranches.outputs.branch_count > 0 }}
uses: asterisk/asterisk-ci-actions/CherryPick@main
with:
repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
branches: ${{steps.getbranches.outputs.branches}}
github_token: ${{secrets.GITHUB_TOKEN}}
push: false
PreMergeUnitTestMatrix:
needs: [ IdentifyBranches ]
if: success()
continue-on-error: false
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(needs.IdentifyBranches.outputs.all_branches) }}
runs-on: ubuntu-latest
steps:
- name: Run Unit Tests for branch ${{matrix.branch}}
uses: asterisk/asterisk-ci-actions/AsteriskUnitComposite@main
with:
asterisk_repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{matrix.branch}}
is_cherry_pick: true
modules_blacklist: ${{env.MODULES_BLACKLIST}}
github_token: ${{secrets.GITHUB_TOKEN}}
unittest_command: ${{vars.UNITTEST_COMMAND}}
PreMergeUnitTests:
needs: [ IdentifyBranches, PreMergeUnitTestMatrix ]
runs-on: ubuntu-latest
steps:
- name: Check unit test matrix status
env:
RESULT: ${{needs.PreMergeUnitTestMatrix.result}}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
case $RESULT in
success)
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \
--add-label ${{vars.PRE_MERGE_CHECKS_PASSED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::notice::All tests passed"
exit 0
;;
skipped)
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \
--add-label ${{vars.PRE_MERGE_CHECKS_FAILED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::notice::Unit tests were skipped because of an earlier failure"
exit 1
;;
*)
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.PRE_MERGE_TESTING_IN_PROGRESS}} \
--add-label ${{vars.PRE_MERGE_CHECKS_FAILED_LABEL}} \
${{env.PR_NUMBER}} || :
echo "::error::One or more tests failed ($RESULT)"
exit 1
esac
MergeAndCherryPick:
needs: [ IdentifyBranches, PreMergeUnitTests ]
if: success()
concurrency:
group: MergeAndCherryPick
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Start Merge
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --repo ${{github.repository}} \
--add-label ${{vars.MERGE_IN_PROGRESS_LABEL}} \
${{env.PR_NUMBER}} || :
- name: Get Token needed to push cherry-picks
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: Merge and Cherry Pick to ${{needs.IdentifyBranches.outputs.branches}}
id: mergecp
uses: asterisk/asterisk-ci-actions/MergeAndCherryPickComposite@main
with:
repo: ${{github.repository}}
pr_number: ${{env.PR_NUMBER}}
branches: ${{needs.IdentifyBranches.outputs.branches}}
force: ${{env.FORCE}}
github_token: ${{steps.get_workflow_token.outputs.token}}
- name: Merge Cleanup
if: always()
env:
RESULT: ${{ steps.mergecp.outcome }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_COUNT: ${{ needs.IdentifyBranches.outputs.branch_count }}
BRANCHES: ${{ needs.IdentifyBranches.outputs.branches }}
run: |
case $RESULT in
success)
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.MERGE_IN_PROGRESS_LABEL}} \
${{env.PR_NUMBER}} || :
if [ $BRANCH_COUNT -eq 0 ] ; then
gh pr comment --repo ${{github.repository}} \
-b "Successfully merged to branch $BASE_BRANCH." \
${{env.PR_NUMBER}} || :
else
gh pr comment --repo ${{github.repository}} \
-b "Successfully merged to branch $BASE_BRANCH and cherry-picked to $BRANCHES" \
${{env.PR_NUMBER}} || :
fi
exit 0
;;
failure)
gh pr edit --repo ${{github.repository}} \
--remove-label ${{vars.MERGE_IN_PROGRESS_LABEL}} \
--add-label ${{vars.MERGE_FAILED_LABEL}} \
${{env.PR_NUMBER}} || :
exit 1
;;
*)
esac

28
.github/workflows/NightlyAdmin.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Nightly Admin
on:
schedule:
- cron: '30 1 * * *'
env:
ASTERISK_REPO: ${{ github.repository }}
PR_NUMBER: 0
PR_COMMIT: ''
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }} ${{ vars.UNITTEST_MODULES_BLACKLIST }}
jobs:
CloseStaleIssues:
runs-on: ubuntu-latest
steps:
- name: Close Stale Issues
uses: actions/stale@v7
with:
stale-issue-message: 'This issue is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 14 days.'
stale-issue-label: stale
close-issue-message: 'This issue was closed because it has been stalled for 14 days with no activity.'
days-before-stale: 7
days-before-close: 14
days-before-pr-close: -1
only-labels: triage,feedback-required

59
.github/workflows/NightlyTests.yml vendored Normal file
View File

@ -0,0 +1,59 @@
name: NightlyTests
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
env:
ASTERISK_REPO: ${{ github.repository }}
PR_NUMBER: 0
PR_COMMIT: ''
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODULES_BLACKLIST: ${{ vars.GATETEST_MODULES_BLACKLIST }}
jobs:
AsteriskNightly:
strategy:
fail-fast: false
matrix:
branch: ${{ fromJSON(vars.NIGHTLYTEST_BRANCHES) }}
group: ${{ fromJSON(vars.NIGHTLYTEST_LIST) }}
runs-on: ubuntu-latest
steps:
- name: Run Nightly Tests for ${{ matrix.group }}/${{ matrix.branch }}
uses: asterisk/asterisk-ci-actions/AsteriskGateComposite@main
with:
test_type: Nightly
asterisk_repo: ${{env.ASTERISK_REPO}}
pr_number: ${{env.PR_NUMBER}}
base_branch: ${{matrix.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}}
AsteriskNightlyTests:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: AsteriskNightly
steps:
- name: Check test matrix status
env:
RESULT: ${{needs.AsteriskNightly.result}}
run: |
case $RESULT in
success)
echo "::notice::All Testsuite tests passed"
exit 0
;;
skipped)
echo "::error::Testsuite tests were skipped because of an earlier failure"
exit 1
;;
*)
echo "::error::One or more Testsuite tests failed"
exit 1
esac

32
.github/workflows/PRMerged.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: PRMerged
run-name: "PR ${{github.event.number || inputs.pr_number}} ${{github.event.action || 'MANUAL POST MERGE'}} by ${{ github.actor }}"
on:
pull_request_target:
types: [closed]
workflow_dispatch:
inputs:
pr_number:
description: 'PR number'
required: true
type: number
concurrency:
group: ${{github.workflow}}-${{github.event.number || inputs.pr_number}}
cancel-in-progress: true
env:
REPO: ${{github.repository}}
PR_NUMBER: ${{github.event.number || inputs.pr_number}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
CloseIssues:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: wow-actions/auto-close-fixed-issues@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

172
.github/workflows/PROpenedOrUpdated.yml vendored Normal file
View File

@ -0,0 +1,172 @@
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: 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
if: ${{ steps.getbranches.outputs.branch_count == 0 || steps.getbranches.outputs.forced_none != 'true' }}
env:
GITHUB_TOKEN: ${{steps.get_workflow_token.outputs.token}}
GH_TOKEN: ${{steps.get_workflow_token.outputs.token}}
CHERRY_PICK_REMINDER: ${{vars.CHERRY_PICK_REMINDER}}
run: |
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

84
.github/workflows/Releaser.yml vendored Normal file
View File

@ -0,0 +1,84 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Releaser
run-name: ${{ github.actor }} is creating ${{vars.PRODUCT_NAME}} release ${{inputs.new_version}}
on:
workflow_dispatch:
inputs:
is_security:
description: |
Security or Hotfix?
required: true
type: boolean
default: false
new_version:
description: |
New Version:
Examples:
20.4.0-rc1, 20.4.0-rc2, 20.4.0, 20.4.1
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
push_release_branches:
description: |
Push release branches live?
required: true
type: boolean
default: false
create_github_release:
description: |
Create the GitHub release?
required: true
type: boolean
default: false
push_tarballs:
description: |
Push tarballs to downloads server?
required: true
type: boolean
default: false
send_email:
description: |
Send announcement emails?
required: true
type: boolean
default: false
jobs:
ReleaseAsterisk:
runs-on: ubuntu-latest
steps:
- name: Run Releaser
uses: asterisk/asterisk-ci-actions/ReleaserComposite@main
with:
product: ${{vars.PRODUCT_NAME}}
is_security: ${{inputs.is_security}}
new_version: ${{inputs.new_version}}
start_version: ${{inputs.start_version}}
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}}
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.DOWNLOADS_DEPLOY_SSH_PRIV_KEY}}
deploy_ssh_username: ${{secrets.DOWNLOADS_DEPLOY_SSH_USERNAME}}
deploy_host: ${{vars.DEPLOY_HOST}}
deploy_dir: ${{vars.DEPLOY_DIR}}

2
.gitignore vendored
View File

@ -37,4 +37,4 @@ doxygen.log
out/
*.orig
tests/CI/output
.develvars

View File

@ -1,5 +1,6 @@
[gerrit]
defaultbranch=master
defaultbranch=16
basebranch=16
#
# Intentional padding to ensure it is possible to point a commit
# to an alternative gerrit server/repository without breaking

1637
CHANGES

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
rewrite of SIP transfers
=== WISHLIST CONTRIBUTERS ===
=== WISHLIST CONTRIBUTORS ===
We'd like to thank the following for contributing to our wishlist

View File

@ -45,7 +45,7 @@ redistribution of Asterisk source code obtained from Digium, you
should contact our licensing department to determine the necessary
steps you must take. For more information on this policy, please read:
http://www.digium.com/en/company/profile/trademarkpolicy.php
https://www.sangoma.com/wp-content/uploads/Sangoma-Trademark-Policy.pdf
If you have any questions regarding our licensing policy, please
contact us:
@ -53,7 +53,6 @@ contact us:
+1.877.344.4861 (via telephone in the USA)
+1.256.428.6000 (via telephone outside the USA)
+1.256.864.0464 (via FAX inside or outside the USA)
IAX2/pbx.digium.com (via IAX2)
licensing@digium.com (via email)
Digium, Inc.

186
Makefile
View File

@ -21,7 +21,7 @@
# on a single object just for that object
# SOLINK - linker flags used only for creating dynamically loadable modules
# as .so files
# DYLINK - linker flags used only for creating shared libaries
# DYLINK - linker flags used only for creating shared libraries
# (.so files on Unix-type platforms, .dylib on Darwin)
#
# Values for ASTCFLAGS and ASTLDFLAGS can be specified in the
@ -49,6 +49,7 @@ DESTDIR?=$(INSTALL_PATH)
export DESTDIR
export INSTALL_PATH # Additional prefix for the following paths
export ASTCACHEDIR
export ASTETCDIR # Path for config files
export ASTVARRUNDIR
export ASTSPOOLDIR
@ -100,6 +101,11 @@ export TAR
export PATCH
export SED
export NM
export FIND
export BASENAME
export DIRNAME
export XMLLINT
export XMLSTARLET
# makeopts is required unless the goal is just {dist{-}}clean
ifeq ($(MAKECMDGOALS),clean)
@ -134,7 +140,7 @@ empty:=
space:=$(empty) $(empty)
ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
# Overwite config files on "make samples" or other config installation targets
# Overwrite config files on "make samples" or other config installation targets
OVERWRITE=y
# Include debug and macro symbols in the executables (-g) and profiling info (-pg)
@ -234,6 +240,10 @@ ifeq ($(OSARCH),OpenBSD)
_ASTCFLAGS+=-pthread -ftrampolines
endif
ifeq ($(OSARCH),linux-uclibc)
AST_LIBS+=-lpthread -ldl
endif
ifeq ($(OSARCH),SunOS)
_ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__
endif
@ -245,7 +255,7 @@ else
endif
ifneq ($(AWK),)
ifneq ($(wildcard .version),)
ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version)
ASTERISKVERSIONNUM:=$(shell $(SED) -e 's/^certified\///' -e 's/-cert/./' .version | $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}')
endif
endif
@ -317,6 +327,9 @@ else
SUBMAKE:=$(MAKE) --quiet --no-print-directory
endif
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
# $(MAKE) is printed in several places, and we want it to be a
# fixed size string. Define a variable whose name has also the
# same size, so we can easily align text.
@ -437,7 +450,7 @@ distclean: $(SUBDIRS_DIST_CLEAN) _clean
rm -f include/asterisk/autoconfig.h
rm -f include/asterisk/buildopts.h
rm -rf doc/api
rm -f doc/asterisk-ng-doxygen
rm -f doc/Doxyfile
rm -f build_tools/menuselect-deps
datafiles: _all $(CORE_XMLDOC)
@ -470,53 +483,24 @@ endif
$(INSTALL) -m 644 $$x "$(DESTDIR)$(ASTDATADIR)/rest-api" ; \
done
ifeq ($(GREP),)
else ifeq ($(GREP),:)
else
XML_core_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
endif
DOC_MOD_SUBDIRS := $(filter-out third-party,$(MOD_SUBDIRS))
XML_core_en_US := $(shell build_tools/make_xml_documentation --command=print_dependencies --source-tree=. --mod-subdirs="$(DOC_MOD_SUBDIRS)")
# core-en_US.xml is the normal documentation created with asterisk builds.
doc/core-en_US.xml: makeopts .lastclean $(XML_core_en_US)
@printf "Building Documentation For: "
@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
@echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@echo "<?xml-stylesheet type=\"text/xsl\" href=\"appdocsxml.xslt\"?>" >> $@
@echo "<docs xmlns:xi=\"http://www.w3.org/2001/XInclude\">" >> $@
@for x in $(MOD_SUBDIRS); do \
printf "$$x " ; \
for i in `find $$x -name '*.c'`; do \
$(AWK) -f build_tools/get_documentation $$i >> $@ ; \
done ; \
done
@echo
@echo "</docs>" >> $@
@build_tools/make_xml_documentation --command=create_xml --source-tree=. --mod-subdirs="$(DOC_MOD_SUBDIRS)" \
--with-moduleinfo --output-file=$@
ifeq ($(GREP),)
else ifeq ($(GREP),:)
else
XML_full_en_US = $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
endif
doc/full-en_US.xml: makeopts .lastclean $(XML_full_en_US)
# The full-en_US.xml target is only called by the wiki documentation generation process
# and does special post-processing in preparation for uploading to the wiki.
# It creates full-en_US.xml but then re-creates core-en_US.xml as well.
doc/full-en_US.xml: makeopts .lastclean $(XML_core_en_US)
ifeq ($(PYTHON),:)
@echo "--------------------------------------------------------------------------"
@echo "--- Please install python to build full documentation ---"
@echo "--------------------------------------------------------------------------"
else
@printf "Building Documentation For: "
@echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
@echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@echo "<?xml-stylesheet type=\"text/xsl\" href=\"appdocsxml.xslt\"?>" >> $@
@echo "<docs xmlns:xi=\"http://www.w3.org/2001/XInclude\">" >> $@
@for x in $(filter-out third-party,$(MOD_SUBDIRS)); do \
printf "$$x " ; \
for i in `find $$x -name '*.c'`; do \
$(PYTHON) build_tools/get_documentation.py < $$i >> $@ ; \
done ; \
done
@echo
@echo "</docs>" >> $@
@$(PYTHON) build_tools/post_process_documentation.py -i $@ -o "doc/core-en_US.xml"
@build_tools/make_xml_documentation --command=create_xml --source-tree=. --mod-subdirs="$(DOC_MOD_SUBDIRS)" \
--for-wiki --output-file=$@ --core-output-file=./doc/core-en_US.xml
endif
validate-docs: doc/core-en_US.xml
@ -551,18 +535,17 @@ update:
NEWHEADERS=$(notdir $(wildcard include/asterisk/*.h))
OLDHEADERS=$(filter-out $(NEWHEADERS) $(notdir $(DESTDIR)$(ASTHEADERDIR)),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTETCDIR)" "$(ASTVARRUNDIR)" \
INSTALLDIRS="$(ASTLIBDIR)" "$(ASTMODDIR)" "$(ASTSBINDIR)" "$(ASTCACHEDIR)" "$(ASTETCDIR)" "$(ASTVARRUNDIR)" \
"$(ASTSPOOLDIR)" "$(ASTSPOOLDIR)/dictate" "$(ASTSPOOLDIR)/meetme" \
"$(ASTSPOOLDIR)/monitor" "$(ASTSPOOLDIR)/system" "$(ASTSPOOLDIR)/tmp" \
"$(ASTSPOOLDIR)/voicemail" "$(ASTSPOOLDIR)/recording" \
"$(ASTHEADERDIR)" "$(ASTHEADERDIR)/doxygen" \
"$(ASTLOGDIR)" "$(ASTLOGDIR)/cdr-csv" "$(ASTLOGDIR)/cdr-custom" \
"$(ASTLOGDIR)/cel-custom" "$(ASTDATADIR)" "$(ASTDATADIR)/documentation" \
"$(ASTDATADIR)/documentation/thirdparty" "$(ASTDATADIR)/firmware" \
"$(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)/third-party" "${ASTDATADIR}/keys/stir_shaken"
installdirs:
@for i in $(INSTALLDIRS); do \
@ -574,19 +557,13 @@ installdirs:
main-bininstall:
+@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main bininstall
bininstall: _all installdirs $(SUBDIRS_INSTALL) main-bininstall
bininstall: _all installdirs $(SUBDIRS_INSTALL) main-bininstall install-headers
$(INSTALL) -m 755 contrib/scripts/astversion "$(DESTDIR)$(ASTSBINDIR)/"
$(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
$(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
if [ ! -f /sbin/launchd ]; then \
./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk"; \
fi
$(INSTALL) -m 644 include/asterisk.h "$(DESTDIR)$(includedir)"
$(INSTALL) -m 644 include/asterisk/*.h "$(DESTDIR)$(ASTHEADERDIR)"
$(INSTALL) -m 644 include/asterisk/doxygen/*.h "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
if [ -n "$(OLDHEADERS)" ]; then \
for h in $(OLDHEADERS); do rm -f "$(DESTDIR)$(ASTHEADERDIR)/$$h"; done \
fi
ifneq ($(HAVE_SBIN_LAUNCHD),1)
./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk";
endif
ifneq ($(DISABLE_XMLDOC),yes)
$(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
@ -719,7 +696,17 @@ ifneq ($(filter ~%,$(DESTDIR)),)
@exit 1
endif
install: badshell bininstall datafiles
versioncheck:
ifeq ($(ASTERISKVERSION),UNKNOWN__git_check_fail)
@echo "Asterisk Version is unknown due to a git error. If you are running make"
@echo "as a different user than the project owner, this can be resolved by"
@echo "running the following command as the user currently executing make: "$$USER
@echo "git config --global --add safe.directory "$(mkfile_dir:/=)
@exit 1
endif
install: badshell versioncheck bininstall datafiles
@if [ -x /usr/sbin/asterisk-post-install ]; then \
/usr/sbin/asterisk-post-install "$(DESTDIR)" . ; \
fi
@ -763,7 +750,7 @@ upgrade: bininstall
# (1) the configuration directory to install from
# (2) the extension to strip off
define INSTALL_CONFIGS
@for x in configs/$(1)/*$(2); do \
@for x in $(1)/*$(2); do \
dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x $(2)`"; \
if [ -f "$${dst}" ]; then \
if [ "$(OVERWRITE)" = "y" ]; then \
@ -782,7 +769,8 @@ define INSTALL_CONFIGS
done ; \
if [ "$(OVERWRITE)" = "y" ]; then \
echo "Updating asterisk.conf" ; \
sed -e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \
sed -e 's|^astcachedir.*$$|astcachedir => $(ASTCACHEDIR)|' \
-e 's|^astetcdir.*$$|astetcdir => $(ASTETCDIR)|' \
-e 's|^astmoddir.*$$|astmoddir => $(ASTMODDIR)|' \
-e 's|^astvarlibdir.*$$|astvarlibdir => $(ASTVARLIBDIR)|' \
-e 's|^astdbdir.*$$|astdbdir => $(ASTDBDIR)|' \
@ -799,6 +787,24 @@ define INSTALL_CONFIGS
fi
endef
install-headers:
# Will create all components of "$(DESTDIR)$(ASTHEADERDIR)/doxygen" including "$(DESTDIR)$(includedir)"
$(INSTALL) -d "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
$(INSTALL) -m 644 include/asterisk.h "$(DESTDIR)$(includedir)"
$(INSTALL) -m 644 include/asterisk/*.h "$(DESTDIR)$(ASTHEADERDIR)"
$(INSTALL) -m 644 include/asterisk/doxygen/*.h "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
if [ -n "$(OLDHEADERS)" ]; then \
for h in $(OLDHEADERS); do rm -f "$(DESTDIR)$(ASTHEADERDIR)/$$h"; done \
fi
install-configs:
@if test -z "$(CONFIG_SRC)" -o ! -d "$(CONFIG_SRC)"; then \
>&2 echo "CONFIG_SRC must be set to a directory."; \
exit 1; \
fi
@echo "Installing config files from $(CONFIG_SRC)/*$(CONFIG_EXTEN)"
$(call INSTALL_CONFIGS,$(CONFIG_SRC),$(CONFIG_EXTEN))
# XXX why *.adsi is installed first ?
adsi:
@echo Installing adsi config files...
@ -815,7 +821,7 @@ adsi:
samples: adsi
@echo Installing other config files...
$(call INSTALL_CONFIGS,samples,.sample)
$(call INSTALL_CONFIGS,configs/samples,.sample)
$(INSTALL) -d "$(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX"
build_tools/make_sample_voicemail "$(DESTDIR)/$(ASTDATADIR)" "$(DESTDIR)/$(ASTSPOOLDIR)"
@for x in phoneprov/*; do \
@ -838,7 +844,7 @@ samples: adsi
basic-pbx:
@echo Installing basic-pbx config files...
$(call INSTALL_CONFIGS,basic-pbx)
$(call INSTALL_CONFIGS,configs/basic-pbx)
webvmail:
@[ -d "$(DESTDIR)$(HTTP_DOCSDIR)/" ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
@ -867,29 +873,36 @@ webvmail:
@echo " +-------------------------------------------+"
progdocs:
# Note, Makefile conditionals must not be tabbed out. Wasted hours with that.
@cp doc/asterisk-ng-doxygen.in doc/asterisk-ng-doxygen
ifeq ($(DOXYGEN),:)
@echo "Doxygen is not installed. Please install and re-run the configuration script."
else
@cp doc/Doxyfile.in doc/Doxyfile
ifeq ($(DOT),:)
@echo "DOT is not installed. Doxygen will not produce any diagrams. Please install and re-run the configuration script."
else
# Enable DOT
@echo "HAVE_DOT = YES" >> doc/asterisk-ng-doxygen
@echo "HAVE_DOT = YES" >> doc/Doxyfile
endif
# Set Doxygen PROJECT_NUMBER variable
ifneq ($(ASTERISKVERSION),UNKNOWN__and_probably_unsupported)
@echo "PROJECT_NUMBER = $(ASTERISKVERSION)" >> doc/asterisk-ng-doxygen
ifneq ($(NOISY_BUILD),yes)
@echo "EXTRACT_ALL = YES" >> doc/Doxyfile
endif
ifeq ($(AST_DEVMODE),yes)
@echo "INTERNAL_DOCS = YES" >> doc/Doxyfile
@echo "WARN_NO_PARAMDOC = YES" >> doc/Doxyfile
endif
ifeq ($(ASTERISKVERSION),UNKNOWN__and_probably_unsupported)
@echo "Asterisk Version is unknown, not configuring Doxygen PROJECT_NUMBER."
else ifeq ($(ASTERISKVERSION),UNKNOWN__git_check_fail)
@echo "Asterisk Version is unknown due to a git error. If you are running make"
@echo "as a different user than the project owner, this can be resolved by"
@echo "running the following command as the user currently executing make: "$$USER
@echo "git config --global --add safe.directory "$(mkfile_dir:/=)
@echo "not configuring Doxygen PROJECT_NUMBER."
else
echo "Asterisk Version is unknown, not configuring Doxygen PROJECT_NUMBER."
@echo "PROJECT_NUMBER = $(ASTERISKVERSION)" >> doc/Doxyfile
endif
# Validate and auto-update local copy
@doxygen -u doc/asterisk-ng-doxygen
# Run Doxygen
@doxygen doc/asterisk-ng-doxygen
# Remove configuration backup file
@rm -f doc/asterisk-ng-doxygen.bak
@echo "Generating C-API documentation. This will take a while."
@doxygen doc/Doxyfile
@echo "Generation complete. Any warnings are in ./doxygen.log."
endif
install-logrotate:
@ -938,7 +951,7 @@ config:
if [ -z "$(DESTDIR)" ] ; then \
/sbin/chkconfig --add asterisk ; \
fi ; \
elif [ -f /etc/os-release ] && [ "opensuse" = "$(shell . /etc/os-release && echo $$ID)" ] ; then \
elif [ -f /etc/os-release ] && [ "opensuse" = "$(shell . /etc/os-release 2>/dev/null && echo $$ID)" ] ; then \
./build_tools/install_subst contrib/init.d/rc.suse.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
if [ ! -f /etc/sysconfig/asterisk ] ; then \
$(INSTALL) -m 644 contrib/init.d/etc_default_asterisk "$(DESTDIR)/etc/sysconfig/asterisk" ; \
@ -950,7 +963,7 @@ config:
./build_tools/install_subst contrib/init.d/rc.archlinux.asterisk "$(DESTDIR)/etc/init.d/asterisk"; \
elif [ -f /etc/slackware-version ]; then \
./build_tools/install_subst contrib/init.d/rc.slackware.asterisk "$(DESTDIR)/etc/rc.d/rc.asterisk"; \
elif [ -f /etc/os-release ] && [ "slackware" = "$(shell . /etc/os-release && echo $$ID)" ] ; then \
elif [ -f /etc/os-release ] && [ "slackware" = "$(shell . /etc/os-release 2>/dev/null && echo $$ID)" ] ; then \
./build_tools/install_subst contrib/init.d/rc.slackware.asterisk "$(DESTDIR)/etc/rc.d/rc.asterisk"; \
elif [ -d "$(DESTDIR)/Library/LaunchDaemons" ]; then \
if [ ! -f "$(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist" ]; then \
@ -974,18 +987,22 @@ sounds:
@$(MAKE) clean
@[ -f "$(DESTDIR)$(ASTDBDIR)/astdb.sqlite3" ] || [ ! -f "$(DESTDIR)$(ASTDBDIR)/astdb" ] || [ ! -f menuselect.makeopts ] || grep -q MENUSELECT_UTILS=.*astdb2sqlite3 menuselect.makeopts || (sed -i.orig -e's/MENUSELECT_UTILS=\(.*\)/MENUSELECT_UTILS=\1 astdb2sqlite3/' menuselect.makeopts && echo "Updating menuselect.makeopts to include astdb2sqlite3" && echo "Original version backed up to menuselect.makeopts.orig")
$(SUBDIRS_UNINSTALL):
+@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTDATADIR="$(ASTDATADIR)" $(SUBMAKE) -C $(@:-uninstall=) uninstall
main-binuninstall:
+@DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main binuninstall
_uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall
uninstall-headers:
rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
rm -f "$(DESTDIR)$(includedir)/asterisk.h"
_uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall uninstall-headers
rm -f "$(DESTDIR)$(ASTMODDIR)/"*
test -n "$(_oldmoddir)" -a -d "$(_oldmoddir)" && rm -f "$(_oldmoddir)/"* || :
rm -f "$(DESTDIR)$(ASTSBINDIR)/astgenkey"
rm -f "$(DESTDIR)$(ASTSBINDIR)/autosupport"
rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
rm -rf "$(DESTDIR)$(ASTDATADIR)/firmware"
rm -f "$(DESTDIR)$(ASTMANDIR)/man8/asterisk.8"
rm -f "$(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8"
@ -1015,7 +1032,7 @@ uninstall: _uninstall
@echo " + $(mK) uninstall-all +"
@echo " +-------------------------------------------+"
uninstall-all: _uninstall
uninstall-all: _uninstall uninstall-headers
rm -rf "$(DESTDIR)$(ASTMODDIR)"
test -n "$(_oldmoddir)" -a -d "$(_oldmoddir)" && rm -rf "$(_oldmoddir)" || :
rm -rf "$(DESTDIR)$(ASTVARLIBDIR)"
@ -1101,13 +1118,16 @@ ifeq ($(PYTHON),:)
else
@$(INSTALL) -d doc/rest-api
$(PYTHON) rest-api-templates/make_ari_stubs.py \
rest-api/resources.json .
--resources rest-api/resources.json --source-dir $(ASTTOPDIR) \
--dest-dir $(ASTTOPDIR)/doc/rest-api --docs-prefix ../
endif
check-alembic: makeopts
@find contrib/ast-db-manage/ -name '*.pyc' -delete
@ALEMBIC=$(ALEMBIC) build_tools/make_check_alembic config cdr voicemail >&2
.PHONY: install-configs
.PHONY: install-headers
.PHONY: menuselect
.PHONY: main
.PHONY: sounds
@ -1121,8 +1141,10 @@ check-alembic: makeopts
.PHONY: uninstall
.PHONY: _uninstall
.PHONY: uninstall-all
.PHONY: uninstall-headers
.PHONY: badshell
.PHONY: installdirs
.PHONY: progdocs
.PHONY: validate-docs
.PHONY: _clean
.PHONY: ari-stubs

View File

@ -114,7 +114,7 @@ ifneq ($(findstring :,$(XMLSTARLET)$(BASH)),:)
EXTERNAL_MODS=$$($(XMLSTARLET) sel -t -m "/category/member[support_level = 'external']" -v "@name" -n .moduleinfo) ;\
for x in $${EXTERNAL_MODS} ; do \
if [ -z "$${DISABLED_MODS[$${x}]}" ] ; then \
$(ASTTOPDIR)/build_tools/download_externals $${x} ;\
PJPROJECT_BUNDLED=${PJPROJECT_BUNDLED} $(ASTTOPDIR)/build_tools/download_externals $${x} ;\
fi ;\
done ;\
fi

View File

@ -20,6 +20,9 @@
# Helpful functions
# call with $(call function,...)
tolower = $(shell echo $(1) | tr '[:upper:]' '[:lower:]')
# Takes a list of MENUSELECT_CFLAG Id and returns CFLAGS to declare
# the ones which are enabled.
get_menuselect_cflags=$(patsubst %,-D%,$(filter $1,$(MENUSELECT_CFLAGS)))
.PHONY: dist-clean
@ -60,6 +63,7 @@ else
endif
OPTIMIZE?=-O3
ifneq ($(findstring darwin,$(OSARCH)),)
ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
# Snow Leopard/Lion has an issue with this optimization flag on large files (like chan_sip)
@ -67,6 +71,17 @@ ifneq ($(findstring darwin,$(OSARCH)),)
endif
endif
ifeq ($(CC),gcc)
# gcc version 8.2.1 and above must have partial-inlining disabled in order
# to avoid a documented bug. Sort to make the lowest version number come
# first. If it's the specified version then the current gcc version is equal
# to or greater, so add the custom optimization rule.
gcc_versions=$(shell printf "%s\n" $$(gcc -dumpversion) 8.2.1 | sort -n)
ifeq ($(firstword $(gcc_versions)),8.2.1)
OPTIMIZE+=-fno-partial-inlining
endif
endif
ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_CODE_COVERAGE),no)
_ASTCFLAGS+=$(OPTIMIZE)
else
@ -189,4 +204,19 @@ endif
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
$(CMD_PREFIX) $(CXX) -o $@ $(PTHREAD_CFLAGS) $(_ASTLDFLAGS) $^ $(CXX_LIBS) $(ASTLDFLAGS)
# These CC commands just create an object file with the input file embedded in it.
# It can be access from code as follows:
# If your input file is named abc_def.xml...
#
# extern const uint8_t _binary_abc_def_xml_start[];
# extern const uint8_t _binary_abc_def_xml_end[];
# extern const size_t _binary_abc_def_xml_size;
%.o: %.xml
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
$(CMD_PREFIX) $(CC) -g -nostartfiles -nodefaultlibs -nostdlib -r -Wl,-b,binary -o $@ $^
%.o: %.xslt
$(ECHO_PREFIX) echo " [LD] $^ -> $@"
$(CMD_PREFIX) $(CC) -g -nostartfiles -nodefaultlibs -nostdlib -r -Wl,-b,binary -o $@ $^
dist-clean:: clean

View File

@ -332,7 +332,7 @@ Data: echo hello world!
```
This manager command will attempt to execute an Asterisk application, System,
which is normally associated with the "system" class authorication. While some
which is normally associated with the "system" class authorization. While some
checks have been put into Asterisk to take this into account, certain dialplan
configurations and/or clever manipulation of the Originate manager action can
circumvent these checks. For example, take the following dialplan:
@ -365,7 +365,7 @@ set channel variables; which allows the execution of dialplan functions.
Dialplan functions within Asterisk are incredibly powerful, which is wonderful
for building applications using Asterisk. But during the read or write
execution, certain diaplan functions do much more. For example, reading the
execution, certain dialplan functions do much more. For example, reading the
SHELL() function can execute arbitrary commands on the system Asterisk is
running on. Writing to the FILE() function can change any file that Asterisk has
write access to.

View File

@ -1,7 +1,7 @@
# The Asterisk(R) Open Source PBX
```text
By Mark Spencer <markster@digium.com> and the Asterisk.org developer community.
Copyright (C) 2001-2016 Digium, Inc. and other copyright holders.
Copyright (C) 2001-2021 Sangoma Technologies Corporation and other copyright holders.
```
## SECURITY
@ -47,7 +47,7 @@ and the BSD variants.
ANY special hardware, not even a sound card) to install and run Asterisk.
Supported telephony hardware includes:
* All Analog and Digital Interface cards from [Digium]
* All Analog and Digital Interface cards from [Sangoma]
* QuickNet Internet PhoneJack and LineJack (http://www.quicknet.net)
* any full duplex sound card supported by ALSA, OSS, or PortAudio
* any ISDN card supported by mISDN on Linux
@ -91,7 +91,10 @@ guides in the [configs] directory.
2. Run `./configure`
Execute the configure script to guess values for system-dependent
variables used during compilation.
variables used during compilation. If the script indicates that some required
components are missing, you can run `./contrib/scripts/install_prereq install`
to install the necessary components. Note that this will install all dependencies for every functionality of Asterisk. After running the script, you will need
to rerun `./configure`.
3. Run `make menuselect` _\[optional]_
@ -251,7 +254,7 @@ Welcome to the growing worldwide community of Asterisk users!
---
Asterisk is a trademark of Digium, Inc.
Asterisk is a trademark of Sangoma Technologies Corporation
[home page]: https://www.asterisk.org
[support]: https://www.asterisk.org/support
@ -261,7 +264,7 @@ Asterisk is a trademark of Digium, Inc.
[voip-info.org]: http://www.voip-info.org/wiki-Asterisk
[asteriskdocs.org]: http://www.asteriskdocs.org
[NTP]: http://www.ntp.org/
[Digium]: https://www.digium.com/
[Sangoma]: https://www.sangoma.com/
[UPGRADE.txt]: UPGRADE.txt
[CHANGES]: CHANGES
[configs]: configs

View File

@ -1,218 +0,0 @@
=========================================================
===
=== Information for upgrading from Asterisk 1.0 to 1.2
===
=== This file documents all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also includes advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=========================================================
Compiling:
* The Asterisk 1.2 source code now uses C language features
supported only by 'modern' C compilers. Generally, this means GCC
version 3.0 or higher, although some GCC 2.96 releases will also
work. Some non-GCC compilers that support C99 and the common GCC
extensions (including anonymous structures and unions) will also
work. All releases of GCC 2.95 do _not_ have the requisite feature
support; systems using that compiler will need to be upgraded to
a more recent compiler release.
Dialplan Expressions:
* The dialplan expression parser (which handles $[ ... ] constructs)
has gone through a major upgrade, but has one incompatible change:
spaces are no longer required around expression operators, including
string comparisons. However, you can now use quoting to keep strings
together for comparison. For more details, please read the
doc/README.variables file, and check over your dialplan for possible
problems.
Agents:
* The default for ackcall has been changed to "no" instead of "yes"
because of a bug which caused the "yes" behavior to generally act like
"no". You may need to adjust the value if your agents behave
differently than you expect with respect to acknowledgement.
* The AgentCallBackLogin application now requires a second '|' before
specifying an extension@context. This is to distinguish the options
string from the extension, so that they do not conflict. See
'show application AgentCallbackLogin' for more details.
Parking:
* Parking behavior has changed slightly; when a parked call times out,
Asterisk will attempt to deliver the call back to the extension that
parked it, rather than the 's' extension. If that extension is busy
or unavailable, the parked call will be lost.
Dialing:
* The Caller*ID of the outbound leg is now the extension that was
called, rather than the Caller*ID of the inbound leg of the call. The
"o" flag for Dial can be used to restore the original behavior if
desired. Note that if you are looking for the originating callerid
from the manager event, there is a new manager event "Dial" which
provides the source and destination channels and callerid.
IAX:
* The naming convention for IAX channels has changed in two ways:
1. The call number follows a "-" rather than a "/" character.
2. The name of the channel has been simplified to IAX2/peer-callno,
rather than IAX2/peer@peer-callno or even IAX2/peer@peer/callno.
SIP:
* The global option "port" in 1.0.X that is used to set which port to
bind to has been changed to "bindport" to be more consistent with
the other channel drivers and to avoid confusion with the "port"
option for users/peers.
* The "Registry" event now uses "Username" rather than "User" for
consistency with IAX.
Applications:
* With the addition of dialplan functions (which operate similarly
to variables), the SetVar application has been renamed to Set.
* The CallerPres application has been removed. Use SetCallerPres
instead. It accepts both numeric and symbolic names.
* The applications GetGroupCount, GetGroupMatchCount, SetGroup, and
CheckGroup have been deprecated in favor of functions. Here is a
table of their replacements:
GetGroupCount([groupname][@category] GROUP_COUNT([groupname][@category]) Set(GROUPCOUNT=${GROUP_COUNT()})
GroupMatchCount(groupmatch[@category]) GROUP_MATCH_COUNT(groupmatch[@category]) Set(GROUPCOUNT=${GROUP_MATCH_COUNT(SIP/.*)})
SetGroup(groupname[@category]) GROUP([category])=groupname Set(GROUP()=test)
CheckGroup(max[@category]) N/A GotoIf($[ ${GROUP_COUNT()} > 5 ]?103)
Note that CheckGroup does not have a direct replacement. There is
also a new function called GROUP_LIST() which will return a space
separated list of all of the groups set on a channel. The GROUP()
function can also return the name of the group set on a channel when
used in a read environment.
* The applications DBGet and DBPut have been deprecated in favor of
functions. Here is a table of their replacements:
DBGet(foo=family/key) Set(foo=${DB(family/key)})
DBPut(family/key=${foo}) Set(DB(family/key)=${foo})
* The application SetLanguage has been deprecated in favor of the
function LANGUAGE().
SetLanguage(fr) Set(LANGUAGE()=fr)
The LANGUAGE function can also return the currently set language:
Set(MYLANG=${LANGUAGE()})
* The applications AbsoluteTimeout, DigitTimeout, and ResponseTimeout
have been deprecated in favor of the function TIMEOUT(timeouttype):
AbsoluteTimeout(300) Set(TIMEOUT(absolute)=300)
DigitTimeout(15) Set(TIMEOUT(digit)=15)
ResponseTimeout(15) Set(TIMEOUT(response)=15)
The TIMEOUT() function can also return the currently set timeouts:
Set(DTIMEOUT=${TIMEOUT(digit)})
* The applications SetCIDName, SetCIDNum, and SetRDNIS have been
deprecated in favor of the CALLERID(datatype) function:
SetCIDName(Joe Cool) Set(CALLERID(name)=Joe Cool)
SetCIDNum(2025551212) Set(CALLERID(number)=2025551212)
SetRDNIS(2024561414) Set(CALLERID(RDNIS)=2024561414)
* The application Record now uses the period to separate the filename
from the format, rather than the colon.
* The application VoiceMail now supports a 'temporary' greeting for each
mailbox. This greeting can be recorded by using option 4 in the
'mailbox options' menu, and 'change your password' option has been
moved to option 5.
* The application VoiceMailMain now only matches the 'default' context if
none is specified in the arguments. (This was the previously
documented behavior, however, we didn't follow that behavior.) The old
behavior can be restored by setting searchcontexts=yes in voicemail.conf.
Queues:
* A queue is now considered empty not only if there are no members but if
none of the members are available (e.g. agents not logged on). To
restore the original behavior, use "leavewhenempty=strict" or
"joinwhenempty=strict" instead of "=yes" for those options.
* It is now possible to use multi-digit extensions in the exit context
for a queue (although you should not have overlapping extensions,
as there is no digit timeout). This means that the EXITWITHKEY event
in queue_log can now contain a key field with more than a single
character in it.
Extensions:
* By default, there is a new option called "autofallthrough" in
extensions.conf that is set to yes. Asterisk 1.0 (and earlier)
behavior was to wait for an extension to be dialed after there were no
more extensions to execute. "autofallthrough" changes this behavior
so that the call will immediately be terminated with BUSY,
CONGESTION, or HANGUP based on Asterisk's best guess. If you are
writing an extension for IVR, you must use the WaitExten application
if "autofallthrough" is set to yes.
AGI:
* AGI scripts did not always get SIGHUP at the end, previously. That
behavior has been fixed. If you do not want your script to terminate
at the end of AGI being called (e.g. on a hangup) then set SIGHUP to
be ignored within your application.
* CallerID is reported with agi_callerid and agi_calleridname instead
of a single parameter holding both.
Music On Hold:
* The preferred format for musiconhold.conf has changed; please see the
sample configuration file for the new format. The existing format
is still supported but will generate warnings when the module is loaded.
chan_modem:
* All the chan_modem channel drivers (aopen, bestdata and i4l) are deprecated
in this release, and will be removed in the next major Asterisk release.
Please migrate to chan_misdn for ISDN interfaces; there is no upgrade
path for aopen and bestdata modem users.
MeetMe:
* The conference application now allows users to increase/decrease their
speaking volume and listening volume (independently of each other and
other users); the 'admin' and 'user' menus have changed, and new sound
files are included with this release. However, if a user calling in
over a Zaptel channel that does NOT have hardware DTMF detection
increases their speaking volume, it is likely they will no longer be
able to enter/exit the menu or make any further adjustments, as the
software DTMF detector will not be able to recognize the DTMF coming
from their device.
GetVar Manager Action:
* Previously, the behavior of the GetVar manager action reported the value
of a variable in the following manner:
> name: value
This has been changed to a manner similar to the SetVar action and is now
> Variable: name
> Value: value

View File

@ -1,497 +0,0 @@
=========================================================
===
=== Information for upgrading from Asterisk 1.2 to 1.4
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also includes advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
===
=========================================================
Build Process (configure script):
Asterisk now uses an autoconf-generated configuration script to learn how it
should build itself for your system. As it is a standard script, running:
$ ./configure --help
will show you all the options available. This script can be used to tell the
build process what libraries you have on your system (if it cannot find them
automatically), which libraries you wish to have ignored even though they may
be present, etc.
You must run the configure script before Asterisk will build, although it will
attempt to automatically run it for you with no options specified; for most
users, that will result in a similar build to what they would have had before
the configure script was added to the build process (except for having to run
'make' again after the configure script is run). Note that the configure script
does NOT need to be re-run just to rebuild Asterisk; you only need to re-run it
when your system configuration changes or you wish to build Asterisk with
different options.
Build Process (module selection):
The Asterisk source tree now includes a basic module selection and build option
selection tool called 'menuselect'. Run 'make menuselect' to make your choices.
In this tool, you can disable building of modules that you don't care about,
turn on/off global options for the build and see which modules will not
(and cannot) be built because your system does not have the required external
dependencies installed.
The resulting file from menuselect is called 'menuselect.makeopts'. Note that
the resulting menuselect.makeopts file generally contains which modules *not*
to build. The modules listed in this file indicate which modules have unmet
dependencies, a present conflict, or have been disabled by the user in the
menuselect interface. Compiler Flags can also be set in the menuselect
interface. In this case, the resulting file contains which CFLAGS are in use,
not which ones are not in use.
If you would like to save your choices and have them applied against all
builds, the file can be copied to '~/.asterisk.makeopts' or
'/etc/asterisk.makeopts'.
Build Process (Makefile targets):
The 'valgrind' and 'dont-optimize' targets have been removed; their functionality
is available by enabling the DONT_OPTIMIZE setting in the 'Compiler Flags' menu
in the menuselect tool.
It is now possible to run most make targets against a single subdirectory; from
the top level directory, for example, 'make channels' will run 'make all' in the
'channels' subdirectory. This also is true for 'clean', 'distclean' and 'depend'.
Sound (prompt) and Music On Hold files:
Beginning with Asterisk 1.4, the sound files and music on hold files supplied for
use with Asterisk have been replaced with new versions produced from high quality
master recordings, and are available in three languages (English, French and
Spanish) and in five formats (WAV (uncompressed), mu-Law, a-Law, GSM and G.729).
In addition, the music on hold files provided by opsound.org Music are now available
in the same five formats, but no longer available in MP3 format.
The Asterisk 1.4 tarball packages will only include English prompts in GSM format,
(as were supplied with previous releases) and the opsound.org MOH files in WAV format.
All of the other variations can be installed by running 'make menuselect' and
selecting the packages you wish to install; when you run 'make install', those
packages will be downloaded and installed along with the standard files included
in the tarball.
If for some reason you expect to not have Internet access at the time you will be
running 'make install', you can make your package selections using menuselect and
then run 'make sounds' to download (only) the sound packages; this will leave the
sound packages in the 'sounds' subdirectory to be used later during installation.
WARNING: Asterisk 1.4 supports a new layout for sound files in multiple languages;
instead of the alternate-language files being stored in subdirectories underneath
the existing files (for French, that would be digits/fr, letters/fr, phonetic/fr,
etc.) the new layout creates one directory under /var/lib/asterisk/sounds for the
language itself, then places all the sound files for that language under that
directory and its subdirectories. This is the layout that will be created if you
select non-English languages to be installed via menuselect, HOWEVER Asterisk does
not default to this layout and will not find the files in the places it expects them
to be. If you wish to use this layout, make sure you put 'languageprefix=yes' in your
/etc/asterisk/asterisk.conf file, so that Asterisk will know how the files were
installed.
PBX Core:
* The (very old and undocumented) ability to use BYEXTENSION for dialing
instead of ${EXTEN} has been removed.
* Builtin (res_features) transfer functionality attempts to use the context
defined in TRANSFER_CONTEXT variable of the transferer channel first. If
not set, it uses the transferee variable. If not set in any channel, it will
attempt to use the last non macro context. If not possible, it will default
to the current context.
* The autofallthrough setting introduced in Asterisk 1.2 now defaults to 'yes';
if your dialplan relies on the ability to 'run off the end' of an extension
and wait for a new extension without using WaitExten() to accomplish that,
you will need set autofallthrough to 'no' in your extensions.conf file.
Command Line Interface:
* 'show channels concise', designed to be used by applications that will parse
its output, previously used ':' characters to separate fields. However, some
of those fields can easily contain that character, making the output not
parseable. The delimiter has been changed to '!'.
Applications:
* In previous Asterisk releases, many applications would jump to priority n+101
to indicate some kind of status or error condition. This functionality was
marked deprecated in Asterisk 1.2. An option to disable it was provided with
the default value set to 'on'. The default value for the global priority
jumping option is now 'off'.
* The applications Cut, Sort, DBGet, DBPut, SetCIDNum, SetCIDName, SetRDNIS,
AbsoluteTimeout, DigitTimeout, ResponseTimeout, SetLanguage, GetGroupCount,
and GetGroupMatchCount were all deprecated in version 1.2, and therefore have
been removed in this version. You should use the equivalent dialplan
function in places where you have previously used one of these applications.
* The application SetGlobalVar has been deprecated. You should replace uses
of this application with the following combination of Set and GLOBAL():
Set(GLOBAL(name)=value). You may also access global variables exclusively by
using the GLOBAL() dialplan function, instead of relying on variable
interpolation falling back to globals when no channel variable is set.
* The application SetVar has been renamed to Set. The syntax SetVar was marked
deprecated in version 1.2 and is no longer recognized in this version. The
use of Set with multiple argument pairs has also been deprecated. Please
separate each name/value pair into its own dialplan line.
* app_read has been updated to use the newer options codes, using "skip" or
"noanswer" will not work. Use s or n. Also there is a new feature i, for
using indication tones, so typing in skip would give you unexpected results.
* OSPAuth is added to authenticate OSP tokens in in_bound call setup messages.
* The CONNECT event in the queue_log from app_queue now has a second field
in addition to the holdtime field. It contains the unique ID of the
queue member channel that is taking the call. This is useful when trying
to link recording filenames back to a particular call from the queue.
* The old/current behavior of app_queue has a serial type behavior
in that the queue will make all waiting callers wait in the queue
even if there is more than one available member ready to take
calls until the head caller is connected with the member they
were trying to get to. The next waiting caller in line then
becomes the head caller, and they are then connected with the
next available member and all available members and waiting callers
waits while this happens. This cycle continues until there are
no more available members or waiting callers, whichever comes first.
The new behavior, enabled by setting autofill=yes in queues.conf
either at the [general] level to default for all queues or
to set on a per-queue level, makes sure that when the waiting
callers are connecting with available members in a parallel fashion
until there are no more available members or no more waiting callers,
whichever comes first. This is probably more along the lines of how
one would expect a queue should work and in most cases, you will want
to enable this new behavior. If you do not specify or comment out this
option, it will default to "no" to keep backward compatability with the old
behavior.
* Queues depend on the channel driver reporting the proper state
for each member of the queue. To get proper signalling on
queue members that use the SIP channel driver, you need to
enable a call limit (could be set to a high value so it
is not put into action) and also make sure that both inbound
and outbound calls are accounted for.
Example:
[general]
limitonpeer = yes
[peername]
type=friend
call-limit=10
* The app_queue application now has the ability to use MixMonitor to
record conversations queue members are having with queue callers. Please
see configs/queues.conf.sample for more information on this option.
* The app_queue application strategy called 'roundrobin' has been deprecated
for this release. Users are encouraged to use 'rrmemory' instead, since it
provides more 'true' round-robin call delivery. For the Asterisk 1.6 release,
'rrmemory' will be renamed 'roundrobin'.
* The app_queue application option called 'monitor-join' has been deprecated
for this release. Users are encouraged to use 'monitor-type=mixmonitor' instead,
since it provides the same functionality but is not dependent on soxmix or some
other external program in order to mix the audio.
* app_meetme: The 'm' option (monitor) is renamed to 'l' (listen only), and
the 'm' option now provides the functionality of "initially muted".
In practice, most existing dialplans using the 'm' flag should not notice
any difference, unless the keypad menu is enabled, allowing the user
to unmute themsleves.
* ast_play_and_record would attempt to cancel the recording if a DTMF
'0' was received. This behavior was not documented in most of the
applications that used ast_play_and_record and the return codes from
ast_play_and_record weren't checked for properly.
ast_play_and_record has been changed so that '0' no longer cancels a
recording. If you want to allow DTMF digits to cancel an
in-progress recording use ast_play_and_record_full which allows you
to specify which DTMF digits can be used to accept a recording and
which digits can be used to cancel a recording.
* ast_app_messagecount has been renamed to ast_app_inboxcount. There is now a
new ast_app_messagecount function which takes a single context/mailbox/folder
mailbox specification and returns the message count for that folder only.
This addresses the deficiency of not being able to count the number of
messages in folders other than INBOX and Old.
* The exit behavior of the AGI applications has changed. Previously, when
a connection to an AGI server failed, the application would cause the channel
to immediately stop dialplan execution and hangup. Now, the only time that
the AGI applications will cause the channel to stop dialplan execution is
when the channel itself requests hangup. The AGI applications now set an
AGISTATUS variable which will allow you to find out whether running the AGI
was successful or not.
Previously, there was no way to handle the case where Asterisk was unable to
locally execute an AGI script for some reason. In this case, dialplan
execution will continue as it did before, but the AGISTATUS variable will be
set to "FAILURE".
A locally executed AGI script can now exit with a non-zero exit code and this
failure will be detected by Asterisk. If an AGI script exits with a non-zero
exit code, the AGISTATUS variable will be set to "FAILURE" as opposed to
"SUCCESS".
* app_voicemail: The ODBC_STORAGE capability now requires the extended table format
previously used only by EXTENDED_ODBC_STORAGE. This means that you will need to update
your table format using the schema provided in doc/odbcstorage.txt
* app_waitforsilence: Fixes have been made to this application which changes the
default behavior with how quickly it returns. You can maintain "old-style" behavior
with the addition/use of a third "timeout" parameter.
Please consult the application documentation and make changes to your dialplan
if appropriate.
Manager:
* After executing the 'status' manager action, the "Status" manager events
included the header "CallerID:" which was actually only the CallerID number,
and not the full CallerID string. This header has been renamed to
"CallerIDNum". For compatibility purposes, the CallerID parameter will remain
until after the release of 1.4, when it will be removed. Please use the time
during the 1.4 release to make this transition.
* The AgentConnect event now has an additional field called "BridgedChannel"
which contains the unique ID of the queue member channel that is taking the
call. This is useful when trying to link recording filenames back to
a particular call from the queue.
* app_userevent has been modified to always send Event: UserEvent with the
additional header UserEvent: <userspec>. Also, the Channel and UniqueID
headers are not automatically sent, unless you specify them as separate
arguments. Please see the application help for the new syntax.
* app_meetme: Mute and Unmute events are now reported via the Manager API.
Native Manager API commands MeetMeMute and MeetMeUnmute are provided, which
are easier to use than "Action Command:". The MeetMeStopTalking event has
also been deprecated in favor of the already existing MeetmeTalking event
with a "Status" of "on" or "off" added.
* OriginateFailure and OriginateSuccess events were replaced by event
OriginateResponse with a header named "Response" to indicate success or
failure
Variables:
* The builtin variables ${CALLERID}, ${CALLERIDNAME}, ${CALLERIDNUM},
${CALLERANI}, ${DNID}, ${RDNIS}, ${DATETIME}, ${TIMESTAMP}, ${ACCOUNTCODE},
and ${LANGUAGE} have all been deprecated in favor of their related dialplan
functions. You are encouraged to move towards the associated dialplan
function, as these variables will be removed in a future release.
* The CDR-CSV variables uniqueid, userfield, and basing time on GMT are now
adjustable from cdr.conf, instead of recompiling.
* OSP applications exports several new variables, ${OSPINHANDLE},
${OSPOUTHANDLE}, ${OSPINTOKEN}, ${OSPOUTTOKEN}, ${OSPCALLING},
${OSPINTIMELIMIT}, and ${OSPOUTTIMELIMIT}
* Builtin transfer functionality sets the variable ${TRANSFERERNAME} in the new
created channel. This variables holds the channel name of the transferer.
* The dial plan variable PRI_CAUSE will be removed from future versions
of Asterisk.
It is replaced by adding a cause value to the hangup() application.
Functions:
* The function ${CHECK_MD5()} has been deprecated in favor of using an
expression: $[${MD5(<string>)} = ${saved_md5}].
* The 'builtin' functions that used to be combined in pbx_functions.so are
now built as separate modules. If you are not using 'autoload=yes' in your
modules.conf file then you will need to explicitly load the modules that
contain the functions you want to use.
* The ENUMLOOKUP() function with the 'c' option (for counting the number of
records), but the lookup fails to match any records, the returned value will
now be "0" instead of blank.
* The REALTIME() function is now available in version 1.4 and app_realtime has
been deprecated in favor of the new function. app_realtime will be removed
completely with the version 1.6 release so please take the time between
releases to make any necessary changes
* The QUEUEAGENTCOUNT() function has been deprecated in favor of
QUEUE_MEMBER_COUNT().
The IAX2 channel:
* It is possible that previous configurations depended on the order in which
peers and users were specified in iax.conf for forcing the order in which
chan_iax2 matched against them. This behavior is going away and is considered
deprecated in this version. Avoid having ambiguous peer and user entries and
to make things easy on yourself, always set the "username" option for users
so that the remote end can match on that exactly instead of trying to infer
which user you want based on host.
If you would like to go ahead and use the new behavior which doesn't use the
order in the config file to influence matching order, then change the
MAX_PEER_BUCKETS define in chan_iax2.c to a value greater than one. An
example is provided there. By changing this, you will get *much* better
performance on systems that do a lot of peer and user lookups as they will be
stored in memory in a much more efficient manner.
* The "mailboxdetail" option has been deprecated. Previously, if this option
was not enabled, the 2 byte MSGCOUNT information element would be set to all
1's to indicate there there is some number of messages waiting. With this
option enabled, the number of new messages were placed in one byte and the
number of old messages are placed in the other. This is now the default
(and the only) behavior.
The SIP channel:
* The "incominglimit" setting is replaced by the "call-limit" setting in
sip.conf.
* OSP support code is removed from SIP channel to OSP applications. ospauth
option in sip.conf is removed to osp.conf as authpolicy. allowguest option
in sip.conf cannot be set as osp anymore.
* The Asterisk RTP stack has been changed in regards to RFC2833 reception
and transmission. Packets will now be sent with proper duration instead of all
at once. If you are receiving calls from a pre-1.4 Asterisk installation you
will want to turn on the rfc2833compensate option. Without this option your
DTMF reception may act poorly.
* The $SIPUSERAGENT dialplan variable is deprecated and will be removed
in coming versions of Asterisk. Please use the dialplan function
SIPCHANINFO(useragent) instead.
* The ALERT_INFO dialplan variable is deprecated and will be removed
in coming versions of Asterisk. Please use the dialplan application
sipaddheader() to add the "Alert-Info" header to the outbound invite.
* The "canreinvite" option has changed. canreinvite=yes used to disable
re-invites if you had NAT=yes. In 1.4, you need to set canreinvite=nonat
to disable re-invites when NAT=yes. This is propably what you want.
The settings are now: "yes", "no", "nonat", "update". Please consult
sip.conf.sample for detailed information.
The Zap channel:
* Support for MFC/R2 has been removed, as it has not been functional for some
time and it has no maintainer.
The Agent channel:
* Callback mode (AgentCallbackLogin) is now deprecated, since the entire function
it provided can be done using dialplan logic, without requiring additional
channel and module locks (which frequently caused deadlocks). An example of
how to do this using AEL dialplan is in doc/queues-with-callback-members.txt.
The G726-32 codec:
* It has been determined that previous versions of Asterisk used the wrong codeword
packing order for G726-32 data. This version supports both available packing orders,
and can transcode between them. It also now selects the proper order when
negotiating with a SIP peer based on the codec name supplied in the SDP. However,
there are existing devices that improperly request one order and then use another;
Sipura and Grandstream ATAs are known to do this, and there may be others. To
be able to continue to use these devices with this version of Asterisk and the
G726-32 codec, a configuration parameter called 'g726nonstandard' has been added
to sip.conf, so that Asterisk can use the packing order expected by the device (even
though it requested a different order). In addition, the internal format number for
G726-32 has been changed, and the old number is now assigned to AAL2-G726-32. The
result of this is that this version of Asterisk will be able to interoperate over
IAX2 with older versions of Asterisk, as long as this version is told to allow
'g726aal2' instead of 'g726' as the codec for the call.
Installation:
* On BSD systems, the installation directories have changed to more "FreeBSDish"
directories. On startup, Asterisk will look for the main configuration in
/usr/local/etc/asterisk/asterisk.conf
If you have an old installation, you might want to remove the binaries and
move the configuration files to the new locations. The following directories
are now default:
ASTLIBDIR /usr/local/lib/asterisk
ASTVARLIBDIR /usr/local/share/asterisk
ASTETCDIR /usr/local/etc/asterisk
ASTBINDIR /usr/local/bin/asterisk
ASTSBINDIR /usr/local/sbin/asterisk
Music on Hold:
* The music on hold handling has been changed in some significant ways in hopes
to make it work in a way that is much less confusing to users. Behavior will
not change if the same configuration is used from older versions of Asterisk.
However, there are some new configuration options that will make things work
in a way that makes more sense.
Previously, many of the channel drivers had an option called "musicclass" or
something similar. This option set what music on hold class this channel
would *hear* when put on hold. Some people expected (with good reason) that
this option was to configure what music on hold class to play when putting
the bridged channel on hold. This option has now been deprecated.
Two new music on hold related configuration options for channel drivers have
been introduced. Some channel drivers support both options, some just one,
and some support neither of them. Check the sample configuration files to see
which options apply to which channel driver.
The "mohsuggest" option specifies which music on hold class to suggest to the
bridged channel when putting them on hold. The only way that this class can
be overridden is if the bridged channel has a specific music class set that
was done in the dialplan using Set(CHANNEL(musicclass)=something).
The "mohinterpret" option is similar to the old "musicclass" option. It
specifies which music on hold class this channel would like to listen to when
put on hold. This music class is only effective if this channel has no music
class set on it from the dialplan and the bridged channel putting this one on
hold had no "mohsuggest" setting.
The IAX2 and Zap channel drivers have an additional feature for the
"mohinterpret" option. If this option is set to "passthrough", then these
channel drivers will pass through the HOLD message in signalling instead of
starting music on hold on the channel. An example for how this would be
useful is in an enterprise network of Asterisk servers. When one phone on one
server puts a phone on a different server on hold, the remote server will be
responsible for playing the hold music to its local phone that was put on
hold instead of the far end server across the network playing the music.
CDR Records:
* The behavior of the "clid" field of the CDR has always been that it will
contain the callerid ANI if it is set, or the callerid number if ANI was not
set. When using the "callerid" option for various channel drivers, some
would set ANI and some would not. This has been cleared up so that all
channel drivers set ANI. If you would like to change the callerid number
on the channel from the dialplan and have that change also show up in the
CDR, then you *must* set CALLERID(ANI) as well as CALLERID(num).
API:
* There are some API functions that were not previously prefixed with the 'ast_'
prefix but now are; these include the ADSI, ODBC and AGI interfaces. If you
have a module that uses the services provided by res_adsi, res_odbc, or
res_agi, you will need to add ast_ prefixes to the functions that you call
from those modules.
Formats:
* format_wav: The GAIN preprocessor definition has been changed from 2 to 0
in Asterisk 1.4. This change was made in response to user complaints of
choppiness or the clipping of loud signal peaks. The GAIN preprocessor
definition will be retained in Asterisk 1.4, but will be removed in a
future release. The use of GAIN for the increasing of voicemail message
volume should use the 'volgain' option in voicemail.conf

View File

@ -1,277 +0,0 @@
=========================================================
===
=== Information for upgrading from Asterisk 1.4 to 1.6
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also includes advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
=== UPGRADE-1.4.txt -- Upgrade info for 1.2 to 1.4
===
=========================================================
AEL:
* Macros are now implemented underneath with the Gosub() application.
Heaven Help You if you wrote code depending on any aspect of this!
Previous to 1.6, macros were implemented with the Macro() app, which
provided a nice feature of auto-returning. The compiler will do its
best to insert a Return() app call at the end of your macro if you did
not include it, but really, you should make sure that all execution
paths within your macros end in "return;".
* The conf2ael program is 'introduced' in this release; it is in a rather
crude state, but deemed useful for making a first pass at converting
extensions.conf code into AEL. More intelligence will come with time.
Core:
* The 'languageprefix' option in asterisk.conf is now deprecated, and
the default sound file layout for non-English sounds is the 'new
style' layout introduced in Asterisk 1.4 (and used by the automatic
sound file installer in the Makefile).
* The ast_expr2 stuff has been modified to handle floating-point numbers.
Numbers of the format D.D are now acceptable input for the expr parser,
Where D is a string of base-10 digits. All math is now done in "long double",
if it is available on your compiler/architecture. This was half-way between
a bug-fix (because the MATH func returns fp by default), and an enhancement.
Also, for those counting on, or needing, integer operations, a series of
'functions' were also added to the expr language, to allow several styles
of rounding/truncation, along with a set of common floating point operations,
like sin, cos, tan, log, pow, etc. The ability to call external functions
like CDR(), etc. was also added, without having to use the ${...} notation.
* The delimiter passed to applications has been changed to the comma (','), as
that is what people are used to using within extensions.conf. If you are
using realtime extensions, you will need to translate your existing dialplan
to use this separator. To use a literal comma, you need merely to escape it
with a backslash ('\'). Another possible side effect is that you may need to
remove the obscene level of backslashing that was necessary for the dialplan
to work correctly in 1.4 and previous versions. This should make writing
dialplans less painful in the future, albeit with the pain of a one-time
conversion. If you would like to avoid this conversion immediately, set
pbx_realtime=1.4 in the [compat] section of asterisk.conf. After
transitioning, set pbx_realtime=1.6 in the same section.
* For the same purpose as above, you may set res_agi=1.4 in the [compat]
section of asterisk.conf to continue to use the '|' delimiter in the EXEC
arguments of AGI applications. After converting to use the ',' delimiter,
change this option to res_agi=1.6.
* As a side effect of the application delimiter change, many places that used
to need quotes in order to get the proper meaning are no longer required.
You now only need to quote strings in configuration files if you literally
want quotation marks within a string.
* Any applications run that contain the pipe symbol but not a comma symbol will
get a warning printed to the effect that the application delimiter has changed.
However, there are legitimate reasons why this might be useful in certain
situations, so this warning can be turned off with the dontwarn option in
asterisk.conf.
* The logger.conf option 'rotatetimestamp' has been deprecated in favor of
'rotatestrategy'. This new option supports a 'rotate' strategy that more
closely mimics the system logger in terms of file rotation.
* The concise versions of various CLI commands are now deprecated. We recommend
using the manager interface (AMI) for application integration with Asterisk.
Voicemail:
* The voicemail configuration values 'maxmessage' and 'minmessage' have
been changed to 'maxsecs' and 'minsecs' to clarify their purpose and
to make them more distinguishable from 'maxmsgs', which sets folder
size. The old variables will continue to work in this version, albeit
with a deprecation warning.
* If you use any interface for modifying voicemail aside from the built in
dialplan applications, then the option "pollmailboxes" *must* be set in
voicemail.conf for message waiting indication (MWI) to work properly. This
is because Voicemail notification is now event based instead of polling
based. The channel drivers are no longer responsible for constantly manually
checking mailboxes for changes so that they can send MWI information to users.
Examples of situations that would require this option are web interfaces to
voicemail or an email client in the case of using IMAP storage.
Applications:
* ChanIsAvail() now has a 't' option, which allows the specified device
to be queried for state without consulting the channel drivers. This
performs mostly a 'ChanExists' sort of function.
* ChannelRedirect() will not terminate the channel that fails to do a
channelredirect as it has done previously. Instead CHANNELREDIRECT_STATUS
will reflect if the attempt was successful of not.
* SetCallerPres() has been replaced with the CALLERPRES() dialplan function
and is now deprecated.
* DISA()'s fifth argument is now an options argument. If you have previously
used 'NOANSWER' in this argument, you'll need to convert that to the new
option 'n'.
* Macro() is now deprecated. If you need subroutines, you should use the
Gosub()/Return() applications. To replace MacroExclusive(), we have
introduced dialplan functions LOCK(), TRYLOCK(), and UNLOCK(). You may use
these functions in any location where you desire to ensure that only one
channel is executing that path at any one time. The Macro() applications
are deprecated for performance reasons. However, since Macro() has been
around for a long time and so many dialplans depend heavily on it, for the
sake of backwards compatibility it will not be removed . It is also worth
noting that using both Macro() and GoSub() at the same time is _heavily_
discouraged.
* Read() now sets a READSTATUS variable on exit. It does NOT automatically
return -1 (and hangup) anymore on error. If you want to hangup on error,
you need to do so explicitly in your dialplan.
* Privacy() no longer uses privacy.conf, so any options must be specified
directly in the application arguments.
* MusicOnHold application now has duration parameter which allows specifying
timeout in seconds.
* WaitMusicOnHold application is now deprecated in favor of extended MusicOnHold.
* SetMusicOnHold is now deprecated. You should use Set(CHANNEL(musicclass)=...)
instead.
* The arguments in ExecIf changed a bit, to be more like other applications.
The syntax is now ExecIf(<cond>?appiftrue(args):appiffalse(args)).
* The behavior of the Set application now depends upon a compatibility option,
set in asterisk.conf. To use the old 1.4 behavior, which allowed Set to take
multiple key/value pairs, set app_set=1.4 in [compat] in asterisk.conf. To
use the new behavior, which permits variables to be set with embedded commas,
set app_set=1.6 in [compat] in asterisk.conf. Note that you can have both
behaviors at the same time, if you switch to using MSet if you want the old
behavior.
Dialplan Functions:
* QUEUE_MEMBER_COUNT() has been deprecated in favor of the QUEUE_MEMBER() function. For
more information, issue a "show function QUEUE_MEMBER" from the CLI.
CDR:
* The cdr_sqlite module has been marked as deprecated in favor of
cdr_sqlite3_custom. It will potentially be removed from the tree
after Asterisk 1.6 is released.
* The cdr_odbc module now uses res_odbc to manage its connections. The
username and password parameters in cdr_odbc.conf, therefore, are no
longer used. The dsn parameter now points to an entry in res_odbc.conf.
* The uniqueid field in the core Asterisk structure has been changed from a
maximum 31 character field to a 149 character field, to account for all
possible values the systemname prefix could be. In the past, if the
systemname was too long, the uniqueid would have been truncated.
* The cdr_tds module now supports all versions of FreeTDS that contain
the db-lib frontend. It will also now log the userfield variable if
the target database table contains a column for it.
Formats:
* format_wav: The GAIN preprocessor definition and source code that used it
is removed. This change was made in response to user complaints of
choppiness or the clipping of loud signal peaks. To increase the volume
of voicemail messages, use the 'volgain' option in voicemail.conf
Channel Drivers:
* SIP: a small upgrade to support the "Record" button on the SNOM360,
which sends a sip INFO message with a "Record: on" or "Record: off"
header. If Asterisk is set up (via features.conf) to accept "One Touch Monitor"
requests (by default, via '*1'), then the user-configured dialpad sequence
is generated, and recording can be started and stopped via this button. The
file names and formats are all controlled via the normal mechanisms. If the
user has not configured the automon feature, the normal "415 Unsupported media type"
is returned, and nothing is done.
* SIP: The "call-limit" option is marked as deprecated. It still works in this version of
Asterisk, but will be removed in the following version. Please use the groupcount functions
in the dialplan to enforce call limits. The "limitonpeer" configuration option is
now renamed to "counteronpeer".
* SIP: The "username" option is now renamed to "defaultuser" to match "defaultip".
These are used only before registration to call a peer with the uri
sip:defaultuser@defaultip
The "username" setting still work, but is deprecated and will not work in
the next version of Asterisk.
* SIP: The old "insecure" options, deprecated in 1.4, have been removed.
"insecure=very" should be changed to "insecure=port,invite"
"insecure=yes" should be changed to "insecure=port"
Be aware that some telephony providers show the invalid syntax in their
sample configurations.
* chan_local.c: the comma delimiter inside the channel name has been changed to a
semicolon, in order to make the Local channel driver compatible with the comma
delimiter change in applications.
* H323: The "tos" setting has changed name to "tos_audio" and "cos" to "cos_audio"
to be compatible with settings in sip.conf. The "tos" and "cos" configuration
is deprecated and will stop working in the next release of Asterisk.
* Console: A new console channel driver, chan_console, has been added to Asterisk.
This new module can not be loaded at the same time as chan_alsa or chan_oss. The
default modules.conf only loads one of them (chan_oss by default). So, unless you
have modified your modules.conf to not use the autoload option, then you will need
to modify modules.conf to add another "noload" line to ensure that only one of
these three modules gets loaded.
* DAHDI: The chan_zap module that supported PSTN interfaces using
Zaptel has been renamed to chan_dahdi, and only supports the DAHDI
telephony driver package for PSTN interfaces. See the
Zaptel-to-DAHDI.txt file for more details on this transition.
* DAHDI: The "msdstrip" option has been deprecated, as it provides no value over
the method of stripping digits in the dialplan using variable substring syntax.
Configuration:
* pbx_dundi.c: tos parameter changed to use new values. Old values like lowdelay,
lowcost and other is not acceptable now. Look into qos.tex for description of
this parameter.
* queues.conf: the queue-lessthan sound file option is no longer available, and the
queue-round-seconds option no longer takes '1' as a valid parameter.
Manager:
* Manager has been upgraded to version 1.1 with a lot of changes.
Please check doc/manager_1_1.txt for information
* The IAXpeers command output has been changed to more closely resemble the
output of the SIPpeers command.
* cdr_manager now reports at the "cdr" level, not at "call" You may need to
change your manager.conf to add the level to existing AMI users, if they
want to see the CDR events generated.
* The Originate command now requires the Originate write permission. For
Originate with the Application parameter, you need the additional System
privilege if you want to do anything that calls out to a subshell.
iLBC Codec:
* Previously, the Asterisk source code distribution included the iLBC
encoder/decoder source code, from Global IP Solutions
(http://www.gipscorp.com). This code is not licensed for
distribution, and thus has been removed from the Asterisk source
code distribution. If you wish to use codec_ilbc to support iLBC
channels in Asterisk, you can run the contrib/scripts/get_ilbc_source.sh
script to download the source and put it in the proper place in
the Asterisk build tree. Once that is done you can follow your normal
steps of building Asterisk. You will need to run 'menuselect' and enable
the iLBC codec in the 'Codec Translators' category.

View File

@ -1,343 +0,0 @@
===========================================================
===
=== Information for upgrading between Asterisk versions
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also includes advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
=== UPGRADE-1.4.txt -- Upgrade info for 1.2 to 1.4
=== UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
===
===========================================================
From 1.8.13 to 1.8.14:
* permitdirectmedia/denydirectmedia now controls whether peers can be
bridged via directmedia by comparing the ACL to the bridging peer's
address rather than its own address.
From 1.8.12 to 1.8.13:
* The complex processor detection and optimization has been removed from
the makefile in favor of using native optimization suppport when available.
BUILD_NATIVE can be disabled via menuselect under "Compiler Flags".
From 1.8.10 to 1.8.11:
* If no transport is specified in sip.conf, transport will default to UDP.
Also, if multiple transport= lines are used, only the last will be used.
From 1.6.2 to 1.8:
* chan_sip no longer sets HASH(SIP_CAUSE,<chan name>) on channels by default.
This must now be enabled by setting 'sipstorecause' to 'yes' in sip.conf.
This carries a performance penalty.
* Asterisk now requires libpri 1.4.11+ for PRI support.
* A couple of CLI commands in res_ais were changed back to their original form:
"ais show clm members" --> "ais clm show members"
"ais show evt event channels" --> "ais evt show event channels"
* The default value for 'autofill' and 'shared_lastcall' in queues.conf has
been changed to 'yes'.
* The default value for the alwaysauthreject option in sip.conf has been changed
from "no" to "yes".
* The behavior of the 'parkedcallstimeout' has changed slightly. The formulation
of the extension name that a timed out parked call is delivered to when this
option is set to 'no' was modified such that instead of converting '/' to '0',
the '/' is converted to an underscore '_'. See the updated documentation in
features.conf.sample for more information on the behavior of the
'parkedcallstimeout' option.
* Asterisk-addons no longer exists as an independent package. Those modules
now live in the addons directory of the main Asterisk source tree. They
are not enabled by default. For more information about why modules live in
addons, see README-addons.txt.
* The rarely used 'event_log' and LOG_EVENT channel have been removed; the few
users of this channel in the tree have been converted to LOG_NOTICE or removed
(in cases where the same message was already generated to another channel).
* The usage of RTP inside of Asterisk has now become modularized. This means
the Asterisk RTP stack now exists as a loadable module, res_rtp_asterisk.
If you are not using autoload=yes in modules.conf you will need to ensure
it is set to load. If not, then any module which uses RTP (such as chan_sip)
will not be able to send or receive calls.
* The app_dahdiscan.c file has been removed, but the dialplan app DAHDIScan still
remains. It now exists within app_chanspy.c and retains the exact same
functionality as before.
* The default behavior for Set, AGI, and pbx_realtime has been changed to implement
1.6 behavior by default, if there is no [compat] section in asterisk.conf. In
prior versions, the behavior defaulted to 1.4 behavior, to assist in upgrades.
Specifically, that means that pbx_realtime and res_agi expect you to use commas
to separate arguments in applications, and Set only takes a single pair of
a variable name/value. The old 1.4 behavior may still be obtained by setting
app_set, pbx_realtime, and res_agi each to 1.4 in the [compat] section of
asterisk.conf.
* The PRI channels in chan_dahdi can no longer change the channel name if a
different B channel is selected during call negotiation. To prevent using
the channel name to infer what B channel a call is using and to avoid name
collisions, the channel name format is changed.
The new channel naming for PRI channels is:
DAHDI/i<span>/<number>[:<subaddress>]-<sequence-number>
* Added CHANNEL(dahdi_span), CHANNEL(dahdi_channel), and CHANNEL(dahdi_type)
so the dialplan can determine the B channel currently in use by the channel.
Use CHANNEL(no_media_path) to determine if the channel even has a B channel.
* Added AMI event DAHDIChannel to associate a DAHDI channel with an Asterisk
channel so AMI applications can passively determine the B channel currently
in use. Calls with "no-media" as the DAHDIChannel do not have an associated
B channel. No-media calls are either on hold or call-waiting.
* The ChanIsAvail application has been changed so the AVAILSTATUS variable
no longer contains both the device state and cause code. The cause code
is now available in the AVAILCAUSECODE variable. If existing dialplan logic
is written to expect AVAILSTATUS to contain the cause code it needs to be
changed to use AVAILCAUSECODE.
* ExternalIVR will now send Z events for invalid or missing files, T events
now include the interrupted file and bugs in argument parsing have been
fixed so there may be arguments specified in incorrect ways that were
working that will no longer work. Please see
https://wiki.asterisk.org/wiki/display/AST/External+IVR+Interface for details.
* OSP lookup application changes following variable names:
OSPPEERIP to OSPINPEERIP
OSPTECH to OSPOUTTECH
OSPDEST to OSPDESTINATION
OSPCALLING to OSPOUTCALLING
OSPCALLED to OSPOUTCALLED
OSPRESULTS to OSPDESTREMAILS
* The Manager event 'iax2 show peers' output has been updated. It now has a
similar output of 'sip show peers'.
* VoiceMailMain and VMAuthenticate, if a '*' is entered in the first position
of a Mailbox or Password, will, if it exists, jump to the 'a' extension in
the current dialplan context.
* The CALLERPRES() dialplan function is deprecated in favor of
CALLERID(num-pres) and CALLERID(name-pres).
* Environment variables that start with "AST_" are reserved to the system and
may no longer be set from the dialplan.
* When a call is redirected inside of a Dial, the app and appdata fields of the
CDR will now be set to "AppDial" and "(Outgoing Line)" instead of being blank.
* The CDR handling of billsec and duration field has changed. If your table
definition specifies those fields as float,double or similar they will now
be logged with microsecond accuracy instead of a whole integer.
* chan_sip will no longer set up a local call forward when receiving a
482 Loop Detected response. The dialplan will just continue from where it
left off.
* The 'stunaddr' option has been removed from chan_sip. This feature did not
behave as expected, had no correct use case, and was not RFC compliant. The
removal of this feature will hopefully be followed by a correct RFC compliant
STUN implementation in chan_sip in the future.
* The default value for the pedantic option in sip.conf has been changed
from "no" to "yes".
* The ConnectedLineNum and ConnectedLineName headers were added to many AMI
events/responses if the CallerIDNum/CallerIDName headers were also present.
The addition of connected line support changes the behavior of the channel
caller ID somewhat. The channel caller ID value no longer time shares with
the connected line ID on outgoing call legs. The timing of some AMI
events/responses output the connected line ID as caller ID. These party ID's
are now separate.
* The Dial application d and H options do not automatically answer the call
anymore. It broke DTMF attended transfers. Since many SIP and ISDN phones
cannot send DTMF before a call is connected, you need to answer the call
leg to those phones before using Dial with these options for them to have
any effect before the dialed party answers.
* The outgoing directory (where .call files are read) now uses inotify to
detect file changes instead of polling the directory on a regular basis.
If your outgoing folder is on a NFS mount or another network file system,
changes to the files will not be detected. You can revert to polling the
directory by specifying --without-inotify to configure before compiling.
* The 'sipusers' realtime table has been removed completely. Use the 'sippeers'
table with type 'user' for user type objects.
* The sip.conf allowoverlap option now accepts 'dtmf' as a value. If you
are using the early media DTMF overlap dialing method you now need to set
allowoverlap=dtmf.
From 1.6.1 to 1.6.2:
* SIP no longer sends the 183 progress message for early media by
default. Applications requiring early media should use the
progress() dialplan app to generate the progress message.
* The firmware for the IAXy has been removed from Asterisk. It can be
downloaded from http://downloads.digium.com/pub/iaxy/. To have Asterisk
install the firmware into its proper location, place the firmware in the
contrib/firmware/iax/ directory in the Asterisk source tree before running
"make install".
* T.38 FAX error correction mode can no longer be configured in udptl.conf;
instead, it is configured on a per-peer (or global) basis in sip.conf, with
the same default as was present in udptl.conf.sample.
* T.38 FAX maximum datagram size can no longer be configured in updtl.conf;
instead, it is either supplied by the application servicing the T.38 channel
(for a FAX send or receive) or calculated from the bridged endpoint's
maximum datagram size (for a T.38 FAX passthrough call). In addition, sip.conf
allows for overriding the value supplied by a remote endpoint, which is useful
when T.38 connections are made to gateways that supply incorrectly-calculated
maximum datagram sizes.
* There have been some changes to the IAX2 protocol to address the security
concerns documented in the security advisory AST-2009-006. Please see the
IAX2 security document, doc/IAX2-security.pdf, for information regarding
backwards compatibility with versions of Asterisk that do not contain these
changes to IAX2.
* The 'canreinvite' option support by the SIP, MGCP and Skinny channel drivers
has been renamed to 'directmedia', to better reflect what it actually does.
In the case of SIP, there are still re-INVITEs issued for T.38 negotiation,
starting and stopping music-on-hold, and other reasons, and the 'canreinvite'
option never had any effect on these cases, it only affected the re-INVITEs
used for direct media path setup. For MGCP and Skinny, the option was poorly
named because those protocols don't even use INVITE messages at all. For
backwards compatibility, the old option is still supported in both normal
and Realtime configuration files, but all of the sample configuration files,
Realtime/LDAP schemas, and other documentation refer to it using the new name.
* The default console now will use colors according to the default background
color, instead of forcing the background color to black. If you are using a
light colored background for your console, you may wish to use the option
flag '-W' to present better color choices for the various messages. However,
if you'd prefer the old method of forcing colors to white text on a black
background, the compatibility option -B is provided for this purpose.
* SendImage() no longer hangs up the channel on transmission error or on
any other error; in those cases, a FAILURE status is stored in
SENDIMAGESTATUS and dialplan execution continues. The possible
return values stored in SENDIMAGESTATUS are: SUCCESS, FAILURE, and
UNSUPPORTED. ('OK' has been replaced with 'SUCCESS', and 'NOSUPPORT'
has been replaced with 'UNSUPPORTED'). This change makes the
SendImage application more consistent with other applications.
* skinny.conf now has separate sections for lines and devices.
Please have a look at configs/skinny.conf.sample and update
your skinny.conf.
* Queue names previously were treated in a case-sensitive manner,
meaning that queues with names like "sales" and "sALeS" would be
seen as unique queues. The parsing logic has changed to use
case-insensitive comparisons now when originally hashing based on
queue names, meaning that now the two queues mentioned as examples
earlier will be seen as having the same name.
* The SPRINTF() dialplan function has been moved into its own module,
func_sprintf, and is no longer included in func_strings. If you use this
function and do not use 'autoload=yes' in modules.conf, you will need
to explicitly load func_sprintf for it to be available.
* The res_indications module has been removed. Its functionality was important
enough that most of it has been moved into the Asterisk core.
Two applications previously provided by res_indications, PlayTones and
StopPlayTones, have been moved into a new module, app_playtones.
* Support for Taiwanese was incorrectly supported with the "tw" language code.
In reality, the "tw" language code is reserved for the Twi language, native
to Ghana. If you were previously using the "tw" language code, you should
switch to using either "zh" (for Mandarin Chinese) or "zh_TW" for Taiwan
specific localizations. Additionally, "mx" should be changed to "es_MX",
Georgian was incorrectly specified as "ge" but should be "ka", and Czech is
"cs", not "cz".
* DAHDISendCallreroutingFacility() parameters are now comma-separated,
instead of the old pipe.
* res_jabber: autoprune has been disabled by default, to avoid misconfiguration
that would end up being interpreted as a bug once Asterisk started removing
the contacts from a user list.
* The cdr.conf file must exist and be configured correctly in order for CDR
records to be written.
* cdr_pgsql now assumes the encoding of strings it is handed are in LATIN9,
which should cover most uses of the extended ASCII set. If your strings
use a different encoding in Asterisk, the "encoding" parameter may be set
to specify the correct character set.
From 1.6.0.1 to 1.6.1:
* The ast_agi_register_multiple() and ast_agi_unregister_multiple()
API calls were added in 1.6.0, so that modules that provide multiple
AGI commands could register/unregister them all with a single
step. However, these API calls were not implemented properly, and did
not allow the caller to know whether registration or unregistration
succeeded or failed. They have been redefined to now return success
or failure, but this means any code using these functions will need
be recompiled after upgrading to a version of Asterisk containing
these changes. In addition, the source code using these functions
should be reviewed to ensure it can properly react to failure
of registration or unregistration of its API commands.
* The ast_agi_fdprintf() API call has been renamed to ast_agi_send()
to better match what it really does, and the argument order has been
changed to be consistent with other API calls that perform similar
operations.
From 1.6.0.x to 1.6.1:
* In previous versions of Asterisk, due to the way objects were arranged in
memory by chan_sip, the order of entries in sip.conf could be adjusted to
control the behavior of matching against peers and users. The way objects
are managed has been significantly changed for reasons involving performance
and stability. A side effect of these changes is that the order of entries
in sip.conf can no longer be relied upon to control behavior.
* The following core commands dealing with dialplan have been deprecated: 'core
show globals', 'core set global' and 'core set chanvar'. Use the equivalent
'dialplan show globals', 'dialplan set global' and 'dialplan set chanvar'
instead.
* In the dialplan expression parser, the logical value of spaces
immediately preceding a standalone 0 previously evaluated to
true. It now evaluates to false. This has confused a good many
people in the past (typically because they failed to realize the
space had any significance). Since this violates the Principle of
Least Surprise, it has been changed.
* While app_directory has always relied on having a voicemail.conf or users.conf file
correctly set up, it now is dependent on app_voicemail being compiled as well.
* SIP: All of the functionality in SIPCHANINFO() has been implemented in CHANNEL(),
and you should start using that function instead for retrieving information about
the channel in a technology-agnostic way.
* If you have any third party modules which use a config file variable whose
name ends in a '+', please note that the append capability added to this
version may now conflict with that variable naming scheme. An easy
workaround is to ensure that a space occurs between the '+' and the '=',
to differentiate your variable from the append operator. This potential
conflict is unlikely, but is documented here to be thorough.
* The "Join" event from app_queue now uses the CallerIDNum header instead of
the CallerID header to indicate the CallerID number.
* If you use ODBC storage for voicemail, there is a new field called "flag"
which should be a char(8) or larger. This field specifies whether or not a
message has been designated to be "Urgent", "PRIORITY", or not.

View File

@ -1,92 +0,0 @@
===========================================================
===
=== Information for upgrading between Asterisk versions
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also include advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
=== UPGRADE-1.4.txt -- Upgrade info for 1.2 to 1.4
=== UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
=== UPGRADE-1.8.txt -- Upgrade info for 1.6 to 1.8
===
===========================================================
From 10.4 to 10.5:
* The complex processor detection and optimization has been removed from
the makefile in favor of using native optimization suppport when available.
BUILD_NATIVE can be disabled via menuselect under "Compiler Flags".
From 10.2 to 10.3:
* If no transport is specified in sip.conf, transport will default to UDP.
Also, if multiple transport= lines are used, only the last will be used.
From 1.8 to 10:
cel_pgsql:
- This module now expects an 'extra' column in the database for data added
using the CELGenUserEvent() application.
ConfBridge
- ConfBridge's dialplan arguments have changed and are not
backwards compatible.
File Interpreters
- The format interpreter formats/format_sln16.c for the file extension
'.sln16' has been removed. The '.sln16' file interpreter now exists
in the formats/format_sln.c module along with new support for sln12,
sln24, sln32, sln44, sln48, sln96, and sln192 file extensions.
HTTP:
- A bindaddr must be specified in order for the HTTP server
to run. Previous versions would default to 0.0.0.0 if no
bindaddr was specified.
Gtalk:
- The default value for 'context' and 'parkinglots' in gtalk.conf has
been changed to 'default', previously they were empty.
chan_dahdi:
- The mohinterpret=passthrough setting is deprecated in favor of
moh_signaling=notify.
pbx_lua:
- Execution no longer continues after applications that do dialplan jumps
(such as app.goto). Now when an application such as app.goto() is called,
control is returned back to the pbx engine and the current extension
function stops executing.
- the autoservice now defaults to being on by default
- autoservice_start() and autoservice_start() no longer return a value.
Queue:
- Mark QUEUE_MEMBER_PENALTY Deprecated it never worked for realtime members
- QUEUE_MEMBER is now R/W supporting setting paused, ignorebusy and penalty.
Asterisk Database:
- The internal Asterisk database has been switched from Berkeley DB 1.86 to
SQLite 3. An existing Berkeley astdb file can be converted with the astdb2sqlite3
utility in the UTILS section of menuselect. If an existing astdb is found and no
astdb.sqlite3 exists, astdb2sqlite3 will be compiled automatically. Asterisk will
convert an existing astdb to the SQLite3 version automatically at runtime.
Module Support Level
- All modules in the addons, apps, bridge, cdr, cel, channels, codecs,
formats, funcs, pbx, and res have been updated to include MODULEINFO data
that includes <support_level> tags with a value of core, extended, or deprecated.
More information is available on the Asterisk wiki at
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States
Deprecated modules are now marked to not build by default and must be explicitly
enabled in menuselect.
===========================================================
===========================================================

View File

@ -1,280 +0,0 @@
===========================================================
===
=== Information for upgrading between Asterisk versions
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also include advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
=== UPGRADE-1.4.txt -- Upgrade info for 1.2 to 1.4
=== UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
=== UPGRADE-1.8.txt -- Upgrade info for 1.6 to 1.8
=== UPGRADE-10.txt -- Upgrade info for 1.8 to 10
===
===========================================================
From 11.6 to 11.7:
ConfBridge
- ConfBridge now has the ability to set the language of announcements to the
conference. The language can be set on a bridge profile in confbridge.conf
or by the dialplan function CONFBRIDGE(bridge,language)=en.
chan_sip - Clarify The "sip show peers" Forcerport Column And Add Comedia
- Under the "Forcerport" column, the "N" used to mean NAT (i.e. Yes). With
the additon of auto_* NAT settings, the meaning changed and there was a
certain combination of letters added to indicate the current setting. The
combination of using "Y", "N", "A" or "a", can be confusing. Therefore, we
now display clearly what the current Forcerport setting is: "Yes", "No",
"Auto (Yes)", "Auto (No)".
- Since we are clarifying the Forcerport column, we have added a column to
display the Comedia setting since this is useful information as well. We
no longer have a simple "NAT" setting like other versions before 11.
From 11.5 to 11.6:
* res_agi will now properly indicate if there was an error in streaming an
audio file. The result code will be -1 and the result returned from the
the function will be RESULT_FAILURE instead of the prior behavior of always
returning RESULT_SUCCESS even if there was an error.
From 11.4 to 11.5:
* The default settings for chan_sip are now overriden properly by the general
settings in sip.conf. Please look over your settings upon upgrading.
From 11.3 to 11.4:
* Added the 'n' option to MeetMe to prevent application of the DENOISE function
to a channel joining a conference. Some channel drivers that vary the number
of audio samples in a voice frame will experience significant quality problems
if a denoiser is attached to the channel; this option gives them the ability
to remove the denoiser without having to unload func_speex.
* The Registry AMI event for SIP registrations will now always include the
Username field. A previous bug fix missed an instance where it was not
included; that has been corrected in this release.
From 11.2.0 to 11.2.1:
* Asterisk would previously not output certain error messages when a remote
console attempted to connect to Asterisk and no instance of Asterisk was
running. This error message is displayed on stderr; as a result, some
initialization scripts that used remote consoles to test for the presence
of a running Asterisk instance started to display erroneous error messages.
The init.d scripts and the safe_asterisk have been updated in the contrib
folder to account for this.
From 11.2 to 11.3:
* Now by default, when Asterisk is installed in a path other than /usr, the
Asterisk binary will search for shared libraries in ${libdir} in addition to
searching system libraries. This allows Asterisk to find its shared
libraries without having to specify LD_LIBRARY_PATH. This can be disabled by
passing --disable-rpath to configure.
From 10 to 11:
Voicemail:
- All voicemails now have a "msg_id" which uniquely identifies a message. For
users of filesystem and IMAP storage of voicemail, this should be transparent.
For users of ODBC, you will need to add a "msg_id" column to your voice mail
messages table. This should be a string capable of holding at least 32 characters.
All messages created in old Asterisk installations will have a msg_id added to
them when required. This operation should be transparent as well.
Parking:
- The comebacktoorigin setting must now be set per parking lot. The setting in
the general section will not be applied automatically to each parking lot.
- The BLINDTRANSFER channel variable is deleted from a channel when it is
bridged to prevent subtle bugs in the parking feature. The channel
variable is used by Asterisk internally for the Park application to work
properly. If you were using it for your own purposes, copy it to your
own channel variable before the channel is bridged.
res_ais:
- Users of res_ais in versions of Asterisk prior to Asterisk 11 must change
to use the res_corosync module, instead. OpenAIS is deprecated, but
Corosync is still actively developed and maintained. Corosync came out of
the OpenAIS project.
Dialplan Functions:
- MAILBOX_EXISTS has been deprecated. Use VM_INFO with the 'exists' parameter
instead.
- Macro has been deprecated in favor of GoSub. For redirecting and connected
line purposes use the following variables instead of their macro equivalents:
REDIRECTING_SEND_SUB, REDIRECTING_SEND_SUB_ARGS,
CONNECTED_LINE_SEND_SUB, CONNECTED_LINE_SEND_SUB_ARGS.
- The REDIRECTING function now supports the redirecting original party id
and reason.
- The HANGUPCAUSE and HANGUPCAUSE_KEYS functions have been introduced to
provide a replacement for the SIP_CAUSE hash. The HangupCauseClear
application has also been introduced to remove this data from the channel
when necessary.
func_enum:
- ENUM query functions now return a count of -1 on lookup error to
differentiate between a failed query and a successful query with 0 results
matching the specified type.
CDR:
- cdr_adaptive_odbc now supports specifying a schema so that Asterisk can
connect to databases that use schemas.
Configuration Files:
- Files listed below have been updated to be more consistent with how Asterisk
parses configuration files. This makes configuration files more consistent
with what is expected across modules.
- cdr.conf: [general] and [csv] sections
- dnsmgr.conf
- dsp.conf
- The 'verbose' setting in logger.conf now takes an optional argument,
specifying the verbosity level for each logging destination. The default,
if not otherwise specified, is a verbosity of 3.
AMI:
- DBDelTree now correctly returns an error when 0 rows are deleted just as
the DBDel action does.
- The IAX2 PeerStatus event now sends a 'Port' header. In Asterisk 10, this was
erroneously being sent as a 'Post' header.
CCSS:
- Macro is deprecated. Use cc_callback_sub instead of cc_callback_macro
in channel configurations.
app_meetme:
- The 'c' option (announce user count) will now work even if the 'q' (quiet)
option is enabled.
app_followme:
- Answered outgoing calls no longer get cut off when the next step is started.
You now have until the last step times out to decide if you want to accept
the call or not before being disconnected.
chan_gtalk:
- chan_gtalk has been deprecated in favor of the chan_motif channel driver. It is recommended
that users switch to using it as it is a core supported module.
chan_jingle:
- chan_jingle has been deprecated in favor of the chan_motif channel driver. It is recommended
that users switch to using it as it is a core supported module.
SIP
===
- A new option "tonezone" for setting default tonezone for the channel driver
or individual devices
- A new manager event, "SessionTimeout" has been added and is triggered when
a call is terminated due to RTP stream inactivity or SIP session timer
expiration.
- SIP_CAUSE is now deprecated. It has been modified to use the same
mechanism as the HANGUPCAUSE function. Behavior should not change, but
performance should be vastly improved. The HANGUPCAUSE function should now
be used instead of SIP_CAUSE. Because of this, the storesipcause option in
sip.conf is also deprecated.
- The sip paramater for Originating Line Information (oli, isup-oli, and
ss7-oli) is now parsed out of the From header and copied into the channel's
ANI2 information field. This is readable from the CALLERID(ani2) dialplan
function.
- ICE support has been added and is enabled by default. Some endpoints may have
problems with the ICE candidates within the SDP. If this is the case ICE support
can be disabled globally or on a per-endpoint basis using the icesupport
configuration option. Symptoms of this include one way media or no media flow.
chan_unistim
- Due to massive update in chan_unistim phone keys functions and on-screen
information changed.
users.conf:
- A defined user with hasvoicemail=yes now finally uses a Gosub to stdexten
as documented in extensions.conf.sample since v1.6.0 instead of a Macro as
documented in v1.4. Set the asterisk.conf stdexten=macro parameter to
invoke the stdexten the old way.
res_jabber
- This module has been deprecated in favor of the res_xmpp module. The res_xmpp
module is backwards compatible with the res_jabber configuration file, dialplan
functions, and AMI actions. The old CLI commands can also be made available using
the res_clialiases template for Asterisk 11.
From 1.8 to 10:
cel_pgsql:
- This module now expects an 'extra' column in the database for data added
using the CELGenUserEvent() application.
ConfBridge
- ConfBridge's dialplan arguments have changed and are not
backwards compatible.
File Interpreters
- The format interpreter formats/format_sln16.c for the file extension
'.sln16' has been removed. The '.sln16' file interpreter now exists
in the formats/format_sln.c module along with new support for sln12,
sln24, sln32, sln44, sln48, sln96, and sln192 file extensions.
HTTP:
- A bindaddr must be specified in order for the HTTP server
to run. Previous versions would default to 0.0.0.0 if no
bindaddr was specified.
Gtalk:
- The default value for 'context' and 'parkinglots' in gtalk.conf has
been changed to 'default', previously they were empty.
chan_dahdi:
- The mohinterpret=passthrough setting is deprecated in favor of
moh_signaling=notify.
pbx_lua:
- Execution no longer continues after applications that do dialplan jumps
(such as app.goto). Now when an application such as app.goto() is called,
control is returned back to the pbx engine and the current extension
function stops executing.
- the autoservice now defaults to being on by default
- autoservice_start() and autoservice_start() no longer return a value.
Queue:
- Mark QUEUE_MEMBER_PENALTY Deprecated it never worked for realtime members
- QUEUE_MEMBER is now R/W supporting setting paused, ignorebusy and penalty.
Asterisk Database:
- The internal Asterisk database has been switched from Berkeley DB 1.86 to
SQLite 3. An existing Berkeley astdb file can be converted with the astdb2sqlite3
utility in the UTILS section of menuselect. If an existing astdb is found and no
astdb.sqlite3 exists, astdb2sqlite3 will be compiled automatically. Asterisk will
convert an existing astdb to the SQLite3 version automatically at runtime. If
moving back from Asterisk 10 to Asterisk 1.8, the astdb2bdb utility can be used
to create a Berkeley DB copy of the SQLite3 astdb that Asterisk 10 uses.
Manager:
- The AMI protocol version was incremented to 1.2 as a result of changing two
instances of the Unlink event to Bridge events. This change was documented
as part of the AMI 1.1 update, but two Unlink events were inadvertently left
unchanged.
Module Support Level
- All modules in the addons, apps, bridge, cdr, cel, channels, codecs,
formats, funcs, pbx, and res have been updated to include MODULEINFO data
that includes <support_level> tags with a value of core, extended, or deprecated.
More information is available on the Asterisk wiki at
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States
Deprecated modules are now marked to not build by default and must be explicitly
enabled in menuselect.
chan_sip:
- Setting of HASH(SIP_CAUSE,<slave-channel-name>) on channels is now disabled
by default. It can be enabled using the 'storesipcause' option. This feature
has a significant performance penalty.
UDPTL:
- The default UDPTL port range in udptl.conf.sample differed from the defaults
in the source. If you didn't have a config file, you got 4500 to 4599. Now the
default is 4000 to 4999.
===========================================================
===========================================================

View File

@ -1,478 +0,0 @@
===========================================================
===
=== Information for upgrading between Asterisk versions
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also include advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
=== UPGRADE-1.4.txt -- Upgrade info for 1.2 to 1.4
=== UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
=== UPGRADE-1.8.txt -- Upgrade info for 1.6 to 1.8
=== UPGRADE-10.txt -- Upgrade info for 1.8 to 10
=== UPGRADE-11.txt -- Upgrade info for 10 to 11
===
===========================================================
There are many significant architectural changes in Asterisk 12. It is
recommended that you not only read through this document for important
changes that affect an upgrade, but that you also read through the CHANGES
document in depth to better understand the new options available to you.
Additional information on the architectural changes made in Asterisk can be
found on the Asterisk wiki (https://wiki.asterisk.org)
Of particular note, the following systems in Asterisk underwent significant
changes. Documentation for the changes and a specification for their
behavior in Asterisk 12 is also available on the Asterisk wiki.
- AMI: Many events were changed, and the semantics of channels and bridges
were defined. In particular, how channels and bridges behave under
transfer scenarios and situations involving multiple parties has
changed significantly. See https://wiki.asterisk.org/wiki/x/dAFRAQ
for more information.
- CDR: CDR logic was extracted from the many locations it existed in across
Asterisk and implemented as a consumer of Stasis message bus events.
As a result, consistency of records has improved significantly and the
behavior of CDRs in transfer scenarios has been defined in the CDR
specification. However, significant behavioral changes in CDRs resulted
from the transition. The most significant change is the addition of
CDR entries when a channel who is the Party A in a CDR leaves a bridge.
See https://wiki.asterisk.org/wiki/x/pwpRAQ for more information.
- CEL: Much like CDRs, CEL was removed from the many locations it existed in
across Asterisk and implemented as a consumer of Stasis message bus
events. It now closely follows the Bridging API model of channels and
bridges, and has a much closer consistency of conveyed events as AMI.
For the changes in events, see https://wiki.asterisk.org/wiki/x/4ICLAQ.
Build System:
- Removed the CHANNEL_TRACE development mode build option. Certain aspects of
the CHANNEL_TRACE build option were incompatible with the new bridging
architecture.
- Asterisk now depends on libjansson, libuuid and optionally (but recommended)
libxslt and uriparser.
- The new SIP stack and channel driver uses a particular version of PJSIP.
Please see https://wiki.asterisk.org/wiki/x/J4GLAQ for more information on
configuring and installing PJSIP for use with Asterisk.
AgentLogin and chan_agent:
- Along with AgentRequest, this application has been modified to be a
replacement for chan_agent. The chan_agent module and the Agent channel
driver have been removed from Asterisk, as the concept of a channel driver
proxying in front of another channel driver was incompatible with the new
architecture (and has had numerous problems through past versions of
Asterisk). The act of a channel calling the AgentLogin application places the
channel into a pool of agents that can be requested by the AgentRequest
application. Note that this application, as well as all other agent related
functionality, is now provided by the app_agent_pool module.
- This application no longer performs agent authentication. If authentication
is desired, the dialplan needs to perform this function using the
Authenticate or VMAuthenticate application or through an AGI script before
running AgentLogin.
- The agents.conf schema has changed. Rather than specifying agents on a
single line in comma delineated fashion, each agent is defined in a separate
context. This allows agents to use the power of context templates in their
definition.
- A number of parameters from agents.conf have been removed. This includes
maxloginretries, autologoffunavail, updatecdr, goodbye, group, recordformat,
urlprefix, and savecallsin. These options were obsoleted by the move from
a channel driver model to the bridging/application model provided by
app_agent_pool.
- The AGENTUPDATECDR channel variable has also been removed, for the same
reason as the updatecdr option.
- The endcall and enddtmf configuration options are removed. Use the
dialplan function CHANNEL(dtmf_features) to set DTMF features on the agent
channel before calling AgentLogin.
AgentMonitorOutgoing
- This application has been removed. It was a holdover from when
AgentCallbackLogin was removed.
Answer
- It is no longer possible to bypass updating the CDR when answering a
channel. CDRs are based on the channel state and will be updated when
the channel is Answered.
ControlPlayback
- The channel variable CPLAYBACKSTATUS may now return the value
'REMOTESTOPPED' when playback is stopped by an external entity.
DISA
- This application now has a dependency on the app_cdr module. It uses this
module to hide the CDR created prior to execution of the DISA application.
DumpChan:
- The output of DumpChan no longer includes the DirectBridge or IndirectBridge
fields. Instead, if a channel is in a bridge, it includes a BridgeID field
containing the unique ID of the bridge that the channel happens to be in.
ForkCDR:
- Nearly every parameter in ForkCDR has been updated and changed to reflect
the changes in CDRs. Please see the documentation for the ForkCDR
application, as well as the CDR specification on the Asterisk wiki.
NoCDR:
- The NoCDR application has been deprecated. Please use the CDR_PROP function
to disable CDRs on a channel.
ParkAndAnnounce:
- The app_parkandannounce module has been removed. The application
ParkAndAnnounce is now provided by the res_parking module. See the
Parking changes for more information.
ResetCDR:
- The 'w' and 'a' options have been removed. Dispatching CDRs to registered
backends occurs on an as-needed basis in order to preserve linkedid
propagation and other needed behavior.
- The 'e' option is deprecated. Please use the CDR_PROP function to enable
CDRs on a channel that they were previously disabled on.
- The ResetCDR application is no longer a part of core Asterisk, and instead
is now delivered as part of app_cdr.
Queues:
- Queue strategy rrmemory now has a predictable order similar to strategy
rrordered. Members will be called in the order that they are added to the
queue.
- Removed the queues.conf check_state_unknown option. It is no longer
necessary.
- It is now possible to play the Queue prompts to the first user waiting in a
call queue. Note that this may impact the ability for agents to talk with
users, as a prompt may still be playing when an agent connects to the user.
This ability is disabled by default but can be enabled on an individual
queue using the 'announce-to-first-user' option.
- The configuration options eventwhencalled and eventmemberstatus have been
removed. As a result, the AMI events QueueMemberStatus, AgentCalled,
AgentConnect, AgentComplete, AgentDump, and AgentRingNoAnswer will always be
sent. The "Variable" fields will also no longer exist on the Agent* events.
These events can be filtered out from a connected AMI client using the
eventfilter setting in manager.conf.
- The queue log now differentiates between blind and attended transfers. A
blind transfer will result in a BLINDTRANSFER message with the destination
context and extension. An attended transfer will result in an
ATTENDEDTRANSFER message. This message will indicate the method by which
the attended transfer was completed: "BRIDGE" for a bridge merge, "APP"
for running an application on a bridge or channel, or "LINK" for linking
two bridges together with local channels. The queue log will also now detect
externally initiated blind and attended transfers and record the transfer
status accordingly.
- When performing queue pause/unpause on an interface without specifying an
individual queue, the PAUSEALL/UNPAUSEALL event will only be logged if at
least one member of any queue exists for that interface.
SetAMAFlags
- This application is deprecated in favor of CHANNEL(amaflags).
VoiceMail:
- Mailboxes defined by app_voicemail MUST be referenced by the rest of the
system as mailbox@context. The rest of the system cannot add @default
to mailbox identifiers for app_voicemail that do not specify a context
any longer. It is a mailbox identifier format that should only be
interpreted by app_voicemail.
- The voicemail.conf configuration file now has an 'alias' configuration
parameter for use with the Directory application. The voicemail realtime
database table schema has also been updated with an 'alias' column. Systems
using voicemail with realtime should update their schemas accordingly.
Channel Drivers:
- When a channel driver is configured to enable jiterbuffers, they are now
applied unconditionally when a channel joins a bridge. If a jitterbuffer
is already set for that channel when it enters, such as by the JITTERBUFFER
function, then the existing jitterbuffer will be used and the one set by
the channel driver will not be applied.
chan_bridge
- chan_bridge is removed and its functionality is incorporated into ConfBridge
itself.
chan_dahdi:
- Analog port dialing and deferred DTMF dialing for PRI now distinguishes
between 'w' and 'W'. The 'w' pauses dialing for half a second. The 'W'
pauses dialing for one second.
- The default for inband_on_proceeding has changed to no.
- The CLI command 'dahdi destroy channel' is now 'dahdi destroy channels'.
A range of channels can be specified to be destroyed. Note that this command
should only be used if you understand the risks it entails.
- The script specified by the chan_dahdi.conf mwimonitornotify option now gets
the exact configured mailbox name. For app_voicemail mailboxes this is
mailbox@context.
- Added mwi_vm_boxes that also must be configured for ISDN MWI to be enabled.
- ignore_failed_channels now defaults to True: the channel will continue to
be configured even if configuring it has failed. This is generally a
better setup for systems with not more than one DAHDI device or with DAHDI
>= 2.8.0 .
chan_local:
- The /b option has been removed.
- chan_local moved into the system core and is no longer a loadable module.
chan_sip:
- The 'callevents' parameter has been removed. Hold AMI events are now raised
in the core, and can be filtered out using the 'eventfilter' parameter
in manager.conf.
- Dynamic realtime tables for SIP Users can now include a 'path' field. This
will store the path information for that peer when it registers. Realtime
tables can also use the 'supportpath' field to enable Path header support.
- LDAP realtime configurations for SIP Users now have the AstAccountPathSupport
objectIdentifier. This maps to the supportpath option in sip.conf.
Core:
- Masquerades as an operation inside Asterisk have been effectively hidden
by the migration to the Bridging API. As such, many 'quirks' of Asterisk
no longer occur. This includes renaming of channels, "<ZOMBIE>" channels,
dropping of frame/audio hooks, and other internal implementation details
that users had to deal with. This fundamental change has large implications
throughout the changes documented for this version. For more information
about the new core architecture of Asterisk, please see the Asterisk wiki.
- The following channel variables have changed behavior which is described in
the CHANGES file: TRANSFER_CONTEXT, BRIDGEPEER, BRIDGEPVTCALLID,
ATTENDED_TRANSFER_COMPLETE_SOUND, DYNAMIC_FEATURENAME, and DYNAMIC_PEERNAME.
AMI (Asterisk Manager Interface):
- Version 1.4 - The details of what happens to a channel when a masquerade
happens (transfers, parking, etc) have changed.
- The Masquerade event now includes the Uniqueid's of the clone and original
channels.
- Channels no longer swap Uniqueid's as a result of the masquerade.
- Instead of a shell game of renames, there's now a single rename, appending
<ZOMBIE> to the name of the original channel.
- *Major* changes were made to both the syntax as well as the semantics of the
AMI protocol. In particular, AMI events have been substantially modified
and improved in this version of Asterisk. The major event changes are listed
below.
- NewPeerAccount has been removed. NewAccountCode is raised instead.
- Reload events have been consolidated and standardized.
- ModuleLoadReport has been removed.
- FaxSent is now SendFAX; FaxReceived is now ReceiveFAX. This standardizes
app_fax and res_fax events.
- MusicOnHold has been replaced with MusicOnHoldStart and MusicOnHoldStop.
- JabberEvent has been removed.
- Hold is now in the core and will now raise Hold and Unhold events.
- Join is now QueueCallerJoin.
- Leave is now QueueCallerLeave.
- Agentlogin/Agentlogoff is now AgentLogin/AgentLogoff, respectively.
- ChannelUpdate has been removed.
- Local channel optimization is now conveyed via LocalOptimizationBegin and
LocalOptimizationEnd.
- BridgeAction and BridgeExec have been removed.
- BlindTransfer and AttendedTransfer events were added.
- Dial is now DialBegin and DialEnd.
- DTMF is now DTMFBegin and DTMFEnd.
- Bridge has been replaced with BridgeCreate, BridgeEnter, BridgeLeave, and
BridgeDestroy
- MusicOnHold has been replaced with MusicOnHoldStart and MusicOnHoldStop
- AGIExec is now AGIExecStart and AGIExecEnd
- AsyncAGI is now AsyncAGIStart, AsyncAGIExec, and AsyncAGIEnd
- The 'MCID' AMI event now publishes a channel snapshot when available and
its non-channel-snapshot parameters now use either the "MCallerID" or
'MConnectedID' prefixes with Subaddr*, Name*, and Num* suffixes instead
of 'CallerID' and 'ConnectedID' to avoid confusion with similarly named
parameters in the channel snapshot.
- The 'Channel' key used in the 'AlarmClear', 'Alarm', and 'DNDState' has been
renamed "DAHDIChannel" since it does not convey an Asterisk channel name.
- All AMI events now contain a 'SystemName' field, if available.
- Local channel information in events is now prefixed with 'LocalOne' and
'LocalTwo'. This replaces the suffix of '1' and '2' for the two halves of
the Local channel. This affects the 'LocalBridge', 'LocalOptimizationBegin',
and 'LocalOptimizationEnd' events.
- The 'RTCPSent'/'RTCPReceived' events have been significantly modified from
previous versions. They now report all SR/RR packets sent/received, and
have been restructured to better reflect the data sent in a SR/RR. In
particular, the event structure now supports multiple report blocks.
- The deprecated use of | (pipe) as a separator in the channelvars setting in
manager.conf has been removed.
- The SIP SIPqualifypeer action now sends a response indicating it will qualify
a peer once a peer has been found to qualify. Once the qualify has been
completed it will now issue a SIPqualifypeerdone event.
- The AMI event 'Newexten' field 'Extension' is deprecated, and may be removed
in a future release. Please use the common 'Exten' field instead.
- The AMI events 'ParkedCall', 'ParkedCallTimeOut', 'ParkedCallGiveUp', and
'UnParkedCall' have changed significantly in the new res_parking module.
- The 'Channel' and 'From' headers are gone. For the channel that was parked
or is coming out of parking, a 'Parkee' channel snapshot is issued and it
has a number of fields associated with it. The old 'Channel' header relayed
the same data as the new 'ParkeeChannel' header.
- The 'From' field was ambiguous and changed meaning depending on the event.
for most of these, it was the name of the channel that parked the call
(the 'Parker'). There is no longer a header that provides this channel name,
however the 'ParkerDialString' will contain a dialstring to redial the
device that parked the call.
- On UnParkedCall events, the 'From' header would instead represent the
channel responsible for retrieving the parkee. It receives a channel
snapshot labeled 'Retriever'. The 'from' field is is replaced with
'RetrieverChannel'.
- Lastly, the 'Exten' field has been replaced with 'ParkingSpace'.
- The AMI event 'Parkinglot' (response to 'Parkinglots' command) in a similar
fashion has changed the field names 'StartExten' and 'StopExten' to
'StartSpace' and 'StopSpace' respectively.
- The AMI 'Status' response event to the AMI Status action replaces the
'BridgedChannel' and 'BridgedUniqueid' headers with the 'BridgeID' header to
indicate what bridge the channel is currently in.
CDR (Call Detail Records)
- Significant changes have been made to the behavior of CDRs. The CDR engine
was effectively rewritten and built on the Stasis message bus. For a full
definition of CDR behavior in Asterisk 12, please read the specification
on the Asterisk wiki (wiki.asterisk.org).
- CDRs will now be created between all participants in a bridge. For each
pair of channels in a bridge, a CDR is created to represent the path of
communication between those two endpoints. This lets an end user choose who
to bill for what during bridge operations with multiple parties.
- The duration, billsec, start, answer, and end times now reflect the times
associated with the current CDR for the channel, as opposed to a cumulative
measurement of all CDRs for that channel.
CEL:
- The Uniqueid field for a channel is now a stable identifier, and will not
change due to transfers, parking, etc.
- CEL has undergone significant rework in Asterisk 12, and is now built on the
Stasis message bus. Please see the specification for CEL on the Asterisk
wiki at https://wiki.asterisk.org/wiki/x/4ICLAQ for more detailed
information. A summary of the affected events is below:
- BRIDGE_START, BRIDGE_END, BRIDGE_UPDATE, 3WAY_START, 3WAY_END, CONF_ENTER,
CONF_EXIT, CONF_START, and CONF_END events have all been removed. These
events have been replaced by BRIDGE_ENTER/BRIDGE_EXIT.
- BLINDTRANSFER/ATTENDEDTRANSFER events now report the peer as NULL and
additional information in the extra string field.
Dialplan Functions:
- Certain dialplan functions have been marked as 'dangerous', and may only be
executed from the dialplan. Execution from extenal sources (AMI's GetVar and
SetVar actions; etc.) may be inhibited by setting live_dangerously in the
[options] section of asterisk.conf to no. SHELL(), channel locking, and
direct file read/write functions are marked as dangerous. DB_DELETE() and
REALTIME_DESTROY() are marked as dangerous for reads, but can now safely
accept writes (which ignore the provided value).
- The default value for live_dangerously was changed from yes (in Asterisk 11
and earlier) to no (in Asterisk 12 and greater).
Dialplan:
- All channel and global variable names are evaluated in a case-sensitive
manner. In previous versions of Asterisk, variables created and evaluated in
the dialplan were evaluated case-insensitively, but built-in variables and
variable evaluation done internally within Asterisk was done
case-sensitively.
- Asterisk has always had code to ignore dash '-' characters that are not
part of a character set in the dialplan extensions. The code now
consistently ignores these characters when matching dialplan extensions.
- BRIDGE_FEATURES channel variable is now casesensitive for feature letter
codes. Uppercase variants apply them to the calling party while lowercase
variants apply them to the called party.
Features:
- The features.conf [applicationmap] <FeatureName> ActivatedBy option is
no longer honored. The feature is always activated by the channel that has
DYNAMIC_FEATURES defined on it when it enters the bridge. Use predial to set
different values of DYNAMIC_FEATURES on the channels
- Executing a dynamic feature on the bridge peer in a multi-party bridge will
execute it on all peers of the activating channel.
- There is no longer an explicit 'features reload' CLI command. Features can
still be reloaded using 'module reload features'.
- It is no longer necessary (or possible) to define the ATXFER_NULL_TECH in
features.c for atxferdropcall=no to work properly. This option now just
works.
Parking:
- Parking has been extracted from the Asterisk core as a loadable module,
res_parking.
- Configuration is found in res_parking.conf. It is no longer supported in
features.conf
- The arguments for the Park, ParkedCall, and ParkAndAnnounce applications
have been modified significantly. See the application documents for
specific details.
- Numerous changes to Parking related applications, AMI and CLI commands and
internal inter-workings have been made. Please read the CHANGES file for
the detailed list.
Security Events Framework:
- Security Event timestamps now use ISO 8601 formatted date/time instead of
the "seconds-microseconds" format that it was using previously.
AGENT:
- The password option has been disabled, as the AgentLogin application no
longer provides authentication.
AUDIOHOOK_INHERIT:
- Due to changes in the Asterisk core, this function is no longer needed to
preserve a MixMonitor on a channel during transfer operations and dialplan
execution. It is effectively obsolete.
CDR: (function)
- The 'amaflags' and 'accountcode' attributes for the CDR function are
deprecated. Use the CHANNEL function instead to access these attributes.
- The 'l' option has been removed. When reading a CDR attribute, the most
recent record is always used. When writing a CDR attribute, all non-finalized
CDRs are updated.
- The 'r' option has been removed, for the same reason as the 'l' option.
- The 's' option has been removed, as LOCKED semantics no longer exist in the
CDR engine.
VMCOUNT:
- Mailboxes defined by app_voicemail MUST be referenced by the rest of the
system as mailbox@context. The rest of the system cannot add @default
to mailbox identifiers for app_voicemail that do not specify a context
any longer. It is a mailbox identifier format that should only be
interpreted by app_voicemail.
res_rtp_asterisk:
- ICE/STUN/TURN support in res_rtp_asterisk has been made optional. To enable
them, an Asterisk-specific version of PJSIP needs to be installed.
Tarballs are available from https://github.com/asterisk/pjproject/tags/.
===========================================================
===========================================================

View File

@ -1,399 +0,0 @@
===========================================================
===
=== Information for upgrading between Asterisk versions
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also include advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
=== UPGRADE-1.4.txt -- Upgrade info for 1.2 to 1.4
=== UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
=== UPGRADE-1.8.txt -- Upgrade info for 1.6 to 1.8
=== UPGRADE-10.txt -- Upgrade info for 1.8 to 10
=== UPGRADE-11.txt -- Upgrade info for 10 to 11
=== UPGRADE-12.txt -- Upgrade info for 11 to 12
===========================================================
General Asterisk Changes:
- The asterisk command line -I option and the asterisk.conf internal_timing
option are removed and always enabled if any timing module is loaded.
- The per console verbose level feature as previously implemented caused a
large performance penalty. The fix required some minor incompatibilities
if the new rasterisk is used to connect to an earlier version. If the new
rasterisk connects to an older Asterisk version then the root console verbose
level is always affected by the "core set verbose" command of the remote
console even though it may appear to only affect the current console. If
an older version of rasterisk connects to the new version then the
"core set verbose" command will have no effect.
- The asterisk compatibility options in asterisk.conf have been removed.
These options enabled certain backwards compatibility features for
pbx_realtime, res_agi, and app_set that made their behaviour similar to
Asterisk 1.4. Users who used these backwards compatibility settings should
update their dialplans to use ',' instead of '|' as a delimiter, and should
use the Set dialplan application instead of the MSet dialplan application.
Build System:
- Sample config files have been moved from configs/ to a subfolder of that
directory, 'samples'.
- The menuselect utility has been pulled into the Asterisk repository. As a
result, the libxml2 development library is now a required dependency for
Asterisk.
- Added a new Compiler Flag, REF_DEBUG. When enabled, reference counted
objects will emit additional debug information to the refs log file located
in the standard Asterisk log file directory. This log file is useful in
tracking down object leaks and other reference counting issues. Prior to
this version, this option was only available by modifying the source code
directly. This change also includes a new script, refcounter.py, in the
contrib folder that will process the refs log file.
Applications:
ConfBridge:
- The sound_place_into_conference sound used in Confbridge is now deprecated
and is no longer functional since it has been broken since its inception
and the fix involved using a different method to achieve the same goal. The
new method to achieve this functionality is by using sound_begin to play
a sound to the conference when waitmarked users are moved into the conference.
- Added 'Admin' header to ConfbridgeJoin, ConfbridgeLeave, ConfbridgeMute,
ConfbridgeUnmute, and ConfbridgeTalking AMI events.
ControlPlayback:
- The ControlPlayback and 'control stream file' AGI command will no longer
implicitly answer the channel. If you do not answer the channel prior to
using either this application or AGI command, you must send Progress
first.
Queue:
- Queue rules provided in queuerules.conf can no longer be named "general".
SetMusicOnHold:
- The SetMusicOnHold dialplan application was deprecated and has been removed.
Users of the application should use the CHANNEL function's musicclass
setting instead.
WaitMusicOnHold:
- The WaitMusicOnHold dialplan application was deprecated and has been
removed. Users of the application should use MusicOnHold with a duration
parameter instead.
CDR Backends:
- The cdr_sqlite module was deprecated and has been removed. Users of this
module should use the cdr_sqlite3_custom module instead.
Channel Drivers:
chan_dahdi:
- SS7 support now requires libss7 v2.0 or later.
- Added the inband_on_setup_ack compatibility option to chan_dahdi.conf to
deal with switches that don't send an inband progress indication in the
SETUP ACKNOWLEDGE message.
Default is now no.
chan_gtalk
- This module was deprecated and has been removed. Users of chan_gtalk
should use chan_motif.
chan_h323
- This module was deprecated and has been removed. Users of chan_h323
should use chan_ooh323.
chan_jingle
- This module was deprecated and has been removed. Users of chan_jingle
should use chan_motif.
chan_pjsip:
- Added a 'force_avp' option to chan_pjsip which will force the usage of
'RTP/AVP', 'RTP/AVPF', 'RTP/SAVP', or 'RTP/SAVPF' as the media transport type
in SDP offers depending on settings, even when DTLS is used for media
encryption.
- Added a 'media_use_received_transport' option to chan_pjsip which will
cause the SDP answer to use the media transport as received in the SDP
offer.
chan_sip:
- Made set SIPREFERREDBYHDR as inheritable for better chan_pjsip
interoperability.
- The SIPPEER dialplan function no longer supports using a colon as a
delimiter for parameters. The parameters for the function should be
delimited using a comma.
- The SIPCHANINFO dialplan function was deprecated and has been removed. Users
of the function should use the CHANNEL function instead.
- Added a 'force_avp' option for chan_sip. When enabled this option will
cause the media transport in the offer or answer SDP to be 'RTP/AVP',
'RTP/AVPF', 'RTP/SAVP', or 'RTP/SAVPF' even if a DTLS stream has been
configured. This option can be set to improve interoperability with WebRTC
clients that don't use the RFC defined transport for DTLS.
- The 'dtlsverify' option in chan_sip now has additional values besides
'yes' and 'no'. If 'yes' is specified both the certificate and fingerprint
will be verified. If 'no' is specified then neither the certificate or
fingerprint is verified. If 'certificate' is specified then only the
certificate is verified. If 'fingerprint' is specified then only the
fingerprint is verified.
- A 'dtlsfingerprint' option has been added to chan_sip which allows the
hash to be specified for the DTLS fingerprint placed in SDP. Supported
values are 'sha-1' and 'sha-256' with 'sha-256' being the default.
- The 'progressinband=never' option is now more zealous in the persecution of
progress messages coming from Asterisk. Channels bridged with a SIP channel
that has 'progressinband=never' set will not be able to forward their
progress indications through to the SIP device. chan_sip will now turn such
progress indications into a 180 Ringing (if a 180 has not yet been
transmitted) if 'progressinband=never'.
- The codec preference order in an SDP during an offer is slightly different
than previous releases. Prior to Asterisk 13, the preference order of
codecs used to be:
(1) Our preferred codec
(2) Our configured codecs
(3) Any non-audio joint codecs
One of the ways the new media format architecture in Asterisk 13 improves
performance is by reference counting formats, such that they can be reused
in many places without additional allocation. To not require a large
amount of locking, an instance of a format is immutable by convention.
This works well except for formats with attributes. Since a media format
with an attribute is a different object than the same format without an
attribute, we have to carry over the formats with attributes from an
inbound offer so that the correct attributes are offered in an outgoing
INVITE request. This requires some subtle tweaks to the preference order
to ensure that the media format with attributes is offered to a remote
peer, as opposed to the same media format (but without attributes) that
may be stored in the peer object.
All of this means that our offer offer list will now be:
(1) Our preferred codec
(2) Any joint codecs offered by the inbound offer
(3) All other codecs that are not the preferred codec and not a joint
codec offered by the inbound offer
chan_unistim:
- The unistim.conf 'dateformat' has changed meaning of options values to conform
values used inside Unistim protocol
- Added 'dtmf_duration' option with changing default operation to disable
receivied dtmf playback on unistim phone
Core:
Account Codes:
- accountcode behavior changed somewhat to add functional peeraccount
support. The main change is that local channels now cross accountcode
and peeraccount across the special bridge between the ;1 and ;2 channels
just like channels between normal bridges. See the CHANGES file for
more information.
ARI:
- The ARI version has been changed to 1.5.0. This is to reflect backwards
compatible changes made since 12.0.0 was released.
- Added a new ARI resource 'mailboxes' which allows the creation and
modification of mailboxes managed by external MWI. Modules res_mwi_external
and res_stasis_mailbox must be enabled to use this resource.
- Added new events for externally initiated transfers. The event
BridgeBlindTransfer is now raised when a channel initiates a blind transfer
of a bridge in the ARI controlled application to the dialplan; the
BridgeAttendedTransfer event is raised when a channel initiates an
attended transfer of a bridge in the ARI controlled application to the
dialplan.
- Channel variables may now be specified as a body parameter to the
POST /channels operation. The 'variables' key in the JSON is interpreted
as a sequence of key/value pairs that will be added to the created channel
as channel variables. Other parameters in the JSON body are treated as
query parameters of the same name.
- A bug fix in bridge creation has caused a behavioural change in how
subscriptions are created for bridges. A bridge created through ARI, does
not, by itself, have a subscription created for any particular Stasis
application. When a channel in a Stasis application joins a bridge, an
implicit event subscription is created for that bridge as well. Previously,
when a channel left such a bridge, the subscription was leaked; this allowed
for later bridge events to continue to be pushed to the subscribed
applications. That leak has been fixed; as a result, bridge events that were
delivered after a channel left the bridge are no longer delivered. An
application must subscribe to a bridge through the applications resource if
it wishes to receive all events related to a bridge.
AMI:
- The AMI version has been changed to 2.5.0. This is to reflect backwards
compatible changes made since 12.0.0 was released.
- The DialStatus field in the DialEnd event can now have additional values.
This includes ABORT, CONTINUE, and GOTO.
- The res_mwi_external_ami module can, if loaded, provide additional AMI
actions and events that convey MWI state within Asterisk. This includes
the MWIGet, MWIUpdate, and MWIDelete actions, as well as the MWIGet and
MWIGetComplete events that occur in response to an MWIGet action.
- AMI now contains a new class authorization, 'security'. This is used with
the following new events: FailedACL, InvalidAccountID, SessionLimit,
MemoryLimit, LoadAverageLimit, RequestNotAllowed, AuthMethodNotAllowed,
RequestBadFormat, SuccessfulAuth, UnexpectedAddress, ChallengeResponseFailed,
InvalidPassword, ChallengeSent, and InvalidTransport.
- Bridge related events now have two additional fields: BridgeName and
BridgeCreator. BridgeName is a descriptive name for the bridge;
BridgeCreator is the name of the entity that created the bridge. This
affects the following events: ConfbridgeStart, ConfbridgeEnd,
ConfbridgeJoin, ConfbridgeLeave, ConfbridgeRecord, ConfbridgeStopRecord,
ConfbridgeMute, ConfbridgeUnmute, ConfbridgeTalking, BlindTransfer,
AttendedTransfer, BridgeCreate, BridgeDestroy, BridgeEnter, BridgeLeave
- MixMonitor AMI actions now require users to have authorization classes.
* MixMonitor - system
* MixMonitorMute - call or system
* StopMixMonitor - call or system
- Removed the undocumented manager.conf block-sockets option. It interferes with
TCP/TLS inactivity timeouts.
- The response to the PresenceState AMI action has historically contained two
Message keys. The first of these is used as an informative message regarding
the success/failure of the action; the second contains a Presence state
specific message. Having two keys with the same unique name in an AMI
message is cumbersome for some client; hence, the Presence specific Message
has been deprecated. The message will now contain a PresenceMessage key
for the presence specific information; the Message key containing presence
information will be removed in the next major version of AMI.
- The manager.conf 'eventfilter' now takes an "extended" regular expression
instead of a "basic" one.
CDRs:
- The "endbeforehexten" setting now defaults to "yes", instead of "no".
When set to "no", yhis setting will cause a new CDR to be generated when a
channel enters into hangup logic (either the 'h' extension or a hangup
handler subroutine). In general, this is not the preferred default: this
causes extra CDRs to be generated for a channel in many common dialplans.
CLI commands:
- "core show settings" now lists the current console verbosity in addition
to the root console verbosity.
- "core set verbose" has not been able to support the by module verbose
logging levels since verbose logging levels were made per console. That
syntax is now removed and a silence option added in its place.
Logging:
- The 'verbose' setting in logger.conf still takes an optional argument,
specifying the verbosity level for each logging destination. However,
the default is now to once again follow the current root console level.
As a result, using the AMI Command action with "core set verbose" could
again set the root console verbose level and affect the verbose level
logged.
HTTP:
- Added http.conf session_inactivity timer option to close HTTP connections
that aren't doing anything.
- Added support for persistent HTTP connections. To enable persistent
HTTP connections configure the keep alive time between HTTP requests. The
keep alive time between HTTP requests is configured in http.conf with the
session_keep_alive parameter.
Realtime Configuration:
- WARNING: The database migration script that adds the 'extensions' table for
realtime had to be modified due to an error when installing for MySQL. The
'extensions' table's 'id' column was changed to be a primary key. This could
potentially cause a migration problem. If so, it may be necessary to
manually alter the affected table/column to bring it back in line with the
migration scripts.
- New columns have been added to realtime tables for 'support_path' on
ps_registrations and ps_aors and for 'path' on ps_contacts for the new
SIP Path support in chan_pjsip.
- The following new tables have been added for pjsip realtime: 'ps_systems',
'ps_globals', 'ps_tranports', 'ps_registrations'.
- The following columns were added to the 'ps_aors' realtime table:
'maximum_expiration', 'outbound_proxy', and 'support_path'.
- The following columns were added to the 'ps_contacts' realtime table:
'outbound_proxy', 'user_agent', and 'path'.
- New columns have been added to the ps_endpoints realtime table for the
'media_address', 'redirect_method' and 'set_var' options. Also the
'mwi_fromuser' column was renamed to 'mwi_from_user'. A new column
'message_context' was added to let users configure how MESSAGE requests are
routed to the dialplan.
- A new column was added to the 'ps_globals' realtime table for the 'debug'
option.
- PJSIP endpoint columns 'tos_audio' and 'tos_video' have been changed from
yes/no enumerators to string values. 'cos_audio' and 'cos_video' have been
changed from yes/no enumerators to integer values. PJSIP transport column
'tos' has been changed from a yes/no enumerator to a string value. 'cos' has
been changed from a yes/no enumerator to an integer value.
- The 'queues' and 'queue_members' realtime tables have been added to the
config Alembic scripts.
- A new set of Alembic scripts has been added for CDR tables. This will create
a 'cdr' table with the default schema that Asterisk expects.
- A new upgrade script has been added that adds a 'queue_rules' table for
app_queue. Users of app_queue can store queue rules in a database. It is
important to note that app_queue only looks for this table on module load or
module reload; for more information, see the CHANGES file.
Resources:
res_odbc:
- The compatibility setting, allow_empty_string_in_nontext, has been removed.
Empty column values will be stored as empty strings during realtime updates.
res_jabber:
- This module was deprecated and has been removed. Users of this module should
use res_xmpp instead.
res_http_websocket:
- Added a compatibility option to ari.conf, sip.conf, and pjsip.conf
'websocket_write_timeout'. When a websocket connection exists where Asterisk
writes a substantial amount of data to the connected client, and the connected
client is slow to process the received data, the socket may be disconnected.
In such cases, it may be necessary to adjust this value.
Default is 100 ms.
Scripts:
safe_asterisk:
- The safe_asterisk script was previously not installed on top of an existing
version. This caused bug-fixes in that script not to be deployed. If your
safe_asterisk script is customized, be sure to keep your changes. Custom
values for variables should be created in *.sh file(s) inside
ASTETCDIR/startup.d/. See ASTERISK-21965.
- Changed a log message in safe_asterisk and the $NOTIFY mail subject. If
you use tools to parse either of them, update your parse functions
accordingly. The changed strings are:
- "Exited on signal $EXITSIGNAL" => "Asterisk exited on signal $EXITSIGNAL."
- "Asterisk Died" => "Asterisk on $MACHINE died (sig $EXITSIGNAL)"
Utilities:
- The refcounter program has been removed in favor of the refcounter.py script
in contrib/scripts.
===========================================================
===========================================================

View File

@ -1,115 +0,0 @@
===========================================================
===
=== Information for upgrading between Asterisk versions
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also include advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
=== UPGRADE-1.4.txt -- Upgrade info for 1.2 to 1.4
=== UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
=== UPGRADE-1.8.txt -- Upgrade info for 1.6 to 1.8
=== UPGRADE-10.txt -- Upgrade info for 1.8 to 10
=== UPGRADE-11.txt -- Upgrade info for 10 to 11
=== UPGRADE-12.txt -- Upgrade info for 11 to 12
=== UPGRADE-13.txt -- Upgrade info for 12 to 13
===========================================================
From 14.6.0 to 14.7.0:
Core:
- ast_app_parse_timelen now returns an error if it encounters extra characters
at the end of the string to be parsed.
From 14.4.0 to 14.5.0:
Core:
- Support for embedded modules has been removed. This has not worked in
many years. LOADABLE_MODULES menuselect option is also removed as
loadable module support is now always enabled.
From 14.3.0 to 14.4.0:
res_rtp_asterisk:
- The RTP layer of Asterisk now has support for RFC 5761: "Multiplexing RTP
Data and Control Packets on a Single Port." For the PJSIP channel driver,
chan_pjsip, you can set "rtcp_mux = yes" on a PJSIP endpoint in pjsip.conf
to enable the feature. For chan_sip you can set "rtcp_mux = yes" either
globally or on a per-peer basis in sip.conf.
New in 14.0.0
ARI:
- The policy for when to send "Dial" events has changed. Previously, "Dial"
events were sent on the calling channel's topic. However, starting in Asterisk
14, if there is no calling channel on which to send the event, the event is
instead sent on the called channel's topic. Note that for the ARI channels
resource's dial operation, this means that the "Dial" events will always be
sent on the called channel's topic.
Channel Drivers:
chan_dahdi:
- For users using the FXO port (FXS signaling) distinctive ring detection
feature, you will need to adjust the dringX count values. The count
values now only record ring end events instead of any DAHDI event. A
ring-ring-ring pattern would exceed the pattern limits and stop
Caller-ID detection.
chan_sip:
- The SIP dial string has been extended past the [!dnid] option by another
exclamation mark: [!dnid[!fromuri]. An exclamation mark in the To-URI
will now mean changes to the From-URI.
Core:
- The REF_DEBUG compiler flag is now used to enable refdebug by default.
The setting can be overridden in asterisk.conf by setting refdebug in
the options category. No recompile is required to enable/disable it.
- Modified processing of command-line options to first parse only what
is necessary to read asterisk.conf. Once asterisk.conf is fully loaded,
the remaining options are processed. The -X option now applies to
asterisk.conf only. To enable #exec for other config files you must
set execincludes=yes in asterisk.conf. Any other option set on the
command-line will now override the equivalent setting from asterisk.conf.
AMI:
- The 'ModuleCheck' Action's Version key will no longer show the module
version. The value will always be blank.
CLI:
- The 'core show file version' command has been removed. When Asterisk
moved to Git, the source control version support was removed. As a
result, the CLi command was no longer useful and was removed as well.
Logging:
- The first callid created is now 1 instead of 0. The value 0
is now reserved to represent a lack of callid.
AMI:
- The Command action now sends the output from the CLI command as a series
of Output headers for each line instead of as a block of text with the
--END COMMAND-- delimiter to match the output from other actions.
Commands that fail to execute (no such command, invalid syntax etc.) now
return an Error response instead of Success.
app_amd:
- The 'maximum_number_of_words' configuration option and parameter to the AMD
application previously did not match the documented functionality + variable
name. In Asterisk 13, a value of '3' would mean that if '3' words were detected,
the result would be detection as a 'MACHINE'. As of this version, the value
reflects the maximum words that if EXCEEDED (rather than reached), would
result in detection as a machine. This means that you should update this
value to be one higher than your previos value, if your previous value
was working well for you.
===========================================================
===========================================================

View File

@ -1,63 +0,0 @@
===========================================================
===
=== Information for upgrading between Asterisk versions
===
=== These files document all the changes that MUST be taken
=== into account when upgrading between the Asterisk
=== versions listed below. These changes may require that
=== you modify your configuration files, dialplan or (in
=== some cases) source code if you have your own Asterisk
=== modules or patches. These files also include advance
=== notice of any functionality that has been marked as
=== 'deprecated' and may be removed in a future release,
=== along with the suggested replacement functionality.
===
=== UPGRADE-1.2.txt -- Upgrade info for 1.0 to 1.2
=== UPGRADE-1.4.txt -- Upgrade info for 1.2 to 1.4
=== UPGRADE-1.6.txt -- Upgrade info for 1.4 to 1.6
=== UPGRADE-1.8.txt -- Upgrade info for 1.6 to 1.8
=== UPGRADE-10.txt -- Upgrade info for 1.8 to 10
=== UPGRADE-11.txt -- Upgrade info for 10 to 11
=== UPGRADE-12.txt -- Upgrade info for 11 to 12
=== UPGRADE-13.txt -- Upgrade info for 12 to 13
=== UPGRADE-14.txt -- Upgrade info for 13 to 14
===========================================================
From 15.2.0 to 15.3.0:
res_pjsip
------------------
* Users who are matching endpoints by SIP header need to reevaluate their
global "endpoint_identifier_order" option in light of the "ip" endpoint
identifier method split into the "ip" and "header" endpoint identifier
methods.
res_pjsip_endpoint_identifier_ip
------------------
* The endpoint identifier "ip" method previously recognized endpoints either
by IP address or a matching SIP header. The "ip" endpoint identifier method
is now split into the "ip" and "header" endpoint identifier methods. The
"ip" endpoint identifier method only matches by IP address and the "header"
endpoint identifier method only matches by SIP header. The split allows the
user to control the relative priority of the IP address and the SIP header
identification methods in the global "endpoint_identifier_order" option.
e.g., If you have two type=identify sections where one matches by IP address
for endpoint alice and the other matches by SIP header for endpoint bob then
you can now predict which endpoint is matched when a request comes in that
matches both.
New in 15.0.0:
Build System:
- '--with-pjproject-bundled' is now the default when running ./configure
It can be disabled with '--without-pjproject-bundled'.
Core:
- Multi-stream support has been added so a channel can have multiple
streams of the same type such as audio and video.
- The 'Data Retrieval API' has been removed. This API was not actively
maintained, was not added to new modules (such as res_pjsip), and there
exist better alternatives to acquire the same information, such as the
ARI. As a result, the 'DataGet' AMI action as well as the 'data get'
CLI command have been removed.

File diff suppressed because it is too large Load Diff

View File

@ -64,6 +64,10 @@ chan_ooh323.so: _ASTCFLAGS+=$(H323CFLAGS)
$(call MOD_ADD_C,chan_ooh323,$(H323SOURCE))
ifneq ($(wildcard mp3/Makefile),)
# At the current time, the fate of mp3 is in flux so it didn't make sense to
# add configure/makeopts processing for array-bounds since this is the only
# source file that needs that warning suppressed.
mp3/layer3.o: _ASTCFLAGS+=-Wno-array-bounds
$(call MOD_ADD_C,format_mp3,mp3/common.c mp3/dct64_i386.c mp3/decode_ntom.c mp3/layer3.c mp3/tabinit.c mp3/interface.c)
.PHONY: check_mp3

View File

@ -37,6 +37,8 @@
<defaultenabled>no</defaultenabled>
<support_level>deprecated</support_level>
<replacement>func_odbc</replacement>
<deprecated_in>1.8</deprecated_in>
<removed_in>19</removed_in>
***/
#include "asterisk.h"

View File

@ -38,6 +38,8 @@
<defaultenabled>no</defaultenabled>
<support_level>deprecated</support_level>
<replacement>cdr_adaptive_odbc</replacement>
<deprecated_in>1.8</deprecated_in>
<removed_in>19</removed_in>
***/
#include "asterisk.h"
@ -173,7 +175,9 @@ static int mysql_log(struct ast_cdr *cdr)
{
struct ast_str *sql1 = ast_str_thread_get(&sql1_buf, 1024), *sql2 = ast_str_thread_get(&sql2_buf, 1024);
int retries = 5;
#if MYSQL_VERSION_ID >= 50013
#ifdef HAVE_MYSQLCLIENT_BOOL
bool my_bool_true = 1;
#elif HAVE_MYSQLCLIENT_MY_BOOL
my_bool my_bool_true = 1;
#endif
@ -382,6 +386,13 @@ static int my_unload_module(int reload)
{
struct column *entry;
if (!reload) {
if (ast_cdr_unregister(name)) {
/* If we can't unregister the backend, we can't unload the module */
return -1;
}
}
ast_cli_unregister_multiple(cdr_mysql_status_cli, sizeof(cdr_mysql_status_cli) / sizeof(struct ast_cli_entry));
if (connected) {
@ -406,7 +417,8 @@ static int my_unload_module(int reload)
if (reload) {
return ast_cdr_backend_suspend(name);
} else {
return ast_cdr_unregister(name);
/* We unregistered earlier */
return 0;
}
}
@ -460,7 +472,9 @@ static int my_connect_db(struct ast_config *cfg)
MYSQL_ROW row;
MYSQL_RES *result;
char sqldesc[128];
#if MYSQL_VERSION_ID >= 50013
#ifdef HAVE_MYSQLCLIENT_BOOL
bool my_bool_true = 1;
#elif HAVE_MYSQLCLIENT_MY_BOOL
my_bool my_bool_true = 1;
#endif

View File

@ -102,7 +102,7 @@ struct adapter_pvt {
char id[31]; /* the 'name' from mobile.conf */
bdaddr_t addr; /* adddress of adapter */
unsigned int inuse:1; /* are we in use ? */
unsigned int alignment_detection:1; /* do alignment detection on this adpater? */
unsigned int alignment_detection:1; /* do alignment detection on this adapter? */
struct io_context *io; /*!< io context for audio connections */
struct io_context *accept_io; /*!< io context for sco listener */
int *sco_id; /*!< the io context id of the sco listener socket */
@ -132,7 +132,8 @@ struct mbl_pvt {
int rfcomm_socket; /* rfcomm socket descriptor */
char rfcomm_buf[256];
char io_buf[CHANNEL_FRAME_SIZE + AST_FRIENDLY_OFFSET];
struct ast_smoother *smoother; /* our smoother, for making 48 byte frames */
struct ast_smoother *bt_out_smoother; /* our bt_out_smoother, for making 48 byte frames */
struct ast_smoother *bt_in_smoother; /* our smoother, for making "normal" CHANNEL_FRAME_SIZEed byte frames */
int sco_socket; /* sco socket descriptor */
pthread_t monitor_thread; /* monitor thread handle */
int timeout; /*!< used to set the timeout for rfcomm data (may be used in the future) */
@ -856,7 +857,8 @@ static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, struct cidinf
else
pvt->do_alignment_detection = 0;
ast_smoother_reset(pvt->smoother, DEVICE_FRAME_SIZE);
ast_smoother_reset(pvt->bt_out_smoother, DEVICE_FRAME_SIZE);
ast_smoother_reset(pvt->bt_in_smoother, CHANNEL_FRAME_SIZE);
ast_dsp_digitreset(pvt->dsp);
chn = ast_channel_alloc(1, state,
@ -1131,23 +1133,27 @@ static struct ast_frame *mbl_read(struct ast_channel *ast)
pvt->fr.delivery.tv_usec = 0;
pvt->fr.data.ptr = pvt->io_buf + AST_FRIENDLY_OFFSET;
if ((r = read(pvt->sco_socket, pvt->fr.data.ptr, DEVICE_FRAME_SIZE)) == -1) {
if (errno != EAGAIN && errno != EINTR) {
ast_debug(1, "[%s] read error %d, going to wait for new connection\n", pvt->id, errno);
close(pvt->sco_socket);
pvt->sco_socket = -1;
ast_channel_set_fd(ast, 0, -1);
do {
if ((r = read(pvt->sco_socket, pvt->fr.data.ptr, DEVICE_FRAME_SIZE)) == -1) {
if (errno != EAGAIN && errno != EINTR) {
ast_debug(1, "[%s] read error %d, going to wait for new connection\n", pvt->id, errno);
close(pvt->sco_socket);
pvt->sco_socket = -1;
ast_channel_set_fd(ast, 0, -1);
}
goto e_return;
}
goto e_return;
}
pvt->fr.datalen = r;
pvt->fr.samples = r / 2;
pvt->fr.datalen = r;
pvt->fr.samples = r / 2;
if (pvt->do_alignment_detection)
do_alignment_detection(pvt, pvt->fr.data.ptr, r);
if (pvt->do_alignment_detection)
do_alignment_detection(pvt, pvt->fr.data.ptr, r);
fr = ast_dsp_process(ast, pvt->dsp, &pvt->fr);
ast_smoother_feed(pvt->bt_in_smoother, &pvt->fr);
fr = ast_smoother_read(pvt->bt_in_smoother);
} while (fr == NULL);
fr = ast_dsp_process(ast, pvt->dsp, fr);
ast_mutex_unlock(&pvt->lock);
@ -1174,9 +1180,9 @@ static int mbl_write(struct ast_channel *ast, struct ast_frame *frame)
CHANNEL_DEADLOCK_AVOIDANCE(ast);
}
ast_smoother_feed(pvt->smoother, frame);
ast_smoother_feed(pvt->bt_out_smoother, frame);
while ((f = ast_smoother_read(pvt->smoother))) {
while ((f = ast_smoother_read(pvt->bt_out_smoother))) {
sco_write(pvt->sco_socket, f->data.ptr, f->datalen);
}
@ -2000,7 +2006,7 @@ static int at_match_prefix(char *buf, char *prefix)
}
/*!
* \brief Read an AT message and clasify it.
* \brief Read an AT message and classify it.
* \param rsock an rfcomm socket
* \param buf the buffer to store the result in
* \param count the size of the buffer or the maximum number of characters to read
@ -2150,10 +2156,12 @@ static inline const char *at_msg2str(at_message_t msg)
* \param buf the buffer to parse (null terminated)
* \return -1 on error (parse error) or a ECAM value on success
*
* Example string: *ECAV: <ccid>,<ccstatus>,<calltype>[,<processid>]
* [,exitcause][,<number>,<type>]
* Example:
* \verbatim *ECAV: <ccid>,<ccstatus>,<calltype>[,<processid>]
[,exitcause][,<number>,<type>] \endverbatim
*
* Example indicating busy: *ECAV: 1,7,1
* Example indicating busy:
* \verbatim *ECAV: 1,7,1 \endverbatim
*/
static int hfp_parse_ecav(struct hfp_pvt *hfp, char *buf)
{
@ -2170,7 +2178,7 @@ static int hfp_parse_ecav(struct hfp_pvt *hfp, char *buf)
}
/*!
* \brief Enable Sony Erricson extensions / indications.
* \brief Enable Sony Ericsson extensions / indications.
* \param hfp an hfp_pvt struct
*/
static int hfp_send_ecam(struct hfp_pvt *hfp)
@ -3034,7 +3042,7 @@ static void msg_queue_free_and_pop(struct mbl_pvt *pvt)
}
/*!
* \brief Remove all itmes from the queue and free them.
* \brief Remove all items from the queue and free them.
* \param pvt a mbl_pvt structure
*/
static void msg_queue_flush(struct mbl_pvt *pvt)
@ -3341,7 +3349,7 @@ static int handle_response_ok(struct mbl_pvt *pvt, char *buf)
}
break;
case AT_CLIP:
ast_debug(1, "[%s] caling line indication enabled\n", pvt->id);
ast_debug(1, "[%s] calling line indication enabled\n", pvt->id);
if (hfp_send_ecam(pvt->hfp) || msg_queue_push(pvt, AT_OK, AT_ECAM)) {
ast_debug(1, "[%s] error enabling Sony Ericsson call monitoring extensions\n", pvt->id);
goto e_return;
@ -3561,7 +3569,7 @@ static int handle_response_ciev(struct mbl_pvt *pvt, char *buf)
if (pvt->owner) {
ast_debug(1, "[%s] hanging up owner\n", pvt->id);
if (mbl_queue_hangup(pvt)) {
ast_log(LOG_ERROR, "[%s] error queueing hangup, disconnectiong...\n", pvt->id);
ast_log(LOG_ERROR, "[%s] error queueing hangup, disconnecting...\n", pvt->id);
return -1;
}
}
@ -3595,7 +3603,7 @@ static int handle_response_ciev(struct mbl_pvt *pvt, char *buf)
handle_response_busy(pvt);
}
if (mbl_queue_hangup(pvt)) {
ast_log(LOG_ERROR, "[%s] error queueing hangup, disconnectiong...\n", pvt->id);
ast_log(LOG_ERROR, "[%s] error queueing hangup, disconnecting...\n", pvt->id);
return -1;
}
}
@ -4425,7 +4433,7 @@ static struct adapter_pvt *mbl_load_adapter(struct ast_config *cfg, const char *
/* bind the sco listener socket */
if (sco_bind(adapter) < 0) {
ast_log(LOG_ERROR, "Skipping adapter %s. Error binding audio connection listerner socket.\n", adapter->id);
ast_log(LOG_ERROR, "Skipping adapter %s. Error binding audio connection listener socket.\n", adapter->id);
goto e_destroy_io;
}
@ -4437,7 +4445,7 @@ static struct adapter_pvt *mbl_load_adapter(struct ast_config *cfg, const char *
/* start the sco listener for this adapter */
if (ast_pthread_create_background(&adapter->sco_listener_thread, NULL, do_sco_listen, adapter)) {
ast_log(LOG_ERROR, "Skipping adapter %s. Error creating audio connection listerner thread.\n", adapter->id);
ast_log(LOG_ERROR, "Skipping adapter %s. Error creating audio connection listener thread.\n", adapter->id);
goto e_remove_sco;
}
@ -4493,7 +4501,7 @@ static struct mbl_pvt *mbl_load_device(struct ast_config *cfg, const char *cat)
}
AST_RWLIST_UNLOCK(&adapters);
if (!adapter) {
ast_log(LOG_ERROR, "Skiping device %s. Unknown adapter '%s' specified.\n", cat, adapter_str);
ast_log(LOG_ERROR, "Skipping device %s. Unknown adapter '%s' specified.\n", cat, adapter_str);
goto e_return;
}
@ -4530,16 +4538,22 @@ static struct mbl_pvt *mbl_load_device(struct ast_config *cfg, const char *cat)
pvt->ring_sched_id = -1;
pvt->has_sms = 1;
/* setup the smoother */
if (!(pvt->smoother = ast_smoother_new(DEVICE_FRAME_SIZE))) {
ast_log(LOG_ERROR, "Skipping device %s. Error setting up frame smoother.\n", cat);
/* setup the bt_out_smoother */
if (!(pvt->bt_out_smoother = ast_smoother_new(DEVICE_FRAME_SIZE))) {
ast_log(LOG_ERROR, "Skipping device %s. Error setting up frame bt_out_smoother.\n", cat);
goto e_free_pvt;
}
/* setup the bt_in_smoother */
if (!(pvt->bt_in_smoother = ast_smoother_new(CHANNEL_FRAME_SIZE))) {
ast_log(LOG_ERROR, "Skipping device %s. Error setting up frame bt_in_smoother.\n", cat);
goto e_free_bt_out_smoother;
}
/* setup the dsp */
if (!(pvt->dsp = ast_dsp_new())) {
ast_log(LOG_ERROR, "Skipping device %s. Error setting up dsp for dtmf detection.\n", cat);
goto e_free_smoother;
goto e_free_bt_in_smoother;
}
/* setup the scheduler */
@ -4599,8 +4613,10 @@ e_free_sched:
ast_sched_context_destroy(pvt->sched);
e_free_dsp:
ast_dsp_free(pvt->dsp);
e_free_smoother:
ast_smoother_free(pvt->smoother);
e_free_bt_in_smoother:
ast_smoother_free(pvt->bt_in_smoother);
e_free_bt_out_smoother:
ast_smoother_free(pvt->bt_out_smoother);
e_free_pvt:
ast_free(pvt);
e_return:
@ -4732,7 +4748,8 @@ static int unload_module(void)
ast_free(pvt->hfp);
}
ast_smoother_free(pvt->smoother);
ast_smoother_free(pvt->bt_out_smoother);
ast_smoother_free(pvt->bt_in_smoother);
ast_dsp_free(pvt->dsp);
ast_sched_context_destroy(pvt->sched);
ast_free(pvt);

View File

@ -82,7 +82,7 @@
/* Defaults */
#define DEFAULT_CONTEXT "default"
#define DEFAULT_H323ID "Asterisk PBX"
#define DEFAULT_LOGFILE "/var/log/asterisk/h323_log"
#define DEFAULT_LOGFILE "h323_log"
#define DEFAULT_H323ACCNT "ast_h323"
/* Flags */
@ -346,7 +346,8 @@ void onModeChanged(ooCallData *call, int t38mode);
extern OOH323EndPoint gH323ep;
static char gLogFile[256] = DEFAULT_LOGFILE;
static char gLogFile[PATH_MAX] = DEFAULT_LOGFILE;
static char gInitError[256] = "";
static int gPort = 1720;
static char gIP[2+8*4+7]; /* Max for IPv6 addr */
struct ast_sockaddr bindaddr;
@ -2059,7 +2060,7 @@ int onOutgoingCall(ooCallData *call)
}
ooCallAddAliasDialedDigits(call, p->caller_dialedDigits);
} else if (!ast_strlen_zero(p->callerid_num)) {
if (ooIsDailedDigit(p->callerid_num)) {
if (ooIsDialedDigit(p->callerid_num)) {
if (gH323Debug) {
ast_verb(0, "setting callid number %s\n", p->callerid_num);
}
@ -2140,7 +2141,7 @@ int onNewCallCreated(ooCallData *call)
}
ooCallAddAliasDialedDigits(call, p->caller_dialedDigits);
} else if (!ast_strlen_zero(p->callerid_num)) {
if (ooIsDailedDigit(p->callerid_num)) {
if (ooIsDialedDigit(p->callerid_num)) {
if (gH323Debug) {
ast_verb(0, "setting callid number %s\n", p->callerid_num);
}
@ -2152,7 +2153,7 @@ int onNewCallCreated(ooCallData *call)
if (!ast_strlen_zero(p->exten)) {
if (ooIsDailedDigit(p->exten)) {
if (ooIsDialedDigit(p->exten)) {
ooCallSetCalledPartyNumber(call, p->exten);
ooCallAddRemoteAliasDialedDigits(call, p->exten);
} else {
@ -2856,7 +2857,7 @@ int reload_config(int reload)
}
/* Inintialize everything to default */
strcpy(gLogFile, DEFAULT_LOGFILE);
snprintf(gLogFile, sizeof(gLogFile), "%s/%s", ast_config_AST_LOG_DIR, DEFAULT_LOGFILE);
gPort = 1720;
gIP[0] = '\0';
strcpy(gCallerID, DEFAULT_H323ID);
@ -3034,7 +3035,11 @@ int reload_config(int reload)
ast_copy_string(gRASIP, v->value, sizeof(gRASIP));
ast_verb(3, " == Setting RAS IP to %s\n", gRASIP);
} else if (!strcasecmp(v->name, "logfile")) {
ast_copy_string(gLogFile, v->value, sizeof(gLogFile));
if (v->value[0] == '/') {
ast_copy_string(gLogFile, v->value, sizeof(gLogFile));
} else {
snprintf(gLogFile, sizeof(gLogFile), "%s/%s", ast_config_AST_LOG_DIR, v->value);
}
} else if (!strcasecmp(v->name, "context")) {
ast_copy_string(gContext, v->value, sizeof(gContext));
ast_verb(3, " == Setting default context to %s\n", gContext);
@ -3838,9 +3843,9 @@ static int load_module(void)
if (!reload_config(0)) {
/* fire up the H.323 Endpoint */
if (OO_OK != ooH323EpInitialize(OO_CALLMODE_AUDIOCALL, gLogFile)) {
ast_log(LOG_ERROR, "Failed to initialize OOH323 endpoint-"
"OOH323 Disabled\n");
if (OO_OK != ooH323EpInitialize(OO_CALLMODE_AUDIOCALL, gLogFile, gInitError, sizeof(gInitError))) {
ast_log(LOG_ERROR, "Failed to initialize OOH323 endpoint: %s"
"OOH323 Disabled\n", gInitError);
ao2_ref(gCap, -1);
gCap = NULL;
ao2_ref(ooh323_tech.capabilities, -1);

View File

@ -65,6 +65,7 @@
#include "asterisk/udptl.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/format_cache.h"
#include "asterisk/paths.h"
#include "ootypes.h"
#include "ooUtils.h"

View File

@ -75,7 +75,7 @@ To run the stack test application chansetup
3. For running calling instance
./h323peer [--use-ip ip] -n <number of calls> -duration <call duration>
-interval <inetrval between successive calls> destination
-interval <interval between successive calls> destination
where all times are in seconds. Interval of 0 means next call will be placed
after current call finishes. "destination" is the dotted ip address of the

View File

@ -417,7 +417,7 @@ int decodeDynBitString (OOCTXT* pctxt, ASN1DynBitStr* pBitStr)
ASN1OCTET* ptmp;
int nbits, stat = ASN_OK;
/* If "fast copy" option is not set (ASN1FATSCOPY) or if constructed,
/* If "fast copy" option is not set (ASN1FASTCOPY) or if constructed,
* copy the bit string value into a dynamic memory buffer;
* otherwise, store the pointer to the value in the decode
* buffer in the data pointer argument. */
@ -737,6 +737,10 @@ static int decodeOctets
nbits -= 8;
}
if (nbits <= 0) {
return ASN_OK;
}
/* Copy last partial byte */
if (nbits >= rshift) {
@ -752,7 +756,7 @@ static int decodeOctets
pctxt->buffer.bitOffset = 8 - nbitsInLastOctet;
}
else if (nbits > 0) { /* nbits < rshift */
else { /* nbits > 0 && nbits < rshift */
pbuffer[i] =
pctxt->buffer.data[pctxt->buffer.byteIndex] << lshift;
pctxt->buffer.bitOffset = rshift - nbits;
@ -832,8 +836,8 @@ int decodeOpenType
int decodeSemiConsInteger (OOCTXT* pctxt, ASN1INT* pvalue, ASN1INT lower)
{
signed char b;
unsigned char ub;
signed char b = 0;
unsigned char ub = 0;
ASN1UINT nbytes;
int stat;

View File

@ -1007,7 +1007,7 @@ int encode2sCompBinInt (OOCTXT* pctxt, ASN1INT value)
{
/* 10.4.6 A minimum octet 2's-complement-binary-integer encoding */
/* of the whole number has a field width that is a multiple of 8 */
/* bits and also satisifies the condition that the leading 9 bits */
/* bits and also satisfies the condition that the leading 9 bits */
/* field shall not be all zeros and shall not be all ones. */
/* first encode integer value into a local buffer */
@ -1048,7 +1048,7 @@ static int encodeNonNegBinInt (OOCTXT* pctxt, ASN1UINT value)
/* 10.3.6 A minimum octet non-negative binary integer encoding of */
/* the whole number (which does not predetermine the number of */
/* octets to be used for the encoding) has a field which is a */
/* multiple of 8 bits and also satisifies the condition that the */
/* multiple of 8 bits and also satisfies the condition that the */
/* leading eight bits of the field shall not be zero unless the */
/* field is precisely 8 bits long. */

View File

@ -49,7 +49,7 @@ extern "C" {
* SEQUENCE OF, SET OF, or CHOICE construct is parsed.
*
* @param name For SEQUENCE, SET, or CHOICE, this is the name of the
* element as defined in the ASN.1 defination. For
* element as defined in the ASN.1 definition. For
* SEQUENCE OF or SET OF, this is set to the name
* "element".
* @param index For SEQUENCE, SET, or CHOICE, this is not used and is
@ -68,7 +68,7 @@ typedef void (*StartElement) (const char* name, int index) ;
* SEQUENCE, SET, SEQUENCE OF, SET OF, or CHOICE construct.
*
* @param name For SEQUENCE, SET, or CHOICE, this is the name of the
* element as defined in the ASN.1 defination. For
* element as defined in the ASN.1 definition. For
* SEQUENCE OF or SET OF, this is set to the name
* "element".
* @param index For SEQUENCE, SET, or CHOICE, this is not used and is
@ -194,7 +194,7 @@ typedef void (*EnumValue) (ASN1UINT value) ;
* within a decode function when an ASN.1 open type is parsed.
*
* @param numocts Number of octets in the parsed value.
* @param data Pointer to byet array contain in tencoded ASN.1
* @param data Pointer to byte array contain in tencoded ASN.1
* value.
* @return - none
*/

View File

@ -1926,7 +1926,7 @@ typedef struct EXTERN H225SecurityCapabilities {
} m;
H225NonStandardParameter nonStandard;
H225SecurityServiceMode encryption;
H225SecurityServiceMode authenticaton;
H225SecurityServiceMode authentication;
H225SecurityServiceMode integrity;
} H225SecurityCapabilities;

View File

@ -6357,14 +6357,14 @@ EXTERN int asn1PD_H225SecurityCapabilities (OOCTXT* pctxt, H225SecurityCapabilit
invokeEndElement (pctxt, "encryption", -1);
/* decode authenticaton */
/* decode authentication */
invokeStartElement (pctxt, "authenticaton", -1);
invokeStartElement (pctxt, "authentication", -1);
stat = asn1PD_H225SecurityServiceMode (pctxt, &pvalue->authenticaton);
stat = asn1PD_H225SecurityServiceMode (pctxt, &pvalue->authentication);
if (stat != ASN_OK) return stat;
invokeEndElement (pctxt, "authenticaton", -1);
invokeEndElement (pctxt, "authentication", -1);
/* decode integrity */

View File

@ -4408,9 +4408,9 @@ EXTERN int asn1PE_H225SecurityCapabilities (OOCTXT* pctxt, H225SecurityCapabilit
stat = asn1PE_H225SecurityServiceMode (pctxt, &pvalue->encryption);
if (stat != ASN_OK) return stat;
/* encode authenticaton */
/* encode authentication */
stat = asn1PE_H225SecurityServiceMode (pctxt, &pvalue->authenticaton);
stat = asn1PE_H225SecurityServiceMode (pctxt, &pvalue->authentication);
if (stat != ASN_OK) return stat;
/* encode integrity */

View File

@ -265,7 +265,7 @@ void* memHeapAlloc (void** ppvMemHeap, int nbytes)
if (nunits <= (ASN1UINT)pElem_nunits (pElem)) {
RTMEMDIAG3
("memHeapAlloc: "
"found an exisiting free element 0x%x, size %d\n",
"found an existing free element 0x%x, size %d\n",
pElem, (pElem_nunits (pElem) * 8u));
if (pMemBlk->freeElemOff ==
@ -373,7 +373,7 @@ void* memHeapAlloc (void** ppvMemHeap, int nbytes)
CHECKMEMBLOCK (pMemHeap, pMemBlk);
}
else {
ast_mutex_unlock(&pMemHeap->pLock);
ast_mutex_unlock(&pMemHeap->pLock);
return NULL;
}
}
@ -753,9 +753,10 @@ void* memHeapRealloc (void** ppvMemHeap, void* mem_p, int nbytes_)
if (newMemBlk == 0)
return 0;
pMemLink->pMemBlk = newMemBlk;
}
else
}
else {
return 0;
}
*(int*)(((char*)pMemLink) + sizeof (OSMemLink)) = nbytes_;
return pMemLink->pMemBlk;
}
@ -1132,7 +1133,7 @@ void* memHeapMarkSaved (void** ppvMemHeap, const void* mem_p,
RTMEMDIAG2 ("memHeapMarkSaved: the element 0x%x is "
"already free!\n", pElem);
ast_mutex_unlock(&pMemHeap->pLock);
ast_mutex_unlock(&pMemHeap->pLock);
return 0;
}
@ -1151,9 +1152,10 @@ void* memHeapMarkSaved (void** ppvMemHeap, const void* mem_p,
CLEAR_SAVED (pMemBlk, pElem);
nsaved = pMemBlk->nsaved;
}
else
ast_mutex_unlock(&pMemHeap->pLock);
return 0;
else {
ast_mutex_unlock(&pMemHeap->pLock);
}
return 0;
}
if (saved && nsaved > 0)
pMemLink->blockType |= RTMEMSAVED;
@ -1212,7 +1214,7 @@ static OSMemLink* memHeapAddBlock (OSMemLink** ppMemLink,
/* if pMemBlk has RTMEMLINK flags it means that it is allocated
* cooperatively with OSMemLink, and we don't need to do additional
* allocations for it. Just use pointer's arithemtic. */
* allocations for it. Just use pointer's arithmetic. */
if (blockType & RTMEMLINK)
pMemLink = (OSMemLink*) (((ASN1OCTET*)pMemBlk) - sizeof (OSMemLink));

View File

@ -783,7 +783,7 @@ OOH323CallData* ooFindCallByToken(const char *callToken)
/* Checks whether session with suplied ID and direction is already active*/
/* Checks whether session with supplied ID and direction is already active*/
ASN1BOOL ooIsSessionEstablished(OOH323CallData *call, int sessionID, char* dir)
{
OOLogicalChannel * temp = NULL;

View File

@ -294,7 +294,7 @@ EXTERN int ooCapabilityDisableDTMFQ931Keypad(struct OOH323CallData *call);
* and txframes parameters to the endpoint or call.(ex. G711, G728, G723.1,
* G729)
* @param call Handle to a call. If this is not Null, then
* capability is added to call's remote enpoint
* capability is added to call's remote endpoint
* capability list, else it is added to local H323
* endpoint list.
* @param cap Type of G711 capability to be added.
@ -326,7 +326,7 @@ EXTERN int ooCapabilityAddSimpleCapability
* to local endpoints capability list or to remote endpoints capability list or
* to a call's capability list.
* @param call Handle to a call. If this is not Null, then
* capability is added to call's remote enpoint
* capability is added to call's remote endpoint
* capability list, else it is added to local H323
* endpoint list.
* @param cap Type of GSM capability to be added.
@ -357,7 +357,7 @@ int ooCapabilityAddGSMCapability(struct OOH323CallData *call, int cap,
* capability list or to remote endpoints capability list or to a call's
* capability list.
* @param call Handle to a call. If this is not Null, then
* capability is added to call's remote enpoint
* capability is added to call's remote endpoint
* capability list, else it is added to local H323
* endpoint list.
* @param sqcifMPI Minimum picture interval for encoding/decoding
@ -396,7 +396,7 @@ EXTERN int ooCapabilityAddH263VideoCapability(struct OOH323CallData *call,
/**
* This function is an helper function to ooCapabilityAddH263VideoCapability.
* @param call Handle to a call. If this is not Null, then
* capability is added to call's remote enpoint
* capability is added to call's remote endpoint
* capability list, else it is added to local H323
* endpoint list.
* @param sqcifMPI Minimum picture interval for encoding/decoding
@ -717,11 +717,11 @@ EXTERN int ooAppendCapToCapPrefs(struct OOH323CallData *call, int cap);
EXTERN int ooChangeCapPrefOrder(struct OOH323CallData *call, int cap, int pos);
/**
* This function is used to preppend a particular capability to preference
* This function is used to prepend a particular capability to preference
* list.
* @param call Handle to call, if call's preference list has to be modified
* else NULL, to modify endpoint's preference list.
* @param cap Capability to be preppended.
* @param cap Capability to be prepended.
*
* @return OO_OK, on success. OO_FAILED, otherwise.
*/

View File

@ -186,7 +186,7 @@ int ooReadAndProcessStackCommand()
if(!pCall) {
OOTRACEINFO2("Call \"%s\" does not exist\n",
(char*)cmd.param1);
OOTRACEINFO1("Call migth be cleared/closed\n");
OOTRACEINFO1("Call might be cleared/closed\n");
}
else {
ooSendProgress(ooFindCallByToken((char*)cmd.param1));
@ -200,7 +200,7 @@ int ooReadAndProcessStackCommand()
if(!pCall) {
OOTRACEINFO2("Call \"%s\" does not exist\n",
(char*)cmd.param1);
OOTRACEINFO1("Call migth be cleared/closed\n");
OOTRACEINFO1("Call might be cleared/closed\n");
}
else {
ooSendAlerting(ooFindCallByToken((char*)cmd.param1));

View File

@ -1231,7 +1231,7 @@ int ooGkClientHandleRegistrationConfirm
(&pGkClient->ctxt, sizeof(ooGkClientTimerCb));
if(!cbData)
{
OOTRACEERR1("Error:Failed to allocate memory for Regisration timer."
OOTRACEERR1("Error:Failed to allocate memory for Registration timer."
"\n");
pGkClient->state = GkClientFailed;
return OO_FAILED;
@ -1927,7 +1927,7 @@ int ooGkClientSendAdmissionRequest
(&pGkClient->ctxt, sizeof(ooGkClientTimerCb));
if(!cbData)
{
OOTRACEERR1("Error:Failed to allocate memory for Regisration timer."
OOTRACEERR1("Error:Failed to allocate memory for Registration timer."
"\n");
pGkClient->state = GkClientFailed;
ast_mutex_unlock(&pGkClient->Lock);

View File

@ -318,7 +318,7 @@ EXTERN int ooGkClientHandleRASMessage
/**
* This function is used to send a message on Gatekeeper clien't RAS channel.
* This function is used to send a message on Gatekeeper client RAS channel.
* @param pGkClient Handle to the gatekeeper client.
* @param pRasMsg Handle to Ras message to be sent.
*

View File

@ -78,7 +78,7 @@ OOLogicalChannel* ooAddNewLogicalChannel(OOH323CallData *call, int channelNo,
OOTRACEDBGC3("Using configured media info (%s, %s)\n", call->callType,
call->callToken);
pNewChannel->localRtpPort = pMediaInfo->lMediaRedirPort ? pMediaInfo->lMediaRedirPort : pMediaInfo->lMediaPort;
/* check MediaRedirPort here because RedirCPort is ReditPort + 1 and can't be 0 ;) */
/* check MediaRedirPort here because RedirCPort is RedirPort + 1 and can't be 0 ;) */
pNewChannel->localRtcpPort = pMediaInfo->lMediaRedirPort ? pMediaInfo->lMediaRedirCPort : pMediaInfo->lMediaCntrlPort;
/* If user application has not specified a specific ip and is using
multihomed mode, substitute appropriate ip.

View File

@ -389,7 +389,7 @@ int ooSocketAccept (OOSOCKET socket, OOSOCKET *pNewSocket,
if (destAddr != 0) {
if ((host = ast_sockaddr_stringify_addr(&addr)) != NULL)
strncpy(destAddr, host, strlen(host));
memcpy(destAddr, host, strlen(host) + 1);
}
if (destPort != 0)
*destPort = ast_sockaddr_port(&addr);
@ -537,8 +537,6 @@ int ooPDWrite(struct pollfd *pfds, int nfds, int fd)
int ooGetLocalIPAddress(char * pIPAddrs)
{
int ret;
struct hostent *hp;
struct ast_hostent phost;
char hostname[100];
if(pIPAddrs == NULL)
@ -546,20 +544,11 @@ int ooGetLocalIPAddress(char * pIPAddrs)
ret = gethostname(hostname, 100);
if(ret == 0)
{
if ((hp = ast_gethostbyname(hostname, &phost))) {
if (hp->h_addrtype == AF_INET6) {
struct in6_addr i;
memcpy(&i, hp->h_addr, sizeof(i));
strcpy(pIPAddrs, (inet_ntop(AF_INET6, &i,
hostname, sizeof(hostname))) == NULL ? "::1" :
inet_ntop(AF_INET6, &i, hostname, sizeof(hostname)));
} else {
struct in_addr i;
memcpy(&i, hp->h_addr, sizeof(i));
strcpy(pIPAddrs, (ast_inet_ntoa(i) == NULL) ? "127.0.0.1" : ast_inet_ntoa(i));
}
} else {
struct ast_sockaddr addr = { {0,} };
if (ast_sockaddr_resolve_first_af(&addr, hostname, PARSE_PORT_FORBID, AF_UNSPEC)) {
return -1;
} else {
strcpy(pIPAddrs, ast_sockaddr_stringify_addr(&addr));
}
}
else{

View File

@ -318,7 +318,7 @@ EXTERN int ooSocketSendTo(OOSOCKET socket, const ASN1OCTET* pdata,
/**
* This function is used for synchronous monitoring of multiple sockets.
* For more information refer to documnetation of "select" system call.
* For more information refer to documentation of "select" system call.
*
* @param nfds The highest numbered descriptor to be monitored
* plus one.

View File

@ -30,7 +30,7 @@ OOBOOL ooUtilsIsStrEmpty (const char* str)
}
OOBOOL ooIsDailedDigit(const char* str)
OOBOOL ooIsDialedDigit(const char* str)
{
if(str == NULL || *str =='\0') { return FALSE; }
while(*str != '\0')

View File

@ -48,6 +48,6 @@ EXTERN OOBOOL ooUtilsIsStrEmpty (const char * str);
* @param str String to test
* @return TRUE if string contains all digits; FALSE otherwise
*/
EXTERN OOBOOL ooIsDailedDigit(const char* str);
EXTERN OOBOOL ooIsDialedDigit(const char* str);
#endif

View File

@ -607,7 +607,7 @@ EXTERN int initContextBuffer
/**
* This function initializes a context block. It makes sure that if the block
* was not previosly initialized, that all key working parameters are set to
* thier correct initial state values (i.e. declared within a function as a
* their correct initial state values (i.e. declared within a function as a
* normal working variable), it is required that they invoke this function
* before using it.
*
@ -664,7 +664,7 @@ EXTERN int setPERBufferUsingCtxt (OOCTXT* pTarget, OOCTXT* pSource);
/**
* This function adds an integer parameter to an error information structure.
* Parameter substitution is done in much the same way as it is done in C
* printf statments. The base error message specification that goes along with
* printf statements. The base error message specification that goes along with
* a particular status code may have variable fields built in using '%'
* modifiers. These would be replaced with actual parameter data.
*
@ -680,7 +680,7 @@ EXTERN int errAddIntParm (ASN1ErrInfo* pErrInfo, int errParm);
/**
* This function adds an string parameter to an error information structure.
* Parameter substitution is done in much the same way as it is done in C
* printf statments. The base error message specification that goes along with
* printf statements. The base error message specification that goes along with
* a particular status code may have variable fields built in using '%'
* modifiers. These would be replaced with actual parameter data.
*
@ -697,7 +697,7 @@ EXTERN int errAddStrParm (ASN1ErrInfo* pErrInfo,
/**
* This function adds an unsigned integer parameter to an error information
* structure. Parameter substitution is done in much the same way as it is done
* in C printf statments. The base error message specification that goes along
* in C printf statements. The base error message specification that goes along
* with a particular status code may have variable fields built in using '%'
* modifiers. These would be replaced with actual parameter data.
*

View File

@ -297,7 +297,7 @@ int ooCreateH225Connection(OOH323CallData *call)
{
call->pH225Channel->sock = channelSocket;
OOTRACEINFO3("H2250 transmiter channel creation - successful "
OOTRACEINFO3("H2250 transmitter channel creation - successful "
"(%s, %s)\n", call->callType, call->callToken);
/* If multihomed, get ip from socket */
@ -454,7 +454,7 @@ int ooAcceptH225Connection()
call->callToken);
if (remoteIP[0]) {
strncpy(call->remoteIP, remoteIP, strlen(remoteIP));
memcpy(call->remoteIP, remoteIP, strlen(remoteIP) + 1);
}
ast_mutex_unlock(&call->Lock);

View File

@ -2559,7 +2559,7 @@ int ooOnReceivedRequestChannelClose(OOH323CallData *call,
if (lChannel->state == OO_LOGICALCHAN_ESTABLISHED) {
ret = ooSendCloseLogicalChannel(call, lChannel);
if (ret != OO_OK) {
OOTRACEERR3("ERROR:Failed to build CloseLgicalChannel message(%s, %s)\n",
OOTRACEERR3("ERROR:Failed to build CloseLogicalChannel message(%s, %s)\n",
call->callType, call->callToken);
return OO_FAILED;
}

View File

@ -174,7 +174,7 @@ EXTERN int ooSendMasterSlaveDeterminationReject (struct OOH323CallData* call);
* MasterSlaveDetermination procedure.
* @param call Handle to the call for which MasterSlaveReject is
* received.
* @param reject Poinetr to the received reject message.
* @param reject Pointer to the received reject message.
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/
@ -271,7 +271,7 @@ EXTERN int ooOnReceivedUserInputIndication
(OOH323CallData *call, H245UserInputIndication *indication);
/**
* This function is called on receiving a TreminalCapabilitySetAck message.
* This function is called on receiving a TerminalCapabilitySetAck message.
* If the MasterSlaveDetermination process is also over, this function
* initiates the process of opening logical channels.
* @param call Pointer to call for which TCSAck is received.

View File

@ -616,7 +616,7 @@ int ooOnReceivedSetup(OOH323CallData *call, Q931Message *q931Msg)
removeEventHandler(call->pctxt);
return OO_FAILED;
}
/* For now, just add decoded fast start elemts to list. This list
/* For now, just add decoded fast start elements to list. This list
will be processed at the time of sending CONNECT message. */
dListAppend(call->pctxt, &call->remoteFastStartOLCs, olc);
}
@ -1062,16 +1062,17 @@ int ooOnReceivedAlerting(OOH323CallData *call, Q931Message *q931Msg)
if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
if (alerting->m.h245AddressPresent)
if (alerting->m.h245AddressPresent) {
OOTRACEINFO3("Tunneling and h245address provided."
"Giving preference to Tunneling (%s, %s)\n",
call->callType, call->callToken);
if (call->h225version >= 4) {
ret =ooSendTCSandMSD(call);
}
if (ret != OO_OK)
return ret;
}
if (call->h225version >= 4) {
ret =ooSendTCSandMSD(call);
}
if (ret != OO_OK) {
return ret;
}
} else if(alerting->m.h245AddressPresent) {
if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
{
@ -1314,15 +1315,17 @@ int ooOnReceivedProgress(OOH323CallData *call, Q931Message *q931Msg)
if(q931Msg->userInfo->h323_uu_pdu.m.h245TunnelingPresent &&
q931Msg->userInfo->h323_uu_pdu.h245Tunneling &&
OO_TESTFLAG (call->flags, OO_M_TUNNELING)) {
if (progress->m.h245AddressPresent)
if (progress->m.h245AddressPresent) {
OOTRACEINFO3("Tunneling and h245address provided."
"Giving preference to Tunneling (%s, %s)\n",
call->callType, call->callToken);
if (call->h225version >= 4) {
ret =ooSendTCSandMSD(call);
}
if (ret != OO_OK)
}
if (call->h225version >= 4) {
ret =ooSendTCSandMSD(call);
}
if (ret != OO_OK) {
return ret;
}
} else if(progress->m.h245AddressPresent) {
if (OO_TESTFLAG (call->flags, OO_M_TUNNELING))
{

View File

@ -34,7 +34,7 @@ ast_mutex_t bindPortLock;
extern DList g_TimerList;
int ooH323EpInitialize
(enum OOCallMode callMode, const char* tracefile)
(enum OOCallMode callMode, const char* tracefile, char* errstr, int errstr_max)
{
memset(&gH323ep, 0, sizeof(ooEndPoint));
@ -46,7 +46,7 @@ int ooH323EpInitialize
{
if(strlen(tracefile)>= MAXFILENAME)
{
printf("Error:File name longer than allowed maximum %d\n",
snprintf(errstr, errstr_max, "Error:File name longer than allowed maximum %d\n",
MAXFILENAME-1);
return OO_FAILED;
}
@ -59,13 +59,13 @@ int ooH323EpInitialize
gH323ep.fptraceFile = fopen(gH323ep.traceFile, "a");
if(gH323ep.fptraceFile == NULL)
{
printf("Error:Failed to open trace file %s for write.\n",
snprintf(errstr, errstr_max, "Error:Failed to open trace file %s for write.\n",
gH323ep.traceFile);
return OO_FAILED;
}
/* Initialize default port ranges that will be used by stack.
Apps can override these by explicitely setting port ranges
Apps can override these by explicitly setting port ranges
*/
gH323ep.tcpPorts.start = TCPPORTSSTART;

View File

@ -163,7 +163,7 @@ typedef struct OOH323EndPoint {
* @return OO_OK, on success. OO_FAILED, on failure
*/
EXTERN int ooH323EpInitialize
(enum OOCallMode callMode, const char* tracefile);
(enum OOCallMode callMode, const char* tracefile, char* errstr, int errstr_max);
/**
* This function is used to represent the H.323 application endpoint as

View File

@ -192,11 +192,13 @@ EXTERN int ooQ931Decode
screening indicators ;-) */
if(ie->discriminator == Q931CallingPartyNumberIE)
{
int numoffset=1;
OOTRACEDBGB1(" CallingPartyNumber IE = {\n");
if(ie->length < OO_MAX_NUMBER_LENGTH)
if(!(0x80 & ie->data[0])) numoffset = 2;
if( (ie->length >= numoffset) &&
(ie->length < OO_MAX_NUMBER_LENGTH) )
{
int numoffset=1;
if(!(0x80 & ie->data[0])) numoffset = 2;
memcpy(number, ie->data+numoffset,ie->length-numoffset);
number[ie->length-numoffset]='\0';
OOTRACEDBGB2(" %s\n", number);
@ -204,7 +206,7 @@ EXTERN int ooQ931Decode
ooCallSetCallingPartyNumber(call, number);
}
else{
OOTRACEERR3("Error:Calling party number too long. (%s, %s)\n",
OOTRACEERR3("Error:Calling party number outside range. (%s, %s)\n",
call->callType, call->callToken);
}
OOTRACEDBGB1(" }\n");
@ -214,7 +216,8 @@ EXTERN int ooQ931Decode
if(ie->discriminator == Q931CalledPartyNumberIE)
{
OOTRACEDBGB1(" CalledPartyNumber IE = {\n");
if(ie->length < OO_MAX_NUMBER_LENGTH)
if( (ie->length >= 1) &&
(ie->length < OO_MAX_NUMBER_LENGTH) )
{
memcpy(number, ie->data+1,ie->length-1);
number[ie->length-1]='\0';
@ -223,7 +226,7 @@ EXTERN int ooQ931Decode
ooCallSetCalledPartyNumber(call, number);
}
else{
OOTRACEERR3("Error:Calling party number too long. (%s, %s)\n",
OOTRACEERR3("Error:Calling party number outside range. (%s, %s)\n",
call->callType, call->callToken);
}
OOTRACEDBGB1(" }\n");
@ -585,7 +588,7 @@ int ooDecodeUUIE(OOCTXT* pctxt, Q931Message *q931Msg)
unsigned int i;
ASN1BOOL aligned=TRUE;
int stat;
Q931InformationElement *ie;
Q931InformationElement *ie=NULL;
/* OOCTXT *pctxt = &gH323ep.msgctxt; */
if(q931Msg ==NULL)
{
@ -1210,7 +1213,7 @@ int ooSetFastStartResponse(OOH323CallData *pCall, Q931Message *pQ931msg,
pChannel = ooFindLogicalChannelByLogicalChannelNo
(pCall, olc->forwardLogicalChannelNumber);
/* start receive and tramsmit channel listening */
/* start receive and transmit channel listening */
if(dir & OORX)
{
strcpy(pChannel->remoteIP, remoteMediaControlIP);
@ -2025,7 +2028,7 @@ int ooSendStatusInquiry(OOH323CallData *call)
/* OOCTXT *pctxt = &gH323ep.msgctxt; */
OOCTXT *pctxt = call->msgctxt;
OOTRACEDBGC3("Building StatusInquryMsg (%s, %s)\n", call->callType,
OOTRACEDBGC3("Building StatusInquiryMsg (%s, %s)\n", call->callType,
call->callToken);
ret = ooCreateQ931Message(pctxt, &q931msg, Q931StatusEnquiryMsg);
if(ret != OO_OK)
@ -2987,7 +2990,7 @@ int ooH323MakeCall_helper(OOH323CallData *call)
}
if(!epCap)
{
OOTRACEWARN4("Warn:Preferred capability %s is abscent in "
OOTRACEWARN4("Warn:Preferred capability %s is absent in "
"capability list. (%s, %s)\n",
ooGetCapTypeText(call->capPrefs.order[k]),
call->callType, call->callToken);

View File

@ -582,7 +582,7 @@ EXTERN int ooH323MakeCall_helper(struct OOH323CallData *call);
* @param dest Destination string to be parsed.
* @param parsedIP Pointer to buffer in which parsed ip:port will be returned.
* @param len Length of the buffer passed.
* @param aliasList Aliase List in which new aliases will be added.
* @param aliasList Aliases List in which new aliases will be added.
*
* @return OO_OK, on success. OO_FAILED, on failure.
*/

View File

@ -554,7 +554,7 @@ static struct ast_config *realtime_multi_mysql(const char *database, const char
static int update_mysql(const char *database, const char *tablename, const char *keyfield, const char *lookup, const struct ast_variable *rt_fields)
{
struct mysql_conn *dbh;
my_ulonglong numrows;
uint64_t numrows;
const struct ast_variable *field = rt_fields;
struct ast_str *sql = ast_str_thread_get(&sql_buf, 100), *buf = ast_str_thread_get(&scratch_buf, 100);
struct tables *table;
@ -641,7 +641,7 @@ static int update_mysql(const char *database, const char *tablename, const char
release_table(table);
release_database(dbh);
ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n", numrows, tablename);
ast_debug(1, "MySQL RealTime: Updated %" PRIu64 " rows on table: %s\n", numrows, tablename);
/* From http://dev.mysql.com/doc/mysql/en/mysql-affected-rows.html
* An integer greater than zero indicates the number of rows affected
@ -655,7 +655,7 @@ static int update_mysql(const char *database, const char *tablename, const char
static int update2_mysql(const char *database, const char *tablename, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields)
{
struct mysql_conn *dbh;
my_ulonglong numrows;
uint64_t numrows;
int first;
const struct ast_variable *field;
struct ast_str *sql = ast_str_thread_get(&sql_buf, 100), *buf = ast_str_thread_get(&scratch_buf, 100);
@ -738,7 +738,7 @@ static int update2_mysql(const char *database, const char *tablename, const stru
numrows = mysql_affected_rows(&dbh->handle);
release_database(dbh);
ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n", numrows, tablename);
ast_debug(1, "MySQL RealTime: Updated %" PRIu64 " rows on table: %s\n", numrows, tablename);
/* From http://dev.mysql.com/doc/mysql/en/mysql-affected-rows.html
* An integer greater than zero indicates the number of rows affected
@ -810,7 +810,7 @@ static int store_mysql(const char *database, const char *table, const struct ast
static int destroy_mysql(const char *database, const char *table, const char *keyfield, const char *lookup, const struct ast_variable *rt_fields)
{
struct mysql_conn *dbh;
my_ulonglong numrows;
uint64_t numrows;
struct ast_str *sql = ast_str_thread_get(&sql_buf, 16);
struct ast_str *buf = ast_str_thread_get(&scratch_buf, 16);
const struct ast_variable *field;
@ -862,7 +862,7 @@ static int destroy_mysql(const char *database, const char *table, const char *ke
numrows = mysql_affected_rows(&dbh->handle);
release_database(dbh);
ast_debug(1, "MySQL RealTime: Deleted %llu rows on table: %s\n", numrows, table);
ast_debug(1, "MySQL RealTime: Deleted %" PRIu64 " rows on table: %s\n", numrows, table);
/* From http://dev.mysql.com/doc/mysql/en/mysql-affected-rows.html
* An integer greater than zero indicates the number of rows affected
@ -878,7 +878,7 @@ static struct ast_config *config_mysql(const char *database, const char *table,
struct mysql_conn *dbh;
MYSQL_RES *result;
MYSQL_ROW row;
my_ulonglong num_rows;
uint64_t num_rows;
struct ast_variable *new_v;
struct ast_category *cur_cat = NULL;
struct ast_str *sql = ast_str_thread_get(&sql_buf, 200);
@ -916,7 +916,7 @@ static struct ast_config *config_mysql(const char *database, const char *table,
if ((result = mysql_store_result(&dbh->handle))) {
num_rows = mysql_num_rows(result);
ast_debug(1, "MySQL RealTime: Found %llu rows.\n", num_rows);
ast_debug(1, "MySQL RealTime: Found %" PRIu64 " rows.\n", num_rows);
/* There might exist a better way to access the column names other than counting,
* but I believe that would require another loop that we don't need. */

View File

@ -93,7 +93,7 @@ static char *wait_result(void)
fprintf(stderr, "Got %d/%d bytes of audio\n", res, bytes);
#endif
bytes += res;
/* Prentend we detected some audio after 3 seconds */
/* Pretend we detected some audio after 3 seconds */
if (bytes > 16000 * 3) {
return "Sample Message";
bytes = 0;

View File

@ -348,7 +348,7 @@ sub music_dir_cache {
}
# this function will fill the @masterCacheList of all the files that
# need to have text2speeced ulaw files of their names generated
# need to have text2speech ulaw files of their names generated
sub music_dir_cache_genlist {
my $dir = shift;
if (!opendir(THEDIR, rmts($MUSIC.$dir))) {

View File

@ -588,7 +588,7 @@ static struct adsi_subscript *getsubbyname(struct adsi_script *state, char *name
}
if (state->numsubs > 127) {
ast_log(LOG_WARNING, "No more subscript space at line %d of %s\n", lineno, script);
ast_log(LOG_WARNING, "No more subscript space at line %d of %s\n", lineno, S_OR(script, "unknown"));
return NULL;
}

View File

@ -24,8 +24,14 @@
*
* See Also:
* \arg \ref AstCREDITS
* \arg \ref Config_agent
* \arg \ref agents.conf "Config_agent"
*/
/*!
* \page agents.conf agents.conf
* \verbinclude agents.conf.sample
*/
/*** MODULEINFO
<support_level>core</support_level>
***/
@ -92,8 +98,8 @@
<ref type="application">PauseQueueMember</ref>
<ref type="application">UnpauseQueueMember</ref>
<ref type="function">AGENT</ref>
<ref type="function">CHANNEL(dtmf_features)</ref>
<ref type="function">CONNECTEDLINE()</ref>
<ref type="function">CHANNEL</ref>
<ref type="function">CONNECTEDLINE</ref>
<ref type="filename">agents.conf</ref>
<ref type="filename">queues.conf</ref>
</see-also>
@ -456,17 +462,11 @@ struct agents_cfg {
struct ao2_container *agents;
};
static const char *agent_type_blacklist[] = {
"general",
"agents",
NULL,
};
static struct aco_type agent_type = {
.type = ACO_ITEM,
.name = "agent-id",
.category_match = ACO_BLACKLIST_ARRAY,
.category = (const char *)agent_type_blacklist,
.category_match = ACO_BLACKLIST_EXACT,
.category = "general",
.item_alloc = agent_cfg_alloc,
.item_find = agent_cfg_find,
.item_offset = offsetof(struct agents_cfg, agents),
@ -652,8 +652,6 @@ static struct ao2_container *agents;
* \brief Lock the agent.
*
* \param agent Agent to lock
*
* \return Nothing
*/
#define agent_lock(agent) _agent_lock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent)
static inline void _agent_lock(struct agent_pvt *agent, const char *file, const char *function, int line, const char *var)
@ -665,8 +663,6 @@ static inline void _agent_lock(struct agent_pvt *agent, const char *file, const
* \brief Unlock the agent.
*
* \param agent Agent to unlock
*
* \return Nothing
*/
#define agent_unlock(agent) _agent_unlock(agent, __FILE__, __PRETTY_FUNCTION__, __LINE__, #agent)
static inline void _agent_unlock(struct agent_pvt *agent, const char *file, const char *function, int line, const char *var)
@ -684,8 +680,6 @@ static inline void _agent_unlock(struct agent_pvt *agent, const char *file, cons
* \note Assumes the agent lock is already obtained.
*
* \note Defined locking order is channel lock then agent lock.
*
* \return Nothing
*/
static struct ast_channel *agent_lock_logged(struct agent_pvt *agent)
{
@ -750,8 +744,6 @@ static enum ast_device_state agent_pvt_devstate_get(const char *agent_id)
* \since 12.0.0
*
* \param agent_id Which agent needs the device state updated.
*
* \return Nothing
*/
static void agent_devstate_changed(const char *agent_id)
{
@ -1011,8 +1003,6 @@ AST_MUTEX_DEFINE_STATIC(agent_holding_lock);
* \param payload_size Size of the payload if payload is non-NULL. A number otherwise.
*
* \note The payload MUST NOT have any resources that need to be freed.
*
* \return Nothing
*/
static void clear_agent_status(struct ast_bridge_channel *bridge_channel, const void *payload, size_t payload_size)
{
@ -1028,8 +1018,6 @@ static void clear_agent_status(struct ast_bridge_channel *bridge_channel, const
* \param agent Which agent is connecting to the caller.
*
* \note The agent is locked on entry and not locked on exit.
*
* \return Nothing
*/
static void agent_connect_caller(struct ast_bridge_channel *bridge_channel, struct agent_pvt *agent)
{
@ -1363,8 +1351,6 @@ static int bridge_agent_hold_push(struct ast_bridge *self, struct ast_bridge_cha
* bridge_channel->bridge_pvt.
*
* \note On entry, self is already locked.
*
* \return Nothing
*/
static void bridge_agent_hold_pull(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel)
{
@ -1382,8 +1368,6 @@ static void bridge_agent_hold_pull(struct ast_bridge *self, struct ast_bridge_ch
* references to the bridge so it can be destroyed.
*
* \note On entry, self must NOT be locked.
*
* \return Nothing
*/
static void bridge_agent_hold_dissolving(struct ast_bridge *self)
{
@ -1457,9 +1441,9 @@ static void send_agent_logoff(struct ast_channel *chan, const char *agent, long
ast_assert(agent != NULL);
blob = ast_json_pack("{s: s, s: i}",
blob = ast_json_pack("{s: s, s: I}",
"agent", agent,
"logintime", logintime);
"logintime", (ast_json_int_t)logintime);
if (!blob) {
return;
}
@ -1475,8 +1459,6 @@ static void send_agent_logoff(struct ast_channel *chan, const char *agent, long
* \param agent Which agent logging out.
*
* \note On entry agent is already locked. On exit it is no longer locked.
*
* \return Nothing
*/
static void agent_logout(struct agent_pvt *agent)
{
@ -1514,8 +1496,6 @@ static void agent_logout(struct agent_pvt *agent)
*
* \param agent Which agent.
* \param logged The logged in channel.
*
* \return Nothing
*/
static void agent_run(struct agent_pvt *agent, struct ast_channel *logged)
{
@ -2034,8 +2014,6 @@ static int agent_request_exec(struct ast_channel *chan, const char *data)
*
* \param agent What to setup channel config values on.
* \param chan Channel logging in as an agent.
*
* \return Nothing
*/
static void agent_login_channel_config(struct agent_pvt *agent, struct ast_channel *chan)
{

View File

@ -158,7 +158,7 @@ static const char app[] = "AlarmReceiver";
events to the standard input of the application.
The configuration file also contains settings for DTMF timing, and for the loudness of the
acknowledgement tones.</para>
<note><para>Few Ademco DTMF signalling formats are detected automaticaly: Contact ID, Express 4+1,
<note><para>Few Ademco DTMF signalling formats are detected automatically: Contact ID, Express 4+1,
Express 4+2, High Speed and Super Fast.</para></note>
<para>The application is affected by the following variables:</para>
<variablelist>
@ -203,7 +203,6 @@ static char event_file[14] = "/event-XXXXXX";
* family, then create it and set its value to 1.
*
* \param key A database key to increment
* \return Nothing
*/
static void database_increment(char *key)
{

View File

@ -92,6 +92,12 @@
<para>Is the maximum duration of a word to accept.</para>
<para>If exceeded, then the result is detection as a MACHINE</para>
</parameter>
<parameter name="audioFile" required="false">
<para>Is an audio file to play to the caller while AMD is in progress.</para>
<para>By default, no audio file is played.</para>
<para>If an audio file is configured in amd.conf, then that file will be used
if one is not specified here. That file may be overridden by this argument.</para>
</parameter>
</syntax>
<description>
<para>This application attempts to detect answering machines at the beginning
@ -155,6 +161,9 @@ static int dfltBetweenWordsSilence = 50;
static int dfltMaximumNumberOfWords = 2;
static int dfltSilenceThreshold = 256;
static int dfltMaximumWordLength = 5000; /* Setting this to a large default so it is not used unless specify it in the configs or command line */
static char *dfltAudioFile = NULL;
static ast_mutex_t config_lock;
/* Set to the lowest ms value provided in amd.conf or application parameters */
static int dfltMaxWaitTimeForFrame = 50;
@ -162,8 +171,10 @@ static int dfltMaxWaitTimeForFrame = 50;
static void isAnsweringMachine(struct ast_channel *chan, const char *data)
{
int res = 0;
int audioFrameCount = 0;
struct ast_frame *f = NULL;
struct ast_dsp *silenceDetector = NULL;
struct timeval amd_tvstart;
int dspsilence = 0, framelength = 0;
RAII_VAR(struct ast_format *, readFormat, NULL, ao2_cleanup);
int inInitialSilence = 1;
@ -177,7 +188,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
char amdCause[256] = "", amdStatus[256] = "";
char *parse = ast_strdupa(data);
/* Lets set the initial values of the variables that will control the algorithm.
/* Let's set the initial values of the variables that will control the algorithm.
The initial values are the default ones. If they are passed as arguments
when invoking the application, then the default values will be overwritten
by the ones passed as parameters. */
@ -191,6 +202,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
int silenceThreshold = dfltSilenceThreshold;
int maximumWordLength = dfltMaximumWordLength;
int maxWaitTimeForFrame = dfltMaxWaitTimeForFrame;
const char *audioFile = NULL;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(argInitialSilence);
@ -202,8 +214,15 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
AST_APP_ARG(argMaximumNumberOfWords);
AST_APP_ARG(argSilenceThreshold);
AST_APP_ARG(argMaximumWordLength);
AST_APP_ARG(audioFile);
);
ast_mutex_lock(&config_lock);
if (!ast_strlen_zero(dfltAudioFile)) {
audioFile = ast_strdupa(dfltAudioFile);
}
ast_mutex_unlock(&config_lock);
ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", ast_channel_name(chan),
S_COR(ast_channel_caller(chan)->ani.number.valid, ast_channel_caller(chan)->ani.number.str, "(N/A)"),
S_COR(ast_channel_redirecting(chan)->from.number.valid, ast_channel_redirecting(chan)->from.number.str, "(N/A)"),
@ -231,6 +250,9 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
silenceThreshold = atoi(args.argSilenceThreshold);
if (!ast_strlen_zero(args.argMaximumWordLength))
maximumWordLength = atoi(args.argMaximumWordLength);
if (!ast_strlen_zero(args.audioFile)) {
audioFile = args.audioFile;
}
} else {
ast_debug(1, "AMD using the default parameters.\n");
}
@ -275,12 +297,20 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
/* Set silence threshold to specified value */
ast_dsp_set_threshold(silenceDetector, silenceThreshold);
/* Set our start time so we can tie the loop to real world time and not RTP updates */
amd_tvstart = ast_tvnow();
/* Optional audio file to play to caller while AMD is doing its thing. */
if (!ast_strlen_zero(audioFile)) {
ast_streamfile(chan, audioFile, ast_channel_language(chan));
}
/* Now we go into a loop waiting for frames from the channel */
while ((res = ast_waitfor(chan, 2 * maxWaitTimeForFrame)) > -1) {
int ms = 0;
/* Figure out how long we waited */
if (res > 0) {
if (res >= 0) {
ms = 2 * maxWaitTimeForFrame - res;
}
@ -293,7 +323,24 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
break;
}
/* Check to make sure we haven't gone over our real-world timeout in case frames get stalled for whatever reason */
if ( (ast_tvdiff_ms(ast_tvnow(), amd_tvstart)) > totalAnalysisTime ) {
ast_frfree(f);
strcpy(amdStatus , "NOTSURE");
if ( audioFrameCount == 0 ) {
ast_verb(3, "AMD: Channel [%s]. No audio data received in [%d] seconds.\n", ast_channel_name(chan), totalAnalysisTime);
sprintf(amdCause , "NOAUDIODATA-%d", iTotalTime);
break;
}
ast_verb(3, "AMD: Channel [%s]. Timeout...\n", ast_channel_name(chan));
sprintf(amdCause , "TOOLONG-%d", iTotalTime);
break;
}
if (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_CNG) {
/* keep track of the number of audio frames we get */
audioFrameCount++;
/* Figure out how long the frame is in milliseconds */
if (f->frametype == AST_FRAME_VOICE) {
framelength = (ast_codec_samples_count(f) / DEFAULT_SAMPLES_PER_MS);
@ -410,6 +457,14 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
}
}
} else {
iTotalTime += ms;
if (iTotalTime >= totalAnalysisTime) {
ast_frfree(f);
strcpy(amdStatus , "NOTSURE");
sprintf(amdCause , "TOOLONG-%d", iTotalTime);
break;
}
}
ast_frfree(f);
}
@ -432,10 +487,14 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
/* Free the DSP used to detect silence */
ast_dsp_free(silenceDetector);
/* If we were playing something to pass the time, stop it now. */
if (!ast_strlen_zero(audioFile)) {
ast_stopstream(chan);
}
return;
}
static int amd_exec(struct ast_channel *chan, const char *data)
{
isAnsweringMachine(chan, data);
@ -486,7 +545,16 @@ static int load_config(int reload)
dfltMaximumNumberOfWords = atoi(var->value);
} else if (!strcasecmp(var->name, "maximum_word_length")) {
dfltMaximumWordLength = atoi(var->value);
} else if (!strcasecmp(var->name, "playback_file")) {
ast_mutex_lock(&config_lock);
if (dfltAudioFile) {
ast_free(dfltAudioFile);
dfltAudioFile = NULL;
}
if (!ast_strlen_zero(var->value)) {
dfltAudioFile = ast_strdup(var->value);
}
ast_mutex_unlock(&config_lock);
} else {
ast_log(LOG_WARNING, "%s: Cat:%s. Unknown keyword %s at line %d of amd.conf\n",
app, cat, var->name, var->lineno);
@ -509,6 +577,12 @@ static int load_config(int reload)
static int unload_module(void)
{
ast_mutex_lock(&config_lock);
if (dfltAudioFile) {
ast_free(dfltAudioFile);
}
ast_mutex_unlock(&config_lock);
ast_mutex_destroy(&config_lock);
return ast_unregister_application(app);
}
@ -524,6 +598,7 @@ static int unload_module(void)
*/
static int load_module(void)
{
ast_mutex_init(&config_lock);
if (load_config(0) || ast_register_application_xml(app, amd_exec)) {
return AST_MODULE_LOAD_DECLINE;
}

View File

@ -0,0 +1,143 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2019, Alexei Gradinari
*
* Alexei Gradinari <alex2grad@gmail.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief Attended transfer by caller channel
*
* \author Alexei Gradinari <alex2grad@gmail.com>
*
* \ingroup applications
*/
/*** MODULEINFO
<support_level>extended</support_level>
***/
#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
#include "asterisk/features_config.h"
/*** DOCUMENTATION
<application name="AttendedTransfer" language="en_US">
<synopsis>
Attended transfer to the extension provided and TRANSFER_CONTEXT
</synopsis>
<syntax>
<parameter name="exten" required="true">
<para>Specify extension.</para>
</parameter>
</syntax>
<description>
<para>Queue up attended transfer to the specified extension in the <literal>TRANSFER_CONTEXT</literal>.</para>
<para>Note that the attended transfer only work when two channels have answered and are bridged together.</para>
<para>Make sure to set Attended Transfer DTMF feature <literal>atxfer</literal>
and attended transfer is permitted.</para>
<para>The result of the application will be reported in the <variable>ATTENDEDTRANSFERSTATUS</variable>
channel variable:</para>
<variablelist>
<variable name="ATTENDEDTRANSFERSTATUS">
<value name="SUCCESS">
Transfer successfully queued.
</value>
<value name="FAILURE">
Transfer failed.
</value>
<value name="NOTPERMITTED">
Transfer not permitted.
</value>
</variable>
</variablelist>
</description>
</application>
***/
static const char * const app = "AttendedTransfer";
static int attended_transfer_exec(struct ast_channel *chan, const char *data)
{
char *exten = NULL;
const char *context = NULL;
char *parse;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(exten);
);
char feature_code[AST_FEATURE_MAX_LEN];
const char *digit;
struct ast_frame f = { .frametype = AST_FRAME_DTMF };
if (ast_strlen_zero((char *)data)) {
ast_log(LOG_WARNING, "%s requires an argument (exten)\n", app);
pbx_builtin_setvar_helper(chan, "ATTENDEDTRANSFERSTATUS", "FAILURE");
return 0;
}
context = pbx_builtin_getvar_helper(chan, "TRANSFER_CONTEXT");
if (ast_strlen_zero(context)) {
pbx_builtin_setvar_helper(chan, "ATTENDEDTRANSFERSTATUS", "NOTPERMITTED");
return 0;
}
ast_channel_lock(chan);
if (ast_get_builtin_feature(chan, "atxfer", feature_code, sizeof(feature_code)) ||
ast_strlen_zero(feature_code)) {
pbx_builtin_setvar_helper(chan, "ATTENDEDTRANSFERSTATUS", "NOTPERMITTED");
ast_channel_unlock(chan);
return 0;
}
ast_channel_unlock(chan);
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
exten = args.exten;
for (digit = feature_code; *digit; ++digit) {
f.subclass.integer = *digit;
ast_queue_frame(chan, &f);
}
for (digit = exten; *digit; ++digit) {
f.subclass.integer = *digit;
ast_queue_frame(chan, &f);
}
f.subclass.integer = '#';
ast_queue_frame(chan, &f);
pbx_builtin_setvar_helper(chan, "ATTENDEDTRANSFERSTATUS", "SUCCESS");
return 0;
}
static int unload_module(void)
{
return ast_unregister_application(app);
}
static int load_module(void)
{
return ast_register_application_xml(app, attended_transfer_exec);
}
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Attended transfer to the given extension");

137
apps/app_blind_transfer.c Normal file
View File

@ -0,0 +1,137 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2019, Alexei Gradinari
*
* Alexei Gradinari <alex2grad@gmail.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief Blind transfer by caller channel
*
* \author Alexei Gradinari <alex2grad@gmail.com>
*
* \ingroup applications
*/
/*** MODULEINFO
<support_level>extended</support_level>
***/
#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
/*** DOCUMENTATION
<application name="BlindTransfer" language="en_US">
<synopsis>
Blind transfer channel(s) to the extension and context provided
</synopsis>
<syntax>
<parameter name="exten" required="true">
<para>Specify extension.</para>
</parameter>
<parameter name="context">
<para>Optionally specify a context.
By default, Asterisk will use the caller channel context.</para>
</parameter>
</syntax>
<description>
<para>Redirect all channels currently bridged to the caller channel to the
specified destination.</para>
<para>The result of the application will be reported in the <variable>BLINDTRANSFERSTATUS</variable>
channel variable:</para>
<variablelist>
<variable name="BLINDTRANSFERSTATUS">
<value name="SUCCESS">
Transfer succeeded.
</value>
<value name="FAILURE">
Transfer failed.
</value>
<value name="INVALID">
Transfer invalid.
</value>
<value name="NOTPERMITTED">
Transfer not permitted.
</value>
</variable>
</variablelist>
</description>
</application>
***/
static const char * const app = "BlindTransfer";
static int blind_transfer_exec(struct ast_channel *chan, const char *data)
{
char *exten = NULL;
char *context = NULL;
char *parse;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(exten);
AST_APP_ARG(context);
);
if (ast_strlen_zero((char *)data)) {
ast_log(LOG_WARNING, "%s requires an argument (exten)\n", app);
pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
return 0;
}
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
exten = args.exten;
if (ast_strlen_zero(args.context)) {
context = (char *)ast_channel_context(chan);
} else {
context = args.context;
}
switch (ast_bridge_transfer_blind(1, chan, exten, context, NULL, NULL)) {
case AST_BRIDGE_TRANSFER_NOT_PERMITTED:
pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "NOTPERMITTED");
break;
case AST_BRIDGE_TRANSFER_INVALID:
pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "INVALID");
break;
case AST_BRIDGE_TRANSFER_FAIL:
pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
break;
case AST_BRIDGE_TRANSFER_SUCCESS:
pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "SUCCESS");
break;
default:
pbx_builtin_setvar_helper(chan, "BLINDTRANSFERSTATUS", "FAILURE");
}
return 0;
}
static int unload_module(void)
{
return ast_unregister_application(app);
}
static int load_module(void)
{
return ast_register_application_xml(app, blind_transfer_exec);
}
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Blind transfer channel to the given destination");

View File

@ -100,6 +100,9 @@
<para>Automatically exit the bridge and return to the PBX after
<emphasis>duration</emphasis> seconds.</para>
</option>
<option name="n">
<para>Do not automatically answer the channel.</para>
</option>
</optionlist>
</parameter>
</syntax>
@ -108,7 +111,7 @@
The channel will then wait in the holding bridge until some event occurs
which removes it from the holding bridge.</para>
<note><para>This application will answer calls which haven't already
been answered.</para></note>
been answered, unless the n option is provided.</para></note>
</description>
</application>
***/
@ -186,6 +189,7 @@ enum bridgewait_flags {
MUXFLAG_MOHCLASS = (1 << 0),
MUXFLAG_ENTERTAINMENT = (1 << 1),
MUXFLAG_TIMEOUT = (1 << 2),
MUXFLAG_NOANSWER = (1 << 3),
};
enum bridgewait_args {
@ -199,6 +203,7 @@ AST_APP_OPTIONS(bridgewait_opts, {
AST_APP_OPTION_ARG('e', MUXFLAG_ENTERTAINMENT, OPT_ARG_ENTERTAINMENT),
AST_APP_OPTION_ARG('m', MUXFLAG_MOHCLASS, OPT_ARG_MOHCLASS),
AST_APP_OPTION_ARG('S', MUXFLAG_TIMEOUT, OPT_ARG_TIMEOUT),
AST_APP_OPTION('n', MUXFLAG_NOANSWER),
});
static int bridgewait_timeout_callback(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
@ -391,17 +396,6 @@ static void wait_wrapper_removal(struct wait_bridge_wrapper *wrapper)
ao2_cleanup(wrapper);
}
/*!
* \internal
* \since 12.0.0
* \brief Application callback for the bridgewait application
*
* \param chan channel running the application
* \param data Arguments to the application
*
* \retval 0 Ran successfully and the call didn't hang up
* \retval -1 Failed or the call was hung up by the time the channel exited the holding bridge
*/
static enum wait_bridge_roles validate_role(const char *role)
{
if (!strcmp(role, "participant")) {
@ -413,6 +407,17 @@ static enum wait_bridge_roles validate_role(const char *role)
}
}
/*!
* \internal
* \since 12.0.0
* \brief Application callback for the bridgewait application
*
* \param chan channel running the application
* \param data Arguments to the application
*
* \retval 0 Ran successfully and the call didn't hang up
* \retval -1 Failed or the call was hung up by the time the channel exited the holding bridge
*/
static int bridgewait_exec(struct ast_channel *chan, const char *data)
{
char *bridge_name = DEFAULT_BRIDGE_NAME;
@ -458,7 +463,7 @@ static int bridgewait_exec(struct ast_channel *chan, const char *data)
}
/* Answer the channel if needed */
if (ast_channel_state(chan) != AST_STATE_UP) {
if (ast_channel_state(chan) != AST_STATE_UP && !ast_test_flag(&flags, MUXFLAG_NOANSWER)) {
ast_answer(chan);
}

View File

@ -119,13 +119,13 @@ struct app_cdr_message_payload {
/*! The name of the channel to be manipulated */
const char *channel_name;
/*! Disable the CDR for this channel */
int disable:1;
unsigned int disable:1;
/*! Re-enable the CDR for this channel */
int reenable:1;
unsigned int reenable:1;
/*! Reset the CDR */
int reset:1;
unsigned int reset:1;
/*! If reseting the CDR, keep the variables */
int keep_variables:1;
unsigned int keep_variables:1;
};
static void appcdr_callback(void *data, struct stasis_subscription *sub, struct stasis_message *message)

View File

@ -51,16 +51,18 @@ static const char app[] = "ChanIsAvail";
Check channel availability
</synopsis>
<syntax>
<parameter name="Technology/Resource" required="true" argsep="&amp;">
<parameter name="Technology/Resource" required="false" argsep="&amp;">
<argument name="Technology/Resource" required="true">
<para>Specification of the device(s) to check. These must be in the format of
<literal>Technology/Resource</literal>, where <replaceable>Technology</replaceable>
represents a particular channel driver, and <replaceable>Resource</replaceable>
represents a resource available to that particular channel driver.</para>
</argument>
<argument name="Technology2/Resource2" multiple="true">
<para>Optional extra devices to check</para>
<para>If you need more than one enter them as
Technology2/Resource2&amp;Technology3/Resource3&amp;.....</para>
</argument>
<para>Specification of the device(s) to check. These must be in the format of
<literal>Technology/Resource</literal>, where <replaceable>Technology</replaceable>
represents a particular channel driver, and <replaceable>Resource</replaceable>
represents a resource available to that particular channel driver.</para>
</parameter>
<parameter name="options" required="false">
<optionlist>
@ -99,25 +101,28 @@ static const char app[] = "ChanIsAvail";
static int chanavail_exec(struct ast_channel *chan, const char *data)
{
int inuse=-1, option_state=0, string_compare=0, option_all_avail=0;
int inuse = -1;
int option_state = 0;
int string_compare = 0;
int option_all_avail = 0;
int status;
char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur;
char *info;
char trychan[512];
char *rest;
char *tech;
char *number;
struct ast_str *tmp_availchan = ast_str_alloca(2048);
struct ast_str *tmp_availorig = ast_str_alloca(2048);
struct ast_str *tmp_availstat = ast_str_alloca(2048);
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");
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(reqchans);
AST_APP_ARG(options);
);
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ChanIsAvail requires an argument (DAHDI/1&DAHDI/2)\n");
return -1;
}
info = ast_strdupa(data);
info = ast_strdupa(data ?: "");
AST_STANDARD_APP_ARGS(args, info);
@ -132,61 +137,68 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
string_compare = 1;
}
}
peers = args.reqchans;
if (peers) {
cur = peers;
do {
/* remember where to start next time */
rest = strchr(cur, '&');
if (rest) {
*rest = 0;
rest++;
rest = args.reqchans;
if (!rest) {
rest = "";
}
while ((tech = strsep(&rest, "&"))) {
tech = ast_strip(tech);
number = strchr(tech, '/');
if (!number) {
if (!ast_strlen_zero(tech)) {
ast_log(LOG_WARNING, "Invalid ChanIsAvail technology/resource argument: '%s'\n",
tech);
}
tech = cur;
number = strchr(tech, '/');
if (!number) {
ast_log(LOG_WARNING, "ChanIsAvail argument takes format ([technology]/[device])\n");
return -1;
ast_str_append(&tmp_availstat, 0, "%s%d",
ast_str_strlen(tmp_availstat) ? "&" : "", AST_DEVICE_INVALID);
continue;
}
*number++ = '\0';
status = AST_DEVICE_UNKNOWN;
if (string_compare) {
/* ast_parse_device_state checks for "SIP/1234" as a channel name.
ast_device_state will ask the SIP driver for the channel state. */
snprintf(trychan, sizeof(trychan), "%s/%s", tech, number);
status = inuse = ast_parse_device_state(trychan);
} else if (option_state) {
/* If the pbx says in use then don't bother trying further.
This is to permit testing if someone's on a call, even if the
channel can permit more calls (ie callwaiting, sip calls, etc). */
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);
if ((inuse <= (int) AST_DEVICE_NOT_INUSE)
&& (tempchan = ast_request(tech, ast_channel_nativeformats(chan), NULL, chan, number, &status))) {
ast_str_append(&tmp_availchan, 0, "%s%s",
ast_str_strlen(tmp_availchan) ? "&" : "", ast_channel_name(tempchan));
ast_str_append(&tmp_availorig, 0, "%s%s/%s",
ast_str_strlen(tmp_availorig) ? "&" : "", tech, number);
ast_str_append(&tmp_availcause, 0, "%s%d",
ast_str_strlen(tmp_availcause) ? "&" : "", status);
/* Disable CDR for this temporary channel. */
if (cdr_prop_func) {
ast_func_write(tempchan, "CDR_PROP(disable)", "1");
}
*number = '\0';
number++;
status = AST_DEVICE_UNKNOWN;
ast_hangup(tempchan);
tempchan = NULL;
if (string_compare) {
/* ast_parse_device_state checks for "SIP/1234" as a channel name.
ast_device_state will ask the SIP driver for the channel state. */
snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
status = inuse = ast_parse_device_state(trychan);
} else if (option_state) {
/* If the pbx says in use then don't bother trying further.
This is to permit testing if someone's on a call, even if the
channel can permit more calls (ie callwaiting, sip calls, etc). */
snprintf(trychan, sizeof(trychan), "%s/%s",cur,number);
status = inuse = ast_device_state(trychan);
if (!option_all_avail) {
break;
}
snprintf(tmp, sizeof(tmp), "%d", status);
ast_str_append(&tmp_availstat, 0, "%s%s", ast_str_strlen(tmp_availstat) ? "&" : "", tmp);
if ((inuse <= 1) && (tempchan = ast_request(tech, ast_channel_nativeformats(chan), NULL, chan, number, &status))) {
ast_str_append(&tmp_availchan, 0, "%s%s", ast_str_strlen(tmp_availchan) ? "&" : "", ast_channel_name(tempchan));
snprintf(tmp, sizeof(tmp), "%s/%s", tech, number);
ast_str_append(&tmp_availorig, 0, "%s%s", ast_str_strlen(tmp_availorig) ? "&" : "", tmp);
snprintf(tmp, sizeof(tmp), "%d", status);
ast_str_append(&tmp_availcause, 0, "%s%s", ast_str_strlen(tmp_availcause) ? "&" : "", tmp);
ast_hangup(tempchan);
tempchan = NULL;
if (!option_all_avail) {
break;
}
}
cur = rest;
} while (cur);
}
}
pbx_builtin_setvar_helper(chan, "AVAILCHAN", ast_str_buffer(tmp_availchan));
@ -209,4 +221,9 @@ static int load_module(void)
AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Check channel availability");
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Check channel availability",
.support_level = AST_MODULE_SUPPORT_EXTENDED,
.load = load_module,
.unload = unload_module,
.optional_modules = "func_cdr"
);

View File

@ -509,7 +509,8 @@ static int start_spying(struct ast_autochan *autochan, const char *spychan_name,
int res;
ast_autochan_channel_lock(autochan);
ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan_name, ast_channel_name(autochan->chan));
ast_verb(3, "Attaching spy channel %s to %s\n",
spychan_name, ast_channel_name(autochan->chan));
if (ast_test_flag(flags, OPTION_READONLY)) {
ast_set_flag(audiohook, AST_AUDIOHOOK_MUTE_WRITE);
@ -558,7 +559,7 @@ static int pack_channel_into_message(struct ast_channel *chan, const char *role,
* \brief Publish the chanspy message over Stasis-Core
* \param spyer The channel doing the spying
* \param spyee Who is being spied upon
* \start start If non-zero, the spying is starting. Otherwise, the spyer is
* \param start If non-zero, the spying is starting. Otherwise, the spyer is
* finishing
*/
static void publish_chanspy_message(struct ast_channel *spyer,
@ -844,13 +845,13 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
ast_audiohook_unlock(&csth.spy_audiohook);
ast_audiohook_destroy(&csth.spy_audiohook);
ast_verb(2, "Done Spying on channel %s\n", name);
publish_chanspy_message(chan, spyee_autochan->chan, 0);
if (spyee_bridge_autochan) {
ast_autochan_destroy(spyee_bridge_autochan);
}
ast_verb(2, "Done Spying on channel %s\n", name);
publish_chanspy_message(chan, NULL, 0);
return running;
}
@ -898,7 +899,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
signed char zero_volume = 0;
int waitms;
int res;
int num_spyed_upon = 1;
int num_spied_upon = 1;
struct ast_channel_iterator *iter = NULL;
if (ast_test_flag(flags, OPTION_EXIT)) {
@ -925,7 +926,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
struct ast_autochan *autochan = NULL, *next_autochan = NULL;
struct ast_channel *prev = NULL;
if (!ast_test_flag(flags, OPTION_QUIET) && num_spyed_upon) {
if (!ast_test_flag(flags, OPTION_QUIET) && num_spied_upon) {
res = ast_streamfile(chan, "beep", ast_channel_language(chan));
if (!res)
res = ast_waitstream(chan, "");
@ -990,7 +991,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
/* reset for the next loop around, unless overridden later */
waitms = 100;
num_spyed_upon = 0;
num_spied_upon = 0;
for (autochan = next_channel(iter, chan);
autochan;
@ -1145,7 +1146,7 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags,
}
res = channel_spy(chan, autochan, &volfactor, fd, user_options, flags, exitcontext);
num_spyed_upon++;
num_spied_upon++;
if (res == -1) {
ast_autochan_destroy(autochan);

View File

@ -124,10 +124,48 @@
</variable>
</variablelist>
</description>
<see-also>
<ref type="application">ConfKick</ref>
<ref type="function">CONFBRIDGE</ref>
<ref type="function">CONFBRIDGE_INFO</ref>
<ref type="function">CONFBRIDGE_CHANNELS</ref>
</see-also>
</application>
<application name="ConfKick" language="en_US">
<since>
<version>16.19.0</version>
<version>18.5.0</version>
<version>19.0.0</version>
</since>
<synopsis>
Kicks channel(s) from the requested ConfBridge.
</synopsis>
<syntax>
<parameter name="conference" required="true" />
<parameter name="channel">
<para>The channel to kick, <literal>all</literal>
to kick all users, or <literal>participants</literal>
to kick all non-admin participants. Default is all.</para>
</parameter>
</syntax>
<description>
<para>Kicks the requested channel(s) from a conference bridge.</para>
<variablelist>
<variable name="CONFKICKSTATUS">
<value name="FAILURE">
Could not kick any users with the provided arguments.
</value>
<value name="SUCCESS">
Successfully kicked users from specified conference bridge.
</value>
</variable>
</variablelist>
</description>
<see-also>
<ref type="application">ConfBridge</ref>
<ref type="function">CONFBRIDGE</ref>
<ref type="function">CONFBRIDGE_INFO</ref>
<ref type="function">CONFBRIDGE_CHANNELS</ref>
</see-also>
</application>
<function name="CONFBRIDGE" language="en_US">
@ -160,23 +198,29 @@
<para>---- Example 1 ----</para>
<para>In this example the custom user profile set on the channel will
automatically be used by the ConfBridge application.</para>
<para>exten => 1,1,Answer()</para>
<example title="Example 1">
exten => 1,1,Answer()
</example>
<para>; In this example the effect of the following line is</para>
<para>; implied:</para>
<para>; same => n,Set(CONFBRIDGE(user,template)=default_user)</para>
<para>same => n,Set(CONFBRIDGE(user,announce_join_leave)=yes)</para>
<para>same => n,Set(CONFBRIDGE(user,startmuted)=yes)</para>
<para>same => n,ConfBridge(1) </para>
<example title="Example 1b">
same => n,Set(CONFBRIDGE(user,template)=default_user)
same => n,Set(CONFBRIDGE(user,announce_join_leave)=yes)
same => n,Set(CONFBRIDGE(user,startmuted)=yes)
same => n,ConfBridge(1)
</example>
<para>---- Example 2 ----</para>
<para>This example shows how to use a predefined user profile in
<filename>confbridge.conf</filename> as a template for a dynamic profile.
Here we make an admin/marked user out of the <literal>my_user</literal>
profile that you define in <filename>confbridge.conf</filename>.</para>
<para>exten => 1,1,Answer()</para>
<para>same => n,Set(CONFBRIDGE(user,template)=my_user)</para>
<para>same => n,Set(CONFBRIDGE(user,admin)=yes)</para>
<para>same => n,Set(CONFBRIDGE(user,marked)=yes)</para>
<para>same => n,ConfBridge(1)</para>
<example title="Example 2">
exten => 1,1,Answer()
same => n,Set(CONFBRIDGE(user,template)=my_user)
same => n,Set(CONFBRIDGE(user,admin)=yes)
same => n,Set(CONFBRIDGE(user,marked)=yes)
same => n,ConfBridge(1)
</example>
</description>
</function>
<function name="CONFBRIDGE_INFO" language="en_US">
@ -212,6 +256,50 @@
<para>This function returns a non-negative integer for valid conference
names and an empty string for invalid conference names.</para>
</description>
<see-also>
<ref type="function">CONFBRIDGE_CHANNELS</ref>
</see-also>
</function>
<function name="CONFBRIDGE_CHANNELS" language="en_US">
<since>
<version>16.26.0</version>
<version>18.12.0</version>
<version>19.4.0</version>
</since>
<synopsis>
Get a list of channels in a ConfBridge conference.
</synopsis>
<syntax>
<parameter name="type" required="true">
<para>What conference information is requested.</para>
<enumlist>
<enum name="admins">
<para>Get the number of admin users in the conference.</para>
</enum>
<enum name="marked">
<para>Get the number of marked users in the conference.</para>
</enum>
<enum name="parties">
<para>Get the number of total users in the conference.</para>
</enum>
<enum name="active">
<para>Get the number of active users in the conference.</para>
</enum>
<enum name="waiting">
<para>Get the number of waiting users in the conference.</para>
</enum>
</enumlist>
</parameter>
<parameter name="conf" required="true">
<para>The name of the conference being referenced.</para>
</parameter>
</syntax>
<description>
<para>This function returns a comma-separated list of channels in a ConfBridge conference, optionally filtered by a type of participant.</para>
</description>
<see-also>
<ref type="function">CONFBRIDGE_INFO</ref>
</see-also>
</function>
<manager name="ConfbridgeList" language="en_US">
<synopsis>
@ -305,6 +393,37 @@
ConfbridgeListRoomsComplete.</para>
</description>
</manager>
<managerEvent language="en_US" name="ConfbridgeListRooms">
<managerEventInstance class="EVENT_FLAG_REPORTING">
<synopsis>Raised as part of the ConfbridgeListRooms action response list.</synopsis>
<syntax>
<parameter name="Conference">
<para>The name of the Confbridge conference.</para>
</parameter>
<parameter name="Parties">
<para>Number of users in the conference.</para>
<para>This includes both active and waiting users.</para>
</parameter>
<parameter name="Marked">
<para>Number of marked users in the conference.</para>
</parameter>
<parameter name="Locked">
<para>Is the conference locked?</para>
<enumlist>
<enum name="Yes"/>
<enum name="No"/>
</enumlist>
</parameter>
<parameter name="Muted">
<para>Is the conference muted?</para>
<enumlist>
<enum name="Yes"/>
<enum name="No"/>
</enumlist>
</parameter>
</syntax>
</managerEventInstance>
</managerEvent>
<manager name="ConfbridgeMute" language="en_US">
<synopsis>
Mute a Confbridge user.
@ -426,6 +545,7 @@
*/
static const char app[] = "ConfBridge";
static const char app2[] = "ConfKick";
/*! Number of buckets our conference bridges container can have */
#define CONFERENCE_BRIDGE_BUCKETS 53
@ -576,6 +696,10 @@ static void send_conf_stasis(struct confbridge_conference *conference, struct as
return;
}
if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_ENABLE_EVENTS)) {
conf_send_event_to_participants(conference, chan, msg);
}
if (channel_topic) {
stasis_publish(ast_channel_topic(chan), msg);
} else {
@ -583,6 +707,43 @@ static void send_conf_stasis(struct confbridge_conference *conference, struct as
}
}
static void send_conf_stasis_snapshots(struct confbridge_conference *conference,
struct ast_channel_snapshot *chan_snapshot, struct stasis_message_type *type,
struct ast_json *extras)
{
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
RAII_VAR(struct ast_bridge_snapshot *, bridge_snapshot, NULL, ao2_cleanup);
json_object = ast_json_pack("{s: s}",
"conference", conference->name);
if (!json_object) {
return;
}
if (extras) {
ast_json_object_update(json_object, extras);
}
ast_bridge_lock(conference->bridge);
bridge_snapshot = ast_bridge_snapshot_create(conference->bridge);
ast_bridge_unlock(conference->bridge);
if (!bridge_snapshot) {
return;
}
msg = ast_bridge_blob_create_from_snapshots(type,
bridge_snapshot,
chan_snapshot,
json_object);
if (!msg) {
return;
}
stasis_publish(ast_bridge_topic(conference->bridge), msg);
}
static void send_conf_start_event(struct confbridge_conference *conference)
{
send_conf_stasis(conference, NULL, confbridge_start_type(), NULL, 0);
@ -724,8 +885,8 @@ struct confbridge_conference *conf_find_bridge(const char *conference_name)
*
* \note Must be called with the conference locked
*
* \retval 1, conference is recording.
* \retval 0, conference is NOT recording.
* \retval 1 conference is recording.
* \retval 0 conference is NOT recording.
*/
static int conf_is_recording(struct confbridge_conference *conference)
{
@ -836,7 +997,7 @@ static int conf_start_record(struct confbridge_conference *conference)
return 0;
}
/* \brief Playback the given filename and monitor for any dtmf interrupts.
/*! \brief Playback the given filename and monitor for any dtmf interrupts.
*
* This function is used to playback sound files on a given channel and optionally
* allow dtmf interrupts to occur.
@ -850,7 +1011,9 @@ static int conf_start_record(struct confbridge_conference *conference)
* \param channel Optional channel to play file on if bridge_channel not given
* \param filename The file name to playback
*
* \retval -1 failure during playback, 0 on file was fully played, 1 on dtmf interrupt.
* \retval -1 failure during playback.
* \retval 0 on file was fully played.
* \retval 1 on dtmf interrupt.
*/
static int play_file(struct ast_bridge_channel *bridge_channel, struct ast_channel *channel,
const char *filename)
@ -907,7 +1070,8 @@ static int sound_file_exists(const char *filename)
* \param bridge_channel The bridged channel involved
*
* \note if caller is NULL, the announcment will be sent to all participants in the conference.
* \return Returns 0 on success, -1 if the user hung up
* \retval 0 on success.
* \retval -1 if the user hung up.
*/
static int announce_user_count(struct confbridge_conference *conference, struct confbridge_user *user,
struct ast_bridge_channel *bridge_channel)
@ -957,7 +1121,9 @@ static int announce_user_count(struct confbridge_conference *conference, struct
* \param user User to play audio prompt to
* \param filename Prompt to play
*
* \return Returns 0 on success, -1 if the user hung up
* \retval 0 on success.
* \retval -1 if the user hung up.
*
* \note Generally this should be called when the conference is unlocked to avoid blocking
* the entire conference while the sound is played. But don't unlock the conference bridge
* in the middle of a state transition.
@ -1094,8 +1260,6 @@ static void hangup_data_destroy(struct hangup_data *hangup)
* \brief Destroy a conference bridge
*
* \param obj The conference bridge object
*
* \return Returns nothing
*/
static void destroy_conference_bridge(void *obj)
{
@ -1107,13 +1271,15 @@ static void destroy_conference_bridge(void *obj)
if (conference->playback_queue) {
struct hangup_data hangup;
hangup_data_init(&hangup, conference);
ast_taskprocessor_push(conference->playback_queue, hangup_playback, &hangup);
ast_mutex_lock(&hangup.lock);
while (!hangup.hungup) {
ast_cond_wait(&hangup.cond, &hangup.lock);
if (!ast_taskprocessor_push(conference->playback_queue, hangup_playback, &hangup)) {
ast_mutex_lock(&hangup.lock);
while (!hangup.hungup) {
ast_cond_wait(&hangup.cond, &hangup.lock);
}
ast_mutex_unlock(&hangup.lock);
}
ast_mutex_unlock(&hangup.lock);
hangup_data_destroy(&hangup);
} else {
/* Playback queue is not yet allocated. Just hang up the channel straight */
@ -1230,7 +1396,7 @@ void conf_update_user_mute(struct confbridge_user *user)
ast_channel_name(user->chan));
}
/*
/*!
* \internal
* \brief Mute/unmute a single user.
*/
@ -1314,8 +1480,6 @@ void conf_moh_start(struct confbridge_user *user)
* \brief Unsuspend MOH for the conference user.
*
* \param user Conference user to unsuspend MOH on.
*
* \return Nothing
*/
static void conf_moh_unsuspend(struct confbridge_user *user)
{
@ -1331,8 +1495,6 @@ static void conf_moh_unsuspend(struct confbridge_user *user)
* \brief Suspend MOH for the conference user.
*
* \param user Conference user to suspend MOH on.
*
* \return Nothing
*/
static void conf_moh_suspend(struct confbridge_user *user)
{
@ -1354,7 +1516,7 @@ int conf_handle_inactive_waitmarked(struct confbridge_user *user)
return 0;
}
int conf_handle_only_unmarked(struct confbridge_user *user)
int conf_handle_only_person(struct confbridge_user *user)
{
/* If audio prompts have not been quieted or this prompt quieted play it on out */
if (!ast_test_flag(&user->u_profile, USER_OPT_QUIET | USER_OPT_NOONLYPERSON)) {
@ -1473,6 +1635,126 @@ static int push_announcer(struct confbridge_conference *conference)
return 0;
}
static void confbridge_unlock_and_unref(void *obj)
{
struct confbridge_conference *conference = obj;
if (!obj) {
return;
}
ao2_unlock(conference);
ao2_ref(conference, -1);
}
void confbridge_handle_atxfer(struct ast_attended_transfer_message *msg)
{
struct ast_channel_snapshot *old_snapshot;
struct ast_channel_snapshot *new_snapshot;
char *confbr_name = NULL;
char *comma;
RAII_VAR(struct confbridge_conference *, conference, NULL, confbridge_unlock_and_unref);
struct confbridge_user *user = NULL;
int found_user = 0;
struct ast_json *json_object;
if (msg->to_transferee.channel_snapshot
&& strcmp(msg->to_transferee.channel_snapshot->appl, "ConfBridge") == 0
&& msg->target) {
/* We're transferring a bridge to an extension */
old_snapshot = msg->to_transferee.channel_snapshot;
new_snapshot = msg->target;
} else if (msg->to_transfer_target.channel_snapshot
&& strcmp(msg->to_transfer_target.channel_snapshot->appl, "ConfBridge") == 0
&& msg->transferee) {
/* We're transferring a call to a bridge */
old_snapshot = msg->to_transfer_target.channel_snapshot;
new_snapshot = msg->transferee;
} else {
ast_log(LOG_ERROR, "Could not determine proper channels\n");
return;
}
/*
* old_snapshot->data should have the original parameters passed to
* the ConfBridge app:
* conference[,bridge_profile[,user_profile[,menu]]]
* We'll use "conference" to look up the bridge.
*
* We _could_ use old_snapshot->bridgeid to get the bridge but
* that would involve locking the conference_bridges container
* and iterating over it looking for a matching bridge.
*/
if (ast_strlen_zero(old_snapshot->data)) {
ast_log(LOG_ERROR, "Channel '%s' didn't have app data set\n", old_snapshot->name);
return;
}
confbr_name = ast_strdupa(old_snapshot->data);
comma = strchr(confbr_name, ',');
if (comma) {
*comma = '\0';
}
ast_debug(1, "Confbr: %s Leaving: %s Joining: %s\n", confbr_name, old_snapshot->name, new_snapshot->name);
conference = ao2_find(conference_bridges, confbr_name, OBJ_SEARCH_KEY);
if (!conference) {
ast_log(LOG_ERROR, "Conference bridge '%s' not found\n", confbr_name);
return;
}
ao2_lock(conference);
/*
* We need to grab the user profile for the departing user in order to
* properly format the join/leave messages.
*/
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
if (strcasecmp(ast_channel_name(user->chan), old_snapshot->name) == 0) {
found_user = 1;
break;
}
}
/*
* If we didn't find the user in the active list, try the waiting list.
*/
if (!found_user && conference->waitingusers) {
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
if (strcasecmp(ast_channel_name(user->chan), old_snapshot->name) == 0) {
found_user = 1;
break;
}
}
}
if (!found_user) {
ast_log(LOG_ERROR, "Unable to find user profile for channel '%s' in bridge '%s'\n",
old_snapshot->name, confbr_name);
return;
}
/*
* We're going to use the existing user profile to create the messages.
*/
json_object = ast_json_pack("{s: b}",
"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN)
);
if (!json_object) {
return;
}
send_conf_stasis_snapshots(conference, old_snapshot, confbridge_leave_type(), json_object);
ast_json_unref(json_object);
json_object = ast_json_pack("{s: b, s: b}",
"admin", ast_test_flag(&user->u_profile, USER_OPT_ADMIN),
"muted", user->muted);
if (!json_object) {
return;
}
send_conf_stasis_snapshots(conference, new_snapshot, confbridge_join_type(), json_object);
ast_json_unref(json_object);
}
/*!
* \brief Join a conference bridge
*
@ -1487,7 +1769,7 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
struct post_join_action *action;
int max_members_reached = 0;
/* We explictly lock the conference bridges container ourselves so that other callers can not create duplicate conferences at the same */
/* We explicitly lock the conference bridges container ourselves so that other callers can not create duplicate conferences at the same time */
ao2_lock(conference_bridges);
ast_debug(1, "Trying to find conference bridge '%s'\n", conference_name);
@ -1543,6 +1825,8 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
/* Set the internal sample rate on the bridge from the bridge profile */
ast_bridge_set_internal_sample_rate(conference->bridge, conference->b_profile.internal_sample_rate);
/* Set the maximum sample rate on the bridge from the bridge profile */
ast_bridge_set_maximum_sample_rate(conference->bridge, conference->b_profile.maximum_sample_rate);
/* Set the internal mixing interval on the bridge from the bridge profile */
ast_bridge_set_mixing_interval(conference->bridge, conference->b_profile.mix_interval);
ast_bridge_set_binaural_active(conference->bridge, ast_test_flag(&conference->b_profile, BRIDGE_OPT_BINAURAL_ACTIVE));
@ -1551,7 +1835,6 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
ast_bridge_set_talker_src_video_mode(conference->bridge);
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_VIDEO_SRC_SFU)) {
ast_bridge_set_sfu_video_mode(conference->bridge);
ast_bridge_set_video_update_discard(conference->bridge, conference->b_profile.video_update_discard);
ast_bridge_set_remb_send_interval(conference->bridge, conference->b_profile.remb_send_interval);
if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE)) {
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE);
@ -1559,9 +1842,25 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_LOWEST);
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST)) {
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST);
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL)) {
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_AVERAGE_ALL);
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL)) {
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_LOWEST_ALL);
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL)) {
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_HIGHEST_ALL);
} else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_REMB_BEHAVIOR_FORCE)) {
ast_brige_set_remb_behavior(conference->bridge, AST_BRIDGE_VIDEO_SFU_REMB_FORCE);
ast_bridge_set_remb_estimated_bitrate(conference->bridge, conference->b_profile.remb_estimated_bitrate);
}
}
/* Always set the minimum interval between video updates, to avoid infinite video updates. */
ast_bridge_set_video_update_discard(conference->bridge, conference->b_profile.video_update_discard);
if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_ENABLE_EVENTS)) {
ast_bridge_set_send_sdp_label(conference->bridge, 1);
}
/* Link it into the conference bridges container */
if (!ao2_link(conference_bridges, conference)) {
ao2_ref(conference, -1);
@ -2311,6 +2610,25 @@ static int join_callback(struct ast_bridge_channel *bridge_channel, void *ignore
return 0;
}
struct confbridge_hook_data {
struct confbridge_conference *conference;
struct confbridge_user *user;
enum ast_bridge_hook_type hook_type;
};
static int send_event_hook_callback(struct ast_bridge_channel *bridge_channel, void *data)
{
struct confbridge_hook_data *hook_data = data;
if (hook_data->hook_type == AST_BRIDGE_HOOK_TYPE_JOIN) {
send_join_event(hook_data->user, hook_data->conference);
} else {
send_leave_event(hook_data->user, hook_data->conference);
}
return 0;
}
/*! \brief The ConfBridge application */
static int confbridge_exec(struct ast_channel *chan, const char *data)
{
@ -2328,6 +2646,9 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
.tech_args.silence_threshold = DEFAULT_SILENCE_THRESHOLD,
.tech_args.drop_silence = 0,
};
struct confbridge_hook_data *join_hook_data;
struct confbridge_hook_data *leave_hook_data;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(conf_name);
AST_APP_ARG(b_profile_name);
@ -2335,10 +2656,6 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
AST_APP_ARG(menu_profile_name);
);
if (ast_channel_state(chan) != AST_STATE_UP) {
ast_answer(chan);
}
if (ast_bridge_features_init(&user.features)) {
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "FAILED");
res = -1;
@ -2388,6 +2705,11 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
goto confbridge_cleanup;
}
/* If channel hasn't been answered already, answer it, unless we're explicitly not supposed to */
if ((ast_channel_state(chan) != AST_STATE_UP) && (ast_test_flag(&user.u_profile, USER_OPT_ANSWER_CHANNEL))) {
ast_answer(chan);
}
quiet = ast_test_flag(&user.u_profile, USER_OPT_QUIET);
/* ask for a PIN immediately after finding user profile. This has to be
@ -2431,6 +2753,13 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
user.features.dtmf_passthrough = 0;
}
/* Set if text messaging is enabled for this user or not */
if (ast_test_flag(&user.u_profile, USER_OPT_TEXT_MESSAGING)) {
user.features.text_messaging = 1;
} else {
user.features.text_messaging = 0;
}
/* Set dsp threshold values if present */
if (user.u_profile.talking_threshold) {
user.tech_args.talking_threshold = user.u_profile.talking_threshold;
@ -2481,17 +2810,24 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
ast_autoservice_stop(chan);
}
/* Play the Join sound to both the conference and the user entering. */
if (!quiet) {
const char *join_sound = conf_get_sound(CONF_SOUND_JOIN, conference->b_profile.sounds);
if (strcmp(conference->b_profile.language, ast_channel_language(chan))) {
ast_stream_and_wait(chan, join_sound, "");
/* if hear_own_join_sound is enabled play the Join sound to everyone */
if (ast_test_flag(&user.u_profile, USER_OPT_HEAR_OWN_JOIN_SOUND) ) {
if (strcmp(conference->b_profile.language, ast_channel_language(chan))) {
ast_stream_and_wait(chan, join_sound, "");
ast_autoservice_start(chan);
play_sound_file(conference, join_sound);
ast_autoservice_stop(chan);
} else {
async_play_sound_file(conference, join_sound, chan);
}
/* if hear_own_join_sound is disabled only play the Join sound to just the conference */
} else {
ast_autoservice_start(chan);
play_sound_file(conference, join_sound);
ast_autoservice_stop(chan);
} else {
async_play_sound_file(conference, join_sound, chan);
}
}
@ -2510,8 +2846,39 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
conf_moh_unsuspend(&user);
/* Join our conference bridge for real */
send_join_event(&user, conference);
join_hook_data = ast_malloc(sizeof(*join_hook_data));
if (!join_hook_data) {
res = -1;
goto confbridge_cleanup;
}
join_hook_data->user = &user;
join_hook_data->conference = conference;
join_hook_data->hook_type = AST_BRIDGE_HOOK_TYPE_JOIN;
res = ast_bridge_join_hook(&user.features, send_event_hook_callback,
join_hook_data, ast_free_ptr, 0);
if (res) {
ast_free(join_hook_data);
ast_log(LOG_ERROR, "Couldn't add bridge join hook for channel '%s'\n", ast_channel_name(chan));
goto confbridge_cleanup;
}
leave_hook_data = ast_malloc(sizeof(*leave_hook_data));
if (!leave_hook_data) {
/* join_hook_data is cleaned up by ast_bridge_features_cleanup via the goto */
res = -1;
goto confbridge_cleanup;
}
leave_hook_data->user = &user;
leave_hook_data->conference = conference;
leave_hook_data->hook_type = AST_BRIDGE_HOOK_TYPE_LEAVE;
res = ast_bridge_leave_hook(&user.features, send_event_hook_callback,
leave_hook_data, ast_free_ptr, 0);
if (res) {
/* join_hook_data is cleaned up by ast_bridge_features_cleanup via the goto */
ast_free(leave_hook_data);
ast_log(LOG_ERROR, "Couldn't add bridge leave hook for channel '%s'\n", ast_channel_name(chan));
goto confbridge_cleanup;
}
if (ast_bridge_join_hook(&user.features, join_callback, NULL, NULL, 0)) {
async_play_sound_ready(user.chan);
@ -2533,8 +2900,6 @@ static int confbridge_exec(struct ast_channel *chan, const char *data)
pbx_builtin_setvar_helper(chan, "CONFBRIDGE_RESULT", "HANGUP");
}
send_leave_event(&user, conference);
/* if we're shutting down, don't attempt to do further processing */
if (ast_shutting_down()) {
/*
@ -3225,7 +3590,7 @@ static char *handle_cli_confbridge_list(struct ast_cli_entry *e, int cmd, struct
return CLI_SHOWUSAGE;
}
/* \internal
/*! \internal
* \brief finds a conference by name and locks/unlocks.
*
* \retval 0 success
@ -3249,7 +3614,7 @@ static int generic_lock_unlock_helper(int lock, const char *conference_name)
return res;
}
/* \internal
/*! \internal
* \brief finds a conference user by channel name and mutes/unmutes them.
*
* \retval 0 success
@ -3549,6 +3914,90 @@ static struct ast_custom_function confbridge_info_function = {
.read = func_confbridge_info,
};
static int func_confbridge_channels(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
char *parse, *outbuf;
struct confbridge_conference *conference;
struct confbridge_user *user;
int bytes, count = 0;
size_t outlen;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(type);
AST_APP_ARG(confno);
);
/* parse all the required arguments and make sure they exist. */
if (ast_strlen_zero(data)) {
return -1;
}
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
if (ast_strlen_zero(args.confno) || ast_strlen_zero(args.type)) {
ast_log(LOG_WARNING, "Usage: %s(category,confno)", cmd);
return -1;
}
conference = ao2_find(conference_bridges, args.confno, OBJ_KEY);
if (!conference) {
ast_debug(1, "No such conference: %s\n", args.confno);
return -1;
}
outbuf = buf;
outlen = len;
ao2_lock(conference);
if (!strcasecmp(args.type, "parties")) {
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
bytes = snprintf(outbuf, outlen, "%s%s", count++ ? "," : "", ast_channel_name(user->chan));
outbuf += bytes;
outlen -= bytes;
}
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
bytes = snprintf(outbuf, outlen, "%s%s", count++ ? "," : "", ast_channel_name(user->chan));
outbuf += bytes;
outlen -= bytes;
}
} else if (!strcasecmp(args.type, "active")) {
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
bytes = snprintf(outbuf, outlen, "%s%s", count++ ? "," : "", ast_channel_name(user->chan));
outbuf += bytes;
outlen -= bytes;
}
} else if (!strcasecmp(args.type, "waiting")) {
AST_LIST_TRAVERSE(&conference->waiting_list, user, list) {
bytes = snprintf(outbuf, outlen, "%s%s", count++ ? "," : "", ast_channel_name(user->chan));
outbuf += bytes;
outlen -= bytes;
}
} else if (!strcasecmp(args.type, "admins")) {
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
if (ast_test_flag(&user->u_profile, USER_OPT_ADMIN)) {
bytes = snprintf(outbuf, outlen, "%s%s", count++ ? "," : "", ast_channel_name(user->chan));
outbuf += bytes;
outlen -= bytes;
}
}
} else if (!strcasecmp(args.type, "marked")) {
AST_LIST_TRAVERSE(&conference->active_list, user, list) {
if (ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)) {
bytes = snprintf(outbuf, outlen, "%s%s", count++ ? "," : "", ast_channel_name(user->chan));
outbuf += bytes;
outlen -= bytes;
}
}
} else {
ast_log(LOG_ERROR, "Invalid keyword '%s' passed to %s.\n", args.type, cmd);
}
ao2_unlock(conference);
ao2_ref(conference, -1);
return 0;
}
static struct ast_custom_function confbridge_channels_function = {
.name = "CONFBRIDGE_CHANNELS",
.read = func_confbridge_channels,
};
static int action_confbridgelist_item(struct mansession *s, const char *id_text, struct confbridge_conference *conference, struct confbridge_user *user, int waiting)
{
struct ast_channel_snapshot *snapshot;
@ -3573,6 +4022,7 @@ static int action_confbridgelist_item(struct mansession *s, const char *id_text,
"MarkedUser: %s\r\n"
"WaitMarked: %s\r\n"
"EndMarked: %s\r\n"
"EndMarkedAny: %s\r\n"
"Waiting: %s\r\n"
"Muted: %s\r\n"
"Talking: %s\r\n"
@ -3585,6 +4035,7 @@ static int action_confbridgelist_item(struct mansession *s, const char *id_text,
AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_MARKEDUSER)),
AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_WAITMARKED)),
AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ENDMARKED)),
AST_YESNO(ast_test_flag(&user->u_profile, USER_OPT_ENDMARKEDANY)),
AST_YESNO(waiting),
AST_YESNO(user->muted),
AST_YESNO(user->talking),
@ -3984,6 +4435,53 @@ static int func_confbridge_info(struct ast_channel *chan, const char *cmd, char
return 0;
}
static int confkick_exec(struct ast_channel *chan, const char *data)
{
char *parse;
struct confbridge_conference *conference;
int not_found;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(confbridge);
AST_APP_ARG(channel);
);
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "No conference bridge specified.\n");
pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE");
return 0;
}
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
conference = ao2_find(conference_bridges, args.confbridge, OBJ_KEY);
if (!conference) {
ast_log(LOG_WARNING, "No conference bridge named '%s' found!\n", args.confbridge);
pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE");
return 0;
}
if (ast_strlen_zero(args.channel)) {
not_found = kick_conference_participant(conference, "all");
} else {
not_found = kick_conference_participant(conference, args.channel);
}
ao2_ref(conference, -1);
if (not_found) {
if (ast_strlen_zero(args.channel) || !strcasecmp("all", args.channel) || !strcasecmp("participants", args.channel)) {
ast_log(LOG_WARNING, "No participants found in conference bridge '%s'!\n", args.confbridge);
} else {
ast_log(LOG_WARNING, "No participant named '%s' found in conference bridge '%s'!\n", args.channel, args.confbridge);
}
pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "FAILURE");
return 0;
}
ast_debug(1, "Kicked '%s' out of conference '%s'\n", args.channel, args.confbridge);
pbx_builtin_setvar_helper(chan, "CONFKICKSTATUS", "SUCCESS");
return 0;
}
void conf_add_user_active(struct confbridge_conference *conference, struct confbridge_user *user)
{
AST_LIST_INSERT_TAIL(&conference->active_list, user, list);
@ -4039,8 +4537,6 @@ void conf_remove_user_waiting(struct confbridge_conference *conference, struct c
* \since 12.0.0
*
* \param tech What to unregister.
*
* \return Nothing
*/
static void unregister_channel_tech(struct ast_channel_tech *tech)
{
@ -4077,9 +4573,11 @@ static int register_channel_tech(struct ast_channel_tech *tech)
static int unload_module(void)
{
ast_unregister_application(app);
ast_unregister_application(app2);
ast_custom_function_unregister(&confbridge_function);
ast_custom_function_unregister(&confbridge_info_function);
ast_custom_function_unregister(&confbridge_channels_function);
ast_cli_unregister_multiple(cli_confbridge, ARRAY_LEN(cli_confbridge));
@ -4135,8 +4633,9 @@ static int load_module(void)
}
/* Create a container to hold the conference bridges */
conference_bridges = ao2_container_alloc(CONFERENCE_BRIDGE_BUCKETS,
conference_bridge_hash_cb, conference_bridge_cmp_cb);
conference_bridges = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,
CONFERENCE_BRIDGE_BUCKETS,
conference_bridge_hash_cb, NULL, conference_bridge_cmp_cb);
if (!conference_bridges) {
unload_module();
return AST_MODULE_LOAD_DECLINE;
@ -4146,9 +4645,11 @@ static int load_module(void)
res |= manager_confbridge_init();
res |= ast_register_application_xml(app, confbridge_exec);
res |= ast_register_application_xml(app2, confkick_exec);
res |= ast_custom_function_register_escalating(&confbridge_function, AST_CFE_WRITE);
res |= ast_custom_function_register(&confbridge_info_function);
res |= ast_custom_function_register(&confbridge_channels_function);
res |= ast_cli_register_multiple(cli_confbridge, ARRAY_LEN(cli_confbridge));

View File

@ -28,6 +28,8 @@
/*** MODULEINFO
<depend>dahdi</depend>
<support_level>deprecated</support_level>
<deprecated_in>16</deprecated_in>
<removed_in>19</removed_in>
***/
#include "asterisk.h"
@ -113,8 +115,10 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args)
c = strsep(&stringp, ",");
}
argv[argc++] = "plugin";
argv[argc++] = "dahdi.so";
if (geteuid() == 0) {
argv[argc++] = "plugin";
argv[argc++] = "dahdi.so";
}
argv[argc++] = "stdin";
/* Finally launch PPP */

View File

@ -74,7 +74,7 @@
Attempt to connect to another device or endpoint and bridge the call.
</synopsis>
<syntax>
<parameter name="Technology/Resource" required="true" argsep="&amp;">
<parameter name="Technology/Resource" required="false" argsep="&amp;">
<argument name="Technology/Resource" required="true">
<para>Specification of the device(s) to dial. These must be in the format of
<literal>Technology/Resource</literal>, where <replaceable>Technology</replaceable>
@ -86,6 +86,7 @@
<para>If you need more than one enter them as
Technology2/Resource2&amp;Technology3/Resource3&amp;.....</para>
</argument>
<xi:include xpointer="xpointer(/docs/info[@name='Dial_Resource'])" />
</parameter>
<parameter name="timeout" required="false">
<para>Specifies the number of seconds we attempt to dial the specified devices.</para>
@ -93,11 +94,17 @@
</parameter>
<parameter name="options" required="false">
<optionlist>
<option name="A">
<argument name="x" required="true">
<option name="A" argsep=":">
<argument name="x">
<para>The file to play to the called party</para>
</argument>
<para>Play an announcement to the called party, where <replaceable>x</replaceable> is the prompt to be played</para>
<argument name="y">
<para>The file to play to the calling party</para>
</argument>
<para>Play an announcement to the called and/or calling parties, where <replaceable>x</replaceable>
is the prompt to be played to the called party and <replaceable>y</replaceable> is the prompt
to be played to the caller. The files may be different and will be played to each party
simultaneously.</para>
</option>
<option name="a">
<para>Immediately answer the calling channel when the called channel answers in
@ -142,16 +149,18 @@
a call to be answered. Exit to that extension if it exists in the
current context, or the context defined in the <variable>EXITCONTEXT</variable> variable,
if it exists.</para>
<note>
<para>Many SIP and ISDN phones cannot send DTMF digits until the call is
connected. If you wish to use this option with these phones, you
can use the <literal>Answer</literal> application before dialing.</para>
</note>
<para>NOTE: Many SIP and ISDN phones cannot send DTMF digits until the call is
connected. If you wish to use this option with these phones, you
can use the <literal>Answer</literal> application before dialing.</para>
</option>
<option name="D" argsep=":">
<argument name="called" />
<argument name="calling" />
<argument name="progress" />
<argument name="mfprogress" />
<argument name="mfwink" />
<argument name="sfprogress" />
<argument name="sfwink" />
<para>Send the specified DTMF strings <emphasis>after</emphasis> the called
party has answered, but before the call gets bridged. The
<replaceable>called</replaceable> DTMF string is sent to the called party, and the
@ -159,6 +168,20 @@
can be used alone. If <replaceable>progress</replaceable> is specified, its DTMF is sent
to the called party immediately after receiving a <literal>PROGRESS</literal> message.</para>
<para>See <literal>SendDTMF</literal> for valid digits.</para>
<para>If <replaceable>mfprogress</replaceable> is specified, its MF is sent
to the called party immediately after receiving a <literal>PROGRESS</literal> message.
If <replaceable>mfwink</replaceable> is specified, its MF is sent
to the called party immediately after receiving a <literal>WINK</literal> message.</para>
<para>See <literal>SendMF</literal> for valid digits.</para>
<para>If <replaceable>sfprogress</replaceable> is specified, its SF is sent
to the called party immediately after receiving a <literal>PROGRESS</literal> message.
If <replaceable>sfwink</replaceable> is specified, its SF is sent
to the called party immediately after receiving a <literal>WINK</literal> message.</para>
<para>See <literal>SendSF</literal> for valid digits.</para>
</option>
<option name="E">
<para>Enable echoing of sent MF or SF digits back to caller (e.g. "hearpulsing").
Used in conjunction with the D option.</para>
</option>
<option name="e">
<para>Execute the <literal>h</literal> extension for peer after the call ends</para>
@ -177,21 +200,15 @@
<argument name="priority" required="true" />
<para>When the caller hangs up, transfer the <emphasis>called</emphasis> party
to the specified destination and <emphasis>start</emphasis> execution at that location.</para>
<note>
<para>Any channel variables you want the called channel to inherit from the caller channel must be
prefixed with one or two underbars ('_').</para>
</note>
<para>NOTE: Any channel variables you want the called channel to inherit from the caller channel must be
prefixed with one or two underbars ('_').</para>
</option>
<option name="F">
<para>When the caller hangs up, transfer the <emphasis>called</emphasis> party to the next priority of the current extension
and <emphasis>start</emphasis> execution at that location.</para>
<note>
<para>Any channel variables you want the called channel to inherit from the caller channel must be
prefixed with one or two underbars ('_').</para>
</note>
<note>
<para>Using this option from a Macro() or GoSub() might not make sense as there would be no return points.</para>
</note>
<para>NOTE: Any channel variables you want the called channel to inherit from the caller channel must be
prefixed with one or two underbars ('_').</para>
<para>NOTE: Using this option from a Macro() or GoSub() might not make sense as there would be no return points.</para>
</option>
<option name="g">
<para>Proceed with dialplan execution at the next priority in the current extension if the
@ -204,9 +221,7 @@
<para>If the call is answered, transfer the calling party to
the specified <replaceable>priority</replaceable> and the called party to the specified
<replaceable>priority</replaceable> plus one.</para>
<note>
<para>You cannot use any additional action post answer options in conjunction with this option.</para>
</note>
<para>NOTE: You cannot use any additional action post answer options in conjunction with this option.</para>
</option>
<option name="h">
<para>Allow the called party to hang up by sending the DTMF sequence
@ -215,12 +230,10 @@
<option name="H">
<para>Allow the calling party to hang up by sending the DTMF sequence
defined for disconnect in <filename>features.conf</filename>.</para>
<note>
<para>Many SIP and ISDN phones cannot send DTMF digits until the call is
connected. If you wish to allow DTMF disconnect before the dialed
party answers with these phones, you can use the <literal>Answer</literal>
application before dialing.</para>
</note>
<para>NOTE: Many SIP and ISDN phones cannot send DTMF digits until the call is
connected. If you wish to allow DTMF disconnect before the dialed
party answers with these phones, you can use the <literal>Answer</literal>
application before dialing.</para>
</option>
<option name="i">
<para>Asterisk will ignore any forwarding requests it may receive on this dial attempt.</para>
@ -316,18 +329,14 @@
</value>
</variable>
</variablelist>
<note>
<para>You cannot use any additional action post answer options in conjunction
with this option. Also, pbx services are run on the peer (called) channel,
so you will not be able to set timeouts via the <literal>TIMEOUT()</literal> function in this macro.</para>
</note>
<warning><para>Be aware of the limitations that macros have, specifically with regards to use of
<para>NOTE: You cannot use any additional action post answer options in conjunction
with this option. Also, pbx services are run on the peer (called) channel,
so you will not be able to set timeouts via the <literal>TIMEOUT()</literal> function in this macro.</para>
<para>WARNING: Be aware of the limitations that macros have, specifically with regards to use of
the <literal>WaitExten</literal> application. For more information, see the documentation for
<literal>Macro()</literal>.</para></warning>
<note>
<para>Macros are deprecated, GoSub should be used instead,
see the <literal>U</literal> option.</para>
</note>
<literal>Macro()</literal>.</para>
<para>NOTE: Macros are deprecated, GoSub should be used instead,
see the <literal>U</literal> option.</para>
</option>
<option name="n">
<argument name="delete">
@ -363,7 +372,7 @@
</argument>
<para>Enables <emphasis>operator services</emphasis> mode. This option only
works when bridging a DAHDI channel to another DAHDI channel
only. if specified on non-DAHDI interfaces, it will be ignored.
only. If specified on non-DAHDI interfaces, it will be ignored.
When the destination answers (presumably an operator services
station), the originator no longer has control of their line.
They may hang up, but the switch will not release their line
@ -392,10 +401,8 @@
to send no cause. See the <filename>causes.h</filename> file for the
full list of valid causes and names.
</para>
<note>
<para>chan_sip does not support setting the cause on a CANCEL to anything
other than ANSWERED_ELSEWHERE.</para>
</note>
<para>NOTE: chan_sip does not support setting the cause on a CANCEL to anything
other than ANSWERED_ELSEWHERE.</para>
</option>
<option name="r">
<para>Default: Indicate ringing to the calling party, even if the called party isn't actually ringing. Pass no audio to the calling
@ -430,7 +437,8 @@
</option>
<option name="U" argsep="^">
<argument name="x" required="true">
<para>Name of the subroutine to execute via <literal>Gosub</literal></para>
<para>Name of the subroutine context to execute via <literal>Gosub</literal>.
The subroutine execution starts in the named context at the s exten and priority 1.</para>
</argument>
<argument name="arg" multiple="true" required="false">
<para>Arguments for the <literal>Gosub</literal> routine</para>
@ -459,11 +467,9 @@
</value>
</variable>
</variablelist>
<note>
<para>You cannot use any additional action post answer options in conjunction
with this option. Also, pbx services are run on the peer (called) channel,
so you will not be able to set timeouts via the <literal>TIMEOUT()</literal> function in this routine.</para>
</note>
<para>NOTE: You cannot use any additional action post answer options in conjunction
with this option. Also, pbx services are run on the <emphasis>called</emphasis> channel,
so you will not be able to set timeouts via the <literal>TIMEOUT()</literal> function in this routine.</para>
</option>
<option name="u">
<argument name = "x" required="true">
@ -512,7 +518,6 @@
answered, if it has not already been answered. These two channels will then
be active in a bridged call. All other channels that were requested will then
be hung up.</para>
<para>Unless there is a timeout specified, the Dial application will wait
indefinitely until one of the called channels answers, the user hangs up, or
if all of the called channels are busy or unavailable. Dialplan execution will
@ -525,7 +530,6 @@
If the <variable>OUTBOUND_GROUP_ONCE</variable> variable is set, all peer channels created by this
application will be put into that group (as in <literal>Set(GROUP()=...</literal>). Unlike <variable>OUTBOUND_GROUP</variable>,
however, the variable will be unset after use.</para>
<example title="Dial with 30 second timeout">
same => n,Dial(PJSIP/alice,30)
</example>
@ -547,28 +551,24 @@
</example>
<example title="Dial with pre-dial subroutines">
[default]
exten => callee_channel,1,NoOp()
exten => callee_channel,1,NoOp(ARG1=${ARG1} ARG2=${ARG2})
same => n,Log(NOTICE, I'm called on channel ${CHANNEL} prior to it starting the dial attempt)
same => n,Return()
exten => called_channel,1,NoOp()
exten => called_channel,1,NoOp(ARG1=${ARG1} ARG2=${ARG2})
same => n,Log(NOTICE, I'm called on outbound channel ${CHANNEL} prior to it being used to dial someone)
same => n,Return()
exten => _X.,1,NoOp()
same => n,Dial(PJSIP/alice,,b(default^called_channel^1)B(default^callee_channel^1))
same => n,Dial(PJSIP/alice,,b(default^called_channel^1(my_gosub_arg1^my_gosub_arg2))B(default^callee_channel^1(my_gosub_arg1^my_gosub_arg2)))
same => n,Hangup()
</example>
<example title="Dial with post-answer subroutine executed on outbound channel">
[default]
exten => called_channel,1,NoOp()
[my_gosub_routine]
exten => s,1,NoOp(ARG1=${ARG1} ARG2=${ARG2})
same => n,Playback(hello)
same => n,Return()
[default]
exten => _X.,1,NoOp()
same => n,Dial(PJSIP/alice,,U(default^called_channel^1))
same => n,Dial(PJSIP/alice,,U(my_gosub_routine^my_gosub_arg1^my_gosub_arg2))
same => n,Hangup()
</example>
<example title="Dial into ConfBridge using 'G' option">
@ -582,9 +582,27 @@
<variable name="DIALEDTIME">
<para>This is the time from dialing a channel until when it is disconnected.</para>
</variable>
<variable name="DIALEDTIME_MS">
<para>This is the milliseconds version of the DIALEDTIME variable.</para>
</variable>
<variable name="ANSWEREDTIME">
<para>This is the amount of time for actual call.</para>
</variable>
<variable name="ANSWEREDTIME_MS">
<para>This is the milliseconds version of the ANSWEREDTIME variable.</para>
</variable>
<variable name="RINGTIME">
<para>This is the time from creating the channel to the first RINGING event received. Empty if there was no ring.</para>
</variable>
<variable name="RINGTIME_MS">
<para>This is the milliseconds version of the RINGTIME variable.</para>
</variable>
<variable name="PROGRESSTIME">
<para>This is the time from creating the channel to the first PROGRESS event received. Empty if there was no such event.</para>
</variable>
<variable name="PROGRESSTIME_MS">
<para>This is the milliseconds version of the PROGRESSTIME variable.</para>
</variable>
<variable name="DIALEDPEERNAME">
<para>The name of the outbound channel that answered the call.</para>
</variable>
@ -596,12 +614,31 @@
</variable>
<variable name="DIALSTATUS">
<para>This is the status of the call</para>
<value name="CHANUNAVAIL" />
<value name="CONGESTION" />
<value name="NOANSWER" />
<value name="BUSY" />
<value name="ANSWER" />
<value name="CANCEL" />
<value name="CHANUNAVAIL">
Either the dialed peer exists but is not currently reachable, e.g.
endpoint is not registered, or an attempt was made to call a
nonexistent location, e.g. nonexistent DNS hostname.
</value>
<value name="CONGESTION">
Channel or switching congestion occured when routing the call.
This can occur if there is a slow or no response from the remote end.
</value>
<value name="NOANSWER">
Called party did not answer.
</value>
<value name="BUSY">
The called party was busy or indicated a busy status.
Note that some SIP devices will respond with 486 Busy if their Do Not Disturb
modes are active. In this case, you can use DEVICE_STATUS to check if the
endpoint is actually in use, if needed.
</value>
<value name="ANSWER">
The call was answered.
Any other result implicitly indicates the call was not answered.
</value>
<value name="CANCEL">
Dial was cancelled before call was answered or reached some other terminating event.
</value>
<value name="DONTCALL">
For the Privacy and Screening Modes.
Will be set if the called party chooses to send the calling party to the 'Go Away' script.
@ -610,7 +647,9 @@
For the Privacy and Screening Modes.
Will be set if the called party chooses to send the calling party to the 'torture' script.
</value>
<value name="INVALIDARGS" />
<value name="INVALIDARGS">
Dial failed due to invalid syntax.
</value>
</variable>
</variablelist>
</description>
@ -710,6 +749,7 @@ enum {
#define OPT_PREDIAL_CALLER (1LLU << 42)
#define OPT_RING_WITH_EARLY_MEDIA (1LLU << 43)
#define OPT_HANGUPCAUSE (1LLU << 44)
#define OPT_HEARPULSING (1LLU << 45)
enum {
OPT_ARG_ANNOUNCE = 0,
@ -745,6 +785,7 @@ AST_APP_OPTIONS(dial_exec_options, BEGIN_OPTIONS
AST_APP_OPTION('c', OPT_CANCEL_ELSEWHERE),
AST_APP_OPTION('d', OPT_DTMF_EXIT),
AST_APP_OPTION_ARG('D', OPT_SENDDTMF, OPT_ARG_SENDDTMF),
AST_APP_OPTION('E', OPT_HEARPULSING),
AST_APP_OPTION('e', OPT_PEER_H),
AST_APP_OPTION_ARG('f', OPT_FORCECLID, OPT_ARG_FORCECLID),
AST_APP_OPTION_ARG('F', OPT_CALLEE_GO_ON, OPT_ARG_CALLEE_GO_ON),
@ -923,7 +964,7 @@ static const char *get_cid_name(char *name, int namelen, struct ast_channel *cha
* XXX this code is highly suspicious, as it essentially overwrites
* the outgoing channel without properly deleting it.
*
* \todo eventually this function should be intergrated into and replaced by ast_call_forward()
* \todo eventually this function should be integrated into and replaced by ast_call_forward()
*/
static void do_forward(struct chanlist *o, struct cause_args *num,
struct ast_flags64 *peerflags, int single, int caller_entertained, int *to,
@ -1002,7 +1043,8 @@ static void do_forward(struct chanlist *o, struct cause_args *num,
* any Dial operations that happen later won't record CC interfaces.
*/
ast_ignore_cc(o->chan);
ast_log(LOG_NOTICE, "Not accepting call completion offers from call-forward recipient %s\n", ast_channel_name(o->chan));
ast_verb(3, "Not accepting call completion offers from call-forward recipient %s\n",
ast_channel_name(o->chan));
} else
ast_log(LOG_NOTICE,
"Forwarding failed to create channel to dial '%s/%s' (cause = %d)\n",
@ -1138,6 +1180,7 @@ struct privacy_args {
char privcid[256];
char privintro[1024];
char status[256];
int canceled;
};
static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
@ -1159,8 +1202,6 @@ static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out
* \param chan Channel to get connected line updated.
* \param peer Channel providing connected line information.
* \param is_caller Non-zero if chan is the calling channel.
*
* \return Nothing
*/
static void update_connected_line_from_peer(struct ast_channel *chan, struct ast_channel *peer, int is_caller)
{
@ -1179,11 +1220,31 @@ static void update_connected_line_from_peer(struct ast_channel *chan, struct ast
ast_party_connected_line_free(&connected_caller);
}
/*!
* \internal
* \pre chan is locked
*/
static void set_duration_var(struct ast_channel *chan, const char *var_base, int64_t duration)
{
char buf[32];
char full_var_name[128];
snprintf(buf, sizeof(buf), "%" PRId64, duration / 1000);
pbx_builtin_setvar_helper(chan, var_base, buf);
snprintf(full_var_name, sizeof(full_var_name), "%s_MS", var_base);
snprintf(buf, sizeof(buf), "%" PRId64, duration);
pbx_builtin_setvar_helper(chan, full_var_name, buf);
}
static struct ast_channel *wait_for_answer(struct ast_channel *in,
struct dial_head *out_chans, int *to, struct ast_flags64 *peerflags,
char *opt_args[],
struct privacy_args *pa,
const struct cause_args *num_in, int *result, char *dtmf_progress,
char *mf_progress, char *mf_wink,
char *sf_progress, char *sf_wink,
const int hearpulsing,
const int ignore_cc,
struct ast_party_id *forced_clid, struct ast_party_id *stored_clid)
{
@ -1201,6 +1262,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
int is_cc_recall;
int cc_frame_received = 0;
int num_ringing = 0;
int sent_ring = 0;
int sent_progress = 0, sent_wink = 0;
struct timeval start = ast_tvnow();
if (single) {
@ -1474,6 +1537,23 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_indicate(in, AST_CONTROL_RINGING);
pa->sentringing++;
}
if (!sent_ring) {
struct timeval now, then;
int64_t diff;
now = ast_tvnow();
ast_channel_lock(in);
ast_channel_stage_snapshot(in);
then = ast_channel_creationtime(c);
diff = ast_tvzero(then) ? 0 : ast_tvdiff_ms(now, then);
set_duration_var(in, "RINGTIME", diff);
ast_channel_stage_snapshot_done(in);
ast_channel_unlock(in);
sent_ring = 1;
}
}
ast_channel_publish_dial(in, c, NULL, "RINGING");
break;
@ -1489,14 +1569,72 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_indicate(in, AST_CONTROL_PROGRESS);
}
}
if (!ast_strlen_zero(dtmf_progress)) {
ast_verb(3,
"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);
if (!sent_progress) {
struct timeval now, then;
int64_t diff;
now = ast_tvnow();
ast_channel_lock(in);
ast_channel_stage_snapshot(in);
then = ast_channel_creationtime(c);
diff = ast_tvzero(then) ? 0 : ast_tvdiff_ms(now, then);
set_duration_var(in, "PROGRESSTIME", diff);
ast_channel_stage_snapshot_done(in);
ast_channel_unlock(in);
sent_progress = 1;
if (!ast_strlen_zero(mf_progress)) {
ast_verb(3,
"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),
(hearpulsing ? in : NULL), mf_progress, 50, 55, 120, 65, 0);
}
if (!ast_strlen_zero(sf_progress)) {
ast_verb(3,
"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),
(hearpulsing ? in : NULL), sf_progress, 0, 0);
}
if (!ast_strlen_zero(dtmf_progress)) {
ast_verb(3,
"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);
}
}
ast_channel_publish_dial(in, c, NULL, "PROGRESS");
break;
case AST_CONTROL_WINK:
ast_verb(3, "%s winked, passing it to %s\n", ast_channel_name(c), ast_channel_name(in));
if (!sent_wink) {
sent_wink = 1;
if (!ast_strlen_zero(mf_wink)) {
ast_verb(3,
"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),
(hearpulsing ? in : NULL), mf_wink, 50, 55, 120, 65, 0);
}
if (!ast_strlen_zero(sf_wink)) {
ast_verb(3,
"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),
(hearpulsing ? in : NULL), sf_wink, 0, 0);
}
}
ast_indicate(in, AST_CONTROL_WINK);
break;
case AST_CONTROL_VIDUPDATE:
case AST_CONTROL_SRCUPDATE:
case AST_CONTROL_SRCCHANGE:
@ -1641,6 +1779,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
/* Got hung up */
*to = -1;
strcpy(pa->status, "CANCEL");
pa->canceled = 1;
publish_dial_end_event(in, out_chans, NULL, pa->status);
if (f) {
if (f->data.uint32) {
@ -1665,6 +1804,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
*to = 0;
*result = f->subclass.integer;
strcpy(pa->status, "CANCEL");
pa->canceled = 1;
publish_dial_end_event(in, out_chans, NULL, pa->status);
ast_frfree(f);
ast_channel_unlock(in);
@ -1681,6 +1821,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_verb(3, "User requested call disconnect.\n");
*to = 0;
strcpy(pa->status, "CANCEL");
pa->canceled = 1;
publish_dial_end_event(in, out_chans, NULL, pa->status);
ast_frfree(f);
if (is_cc_recall) {
@ -1734,6 +1875,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_verb(3, "Call on %s left from hold\n", ast_channel_name(o->chan));
ast_indicate(o->chan, AST_CONTROL_UNHOLD);
break;
case AST_CONTROL_FLASH:
ast_verb(3, "Hook flash on %s\n", ast_channel_name(o->chan));
ast_indicate(o->chan, AST_CONTROL_FLASH);
break;
case AST_CONTROL_VIDUPDATE:
case AST_CONTROL_SRCUPDATE:
case AST_CONTROL_SRCCHANGE:
@ -1750,12 +1895,20 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_indicate(o->chan, f->subclass.integer);
break;
case AST_CONTROL_CONNECTED_LINE:
if (ast_test_flag64(o, OPT_IGNORE_CONNECTEDLINE)) {
ast_verb(3, "Connected line update to %s prevented.\n", ast_channel_name(o->chan));
break;
}
if (ast_channel_connected_line_sub(in, o->chan, f, 1) &&
ast_channel_connected_line_macro(in, o->chan, f, 0, 1)) {
ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
}
break;
case AST_CONTROL_REDIRECTING:
if (ast_test_flag64(o, OPT_IGNORE_CONNECTEDLINE)) {
ast_verb(3, "Redirecting update to %s prevented.\n", ast_channel_name(o->chan));
break;
}
if (ast_channel_redirecting_sub(in, o->chan, f, 1) &&
ast_channel_redirecting_macro(in, o->chan, f, 0, 1)) {
ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
@ -1941,7 +2094,7 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
/* well, there seems basically two choices. Just patch the caller thru immediately,
or,... put 'em thru to voicemail. */
/* since the callee may have hung up, let's do the voicemail thing, no database decision */
ast_log(LOG_NOTICE, "privacy: no valid response from the callee. Sending the caller to voicemail, the callee isn't responding\n");
ast_verb(3, "privacy: no valid response from the callee. Sending the caller to voicemail, the callee isn't responding\n");
/* XXX should we set status to DENY ? */
/* XXX what about the privacy flags ? */
break;
@ -2040,9 +2193,7 @@ static int setup_privacy_args(struct privacy_args *pa,
/* the file doesn't exist yet. Let the caller submit his
vocal intro for posterity */
/* priv-recordintro script:
"At the tone, please say your name:"
*/
int silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE);
ast_answer(chan);
@ -2067,18 +2218,12 @@ static int setup_privacy_args(struct privacy_args *pa,
static void end_bridge_callback(void *data)
{
char buf[80];
time_t end;
struct ast_channel *chan = data;
time(&end);
ast_channel_lock(chan);
ast_channel_stage_snapshot(chan);
snprintf(buf, sizeof(buf), "%d", ast_channel_get_up_time(chan));
pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
snprintf(buf, sizeof(buf), "%d", ast_channel_get_duration(chan));
pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
set_duration_var(chan, "ANSWEREDTIME", ast_channel_get_up_time_ms(chan));
set_duration_var(chan, "DIALEDTIME", ast_channel_get_duration_ms(chan));
ast_channel_stage_snapshot_done(chan);
ast_channel_unlock(chan);
}
@ -2126,8 +2271,6 @@ static int dial_handle_playtones(struct ast_channel *chan, const char *data)
* \param peer Peer channel for bridge.
* \param opts Dialing option flags.
* \param opt_args Dialing option argument strings.
*
* \return Nothing
*/
static void setup_peer_after_bridge_goto(struct ast_channel *chan, struct ast_channel *peer, struct ast_flags64 *opts, char *opt_args[])
{
@ -2161,15 +2304,18 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
struct ast_channel *peer;
int to; /* timeout */
struct cause_args num = { chan, 0, 0, 0 };
int cause;
int cause, hanguptreecause = -1;
struct ast_bridge_config config = { { 0, } };
struct timeval calldurationlimit = { 0, };
char *dtmfcalled = NULL, *dtmfcalling = NULL, *dtmf_progress=NULL;
char *dtmfcalled = NULL, *dtmfcalling = NULL, *dtmf_progress = NULL;
char *mf_progress = NULL, *mf_wink = NULL;
char *sf_progress = NULL, *sf_wink = NULL;
struct privacy_args pa = {
.sentringing = 0,
.privdb_val = 0,
.status = "INVALIDARGS",
.canceled = 0,
};
int sentringing = 0, moh = 0;
const char *outbound_group = NULL;
@ -2220,7 +2366,13 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
pbx_builtin_setvar_helper(chan, "DIALEDPEERNUMBER", "");
pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", "");
pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", "");
pbx_builtin_setvar_helper(chan, "ANSWEREDTIME_MS", "");
pbx_builtin_setvar_helper(chan, "DIALEDTIME", "");
pbx_builtin_setvar_helper(chan, "DIALEDTIME_MS", "");
pbx_builtin_setvar_helper(chan, "RINGTIME", "");
pbx_builtin_setvar_helper(chan, "RINGTIME_MS", "");
pbx_builtin_setvar_helper(chan, "PROGRESSTIME", "");
pbx_builtin_setvar_helper(chan, "PROGRESSTIME_MS", "");
ast_channel_stage_snapshot_done(chan);
max_forwards = ast_max_forwards_get(chan);
ast_channel_unlock(chan);
@ -2232,12 +2384,6 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
return -1;
}
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Dial requires an argument (technology/resource)\n");
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
return -1;
}
if (ast_check_hangup_locked(chan)) {
/*
* Caller hung up before we could dial. If dial is executed
@ -2256,7 +2402,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
return -1;
}
parse = ast_strdupa(data);
parse = ast_strdupa(data ?: "");
AST_STANDARD_APP_ARGS(args, parse);
@ -2266,12 +2412,6 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
goto done;
}
if (ast_strlen_zero(args.peers)) {
ast_log(LOG_WARNING, "Dial requires an argument (technology/resource)\n");
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
goto done;
}
if (ast_cc_call_init(chan, &ignore_cc)) {
goto done;
}
@ -2297,7 +2437,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
if (ast_test_flag64(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
calldurationlimit.tv_sec = atoi(opt_args[OPT_ARG_DURATION_STOP]);
if (!calldurationlimit.tv_sec) {
ast_log(LOG_WARNING, "Dial does not accept S(%s), hanging up.\n", opt_args[OPT_ARG_DURATION_STOP]);
ast_log(LOG_WARNING, "Dial does not accept S(%s)\n", opt_args[OPT_ARG_DURATION_STOP]);
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
goto done;
}
@ -2305,9 +2445,13 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
}
if (ast_test_flag64(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
dtmf_progress = opt_args[OPT_ARG_SENDDTMF];
dtmfcalled = strsep(&dtmf_progress, ":");
dtmfcalling = strsep(&dtmf_progress, ":");
sf_wink = opt_args[OPT_ARG_SENDDTMF];
dtmfcalled = strsep(&sf_wink, ":");
dtmfcalling = strsep(&sf_wink, ":");
dtmf_progress = strsep(&sf_wink, ":");
mf_progress = strsep(&sf_wink, ":");
mf_wink = strsep(&sf_wink, ":");
sf_progress = strsep(&sf_wink, ":");
}
if (ast_test_flag64(&opts, OPT_DURATION_LIMIT) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_LIMIT])) {
@ -2444,14 +2588,25 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
/* loop through the list of dial destinations */
rest = args.peers;
while ((cur = strsep(&rest, "&")) ) {
while ((cur = strsep(&rest, "&"))) {
struct ast_channel *tc; /* channel for this destination */
/* Get a technology/resource pair */
char *number = cur;
char *tech = strsep(&number, "/");
char *number;
char *tech;
int i;
size_t tech_len;
size_t number_len;
struct ast_stream_topology *topology;
struct ast_stream *stream;
cur = ast_strip(cur);
if (ast_strlen_zero(cur)) {
/* No tech/resource in this position. */
continue;
}
/* Get a technology/resource pair */
number = cur;
tech = strsep(&number, "/");
num_dialed++;
if (ast_strlen_zero(number)) {
@ -2507,13 +2662,29 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
ast_channel_unlock(chan);
for (i = 0; i < ast_stream_topology_get_count(topology); ++i) {
stream = ast_stream_topology_get_stream(topology, i);
/* For both recvonly and sendonly the stream state reflects our state, that is we
* are receiving only and we are sending only. Since we are requesting a
* channel for the peer, we need to swap this to reflect what we will be doing.
* That is, if we are receiving from Alice then we want to be sending to Bob,
* so swap recvonly to sendonly and vice versa.
*/
if (ast_stream_get_state(stream) == AST_STREAM_STATE_RECVONLY) {
ast_stream_set_state(stream, AST_STREAM_STATE_SENDONLY);
} else if (ast_stream_get_state(stream) == AST_STREAM_STATE_SENDONLY) {
ast_stream_set_state(stream, AST_STREAM_STATE_RECVONLY);
}
}
tc = ast_request_with_stream_topology(tmp->tech, topology, NULL, chan, tmp->number, &cause);
ast_stream_topology_free(topology);
if (!tc) {
/* If we can't, just go on to the next call */
ast_log(LOG_WARNING, "Unable to create channel of type '%s' (cause %d - %s)\n",
/* Failure doesn't necessarily mean user error. DAHDI channels could be busy. */
ast_log(LOG_NOTICE, "Unable to create channel of type '%s' (cause %d - %s)\n",
tmp->tech, cause, ast_cause2str(cause));
handle_cause(cause, &num);
if (!rest) {
@ -2651,6 +2822,19 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
AST_LIST_INSERT_TAIL(&out_chans, tmp, node);
}
/* As long as we attempted to dial valid peers, don't throw a warning. */
/* If a DAHDI peer is busy, out_chans will be empty so checking list size is misleading. */
if (!num_dialed) {
ast_verb(3, "No devices or endpoints to dial (technology/resource)\n");
if (continue_exec) {
/* There is no point in having RetryDial try again */
*continue_exec = 1;
}
strcpy(pa.status, "CHANUNAVAIL");
res = 0;
goto out;
}
/*
* PREDIAL: Run gosub on all of the callee channels
*
@ -2764,7 +2948,9 @@ 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,
dtmf_progress, ignore_cc, &forced_clid, &stored_clid);
dtmf_progress, mf_progress, mf_wink, sf_progress, sf_wink,
(ast_test_flag64(&opts, OPT_HEARPULSING) ? 1 : 0),
ignore_cc, &forced_clid, &stored_clid);
if (!peer) {
if (result) {
@ -2848,33 +3034,71 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
int digit = 0;
struct ast_channel *chans[2];
struct ast_channel *active_chan;
char *calledfile = NULL, *callerfile = NULL;
int calledstream = 0, callerstream = 0;
chans[0] = chan;
chans[1] = peer;
/* we need to stream the announcement while monitoring the caller for a hangup */
/* we need to stream the announcement(s) when the OPT_ARG_ANNOUNCE (-A) is set */
callerfile = opt_args[OPT_ARG_ANNOUNCE];
calledfile = strsep(&callerfile, ":");
/* stream the file */
res = ast_streamfile(peer, opt_args[OPT_ARG_ANNOUNCE], ast_channel_language(peer));
if (res) {
res = 0;
ast_log(LOG_ERROR, "error streaming file '%s' to callee\n", opt_args[OPT_ARG_ANNOUNCE]);
/* stream the file(s) */
if (!ast_strlen_zero(calledfile)) {
res = ast_streamfile(peer, calledfile, ast_channel_language(peer));
if (res) {
res = 0;
ast_log(LOG_ERROR, "error streaming file '%s' to callee\n", calledfile);
} else {
calledstream = 1;
}
}
if (!ast_strlen_zero(callerfile)) {
res = ast_streamfile(chan, callerfile, ast_channel_language(chan));
if (res) {
res = 0;
ast_log(LOG_ERROR, "error streaming file '%s' to caller\n", callerfile);
} else {
callerstream = 1;
}
}
/* can't use ast_waitstream, because we're streaming two files at once, and can't block
We'll need to handle both channels at once. */
ast_channel_set_flag(peer, AST_FLAG_END_DTMF_ONLY);
while (ast_channel_stream(peer)) {
int ms;
while (ast_channel_stream(peer) || ast_channel_stream(chan)) {
int mspeer, mschan;
ms = ast_sched_wait(ast_channel_sched(peer));
mspeer = ast_sched_wait(ast_channel_sched(peer));
mschan = ast_sched_wait(ast_channel_sched(chan));
if (ms < 0 && !ast_channel_timingfunc(peer)) {
ast_stopstream(peer);
if (calledstream) {
if (mspeer < 0 && !ast_channel_timingfunc(peer)) {
ast_stopstream(peer);
calledstream = 0;
}
}
if (callerstream) {
if (mschan < 0 && !ast_channel_timingfunc(chan)) {
ast_stopstream(chan);
callerstream = 0;
}
}
if (!calledstream && !callerstream) {
break;
}
if (ms < 0)
ms = 1000;
active_chan = ast_waitfor_n(chans, 2, &ms);
if (mspeer < 0)
mspeer = 1000;
if (mschan < 0)
mschan = 1000;
/* wait for the lowest maximum of the two */
active_chan = ast_waitfor_n(chans, 2, (mspeer > mschan ? &mschan : &mspeer));
if (active_chan) {
struct ast_channel *other_chan;
struct ast_frame *fr = ast_read(active_chan);
@ -2924,6 +3148,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
ast_frfree(fr);
}
ast_sched_runq(ast_channel_sched(peer));
ast_sched_runq(ast_channel_sched(chan));
}
ast_channel_clear_flag(peer, AST_FLAG_END_DTMF_ONLY);
}
@ -3215,11 +3440,16 @@ out:
}
ast_channel_early_bridge(chan, NULL);
/* forward 'answered elsewhere' if we received it */
hanguptree(&out_chans, NULL,
ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE
|| ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE)
? AST_CAUSE_ANSWERED_ELSEWHERE : -1);
/* forward 'answered elsewhere' if we received it */
if (ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE || ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE)) {
hanguptreecause = AST_CAUSE_ANSWERED_ELSEWHERE;
} else if (pa.canceled) { /* Caller canceled */
if (ast_channel_hangupcause(chan))
hanguptreecause = ast_channel_hangupcause(chan);
else
hanguptreecause = AST_CAUSE_NORMAL_CLEARING;
}
hanguptree(&out_chans, NULL, hanguptreecause);
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);

View File

@ -149,7 +149,8 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
ast_mkdir(base, 0755);
len = strlen(base) + strlen(filein) + 2;
if (!path || len > maxlen) {
path = ast_alloca(len);
ast_free(path);
path = ast_malloc(len);
memset(path, 0, len);
maxlen = len;
} else {
@ -334,6 +335,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
ast_frfree(f);
}
}
ast_free(path);
if (oldr) {
ast_set_read_format(chan, oldr);
ao2_ref(oldr, -1);

View File

@ -396,7 +396,7 @@ static int select_item_menu(struct ast_channel *chan, struct directory_item **it
{
struct directory_item **block, *item;
int i, limit, res = 0;
char buf[9];
char buf[7+12]; /* INT_MIN has a length of 12 chars */
/* option p(n): cellphone pause option */
select_item_pause(chan, flags, opts);

View File

@ -361,7 +361,6 @@ static int disa_exec(struct ast_channel *chan, const char *data)
if (k == 3) {
int recheck = 0;
struct ast_app *app_reset_cdr;
if (!ast_exists_extension(chan, args.context, exten, 1,
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
@ -386,10 +385,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
ast_channel_unlock(chan);
}
app_reset_cdr = pbx_findapp("ResetCDR");
if (app_reset_cdr) {
pbx_exec(chan, app_reset_cdr, special_noanswer ? "" : "e");
} else {
if (ast_pbx_exec_application(chan, "ResetCDR", special_noanswer ? "" : "e")) {
ast_log(AST_LOG_NOTICE, "ResetCDR application not found; CDR will not be reset\n");
}
ast_explicit_goto(chan, args.context, exten, 1);

297
apps/app_dtmfstore.c Normal file
View File

@ -0,0 +1,297 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2021, Naveen Albert
*
* Naveen Albert <asterisk@phreaknet.org>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief Technology independent asynchronous DTMF collection
*
* \author Naveen Albert <asterisk@phreaknet.org>
*
* \ingroup functions
*
*/
/*** MODULEINFO
<support_level>extended</support_level>
***/
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/framehook.h"
#include "asterisk/app.h"
#include "asterisk/conversions.h"
/*** DOCUMENTATION
<application name="StoreDTMF" language="en_US">
<since>
<version>16.20.0</version>
<version>18.6.0</version>
<version>19.0.0</version>
</since>
<synopsis>
Stores DTMF digits transmitted or received on a channel.
</synopsis>
<syntax>
<parameter name="direction" required="true">
<para>Must be <literal>TX</literal> or <literal>RX</literal> to
store digits, or <literal>remove</literal> to disable.</para>
</parameter>
</syntax>
<description>
<para>The StoreDTMF function can be used to obtain digits sent in the
<literal>TX</literal> or <literal>RX</literal> direction of any channel.</para>
<para>The arguments are:</para>
<para><replaceable>var_name</replaceable>: Name of variable to which to append
digits.</para>
<para><replaceable>max_digits</replaceable>: The maximum number of digits to
store in the variable. Defaults to 0 (no maximum). After reading <literal>
maximum</literal> digits, no more digits will be stored.</para>
<example title="Store digits in CDR variable">
same => n,StoreDTMF(TX,CDR(digits))
</example>
<example title="Store up to 24 digits">
same => n,StoreDTMF(RX,testvar,24)
</example>
<example title="Disable digit collection">
same => n,StoreDTMF(remove)
</example>
</description>
</application>
***/
static char *app = "StoreDTMF";
/*! \brief Private data structure used with the function's datastore */
struct dtmf_store_data {
int framehook_id;
char *rx_var;
char *tx_var;
int maxdigits;
};
static void datastore_destroy_cb(void *data) {
struct dtmf_store_data *d;
d = data;
if (d) {
if (d->rx_var) {
ast_free(d->rx_var);
}
if (d->tx_var) {
ast_free(d->tx_var);
}
ast_free(data);
}
}
/*! \brief The channel datastore the function uses to store state */
static const struct ast_datastore_info dtmf_store_datastore = {
.type = "dtmf_store",
.destroy = datastore_destroy_cb
};
/*! \internal \brief Store digits tx/rx on the channel */
static int remove_dtmf_store(struct ast_channel *chan)
{
struct ast_datastore *datastore = NULL;
struct dtmf_store_data *data;
SCOPED_CHANNELLOCK(chan_lock, chan);
datastore = ast_channel_datastore_find(chan, &dtmf_store_datastore, NULL);
if (!datastore) {
ast_log(AST_LOG_WARNING, "Cannot remove StoreDTMF from %s: StoreDTMF not currently enabled\n",
ast_channel_name(chan));
return -1;
}
data = datastore->data;
if (ast_framehook_detach(chan, data->framehook_id)) {
ast_log(AST_LOG_WARNING, "Failed to remove StoreDTMF framehook from channel %s\n",
ast_channel_name(chan));
return -1;
}
if (ast_channel_datastore_remove(chan, datastore)) {
ast_log(AST_LOG_WARNING, "Failed to remove StoreDTMF datastore from channel %s\n",
ast_channel_name(chan));
return -1;
}
ast_datastore_free(datastore);
return 0;
}
/*! \brief Frame hook that is called to intercept digit/undigit */
static struct ast_frame *dtmf_store_framehook(struct ast_channel *chan,
struct ast_frame *f, enum ast_framehook_event event, void *data)
{
char currentdata[512];
char varnamesub[64];
char *varname = NULL;
struct dtmf_store_data *framedata = data;
int len;
if (!f || !framedata) {
return f;
}
if ((event != AST_FRAMEHOOK_EVENT_WRITE) && (event != AST_FRAMEHOOK_EVENT_READ)) {
return f;
}
if (f->frametype != AST_FRAME_DTMF_END) {
return f;
}
/* If this is DTMF then store the digits */
if (event == AST_FRAMEHOOK_EVENT_READ && framedata->rx_var) { /* coming from source */
varname = framedata->rx_var;
} else if (event == AST_FRAMEHOOK_EVENT_WRITE && framedata->tx_var) { /* going to source */
varname = framedata->tx_var;
}
if (!varname) {
return f;
}
sprintf(varnamesub, "${%s}", varname);
pbx_substitute_variables_helper(chan, varnamesub, currentdata, 511);
/* pbx_builtin_getvar_helper works for regular vars but not CDR vars */
if (ast_strlen_zero(currentdata)) { /* var doesn't exist yet */
ast_debug(3, "Creating new digit store: %s\n", varname);
}
len = strlen(currentdata);
if (framedata->maxdigits > 0 && len >= framedata->maxdigits) {
ast_debug(3, "Reached digit limit: %d\n", framedata->maxdigits);
remove_dtmf_store(chan); /* reached max digit count, stop now */
return f;
} else {
char newdata[len + 2]; /* one more char + terminator */
if (len > 0) {
ast_copy_string(newdata, currentdata, len + 2);
}
newdata[len] = (unsigned) f->subclass.integer;
newdata[len + 1] = '\0';
ast_debug(3, "Appending to digit store: now %s\n", newdata);
pbx_builtin_setvar_helper(chan, varname, newdata);
}
return f;
}
/*! \internal \brief Enable digit interception on the channel */
static int dtmfstore_exec(struct ast_channel *chan, const char *appdata)
{
struct ast_datastore *datastore;
struct dtmf_store_data *data;
static struct ast_framehook_interface digit_framehook_interface = {
.version = AST_FRAMEHOOK_INTERFACE_VERSION,
.event_cb = dtmf_store_framehook,
.disable_inheritance = 1,
};
char *parse = ast_strdupa(appdata);
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(direction);
AST_APP_ARG(varname);
AST_APP_ARG(maxdigits);
);
SCOPED_CHANNELLOCK(chan_lock, chan);
AST_STANDARD_APP_ARGS(args, parse);
if (ast_strlen_zero(appdata)) {
ast_log(AST_LOG_WARNING, "StoreDTMF requires an argument\n");
return -1;
}
if (!strcasecmp(args.direction, "remove")) {
return remove_dtmf_store(chan);
}
datastore = ast_channel_datastore_find(chan, &dtmf_store_datastore, NULL);
if (datastore) {
ast_log(AST_LOG_WARNING, "StoreDTMF already set on '%s'\n",
ast_channel_name(chan));
return 0;
}
datastore = ast_datastore_alloc(&dtmf_store_datastore, NULL);
if (!datastore) {
return -1;
}
data = ast_calloc(1, sizeof(*data));
if (!data) {
ast_datastore_free(datastore);
return -1;
}
digit_framehook_interface.data = data;
data->rx_var = NULL;
data->tx_var = NULL;
data->maxdigits = 0;
if (!strcasecmp(args.direction, "tx")) {
data->tx_var = ast_strdup(args.varname);
} else if (!strcasecmp(args.direction, "rx")) {
data->rx_var = ast_strdup(args.varname);
} else {
ast_log(LOG_ERROR, "Direction must be either RX or TX\n");
return -1;
}
if (!ast_strlen_zero(args.maxdigits)) {
if (ast_str_to_int(args.maxdigits,&(data->maxdigits))) {
ast_log(LOG_ERROR, "Invalid integer: %s\n", args.maxdigits);
return -1;
}
if (data->maxdigits < 0) {
ast_log(LOG_ERROR, "Invalid natural number: %d\n", data->maxdigits);
return -1;
} else if (data->maxdigits == 0) {
ast_log(LOG_WARNING, "No maximum digit count set\n");
}
}
data->framehook_id = ast_framehook_attach(chan, &digit_framehook_interface);
if (data->framehook_id < 0) {
ast_log(AST_LOG_WARNING, "Failed to attach StoreDTMF framehook to '%s'\n",
ast_channel_name(chan));
ast_datastore_free(datastore);
ast_free(data);
return -1;
}
datastore->data = data;
ast_channel_datastore_add(chan, datastore);
return 0;
}
static int unload_module(void)
{
return ast_unregister_application(app);
}
static int load_module(void)
{
return ast_register_application_xml(app, dtmfstore_exec);
}
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Technology independent async DTMF storage");

View File

@ -254,9 +254,9 @@ static struct ast_frame *gen_readframe(struct gen_state *state)
if (!(state->stream && (f = ast_readframe(state->stream)))) {
if (state->current) {
/* remove finished file from playlist */
AST_LIST_LOCK(&u->playlist);
AST_LIST_REMOVE_HEAD(&u->playlist, list);
AST_LIST_UNLOCK(&u->playlist);
AST_LIST_LOCK(&u->playlist);
AST_LIST_REMOVE_HEAD(&u->playlist, list);
AST_LIST_UNLOCK(&u->playlist);
/* add finished file to finishlist */
AST_LIST_LOCK(&u->finishlist);
AST_LIST_INSERT_TAIL(&u->finishlist, state->current, list);
@ -581,7 +581,7 @@ static int app_exec(struct ast_channel *chan, const char *data)
}
}
exit:
exit:
if (u->gen_active) {
ast_deactivate_generator(chan);
}
@ -622,21 +622,21 @@ static int app_exec(struct ast_channel *chan, const char *data)
}
static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
struct ast_iostream *eivr_events,
struct ast_iostream *eivr_commands,
struct ast_iostream *eivr_errors,
const struct ast_str *args, const struct ast_flags flags)
struct ast_iostream *eivr_events,
struct ast_iostream *eivr_commands,
struct ast_iostream *eivr_errors,
const struct ast_str *args, const struct ast_flags flags)
{
char input[1024];
struct playlist_entry *entry;
struct ast_frame *f;
int ms;
int exception;
int ready_fd;
int exception;
int ready_fd;
int waitfds[2];
int r;
struct ast_channel *rchan;
int res = -1;
struct ast_channel *rchan;
int res = -1;
int hangup_info_sent = 0;
waitfds[0] = ast_iostream_get_fd(eivr_commands);
@ -645,78 +645,78 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
while (1) {
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)) {
ast_chan_log(LOG_ERROR, chan, "Is a zombie\n");
break;
}
if (!hangup_info_sent && !(ast_test_flag(&flags, run_dead)) && ast_check_hangup(chan)) {
break;
}
if (!hangup_info_sent && !(ast_test_flag(&flags, run_dead)) && ast_check_hangup(chan)) {
if (ast_test_flag(&flags, ignore_hangup)) {
ast_verb(3, "Got check_hangup, but ignore_hangup set so sending 'I' command\n");
send_eivr_event(eivr_events, 'I', "HANGUP", chan);
hangup_info_sent = 1;
} else {
ast_verb(3, "Got check_hangup\n");
send_eivr_event(eivr_events, 'H', NULL, chan);
break;
ast_verb(3, "Got check_hangup\n");
send_eivr_event(eivr_events, 'H', NULL, chan);
break;
}
}
}
ready_fd = 0;
ms = 100;
errno = 0;
exception = 0;
ready_fd = 0;
ms = 100;
errno = 0;
exception = 0;
rchan = ast_waitfor_nandfds(&chan, 1, waitfds, (eivr_errors) ? 2 : 1, &exception, &ready_fd, &ms);
if (ast_channel_state(chan) == AST_STATE_UP && !AST_LIST_EMPTY(&u->finishlist)) {
AST_LIST_LOCK(&u->finishlist);
while ((entry = AST_LIST_REMOVE_HEAD(&u->finishlist, list))) {
send_eivr_event(eivr_events, 'F', entry->filename, chan);
ast_free(entry);
}
AST_LIST_UNLOCK(&u->finishlist);
}
if (ast_channel_state(chan) == AST_STATE_UP && !AST_LIST_EMPTY(&u->finishlist)) {
AST_LIST_LOCK(&u->finishlist);
while ((entry = AST_LIST_REMOVE_HEAD(&u->finishlist, list))) {
send_eivr_event(eivr_events, 'F', entry->filename, chan);
ast_free(entry);
}
AST_LIST_UNLOCK(&u->finishlist);
}
if (ast_channel_state(chan) == AST_STATE_UP && !(ast_check_hangup(chan)) && rchan) {
/* the channel has something */
f = ast_read(chan);
if (!f) {
ast_verb(3, "Returned no frame\n");
send_eivr_event(eivr_events, 'H', NULL, chan);
break;
}
if (f->frametype == AST_FRAME_DTMF) {
send_eivr_event(eivr_events, f->subclass.integer, NULL, chan);
if (u->option_autoclear) {
AST_LIST_LOCK(&u->playlist);
if (!u->abort_current_sound && !u->playing_silence) {
if (ast_channel_state(chan) == AST_STATE_UP && !(ast_check_hangup(chan)) && rchan) {
/* the channel has something */
f = ast_read(chan);
if (!f) {
ast_verb(3, "Returned no frame\n");
send_eivr_event(eivr_events, 'H', NULL, chan);
break;
}
if (f->frametype == AST_FRAME_DTMF) {
send_eivr_event(eivr_events, f->subclass.integer, NULL, chan);
if (u->option_autoclear) {
AST_LIST_LOCK(&u->playlist);
if (!u->abort_current_sound && !u->playing_silence) {
/* send interrupted file as T data */
if ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
send_eivr_event(eivr_events, 'T', entry->filename, chan);
if ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
send_eivr_event(eivr_events, 'T', entry->filename, chan);
ast_free(entry);
}
}
while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
send_eivr_event(eivr_events, 'D', entry->filename, chan);
ast_free(entry);
}
if (!u->playing_silence)
u->abort_current_sound = 1;
AST_LIST_UNLOCK(&u->playlist);
}
} else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) {
ast_verb(3, "Got AST_CONTROL_HANGUP\n");
send_eivr_event(eivr_events, 'H', NULL, chan);
while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
send_eivr_event(eivr_events, 'D', entry->filename, chan);
ast_free(entry);
}
if (!u->playing_silence)
u->abort_current_sound = 1;
AST_LIST_UNLOCK(&u->playlist);
}
} else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) {
ast_verb(3, "Got AST_CONTROL_HANGUP\n");
send_eivr_event(eivr_events, 'H', NULL, chan);
if (f->data.uint32) {
ast_channel_hangupcause_set(chan, f->data.uint32);
}
ast_frfree(f);
break;
}
ast_frfree(f);
} else if (ready_fd == waitfds[0]) {
if (exception) {
ast_chan_log(LOG_ERROR, chan, "Child process went away\n");
break;
}
ast_frfree(f);
break;
}
ast_frfree(f);
} else if (ready_fd == waitfds[0]) {
if (exception) {
ast_chan_log(LOG_ERROR, chan, "Child process went away\n");
break;
}
r = ast_iostream_gets(eivr_commands, input, sizeof(input));
if (r <= 0) {
@ -784,112 +784,112 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
u->abort_current_sound = 1;
}
AST_LIST_UNLOCK(&u->playlist);
} else if (input[0] == EIVR_CMD_SQUE) {
} else if (input[0] == EIVR_CMD_SQUE) {
if (ast_channel_state(chan) != AST_STATE_UP || ast_check_hangup(chan)) {
ast_chan_log(LOG_WARNING, chan, "Queue re'S'et called on unanswered channel\n");
send_eivr_event(eivr_events, 'Z', NULL, chan);
continue;
}
if (!ast_fileexists(&input[2], NULL, ast_channel_language(u->chan))) {
ast_chan_log(LOG_WARNING, chan, "Unknown file requested '%s'\n", &input[2]);
send_eivr_event(eivr_events, 'Z', &input[2], chan);
} else {
AST_LIST_LOCK(&u->playlist);
if (!u->abort_current_sound && !u->playing_silence) {
if (!ast_fileexists(&input[2], NULL, ast_channel_language(u->chan))) {
ast_chan_log(LOG_WARNING, chan, "Unknown file requested '%s'\n", &input[2]);
send_eivr_event(eivr_events, 'Z', &input[2], chan);
} else {
AST_LIST_LOCK(&u->playlist);
if (!u->abort_current_sound && !u->playing_silence) {
/* send interrupted file as T data */
if ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
send_eivr_event(eivr_events, 'T', entry->filename, chan);
if ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
send_eivr_event(eivr_events, 'T', entry->filename, chan);
ast_free(entry);
}
}
while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
send_eivr_event(eivr_events, 'D', entry->filename, chan);
ast_free(entry);
while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
send_eivr_event(eivr_events, 'D', entry->filename, chan);
ast_free(entry);
}
if (!u->playing_silence) {
u->abort_current_sound = 1;
if (!u->playing_silence) {
u->abort_current_sound = 1;
}
entry = make_entry(&input[2]);
if (entry) {
AST_LIST_INSERT_TAIL(&u->playlist, entry, list);
entry = make_entry(&input[2]);
if (entry) {
AST_LIST_INSERT_TAIL(&u->playlist, entry, list);
}
AST_LIST_UNLOCK(&u->playlist);
AST_LIST_UNLOCK(&u->playlist);
}
} else if (input[0] == EIVR_CMD_APND) {
} else if (input[0] == EIVR_CMD_APND) {
if (ast_channel_state(chan) != AST_STATE_UP || ast_check_hangup(chan)) {
ast_chan_log(LOG_WARNING, chan, "Queue 'A'ppend called on unanswered channel\n");
send_eivr_event(eivr_events, 'Z', NULL, chan);
continue;
}
if (!ast_fileexists(&input[2], NULL, ast_channel_language(u->chan))) {
ast_chan_log(LOG_WARNING, chan, "Unknown file requested '%s'\n", &input[2]);
send_eivr_event(eivr_events, 'Z', &input[2], chan);
} else {
entry = make_entry(&input[2]);
if (entry) {
AST_LIST_LOCK(&u->playlist);
AST_LIST_INSERT_TAIL(&u->playlist, entry, list);
AST_LIST_UNLOCK(&u->playlist);
if (!ast_fileexists(&input[2], NULL, ast_channel_language(u->chan))) {
ast_chan_log(LOG_WARNING, chan, "Unknown file requested '%s'\n", &input[2]);
send_eivr_event(eivr_events, 'Z', &input[2], chan);
} else {
entry = make_entry(&input[2]);
if (entry) {
AST_LIST_LOCK(&u->playlist);
AST_LIST_INSERT_TAIL(&u->playlist, entry, list);
AST_LIST_UNLOCK(&u->playlist);
}
}
} else if (input[0] == EIVR_CMD_GET) {
char response[2048];
}
} else if (input[0] == EIVR_CMD_GET) {
char response[2048];
ast_verb(4, "Retriving Variables from channel: %s\n", &input[2]);
ast_eivr_getvariable(chan, &input[2], response, sizeof(response));
send_eivr_event(eivr_events, 'G', response, chan);
} else if (input[0] == EIVR_CMD_SVAR) {
ast_eivr_getvariable(chan, &input[2], response, sizeof(response));
send_eivr_event(eivr_events, 'G', response, chan);
} else if (input[0] == EIVR_CMD_SVAR) {
ast_verb(4, "Setting Variables in channel: %s\n", &input[2]);
ast_eivr_setvariable(chan, &input[2]);
} else if (input[0] == EIVR_CMD_LOG) {
ast_chan_log(LOG_NOTICE, chan, "Log message from EIVR: %s\n", &input[2]);
} else if (input[0] == EIVR_CMD_XIT) {
ast_chan_log(LOG_NOTICE, chan, "Exiting: %s\n", &input[2]);
ast_eivr_setvariable(chan, &input[2]);
} else if (input[0] == EIVR_CMD_LOG) {
ast_chan_log(LOG_NOTICE, chan, "Log message from EIVR: %s\n", &input[2]);
} else if (input[0] == EIVR_CMD_XIT) {
ast_chan_log(LOG_NOTICE, chan, "Exiting: %s\n", &input[2]);
ast_chan_log(LOG_WARNING, chan, "e'X'it command is depricated, use 'E'xit instead\n");
res = 0;
break;
res = 0;
break;
} else if (input[0] == EIVR_CMD_EXIT) {
ast_chan_log(LOG_NOTICE, chan, "Exiting: %s\n", &input[2]);
send_eivr_event(eivr_events, 'E', NULL, chan);
res = 0;
break;
} else if (input[0] == EIVR_CMD_HGUP) {
ast_chan_log(LOG_NOTICE, chan, "Hanging up: %s\n", &input[2]);
send_eivr_event(eivr_events, 'H', NULL, chan);
break;
} else if (input[0] == EIVR_CMD_OPT) {
ast_chan_log(LOG_NOTICE, chan, "Exiting: %s\n", &input[2]);
send_eivr_event(eivr_events, 'E', NULL, chan);
res = 0;
break;
} else if (input[0] == EIVR_CMD_HGUP) {
ast_chan_log(LOG_NOTICE, chan, "Hanging up: %s\n", &input[2]);
send_eivr_event(eivr_events, 'H', NULL, chan);
break;
} else if (input[0] == EIVR_CMD_OPT) {
if (ast_channel_state(chan) != AST_STATE_UP || ast_check_hangup(chan)) {
ast_chan_log(LOG_WARNING, chan, "Option called on unanswered channel\n");
send_eivr_event(eivr_events, 'Z', NULL, chan);
continue;
}
if (!strcasecmp(&input[2], "autoclear"))
u->option_autoclear = 1;
else if (!strcasecmp(&input[2], "noautoclear"))
u->option_autoclear = 0;
else
ast_chan_log(LOG_WARNING, chan, "Unknown option requested: %s\n", &input[2]);
}
} else if (ready_fd == waitfds[1]) {
if (exception) {
ast_chan_log(LOG_ERROR, chan, "Child process went away\n");
break;
}
r = ast_iostream_gets(eivr_errors, input, sizeof(input));
if (r > 0) {
ast_chan_log(LOG_NOTICE, chan, "stderr: %s\n", ast_strip(input));
} else if (r == 0) {
ast_chan_log(LOG_ERROR, chan, "Child process went away\n");
break;
if (!strcasecmp(&input[2], "autoclear"))
u->option_autoclear = 1;
else if (!strcasecmp(&input[2], "noautoclear"))
u->option_autoclear = 0;
else
ast_chan_log(LOG_WARNING, chan, "Unknown option requested: %s\n", &input[2]);
}
} else if (ready_fd == waitfds[1]) {
if (exception) {
ast_chan_log(LOG_ERROR, chan, "Child process went away\n");
break;
}
} else if ((ready_fd < 0) && ms) {
if (errno == 0 || errno == EINTR)
continue;
ast_chan_log(LOG_ERROR, chan, "Wait failed (%s)\n", strerror(errno));
break;
}
}
r = ast_iostream_gets(eivr_errors, input, sizeof(input));
if (r > 0) {
ast_chan_log(LOG_NOTICE, chan, "stderr: %s\n", ast_strip(input));
} else if (r == 0) {
ast_chan_log(LOG_ERROR, chan, "Child process went away\n");
break;
}
} else if ((ready_fd < 0) && ms) {
if (errno == 0 || errno == EINTR)
continue;
ast_chan_log(LOG_ERROR, chan, "Wait failed (%s)\n", strerror(errno));
break;
}
}
return res;
}

View File

@ -13,13 +13,17 @@
*/
/*** MODULEINFO
<defaultenabled>no</defaultenabled>
<depend>spandsp</depend>
<conflict>res_fax</conflict>
<defaultenabled>no</defaultenabled>
<support_level>deprecated</support_level>
<replacement>res_fax</replacement>
<deprecated_in>16</deprecated_in>
<removed_in>19</removed_in>
***/
/* Needed for spandsp headers */
#define ASTMM_LIBC ASTMM_IGNORE
#include "asterisk.h"
#include <string.h>

View File

@ -281,8 +281,6 @@ static int festival_exec(struct ast_channel *chan, const char *vdata)
int usecache;
int res = 0;
struct sockaddr_in serv_addr;
struct hostent *serverhost;
struct ast_hostent ahp;
int fd;
FILE *fs;
const char *host;
@ -398,15 +396,17 @@ static int festival_exec(struct ast_channel *chan, const char *vdata)
if ((serv_addr.sin_addr.s_addr = inet_addr(host)) == -1) {
/* its a name rather than an ipnum */
serverhost = ast_gethostbyname(host, &ahp);
struct ast_sockaddr addr = { {0,} };
if (serverhost == NULL) {
ast_log(LOG_WARNING, "festival_client: gethostbyname failed\n");
if (ast_sockaddr_resolve_first_af(&addr, host, PARSE_PORT_FORBID, AF_INET)) {
ast_log(LOG_WARNING, "festival_client: ast_sockaddr_resolve_first_af() failed\n");
ast_config_destroy(cfg);
close(fd);
return -1;
}
memmove(&serv_addr.sin_addr, serverhost->h_addr, serverhost->h_length);
/* We'll overwrite port and family in a sec */
ast_sockaddr_to_sin(&addr, &serv_addr);
}
serv_addr.sin_family = AF_INET;
@ -433,7 +433,7 @@ static int festival_exec(struct ast_channel *chan, const char *vdata)
}
readcache = 0;
writecache = 0;
if (strlen(cachedir) + strlen(MD5Hex) + 1 <= MAXFESTLEN && (usecache == -1)) {
if (strlen(cachedir) + sizeof(MD5Hex) + 1 <= MAXFESTLEN && (usecache == -1)) {
snprintf(cachefile, sizeof(cachefile), "%s/%s", cachedir, MD5Hex);
fdesc = open(cachefile, O_RDWR);
if (fdesc == -1) {

View File

@ -224,7 +224,7 @@ struct findme_user {
long digts;
int ynidx;
int state;
char dialarg[256];
char dialarg[768];
/*! Collected digits to accept/decline the call. */
char yn[MAX_YN_STRING];
/*! TRUE if the outgoing call is answered. */
@ -408,7 +408,6 @@ static int reload_followme(int reload)
char *cat = NULL, *tmp;
struct ast_variable *var;
struct number *cur, *nm;
char *numberstr;
int timeout;
int numorder;
const char* enable_callee_prompt_str;
@ -536,9 +535,12 @@ static int reload_followme(int reload)
while (var) {
if (!strcasecmp(var->name, "number")) {
int idx = 0;
char copy[strlen(var->value) + 1];
char *numberstr;
/* Add a new number */
numberstr = ast_strdupa(var->value);
strcpy(copy, var->value); /* safe */
numberstr = copy;
if ((tmp = strchr(numberstr, ','))) {
*tmp++ = '\0';
timeout = atoi(tmp);
@ -762,10 +764,6 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
}
tmpto = to;
if (to < 0) {
to = 1000;
tmpto = 1000;
}
towas = to;
winner = ast_waitfor_n(watchers, pos, &to);
tmpto -= to;
@ -915,6 +913,11 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
/* Ignore going off hook and flash */
break;
case AST_CONTROL_CONNECTED_LINE:
if (ast_test_flag(&tpargs->followmeflags, FOLLOWMEFLAG_IGNORE_CONNECTEDLINE)) {
ast_verb(3, "Connected line update from %s prevented.\n",
ast_channel_name(winner));
break;
}
if (!tmpuser) {
/*
* Hold connected line update from caller until we have a
@ -930,11 +933,6 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
tpargs->pending_in_connected_update = 1;
}
ast_party_connected_line_free(&connected);
break;
}
if (ast_test_flag(&tpargs->followmeflags, FOLLOWMEFLAG_IGNORE_CONNECTEDLINE)) {
ast_verb(3, "Connected line update from %s prevented.\n",
ast_channel_name(winner));
} else {
ast_verb(3,
"%s connected line has changed. Saving it until answer.\n",

View File

@ -2,7 +2,7 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2005, Anthony Minessale anthmct@yahoo.com
* Development of this app Sponsered/Funded by TAAN Softworks Corp
* Development of this app Sponsored/Funded by TAAN Softworks Corp
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact

View File

@ -26,6 +26,7 @@
*/
/*** MODULEINFO
<depend>res_adsi</depend>
<support_level>deprecated</support_level>
***/

View File

@ -29,6 +29,8 @@
/*** MODULEINFO
<support_level>deprecated</support_level>
<deprecated_in>16</deprecated_in>
<removed_in>19</removed_in>
***/
#include "asterisk.h"

View File

@ -27,6 +27,8 @@
/*** MODULEINFO
<support_level>deprecated</support_level>
<deprecated_in>16</deprecated_in>
<removed_in>19</removed_in>
***/
#include "asterisk.h"

View File

@ -615,8 +615,6 @@ static int queue_voice_frame(struct jack_data *jack_data, struct ast_frame *f)
* Read data from the input ringbuffer, which is the properly resampled audio
* that was read from the jack input port. Write it to the channel in 20 ms frames,
* or fill up an output frame instead if one is provided.
*
* \return Nothing.
*/
static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_data,
struct ast_frame *out_frame)

View File

@ -29,6 +29,8 @@
<defaultenabled>no</defaultenabled>
<support_level>deprecated</support_level>
<replacement>app_stack (GoSub)</replacement>
<deprecated_in>16</deprecated_in>
<removed_in>21</removed_in>
***/
#include "asterisk.h"
@ -73,7 +75,7 @@
of nesting (macro calling macro calling macro, etc.); It may be possible that stack-intensive
applications in deeply nested macros could cause asterisk to crash earlier than this limit.
It is advised that if you need to deeply nest macro calls, that you use the Gosub application
(now allows arguments like a Macro) with explict Return() calls instead.</para></warning>
(now allows arguments like a Macro) with explicit Return() calls instead.</para></warning>
<warning><para>Use of the application <literal>WaitExten</literal> within a macro will not function
as expected. Please use the <literal>Read</literal> application in order to read DTMF from a channel
currently executing a macro.</para></warning>

View File

@ -43,6 +43,8 @@
<defaultenabled>no</defaultenabled>
<support_level>extended</support_level>
<replacement>app_confbridge</replacement>
<deprecated_in>19</deprecated_in>
<removed_in>21</removed_in>
***/
#include "asterisk.h"
@ -637,6 +639,82 @@
</syntax>
</managerEventInstance>
</managerEvent>
<managerEvent language="en_US" name="MeetmeList">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised in response to a MeetmeList command.</synopsis>
<syntax>
<parameter name="Conference">
<para>Conference ID.</para>
</parameter>
<parameter name="UserNumber">
<para>User ID.</para>
</parameter>
<parameter name="CallerIDNum">
<para>Caller ID number.</para>
</parameter>
<parameter name="CallerIDName">
<para>Caller ID name.</para>
</parameter>
<parameter name="ConnectedLineNum">
<para>Connected Line number.</para>
</parameter>
<parameter name="ConnectedLineName">
<para>Connected Line name.</para>
</parameter>
<parameter name="Channel">
<para>Channel name</para>
</parameter>
<parameter name="Admin">
<para>Whether or not the user is an admin.</para>
</parameter>
<parameter name="Role">
<para>User role. Can be "Listen only", "Talk only", or "Talk and listen".</para>
</parameter>
<parameter name="MarkedUser">
<para>Whether or not the user is a marked user.</para>
</parameter>
<parameter name="Muted">
<para>Whether or not the user is currently muted.</para>
</parameter>
<parameter name="Talking">
<para>Whether or not the user is currently talking.</para>
</parameter>
</syntax>
<see-also>
<ref type="manager">MeetmeList</ref>
<ref type="application">MeetMe</ref>
</see-also>
</managerEventInstance>
</managerEvent>
<managerEvent language="en_US" name="MeetmeListRooms">
<managerEventInstance class="EVENT_FLAG_CALL">
<synopsis>Raised in response to a MeetmeListRooms command.</synopsis>
<syntax>
<parameter name="Conference">
<para>Conference ID.</para>
</parameter>
<parameter name="Parties">
<para>Number of parties in the conference.</para>
</parameter>
<parameter name="Marked">
<para>Number of marked users in the conference.</para>
</parameter>
<parameter name="Activity">
<para>Total duration of conference in HH:MM:SS format.</para>
</parameter>
<parameter name="Creation">
<para>How the conference was created: "Dyanmic" or "Static".</para>
</parameter>
<parameter name="Locked">
<para>Whether or not the conference is locked.</para>
</parameter>
</syntax>
<see-also>
<ref type="manager">MeetmeListRooms</ref>
<ref type="application">MeetMe</ref>
</see-also>
</managerEventInstance>
</managerEvent>
***/
#define CONFIG_FILE_NAME "meetme.conf"
@ -1334,7 +1412,7 @@ static struct ast_json *status_to_json(int on)
* \brief Generate a stasis message associated with a meetme event
* \since 12.0.0
*
* \param meetme_confere The conference responsible for generating this message
* \param meetme_conference The conference responsible for generating this message
* \param chan The channel involved in the message (NULL allowed)
* \param user The conference user involved in the message (NULL allowed)
* \param message_type the type the stasis message being generated
@ -1624,8 +1702,14 @@ static struct ast_conference *build_conf(const char *confno, const char *pin,
ast_format_cap_append(cap_slin, ast_format_slin, 0);
/* Make a new one */
if (!(cnf = ast_calloc(1, sizeof(*cnf))) ||
!(cnf->usercontainer = ao2_container_alloc(1, NULL, user_no_cmp))) {
cnf = ast_calloc(1, sizeof(*cnf));
if (!cnf) {
goto cnfout;
}
cnf->usercontainer = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,
NULL, user_no_cmp);
if (!cnf->usercontainer) {
goto cnfout;
}
@ -2828,7 +2912,7 @@ static void meetme_menu_normal(enum menu_modes *menu_mode, int *dtmf, struct ast
}
/*! \internal
* \brief Processes menu options for the adminstrator menu (accessible through the 's' option for app_meetme)
* \brief Processes menu options for the administrator menu (accessible through the 's' option for app_meetme)
*
* \param menu_mode a pointer to the currently active menu_mode.
* \param dtmf a pointer to the dtmf value currently being processed against the menu.
@ -2955,7 +3039,8 @@ static void meetme_menu_admin(enum menu_modes *menu_mode, int *dtmf, struct ast_
* \param confflags flags used by conf for various options
* \param chan ast_channel belonging to the user who called the menu
* \param user which meetme conference user invoked the menu
* \param recordingtmp character buffer which may hold the name of the conference recording file
* \param recordingtmp, recordingtmp_size character buffer which may hold the name of the conference recording file
* \param cap_slin
*/
static void meetme_menu_admin_extended(enum menu_modes *menu_mode, int *dtmf,
struct ast_conference *conf, struct ast_flags64 *confflags, struct ast_channel *chan,
@ -3142,7 +3227,8 @@ static void meetme_menu_admin_extended(enum menu_modes *menu_mode, int *dtmf,
* \param confflags flags used by conf for various options
* \param chan ast_channel belonging to the user who called the menu
* \param user which meetme conference user invoked the menu
* \param recordingtmp character buffer which may hold the name of the conference recording file
* \param recordingtmp,recordingtmp_size character buffer which may hold the name of the conference recording file
* \param cap_slin
*/
static void meetme_menu(enum menu_modes *menu_mode, int *dtmf,
struct ast_conference *conf, struct ast_flags64 *confflags, struct ast_channel *chan,
@ -3424,7 +3510,9 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
user->chan = chan;
user->userflags = *confflags;
user->adminflags = ast_test_flag64(confflags, CONFFLAG_STARTMUTED) ? ADMINFLAG_SELFMUTED : 0;
user->adminflags |= (conf->gmuted) ? ADMINFLAG_MUTED : 0;
if (!ast_test_flag64(confflags, CONFFLAG_ADMIN)) {
user->adminflags |= (conf->gmuted) ? ADMINFLAG_MUTED : 0;
}
user->talking = -1;
ast_mutex_unlock(&conf->playlock);
@ -4749,7 +4837,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno,
}
}
if (!var) {
ast_debug(1, "%s isn't a valid conference\n", confno);
ast_log(LOG_WARNING, "%s isn't a valid conference\n", confno);
}
ast_config_destroy(cfg);
}
@ -5211,7 +5299,7 @@ static int user_chan_cb(void *obj, void *args, int flags)
return 0;
}
/*! \brief The MeetMeadmin application
/*! \brief The MeetMeAdmin application
MeetMeAdmin(confno, command, caller) */
static int admin_exec(struct ast_channel *chan, const char *data) {
@ -5227,7 +5315,9 @@ static int admin_exec(struct ast_channel *chan, const char *data) {
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "MeetMeAdmin requires an argument!\n");
pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
if (chan) {
pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
}
return -1;
}
@ -5236,7 +5326,9 @@ static int admin_exec(struct ast_channel *chan, const char *data) {
if (!args.command) {
ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n");
pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
if (chan) {
pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
}
return -1;
}
@ -5249,7 +5341,9 @@ static int admin_exec(struct ast_channel *chan, const char *data) {
if (!cnf) {
ast_log(LOG_WARNING, "Conference number '%s' not found!\n", args.confno);
AST_LIST_UNLOCK(&confs);
pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOTFOUND");
if (chan) {
pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOTFOUND");
}
return 0;
}
@ -5372,7 +5466,9 @@ usernotfound:
AST_LIST_UNLOCK(&confs);
dispose_conf(cnf);
pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", res == -2 ? "NOTFOUND" : res ? "FAILED" : "OK");
if (chan) {
pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", res == -2 ? "NOTFOUND" : res ? "FAILED" : "OK");
}
return 0;
}
@ -7395,13 +7491,6 @@ static void sla_station_destructor(void *obj)
ast_string_field_free_memory(station);
}
static int sla_trunk_hash(const void *obj, const int flags)
{
const struct sla_trunk *trunk = obj;
return ast_str_case_hash(trunk->name);
}
static int sla_trunk_cmp(void *obj, void *arg, int flags)
{
struct sla_trunk *trunk = obj, *trunk2 = arg;
@ -7409,13 +7498,6 @@ static int sla_trunk_cmp(void *obj, void *arg, int flags)
return !strcasecmp(trunk->name, trunk2->name) ? CMP_MATCH | CMP_STOP : 0;
}
static int sla_station_hash(const void *obj, const int flags)
{
const struct sla_station *station = obj;
return ast_str_case_hash(station->name);
}
static int sla_station_cmp(void *obj, void *arg, int flags)
{
struct sla_station *station = obj, *station2 = arg;
@ -7869,8 +7951,10 @@ static int sla_load_config(int reload)
if (!reload) {
ast_mutex_init(&sla.lock);
ast_cond_init(&sla.cond, NULL);
sla_trunks = ao2_container_alloc(1, sla_trunk_hash, sla_trunk_cmp);
sla_stations = ao2_container_alloc(1, sla_station_hash, sla_station_cmp);
sla_trunks = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,
NULL, sla_trunk_cmp);
sla_stations = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,
NULL, sla_station_cmp);
}
if (!(cfg = ast_config_load(SLA_CONFIG_FILE, config_flags))) {

546
apps/app_mf.c Normal file
View File

@ -0,0 +1,546 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2021, Naveen Albert
*
* Naveen Albert <asterisk@phreaknet.org>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief MF sender and receiver applications
*
* \author Naveen Albert <asterisk@phreaknet.org>
*
* \ingroup applications
*/
/*** MODULEINFO
<support_level>extended</support_level>
***/
#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/pbx.h"
#include "asterisk/channel.h"
#include "asterisk/dsp.h"
#include "asterisk/app.h"
#include "asterisk/module.h"
#include "asterisk/indications.h"
#include "asterisk/conversions.h"
/*** DOCUMENTATION
<application name="ReceiveMF" language="en_US">
<since>
<version>16.21.0</version>
<version>18.7.0</version>
<version>19.0.0</version>
</since>
<synopsis>
Detects MF digits on a channel and saves them to a variable.
</synopsis>
<syntax>
<parameter name="variable" required="true">
<para>The input digits will be stored in the given
<replaceable>variable</replaceable> name.</para>
</parameter>
<parameter name="timeout">
<para>The number of seconds to wait for all digits, if greater
than <literal>0</literal>. Can be floating point. Default
is no timeout.</para>
</parameter>
<parameter name="options">
<optionlist>
<option name="d">
<para>Delay audio by a frame to try to extra quelch.</para>
</option>
<option name="l">
<para>Receive digits even if a key pulse (KP) has not yet
been received. By default, this application will ignore
all other digits until a KP has been received.</para>
</option>
<option name="k">
<para>Do not return a character for the KP digit.</para>
</option>
<option name="m">
<para>Mute conference.</para>
</option>
<option name="n">
<para>Maximum number of digits, regardless of the sequence.</para>
</option>
<option name="o">
<para>Enable override. Repeated KPs will clear all previous digits.</para>
</option>
<option name="q">
<para>Quelch MF from in-band.</para>
</option>
<option name="r">
<para>"Radio" mode (relaxed MF).</para>
</option>
<option name="s">
<para>Do not return a character for ST digits.</para>
</option>
</optionlist>
</parameter>
</syntax>
<description>
<para>Reads a ST, STP, ST2P, or ST3P-terminated string of MF digits from
the user in to the given <replaceable>variable</replaceable>.</para>
<para>This application does not automatically answer the channel and
should be preceded with <literal>Answer</literal> or
<literal>Progress</literal> as needed.</para>
<variablelist>
<variable name="RECEIVEMFSTATUS">
<para>This is the status of the read operation.</para>
<value name="START" />
<value name="ERROR" />
<value name="HANGUP" />
<value name="MAXDIGITS" />
<value name="TIMEOUT" />
</variable>
</variablelist>
</description>
<see-also>
<ref type="application">Read</ref>
<ref type="application">SendMF</ref>
<ref type="application">ReceiveSF</ref>
</see-also>
</application>
<application name="SendMF" language="en_US">
<since>
<version>16.21.0</version>
<version>18.7.0</version>
<version>19.0.0</version>
</since>
<synopsis>
Sends arbitrary MF digits on the current or specified channel.
</synopsis>
<syntax>
<parameter name="digits" required="true">
<para>List of digits 0-9,*#ABC to send; w for a half-second pause,
also f or F for a flash-hook if the channel supports flash-hook,
h or H for 250 ms of 2600 Hz,
and W for a wink if the channel supports wink.</para>
<para>Key pulse and start digits are not included automatically.
* is used for KP, # for ST, A for STP, B for ST2P, and C for ST3P.</para>
</parameter>
<parameter name="timeout_ms" required="false">
<para>Amount of time to wait in ms between tones. (defaults to 50ms).</para>
</parameter>
<parameter name="duration_ms" required="false">
<para>Duration of each numeric digit (defaults to 55ms).</para>
</parameter>
<parameter name="duration_ms_kp" required="false">
<para>Duration of KP digits (defaults to 120ms).</para>
</parameter>
<parameter name="duration_ms_st" required="false">
<para>Duration of ST, STP, ST2P, and ST3P digits (defaults to 65ms).</para>
</parameter>
<parameter name="channel" required="false">
<para>Channel where digits will be played</para>
</parameter>
</syntax>
<description>
<para>It will send all digits or terminate if it encounters an error.</para>
</description>
<see-also>
<ref type="application">ReceiveMF</ref>
<ref type="application">SendSF</ref>
<ref type="application">SendDTMF</ref>
</see-also>
</application>
<manager name="PlayMF" language="en_US">
<since>
<version>16.21.0</version>
<version>18.7.0</version>
<version>19.0.0</version>
</since>
<synopsis>
Play MF digit on a specific channel.
</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
<parameter name="Channel" required="true">
<para>Channel name to send digit to.</para>
</parameter>
<parameter name="Digit" required="true">
<para>The MF digit to play.</para>
</parameter>
<parameter name="Duration" required="false">
<para>The duration, in milliseconds, of the digit to be played.</para>
</parameter>
</syntax>
<description>
<para>Plays an MF digit on the specified channel.</para>
</description>
</manager>
***/
enum read_option_flags {
OPT_DELAY = (1 << 0),
OPT_MUTE = (1 << 1),
OPT_QUELCH = (1 << 2),
OPT_RELAXED = (1 << 3),
OPT_LAX_KP = (1 << 4),
OPT_PROCESS = (1 << 5),
OPT_NO_KP = (1 << 6),
OPT_NO_ST = (1 << 7),
OPT_KP_OVERRIDE = (1 << 8),
OPT_MAXDIGITS = (1 << 9),
};
enum {
OPT_ARG_MAXDIGITS,
/* Must be the last element */
OPT_ARG_ARRAY_SIZE,
};
AST_APP_OPTIONS(read_app_options, {
AST_APP_OPTION('d', OPT_DELAY),
AST_APP_OPTION('l', OPT_LAX_KP),
AST_APP_OPTION('k', OPT_NO_KP),
AST_APP_OPTION('m', OPT_MUTE),
AST_APP_OPTION_ARG('n', OPT_MAXDIGITS, OPT_ARG_MAXDIGITS),
AST_APP_OPTION('o', OPT_KP_OVERRIDE),
AST_APP_OPTION('p', OPT_PROCESS),
AST_APP_OPTION('q', OPT_QUELCH),
AST_APP_OPTION('r', OPT_RELAXED),
AST_APP_OPTION('s', OPT_NO_ST),
});
static const char *readmf_name = "ReceiveMF";
static const char sendmf_name[] = "SendMF";
#define MF_BETWEEN_MS 50
#define MF_DURATION 55
#define MF_KP_DURATION 120
#define MF_ST_DURATION 65
/*!
* \brief Detects MF digits on channel using DSP, terminated by ST, STP, ST2P, or ST3P
*
* \param chan channel on which to read digits
* \param buf Buffer in which to store digits
* \param buflen Size of buffer
* \param timeout ms to wait for all digits before giving up
* \param features Any additional DSP features to use
* \param override Start over if we receive additional KPs
* \param no_kp Don't include KP in the output
* \param no_st Don't include start digits in the output
* \param maxdigits If greater than 0, only read this many digits no matter what
*
* \retval 0 if successful
* \retval -1 if unsuccessful (including hangup).
*/
static int read_mf_digits(struct ast_channel *chan, char *buf, int buflen, int timeout, int features, int laxkp, int override, int no_kp, int no_st, int maxdigits) {
struct ast_dsp *dsp;
struct ast_frame *frame = NULL;
struct timeval start;
int remaining_time = timeout;
int digits_read = 0;
int is_start_digit = 0;
char *str = buf;
int res = 0;
if (!(dsp = ast_dsp_new())) {
ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
pbx_builtin_setvar_helper(chan, "RECEIVEMFSTATUS", "ERROR");
return -1;
}
ast_dsp_set_features(dsp, DSP_FEATURE_DIGIT_DETECT);
ast_dsp_set_digitmode(dsp, DSP_DIGITMODE_MF | features);
start = ast_tvnow();
*str = 0; /* start with empty output buffer */
/* based on app_read and generic_fax_exec from res_fax */
while (timeout == 0 || remaining_time > 0) {
if (timeout > 0) {
remaining_time = ast_remaining_ms(start, timeout);
if (remaining_time <= 0) {
pbx_builtin_setvar_helper(chan, "RECEIVEMFSTATUS", "TIMEOUT");
break;
}
}
if ((maxdigits && digits_read >= maxdigits) || digits_read >= (buflen - 1)) { /* we don't have room to store any more digits (very unlikely to happen for a legitimate reason) */
/* This result will probably not be usable, so status should not be START */
pbx_builtin_setvar_helper(chan, "RECEIVEMFSTATUS", "MAXDIGITS");
break;
}
/* ast_waitfordigit only waits for DTMF frames, we need to do DSP on voice frames */
if (ast_waitfor(chan, 1000) > 0) {
frame = ast_read(chan);
if (!frame) {
ast_debug(1, "Channel '%s' did not return a frame; probably hung up.\n", ast_channel_name(chan));
pbx_builtin_setvar_helper(chan, "RECEIVEMFSTATUS", "HANGUP");
break;
} else if (frame->frametype == AST_FRAME_VOICE) {
frame = ast_dsp_process(chan, dsp, frame);
/* AST_FRAME_DTMF is used all over the DSP code for DTMF, MF, fax, etc.
It's used because we can use the frame to store the digit detected.
All this means is that we received something we care about. */
if (frame->frametype == AST_FRAME_DTMF) {
char result = frame->subclass.integer;
if (digits_read == 0 && !laxkp && result != '*') {
ast_debug(1, "Received MF digit, but no KP yet, ignoring: %c\n", result);
ast_frfree(frame);
continue;
}
ast_debug(1, "Received MF digit: %c\n", result);
if (result == '*') {
/* We received an additional KP, start over? */
if (override && digits_read > 0) {
ast_debug(1, "Received another KP, starting over\n");
str = buf;
*str = 0;
digits_read = 1; /* we just detected a KP */
} else {
digits_read++;
}
/* if we were told not to include the KP digit in the output string, then skip it */
if (no_kp) {
ast_frfree(frame);
continue;
}
} else {
digits_read++;
}
is_start_digit = (strchr("#", result) || strchr("A", result) || strchr("B", result) || strchr("C", result));
/* if we were told not to include the ST digit in the output string, then skip it */
if (!no_st || !is_start_digit) {
*str++ = result; /* won't write past allotted memory, because of buffer check at top of loop */
*str = 0;
}
/* we received a ST digit (ST, STP, ST2P, or ST3P), so we're done */
if (is_start_digit) {
pbx_builtin_setvar_helper(chan, "RECEIVEMFSTATUS", "START");
ast_frfree(frame);
break;
}
/* only free frame if it was a DSP match. The MF itself should not be muted. */
ast_frfree(frame);
}
}
} else {
pbx_builtin_setvar_helper(chan, "RECEIVEMFSTATUS", "HANGUP");
res = -1;
}
}
ast_dsp_free(dsp);
ast_debug(3, "channel '%s' - event loop stopped { timeout: %d, remaining_time: %d }\n", ast_channel_name(chan), timeout, remaining_time);
return res;
}
static int read_mf_exec(struct ast_channel *chan, const char *data)
{
#define BUFFER_SIZE 256
char tmp[BUFFER_SIZE] = "";
int to = 0;
double tosec;
struct ast_flags flags = {0};
char *optargs[OPT_ARG_ARRAY_SIZE];
char *argcopy = NULL;
int res, features = 0, maxdigits = 0;
AST_DECLARE_APP_ARGS(arglist,
AST_APP_ARG(variable);
AST_APP_ARG(timeout);
AST_APP_ARG(options);
);
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ReceiveMF requires an argument (variable)\n");
return -1;
}
argcopy = ast_strdupa(data);
AST_STANDARD_APP_ARGS(arglist, argcopy);
if (!ast_strlen_zero(arglist.options)) {
ast_app_parse_options(read_app_options, &flags, optargs, arglist.options);
}
if (!ast_strlen_zero(arglist.timeout)) {
tosec = atof(arglist.timeout);
if (tosec <= 0) {
to = 0;
} else {
to = tosec * 1000.0;
}
}
if (ast_strlen_zero(arglist.variable)) {
ast_log(LOG_WARNING, "Invalid! Usage: ReceiveMF(variable[,timeout][,option])\n");
return -1;
}
if (ast_test_flag(&flags, OPT_MAXDIGITS) && !ast_strlen_zero(optargs[OPT_ARG_MAXDIGITS])) {
maxdigits = atoi(optargs[OPT_ARG_MAXDIGITS]);
if (maxdigits <= 0) {
ast_log(LOG_WARNING, "Invalid maximum number of digits, ignoring: '%s'\n", optargs[OPT_ARG_MAXDIGITS]);
maxdigits = 0;
}
}
if (ast_test_flag(&flags, OPT_DELAY)) {
features |= DSP_DIGITMODE_MUTEMAX;
}
if (ast_test_flag(&flags, OPT_MUTE)) {
features |= DSP_DIGITMODE_MUTECONF;
}
if (!ast_test_flag(&flags, OPT_QUELCH)) {
features |= DSP_DIGITMODE_NOQUELCH;
}
if (ast_test_flag(&flags, OPT_RELAXED)) {
features |= DSP_DIGITMODE_RELAXDTMF;
}
res = read_mf_digits(chan, tmp, BUFFER_SIZE, to, features, (ast_test_flag(&flags, OPT_LAX_KP)),
(ast_test_flag(&flags, OPT_KP_OVERRIDE)), (ast_test_flag(&flags, OPT_NO_KP)), (ast_test_flag(&flags, OPT_NO_ST)), maxdigits);
pbx_builtin_setvar_helper(chan, arglist.variable, tmp);
if (!ast_strlen_zero(tmp)) {
ast_verb(3, "MF digits received: '%s'\n", tmp);
} else if (!res) { /* if channel hung up, don't print anything out */
ast_verb(3, "No MF digits received.\n");
}
return res;
}
static int sendmf_exec(struct ast_channel *chan, const char *vdata)
{
int res;
char *data;
int dinterval = 0, duration = 0, durationkp = 0, durationst = 0;
struct ast_channel *chan_found = NULL;
struct ast_channel *chan_dest = chan;
struct ast_channel *chan_autoservice = NULL;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(digits);
AST_APP_ARG(dinterval);
AST_APP_ARG(duration);
AST_APP_ARG(durationkp);
AST_APP_ARG(durationst);
AST_APP_ARG(channel);
);
if (ast_strlen_zero(vdata)) {
ast_log(LOG_WARNING, "SendMF requires an argument\n");
return 0;
}
data = ast_strdupa(vdata);
AST_STANDARD_APP_ARGS(args, data);
if (ast_strlen_zero(args.digits)) {
ast_log(LOG_WARNING, "The digits argument is required (0-9,*#ABC,wf)\n");
return 0;
}
if (!ast_strlen_zero(args.dinterval)) {
ast_app_parse_timelen(args.dinterval, &dinterval, TIMELEN_MILLISECONDS);
}
if (!ast_strlen_zero(args.duration)) {
ast_app_parse_timelen(args.duration, &duration, TIMELEN_MILLISECONDS);
}
if (!ast_strlen_zero(args.durationkp)) {
ast_app_parse_timelen(args.durationkp, &durationkp, TIMELEN_MILLISECONDS);
}
if (!ast_strlen_zero(args.durationst)) {
ast_app_parse_timelen(args.durationst, &durationst, TIMELEN_MILLISECONDS);
}
if (!ast_strlen_zero(args.channel)) {
chan_found = ast_channel_get_by_name(args.channel);
if (!chan_found) {
ast_log(LOG_WARNING, "No such channel: %s\n", args.channel);
return 0;
}
chan_dest = chan_found;
if (chan_found != chan) {
chan_autoservice = chan;
}
}
res = ast_mf_stream(chan_dest, chan_autoservice, NULL, args.digits, dinterval <= 0 ? MF_BETWEEN_MS : dinterval,
duration <= 0 ? MF_DURATION : duration, durationkp <= 0 ? MF_KP_DURATION : durationkp,
durationst <= 0 ? MF_ST_DURATION : durationst, 0);
ast_channel_cleanup(chan_found);
return chan_autoservice ? 0 : res;
}
static int manager_play_mf(struct mansession *s, const struct message *m)
{
const char *channel = astman_get_header(m, "Channel");
const char *digit = astman_get_header(m, "Digit");
const char *duration = astman_get_header(m, "Duration");
struct ast_channel *chan;
unsigned int duration_ms = MF_DURATION;
if (!(chan = ast_channel_get_by_name(channel))) {
astman_send_error(s, m, "Channel not found");
return 0;
}
if (ast_strlen_zero(digit)) {
astman_send_error(s, m, "No digit specified");
chan = ast_channel_unref(chan);
return 0;
}
/* Override default duration with KP or ST-specific default durations */
if (!strcmp(digit, "*"))
duration_ms = MF_KP_DURATION;
if (!strcmp(digit, "#") || !strcmp(digit, "A") || !strcmp(digit, "B") || !strcmp(digit, "C"))
duration_ms = MF_ST_DURATION;
if (!ast_strlen_zero(duration) && (sscanf(duration, "%30u", &duration_ms) != 1)) {
astman_send_error(s, m, "Could not convert Duration parameter");
chan = ast_channel_unref(chan);
return 0;
}
ast_mf_stream(chan, NULL, NULL, digit, 0, duration_ms, duration_ms, duration_ms, 1);
chan = ast_channel_unref(chan);
astman_send_ack(s, m, "MF successfully queued");
return 0;
}
static int unload_module(void)
{
int res;
res = ast_unregister_application(readmf_name);
res |= ast_unregister_application(sendmf_name);
res |= ast_manager_unregister("PlayMF");
return res;
}
static int load_module(void)
{
int res;
res = ast_register_application_xml(readmf_name, read_mf_exec);
res |= ast_register_application_xml(sendmf_name, sendmf_exec);
res |= ast_manager_register_xml("PlayMF", EVENT_FLAG_CALL, manager_play_mf);
return res;
}
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "MF Sender and Receiver Applications");

View File

@ -40,19 +40,29 @@
/*** DOCUMENTATION
<application name="Milliwatt" language="en_US">
<synopsis>
Generate a Constant 1004Hz tone at 0dbm (mu-law).
Generates a 1004 Hz test tone at 0dbm (mu-law).
</synopsis>
<syntax>
<parameter name="options">
<optionlist>
<option name="m">
<para>Generate a 1004 Hz Milliwatt test tone at 0dbm, with a
1 second silent interval. This option must be specified
if you are using this for a milliwatt test line.</para>
</option>
<option name="o">
<para>Generate the tone at 1000Hz like previous version.</para>
<para>Generate a constant tone at 1000 Hz like previous version.</para>
</option>
</optionlist>
</parameter>
</syntax>
<description>
<para>Previous versions of this application generated the tone at 1000Hz. If for
<para>Generates a 1004 Hz test tone.</para>
<para>By default, this application does not provide a Milliwatt test tone. It simply
plays a 1004 Hz tone, which is not suitable for performing a milliwatt test.
The <literal>m</literal> option should be used so that a real Milliwatt test tone
is provided. This will include a 1 second silent interval every 10 seconds.</para>
<para>Previous versions of this application generated a constant tone at 1000 Hz. If for
some reason you would prefer that behavior, supply the <literal>o</literal> option to get the
old behavior.</para>
</description>
@ -155,8 +165,11 @@ static int milliwatt_exec(struct ast_channel *chan, const char *data)
if (!ast_strlen_zero(options) && strchr(options, 'o')) {
return old_milliwatt_exec(chan);
}
res = ast_playtones_start(chan, 23255, "1004/1000", 0);
if (!ast_strlen_zero(options) && strchr(options, 'm')) {
res = ast_playtones_start(chan, 23255, "1004/9000,0/1000", 0);
} else {
res = ast_playtones_start(chan, 23255, "1004/1000", 0);
}
while (!res) {
res = ast_safe_sleep(chan, 10000);

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