]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6452 mod_spy doesn't react on events without variable_domain_name
authorBrian West <brian@freeswitch.org>
Fri, 18 Apr 2014 01:12:27 +0000 (20:12 -0500)
committerBrian West <brian@freeswitch.org>
Fri, 18 Apr 2014 01:12:27 +0000 (20:12 -0500)
src/mod/applications/mod_spy/mod_spy.c

index 4f4c8ebdf9328f1568eaca12a86c9853bc1d4baf..10a28ccedda5b379cdd22ae01e9b870a63407b44 100644 (file)
@@ -143,7 +143,7 @@ SWITCH_STANDARD_API(dump_hash)
                switch_core_hash_this(hi, &key, NULL, &val);
                spy = (spy_t *) val;
 
-               stream->write_function(stream, "%s :");
+               stream->write_function(stream, "%s :", key);
                while (spy) {
                        stream->write_function(stream, " %s", spy->uuid);
                        spy = spy->next;
@@ -165,6 +165,7 @@ static switch_status_t process_event(switch_event_t *event)
        char key[512];
        char *uuid = NULL, *my_uuid = NULL;
        int i;
+       int found = 0;
 
 
        switch_thread_rwlock_rdlock(globals.spy_hash_lock);
@@ -193,10 +194,11 @@ static switch_status_t process_event(switch_event_t *event)
                                        if ((session = switch_core_session_locate(spy->uuid))) {
                                                switch_channel_t *channel = switch_core_session_get_channel(session);
                                                
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UserSpy retrieved uuid %s for key %s, activating eavesdrop\n", uuid, key);
                                                my_uuid = switch_event_get_header(event, "Unique-ID");
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UserSpy retrieved uuid %s for key %s, activating eavesdrop\n", uuid, key);
                                                
                                                switch_channel_set_variable(channel, "spy_uuid", my_uuid);
+                                               found++;
                                                
                                                switch_channel_set_state(channel, CS_EXCHANGE_MEDIA);
                                                switch_channel_set_flag(channel, CF_BREAK);
@@ -212,6 +214,10 @@ static switch_status_t process_event(switch_event_t *event)
                        }
                }
        }
+
+       if (!found) {
+               status = SWITCH_STATUS_FALSE;
+       }
        
        
  done: