Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mod_event_socket] log received esl command capability #2652

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<param name="listen-ip" value="127.0.0.1"/>
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
<!-- Log the command that freeswitch received; default is false -->
<param name="log-recv-cmd" value="true"/>
<!--<param name="apply-inbound-acl" value="lan"/>-->
</settings>
</configuration>
7 changes: 7 additions & 0 deletions src/mod/event_handlers/mod_event_socket/mod_event_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down