mod_event_socket: sendevent Fire events with correct event-name and subclass (MODEVENT-41)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14354 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
e7ec98273f
commit
b0daf34ad5
|
@ -163,6 +163,9 @@ SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack,
|
SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack,
|
||||||
const char *header_name, const char *fmt, ...) PRINTF_FUNCTION(4, 5);
|
const char *header_name, const char *fmt, ...) PRINTF_FUNCTION(4, 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_event_set_subclass_name(switch_event_t *event, const char *subclass_name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Add a string header to an event
|
\brief Add a string header to an event
|
||||||
\param event the event to add the header to
|
\param event the event to add the header to
|
||||||
|
|
|
@ -1085,6 +1085,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (var && val) {
|
if (var && val) {
|
||||||
|
switch_event_del_header(*event, var);
|
||||||
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, var, val);
|
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, var, val);
|
||||||
if (!strcasecmp(var, "content-length")) {
|
if (!strcasecmp(var, "content-length")) {
|
||||||
clen = atoi(val);
|
clen = atoi(val);
|
||||||
|
@ -1687,7 +1688,12 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
|
||||||
if (ename) {
|
if (ename) {
|
||||||
switch_event_types_t etype;
|
switch_event_types_t etype;
|
||||||
if (switch_name_event(ename, &etype) == SWITCH_STATUS_SUCCESS) {
|
if (switch_name_event(ename, &etype) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
const char *subclass_name = switch_event_get_header(*event, "Event-Subclass");
|
||||||
(*event)->event_id = etype;
|
(*event)->event_id = etype;
|
||||||
|
|
||||||
|
if (etype == SWITCH_EVENT_CUSTOM && subclass_name) {
|
||||||
|
switch_event_set_subclass_name(*event, subclass_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -782,6 +782,17 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, s
|
||||||
return switch_event_base_add_header(event, stack, header_name, data);
|
return switch_event_base_add_header(event, stack, header_name, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_event_set_subclass_name(switch_event_t *event, const char *subclass_name)
|
||||||
|
{
|
||||||
|
if (!event || !subclass_name) return SWITCH_STATUS_GENERR;
|
||||||
|
|
||||||
|
switch_safe_free(event->subclass_name);
|
||||||
|
event->subclass_name = DUP(subclass_name);
|
||||||
|
switch_event_del_header(event, "Event-Subclass");
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Subclass", subclass_name);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
|
SWITCH_DECLARE(switch_status_t) switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
|
||||||
{
|
{
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -848,6 +859,7 @@ SWITCH_DECLARE(void) switch_event_destroy(switch_event_t **event)
|
||||||
*event = NULL;
|
*event = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_event_t *todup)
|
SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_event_t *todup)
|
||||||
{
|
{
|
||||||
switch_event_header_t *hp;
|
switch_event_header_t *hp;
|
||||||
|
|
Loading…
Reference in New Issue