From aa8a4913b4c7d9436cde45075e0d9df07096ca51 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 23 Nov 2013 20:11:59 -0600 Subject: [PATCH] FS-5994 --- src/switch_ivr_bridge.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 089301da0e..ffc7e0b5e8 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -976,18 +976,12 @@ static switch_status_t sb_on_dtmf(switch_core_session_t *session, const switch_d static switch_status_t hanguphook(switch_core_session_t *session) { - switch_core_session_message_t msg = { 0 }; + switch_core_session_message_t *msg = NULL; switch_channel_t *channel = NULL; switch_event_t *event; channel = switch_core_session_get_channel(session); - - msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; - msg.from = __FILE__; - msg.string_arg = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE); - - if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { @@ -996,8 +990,14 @@ static switch_status_t hanguphook(switch_core_session_t *session) } } + + msg = switch_core_session_alloc(session, sizeof(*msg)); + MESSAGE_STAMP_FFL(msg); + msg->message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; + msg->from = __FILE__; + msg->string_arg = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE); + switch_core_session_queue_message(session, msg); - switch_core_session_receive_message(session, &msg); switch_core_event_hook_remove_state_change(session, hanguphook); return SWITCH_STATUS_SUCCESS;