name change
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8579 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
4062b636e2
commit
307e9ef7d6
|
@ -92,7 +92,7 @@ struct switch_stream_handle {
|
|||
switch_size_t data_len;
|
||||
switch_size_t alloc_len;
|
||||
switch_size_t alloc_chunk;
|
||||
switch_event_t *event;
|
||||
switch_event_t *param_event;
|
||||
};
|
||||
|
||||
struct switch_io_event_hooks;
|
||||
|
|
|
@ -114,9 +114,9 @@ static switch_status_t _find_user(const char *cmd, switch_core_session_t *sessio
|
|||
char *host = NULL;
|
||||
const char *err = NULL;
|
||||
|
||||
if (stream->event && (host = switch_event_get_header(stream->event, "http-host"))) {
|
||||
if (stream->param_event && (host = switch_event_get_header(stream->param_event, "http-host"))) {
|
||||
stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
|
||||
if ((path_info = switch_event_get_header(stream->event, "http-path-info"))) {
|
||||
if ((path_info = switch_event_get_header(stream->param_event, "http-path-info"))) {
|
||||
cmd = path_info;
|
||||
delim = '/';
|
||||
}
|
||||
|
@ -200,9 +200,9 @@ SWITCH_STANDARD_API(xml_locate_function)
|
|||
char *host = NULL;
|
||||
const char *err = NULL;
|
||||
|
||||
if (stream->event && (host = switch_event_get_header(stream->event, "http-host"))) {
|
||||
if (stream->param_event && (host = switch_event_get_header(stream->param_event, "http-host"))) {
|
||||
stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
|
||||
if ((path_info = switch_event_get_header(stream->event, "http-path-info"))) {
|
||||
if ((path_info = switch_event_get_header(stream->param_event, "http-path-info"))) {
|
||||
cmd = path_info;
|
||||
delim = '/';
|
||||
}
|
||||
|
@ -522,8 +522,8 @@ SWITCH_STANDARD_API(status_function)
|
|||
|
||||
switch_core_measure_time(switch_core_uptime(), &duration);
|
||||
|
||||
if (stream->event) {
|
||||
http = switch_event_get_header(stream->event, "http-host");
|
||||
if (stream->param_event) {
|
||||
http = switch_event_get_header(stream->param_event, "http-host");
|
||||
}
|
||||
|
||||
if (http || (cmd && strstr(cmd, "html"))) {
|
||||
|
@ -1943,8 +1943,8 @@ SWITCH_STANDARD_API(show_function)
|
|||
}
|
||||
}
|
||||
|
||||
if (stream->event) {
|
||||
holder.http = switch_event_get_header(stream->event, "http-host");
|
||||
if (stream->param_event) {
|
||||
holder.http = switch_event_get_header(stream->param_event, "http-host");
|
||||
}
|
||||
|
||||
holder.print_title = 1;
|
||||
|
|
|
@ -3663,8 +3663,8 @@ SWITCH_STANDARD_API(conf_api_main)
|
|||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (stream->event) {
|
||||
http = switch_event_get_header(stream->event, "http-host");
|
||||
if (stream->param_event) {
|
||||
http = switch_event_get_header(stream->param_event, "http-host");
|
||||
}
|
||||
|
||||
if (http) {
|
||||
|
|
|
@ -2417,8 +2417,8 @@ static void do_del(vm_profile_t *profile, char *user, char *domain, char *file,
|
|||
struct holder holder;
|
||||
char *ref = NULL;
|
||||
|
||||
if (stream->event) {
|
||||
ref = switch_event_get_header(stream->event, "http-referer");
|
||||
if (stream->param_event) {
|
||||
ref = switch_event_get_header(stream->param_event, "http-referer");
|
||||
}
|
||||
|
||||
sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' and file_path like '%%%s'", user, domain, file);
|
||||
|
@ -2766,13 +2766,13 @@ SWITCH_STANDARD_API(voicemail_api_function)
|
|||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (stream->event) {
|
||||
host = switch_event_get_header(stream->event, "http-host");
|
||||
port = switch_event_get_header(stream->event, "http-port");
|
||||
uri = switch_event_get_header(stream->event, "http-uri");
|
||||
user = switch_event_get_header(stream->event, "freeswitch-user");
|
||||
domain = switch_event_get_header(stream->event, "freeswitch-domain");
|
||||
path_info = switch_event_get_header(stream->event, "http-path-info");
|
||||
if (stream->param_event) {
|
||||
host = switch_event_get_header(stream->param_event, "http-host");
|
||||
port = switch_event_get_header(stream->param_event, "http-port");
|
||||
uri = switch_event_get_header(stream->param_event, "http-uri");
|
||||
user = switch_event_get_header(stream->param_event, "freeswitch-user");
|
||||
domain = switch_event_get_header(stream->param_event, "freeswitch-domain");
|
||||
path_info = switch_event_get_header(stream->param_event, "http-path-info");
|
||||
}
|
||||
|
||||
if (!switch_strlen_zero(cmd)) {
|
||||
|
|
|
@ -1532,8 +1532,8 @@ SWITCH_STANDARD_API(pa_cmd)
|
|||
char cmd_buf[1024] = "";
|
||||
char *http = NULL;
|
||||
|
||||
if (stream->event) {
|
||||
http = switch_event_get_header(stream->event, "http-host");
|
||||
if (stream->param_event) {
|
||||
http = switch_event_get_header(stream->param_event, "http-host");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1553,7 +1553,7 @@ SWITCH_STANDARD_API(pa_cmd)
|
|||
#if 0
|
||||
switch_event_header_t *hp;
|
||||
stream->write_function(stream, "<pre>");
|
||||
for (hp = stream->event->headers; hp; hp = hp->next) {
|
||||
for (hp = stream->param_event->headers; hp; hp = hp->next) {
|
||||
stream->write_function(stream, "[%s]=[%s]\n", hp->name, hp->value);
|
||||
}
|
||||
stream->write_function(stream, "</pre>");
|
||||
|
@ -1561,8 +1561,8 @@ SWITCH_STANDARD_API(pa_cmd)
|
|||
|
||||
stream->write_function(stream, "Content-type: text/html\n\n");
|
||||
|
||||
wcmd = switch_str_nil(switch_event_get_header(stream->event, "wcmd"));
|
||||
action = switch_event_get_header(stream->event, "action");
|
||||
wcmd = switch_str_nil(switch_event_get_header(stream->param_event, "wcmd"));
|
||||
action = switch_event_get_header(stream->param_event, "action");
|
||||
|
||||
if (action) {
|
||||
if (strlen(action) == 1) {
|
||||
|
|
|
@ -1542,15 +1542,15 @@ SWITCH_STANDARD_API(pa_cmd)
|
|||
"pa outdev #<num>|<partial name>\n"
|
||||
"pa ringdev #<num>|<partial name>\n" "--------------------------------------------------------------------------------\n";
|
||||
|
||||
if (stream->event) {
|
||||
http = switch_event_get_header(stream->event, "http-host");
|
||||
if (stream->param_event) {
|
||||
http = switch_event_get_header(stream->param_event, "http-host");
|
||||
}
|
||||
|
||||
if (http) {
|
||||
stream->write_function(stream, "Content-type: text/html\n\n");
|
||||
|
||||
wcmd = switch_str_nil(switch_event_get_header(stream->event, "wcmd"));
|
||||
action = switch_event_get_header(stream->event, "action");
|
||||
wcmd = switch_str_nil(switch_event_get_header(stream->param_event, "wcmd"));
|
||||
action = switch_event_get_header(stream->param_event, "action");
|
||||
|
||||
if (action) {
|
||||
if (strlen(action) == 1) {
|
||||
|
|
|
@ -1032,7 +1032,7 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
|
|||
|
||||
void do_telecast(switch_stream_handle_t *stream)
|
||||
{
|
||||
char *path_info = switch_event_get_header(stream->event, "http-path-info");
|
||||
char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
|
||||
char *uuid = strdup(path_info + 4);
|
||||
switch_core_session_t *tsession;
|
||||
char *fname = "stream.mp3";
|
||||
|
@ -1042,7 +1042,7 @@ void do_telecast(switch_stream_handle_t *stream)
|
|||
}
|
||||
|
||||
if (!(tsession = switch_core_session_locate(uuid))) {
|
||||
char *ref = switch_event_get_header(stream->event, "http-referer");
|
||||
char *ref = switch_event_get_header(stream->param_event, "http-referer");
|
||||
stream->write_function(stream,"Content-type: text/html\r\n\r\n<h2>Not Found!</h2>\n"
|
||||
"<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
|
||||
} else {
|
||||
|
@ -1140,7 +1140,7 @@ void do_telecast(switch_stream_handle_t *stream)
|
|||
|
||||
void do_broadcast(switch_stream_handle_t *stream)
|
||||
{
|
||||
char *path_info = switch_event_get_header(stream->event, "http-path-info");
|
||||
char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
|
||||
char *file;
|
||||
lame_global_flags *gfp = NULL;
|
||||
switch_file_handle_t fh = {0};
|
||||
|
@ -1254,9 +1254,9 @@ void do_index(switch_stream_handle_t *stream)
|
|||
struct holder holder;
|
||||
char *errmsg;
|
||||
|
||||
holder.host = switch_event_get_header(stream->event, "http-host");
|
||||
holder.port = switch_event_get_header(stream->event, "http-port");
|
||||
holder.uri = switch_event_get_header(stream->event, "http-uri");
|
||||
holder.host = switch_event_get_header(stream->param_event, "http-host");
|
||||
holder.port = switch_event_get_header(stream->param_event, "http-port");
|
||||
holder.uri = switch_event_get_header(stream->param_event, "http-uri");
|
||||
holder.stream = stream;
|
||||
|
||||
stream->write_function(stream, "Content-type: text/html\r\n\r\n");
|
||||
|
@ -1286,11 +1286,11 @@ SWITCH_STANDARD_API(telecast_api_function)
|
|||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (stream->event) {
|
||||
host = switch_event_get_header(stream->event, "http-host");
|
||||
port = switch_event_get_header(stream->event, "http-port");
|
||||
uri = switch_event_get_header(stream->event, "http-uri");
|
||||
path_info = switch_event_get_header(stream->event, "http-path-info");
|
||||
if (stream->param_event) {
|
||||
host = switch_event_get_header(stream->param_event, "http-host");
|
||||
port = switch_event_get_header(stream->param_event, "http-port");
|
||||
uri = switch_event_get_header(stream->param_event, "http-uri");
|
||||
path_info = switch_event_get_header(stream->param_event, "http-path-info");
|
||||
}
|
||||
|
||||
if (!path_info) {
|
||||
|
|
|
@ -346,12 +346,12 @@ SWITCH_STANDARD_API(lua_api_function) {
|
|||
switch_assert(mycmd);
|
||||
mod_lua_conjure_stream(L, stream, "stream", 1);
|
||||
|
||||
if (stream->event) {
|
||||
mod_lua_conjure_event(L, stream->event, "env", 1);
|
||||
if (stream->param_event) {
|
||||
mod_lua_conjure_event(L, stream->param_event, "env", 1);
|
||||
}
|
||||
|
||||
if ((error = lua_parse_and_execute(L, mycmd))) {
|
||||
if (switch_event_get_header(stream->event, "http-host")) {
|
||||
if (switch_event_get_header(stream->param_event, "http-host")) {
|
||||
stream->write_function(stream, "Content-Type: text/html\n\n<H2>Error Executing Script</H2>");
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR encounterd\n");
|
||||
|
|
|
@ -266,8 +266,8 @@ static void *SWITCH_THREAD_FUNC perl_thread_run(switch_thread_t *thread, void *o
|
|||
if (cmd) {
|
||||
if (stream) {
|
||||
mod_perl_conjure_stream(my_perl, stream, "stream");
|
||||
if (stream->event) {
|
||||
mod_perl_conjure_event(my_perl, stream->event, "env");
|
||||
if (stream->param_event) {
|
||||
mod_perl_conjure_event(my_perl, stream->param_event, "env");
|
||||
}
|
||||
}
|
||||
//Perl_safe_eval(my_perl, cmd);
|
||||
|
|
|
@ -196,7 +196,7 @@ static JSBool request_add_header(JSContext *cx, JSObject *obj, uintN argc, jsval
|
|||
if (argc > 1) {
|
||||
char *hname = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
|
||||
char *hval = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
|
||||
switch_event_add_header(ro->stream->event, SWITCH_STACK_BOTTOM, hname, "%s", hval);
|
||||
switch_event_add_header(ro->stream->param_event, SWITCH_STACK_BOTTOM, hname, "%s", hval);
|
||||
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ static JSBool request_get_header(JSContext * cx, JSObject * obj, uintN argc, jsv
|
|||
|
||||
if (argc > 0) {
|
||||
char *hname = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
|
||||
char *val = switch_event_get_header(ro->stream->event, hname);
|
||||
char *val = switch_event_get_header(ro->stream->param_event, hname);
|
||||
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, val));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -243,14 +243,14 @@ static JSBool request_dump_env(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
|||
if (!strcasecmp(how, "xml")) {
|
||||
switch_xml_t xml;
|
||||
char *xmlstr;
|
||||
if ((xml = switch_event_xmlize(ro->stream->event, SWITCH_VA_NONE))) {
|
||||
if ((xml = switch_event_xmlize(ro->stream->param_event, SWITCH_VA_NONE))) {
|
||||
xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
|
||||
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, xmlstr));
|
||||
return JS_TRUE;
|
||||
}
|
||||
} else {
|
||||
char *buf;
|
||||
switch_event_serialize(ro->stream->event, &buf, SWITCH_TRUE);
|
||||
switch_event_serialize(ro->stream->param_event, &buf, SWITCH_TRUE);
|
||||
if (buf) {
|
||||
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buf));
|
||||
free(buf);
|
||||
|
@ -3406,8 +3406,8 @@ SWITCH_STANDARD_API(jsapi_function)
|
|||
struct request_obj ro = {0};
|
||||
char *path_info = NULL;
|
||||
|
||||
if (stream->event) {
|
||||
path_info = switch_event_get_header(stream->event, "http-path-info");
|
||||
if (stream->param_event) {
|
||||
path_info = switch_event_get_header(stream->param_event, "http-path-info");
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(cmd) && path_info) {
|
||||
|
|
|
@ -519,32 +519,32 @@ abyss_bool handler_hook(TSession * r)
|
|||
|
||||
auth:
|
||||
|
||||
if (switch_event_create(&stream.event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_event_create(&stream.param_event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
|
||||
const char * const content_length = RequestHeaderValue(r, "content-length");
|
||||
|
||||
if (fs_user)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "FreeSWITCH-User", "%s", fs_user);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "FreeSWITCH-User", "%s", fs_user);
|
||||
if (fs_domain)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Domain", "%s", fs_domain);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Domain", "%s", fs_domain);
|
||||
if (path_info)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-Path-Info", "%s", path_info);
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-URI", "%s", r->requestInfo.uri);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-Path-Info", "%s", path_info);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-URI", "%s", r->requestInfo.uri);
|
||||
if (r->requestInfo.query)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", r->requestInfo.query);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", r->requestInfo.query);
|
||||
if (r->requestInfo.host)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-HOST", "%s", r->requestInfo.host);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-HOST", "%s", r->requestInfo.host);
|
||||
if (r->requestInfo.from)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-FROM", "%s", r->requestInfo.from);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-FROM", "%s", r->requestInfo.from);
|
||||
if (r->requestInfo.useragent)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-USER-AGENT", "%s", r->requestInfo.useragent);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-USER-AGENT", "%s", r->requestInfo.useragent);
|
||||
if (r->requestInfo.referer)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-REFERER", "%s", r->requestInfo.referer);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-REFERER", "%s", r->requestInfo.referer);
|
||||
if (r->requestInfo.requestline)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-REQUESTLINE", "%s", r->requestInfo.requestline);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-REQUESTLINE", "%s", r->requestInfo.requestline);
|
||||
if (r->requestInfo.user)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-USER", "%s", r->requestInfo.user);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-USER", "%s", r->requestInfo.user);
|
||||
if (r->requestInfo.port)
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-PORT", "%u", r->requestInfo.port);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-PORT", "%u", r->requestInfo.port);
|
||||
if (r->requestInfo.query || content_length) {
|
||||
char *q, *qd;
|
||||
char *next;
|
||||
|
@ -584,7 +584,7 @@ abyss_bool handler_hook(TSession * r)
|
|||
}
|
||||
}
|
||||
if (query) {
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", query);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", query);
|
||||
|
||||
qd = strdup(query);
|
||||
switch_assert(qd != NULL);
|
||||
|
@ -610,7 +610,7 @@ abyss_bool handler_hook(TSession * r)
|
|||
name = q;
|
||||
if ((val = strchr(name, '='))) {
|
||||
*val++ = '\0';
|
||||
switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, name, "%s", val);
|
||||
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, name, "%s", val);
|
||||
}
|
||||
q = next;
|
||||
} while (q != NULL);
|
||||
|
|
|
@ -1341,16 +1341,16 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char *
|
|||
switch_assert(stream->data != NULL);
|
||||
switch_assert(stream->write_function != NULL);
|
||||
|
||||
if (!stream->event) {
|
||||
switch_event_create(&stream->event, SWITCH_EVENT_API);
|
||||
if (!stream->param_event) {
|
||||
switch_event_create(&stream->param_event, SWITCH_EVENT_API);
|
||||
}
|
||||
|
||||
if (stream->event) {
|
||||
if (stream->param_event) {
|
||||
if (cmd) {
|
||||
switch_event_add_header(stream->event, SWITCH_STACK_BOTTOM, "API-Command", "%s", cmd);
|
||||
switch_event_add_header(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command", "%s", cmd);
|
||||
}
|
||||
if (arg) {
|
||||
switch_event_add_header(stream->event, SWITCH_STACK_BOTTOM, "API-Command-Argument", "%s", arg);
|
||||
switch_event_add_header(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command-Argument", "%s", arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1361,8 +1361,8 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char *
|
|||
stream->write_function(stream, "INVALID COMMAND!\n");
|
||||
}
|
||||
|
||||
if (stream->event) {
|
||||
switch_event_fire(&stream->event);
|
||||
if (stream->param_event) {
|
||||
switch_event_fire(&stream->param_event);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue