mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
app_confbridge: Attended transfer event fixup
When a channel already in a conference bridge is attended transfered to another extension, or when an existing call is attended transferred into a conference bridge, we now generate ConfbridgeJoin and ConfbridgeLeave events for the entering and departing channels. Change-Id: Id7709cfbceb26fbcb828b2d0d2a6b2fbeaf028e1
This commit is contained in:
@@ -621,6 +621,26 @@ static void confbridge_join_cb(void *data, struct stasis_subscription *sub,
|
||||
ast_free(extra_text);
|
||||
}
|
||||
|
||||
static void confbridge_atxfer_cb(void *data, struct stasis_subscription *sub,
|
||||
struct stasis_message *message)
|
||||
{
|
||||
struct ast_attended_transfer_message *msg = stasis_message_data(message);
|
||||
|
||||
if (msg->result != AST_BRIDGE_TRANSFER_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* This callback will get called for ALL attended transfers
|
||||
* so we need to make sure this transfer belongs to
|
||||
* a conference bridge before trying to handle it.
|
||||
*/
|
||||
if (msg->dest_type == AST_ATTENDED_TRANSFER_DEST_APP
|
||||
&& strcmp(msg->dest.app, "ConfBridge") == 0) {
|
||||
confbridge_handle_atxfer(msg);
|
||||
}
|
||||
}
|
||||
|
||||
static void confbridge_start_record_cb(void *data, struct stasis_subscription *sub,
|
||||
struct stasis_message *message)
|
||||
{
|
||||
@@ -739,6 +759,13 @@ int manager_confbridge_init(void)
|
||||
manager_confbridge_shutdown();
|
||||
return -1;
|
||||
}
|
||||
if (stasis_message_router_add(bridge_state_router,
|
||||
ast_attended_transfer_type(),
|
||||
confbridge_atxfer_cb,
|
||||
NULL)) {
|
||||
manager_confbridge_shutdown();
|
||||
return -1;
|
||||
}
|
||||
if (stasis_message_router_add(bridge_state_router,
|
||||
confbridge_leave_type(),
|
||||
confbridge_leave_cb,
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "asterisk/channel.h"
|
||||
#include "asterisk/bridge.h"
|
||||
#include "asterisk/bridge_features.h"
|
||||
#include "asterisk/stasis_bridges.h"
|
||||
#include "conf_state.h"
|
||||
|
||||
/*! Maximum length of a conference bridge name */
|
||||
@@ -714,4 +715,14 @@ struct confbridge_conference *conf_find_bridge(const char *conference_name);
|
||||
void conf_send_event_to_participants(struct confbridge_conference *conference,
|
||||
struct ast_channel *chan, struct stasis_message *msg);
|
||||
|
||||
/*!
|
||||
* \brief Create join/leave events for attended transfers
|
||||
* \since 13.28
|
||||
* \since 16.5
|
||||
*
|
||||
* \param msg The attended transfer stasis message
|
||||
*
|
||||
*/
|
||||
void confbridge_handle_atxfer(struct ast_attended_transfer_message *msg);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user