From b181f0c4726681556f41d0f68857d0faa064be23 Mon Sep 17 00:00:00 2001 From: Minh Minh Date: Wed, 27 Nov 2024 22:31:13 +0100 Subject: [PATCH 1/2] log received esl command capability --- .../conf/autoload_configs/event_socket.conf.xml | 2 ++ src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/mod/event_handlers/mod_event_socket/conf/autoload_configs/event_socket.conf.xml b/src/mod/event_handlers/mod_event_socket/conf/autoload_configs/event_socket.conf.xml index 5ea2e097883..33ef6551da0 100644 --- a/src/mod/event_handlers/mod_event_socket/conf/autoload_configs/event_socket.conf.xml +++ b/src/mod/event_handlers/mod_event_socket/conf/autoload_configs/event_socket.conf.xml @@ -4,6 +4,8 @@ + + diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 935f726ee15..3f3acc8e4f3 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -108,6 +108,7 @@ static struct { switch_mutex_t *listener_mutex; switch_event_node_t *node; int debug; + int log_recv_cmd } globals; static struct { @@ -1726,6 +1727,10 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even goto done; } + if (globals.log_recv_cmd > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Received from %s:%d: %s", listener->remote_ip, listener->remote_port, cmd); + } + if (switch_stristr("unload", cmd) && switch_stristr("mod_event_socket", cmd)) { cmd = unload_cheat; } else if (switch_stristr("reload", cmd) && switch_stristr("mod_event_socket", cmd)) { @@ -2887,6 +2892,8 @@ static int config(void) set_pref_ip(val); } else if (!strcmp(var, "debug")) { globals.debug = atoi(val); + } else if (!strcmp(var, "log-recv-cmd")) { + globals.log_recv_cmd = switch_true(val) ? 1 : 0; } else if (!strcmp(var, "nat-map")) { if (switch_true(val) && switch_nat_get_type()) { prefs.nat_map = 1; From dd53129f2848b863d4c187d408794cf5fa950cd3 Mon Sep 17 00:00:00 2001 From: Minh Minh Date: Wed, 27 Nov 2024 22:56:33 +0100 Subject: [PATCH 2/2] typo --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 3f3acc8e4f3..ddff0b59b34 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -108,7 +108,7 @@ static struct { switch_mutex_t *listener_mutex; switch_event_node_t *node; int debug; - int log_recv_cmd + int log_recv_cmd; } globals; static struct {