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;
char key[512];
char *uuid = NULL, *my_uuid = NULL;
int i;
+ int found = 0;
switch_thread_rwlock_rdlock(globals.spy_hash_lock);
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);
}
}
}
+
+ if (!found) {
+ status = SWITCH_STATUS_FALSE;
+ }
done: