]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add channel events to message when its in-dialog
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 30 Aug 2012 21:38:31 +0000 (16:38 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 30 Aug 2012 21:38:31 +0000 (16:38 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_presence.c

index bee5792cc7baea33935baa21a589604c084b75a9..7d6659cdfc13f89e14793025c7ef907c9ad8d6f1 100644 (file)
@@ -983,7 +983,7 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n
                                                                sofia_dispatch_event_t *de,
                                                                                 tagi_t tags[]);
 void sofia_presence_handle_sip_i_message(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
-                                                                                sofia_private_t *sofia_private, sip_t const *sip,
+                                                                                switch_core_session_t *session, sofia_private_t *sofia_private, sip_t const *sip,
                                                                sofia_dispatch_event_t *de, tagi_t tags[]);
 void sofia_presence_handle_sip_r_subscribe(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
                                                                                   sofia_private_t *sofia_private, sip_t const *sip,
index 0b1e85e8ae4abeb46faf8d5515b2e26ebc4ef90f..41ae399691192a369c0c868eeb7df35db275b678 100644 (file)
@@ -1185,7 +1185,7 @@ static void our_sofia_event_callback(nua_event_t event,
                sofia_handle_sip_i_state(session, status, phrase, nua, profile, nh, sofia_private, sip, de, tags);
                break;
        case nua_i_message:
-               sofia_presence_handle_sip_i_message(status, phrase, nua, profile, nh, sofia_private, sip, de, tags);
+               sofia_presence_handle_sip_i_message(status, phrase, nua, profile, nh, session, sofia_private, sip, de, tags);
                break;
        case nua_i_info:
                sofia_handle_sip_i_info(nua, profile, nh, session, sip, de, tags);
index 9f2d0d184e96cb94fb008d141e7165d62f929b57..fca3a1bad3a7f9e250ccab87b0d882e8ef02f063 100644 (file)
@@ -4268,7 +4268,9 @@ void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip)
 
 void sofia_presence_handle_sip_i_message(int status,
                                                                                 char const *phrase,
-                                                                                nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+                                                                                nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, 
+                                                                                switch_core_session_t *session,
+                                                                                sofia_private_t *sofia_private, sip_t const *sip,
                                                                                 sofia_dispatch_event_t *de,
                                                                                 tagi_t tags[])
 {
@@ -4284,6 +4286,12 @@ void sofia_presence_handle_sip_i_message(int status,
                const char *us;
                char network_ip[80];
                int network_port = 0;
+               switch_channel_t *channel = NULL;
+
+
+               if (session) {
+                       channel = switch_core_session_get_channel(session);
+               }
 
                if ((us = sofia_glue_get_unknown_header(sip, "X-FS-Sending-Message")) && !strcmp(us, switch_core_get_uuid())) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not sending message to ourselves!\n");
@@ -4380,6 +4388,11 @@ void sofia_presence_handle_sip_i_message(int status,
                                        switch_event_add_body(event, "%s", msg);
                                }
 
+                               if (channel) {
+                                       switch_channel_event_set_data(channel, event);
+                               }
+
+
                                if (sofia_test_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS)) { 
                                        if (switch_event_dup(&event_dup, event) == SWITCH_STATUS_SUCCESS) {
                                                event_dup->event_id = SWITCH_EVENT_RECV_MESSAGE;