diff options
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/bridge_features.h | 51 | ||||
-rw-r--r-- | include/asterisk/datastore.h | 16 | ||||
-rw-r--r-- | include/asterisk/stasis_app.h | 22 | ||||
-rw-r--r-- | include/asterisk/stasis_bridges.h | 68 |
4 files changed, 147 insertions, 10 deletions
diff --git a/include/asterisk/bridge_features.h b/include/asterisk/bridge_features.h index dddc9b043..df01a0dca 100644 --- a/include/asterisk/bridge_features.h +++ b/include/asterisk/bridge_features.h @@ -157,6 +157,25 @@ typedef void (*ast_bridge_hook_pvt_destructor)(void *hook_pvt); */ typedef int (*ast_bridge_talking_indicate_callback)(struct ast_bridge_channel *bridge_channel, void *hook_pvt, int talking); +/*! + * \brief Move indicator callback + * + * \details + * This callback can be registered with the bridge channel in order + * to be notified when the bridge channel is being moved from one + * bridge to another. + * + * \param bridge_channel The channel executing the feature + * \param hook_pvt Private data passed in when the hook was created + * \param src The bridge from which the bridge channel is moving + * \param dst The bridge into which the bridge channel is moving + * + * \retval 0 Keep the callback hook. + * \retval -1 Remove the callback hook. + */ +typedef int (*ast_bridge_move_indicate_callback)(struct ast_bridge_channel *bridge_channel, + void *hook_pvt, struct ast_bridge *src, struct ast_bridge *dst); + enum ast_bridge_hook_remove_flags { /*! The hook is removed when the channel is pulled from the bridge. */ AST_BRIDGE_HOOK_REMOVE_ON_PULL = (1 << 0), @@ -173,6 +192,7 @@ enum ast_bridge_hook_type { AST_BRIDGE_HOOK_TYPE_JOIN, AST_BRIDGE_HOOK_TYPE_LEAVE, AST_BRIDGE_HOOK_TYPE_TALK, + AST_BRIDGE_HOOK_TYPE_MOVE, }; /*! \brief Structure that is the essence of a feature hook. */ @@ -621,6 +641,37 @@ int ast_bridge_talk_detector_hook(struct ast_bridge_features *features, enum ast_bridge_hook_remove_flags remove_flags); /*! + * \brief Attach a bridge channel move detection hook to a bridge features structure + * + * \param features Bridge features structure + * \param callback Function to execute upon activation + * \param hook_pvt Unique data + * \param destructor Optional destructor callback for hook_pvt data + * \param remove_flags Dictates what situations the hook should be removed. + * + * \retval 0 on success + * \retval -1 on failure (The caller must cleanup any hook_pvt resources.) + * + * Example usage: + * + * \code + * struct ast_bridge_features features; + * ast_bridge_features_init(&features); + * ast_bridge_move_hook(&features, move_callback, NULL, NULL, 0); + * \endcode + * + * This makes the bridging core call \ref callback when a + * channel is moved from one bridge to another. A + * pointer to useful data may be provided to the hook_pvt + * parameter. + */ +int ast_bridge_move_hook(struct ast_bridge_features *features, + ast_bridge_move_indicate_callback callback, + void *hook_pvt, + ast_bridge_hook_pvt_destructor destructor, + enum ast_bridge_hook_remove_flags remove_flags); + +/*! * \brief Enable a built in feature on a bridge features structure * * \param features Bridge features structure diff --git a/include/asterisk/datastore.h b/include/asterisk/datastore.h index 9060a5f82..8f59fd3cf 100644 --- a/include/asterisk/datastore.h +++ b/include/asterisk/datastore.h @@ -34,7 +34,7 @@ struct ast_datastore_info { void (*destroy)(void *data); /*!< Destroy function */ /*! - * \brief Fix up channel references + * \brief Fix up channel references on the masquerading channel * * \arg data The datastore data * \arg old_chan The old channel owning the datastore @@ -48,6 +48,20 @@ struct ast_datastore_info { * \return nothing. */ void (*chan_fixup)(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan); + + /*! + * \brief Fix up channel references on the channel being masqueraded into + * + * \arg data The datastore data + * \arg old_chan The old channel owning the datastore + * \arg new_chan The new channel owning the datastore + * + * This is the same as the above callback, except it is called for the channel + * being masqueraded into instead of the channel that is masquerading. + * + * \return nothing. + */ + void (*chan_breakdown)(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan); }; /*! \brief Structure for a data store object */ diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h index a7b204034..e06e68ed2 100644 --- a/include/asterisk/stasis_app.h +++ b/include/asterisk/stasis_app.h @@ -799,6 +799,28 @@ void stasis_app_unref(void); */ struct stasis_message_sanitizer *stasis_app_get_sanitizer(void); +/*! + * \brief Stasis message type for a StasisEnd event + */ +struct stasis_message_type *ast_stasis_end_message_type(void); + +/*! + * \brief Indicate that this channel has had a StasisEnd published for it + * + * \param The channel that is exiting Stasis. + */ +void stasis_app_channel_set_stasis_end_published(struct ast_channel *chan); + +/*! + * \brief Has this channel had a StasisEnd published on it? + * + * \param chan The channel upon which the query rests. + * + * \retval 0 No + * \retval 1 Yes + */ +int stasis_app_channel_is_stasis_end_published(struct ast_channel *chan); + /*! @} */ #endif /* _ASTERISK_STASIS_APP_H */ diff --git a/include/asterisk/stasis_bridges.h b/include/asterisk/stasis_bridges.h index 49d4db2f7..a4e46cdb0 100644 --- a/include/asterisk/stasis_bridges.h +++ b/include/asterisk/stasis_bridges.h @@ -285,6 +285,24 @@ struct ast_bridge_channel_pair { struct stasis_message_type *ast_blind_transfer_type(void); /*! + * \brief Message published during a blind transfer + */ +struct ast_blind_transfer_message { + /*! Result of the transfer */ + enum ast_transfer_result result; + /*! True if the transfer was initiated by an external source (i.e. not DTMF-initiated) */ + int is_external; + /*! Transferer and its bridge */ + struct ast_bridge_channel_snapshot_pair to_transferee; + /*! Destination context */ + char context[AST_MAX_CONTEXT]; + /*! Destination extension */ + char exten[AST_MAX_EXTENSION]; + /*! Transferee channel. NULL if there were multiple transferee channels */ + struct ast_channel_snapshot *transferee; +}; + +/*! * \brief Publish a blind transfer event * * \pre Bridges involved are locked. Channels involved are not locked. @@ -294,9 +312,11 @@ struct stasis_message_type *ast_blind_transfer_type(void); * \param to_transferee The bridge between the transferer and transferee plus the transferer channel * \param context The destination context for the blind transfer * \param exten The destination extension for the blind transfer + * \param transferee_channel If a single channel is being transferred, this is it. If multiple parties are being transferred, this is NULL. */ void ast_bridge_publish_blind_transfer(int is_external, enum ast_transfer_result result, - struct ast_bridge_channel_pair *to_transferee, const char *context, const char *exten); + struct ast_bridge_channel_pair *to_transferee, const char *context, const char *exten, + struct ast_channel *transferee_channel); enum ast_attended_transfer_dest_type { /*! The transfer failed, so there is no appropriate final state */ @@ -305,6 +325,8 @@ enum ast_attended_transfer_dest_type { AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE, /*! The transfer results in a channel or bridge running an application */ AST_ATTENDED_TRANSFER_DEST_APP, + /*! The transfer results in a channel or bridge running an application via a local channel */ + AST_ATTENDED_TRANSFER_DEST_LOCAL_APP, /*! The transfer results in both bridges remaining with a local channel linking them */ AST_ATTENDED_TRANSFER_DEST_LINK, /*! The transfer results in a threeway call between transferer, transferee, and transfer target */ @@ -323,6 +345,12 @@ struct ast_attended_transfer_message { struct ast_bridge_channel_snapshot_pair to_transferee; /*! Bridge between transferer <-> transfer target and the transferer channel in that bridge. May be NULL */ struct ast_bridge_channel_snapshot_pair to_transfer_target; + /*! Local channel connecting transferee bridge to application */ + struct ast_channel_snapshot *replace_channel; + /*! Transferee channel. Will be NULL if there were multiple channels transferred. */ + struct ast_channel_snapshot *transferee; + /*! Transfer target channel. Will be NULL if there were multiple channels targeted. */ + struct ast_channel_snapshot *target; /*! Indicates the final state of the transfer */ enum ast_attended_transfer_dest_type dest_type; union { @@ -358,9 +386,12 @@ struct stasis_message_type *ast_attended_transfer_type(void); * \param result The result of the transfer. Will always be a type of failure. * \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge * \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge + * \param transferee_channel If a single channel is being transferred, this is it. If multiple parties are being transferred, this is NULL. + * \param target_channel If a single channel is being transferred to, this is it. If multiple parties are being transferred to, this is NULL. */ void ast_bridge_publish_attended_transfer_fail(int is_external, enum ast_transfer_result result, - struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target); + struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target, + struct ast_channel *transferee_channel, struct ast_channel *target_channel); /*! * \since 12 @@ -382,10 +413,13 @@ void ast_bridge_publish_attended_transfer_fail(int is_external, enum ast_transfe * \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge * \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge * \param final_bridge The bridge that the parties end up in. Will be a bridge from the transferee or target pair. + * \param transferee_channel If a single channel is being transferred, this is it. If multiple parties are being transferred, this is NULL. + * \param target_channel If a single channel is being transferred to, this is it. If multiple parties are being transferred to, this is NULL. */ void ast_bridge_publish_attended_transfer_bridge_merge(int is_external, enum ast_transfer_result result, struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target, - struct ast_bridge *final_bridge); + struct ast_bridge *final_bridge, struct ast_channel *transferee_channel, + struct ast_channel *target_channel); /*! * \since 12 @@ -403,10 +437,13 @@ void ast_bridge_publish_attended_transfer_bridge_merge(int is_external, enum ast * \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge * \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge * \param final_pair The bridge that the parties end up in, and the transferer channel that is in this bridge. + * \param transferee_channel If a single channel is being transferred, this is it. If multiple parties are being transferred, this is NULL. + * \param target_channel If a single channel is being transferred to, this is it. If multiple parties are being transferred to, this is NULL. */ void ast_bridge_publish_attended_transfer_threeway(int is_external, enum ast_transfer_result result, struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target, - struct ast_bridge_channel_pair *final_pair); + struct ast_bridge_channel_pair *final_pair, struct ast_channel *transferee_channel, + struct ast_channel *target_channel); /*! * \since 12 @@ -423,13 +460,23 @@ void ast_bridge_publish_attended_transfer_threeway(int is_external, enum ast_tra * * \param is_external Indicates if the transfer was initiated externally * \param result The result of the transfer. - * \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge - * \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge - * \param dest_app The application that the channel or bridge is running upon transfer completion. + * \param transferee The bridge between the transferer and transferees as well as the + * transferer channel from that bridge + * \param target The bridge between the transferer and transfer targets as well as the + * transferer channel from that bridge + * \param replace_channel The channel that will be replacing the transferee bridge + * transferer channel when a local channel is involved + * \param dest_app The application that the channel or bridge is running upon transfer + * completion. + * \param transferee_channel If a single channel is being transferred, this is it. + * If multiple parties are being transferred, this is NULL. + * \param target_channel If a single channel is being transferred to, this is it. + * If multiple parties are being transferred to, this is NULL. */ void ast_bridge_publish_attended_transfer_app(int is_external, enum ast_transfer_result result, struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target, - const char *dest_app); + struct ast_channel *replace_channel, const char *dest_app, + struct ast_channel *transferee_channel, struct ast_channel *target_channel); /*! * \since 12 @@ -451,10 +498,13 @@ void ast_bridge_publish_attended_transfer_app(int is_external, enum ast_transfer * \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge * \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge * \param locals The local channels linking the bridges together. + * \param transferee_channel If a single channel is being transferred, this is it. If multiple parties are being transferred, this is NULL. + * \param target_channel If a single channel is being transferred to, this is it. If multiple parties are being transferred to, this is NULL. */ void ast_bridge_publish_attended_transfer_link(int is_external, enum ast_transfer_result result, struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target, - struct ast_channel *locals[2]); + struct ast_channel *locals[2], struct ast_channel *transferee_channel, + struct ast_channel *target_channel); /*! * \brief Returns the most recent snapshot for the bridge. |