]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
<refactor>
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 16 Apr 2007 16:53:30 +0000 (16:53 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 16 Apr 2007 16:53:30 +0000 (16:53 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4944 d0543943-73ff-0310-b7d9-9358b9ac24b2

13 files changed:
src/include/switch_core.h
src/include/switch_core_event_hook.h
src/include/switch_module_interfaces.h
src/include/switch_types.h
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_iax/mod_iax.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
src/mod/endpoints/mod_woomera/mod_woomera.c
src/switch_channel.c
src/switch_core_event_hook.c
src/switch_core_session.c

index f00466319ef7a80d5617791f0b5efff30207a7f0..7b9fd7cdfa7eec885022a26ec67fdfc4dda420bd 100644 (file)
@@ -526,6 +526,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(char *uuid_str,
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message);
 
+/*! 
+  \brief pass an indication message on a session
+  \param session the session to pass the message across
+  \param indication the indication message to pass
+  \return SWITCH_STATUS_SUCCESS if the message was passed
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_session_t *session, switch_core_session_message_types_t indication);
+
 /*! 
   \brief Queue an indication message on a session
   \param session the session to queue the message to
@@ -639,13 +647,6 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
                                                                                                                                                 switch_caller_profile_t *caller_profile,
                                                                                                                                                 switch_core_session_t **new_session, switch_memory_pool_t **pool);
 
-/*! 
-  \brief Answer the channel of a given session
-  \param session the session to answer the channel of
-  \return SWITCH_STATUS_SUCCESS if the channel was answered
-*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_answer_channel(switch_core_session_t *session);
-
 /*! 
   \brief Receive a message on a given session
   \param session the session to receive the message from
index 3084343a439fc6388c21ee2e4de2bdffbd8a22cb..ac2e5ac67889f7d5367ce8a9699d2e9bc3181b22 100644 (file)
@@ -35,7 +35,6 @@
 SWITCH_BEGIN_EXTERN_C typedef struct switch_io_event_hooks switch_io_event_hooks_t;
 
 typedef struct switch_io_event_hook_outgoing_channel switch_io_event_hook_outgoing_channel_t;
-typedef struct switch_io_event_hook_answer_channel switch_io_event_hook_answer_channel_t;
 typedef struct switch_io_event_hook_receive_message switch_io_event_hook_receive_message_t;
 typedef struct switch_io_event_hook_receive_event switch_io_event_hook_receive_event_t;
 typedef struct switch_io_event_hook_read_frame switch_io_event_hook_read_frame_t;
@@ -48,7 +47,6 @@ typedef struct switch_io_event_hook_state_change switch_io_event_hook_state_chan
 
 
 typedef switch_status_t (*switch_outgoing_channel_hook_t) (switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t *);
-typedef switch_status_t (*switch_answer_channel_hook_t) (switch_core_session_t *);
 typedef switch_status_t (*switch_receive_message_hook_t) (switch_core_session_t *, switch_core_session_message_t *);
 typedef switch_status_t (*switch_receive_event_hook_t) (switch_core_session_t *, switch_event_t *);
 typedef switch_status_t (*switch_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
@@ -67,23 +65,16 @@ struct switch_io_event_hook_outgoing_channel {
        struct switch_io_event_hook_outgoing_channel *next;
 };
 
-/*! \brief Node in which to store custom answer channel callback hooks */
-struct switch_io_event_hook_answer_channel {
-       /*! the answer channel callback hook */
-       switch_answer_channel_hook_t answer_channel;
-       struct switch_io_event_hook_answer_channel *next;
-};
-
 /*! \brief Node in which to store custom receive message callback hooks */
 struct switch_io_event_hook_receive_message {
-       /*! the answer channel callback hook */
+       /*! the message callback hook */
        switch_receive_message_hook_t receive_message;
        struct switch_io_event_hook_receive_message *next;
 };
 
 /*! \brief Node in which to store custom receive message callback hooks */
 struct switch_io_event_hook_receive_event {
-       /*! the answer channel callback hook */
+       /*! the event callback hook */
        switch_receive_event_hook_t receive_event;
        struct switch_io_event_hook_receive_event *next;
 };
@@ -141,8 +132,6 @@ struct switch_io_event_hook_state_change {
 struct switch_io_event_hooks {
        /*! a list of outgoing channel hooks */
        switch_io_event_hook_outgoing_channel_t *outgoing_channel;
-       /*! a list of answer channel hooks */
-       switch_io_event_hook_answer_channel_t *answer_channel;
        /*! a list of receive message hooks */
        switch_io_event_hook_receive_message_t *receive_message;
        /*! a list of queue message hooks */
@@ -180,14 +169,6 @@ extern switch_io_event_hooks_t switch_core_session_get_event_hooks(switch_core_s
 SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_outgoing_channel(switch_core_session_t *session,
                                                                                                                                                        switch_outgoing_channel_hook_t outgoing_channel);
 
-/*! 
-  \brief Add an event hook to be executed when a session answers a channel
-  \param session session to bind hook to
-  \param answer_channel hook to bind
-  \return SWITCH_STATUS_SUCCESS on suceess
-*/
-SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_answer_channel(switch_core_session_t *session, switch_answer_channel_hook_t answer_channel);
-
 /*! 
   \brief Add an event hook to be executed when a session sends a message
   \param session session to bind hook to
@@ -250,7 +231,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_send_dtmf(switch_core
   \param state_change hook to bind
   \return SWITCH_STATUS_SUCCESS on suceess
 */
-SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_state_change(switch_core_session_t *session, switch_answer_channel_hook_t state_change);
+SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_state_change(switch_core_session_t *session, switch_state_change_hook_t state_change);
 ///\}
 
 SWITCH_END_EXTERN_C
index 0eb086c1b7a3ce82b578940c0d4adedd92b690fb..e018de34adff61bd3861eeb70c32a51f13cef1d5 100644 (file)
@@ -81,8 +81,6 @@ struct switch_io_event_hooks;
 struct switch_io_routines {
        /*! creates an outgoing session from given session, caller profile */
        switch_call_cause_t (*outgoing_channel) (switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **);
-       /*! answers the given session's channel */
-       switch_status_t (*answer_channel) (switch_core_session_t *);
        /*! read a frame from a session */
        switch_status_t (*read_frame) (switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
        /*! write a frame to a session */
index d3625db2857868bddcf9aac69d9134b9190ef106..0ec0c0827f2c84c5208b32f5845441effd9fbbe8 100644 (file)
@@ -349,6 +349,7 @@ typedef enum {
 <pre>
        SWITCH_MESSAGE_REDIRECT_AUDIO     - Indication to redirect audio to another location if possible
        SWITCH_MESSAGE_TRANSMIT_TEXT      - A text message
+       SWITCH_MESSAGE_INDICATE_ANSWER    - indicate answer
        SWITCH_MESSAGE_INDICATE_PROGRESS  - indicate progress 
        SWITCH_MESSAGE_INDICATE_BRIDGE    - indicate a bridge starting
        SWITCH_MESSAGE_INDICATE_UNBRIDGE  - indicate a bridge ending
@@ -363,6 +364,7 @@ typedef enum {
 typedef enum {
        SWITCH_MESSAGE_REDIRECT_AUDIO,
        SWITCH_MESSAGE_TRANSMIT_TEXT,
+       SWITCH_MESSAGE_INDICATE_ANSWER,
        SWITCH_MESSAGE_INDICATE_PROGRESS,
        SWITCH_MESSAGE_INDICATE_BRIDGE,
        SWITCH_MESSAGE_INDICATE_UNBRIDGE,
index 83b5e5d7612b6d5fdd74076ad89a91fda461fb12..d90ea699e01a5343bf1f8d7feb3b578f51711622 100644 (file)
@@ -1513,6 +1513,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
        assert(tech_pvt != NULL);
 
        switch (msg->message_id) {
+       case SWITCH_MESSAGE_INDICATE_ANSWER:
+               channel_answer_channel(session);
+               break;
        case SWITCH_MESSAGE_INDICATE_BRIDGE:
                if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
                        switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
@@ -1571,7 +1574,6 @@ static const switch_state_handler_table_t channel_event_handlers = {
 
 static const switch_io_routines_t channel_io_routines = {
        /*.outgoing_channel */ channel_outgoing_channel,
-       /*.answer_channel */ channel_answer_channel,
        /*.read_frame */ channel_read_frame,
        /*.write_frame */ channel_write_frame,
        /*.kill_channel */ channel_kill_channel,
index c77823c9fca6d8e471bea0bdafb0069ab0052ec9..4c1fa52a5641460b90b34e90df1eabe44cc63d32 100644 (file)
@@ -747,6 +747,29 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session)
        return SWITCH_STATUS_SUCCESS;
 }
 
+
+static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
+{
+       switch_channel_t *channel;
+       private_t *tech_pvt;
+
+       channel = switch_core_session_get_channel(session);
+       assert(channel != NULL);
+                       
+       tech_pvt = (private_t *) switch_core_session_get_private(session);
+       assert(tech_pvt != NULL);
+
+       switch (msg->message_id) {
+       case SWITCH_MESSAGE_INDICATE_ANSWER:
+               channel_answer_channel(session);
+               break;
+       default:
+               break;
+       }
+
+       return SWITCH_STATUS_SUCCESS;
+}
+
 static const switch_state_handler_table_t channel_event_handlers = {
        /*.on_init */ channel_on_init,
        /*.on_ring */ channel_on_ring,
@@ -758,13 +781,13 @@ static const switch_state_handler_table_t channel_event_handlers = {
 
 static const switch_io_routines_t channel_io_routines = {
        /*.outgoing_channel */ channel_outgoing_channel,
-       /*.answer_channel */ channel_answer_channel,
        /*.read_frame */ channel_read_frame,
        /*.write_frame */ channel_write_frame,
        /*.kill_channel */ channel_kill_channel,
        /*.waitfor_read */ channel_waitfor_read,
        /*.waitfor_write */ channel_waitfor_write,
-       /*.send_dtmf */ channel_send_dtmf
+       /*.send_dtmf */ channel_send_dtmf,
+       /*.receive_message*/ channel_receive_message
 };
 
 static const switch_endpoint_interface_t channel_endpoint_interface = {
index 075fd01de9e5e3f90e6dff755ca034a817f10a0f..feebbef6741b35282e5e88e0ce277a436dcf88b0 100644 (file)
@@ -718,6 +718,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
 
 
        switch (msg->message_id) {
+       case SWITCH_MESSAGE_INDICATE_ANSWER:
+               channel_answer_channel(session);
+               break;
        case SWITCH_MESSAGE_INDICATE_PROGRESS:
                {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engage Early Media\n");
@@ -788,7 +791,6 @@ static const switch_state_handler_table_t channel_event_handlers = {
 
 static const switch_io_routines_t channel_io_routines = {
        /*.outgoing_channel */ channel_outgoing_channel,
-       /*.answer_channel */ channel_answer_channel,
        /*.read_frame */ channel_read_frame,
        /*.write_frame */ channel_write_frame,
        /*.kill_channel */ channel_kill_channel,
index f96600fc08ba4da3164ffe4240361b52c5c7182e..ea2fb88c3ad54624812e7dc81f116cdceab4a2a9 100644 (file)
@@ -675,9 +675,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                break;
        case SWITCH_MESSAGE_INDICATE_RINGING:
                nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
+               switch_channel_mark_ring_ready(channel);
+               break;
+       case SWITCH_MESSAGE_INDICATE_ANSWER:
+               sofia_answer_channel(session);
                break;
        case SWITCH_MESSAGE_INDICATE_PROGRESS:{
                        if (!switch_test_flag(tech_pvt, TFLAG_ANS)) {
+                               
                                switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
 
@@ -708,7 +713,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Ring SDP:\n%s\n", tech_pvt->local_sdp_str);
                                        }
                                }
-
+                               switch_channel_mark_pre_answered(channel);
                                nua_respond(tech_pvt->nh,
                                                        SIP_183_SESSION_PROGRESS,
                                                        SIPTAG_CONTACT_STR(tech_pvt->profile->url),
@@ -754,7 +759,6 @@ static switch_status_t sofia_receive_event(switch_core_session_t *session, switc
 
 static const switch_io_routines_t sofia_io_routines = {
        /*.outgoing_channel */ sofia_outgoing_channel,
-       /*.answer_channel */ sofia_answer_channel,
        /*.read_frame */ sofia_read_frame,
        /*.write_frame */ sofia_write_frame,
        /*.kill_channel */ sofia_kill_channel,
index ec3c202549eaa8fd05fe4cf6205d6c300ce3173a..d6a03afd59b03a7ad38b1ec02e907934c2b24985 100644 (file)
@@ -930,6 +930,9 @@ static switch_status_t wanpipe_receive_message(switch_core_session_t *session, s
                break;
        case SWITCH_MESSAGE_INDICATE_REDIRECT:
                break;
+       case SWITCH_MESSAGE_INDICATE_ANSWER:
+               wanpipe_answer_channel(session);
+               break;
        case SWITCH_MESSAGE_INDICATE_PROGRESS:
                break;
        case SWITCH_MESSAGE_INDICATE_RINGING:
@@ -969,7 +972,6 @@ static switch_status_t wanpipe_kill_channel(switch_core_session_t *session, int
 
 static const switch_io_routines_t wanpipe_io_routines = {
        /*.outgoing_channel */ wanpipe_outgoing_channel,
-       /*.answer_channel */ wanpipe_answer_channel,
        /*.read_frame */ wanpipe_read_frame,
        /*.write_frame */ wanpipe_write_frame,
        /*.kill_channel */ wanpipe_kill_channel,
@@ -1422,16 +1424,8 @@ static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
                channel = switch_core_session_get_channel(session);
                assert(channel != NULL);
                
-               if ((msg = malloc(sizeof(*msg)))) {
-                       memset(msg, 0, sizeof(*msg));
-                       msg->message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
-                       msg->from = __FILE__;
-                       switch_core_session_queue_message(session, msg);
-                       switch_set_flag(msg, SCSMF_DYNAMIC);
-                       switch_channel_mark_pre_answered(channel);
-               } else {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-               }
+               switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_PROGRESS);
+               switch_channel_mark_pre_answered(channel);
                
                switch_core_session_rwunlock(session);
        } else {
@@ -1457,7 +1451,7 @@ static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
                channel = switch_core_session_get_channel(session);
                assert(channel != NULL);
 
-               switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
+               switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
                switch_channel_mark_ring_ready(channel);
 
                switch_core_session_rwunlock(session);
index 8bec324feede05347ed4bfe9bf00b9c98379c057..78d005b0ef738624d2ad9de70068188eab4ef622 100644 (file)
@@ -447,7 +447,6 @@ static const switch_state_handler_table_t woomera_event_handlers = {
 
 static const switch_io_routines_t woomera_io_routines = {
        /*.outgoing_channel */ woomera_outgoing_channel,
-       /*.answer_channel */ NULL,
        /*.read_frame */ woomera_read_frame,
        /*.write_frame */ woomera_write_frame,
        /*.kill_channel */ woomera_kill_channel,
index 0874b4fdb66882d7774575bd428ad5a84efb5b2b..df82295b94a9783ca494c0a0bdcc3897b80f56c6 100644 (file)
@@ -1080,7 +1080,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel_t *channel, const char *file, const char *func, int line)
 {
        switch_core_session_message_t msg;
-       char *uuid = switch_core_session_get_uuid(channel->session);
        switch_status_t status;
 
        assert(channel != NULL);
@@ -1099,7 +1098,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel
 
        msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
        msg.from = channel->name;
-       status = switch_core_session_message_send(uuid, &msg);
+       status = switch_core_session_receive_message(channel->session, &msg);
 
        if (status == SWITCH_STATUS_SUCCESS) {
                status = switch_channel_perform_mark_pre_answered(channel, file, func, line);
@@ -1111,7 +1110,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line)
 {
        switch_core_session_message_t msg;
-       char *uuid = switch_core_session_get_uuid(channel->session);
        switch_status_t status;
 
        assert(channel != NULL);
@@ -1130,7 +1128,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel
 
        msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING;
        msg.from = channel->name;
-       status = switch_core_session_message_send(uuid, &msg);
+       status = switch_core_session_receive_message(channel->session, &msg);
 
        if (status == SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
@@ -1185,6 +1183,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
 
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line)
 {
+       switch_core_session_message_t msg;
+       switch_status_t status;
+
        assert(channel != NULL);
 
        if (channel->hangup_cause || channel->state >= CS_HANGUP) {
@@ -1195,7 +1196,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *
                return SWITCH_STATUS_SUCCESS;
        }
 
-       if (switch_core_session_answer_channel(channel->session) == SWITCH_STATUS_SUCCESS) {
+
+       msg.message_id = SWITCH_MESSAGE_INDICATE_ANSWER;
+       msg.from = channel->name;
+       status = switch_core_session_receive_message(channel->session, &msg);
+
+       if (status == SWITCH_STATUS_SUCCESS) {
                return switch_channel_perform_mark_answered(channel, file, func, line);
        }
 
index 5491cfb1a9de4cd8c35108fd45f53eae4a2f8c3e..a4f9aa5d84195468d5e9bb731ceff21685ba064d 100644 (file)
@@ -52,29 +52,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_outgoing(switch_core_
        return SWITCH_STATUS_MEMERR;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_answer_channel(switch_core_session_t *session, switch_answer_channel_hook_t answer_channel)
-{
-       switch_io_event_hook_answer_channel_t *hook, *ptr;
-
-       assert(answer_channel != NULL);
-       if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
-               hook->answer_channel = answer_channel;
-               if (!session->event_hooks.answer_channel) {
-                       session->event_hooks.answer_channel = hook;
-               } else {
-                       for (ptr = session->event_hooks.answer_channel; ptr && ptr->next; ptr = ptr->next);
-                       ptr->next = hook;
-
-               }
-
-               return SWITCH_STATUS_SUCCESS;
-       }
-
-       return SWITCH_STATUS_MEMERR;
-
-}
-
-SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_state_change(switch_core_session_t *session, switch_answer_channel_hook_t state_change)
+SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_state_change(switch_core_session_t *session, switch_state_change_hook_t state_change)
 {
        switch_io_event_hook_state_change_t *hook, *ptr;
 
index 9f2e36be97fa7c574dcb4a5adcf8393c1b7dead5..30b7327cc1785879c468bc6b2b2f6be1c0063b1a 100644 (file)
@@ -320,50 +320,52 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
        return cause;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_answer_channel(switch_core_session_t *session)
+SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_session_t *session, switch_core_session_message_t *message)
 {
-       switch_io_event_hook_answer_channel_t *ptr;
+       switch_io_event_hook_receive_message_t *ptr;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
        assert(session != NULL);
 
-       if (session->endpoint_interface->io_routines->answer_channel) {
-               status = session->endpoint_interface->io_routines->answer_channel(session);
+       if (session->endpoint_interface->io_routines->receive_message) {
+               status = session->endpoint_interface->io_routines->receive_message(session, message);
+
        }
 
        if (status == SWITCH_STATUS_SUCCESS) {
-               for (ptr = session->event_hooks.answer_channel; ptr; ptr = ptr->next) {
-                       if ((status = ptr->answer_channel(session)) != SWITCH_STATUS_SUCCESS) {
+               for (ptr = session->event_hooks.receive_message; ptr; ptr = ptr->next) {
+                       if ((status = ptr->receive_message(session, message)) != SWITCH_STATUS_SUCCESS) {
                                break;
                        }
                }
        }
 
-
+       switch_core_session_kill_channel(session, SWITCH_SIG_BREAK);
        return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_session_t *session, switch_core_session_message_t *message)
+SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_session_t *session, switch_core_session_message_types_t indication)
 {
-       switch_io_event_hook_receive_message_t *ptr;
+       switch_core_session_message_t msg = {0};
+       switch_core_session_t *other_session;
+       char *uuid;
+       switch_channel_t *channel;
        switch_status_t status = SWITCH_STATUS_SUCCESS;
 
        assert(session != NULL);
+       
+       channel = switch_core_session_get_channel(session);
+       assert(channel != NULL);
 
-       if (session->endpoint_interface->io_routines->receive_message) {
-               status = session->endpoint_interface->io_routines->receive_message(session, message);
-
-       }
-
-       if (status == SWITCH_STATUS_SUCCESS) {
-               for (ptr = session->event_hooks.receive_message; ptr; ptr = ptr->next) {
-                       if ((status = ptr->receive_message(session, message)) != SWITCH_STATUS_SUCCESS) {
-                               break;
-                       }
-               }
+       if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+               msg.message_id = indication;
+               msg.from = __FILE__;
+               status = switch_core_session_receive_message(other_session, &msg);
+               switch_core_session_rwunlock(other_session);
+       } else {
+               status = SWITCH_STATUS_FALSE;
        }
 
-       switch_core_session_kill_channel(session, SWITCH_SIG_BREAK);
        return status;
 }
 
@@ -375,8 +377,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core
                memset(msg, 0, sizeof(*msg));
                msg->message_id = indication;
                msg->from = __FILE__;
-               switch_core_session_queue_message(session, msg);
                switch_set_flag(msg, SCSMF_DYNAMIC);
+               switch_core_session_queue_message(session, msg);
                return SWITCH_STATUS_SUCCESS;
        }