diff options
author | David M. Lee <dlee@digium.com> | 2013-04-15 16:43:47 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-04-15 16:43:47 +0000 |
commit | c599aca553a57335267406b93c856e53c5e14db4 (patch) | |
tree | c1f8055e6cfc0cf5f1b6aeec5c9ec860ce6236cc /include/asterisk | |
parent | 2450722f52401b8537e9c0ffb1192f38b7dd146d (diff) |
Moved core logic from app_stasis to res_stasis
After some discussion on asterisk-dev, it was decided that the bulk of
the logic in app_stasis actually belongs in a resource module instead
of the application module.
This patch does that, leaves the app specific stuff in app_stasis, and
fixes up everything else to be consistent with that change.
* Renamed test_app_stasis to test_res_stasis
* Renamed app_stasis.h to stasis_app.h
* This is still stasis application support, even though it's no
longer in an app_ module. The name should never have been tied to
the type of module, anyways.
* Now that json isn't a resource module anymore, moved the
ast_channel_snapshot_to_json function to main/stasis_channels.c,
where it makes more sense.
Review: https://reviewboard.asterisk.org/r/2430/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/json.h | 2 | ||||
-rw-r--r-- | include/asterisk/stasis_app.h (renamed from include/asterisk/app_stasis.h) | 50 | ||||
-rw-r--r-- | include/asterisk/stasis_channels.h | 7 |
3 files changed, 37 insertions, 22 deletions
diff --git a/include/asterisk/json.h b/include/asterisk/json.h index 64a1e7b7a..62e21293b 100644 --- a/include/asterisk/json.h +++ b/include/asterisk/json.h @@ -791,7 +791,7 @@ struct ast_json *ast_json_name_number(const char *name, const char *number); * \return JSON string with ISO 8601 formatted date/time. * \return \c NULL on error. */ -struct ast_json *ast_json_timeval(const struct timeval *tv, const char *zone); +struct ast_json *ast_json_timeval(const struct timeval tv, const char *zone); /*! * \brief Construct a context/exten/priority as JSON. diff --git a/include/asterisk/app_stasis.h b/include/asterisk/stasis_app.h index 3001992d2..caec19bbc 100644 --- a/include/asterisk/app_stasis.h +++ b/include/asterisk/stasis_app.h @@ -16,26 +16,26 @@ * at the top of the source tree. */ -#ifndef _ASTERISK_APP_STASIS_H -#define _ASTERISK_APP_STASIS_H +#ifndef _ASTERISK_STASIS_APP_H +#define _ASTERISK_STASIS_APP_H /*! \file * - * \brief Stasis Application API. See \ref app_stasis "Stasis Application API" + * \brief Stasis Application API. See \ref res_stasis "Stasis Application API" * for detailed documentation. * * \author David M. Lee, II <dlee@digium.com> * \since 12 * - * \page app_stasis Stasis Application API + * \page res_stasis Stasis Application API * * This is the API that binds the Stasis dialplan application to external * Stasis applications, such as \c res_stasis_websocket. * - * This module registers a dialplan function named \c Stasis, which is used to - * put a channel into the named Stasis app. As a channel enters and leaves the - * Stasis diaplan applcation, the Stasis app receives a \c 'stasis-start' and \c - * 'stasis-end' events. + * The associated \c res_stasis module registers a dialplan function named \c + * Stasis, which uses \c res_stasis to put a channel into the named Stasis + * app. As a channel enters and leaves the Stasis diaplan application, the + * Stasis app receives a \c 'stasis-start' and \c 'stasis-end' events. * * Stasis apps register themselves using the \ref stasis_app_register and * stasis_app_unregister functions. Messages are sent to an appliction using @@ -54,6 +54,25 @@ struct ast_channel_snapshot; /*! @{ */ /*! + * \brief Control a channel using \c stasis_app. + * + * This function blocks until the channel hangs up, or + * stasis_app_control_continue() is called on the channel's \ref + * stasis_app_control struct. + * + * \param chan Channel to control with Stasis. + * \param app_name Application controlling the channel. + * \param argc Number of arguments for the application. + * \param argv Arguments for the application. + */ +int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, + char *argv[]); + +/*! @} */ + +/*! @{ */ + +/*! * \brief Callback for Stasis application handler. * * The message given to the handler is a borrowed copy. If you want to keep a @@ -110,7 +129,7 @@ struct stasis_app_control; * \brief Returns the handler for the given channel * \param chan Channel to handle. * \return NULL channel not in Stasis application - * \return Pointer to app_stasis handler. + * \return Pointer to stasis handler. */ struct stasis_app_control *stasis_app_control_find_by_channel( const struct ast_channel *chan); @@ -126,15 +145,4 @@ void stasis_app_control_continue(struct stasis_app_control *handler); /*! @} */ -/*! @{ */ - -/*! - * \brief Build a JSON object from a \ref ast_channel_snapshot. - * \return JSON object representing channel snapshot. - * \return \c NULL on error - */ -struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot); - -/*! @} */ - -#endif /* _ASTERISK_APP_STASIS_H */ +#endif /* _ASTERISK_STASIS_APP_H */ diff --git a/include/asterisk/stasis_channels.h b/include/asterisk/stasis_channels.h index c5464ba03..41d2da818 100644 --- a/include/asterisk/stasis_channels.h +++ b/include/asterisk/stasis_channels.h @@ -292,6 +292,13 @@ void ast_channel_publish_dial(struct ast_channel *caller, /*! @} */ /*! + * \brief Build a JSON object from a \ref ast_channel_snapshot. + * \return JSON object representing channel snapshot. + * \return \c NULL on error + */ +struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot); + +/*! * \brief Dispose of the stasis channel topics and message types */ void ast_stasis_channels_shutdown(void); |