Adds a data buffer with a configurable size that can store different
kinds of packets (like RTP packets for retransmission). Given a number
it will store a data packet at that position relative to the others.
Given a number it will retrieve the given data packet if it is present.
This is purposely a storage of arbitrary things so it can be used not
just for RTP packets but also Asterisk frames in the future if needed.
The API does not internally use a lock, so it will be up to the user of
the API to properly protect the data buffer.
For more information, refer to the wiki page:
https://wiki.asterisk.org/wiki/display/AST/WebRTC+User+Experience+Improvements
Change-Id: Iff13c5d4795d52356959fe2a57360cd57dfade07
This change extends the existing AST_FRAME_RTCP frame type to be
able to contain additional RTCP message types, such as feedback
messages. The payload type is contained in the subclass which allows
knowing what is in the frame itself.
The RTCP feedback message type is now handled and REMB[1] messages
are raised with their containing information.
This also fixes a bug where all feedback messages were triggering
video updates instead of just FIR and FUR.
Finally RTCP frames are now passed up through the Asterisk core to
what is handling the channel, mapped appropriately in the case of
bridging, and written to an outgoing stream. Since RTCP frames are
on a per-stream basis this is only done on multistream capable
channels.
[1] https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
ASTERISK-27758
ASTERISK-26366
Change-Id: I680da0ad8d5059d5e9655d896fb9d92e9da8491e
Setting optind = 0 is forced to 1 in glibc implementation, but
causes option parsing to be flawed in other implementations, for
example on FreeBSD.
ASTERISK-27773 #close
Change-Id: Ia548e69f8302e9754dbbedb6bc451c0700c66f61
This creates a separate source to 'own' symbols related to options.h and
paths.h. This significantly reduces the number of exports created by
main/asterisk.o. This change is required to eventually be able to
link unmodified Asterisk sources to utilities and/or stand-alone tests.
ASTERISK~26245
Change-Id: I5cf184f4757f9363b80c9e678bdc35c477122380
* dahdi_chan_name
* dahdi_chan_name_len
* dahdi_chan_mode
* __manager_event
* dialed_interface_info
Added comment about __progname and environ being needed for FreeBSD to
prevent accidental removal in the future.
Change-Id: I3ae026bc541cd9cb572be2ffa95fc359547642b5
If the two formats on a channel are equal, we don't transcode and since
the generic plc needs slin to work, it doesn't get invoked.
* A new configuration option "genericplc_on_equal_codecs" was added
to the "plc" section of codecs.conf to allow generic packet loss
concealment even if no transcoding was originally needed.
Transcoding via SLIN is forced in this case.
ASTERISK-27743
Change-Id: I0577026a179dea34232e63123254b4e0508378f4
* Define CHAR_T_LIBEDIT and CHAR_TO_LIBEDIT based on
HAVE_LIBEDIT_IS_UNICODE. This avoids needing to repeatedly use
conditional blocks, eliminates having multiple function prototypes.
* Remove parenthesis from return values.
* Add missing code block brackets {}.
* Reduce use of 'else' conditional statements where possible.
Change-Id: I4315328ebea2f62641faf6881de2ac20a9f9d08e
This replaces AST_INLINE_API allocators in utils.h with real functions
implemented in astmm.c. Associated macro's are also moved from utils.h
to astmm.h.
Remove menuselect conflicts between MALLOC_DEBUG and DEBUG_CHAOS as they
can now be combined.
This has multiple benefits:
* Simplifies asterisk/utils.h by removing inline functions and use of
the logger.
* Removal of these inline functions decreases size of Asterisk and
module binaries by 1% or more.
* Puts memory management functions together with and without
MALLOC_DEBUG enabled, simplifying management of the code.
* Enables DEBUG_CHAOS for ASTMM_REDIRECT and bundled pjproject.
Change-Id: If9df4377f74bdbb627461b27a473123e05525887
* ast_cli_complete
* ast_complete_channels
* ast_complete_applications
These generators will now use ast_cli_completion_add if state == -1.
Change-Id: I7ff311f0873099be0e43a3dc5415c0cd06d15756
* acl (named_acl.c)
* cdr
* cel
* ccss
* dnsmgr
* dsp
* enum
* extconfig (config.c)
* features
* http
* indications
* logger
* manager
* plc
* sounds
* udptl
These modules are now loaded at appropriate time by the module loader.
Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so
the module loader will abort startup on failure of these modules.
Some of these modules are still initialized or shutdown from outside the
module loader. logger.c is initialized very early and shutdown very
late, manager.c is initialized by the module loader but is shutdown by
the Asterisk core (too much uses it without holding references).
Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
GCC documentation states that when __attribute__((malloc)) is used it
should not return storage which contains any valid pointers. It
specifically mentions that realloc functions should not have the malloc
attribute, but this also means that complex initializers which could
contain initialized pointers should not use this attribute.
Change-Id: If507f33ffb3ca3b83b702196eb0e8215d27fc7d2
This causes MALLOC_DEBUG reporting to be slightly different, calls which
cause additional memory pools to be allocated now report the callers
location rather than the location which originally allocated the
string field structure. This reduces storage needed by string fields
and allows MALLOC_DEBUG to identify the source of additional allocations
rather than obscuring it by reporting the original allocation caller.
Change-Id: Idd18e6639a87ab862079b580c114d90361412289
When built-in components of Asterisk fail to start they cause the
Asterisk startup to abort. In these cases only the most critical
cleanup should be performed - closing databases and terminating
proceses. These cleanups are registered using ast_register_atexit, all
other cleanups should not be run during startup abort.
The main reason for this change is that these cleanup procedures are
untestable from the partially initialized states, if they fail it could
prevent us from ever running the critical cleanup with ast_run_atexits.
Create separate initialization for dns_core.c to be run unconditionally
during startup instead of being initialized by the first dns resolver to
be registered. This ensures that 'sched' is initialized before it can be
potentially used.
Replace ast_register_atexit with ast_register_cleanup in media_cache.c.
There is no reason for this cleanup to happen unconditionally.
Change-Id: Iecc2df98008b21509925ff16740bd5fa29527db3
In the script ./configure,
xyz_LIB is set by AST_PKG_CONFIG_CHECK and
xyz_LIBS is set by PKG_CHECK_MODULES within
AST_PKG_CONFIG_CHECK. Both are the same. In Asterisk normally the former and
only three times the latter was used. Let us use xyz_LIB without s, for
consistency with AST_EXT_LIB_CHECK. That eases understanding because now readers
do not have to know that xyz_LIB equals xyz_LIBS.
Change-Id: I7359860a5d730cdc784c2c48e501a082196434d3
Checking option_debug directly is incorrect as it ignores file/module
specific debug settings. This system-wide change replaces nearly all
direct checks for option_debug with the DEBUG_ATLEAST macro.
Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0
When HAVE_GETHOSTBYNAME_R_5 was set by the script ./configure, GCC 7.3.0 found
an unused variable. Actually, the variable was used (set to a dummy value) but
the compiler optimization might have removed that. Instead, this change ensures
that the variable 'res' is only used when it is really required.
Change-Id: Ic3ea23ccf84ac4bc2d501b514985b989030abab5
This allows asterisk to be compiled with MALLOC_DEBUG to load modules
built without MALLOC_DEBUG. Now pre-compiled third-party modules will
still work regardless of MALLOC_DEBUG being enabled or not.
Change-Id: Ic07ad80b2c2df894db984cf27b16a69383ce0e10
The pool cache gets in the way of finding use after free errors of memory
pool contents. Tools like valgrind and MALLOC_DEBUG don't know when a
pool is released because it gets put into the cache instead of being
freed.
* Added the "cache_pools" option to pjproject.conf. Disabling the option
helps track down pool content mismanagement when using valgrind or
MALLOC_DEBUG. The cache gets in the way of determining if the pool
contents are used after free and who freed it.
To disable the pool caching simply disable the cache_pools option in
pjproject.conf and restart Asterisk.
Sample pjproject.conf setting:
[startup]
cache_pools=no
* Made current users of the caching pool factory initialization and
destruction calls call common routines to create and destroy cached pools.
ASTERISK-27704
Change-Id: I64d5befbaeed2532f93aa027a51eb52347d2b828
When a line is the maximum length "\n" is found at sizeof(buf) - 2 since
the last character is actually the null terminator. In addition if a
line was exactly 8190 plus a multiple of 8192 characters long the config
parser would skip the following line.
Additionally fix comment in voicemail.conf sample config. It previously
stated that emailbody can only contain up to 512 characters which is
always wrong. The buffer is normally 8192 characters unless LOW_MEMORY
is enabled then it is 512 characters. The updated comment states that
the line can be up to 8190 or 510 characters since the line feed and
NULL terminator each use a character.
ASTERISK-26688 #close
Change-Id: I80864a0d40d2e2d8cd79d72af52a8f0a3a99c015
When an RTP packet is received by an RTP engine it has to map the
payload into the Asterisk format. The code was incorrectly checking
our own static list for ALL payloads if it couldn't find a negotiated one.
This included dynamic payloads. If the payload mapped to a format
of a different type (for example receiving a video packet on an audio
RTP instance) then the core stream code could cause a crash if a legacy
channel driver was in use as no stream would be present.
To provide further protection the core stream code will no longer assume
that a video or audio frame will always have a stream for legacy channel
drivers. If no stream is present the frame is dropped.
ASTERISK-27488
Change-Id: I022556f524ad8379ee73f14037040af17ea3316a
This will make the source filename match the 'module reload sounds'
command. This will allow conversion to a built-in module in Asterisk 16
without needing to redefine AST_MODULE.
Change-Id: Ifb8e489575b27eb33d8c0b6a531f266670557f6e
Expand locking to include full reload process for extconfig to ensure
nothing can read the config mappings between clearing and reloading.
Change-Id: I378316bad04f1b599ea82d0fef62b8978a644b92
* Replace ad-hoc array management with macro's from vector.h.
* Remove redundent logger messages.
* Use normal Asterisk allocators instead of directly using libc
allocators.
* Free memory when an API has no implementation or users.
Change-Id: Ic6ecb31798d4a78e7df39ece86a68b60eac05bf5
Add an AMI events Load and Unload for notify when the
module has been loaded and unloaded.
ASTERISK-27661
Change-Id: Ib916c41eddd63651952998f2f49c57c42ef87a64
Jansson is thread safe for all read-only functions and reference
counting starting v2.11. This allows simplification of our code and
removal of locking around reference counting and dumping.
Change-Id: Id985cb3ffa6681f9ac765642e20fcd187bd4aeee
This removes the embedded copy of editline from the Asterisk source
tree, making a system copy of libedit mandatory in Asterisk 16+.
ASTERISK-27634 #close
Change-Id: Iedb64ad92acb78419f3caefedaa2bb7cd2a1a33f
Need to remove all CDR's listed by a CDR object from the active_cdrs_all
container including the root/master record.
ASTERISK-27656
Change-Id: I48b4970663fea98baa262593d2204ef304aaf80e
* Changed to create ami_event string only when the given blob is not
json_null().
* Fixed bad expression.
ASTERISK-27621
Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f
ast_str_append_event_header() could potentially leak and corrupt memory if
the ast_str needed to expand to add the AMI event header.
* Fixed to return error if the ast_str_append() failed.
Change-Id: I92f36b855540743b208d76e274152ee2d758176d
* Made not allocate memory if the channel snapshot is an internal channel.
* Free memory earlier when no longer needed.
Change-Id: Ia06e0c065f1bd095781aa3f4a626d58fa4d28b38
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
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
The previous fix broke the case
HAVE_SYSINFO = no
HAVE_SYSCTL = yes
HAVE_SWAPCTL = no
which occurs on FreeBSD 11.1 for example.
ASTERISK-26563
Change-Id: If77c39bc75f0b83a6c8a24ecb2fa69be8846160a
Move initialization of units which do not require configuration to occur
before preload modules. This leaves only units which load config between
module preload and regular load stages.
Change-Id: I1d15384acad16a22c3498124421af474fa517478
This change causes the configure script to throw an error if neither
__sync nor __atomic builtin functions are available.
ASTERISK-27619
Change-Id: Ie01a281e0f5c41dfeeb5f250c1ccea8752f56ef9
The code which handled loading modules had too many situations which
would result in halting Asterisk startup. Treat most errors as declines
instead of failures. The exception is when the module load function
returns AST_MODULE_LOAD_FAILURE or an invalid code.
Clear the missingdeps vector when appropriate to ensure the next loop
starts clean.
ASTERISK-27620
Change-Id: I45547d9641fd45bd86d80250224417625631ad84
* 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
Each time the dial plan is reloaded, a lot of logs like these are generated:
"Added extension 'XXXXX' priority 1 to YYYYYYYYYYY"
This patch changes the log level for those logs.
ASTERISK-27084
Change-Id: I5662902161c50890997ddc56835d4cafb456c529
* Add SRC_EMBEDDED variable to main/Makefile. Built-in module sources
must be listed in this variable to ensure they get the correct CFLAGS.
Change-Id: I920852bc17513a9c2627061a4ad40511e3a20499
Use a single loop in a loop to scan the resource list attempting to
dlopen each module. The inner loop is repeated until it doesn't do any
work, then it is run one more time to allow printing of error messages.
Change-Id: I60c15cd57ff9680b62e2a94c7519401fa4a38e45
Dependency loader is now in place so we no longer need a separate loader
phase for global symbols only. This simplifies the loader and allows us
to minimize calls to dlopen.
Change-Id: I33e3174d67f3b4552d3d536326dcaf0ebabb097d
* Add string vectors for requires, optional_apis and enhances.
* Add reffed_deps module vector for holding references to dependencies.
* Initialize string vectors after final dlopen of each module.
* Free string vectors and clear references from reffed_deps in
module_destroy.
* Create functions necessary to process module dependencies and enforce
load order.
Module dependencies result in automatic references being managed by the
module loader. This enforces unload order.
Change-Id: I9be08d1dd331aceadc1dcba00b804d71360b2fbb
* Remove comment about lazy load.
* Improve message about module already being loaded and running.
* Handle allocation error in add_to_load_order.
* Dead code elimination from modules_shutdown.
Change-Id: I22261599c46d0f416e568910ec9502f45143197f
Since v12 the number of taskprocessors in the system has increased a lot.
Small systems can easily have over a hundred and larger systems can have
thousands.
Most uses of the tps_singletons container deal with creating and
destroying the taskprocessors. However, the pjsip distributor looks up
taskprocessors/serializers by name frequently. It needs to find the
serializer for incoming SIP responses to distribute them to the
appropriate serializer.
Change-Id: Ice0603606614ba49f7c0c316c524735c064e7e43
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
ast_format_get_sample_rate(.) returns an unsigned type. The difference of a
substraction between two unsigned types does not get implicitly converted to a
signed type. Therefore, using abs(.) did not make sense.
ASTERISK-27549
Change-Id: Ib904d9ee0d46b6fdd1476fbc464fbbf813304017
pbx_extension_helper has a check for q->swo.exec == NULL but it doesn't
actually return so we would still run the function. Fix the return.
Move the 'int res' variable into the only scope which uses it.
Also fix a copy-paste error in ast_pbx_init which could result in a
crash on allocation failure (we exit with a normal error instead).
Change-Id: I0693af921fdc7f56b6a72a21fb816ed08b960a69
Translators are run during module load before the module is actually
running, so it cannot use ast_module_running_ref.
ASTERISK-20346
Change-Id: Iaa0e75da99c696e38000f1a41e340abbd7a88f56
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
Per RFC 5245, the foundation specified with an ICE candidate can be up
to 32 characters but we are only allowing for 31.
ASTERISK-27498 #close
Reported by: Michele Prà
Change-Id: I05ce7a5952721a76a2b4c90366168022558dc7cf
This uses AO2_STRING_FIELD_HASH_FN and AO2_STRING_FIELD_CMP_FN where
possible in the Asterisk core.
This removes CMP_STOP from the result of CMP_FN callbacks for the
following structure types:
* ast_bucket_metadata
* ast_bucket_scheme
* generic_monitor_instance_list (ccss.c)
* ast_bucket_file (media_cache.c)
* named_acl
Change-Id: Ide4c1449a894bce70dea1fef664dade9b57578f1
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
* Use current OBJ_SEARCH_xxx defines instead of the deprecated versions.
* Fix hash_cb and cmp_cb container functions to correctly use the
OBJ_SEARCH_xxx values.
* Remove incorrect usage of CMP_STOP. Most uses in the system have no
effect. This allows the collapse of channel_role_single_cmp_cb() and
channel_role_multi_cmp_cb() into channel_role_cmp_cb().
* Remove unnecessary usage of RAII_VAR().
Change-Id: I02c405518cab22aa2a082b61e2353bf7cd629a70
The AMI Status event had linkedid listed twice and was missing the
effective connected line name and number headers.
NOTE: The linkedid and other standard channel snapshot fields in the XML
documentation are part of the <channel_snapshot/> XML template defined in
doc/appdocsxml.xslt.
Change-Id: I004c4c4f9e7b40ef55035c831702721bec82496c
* handle_dial_message: Missing a check for NULL peer.
* cdr_generic_register: Missing unlock on allocation failure.
cdr_generic_register is fixed by reordering so the new structure is
allocated and initialized before locking the list.
Change-Id: I5799b99270d1a7a716a555c31ac85f4b00ce8686
Some compiler optimizers seem to assume that dlopen will not use
__attribute__((constructor)) functions to call back to the program.
This was causing resource_being_loaded to be optimized away completely.
ASTERISK-27531 #close
Tested By: abelbeck
Change-Id: If17a3b889e06811a0e7119f0539d052494d6ece9
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
The bridge holds onto the old channel video source after it's been
released. This can lead to use after free errors.
ASTERISK-27229 #close
Change-Id: Ib2dab61677dd8a21f7ad53cdc9b8ca93297838b3
Apparently in OSX it's possible for OSX to HAVE_SYSCTL but not
HAVE_SYSINFO or HAVE_SWAPCTL. In this case freeswap caused an unused
variable error.
ASTERISK-26563 #close
Change-Id: I8ec5b1897b786cc1abaf62264aa75039eea05510
* listen uses the variable `s` for the result from ast_poll() then
overwrites it with the result of accept(). Create a separate variable
poll_result to avoid confusion since ast_poll does not return a file
descriptor.
* Resolve fd leak that would occur if setsockopt failed in listen.
* Reserve an extra byte while processing completion results from remote
daemon. This fixes a bug where completion processing used strstr() on
a string that was not '\0' terminated. This was no risk to the Asterisk
daemon, the bug was only reachable the remote console process.
* Resolve leak in handle_showchan when the channel is not found.
* Multiple leaks and a deadlock in pbx_config CLI completion.
* Fix leaks in "manager show command".
Change-Id: I8f633ceb1714867ae30ef4e421858f77c14485a9
Add a check to allocate_dns_record to prevent calling a pointer
retrieved from beyond dns_alloc_table.
ASTERISK-27495 #close
Change-Id: Ie2f6e4991cea46baa12e837bd64cc22b44d322bb
When a channel that is on hold gets added to a bridge by
the Bridge AMI action or the dialplan application of the same name,
music continues to play, causing "robotic sound".
This commit adds a call to ast_moh_stop to stop the music.
Also, it makes the AMI Park action use the right MOH class when the
channel gets parked.
Reported by: Zane Conkle
ASTERISK-25079 #close
Change-Id: I4b129c5a20c15e63968842460ac5a1a85903cf9f
Some variables are set and never changed, making them constant. This
means that code in the 'false' block of the conditional is unreachable.
In chan_skinny and res_config_ldap I used preprocessor directive `#if 0`
as I'm unsure if the unreachable code could be enabled in the future.
Change-Id: I62e2aac353d739fb3c983cf768933120f5fba059
* Fix small leaks in from error conditions in sdp.c and translate.c.
* Check new file descriptor is less than 0, not less than or equal.
Change-Id: Id7782775486175c739e0c4bf3ea5e17e3f452a99
* ast_linear_stream would leak a file descriptor if it failed to allocate
lin.
* ast_control_tone leaked zone and ts if ast_playtones_start failed.
Additionally added whitespace to ast_linear_stream, pulled assignments
out of conditionals for improved readability.
Change-Id: I6d1a10cf9161b1529d939b9b2d63ea36d395b657
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
The completion generator is missing a return so typing "core set debug
all off <tab>" causes the command to actually execute.
Change-Id: Ibf6462088a74eee66967732b50445783ebefc20b
Remove nearly all use of regex from ACO users. Still remaining:
* app_confbridge has a legitamate use of option name regex.
* ast_sorcery_object_fields_register is implemented with regex, all
callers use simple prefix based regex. I haven't decided the best
way to fix this in both 13/15 and master.
Change-Id: Ib5ed478218d8a661ace4d2eaaea98b59a897974b
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
This is needed for future changes which will require being able to
process the load priority out of order.
Change-Id: Ia23421197f09789940510b03ebbbf3bf24d51bea
* Split off load_dlopen to perform actual dlopen, check results and log
warnings when needed.
* Always use RTLD_NOW.
* Use flags which minimize number of calls to dlopen required. First
attempt always uses RTLD_GLOBAL when global_symbols_only is enabled,
RTLD_LOCAL when it is not.
This patch significantly reduces the number of dlopen's performed. With
299 modules my system ran dlopen 857 times before this patch, 655 times
after this patch.
Change-Id: Ib2c9903cfddcc01aed3e01c1e7fe4a3fb9af0f8b
This protects the module loader itself against crashing if dlopen is
called on a module from outside loader.c.
* Expand scope of lock inside ast_module_register to include reading of
resource_being_loaded.
* NULL check resource_being_loaded.
* Set resource_being_loaded NULL as soon as dlopen returns. This fixes
some error paths where it was not NULL'ed.
* Create module_destroy function to deduplicate code from
ast_module_unregister and modules_shutdown.
* Resolve leak that occured if a module did not successfully register.
* Simplify checking for successful registration.
Change-Id: I40f07a315e55b92df4fc7faf525ed6d4f396e7d2
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
rasterisk does not need to handle setting verbose levels locally, it
should just tell the daemon what it wants and print what it is given.
Just max out the verbose level on the local client so all filtering
happens on the daemon.
ASTERISK-20281 #close
Change-Id: Ia305f75f1fc424a9169bfa30ef70d626ace2c8a8
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
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
Optimize resource_name_match. This change eliminates use of
ast_strdupa, instead verifying that both basename's are the same length,
then using strncasecmp.
Change-Id: I477275c0e954c99d74be5abfc8bb6545b04e5a3d
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
The sounds index is rebuilt each time a format is registered or
unregistered. This causes the index to be repeatedly rebuilt during
startup and shutdown.
This patch significantly reduces the work done by delaying sound index
initialization until after modules are loaded. This way a reindex only
occurs if a format module is loaded after startup. We also skip
reindexing when format modules are unloaded during shutdown.
Change-Id: I585fd6ee04200612ab1490dc804f76805f89cf0a
This eliminates some wasteful operations in media_index startup.
* Replace statically set string-fields with char[0].
* Eliminate pointless RAII_VAR's.
* alloc_variant: Avoid pointless ao2_find on new info->variant.
* Stop trying find_variant before alloc_variant.
* process_media_file: replace ast_str with ast_asprintf. This avoids
reallocation of file_id_str.
Overall sounds_index.c is about 27% of Asterisk startup time when using
sample configs. This patch reduces it to 20%. This is a half-fix. The
real problem is that the media_index is regenerated repeatedly - 68
times in my test.
Change-Id: Ia50b752f8efb356f852b05c4be495a6631af8652
* Added start DTMF transfer verbose messages.
* Made associated transfer messages use a similar message format.
* Adjusted message verbose level as requested by initial reporter.
ASTERISK-27449
Change-Id: I2045714586414b3c5ef1f3cc56c1c4af4b31f551
* Add the channel name to diagnostic messages so you will know which
channel failed to transfer.
* Promoted some debug messages to verbose 4 messages.
ASTERISK-27449 #close
Change-Id: Idac66b7628c99379cc9269158377fd87dc97a880
ast_category_get() has an (undocumented) implementation detail where it
tries to match the category name first by an explicit pointer comparison
and if that fails falls back to a normal match.
When initially building an ast_config during ast_config_load, this
pointer comparison can never succeed, but we will end up iterating all
categories twice. As the number of categories using a template
increases, this dual looping becomes quite expensive. So we pass a flag
to category_get_sep() indicating if a pointer match is even possible
before trying to do so, saving us a full pass over the list of current
categories.
In my tests, loading a file with 3 template categories and 12000
additional categories that use those 3 templates (this file configures
4000 PJSIP endpoints with AOR & Auth) takes 1.2 seconds. After this
change, that drops to 22ms.
Change-Id: I59b95f288e11eb6bb34f31ce4cc772136b275e4a
When starting Asterisk in the foreground, there is a perceptible delay
when loading modules that use the ACO and sorcery config frameworks.
For example, a lightly configured res_pjsip took 853ms to load on my
VM.
I tracked down the slowness to the XPath queries used to associate the
relevant documentation with the config options. One improvement was
adding a call to xmlXPathOrderDocElems after loading an XML document.
From the libxml2 docs:
Call this routine to speed up XPath computation on static documents.
The second change was to remove recursive descent and wildcard
operators from the XPath queries. After these changes, res_pjsip takes
85ms to load on my VM and there is no longer a perceptible delay when
starting Asterisk in the foreground.
Change-Id: I45d457f1580e26bf5a2b0dab16e8e9ae46dcbd82
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
When a format has no pre-recorded sound files, Asterisk has to transcode between
formats. For this, Asterisk has a fixed translation table. If the pre-recorded
sound files are not available in the same sample rate, Asterisk has not only to
transcode but also to resample.
Asterisk has pre-recorded files for SLN (8000 kHz) and SLN16 (16000 kHz).
However before this change, Asterisk did not take the sample rate into account,
because the translation paths to SLN and SLN16 got the same score/weight in the
table. Consequently, you might have got narrow-band audio with siren14, speex32,
silk24, and silk12 although those are (ultra) wide-band audio codecs.
With this change, the distance in sample-rates is taken into account. Now on the
Command-Line interface (CLI) 'core show channels', you should see:
(slin@16000)->(slin@32000)->(speex@32000).
ASTERISK-23735
Reported by: Richard Kenner
Change-Id: I9448295c1978be26f8633b6066395e7bbbe2e213
* Stop using "_COMMAND NUMMATCHES" on remote consoles. Using this
command had doubled the amount of work needed from the Asterisk
daemon for each completion request.
* Fix code formatting.
* Remove static buffer used to send the command, use the same buffer
that will receive the results.
* Move sort from ast_cli_display_match_list.
Change-Id: Ie2211b519a3d4bec45bf46e0095bdd01d384cb69
This rewrites ast_el_strtoarr to use vector's internally, but still
return the original NULL terminated array of strings.
Change-Id: Ibfe776cbe14f750effa9ca360930acaccc02e957
* Stop estimating line count, just print until we run out of matches.
* Stop freeing entries, the caller does that anyways.
* Stop calculating / returning numoutput, it was ignored.
Change-Id: I7f92afa8bea92241a95227587367424c8c32a5cb
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