summaryrefslogtreecommitdiff
path: root/main
AgeCommit message (Collapse)Author
2015-07-11main/format_cap: Parse capabilities generated by ast_format_cap_get_namesMatt Jordan
We have a strange relationship between the parsing of format capabilities from a string and their representation as a string. We expect the format capabilities to be expressed as a string in the following format: allow = !all,ulaw,alaw disallow = g722 While we would generate the string representation of those formats as: allow = (ulaw|alaw) disallow = (ulaw|alaw|g729...) When the configuration framework needs to store values as a string, it generates the format capabilities using the second representation; this representation however cannot be parsed when the entry is rehydrated. This patch fixes that by updating ast_format_cap_update_by_allow_disallow to parse an entry as if it were in the generated format if it has a leading '(' and a trailing ')'. ASTERISK-25238 Change-Id: I904d43caf4cf45af06f6aee0c9e58556eb91d6ca
2015-07-11main/sorcery: Provide log messages when a wizard does not support an operationMatt Jordan
If a sorcery wizard does not support one of the 'optional' CRUD operations (namely the CUD), log a WARNING message so we are aware of why the operation failed. This also removes an assert in this case, as the CUD operation may have been triggered by an external system, in which case it is not a programming error but a configuration error. Change-Id: Ifecd9df946d9deaa86235257b49c6e5e24423b53
2015-07-11Merge "main/devicestate: Prevent duplicate registration of device state ↵Matt Jordan
providers"
2015-07-11Merge "bucket: Add clone/staleness operations for ast_bucket/ast_bucket_file"Matt Jordan
2015-07-11Merge "sorcery: Add support for object staleness"Matt Jordan
2015-07-11main/devicestate: Prevent duplicate registration of device state providersMatt Jordan
Currently, the device state provider API will allow you to register a device state provider with the same case insensitive name more than once. This could cause strange issues, as the duplicate device state providers will not be queried when a device's state has to be polled. This patch updates the API such that a device state provider with the same name as one that has already registered will be rejected. Change-Id: I4a418a12280b7b6e4960bd44f302e27cd036ceb2
2015-07-10ARI: Added new functionality to get all module information.Benjamin Ford
An http request can be sent to retrieve a list of all existing modules, including the resource name, description, use count, status, and support level. The command "curl -v -u user:pass -X GET 'http://localhost:8088/ari/ asterisk/modules" (or something similar, depending on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Information on modules can now be retrieved Change-Id: I63cbbf0ec0c3544cc45ed2a588dceabe91c5e0b0
2015-07-08Merge "DNS: Create a system-level DNS resolver"Mark Michelson
2015-07-07DNS: Create a system-level DNS resolverAshley Sanders
Prior to this patch, the DNS core present in master had no default system-level resolver implementation. Therefore, it was not possible for the DNS core to perform resolutions unless the libunbound library was installed and the res_resolver_unbound module was loaded. This patch introduces a system-level DNS resolver implementation that will register itself with the lowest consideration priority available (to ensure that it is to be used only as a last resort). The resolver relies on low-level DNS search functions to perform a rudimentary DNS search based on a provided query and then supplies the search results to the DNS core. ASTERISK-25146 #close Reported By: Joshua Colp Change-Id: I3b36ea17b889a98df4f8d80d50bb7ee175afa077
2015-07-04bucket: Add clone/staleness operations for ast_bucket/ast_bucket_fileMatt Jordan
This patch enhances the bucket API in two ways. First, since ast_bucket and ast_bucket_file instances are immutable, a 'clone' operation has been added that provides a 'clone' of an existing ast_bucket/ast_bucket_file object. Note that this makes use of the ast_sorcery_copy operation, along with the copy callback handler on the "bucket" and "file" object types for the bucket sorcery instance. Second, there is a need for the bucket API to ask a wizard if an object is stale. This is particularly useful with the upcoming media cache enhancements, where we want to ask the backing data storage if the object we are currently operating on has known updates. This patch adds API calls for ast_bucket and ast_bucket_file objects, which callback into their respective sorcery wizards via the sorcery API. Unit tests have also been added to cover the respective ast_bucket/ast_bucket_file clone and staleness operations. Change-Id: Ib0240ba915ece313f1678a085a716021d75d6b4a
2015-07-04sorcery: Add support for object stalenessMatt Jordan
This patch enhances the sorcery API to allow for sorcery wizards to determine if an object is stale. This includes the following: * Sorcery objects now have a timestamp that is set on creation. Since sorcery objects are immutable, this can be used by sorcery wizards to determine if an object is stale. * A new API call has been added, ast_sorcery_is_stale. This API call queries the wizards associated with the object, calling a new callback function 'is_stale'. Note that if a wizard does not support the new callback, objects are always assumed to not be stale. * Unit tests have been added that cover the new API call. Change-Id: Ica93c6a4e8a06c0376ea43e00cf702920b806064
2015-07-02Merge "dns: Fix crash when invoking cancel in DNS recurring unit test."Matt Jordan
2015-07-02Merge "sorcery/realtime: Add a bit of debug and warning messages for bad ↵Matt Jordan
configs"
2015-07-02Merge "rtp_engine: Skip useless self-assignment in ↵Joshua Colp
ast_rtp_engine_unload_format."
2015-07-02Merge "astfd: Fix buffer overflow in DEBUG_FD_LEAKS."Joshua Colp
2015-07-02sorcery/realtime: Add a bit of debug and warning messages for bad configsMatt Jordan
When a mapping does not exist between a sorcery.conf defined object and a realtime mapping in extconf, currently, the user will receive a slew of ERROR messages that don't really tell what is happening. Some ERROR messages may even be misleading, as they occur after the sorcery API has already given up on the attempt to load and create the sorcery object. This patch adds a bit of debug and a useful WARNING message for when a wizard's open callback fails for a particular object type. In the bad configurations that resulted in this patch, this provided a 'root cause' WARNING message that pointed in the right direction of the configuration problem. Change-Id: I1cc7344f2b015b8b9c85a7e6ebc8cb4753a8f80b
2015-07-02dns: Fix crash when invoking cancel in DNS recurring unit test.Joshua Colp
The recurring unit test expects the user data on a DNS query created as a result of a recurring DNS query to be the recurring structure itself. This is true, mostly. When invoking the user provided callback this user data is changed to the user provided data. This presents a race condition where the data may or may not point to the recurring data. This change simplifies the callback of the user provided callback by creating a new query and populating it with the expected values. This leaves the recurring DNS query alone and fixes the race condition. This is more in line with how the API should be used overall. ASTERISK-25222 #close Change-Id: I10fb6deec025dff097157e7ec17e6e4921778478
2015-07-02rtp_engine: Skip useless self-assignment in ast_rtp_engine_unload_format.Walter Doekes
When running valgrind on Asterisk, it complained about: ==32423== Source and destination overlap in memcpy(0x85a920, 0x85a920, 304) ==32423== at 0x4C2F71C: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/...) ==32423== by 0x55BA91: ast_rtp_engine_unload_format (rtp_engine.c:2292) ==32423== by 0x4EEFB7: ast_format_attr_unreg_interface (format.c:1437) The code in question is a struct assignment, which may be performed by memcpy as a compiler optimization. It is changed to only copy the struct contents if source and destination are different. ASTERISK-25219 #close Change-Id: I6d3546c326b03378ca8e9b8cefd41c16e0088b9a
2015-07-02astfd: Fix buffer overflow in DEBUG_FD_LEAKS.Walter Doekes
If DEBUG_FD_LEAKS was used and more file descriptors than the default of 1024 were available, some DEBUG_FD_LEAKS-patched functions would overwrite memory past the fixed-size (1024) fdleaks buffer. This change: - adds bounds checks to __ast_fdleak_fopen and __ast_fdleak_pipe - consistently uses ARRAY_LEN() instead of sizeof() or 1023 or 1024 - stores pointers to constants instead of copying the contents - reorders the fdleaks struct for possibly tighter packing - adds a tiny bit of documentation ASTERISK-25212 #close Change-Id: Iacb69e7701c0f0a113786bd946cea5b6335a85e5
2015-07-01Channel alert pipe: improve diagnostic error returnScott Griepentrog
When a frame is queued on a channel, any failure in ast_channel_alert_write is logged along with errno. This change improves the diagnostic message through aligning the errno value with actual failure cases. ASTERISK-25224 Reported by: Andrey Biglari Change-Id: I1bf7b3337ad392789a9f02c650589cd065d20b5b
2015-06-30Merge "channel: Remove ignore of answer on non-outgoing channels."Matt Jordan
2015-06-26main/pbx: Resolve case sensitivity regression in PBX hintsMatt Jordan
When 8297136f was merged for ASTERISK-25040, a regression was introduced surrounding the case sensitivity of device names within hints. Previously, device names - such as 'sip/foo' - were compared in a case insensitive fashion. Thus, 'sip/foo' was equivalent to 'SIP/foo'. After that patch, only the case sensitive name would match, i.e., 'SIP/foo'. As a result, some dialplan hints stopped working. This patch re-introduces case insensitive matching for device names in hints. ASTERISK-25040 ASTERISK-25202 #close Change-Id: If5046a7d14097e1e3c12b63092b9584bb1e9cb4c (cherry picked from commit 96bbcf495a1da9e607d9b04a44b5c4f49e83cc03)
2015-06-26Merge "threadpool, res_pjsip: Add serializer group shutdown API calls."Matt Jordan
2015-06-26Merge "sorcery: Add ast_sorcery_object_unregister() API call."Matt Jordan
2015-06-26AMI: Add Linkedid to the standard channel snapshot AMI event headers.Richard Mudgett
ASTERISK-25189 #close Reported by: John Hardin Change-Id: I2b1778c3fdc1dca0ed55db4e3a639eddfb16c2ac
2015-06-25threadpool, res_pjsip: Add serializer group shutdown API calls.Richard Mudgett
A module trying to unload needs to wait for all serializers it creates and uses to complete processing before unloading. ASTERISK-24907 Reported by: Kevin Harwell Change-Id: I8c80b90f2f82754e8dbb02ddf3c9121e5e966059
2015-06-25sorcery: Add ast_sorcery_object_unregister() API call.Richard Mudgett
Find and unlink the specified sorcery object type to complement ast_sorcery_object_register(). Without this function you cannot completely unload individual modules that use sorcery for configuration. ASTERISK-24907 Reported by: Kevin Harwell Change-Id: I1c04634fe9a90921bf676725c7d6bb2aeaab1c88
2015-06-25channel: Remove ignore of answer on non-outgoing channels.Joshua Colp
Due to the way that channels can now be moved around inside of Asterisk it is possible for the outgoing flag of a channel to get cleared before it has been answered. This results in the bridge not receiving notification that the outgoing leg has been answered. This most easily exhibits itself with DTMF based blond transfers. Since the answer of the outgoing leg is ignored the other party continues to receive both a locally generated ringing and the media stream of the outgoing leg upon its answer. This results in no media being heard. This change removes the ignore of the answer and allows it to pass through. ASTERISK-25171 #close Change-Id: I82aedcec4f89f34a2e5472086dfc9a6c775bca8e
2015-06-24test.c: Add unit test registration checks for summary and description.Richard Mudgett
Added checks when a unit test is registered to see that the summary and description strings do not end with a new-line '\n' for consistency. The check generates a warning message and will cause the /main/test/registrations unit test to fail. * Updated struct ast_test_info member doxygen comments. Change-Id: I295909b6bc013ed9b6882e85c05287082497534d
2015-06-23bridge.c: Hangup attended transfer target if bridgedKevin Harwell
After completing an attended transfer the transfer target channel was not being hung up after leaving the bridge. Added an explicit softhangup to hangup said channel, but only if it was previously bridged. ASTERISK-24782 #close Reported by: John Bigelow Change-Id: Idde9543d56842369384a5e8c00d72a22bbc39ada
2015-06-15main/cdr: Carry over the disable flag when 'disable all' is specifiedmjordan
The CDR_PROP function (as well as the NoCDR application) set the 'disable all' flag (AST_CDR_FLAG_DISABLE_ALL) on the current CDR. This flag is supposed to be applied to all CDRs that are currently in the chain, as well as all CDRs that may be created in the future. Currently, however, the flag is only applied to the existing CDRs in the chain; new CDRs do not receive the 'disable all' flag. In particular, this affects parallel dials, which generate new CDRs for each pair of channels in the dial attempt. This patch carries over the 'disable all' flag when it is specified on a CDR and a new CDR is generated for the chain. ASTERISK-24344 #close Change-Id: I91a0f0031e4d147bdf8a68ecd08304d506fb6a0e
2015-06-13main/cdr: Copy context/exten on chained CDRs for parallel dials in subroutinesMatt Jordan
When a parallel dial occurs, a new CDR will be created for each dial attempt that is made. In most circumstances, the act of creating each CDR in the chain will include a step that updates the Party A snapshot, which causes the context/extension of the Party A to be copied onto the CDR object. However, when the Party A is in a subroutine, we explicitly do *not* copy the context/extension onto the CDR. This prevents the Macro or GoSub routine name from blowing away the context/extension that the channel was originally executing in. For the original CDR, this is not a problem: the original CDR already recorded the last known 'good' state of the channel just prior to it going into the subroutine. However, for newly generated CDRs in a chain, there is no context/extension set on them. Since we are in a subroutine, we will never set the Party A's context/extension on the CDR, and we end up with a CDR with no destination recorded on it. This patch updates the creation of a chained CDR such that it copies over the original CDR's context/extension. This is the last known "good" state of the CDR, and is a reasonable starting point for the newly generated CDR. In the case where we are not in a subroutine, subsequent code will update the location of the CDR from the Party A information; in the case where we are in a subroutine, the context/extension on the original CDR is the correct information. ASTERISK-24443 #close Change-Id: I6a3ef0d6e458d3b9b30572feaec70f2964f3bc2a
2015-06-13Merge "bridge: When performing a blonde transfer update connected line ↵Matt Jordan
information."
2015-06-11bridge: When performing a blonde transfer update connected line information.Joshua Colp
When performing a blonde transfer the code uses the old masquerade mechanism to move a channel around. As a result of this certain information, such as connected line, is moved between the channels involved. Upon completion of the move a frame is queued which is supposed to update the connected line information on the channel. This does not occur as the code considers it a redundant update since the masquerade operation updated the channel (but did not inform it of the new connected line information). The code also does not queue a connected line update to be handled by the thread handling the channel. Without this any other channel that may be loosely involved does not know it is talking to a different caller. This change does the following to resolve this: 1. The indicated connected line information is cleared upon completion of the masquerade operation when doing a blonde transfer. This prevents the connected line update from being considered redundant. 2. A connected line update frame is now queued upon the completion of the masquerade operation so any other channel loosely involved knows that there is a different caller. ASTERISK-25157 #close Reported by: Joshua Colp Change-Id: Ibb8798184a1dab3ecd35299faecc420034adbf20
2015-06-10DNS: Need to use the same serializer for a pjproject SIP transaction.Richard Mudgett
All send/receive processing for a SIP transaction needs to be done under the same threadpool serializer to prevent reentrancy problems inside pjproject when using an external DNS resolver to process messages for the transaction. * Add threadpool API call to get the current serializer associated with the worker thread. * Pick a serializer from a pool of default serializers if the caller of res_pjsip.c:ast_sip_push_task() does not provide one. This is a simple way to ensure that all outgoing SIP request messages are processed under a serializer. Otherwise, any place where a pushed task is done that would result in an outgoing out-of-dialog request would need to be modified to supply a serializer. Serializers from the default serializer pool are picked in a round robin sequence for simplicity. A side effect is that the default serializer pool will limit the growth of the thread pool from random tasks. This is not necessarily a bad thing. * Made pjsip_resolver.c use the requesting thread's serializer to execute the async callback. * Made pjsip_distributor.c save the thread's serializer name on the outgoing request tdata struct so the response can be processed under the same serializer. ASTERISK-25115 #close Reported by: John Bigelow Change-Id: Iea71c16ce1132017b5791635e198b8c27973f40a
2015-06-10DNS: Fix some corner cases.Richard Mudgett
* Fix query_set destruction before we are done kicking the queries off. * Fixed no queries requested handling. * Add empty queries request unit test. * Added missing allocation check in ast_dns_query_set_add(). * Made initial pjsip resolving query vector slightly larger. ASTERISK-25115 Reported by: John Bigelow Change-Id: Ie8be8347d0992e93946d72b6e7b1299727b038f2
2015-06-10DNS: Fix doxygen comments.Richard Mudgett
Change-Id: Icafea3fb4ea64ac027561b23cbfe2b17997dc549
2015-06-10taskprocessor.c: Remove extra unref from off-nominal path.Richard Mudgett
Change-Id: Iee3bd8c8a528776056972066698fe735f0f6cf60
2015-06-10Merge "chan_iax2: Prevent deadlock between hangup and sending lagrq/ping"Mark Michelson
2015-06-09Merge "Fix unsafe uses of ast_context pointers."Matt Jordan
2015-06-08Fix unsafe uses of ast_context pointers.Corey Farrell
Although ast_context_find, ast_context_find_or_create and ast_context_destroy perform locking of the contexts table, any context pointer can become invalid at any time that the contexts table is unlocked. This change adds locking around all complete operations involving these functions. Places where ast_context_find was followed by ast_context_destroy have been replaced with calls ast_context_destroy_by_name. ASTERISK-25094 #close Reported by: Corey Farrell Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa
2015-06-08AMI: Escape string values.Kevin Harwell
So this issue is a bit complicated. Since it is possible to pass values to AMI that contain a '\r\n' (or other similar sequences) these values need to be escaped. One way to solve this is to escape the values and then pass the escaped values to the AMI variable parameter string building function. However, this puts the onus on the pre-build function to escape all string values. This potentially requires a fair amount of changes along with a lot of string allocations/freeing for all values. Surely there is a way to push this complexity down a level into the string building function itself? This of course is possible, but ends up requiring a way to distinguish between strings that need to be escaped and those that don't. The best way to handle this is by introducing a new format specifier in the format string. For instance a %s (no escape) and %S (escape). However, that is a bit weird and unexpected. So faced with those possibilities this patch implements a limited version of the first option. Instead of attempting to escape all string values this patch only escapes those values that make sense. This approach limits the number of changes and doesn't suffer from the odd format specifier problem. ASTERISK-24934 #close Reported by: warren smith Change-Id: Ib55a5b84fe0481b0f2caaaab68c566f392c0aac0
2015-06-05Fixes for OS XDavid M. Lee
* Add some type casting so tv_usec can really be a long, instead of some strange platform specific type. * Add some .dylib style files to .gitignore. * Switch from using -Xlinker to -Wl,. For [reasons unknown][], newer versions of GCC, when compiling the Homebrew formula for Asterisk, are not properly passing the -Xlinker options to the linker. Given that -Wl, does exactly the [same thing][], and does it properly, this patch changes the -Xlinker options to use -Wl, instead. [reasons unknown]: http://bit.ly/1SUbEYx [same thing]: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html Change-Id: Id5e6b3c6cc86282ea5fca630dc3991137c5bf4dd
2015-06-05CLI: Cosmetic issue - core show uptimeibercom
Show uptime information ends with an unnecessary space. Now NEEDCOMMA is better defined. Change-Id: I11b360504a0703309ff51772ff8f672287f3c5a1
2015-06-02tcptls.c: Don't use OpenSSL functions when no SSL support is present.Joerg Sonnenberger
Change-Id: I68a85a7fcbdb282140ff333c6274b6763d5f82a3
2015-05-29Revert "endpoint/stasis: Eliminate duplicate events on endpoint status change"George Joseph
This reverts commit 6fca75bb628dfff2ab112e80b0228cf3ac0b8a05. Change-Id: Ifee026cc63e22c5ac5717c37867a9f036373ae5a
2015-05-27endpoint/stasis: Eliminate duplicate events on endpoint status changeGeorge Joseph
When an endpoint was created, it's messages were being forwarded to both the tech endpoint topic and the all endpoints topic. Since the tech topic was also forwarded to all, this was resulting in duplicate messages whenever an endpoint published. This patch causes the endpoint to only forward to the tech topic and lets the tech topic forward to all. To accomplish this, the existing stasis_cp_single_create function (which both creates and forwards) was cloned and split into 2 functions, one that creates the topic and one that sets up the forwarding. This allows endpoint_internal_create to create the topic from the endpoint_all cache without forwarding it there, then allows it to do the forward to the tech's topic. ASTERISK-25137 #close Reported-by: Vitezslav Novy ASTERISK-25116 #close Reported-by: George Joseph <george.joseph@fairview5.com> Tested-by: George Joseph <george.joseph@fairview5.com> Change-Id: I26d7d4926a0861748fd3bdffe316b75b549a801c
2015-05-26res_pjsip: Add AMI events for chan_pjsip contact lifecycle changesGeorge Joseph
Add a new ContactStatus AMI event. Publish the following status/state changes: Created Removed Reachable Unreachable Unknown Contact URI, new status/state, aor and endpoint names, and the last qualify rtt result are included in the event. ASTERISK-25114 #close Change-Id: Id25aae5f7122facba183273efb3e8f36c20fb61e Reported-by: George Joseph <george.joseph@fairview5.com> Tested-by: George Joseph <george.joseph@fairview5.com>
2015-05-26Merge "Astobj2: Correctly treat hash_fn returning INT_MIN"Joshua Colp
2015-05-26sorcery: Fix cache creation callback.Joshua Colp
The cache creation callback function expects to receive a sorcery_details structure and not just a standalone object. Change-Id: I3e4a5a137cb25292eb52d7a14cbb6daa09213450