diff options
Diffstat (limited to 'include/asterisk/channel.h')
-rw-r--r-- | include/asterisk/channel.h | 117 |
1 files changed, 116 insertions, 1 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index f7e4d2d39..eee0828be 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -125,7 +125,6 @@ References: #include "asterisk/abstract_jb.h" #include "asterisk/astobj2.h" - #include "asterisk/poll-compat.h" #if defined(__cplusplus) || defined(c_plusplus) @@ -151,6 +150,7 @@ extern "C" { #include "asterisk/channelstate.h" #include "asterisk/ccss.h" #include "asterisk/framehook.h" +#include "asterisk/stasis.h" #define DATASTORE_INHERIT_FOREVER INT_MAX @@ -4102,4 +4102,119 @@ int ast_channel_dialed_causes_add(const struct ast_channel *chan, const struct a void ast_channel_dialed_causes_clear(const struct ast_channel *chan); struct ast_flags *ast_channel_flags(struct ast_channel *chan); + +/*! + * \since 12 + * \brief Structure representing a snapshot of channel state. + * + * While not enforced programmatically, this object is shared across multiple + * threads, and should be threated as an immutable object. + */ +struct ast_channel_snapshot { + AST_DECLARE_STRING_FIELDS( + AST_STRING_FIELD(name); /*!< ASCII unique channel name */ + AST_STRING_FIELD(accountcode); /*!< Account code for billing */ + AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */ + AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */ + AST_STRING_FIELD(uniqueid); /*!< Unique Channel Identifier */ + AST_STRING_FIELD(linkedid); /*!< Linked Channel Identifier -- gets propagated by linkage */ + AST_STRING_FIELD(parkinglot); /*!< Default parking lot, if empty, default parking lot */ + AST_STRING_FIELD(hangupsource); /*!< Who is responsible for hanging up this channel */ + AST_STRING_FIELD(appl); /*!< Current application */ + AST_STRING_FIELD(data); /*!< Data passed to current application */ + AST_STRING_FIELD(context); /*!< Dialplan: Current extension context */ + AST_STRING_FIELD(exten); /*!< Dialplan: Current extension number */ + AST_STRING_FIELD(caller_name); /*!< Caller ID Name */ + AST_STRING_FIELD(caller_number); /*!< Caller ID Number */ + AST_STRING_FIELD(connected_name); /*!< Connected Line Name */ + AST_STRING_FIELD(connected_number); /*!< Connected Line Number */ + ); + + struct timeval creationtime; /*!< The time of channel creation */ + enum ast_channel_state state; /*!< State of line */ + int priority; /*!< Dialplan: Current extension priority */ + int amaflags; /*!< AMA flags for billing */ + int hangupcause; /*!< Why is the channel hanged up. See causes.h */ + struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */ +}; + +/*! + * \since 12 + * \brief Generate a snapshot of the channel state. This is an ao2 object, so + * ao2_cleanup() to deallocate. + * + * \param chan The channel from which to generate a snapshot + * + * \retval pointer on success (must be ast_freed) + * \retval NULL on error + */ +struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *chan); + +/*! + * \since 12 + * \brief Message type for \ref ast_channel_snapshot. + * + * \retval Message type for \ref ast_channel_snapshot. + */ +struct stasis_message_type *ast_channel_snapshot(void); + +/*! + * \since 12 + * \brief A topic which publishes the events for a particular channel. + * + * \param chan Channel. + * + * \retval Topic for channel's events. + * \retval \c NULL if \a chan is \c NULL. + */ +struct stasis_topic *ast_channel_topic(struct ast_channel *chan); + +/*! + * \since 12 + * \brief A topic which publishes the events for all channels. + * \retval Topic for all channel events. + */ +struct stasis_topic *ast_channel_topic_all(void); + +/*! + * \since 12 + * \brief A caching topic which caches \ref ast_channel_snapshot messages from + * ast_channel_events_all(void). + * + * \retval Topic for all channel events. + */ +struct stasis_caching_topic *ast_channel_topic_all_cached(void); + +/*! + * \since 12 + * \brief Variable set event. + */ +struct ast_channel_varset { + /*! Channel variable was set on (or NULL for global variable) */ + struct ast_channel_snapshot *snapshot; + /*! Variable name */ + char *variable; + /*! New value */ + char *value; +}; + +/*! + * \since 12 + * \brief Message type for \ref ast_channel_varset messages. + * + * \retval Message type for \ref ast_channel_varset messages. + */ +struct stasis_message_type *ast_channel_varset(void); + +/*! + * \since 12 + * \brief Publish a \ref ast_channel_varset for a channel. + * + * \param chan Channel to pulish the event for, or \c NULL for 'none'. + * \param variable Name of the variable being set + * \param value Value. + */ +void ast_channel_publish_varset(struct ast_channel *chan, + const char *variable, const char *value); + #endif /* _ASTERISK_CHANNEL_H */ |