fix arg parsing in new command
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13102 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
5b5d8da571
commit
c253d41d75
|
@ -532,6 +532,11 @@ SWITCH_STANDARD_API(expand_function)
|
||||||
switch_core_session_t *xsession;
|
switch_core_session_t *xsession;
|
||||||
char uuid[80] = "";
|
char uuid[80] = "";
|
||||||
|
|
||||||
|
if (switch_strlen_zero(cmd)) {
|
||||||
|
stream->write_function(stream, "-ERR, no input\n");
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
dup = strdup(cmd);
|
dup = strdup(cmd);
|
||||||
mycmd = dup;
|
mycmd = dup;
|
||||||
|
|
||||||
|
@ -558,8 +563,10 @@ SWITCH_STANDARD_API(expand_function)
|
||||||
*arg++ = '\0';
|
*arg++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
expanded = switch_event_expand_headers(stream->param_event, arg);
|
expanded = arg ? switch_event_expand_headers(stream->param_event, arg) : arg;
|
||||||
status = switch_api_execute(mycmd, expanded, session, stream);
|
if ((status = switch_api_execute(mycmd, expanded, session, stream)) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
stream->write_function(stream, "-ERR, error executing command\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (expanded != arg) {
|
if (expanded != arg) {
|
||||||
free(expanded);
|
free(expanded);
|
||||||
|
@ -569,7 +576,7 @@ SWITCH_STANDARD_API(expand_function)
|
||||||
free(dup);
|
free(dup);
|
||||||
dup = NULL;
|
dup = NULL;
|
||||||
|
|
||||||
return status;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue