Commit Graph

3864 Commits

Author SHA1 Message Date
Jenkins2 f041bc7863 Merge "app_confbridge: Update dsp_silence_threshold and dsp_talking_threshold docs." 2018-02-01 11:36:00 -06:00
George Joseph b148453708 Merge "res_pjsip_pubsub: Prune subs with reliable transports at startup" 2018-02-01 11:26:49 -06:00
Jenkins2 7a6db221ab Merge "core: Create ast_atomic macro's." 2018-01-31 17:06:56 -06:00
Richard Mudgett b9024197ab app_confbridge: Update dsp_silence_threshold and dsp_talking_threshold docs.
The dsp_talking_threshold does not represent time in milliseconds.  It
represents the average magnitude per sample in the audio packets.  This is
what the DSP uses to determine if a packet is silence or talking/noise.

Change-Id: If6f939c100eb92a5ac6c21236559018eeaf58443
2018-01-31 13:13:27 -06:00
Jenkins2 093484d137 Merge "loader: Use ast_cli_completion_add for 'module load' completion." 2018-01-31 07:48:21 -06:00
Jenkins2 8f6978d7b8 Merge "pbx_variables.c: Misc fixes in variable substitution." 2018-01-31 06:52:24 -06:00
Corey Farrell 720dbb5745 core: Create ast_atomic macro's.
Create ast_atomic macro's to provide a consistent interface to the
common functionality of __atomic and __sync built-in functions.

ASTERISK-27619

Change-Id: Ieba3f81832a0e25c5725ea067e5d6f742d33eb5b
2018-01-30 12:50:38 -05:00
George Joseph 2b9aa6b5bb res_pjsip_pubsub: Prune subs with reliable transports at startup
In an earlier release, inbound registrations on a reliable transport
were pruned on Asterisk restart since the TCP connection would have
been torn down and become unusable when Asterisk stopped.  This same
process is now also applied to inbound subscriptions.

Also fixed issues in res_pjsip_registrar where it wasn't handling the
monitoring correctly when multiple registrations came in over the same
transport.

To accomplish this, the pjsip_transport_event feature needed to
be refactored to allow multiple monitors (multiple subcriptions or
registrations from the same endpoint) to exist on the same transport.
Since this changed the API, any external modules that may have used the
transport monitor feature (highly unlikey) will need to be changed.

ASTERISK-27612
Reported by: Ross Beer

Change-Id: Iee87cf4eb9b7b2b93d5739a72af52d6ca8fbbe36
2018-01-30 09:29:51 -06:00
Jenkins2 da4ddb1faa Merge "Build System: Require __sync or __atomic functions." 2018-01-30 06:56:08 -06:00
Jenkins2 652dc0d38c Merge "Build System: Add support for __atomic built-in operators." 2018-01-30 06:54:00 -06:00
Jenkins2 a231e1d155 Merge "Remove redundant module checks and references." 2018-01-29 12:39:34 -06:00
Corey Farrell 84a6365164 loader: Use ast_cli_completion_add for 'module load' completion.
This addresses all performance issues with 'module load' completion.  In
addition to using ast_cli_completion_add we stop using libedit's
filename_completion_function, instead using ast_file_read_dir.  This
ensures all results are produced from a single call to opendir.

Change-Id: I8bf51ffaa7ef1606f3bd1b5bb13f1905d72c6134
2018-01-27 15:18:45 -05:00
Alexander Traud c38da18ec6 headers: Consistent use of typeof and/or __typeof__.
Because of a copy-and-paste error, the Asterisk project was using __typeof
instead of typeof. It works because typeof, __typeof, and __typeof__ are
supported by GCC, but here the escaped variant was not intended. Therefore,
for consistence, we change this to typeof.

Change-Id: I2a962c3e596e882f691a19345445b14571a5f07c
2018-01-27 10:25:11 +01:00
Corey Farrell 23381d2c5e Build System: Require __sync or __atomic functions.
This change causes the configure script to throw an error if neither
__sync nor __atomic builtin functions are available.

ASTERISK-27619

Change-Id: Ie01a281e0f5c41dfeeb5f250c1ccea8752f56ef9
2018-01-25 10:38:45 -05:00
Corey Farrell 6fbd855228 Build System: Add support for __atomic built-in operators.
Add a check to configure.ac for __atomic_fetch_add support.  If found
use the __atomic built-in operators for ast_atomic_dec_and_test and
ast_atomic_fetchadd_int.

