summaryrefslogtreecommitdiff
path: root/include/asterisk/sorcery.h
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-03-17 17:22:12 +0000
committerMark Michelson <mmichelson@digium.com>2014-03-17 17:22:12 +0000
commitd44aefeef476d744f2915d47c3fdc9b138cdd584 (patch)
tree59aa013e9a8c0fb7ab1607e2e98076dd88a60f1b /include/asterisk/sorcery.h
parent1900bae7b6cec9479ba0e89aed31d02aa71f3133 (diff)
Fix stuck channel in ARI through the introduction of synchronous bridge actions.
Playing back a file to a channel in an ARI bridge would attempt to wait until the playback concluded before returning. The method used involved signaling the waiting thread in the ARI custom playback function. The problem with this is that there were some corner cases that were not accounted for: * If a bridge channel could not be found, then we never would attempt the playback but would still attempt to wait for the playback to complete. * If the bridge playfile action failed to queue, we would still attempt to wait for the playback to complete. * If the bridge playfile action were queued but some circumstance caused the playback not to occur (the bridge dies, the channel is removed from the bridge), then we would never be notified. The solution to this is to move the waiting logic into the bridge code. A new bridge API function is added to queue a synchronous action on a bridge. The waiting thread is notified when the queued frame has been freed, either due to an error occurring or due to successful playback. As a failsafe, the waiting thread has a 10 minute timeout just in case there is a frame leak somewhere. Review: https://reviewboard.asterisk.org/r/3338 ........ Merged revisions 410673 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/sorcery.h')
-rw-r--r--include/asterisk/sorcery.h39
1 files changed, 32 insertions, 7 deletions
diff --git a/include/asterisk/sorcery.h b/include/asterisk/sorcery.h
index 026fb4074..22616d5b4 100644
--- a/include/asterisk/sorcery.h
+++ b/include/asterisk/sorcery.h
@@ -39,7 +39,11 @@
* object types to their respective wizards (object storage modules). If the developer would like
* to allow the user to configure this using the sorcery.conf configuration file the
* \ref ast_sorcery_apply_config API call can be used to read in the configuration file and apply the
- * mappings. If the storage of the object types are such that a default wizard can be used this can
+ * mappings. \ref ast_sorcery_open will automatically call \ref ast_sorcery_apply_config to allow
+ * for configuration of objects using the same category name as the module that is opening the
+ * sorcery instance. Direct calls to \ref ast_sorcery_apply_config should only be performed if a
+ * module wishes to allow for additional configuration sections in sorcery.conf to be used.
+ * If the storage of the object types are such that a default wizard can be used this can
* be applied using the \ref ast_sorcery_apply_default API call. Note that the default mappings will not
* override configured mappings. They are only used in the case where no configured mapping exists.
*
@@ -322,6 +326,9 @@ int ast_sorcery_wizard_unregister(const struct ast_sorcery_wizard *interface);
*
* \param module The module name (AST_MODULE)
*
+ * When called, this will automatically also call __ast_sorcery_apply_config()
+ * with the module name as the configuration section.
+ *
* \retval non-NULL success
* \retval NULL if allocation failed
*/
@@ -343,6 +350,17 @@ struct ast_sorcery *__ast_sorcery_open(const char *module);
*/
struct ast_sorcery *ast_sorcery_retrieve_by_module_name(const char *module);
+enum ast_sorcery_apply_result {
+ /*! Sorcery wizard failed to apply. */
+ AST_SORCERY_APPLY_FAIL = -1,
+ /*! Sorcery wizard applied successfully. */
+ AST_SORCERY_APPLY_SUCCESS = 0,
+ /*! Sorcery wizard has already been applied to the object type. */
+ AST_SORCERY_APPLY_DUPLICATE = 1,
+ /*! Default sorcery wizard is unnecessary since a wizard has already been applied to the object type. */
+ AST_SORCERY_APPLY_DEFAULT_UNNECESSARY = 2,
+};
+
/*!
* \brief Apply configured wizard mappings
*
@@ -350,10 +368,17 @@ struct ast_sorcery *ast_sorcery_retrieve_by_module_name(const char *module);
* \param name Name of the category to use within the configuration file, normally the module name
* \param module The module name (AST_MODULE)
*
- * \retval 0 success
- * \retval -1 failure
+ * This function is called automatically by __ast_sorcery_open() using the module name as the
+ * configuration category. The only reason you should call this function is if your module
+ * wishes to apply configuration from additional sections of sorcery.conf.
+ *
+ * If a configuration section attempts to apply the same sorcery wizard to an object type
+ * more than once, the wizard will only be applied one time.
+ *
+ * \return What happened when attempting to apply the default.
*/
-int __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, const char *module);
+enum ast_sorcery_apply_result __ast_sorcery_apply_config(struct ast_sorcery *sorcery,
+ const char *name, const char *module);
#define ast_sorcery_apply_config(sorcery, name) \
__ast_sorcery_apply_config((sorcery), (name), AST_MODULE)
@@ -367,14 +392,14 @@ int __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, co
* \param name Name of the wizard to use
* \param data Data to be passed to wizard
*
- * \retval 0 success
- * \retval -1 failure
+ * \return What occurred when applying the default
*
* \note This should be called *after* applying configuration sourced mappings
*
* \note Only a single default can exist per object type
*/
-int __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data);
+enum ast_sorcery_apply_result __ast_sorcery_apply_default(struct ast_sorcery *sorcery,
+ const char *type, const char *module, const char *name, const char *data);
#define ast_sorcery_apply_default(sorcery, type, name, data) \
__ast_sorcery_apply_default((sorcery), (type), AST_MODULE, (name), (data))