]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5778 --resolve use switch_core_event_hook_remove_receive_message() to bind to...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 11 Sep 2013 17:58:00 +0000 (22:58 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 11 Sep 2013 17:58:00 +0000 (22:58 +0500)
src/include/switch_types.h
src/switch_channel.c

index 1b28b5cd84cb786fac56d90b8c98e538d5e32e2e..143328cec4d5e40607c8ad1fa8e6919e15f5cb84 100644 (file)
@@ -955,6 +955,9 @@ typedef enum {
        SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE,
        SWITCH_MESSAGE_INDICATE_STUN_ERROR,
        SWITCH_MESSAGE_INDICATE_MEDIA_RENEG,
+       SWITCH_MESSAGE_ANSWER_EVENT,
+       SWITCH_MESSAGE_PROGRESS_EVENT,
+       SWITCH_MESSAGE_RING_EVENT,
        SWITCH_MESSAGE_INVALID
 } switch_core_session_message_types_t;
 
index 950fb28257b71b7c3405d85d1757b2de8150c046..ae94061c260600810a0c55a995bfd3c7922bff1e 100644 (file)
@@ -3144,6 +3144,16 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
        return channel->state;
 }
 
+static switch_status_t send_ind(switch_channel_t *channel, switch_core_session_message_types_t msg_id, const char *file, const char *func, int line)
+{
+       switch_core_session_message_t msg = { 0 };
+
+       msg.message_id = msg_id;
+       msg.from = channel->name;
+       return switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
+}
+
+
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(switch_channel_t *channel, 
                                                                                                                                                         switch_ring_ready_t rv,
                                                                                                                                                         const char *file, const char *func, int line)
@@ -3183,6 +3193,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi
 
                switch_channel_set_callstate(channel, CCS_RINGING);
 
+               send_ind(channel, SWITCH_MESSAGE_RING_EVENT, file, func, line);
+
                return SWITCH_STATUS_SUCCESS;
        }
 
@@ -3319,6 +3331,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
 
                switch_channel_set_callstate(channel, CCS_EARLY);
 
+               send_ind(channel, SWITCH_MESSAGE_PROGRESS_EVENT, file, func, line);
+
                return SWITCH_STATUS_SUCCESS;
        }
 
@@ -3598,6 +3612,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
 
        switch_channel_set_callstate(channel, CCS_ACTIVE);
 
+       send_ind(channel, SWITCH_MESSAGE_ANSWER_EVENT, file, func, line);
+
+
        return SWITCH_STATUS_SUCCESS;
 }