ASTERISK~27619

Change-Id: I65b4feb02bae368904ed0fb03f585c05f50a690e
2018-01-24 20:00:48 -05:00
Corey Farrell 527cf5a570 Remove redundant module checks and references.
This removes references that are no longer needed due to automatic
references created by module dependencies.

In addition this removes most calls to ast_module_check as they were
checking modules which are listed as dependencies.

Change-Id: I332a6e8383d4c72c8e89d988a184ab8320c4872e
2018-01-24 13:37:29 -05:00
Richard Mudgett 2f78dc2bfa pbx_variables.c: Misc fixes in variable substitution.
* Copy more than one character at a time when there is nothing to
substitute.

* Fix off by one error if a '}' or ']' is missing.

* Eliminated the requirement that the "used" parameter had to point to a
variable.  The current callers were always declaring a variable to meet
the requirement and discarding the value put into that variable.  Now it
can be NULL.

* In ast_str_substitute_variables_full() fixed using the bogus channel to
evaluate a function.  We were not using the bogus channel we just created
to help evaluate a subexpression.

Change-Id: Ia83d99f4f16abe47f329eb39b6ff2013ae7c9854
2018-01-22 12:38:13 -06:00
Richard Mudgett 8494e78010 res_pjsip: Split type=identify to IP address and SIP header matching priorities
The type=identify endpoint identification method can match by IP address
and by SIP header.  However, the SIP header matching has limited
usefulness because you cannot specify the SIP header matching priority
relative to the IP address matching.  All the matching happens at the same
priority and the order of evaluating the identify sections is
indeterminate.  e.g., If you had 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 couldn't predict which endpoint is
matched when a request comes in that matches both.

* Extract the SIP header matching criteria into its own "header" endpoint
identification method so the user can specify the relative priority of the
SIP header and the IP address matching criteria in the global
endpoint_identifier_order option.  The "ip" endpoint identification method
now only matches by IP address.

ASTERISK-27491

Change-Id: I9df142a575b7e1e3471b7cda5d3ea156cef08095
2018-01-16 12:50:34 -06:00
Corey Farrell 9cfdb81e91 loader: Add dependency fields to module structures.
* Declare 'requires' and 'enhances' text fields on module info structure.
* Rename 'nonoptreq' to 'optional_modules'.
* Update doxygen comments.

Still need to investigate dependencies among modules I cannot compile.

Change-Id: I3ad9547a0a6442409ff4e352a6d897bef2cc04bf
2018-01-15 13:25:51 -05:00
Corey Farrell 35ae99c712 vector: Additional string vector definitions.
ast_vector_string_split:
This function will add items to an ast_vector_string by splitting values
of a string buffer.  Items are appended to the vector in the order they
are found.

ast_vector_const_string:
A vector of 'const char *'.

Change-Id: I1bf02a1efeb2baeea11c59c557d39dd1197494d7
2018-01-15 13:25:45 -05:00
Joshua Colp 2fac32a37a Merge "loader: Create ast_module_running_ref." 2018-01-04 07:12:43 -06:00
Joshua Colp 307abc4cad Merge "datastore: Add automatic module references." 2018-01-04 06:53:28 -06:00
Corey Farrell 55f1d69c43 loader: Create ast_module_running_ref.
This function returns NULL if the module in question is not running.  I
did not change ast_module_ref as most callers do not check the result
and they always call ast_module_unref.

Make use of this function when running registered items from:
* app_stack API's
* bridge technologies
* CLI commands
* File formats
* Manager Actions
* RTP engines
* Sorcery Wizards
* Timing Interfaces
* Translators
* AGI Commands
* Fax Technologies

ASTERISK-20346 #close

Change-Id: Ia16fd28e188b2fc0b9d18b8a5d9cacc31df73fcc
2018-01-03 17:23:36 -05:00
Corey Farrell b32d6d5e2d astobj2: Create case-insensitive variants of container function macros.
* AO2_STRING_FIELD_CASE_HASH_FN
* AO2_STRING_FIELD_CASE_CMP_FN
* AO2_STRING_FIELD_CASE_SORT_FN

Change-Id: I11af8c6a0c43380a42732553f519c667abb842cf
2017-12-30 13:39:24 -05:00
Corey Farrell 0fe7df641a datastore: Add automatic module references.
Add a reference to the calling module when it is active to protect
access to datastore->info.  Remove module references done by
func_periodic_hook as the datastore now handles it.

