Skip to content

Commit

Permalink
freeswitch_scripting: Rename fs_cli() to freeswitch_esl()
Browse files Browse the repository at this point in the history
Also adapt to the new interface / IPC changes.
  • Loading branch information
liviuchircu committed Dec 14, 2017
1 parent 35f613b commit 97c31c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
4 changes: 0 additions & 4 deletions modules/freeswitch_scripting/fss_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@ void fss_ipc_rcv_event(int sender, void *fs_event)

}

int fs_ipc_send_cli_cmd(fss_ipc_cli_cmd *fs_cmd)
{
return 0;
}
5 changes: 0 additions & 5 deletions modules/freeswitch_scripting/fss_ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@

#include "../../ipc.h"

typedef struct _fss_ipc_cli_cmd {
char *content;
} fss_ipc_cli_cmd;

int fss_ipc_init(void);
int fs_ipc_send_cli_cmd(fss_ipc_cli_cmd *fs_cmd);

#endif /* __FSS_IPC__ */
24 changes: 12 additions & 12 deletions modules/freeswitch_scripting/fss_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

static int mod_init(void);

static int fs_cli(struct sip_msg *msg, char *cmd, char *url, char *out_pv);
static int fixup_fs_cli(void **param, int param_no);
static int fs_esl(struct sip_msg *msg, char *cmd, char *url, char *out_pv);
static int fixup_fs_esl(void **param, int param_no);

static int fs_sub_add_url(modparam_t type, void *string);

Expand All @@ -45,8 +45,8 @@ struct mi_root *mi_fs_reload(struct mi_root *cmd, void *param);

static cmd_export_t cmds[] = {
{ "fss_bind", (cmd_function)fss_bind, 1, NULL, NULL, 0 },
{ "fs_cli", (cmd_function)fs_cli, 2, fixup_fs_cli, NULL, ALL_ROUTES },
{ "fs_cli", (cmd_function)fs_cli, 3, fixup_fs_cli, NULL, ALL_ROUTES },
{ "freeswitch_esl", (cmd_function)fs_esl, 2, fixup_fs_esl, NULL, ALL_ROUTES },
{ "freeswitch_esl", (cmd_function)fs_esl, 3, fixup_fs_esl, NULL, ALL_ROUTES },
{ NULL, NULL, 0, NULL, NULL, 0 }
};

Expand Down Expand Up @@ -146,7 +146,7 @@ static int mod_init(void)
return 0;
}

static int fixup_fs_cli(void **param, int param_no)
static int fixup_fs_esl(void **param, int param_no)
{
switch (param_no) {
case 1:
Expand All @@ -155,18 +155,18 @@ static int fixup_fs_cli(void **param, int param_no)
case 3:
return fixup_pvar(param);
default:
LM_BUG("fs_cli() called with > 3 params!\n");
LM_BUG("freeswitch_esl() called with > 3 params!\n");
return -1;
}
}

static int fs_cli(struct sip_msg *msg, char *cmd_gp, char *url_gp,
static int fs_esl(struct sip_msg *msg, char *cmd_gp, char *url_gp,
char *reply_pvs)
{
fs_evs *sock;
pv_value_t reply_val;
str url, cmd, reply;
int ret = 0;
int ret = 1;

if (fixup_get_svalue(msg, (gparam_p)cmd_gp, &cmd) != 0) {
LM_ERR("failed to print cmd parameter!\n");
Expand All @@ -187,9 +187,9 @@ static int fs_cli(struct sip_msg *msg, char *cmd_gp, char *url_gp,
LM_DBG("running '%.*s' on %s:%d\n", cmd.len, cmd.s,
sock->host.s, sock->port);

if (fs_api.fs_cli(sock, &cmd, &reply) != 0) {
LM_ERR("failed to run fs_cli cmd '%*s.' on %s:%d\n", cmd.len, cmd.s,
sock->host.s, sock->port);
if (fs_api.fs_esl(sock, &cmd, &reply) != 0) {
LM_ERR("failed to run freeswitch_esl cmd '%*s.' on %s:%d\n",
cmd.len, cmd.s, sock->host.s, sock->port);
ret = -1;
goto out;
}
Expand All @@ -200,7 +200,7 @@ static int fs_cli(struct sip_msg *msg, char *cmd_gp, char *url_gp,
reply_val.rs = reply;

if (pv_set_value(msg, (pv_spec_p)reply_pvs, 0, &reply_val) != 0) {
LM_ERR("Set body pv value failed!\n");
LM_ERR("failed to set output pvar!\n");
ret = -1;
}

Expand Down

0 comments on commit 97c31c8

Please sign in to comment.