summaryrefslogtreecommitdiff
path: root/main
AgeCommit message (Collapse)Author
2015-07-13Merge "ARI: Added new functionality to get information on a single module." ↵Mark Michelson
into 13
2015-07-13Merge "bridge.c: Fixed race condition during attended transfer" into 13Mark Michelson
2015-07-13ARI: Added new functionality to get information on a single module.Benjamin Ford
An http request can be sent to retrieve information on a single module, 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/{moduleName}'" (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 a single module can now be retrieved ASTERISK-25173 Change-Id: Ibce5a94e70ecdf4e90329cf0ba66c33a62d37463
2015-07-13bridge.c: Fixed race condition during attended transferKevin Harwell
During an attended transfer a thread is started that handles imparting the bridge channel. From the start of the thread to when the bridge channel is ready exists a gap that can potentially cause problems (for instance, the channel being swapped is hung up before the replacement channel enters the bridge thus stopping the transfer). This patch adds a condition that waits for the impart thread to get to a point of acceptable readiness before allowing the initiating thread to continue. ASTERISK-24782 Reported by: John Bigelow Change-Id: I08fe33a2560da924e676df55b181e46fca604577
2015-07-13Merge "main/format_cap: Parse capabilities generated by ↵Matt Jordan
ast_format_cap_get_names" into 13
2015-07-12main/sorcery: Don't fail object set creation from JSON if field failsMatt Jordan
Some individual fields may fail their conversion due to their default values being invalid for their custom handlers. In particular, configuration values that depend on others being enabled (and thus have an empty default value) are notorious for tripping this routine up. An example of this are any of the DTLS options for endpoints. Any of the DTLS options will fail to be applied (as DTLS is not enabled), causing the entire object set to be aborted. This patch makes it so that we log a debug message when skipping a field, and rumble on anyway. ASTERISK-25238 Change-Id: I0bea13de79f66bf9f9ae6ece0e94a2dc1c026a76
2015-07-12main/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/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-10Merge "ARI: Added new functionality to get all module information." into 13Matt Jordan
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-09res_sorcery_memory_cache: Backport to 13Joshua Colp
Gerrit is complaining of conflicts when trying to create a patch series of all of the cherry-picked master commits, so I have instead squashed it all into one commit. ASTERISK-25067 #close Reported by: Matt Jordan Change-Id: I6dda90343fae24a75dc5beec84980024e8d61eb9
2015-07-06res_pjsip: 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 and res_pjsip. * 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_distributor.c save the thread's serializer name on the outgoing request tdata struct so the response can be processed under the same serializer. This is a cherry-pick from master. **** ASTERISK-25115 Change-Id: Iea71c16ce1132017b5791635e198b8c27973f40a NOTE: session_inv_on_state_changed() is disassociating the dialog from the session when the invite dialog becomes PJSIP_INV_STATE_DISCONNECTED. Unfortunately this is a tad too soon because our BYE request transaction has not completed yet. ASTERISK-25183 #close Reported by: Matt Jordan Change-Id: I8bad0ae1daf18d75b8c9e55874244b7962df2d0a
2015-07-02Merge "sorcery/realtime: Add a bit of debug and warning messages for bad ↵Matt Jordan
configs" into 13
2015-07-02Merge "rtp_engine: Skip useless self-assignment in ↵Joshua Colp
ast_rtp_engine_unload_format." into 13
2015-07-02Merge "astfd: Fix buffer overflow in DEBUG_FD_LEAKS." into 13Joshua Colp
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-07-01sorcery/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-06-30Merge "channel: Remove ignore of answer on non-outgoing channels." into 13Matt 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." into 13Matt Jordan
2015-06-26Merge "sorcery: Add ast_sorcery_object_unregister() API call." into 13Matt Jordan
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-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-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-25AMI: Add Linkedid to the standard channel snapshot AMI event headers.Richard Mudgett
* The AMI version is bumped to 2.8.0. ASTERISK-25189 #close Reported by: John Hardin Change-Id: I2b1778c3fdc1dca0ed55db4e3a639eddfb16c2ac
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-22bridge.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-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-10taskprocessor.c: Remove extra unref from off-nominal path.Richard Mudgett
Change-Id: Iee3bd8c8a528776056972066698fe735f0f6cf60
2015-06-10chan_iax2: Prevent deadlock between hangup and sending lagrq/pingYousf Ateya
channels/chan_iax.c: Prevent the deadlock between iax2_hangup and send_lagrq/ send_ping. This deadlock happens because the scheduled task send_lagrq(or send_ping) starts execution after the call hangup procedure starts but before it deletes the tasks in the scheduler. The solution is to delete scheduled lagrq (and ping) task asynchronously (i.e. schedule AST_SCHED_DEL for these tasks); By this, AST_SCHED_DEL will be called in a new context (doesn't have callno locked). This commit also cleans up the procedure of sending LAGRQ and PING. main/sched.c: Do not assert when deleting non existant entry from scheduler. This assert seems to be the reason for a lot of awkward code to avoid it. ASTERISK-24983 #close Reported by: Y Ateya Change-Id: I03bec1fc8faacb89630269e935fa667c6d6c080c
2015-06-09Merge "Fix unsafe uses of ast_context pointers." into 13Matt Jordan
2015-06-08Merge "AMI: Escape string values." into 13Matt 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-05Merge "Fixes for OS X" into 13Joshua Colp
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-03AMI: 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-02Fixes 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-05-29Revert "endpoint/stasis: Eliminate duplicate events on endpoint status change"George Joseph
This reverts commit 35c699086ae2fd81b2473307ccb2ae79ad32375a. Change-Id: Ia98c2b4820cf579a5b9bb75e9e05d7a233205fb7
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" into 13Joshua 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
2015-05-25Astobj2: Correctly treat hash_fn returning INT_MINIvan Poddubny
The code in astobj2_hash.c wrongly assumed that abs(int) is always > 0. However, abs(INT_MIN) = INT_MIN and is still negative, as well as abs(INT_MIN) % num_buckets, and as a result this led to a crash. One way to trigger the bug is using host=::80 or 0.0.0.128 in peer configuration section in chan_sip or chan_iax. This patch takes the remainder before applying abs, so that bucket number is always in range. ASTERISK-25100 #close Reported by: Mark Petersen Change-Id: Id6981400ad526f47e10bcf7b847b62bd2785e899
2015-05-22Stasis: Fix unsafe use of stasis_unsubscribe in modules.Corey Farrell
Many uses of stasis_unsubscribe in modules can be reached through unload. These have been switched to stasis_unsubscribe_and_join. Some subscription callbacks do nothing, for these I've created a noop callback function in stasis.c. This is used by some modules that monitor MWI topics in order to enable cache, since the callback does not become invalid after dlclose it is safe to use stasis_unsubscribe on these, even during module unload. ASTERISK-25121 #close Change-Id: Ifc2549fbd8eef7d703c222978e8f452e2972189c
2015-05-21Merge "audiohook.c: Difference in read/write rates caused continuous buffer ↵Matt Jordan
resets" into 13
2015-05-21Merge "Logger: Reset defaults before processing config." into 13Matt Jordan