mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-23 19:45:35 +00:00
add getvar
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3931 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
97cf339c7e
commit
09384634cc
@ -613,6 +613,9 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t *event
|
|||||||
|
|
||||||
|
|
||||||
if (listener->session) {
|
if (listener->session) {
|
||||||
|
switch_channel_t *channel = switch_core_session_get_channel(listener->session);
|
||||||
|
assert(channel != NULL);
|
||||||
|
|
||||||
if (!strncasecmp(cmd, "connect", 7)) {
|
if (!strncasecmp(cmd, "connect", 7)) {
|
||||||
snprintf(reply, reply_len, "+OK");
|
snprintf(reply, reply_len, "+OK");
|
||||||
goto done;
|
goto done;
|
||||||
@ -628,6 +631,21 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t *event
|
|||||||
snprintf(reply, reply_len, "+OK");
|
snprintf(reply, reply_len, "+OK");
|
||||||
}
|
}
|
||||||
goto done;
|
goto done;
|
||||||
|
} else if (!strncasecmp(cmd, "getvar", 6)) {
|
||||||
|
char *arg;
|
||||||
|
char *val = "";
|
||||||
|
|
||||||
|
strip_cr(cmd);
|
||||||
|
|
||||||
|
if ((arg = strchr(cmd, ' '))) {
|
||||||
|
*arg++ = '\0';
|
||||||
|
if (!(val = switch_channel_get_variable(channel, arg))) {
|
||||||
|
val = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
snprintf(reply, reply_len, val);
|
||||||
|
goto done;
|
||||||
} else if (!strncasecmp(cmd, "myevents", 8)) {
|
} else if (!strncasecmp(cmd, "myevents", 8)) {
|
||||||
listener->event_list[SWITCH_EVENT_CHANNEL_CREATE] = 1;
|
listener->event_list[SWITCH_EVENT_CHANNEL_CREATE] = 1;
|
||||||
listener->event_list[SWITCH_EVENT_CHANNEL_DESTROY] = 1;
|
listener->event_list[SWITCH_EVENT_CHANNEL_DESTROY] = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user