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
This commit is contained in:
David M. Lee
2013-04-15 16:43:47 +00:00
parent 2450722f52
commit c599aca553
16 changed files with 750 additions and 658 deletions

View File

@@ -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.

View File

@@ -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
@@ -53,6 +53,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.
*
@@ -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 */

View File

@@ -291,6 +291,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
*/