summaryrefslogtreecommitdiff
path: root/res/res_stasis_device_state.c
AgeCommit message (Collapse)Author
2018-01-15loader: Add dependency fields to module structures.Corey Farrell
* 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
2017-11-03res_stasis_device_state.c: Optimize stasis_app_device_states_to_json()Richard Mudgett
* Eliminate RAII_VAR() * Replace looped alloca with a char[] since that is how it is used anyway. Change-Id: Ia27e64a884afa0f50b9ffdb1cf23da6bfa51ffdf
2017-07-25res_stasis_device_state: Unsubscribe should remove old subscriptionsSergej Kasumovic
Case scenario with Applications ARI: * Once you subscribe to deviceState with Applications REST API, it will be added into subscription pool. * When you unsubscribe it will remove from the device_state_subscription hash table but not from the subscription pool. * When you subscribe again, it will add it to pool again. * Now you will have two subscriptions and you will receive same event twice. This fix should now remove deviceState subscription from pool and it should fix unsubscribe on deviceState. ASTERISK-27130 #close Change-Id: I718b70d770a086e39b4ddba4f69a3c616d4476c4
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-02-07res_stasis_device_state: Protect the adding/removing of subscriptions.Joshua Colp
The adding and removing of device state subscriptions did not protect fully against simultaneous manipulation. In particular the subscribe case allowed a small window where two subscriptions could be added for the same device state instead of just one. This change makes the code hold the subscriptions lock for the entirety of each operation to ensure that two are not occurring at the same time. ASTERISK-26770 Change-Id: I3e7f8eb9d09de440c9024d2dd52029f6f20e725b
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-02-04res_stasis_device_state: Fix refcounting error.Mark Michelson
Device state subscription lifetimes were governed by when the subscription was established and unsubscribed from. However, it is possible that at the time of unsubscription, there could be device state events still in flight. When those device state events occur, the device state callback could attempt to dereference a freed pointer. Crash. This change ensures that the lifetime of the device state subscription does not end until the underlying stasis subscription has confirmed that its final message has been sent. Change-Id: I25a0f1472894c1a562252fb7129671478e25e9b2
2015-09-21res/res_stasis_device_state: Allow for subscribing to 'all' device stateMatt Jordan
This patch adds support for subscribing to all device state changes. This is done either by subscribing to an empty device, e.g., 'eventSource=deviceState:', or by the WebSocket connection specifying that it wants all state in the system. ASTERISK-24870 Change-Id: I9cfeca1c9e2231bd7ea73e45919111d44d2eda32
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-13AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.Rodrigo Ramírez Norambuena
Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2014-12-01main/stasis: Allow subscriptions to use a threadpool for message deliveryMatthew Jordan
Prior to this patch, all Stasis subscriptions would receive a dedicated thread for servicing published messages. In contrast, prior to r400178 (see review https://reviewboard.asterisk.org/r/2881/), the subscriptions shared a thread pool. It was discovered during some initial work on Stasis that, for a low subscription count with high message throughput, the threadpool was not as performant as simply having a dedicated thread per subscriber. For situations where a subscriber receives a substantial number of messages and is always present, the model of having a dedicated thread per subscriber makes sense. While we still have plenty of subscriptions that would follow this model, e.g., AMI, CDRs, CEL, etc., there are plenty that also fall into the following two categories: * Large number of subscriptions, specifically those tied to endpoints/peers. * Low number of messages. Some subscriptions exist specifically to coordinate a single message - the subscription is created, a message is published, the delivery is synchronized, and the subscription is destroyed. In both of the latter two cases, creating a dedicated thread is wasteful (and in the case of a large number of peers/endpoints, harmful). In those cases, having shared delivery threads is far more performant. This patch adds the ability of a subscriber to Stasis to choose whether or not their messages are dispatched on a dedicated thread or on a threadpool. The threadpool is configurable through stasis.conf. Review: https://reviewboard.asterisk.org/r/4193 ASTERISK-24533 #close Reported by: xrobau Tested by: xrobau ........ Merged revisions 428681 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 428687 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-28ARI: Make double subscribe respond with successKinsey Moore
Currently, attempting to subscribe an application to a device state that it has already subscribed to will generate a 500 error response. This will now be treated as a subscription refresh even though ARI subscriptions don't currently support lifetimes and will respond with the normal response for a successful subscription (200 OK). (closes issue ASTERISK-23143) Reported by: Matt Jordan ........ Merged revisions 406775 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406778 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-20res_stasis_device_state: Set resource type for subscriptions to deviceStateMatthew Jordan
The documentation for ARI already specifies that the device state resource when used for subscribing for events is "deviceState", not "device_state". The code, however, used "device_state"; although this was inconsistent as well in doxygen comments in resource_applications. Because the actual resource being subscribed to is /deviceStates/{device}/, it makes sense for the resource type specifier to be deviceState. Note that the key value in the events is still "device_state". ........ Merged revisions 404437 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-23ARI: Implement device state APIKevin Harwell
Created a data model and implemented functionality for an ARI device state resource. The following operations have been added that allow a user to manipulate an ARI controlled device: Create/Change the state of an ARI controlled device PUT /deviceStates/{deviceName}&{deviceState} Retrieve all ARI controlled devices GET /deviceStates Retrieve the current state of a device GET /deviceStates/{deviceName} Destroy a device-state controlled by ARI DELETE /deviceStates/{deviceName} The ARI controlled device must begin with 'Stasis:'. An example controlled device name would be Stasis:Example. A 'DeviceStateChanged' event has also been added so that an application can subscribe and receive device change events. Any device state, ARI controlled or not, can be subscribed to. While adding the event, the underlying subscription control mechanism was refactored so that all current and future resource subscriptions would be the same. Each event resource must now register itself in order to be able to properly handle [un]subscribes. (issue ASTERISK-22838) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3025/ ........ Merged revisions 403134 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403135 65c4cc65-6c06-0410-ace0-fbb531ad65f3