]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4558 --resolve
authorRaymond Chandler <intralanman@gmail.com>
Sat, 8 Sep 2012 06:28:35 +0000 (02:28 -0400)
committerRaymond Chandler <intralanman@gmail.com>
Sat, 8 Sep 2012 06:28:35 +0000 (02:28 -0400)
src/mod/applications/mod_conference/mod_conference.c
src/mod/endpoints/mod_sofia/mod_sofia.c

index 9539c1631ead49f59b524f25a74e8ef90cef9f5e..eb70d53ea2cc75a26bb3c2591bebf834395988e8 100644 (file)
@@ -4473,7 +4473,7 @@ static switch_status_t conference_say(conference_obj_t *conference, const char *
 }
 
 /* send a message to every member of the conference */
-static void chat_message_broadcast(conference_obj_t *conference, switch_stream_handle_t *stream, const char *data, const char *chat_from)
+static void chat_message_broadcast(conference_obj_t *conference, switch_stream_handle_t *stream, const char *data, const char *chat_from, const char *ouuid)
 {
        conference_member_t *member = NULL;
        char *argv[2] = { 0 };
@@ -4490,25 +4490,15 @@ static void chat_message_broadcast(conference_obj_t *conference, switch_stream_h
 
        msg.message_id = SWITCH_MESSAGE_INDICATE_MESSAGE;
        msg.string_array_arg[2] = data;
+       msg.string_array_arg[3] = ouuid;
        msg.from = __FILE__;
 
        switch_mutex_lock(conference->member_mutex);
        for (member = conference->members; member; member = member->next) {
                if (member->session && !switch_test_flag(member, MFLAG_NOCHANNEL)) {
                        switch_core_session_t *lsession = NULL;
-                       switch_channel_t *channel = NULL;
-                       switch_caller_profile_t *caller_profile = NULL;
 
                        lsession = member->session;
-                       channel = switch_core_session_get_channel(lsession);
-                       caller_profile = switch_channel_get_caller_profile(channel);
-
-                       if (!strcmp(argv[0], caller_profile->username)) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not sending message to sender [%s]\n", chat_from);
-                               continue;
-                       } else {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sending message to [%s]\n", caller_profile->username);
-                       }
 
                        switch_core_session_receive_message(lsession, &msg);
                }
@@ -7866,6 +7856,7 @@ static switch_status_t chat_send(switch_event_t *message_event)
        const char *body;
        //const char *type;
        const char *hint;
+       const char *ouuid;
 
        proto = switch_event_get_header(message_event, "proto");
        from = switch_event_get_header(message_event, "from");
@@ -7874,6 +7865,7 @@ static switch_status_t chat_send(switch_event_t *message_event)
        body = switch_event_get_body(message_event);
        //type = switch_event_get_header(message_event, "type");
        hint = switch_event_get_header(message_event, "hint");
+       ouuid = switch_event_get_header(message_event, "Channel-Call-UUID");
 
        if ((p = strchr(to, '+'))) {
                to = ++p;
@@ -7890,7 +7882,8 @@ static switch_status_t chat_send(switch_event_t *message_event)
        }
 
        if (!(conference = conference_find(name, NULL))) {
-               switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL, NULL, SWITCH_FALSE);
+               switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", 
+                                                                  "Conference not active.", NULL, NULL, SWITCH_FALSE);
                return SWITCH_STATUS_FALSE;
        }
 
@@ -7899,7 +7892,7 @@ static switch_status_t chat_send(switch_event_t *message_event)
        if (body != NULL && (lbuf = strdup(body))) {
                /* special case list */
                if (conference->broadcast_chat_messages) {
-                       chat_message_broadcast(conference, &stream, body, from);
+                       chat_message_broadcast(conference, &stream, body, from, ouuid);
                } else if (switch_stristr("list", lbuf)) {
                        conference_list_pretty(conference, &stream);
                        /* provide help */
index a5f8d8d11f6c45f29f5a57f337227752d4c6537f..b1771dd1f2948d32a0284ec5c3ecbda55d590224 100644 (file)
@@ -2099,6 +2099,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        char *ct = "text/plain";
                        int ok = 0;
 
+                       if (!zstr(msg->string_array_arg[3]) && !strcmp(msg->string_array_arg[3], tech_pvt->caller_profile->uuid)) {
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Not sending message back to sender\n");
+                               break;
+                       }
+
                        if (!zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {
                                ct = switch_core_session_sprintf(session, "%s/%s", msg->string_array_arg[0], msg->string_array_arg[1]);
                                ok = 1;