ASTERISK-25128 #close

Change-Id: I8357a3711e77591d0d1dd8ab4211a7eedd782c89
2017-12-29 16:16:11 -05:00
Corey Farrell c2529a352c astobj.h: Remove from Asterisk core.
This is the old ASTOBJ macro's which are no longer used except by the
deprecated netsock.c.  Move it to the chan_iax2 include folder so it
does not get used elsewhere.

Change-Id: I7e4ae96678b36b9f41d3cae14b167f110eb5d349
2017-12-22 15:00:14 -05:00
Sean Bright fd0ca1c3f9 Remove as much trailing whitespace as possible.
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-22 09:23:22 -05:00
Jenkins2 0100c9267e Merge "Fix Common Typo's." 2017-12-21 08:40:22 -06:00
Corey Farrell 1b80ffa495 Fix Common Typo's.
Fix instances of:
* Retreive
* Recieve
* other then
* different then
* Repeated words ("the the", "an an", "and and", etc).
* othterwise, teh

ASTERISK-24198 #close

Change-Id: I3809a9c113b92fd9d0d9f9bac98e9c66dc8b2d31
2017-12-20 12:40:01 -05:00
Richard Mudgett 3625e91586 manager.h: Bump AMI version
Change-Id: I62e6ddeb261ef012687e1fb6734c554e2499b6bf
2017-12-20 11:34:42 -06:00
Jenkins2 11a1e07ad2 Merge "netsock: Remove from Asterisk core." 2017-12-18 17:40:22 -06:00
Joshua Colp 5224fd3ab4 Merge changes from topic 'faster-aco'
* changes:
  aco: Minimize use of regex.
  aco: Create ways to minimize use of regex.
2017-12-18 14:41:41 -06:00
Corey Farrell 064c74e4af netsock: Remove from Asterisk core.
This moves netsock.c / netsock.h to the chan_iax2 module.  netsock.h has
been marked deprecated since 13.0.0, chan_iax2 is the only remaining
user.

Change-Id: I28c6578043bac18de5ea608e136acec4f83d5dd3
2017-12-18 15:00:35 -05:00
George Joseph c56c4312ad Merge changes from topic 'loader-work'
* changes:
  loader: Use vector to build apha sorted module lists.
  loader: Replace priority heap with vector.
2017-12-18 10:24:28 -06:00
Jenkins2 c9bcd888a2 Merge "res_rtp_asterisk.c: Disable packet flood detection for video streams." 2017-12-15 12:15:42 -06:00
Jenkins2 dff0415b1e Merge "pjsip_options: wrongly applied "UNKNOWN" status" 2017-12-15 09:49:50 -06:00
Corey Farrell a455e18320 aco: Create ways to minimize use of regex.
ACO uses regex in many situations where it is completely unneeded.  In
some cases this doubles the total processing performed by
aco_process_config.

* Create ACO_IGNORE category type for use in place of skip_category
  regex source string.
* Create additional aco_category_op values to allow specifying category
  filter using either a single plain string or a NULL terminated array
  of plain strings.
* Create ACO_PREFIX to allow matching option names to case insensitive
  prefixes.

Change-Id: I66a920dcd8e2b0301f73f968016440a985e72821
2017-12-15 10:14:20 -05:00
Corey Farrell 7b54903313 loader: Replace priority heap with vector.
This is needed for future changes which will require being able to
process the load priority out of order.

Change-Id: Ia23421197f09789940510b03ebbbf3bf24d51bea
2017-12-14 20:53:25 -05:00
Richard Mudgett 98f7e9251f res_rtp_asterisk.c: Disable packet flood detection for video streams.
We should not do flood detection on video RTP streams.  Video RTP streams
are very bursty by nature.  They send out a burst of packets to update the
video frame then wait for the next video frame update.  Really only audio
streams can be checked for flooding.  The others are either bursty or
don't have a set rate.

* Added code to selectively disable packet flood detection for video RTP
streams.

ASTERISK-27440

Change-Id: I78031491a6e75c2d4b1e9c2462dc498fe9880a70
2017-12-14 14:40:34 -06:00
Richard Mudgett 22810fc635 chan_pjsip/res_pjsip: Add CHANNEL(pjsip,request_uri)
This patch does three things associated with the initial incoming INVITE
request URI.

1) Add access to the full initial incoming INVITE request URI.

