*/
void ast_channel_internal_swap_topics(struct ast_channel *a, struct ast_channel *b);
+/*!
+ * \brief Swap endpoint_forward between two channels
+ * \param a First channel
+ * \param b Second channel
+ * \return void
+ *
+ * \note
+ * This is used in masquerade to exchange endpoint details if one of the two or both
+ * the channels were created with endpoint
+ */
+void ast_channel_internal_swap_endpoint_forward(struct ast_channel *a, struct ast_channel *b);
+
/*!
* \brief Swap snapshots beteween two channels
* \param a First channel
/* Make sure the Stasis topic on the channel is updated appropriately */
ast_channel_internal_swap_topics(clonechan, original);
+ /* Swap endpoint forward so channel created with endpoint exchanges its state
+ * with other channel for proper endpoint cleanup.
+ */
+ ast_channel_internal_swap_endpoint_forward(clonechan, original);
+
/* The old snapshots need to follow the channels so the snapshot update is correct */
ast_channel_internal_swap_snapshots(clonechan, original);
b->channel_forward = forward;
}
+void ast_channel_internal_swap_endpoint_forward(struct ast_channel *a, struct ast_channel *b)
+{
+ struct stasis_forward *temp;
+
+ temp = a->endpoint_forward;
+ a->endpoint_forward = b->endpoint_forward;
+ b->endpoint_forward = temp;
+}
+
void ast_channel_internal_swap_snapshots(struct ast_channel *a, struct ast_channel *b)
{
struct ast_channel_snapshot *snapshot;