]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add unique-id check to sendevent to send and event to a session instead of the system
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 15 Sep 2009 19:18:20 +0000 (19:18 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 15 Sep 2009 19:18:20 +0000 (19:18 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14874 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_event_socket/mod_event_socket.c

index b0e0645310cac1fc9d535a4540428329f673643b..f5417e695b51e32b42c54a7442863dba130bcc79 100644 (file)
@@ -1667,6 +1667,8 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
 
        if (!strncasecmp(cmd, "sendevent", 9)) {
                char *ename;
+               const char *uuid = NULL;
+
                strip_cr(cmd);
 
                ename = cmd + 9;
@@ -1691,7 +1693,17 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                        }
                }
 
-               switch_event_fire(event);
+               if ((uuid = switch_event_get_header(*event, "unique-id"))) {
+                       switch_core_session_t *dsession;
+                       if ((dsession = switch_core_session_locate(uuid))) {
+                               switch_core_session_queue_event(dsession, event);
+                               switch_core_session_rwunlock(dsession);
+                       }
+               }
+               
+               if (*event) {
+                       switch_event_fire(event);
+               }
                switch_snprintf(reply, reply_len, "+OK");
                goto done;
        } else if (!strncasecmp(cmd, "api ", 4)) {