From 0bec209a9bfef8e84506c91ad96c640e7750098e Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sat, 3 Jan 2015 16:06:35 +0800 Subject: [PATCH] fix fsapi in verto, the json_api_function expects cmd & arg in the data object --- src/mod/endpoints/mod_verto/mod_verto.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 7616416982..67a8dec072 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3571,10 +3571,15 @@ static switch_bool_t jsapi_func(const char *method, cJSON *params, jsock_t *jsoc } if (jsock->allowed_fsapi && !strcmp(function, "fsapi")) { - cJSON *cmd = cJSON_GetObjectItem(params, "cmd"); - cJSON *arg = cJSON_GetObjectItem(params, "arg"); - - if (cmd->type == cJSON_String && cmd->valuestring && !auth_api_command(jsock, cmd->valuestring, arg ? arg->valuestring : NULL)) { + cJSON *data = cJSON_GetObjectItem(params, "data"); + cJSON *cmd; + cJSON *arg; + + if (data && + (cmd = cJSON_GetObjectItem(data, "cmd")) && + (arg = cJSON_GetObjectItem(data, "arg")) && + cmd->type == cJSON_String && cmd->valuestring && + !auth_api_command(jsock, cmd->valuestring, arg ? arg->valuestring : NULL)) { return SWITCH_FALSE; } } -- 2.47.2