2) We were not setting DNID on incoming PJSIP channels.  The DNID is the
user portion of the initial incoming INVITE Request-URI.  The value is
accessed by reading CALLERID(dnid).

3) Fix CHANNEL(pjsip,target_uri) documentation.

* The initial incoming INVITE request URI is now available using
CHANNEL(pjsip,request_uri).

* Set the DNID on PJSIP channel creation so CALLERID(dnid) can return the
initial incoming INVITE request URI user portion.

* CHANNEL(pjsip,target_uri) now correctly documents that the target URI is
the contact URI.

* Refactored print_escaped_uri() out of channel_read_pjsip() to handle
pjsip_uri_print() error condition when the buffer is too small.

ASTERISK-27478

Change-Id: I512e60d1f162395c946451becb37af3333337b33
2017-12-12 13:46:42 -06:00
Kevin Harwell b088cddc03 pjsip_options: wrongly applied "UNKNOWN" status
A couple of places were setting the status to "UNKNOWN" when qualifies were
being disabled. Instead this should be set to the "CREATED" status that
represents when a contact is given (uri available), but the qualify frequency
is set to zero so we don't know the status.

This patch updates the relevant places with "CREATED". It also updates the
"CREATED" status description (value shown in CLI/AMI/ARI output) to a value
of "NonQualified"/"NonQual" as this description is hopefully less confusing.

ASTERISK-27467

Change-Id: Id67509d25df92a72eb3683720ad2a95a27b50c89
2017-12-11 15:27:29 -06:00
Jenkins2 b7e79d7baf Merge "astdb: Improve prefix searches in astdb" 2017-12-11 12:12:58 -06:00
Sean Bright 9a9edc6c9e astdb: Improve prefix searches in astdb
Using the LIKE operator requires a full table scan of 'astdb', whereas a
comparison operation is able to use the primary key index.

This patch adds a new function to the AstDB API for quick prefix matches
and updates res_sorcery_astdb to utilize it. This showed substantial
performance improvement in my test environment.

Related to ASTERISK~26806, but does not completely resolve it.

Change-Id: I7d37f9ba2aea139dabf2ca72d31fbe34bd9b2fa1
2017-12-10 12:51:16 -06:00
Sean Bright 2ffe52a116 utils: Add convenience function for setting fd flags
There are many places in the code base where we ignore the return value
of fcntl() when getting/setting file descriptior flags. This patch
introduces a convenience function that allows setting or clearing file
descriptor flags and will also log an error on failure for later
analysis.

Change-Id: I8b81901e1b1bd537ca632567cdb408931c6eded7
2017-12-08 13:28:04 -06:00
Richard Mudgett 8536a09b86 security-events: Fix SuccessfulAuth using_password declaration.
The SuccessfulAuth using_password field was declared as a pointer to a
uint32_t when the field was later read as a uint32_t value.  This resulted
in unnecessary casts and a non-portable field value reinterpret in
main/security_events.c:add_json_object().  i.e., It would work on a 32 bit
architecture but not on a 64 bit big endian architecture.

Change-Id: Ia08bc797613a62f07e5473425f9ccd8d77c80935
2017-12-04 17:21:27 -06:00
Corey Farrell d12a2ab400 CLI: Remove compatibility code.
Previous commits maintained compatibility with older remote console
clients as well as maintaining all API's.

Remove the following compatibility code:
* ast_cli_generatornummatches.
* Remote command "_command nummatches".
* Sorting / duplicate removal by remote console.

Change-Id: I59e6ce94fa57ae564888442049695f7e46746437
2017-11-27 16:23:06 -06:00
George Joseph 708189ce02 Merge "CLI: Create ast_cli_completion_add function." 2017-11-27 13:26:43 -06:00
George Joseph 93dba6f396 Merge "CLI: Remove calls to ast_cli_generator." 2017-11-27 12:11:18 -06:00
Joshua Colp d8c6852bdc Merge "BuildSystem: pjsip_evsub_set_uas_timeout was not used." 2017-11-21 10:33:28 -06:00
Corey Farrell 9587a61f4c CLI: Create ast_cli_completion_add function.
Some completion generators are very inefficent due to the way CLI
requests matches one at a time.  ast_cli_completion_add can be called
multiple times during one invokation of a CLI generator to add all
results without having to reinitialize the search state for each match.

Change-Id: I73d26d270bbbe1e3e6390799cfc1b639e39cceec
2017-11-21 09:39:19 -05:00