From 190c241c816369656986b83715613566a2aa4515 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 17 Apr 2014 20:12:27 -0500 Subject: [PATCH] FS-6452 mod_spy doesn't react on events without variable_domain_name --- src/mod/applications/mod_spy/mod_spy.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_spy/mod_spy.c b/src/mod/applications/mod_spy/mod_spy.c index 4f4c8ebdf9..10a28ccedd 100644 --- a/src/mod/applications/mod_spy/mod_spy.c +++ b/src/mod/applications/mod_spy/mod_spy.c @@ -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: