FreeSWITCH API Documentation  1.7.0
switch_event.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Anthony Minessale II <anthm@freeswitch.org>
27  *
28  *
29  * switch_event.h -- Event System
30  *
31  */
32 /*! \file switch_event.h
33  \brief Event System
34 
35  The event system uses a backend thread and an APR threadsafe FIFO queue to accept event objects from various threads
36  and allow the backend to take control and deliver the events to registered callbacks.
37 
38  The typical usage would be to bind to one or all of the events and use a callback function to react in various ways
39  (see the more_xmpp_event_handler or mod_event_test modules for examples).
40 
41  Builtin events are fired by the core at various points in the execution of the application and custom events can be
42  reserved and registered so events from an external module can be rendered and handled by an another even handler module.
43 
44  If the work time to process an event in a callback is anticipated to grow beyond a very small amount of time it is recommended
45  that you implement your own handler thread and FIFO queue so you can accept the events in the callback and queue them
46  into your own thread rather than tie up the delivery agent. It is in the opinion of the author that such a necessity
47  should be judged on a per-use basis and therefore it does not fall within the scope of this system to provide that
48  functionality at a core level.
49 
50 */
51 
52 /*!
53  \defgroup events Eventing Engine
54  \ingroup core1
55  \{
56 */
57 
58 #ifndef SWITCH_EVENT_H
59 #define SWITCH_EVENT_H
60 
61 #include <switch.h>
62 
64 /*! \brief An event Header */
66  /*! the header name */
67  char *name;
68  /*! the header value */
69  char *value;
70  /*! array space */
71  char **array;
72  /*! array index */
73  int idx;
74  /*! hash of the header name */
75  unsigned long hash;
77 };
78 
79 /*! \brief Representation of an event */
80 struct switch_event {
81  /*! the event id (descriptor) */
83  /*! the priority of the event */
85  /*! the owner of the event */
86  char *owner;
87  /*! the subclass of the event */
89  /*! the event headers */
91  /*! the event headers tail pointer */
93  /*! the body of the event */
94  char *body;
95  /*! user data from the subclass provider */
97  /*! user data from the event sender */
99  /*! unique key */
100  unsigned long key;
102  int flags;
103 };
104 
105 typedef struct switch_serial_event_s {
106  int event_id;
107  int priority;
108  int flags;
109  char *owner;
111  char *body;
113 
115  char *name;
116  char *value;
118 
119 typedef enum {
120  EF_UNIQ_HEADERS = (1 << 0),
121  EF_NO_CHAT_EXEC = (1 << 1),
122  EF_DEFAULT_ALLOW = (1 << 2)
124 
125 
126 struct switch_event_node;
127 
128 #define SWITCH_EVENT_SUBCLASS_ANY NULL
129 
130 /*!
131  \brief Start the eventing system
132  \param pool the memory pool to use for the event system (creates a new one if NULL)
133  \return SWITCH_STATUS_SUCCESS when complete
134 */
136 
137 /*!
138  \brief Stop the eventing system
139  \return SWITCH_STATUS_SUCCESS when complete
140 */
142 
143 /*!
144  \brief Create an event
145  \param event a NULL pointer on which to create the event
146  \param event_id the event id enumeration of the desired event
147  \param subclass_name the subclass name for custom event (only valid when event_id is SWITCH_EVENT_CUSTOM)
148  \return SWITCH_STATUS_SUCCESS on success
149 */
150 SWITCH_DECLARE(switch_status_t) switch_event_create_subclass_detailed(const char *file, const char *func, int line,
152 
153 #define switch_event_create_subclass(_e, _eid, _sn) switch_event_create_subclass_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _e, _eid, _sn)
154 
155 /*!
156  \brief Set the priority of an event
157  \param event the event to set the priority on
158  \param priority the event priority
159  \return SWITCH_STATUS_SUCCESS
160 */
162 
163 /*!
164  \brief Retrieve a header value from an event
165  \param event the event to read the header from
166  \param header_name the name of the header to read
167  \return the value of the requested header
168 */
169 
171 _Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header_idx(switch_event_t *event, const char *header_name, int idx);
172 #define switch_event_get_header(_e, _h) switch_event_get_header_idx(_e, _h, -1)
173 
174 #define switch_event_get_header_nil(e, h) switch_str_nil(switch_event_get_header(e,h))
175 
176 SWITCH_DECLARE(switch_status_t) switch_event_rename_header(switch_event_t *event, const char *header_name, const char *new_header_name);
177 
178 /*!
179  \brief Retrieve the body value from an event
180  \param event the event to read the body from
181  \return the value of the body or NULL
182 */
184 
185 #ifndef SWIG
186 /*!
187  \brief Add a header to an event
188  \param event the event to add the header to
189  \param stack the stack sense (stack it on the top or on the bottom)
190  \param header_name the name of the header to add
191  \param fmt the value of the header (varargs see standard sprintf family)
192  \return SWITCH_STATUS_SUCCESS if the header was added
193 */
195  const char *header_name, const char *fmt, ...) PRINTF_FUNCTION(4, 5);
196 #endif
197 
199 
200 /*!
201  \brief Add a string header to an event
202  \param event the event to add the header to
203  \param stack the stack sense (stack it on the top or on the bottom)
204  \param header_name the name of the header to add
205  \param data the value of the header
206  \return SWITCH_STATUS_SUCCESS if the header was added
207 */
208 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);
209 
210 SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val);
211 #define switch_event_del_header(_e, _h) switch_event_del_header_val(_e, _h, NULL)
212 SWITCH_DECLARE(int) switch_event_add_array(switch_event_t *event, const char *var, const char *val);
213 /*!
214  \brief Destroy an event
215  \param event pointer to the pointer to event to destroy
216 */
218 #define switch_event_safe_destroy(_event) if (_event) switch_event_destroy(_event)
219 
220 /*!
221  \brief Duplicate an event
222  \param event a NULL pointer on which to duplicate the event
223  \param todup an event to duplicate
224  \return SWITCH_STATUS_SUCCESS if the event was duplicated
225 */
229 
230 /*!
231  \brief Fire an event with full arguement list
232  \param file the calling file
233  \param func the calling function
234  \param line the calling line number
235  \param event the event to send (will be nulled on success)
236  \param user_data optional private data to pass to the event handlers
237  \return
238 */
239 SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data);
240 
241 SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event);
242 #define switch_event_prep_for_delivery(_event) switch_event_prep_for_delivery_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _event)
243 
244 
245 /*!
246  \brief Bind an event callback to a specific event
247  \param id an identifier token of the binder
248  \param event the event enumeration to bind to
249  \param subclass_name the event subclass to bind to in the case if SWITCH_EVENT_CUSTOM
250  \param callback the callback functon to bind
251  \param user_data optional user specific data to pass whenever the callback is invoked
252  \return SWITCH_STATUS_SUCCESS if the event was binded
253 */
255  void *user_data);
256 
258 
259 /*!
260  \brief Bind an event callback to a specific event
261  \param id an identifier token of the binder
262  \param event the event enumeration to bind to
263  \param subclass_name the event subclass to bind to in the case if SWITCH_EVENT_CUSTOM
264  \param callback the callback functon to bind
265  \param user_data optional user specific data to pass whenever the callback is invoked
266  \param node bind handle to later remove the binding.
267  \return SWITCH_STATUS_SUCCESS if the event was binded
268 */
269 SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name,
270  switch_event_callback_t callback, void *user_data, switch_event_node_t **node);
271 /*!
272  \brief Unbind a bound event consumer
273  \param node node to unbind
274  \return SWITCH_STATUS_SUCCESS if the consumer was unbinded
275 */
278 
279 /*!
280  \brief Render the name of an event id enumeration
281  \param event the event id to render the name of
282  \return the rendered name
283 */
285 
286 /*!
287  \brief return the event id that matches a given event name
288  \param name the name of the event
289  \param type the event id to return
290  \return SWITCH_STATUS_SUCCESS if there was a match
291 */
293 
294 /*!
295  \brief Reserve a subclass name for private use with a custom event
296  \param owner the owner of the event name
297  \param subclass_name the name to reserve
298  \return SWITCH_STATUS_SUCCESS if the name was reserved
299  \note There is nothing to enforce this but I recommend using module::event_name for the subclass names
300 
301 */
302 SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(const char *owner, const char *subclass_name);
303 
304 SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char *owner, const char *subclass_name);
305 
306 /*!
307  \brief Render a string representation of an event suitable for printing or network transport
308  \param event the event to render
309  \param str a string pointer to point at the allocated data
310  \param encode url encode the headers
311  \return SWITCH_STATUS_SUCCESS if the operation was successful
312  \note you must free the resulting string when you are finished with it
313 */
320 SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup);
321 SWITCH_DECLARE(switch_status_t) switch_event_create_array_pair(switch_event_t **event, char **names, char **vals, int len);
322 
323 #ifndef SWIG
324 /*!
325  \brief Render a XML representation of an event suitable for printing or network transport
326  \param event the event to render
327  \param fmt optional body of the event (varargs see standard sprintf family)
328  \return the xml object if the operation was successful
329  \note the body supplied by this function will supersede an existing body the event may have
330 */
331 SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const char *fmt, ...) PRINTF_FUNCTION(2, 3);
332 #endif
333 
334 /*!
335  \brief Determine if the event system has been initialized
336  \return SWITCH_STATUS_SUCCESS if the system is running
337 */
339 
340 #ifndef SWIG
341 /*!
342  \brief Add a body to an event
343  \param event the event to add to body to
344  \param fmt optional body of the event (varargs see standard sprintf family)
345  \return SWITCH_STATUS_SUCCESS if the body was added to the event
346  \note the body parameter can be shadowed by the switch_event_reserve_subclass_detailed function
347 */
348 SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, const char *fmt, ...) PRINTF_FUNCTION(2, 3);
349 #endif
350 
352 
353 SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur);
354 #define switch_event_expand_headers(_event, _in) switch_event_expand_headers_check(_event, _in, NULL, NULL, 0)
355 
357  _In_z_ const char *proto, _In_z_ const char *login,
358  _In_z_ const char *from, _In_z_ const char *from_domain,
359  _In_z_ const char *status, _In_z_ const char *event_type,
360  _In_z_ const char *alt_event_type, _In_ int event_count,
361  _In_z_ const char *unique_id, _In_z_ const char *channel_state,
362  _In_z_ const char *answer_state, _In_z_ const char *call_direction);
363 #define switch_event_create_pres_in(event) switch_event_create_pres_in_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, \
364  proto, login, from, from_domain, status, event_type, alt_event_type, event_count, \
365  unique_id, channel_state, answer_state, call_direction)
366 
367 
368 /*!
369  \brief Reserve a subclass assuming the owner string is the current filename
370  \param subclass_name the subclass name to reserve
371  \return SWITCH_STATUS_SUCCESS if the operation was successful
372  \note the body supplied by this function will supersede an existing body the event may have
373 */
374 #define switch_event_reserve_subclass(subclass_name) switch_event_reserve_subclass_detailed(__FILE__, subclass_name)
375 #define switch_event_free_subclass(subclass_name) switch_event_free_subclass_detailed(__FILE__, subclass_name)
376 
377 /*!
378  \brief Create a new event assuming it will not be custom event and therefore hiding the unused parameters
379  \param event a NULL pointer on which to create the event
380  \param id the event id enumeration of the desired event
381  \return SWITCH_STATUS_SUCCESS on success
382 */
383 #define switch_event_create(event, id) switch_event_create_subclass(event, id, SWITCH_EVENT_SUBCLASS_ANY)
384 
386 {
388  if (status == SWITCH_STATUS_SUCCESS) {
389  (*event)->event_id = event_id;
390 
391  if (event_id == SWITCH_EVENT_REQUEST_PARAMS || event_id == SWITCH_EVENT_CHANNEL_DATA) {
392  (*event)->flags |= EF_UNIQ_HEADERS;
393  }
394  }
395 
396  return status;
397 }
398 
399 /*!
400  \brief Deliver an event to all of the registered event listeners
401  \param event the event to send (will be nulled)
402  \note normaly use switch_event_fire for delivering events (only use this when you wish to deliver the event blocking on your thread)
403 */
405 
406 /*!
407  \brief Fire an event filling in most of the arguements with obvious values
408  \param event the event to send (will be nulled on success)
409  \return SWITCH_STATUS_SUCCESS if the operation was successful
410  \note the body supplied by this function will supersede an existing body the event may have
411 */
412 #define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, NULL)
413 
414 /*!
415  \brief Fire an event filling in most of the arguements with obvious values and allowing user_data to be sent
416  \param event the event to send (will be nulled on success)
417  \param data user data to send to the event handlers
418  \return SWITCH_STATUS_SUCCESS if the operation was successful
419  \note the body supplied by this function will supersede an existing body the event may have
420 */
421 #define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, data)
422 
423 SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map);
425 SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix);
426 SWITCH_DECLARE(void) switch_json_add_presence_data_cols(switch_event_t *event, cJSON *json, const char *prefix);
427 
429 
430 SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id);
431 SWITCH_DECLARE(uint32_t) switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func);
433 
434 
435 typedef void (*switch_live_array_command_handler_t)(switch_live_array_t *la, const char *cmd, const char *sessid, cJSON *jla, void *user_data);
436 
437 #define NO_EVENT_CHANNEL_ID 0
438 #define SWITCH_EVENT_CHANNEL_GLOBAL "__global__"
439 
443 SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_channel, const char *name,
444  switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP);
448 SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, const char *name, int index, cJSON **obj, switch_bool_t destroy);
456 SWITCH_DECLARE(switch_bool_t) switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name);
457 SWITCH_DECLARE(switch_bool_t) switch_live_array_clear_alias(switch_live_array_t *la, const char *event_channel, const char *name);
458 SWITCH_DECLARE(switch_bool_t) switch_event_channel_permission_verify(const char *cookie, const char *event_channel);
459 SWITCH_DECLARE(void) switch_event_channel_permission_modify(const char *cookie, const char *event_channel, switch_bool_t set);
460 SWITCH_DECLARE(void) switch_event_channel_permission_clear(const char *cookie);
461 
462 ///\}
463 
465 #endif
466 /* For Emacs:
467  * Local Variables:
468  * mode:c
469  * indent-tabs-mode:t
470  * tab-width:4
471  * c-basic-offset:4
472  * End:
473  * For VIM:
474  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
475  */
_Ret_opt_z_ char * switch_event_get_header_idx(switch_event_t *event, const char *header_name, int idx)
Definition: switch_event.c:817
void switch_json_add_presence_data_cols(switch_event_t *event, cJSON *json, const char *prefix)
switch_status_t switch_event_serialize_json(switch_event_t *event, char **str)
switch_event_types_t event_id
Definition: switch_event.h:82
switch_priority_t priority
Definition: switch_event.h:84
void switch_live_array_parse_json(cJSON *json, switch_event_channel_id_t channel_id)
switch_xml_t switch_status_t switch_event_running(void)
Determine if the event system has been initialized.
Definition: switch_event.c:417
switch_status_t switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name, switch_event_callback_t callback, void *user_data, switch_event_node_t **node)
Bind an event callback to a specific event.
uint32_t switch_event_channel_id_t
switch_status_t switch_live_array_visible(switch_live_array_t *la, switch_bool_t visible, switch_bool_t force)
switch_status_t switch_event_serialize_json_obj(switch_event_t *event, cJSON **json)
unsigned long key
Definition: switch_event.h:100
#define SWITCH_END_EXTERN_C
Definition: switch.h:43
void switch_live_array_lock(switch_live_array_t *la)
void switch_event_channel_permission_modify(const char *cookie, const char *event_channel, switch_bool_t set)
switch_event_types_t
Built-in Events.
switch_status_t switch_event_binary_serialize(switch_event_t *event, void **data, switch_size_t *len)
int switch_event_add_array(switch_event_t *event, const char *var, const char *val)
Definition: switch_event.c:922
switch_status_t switch_live_array_destroy(switch_live_array_t **live_arrayP)
void switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix)
switch_bool_t
Definition: switch_types.h:405
switch_status_t switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup)
switch_status_t switch_name_event(const char *name, switch_event_types_t *type)
return the event id that matches a given event name
Definition: switch_event.c:430
switch_priority_t
Priority Indication.
Definition: switch_types.h:991
cJSON * switch_live_array_get_idx(switch_live_array_t *la, int idx)
struct switch_serial_event_header_s switch_serial_event_header_t
switch_memory_pool_t * pool
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
Add a header to an event.
Representation of an event.
Definition: switch_event.h:80
int switch_event_check_permission_list(switch_event_t *list, const char *name)
switch_status_t switch_event_add_body(switch_event_t *event, const char *fmt,...) PRINTF_FUNCTION(2
Add a body to an event.
An event Header.
Definition: switch_event.h:65
void switch_event_launch_dispatch_threads(uint32_t max)
Definition: switch_event.c:623
switch_status_t switch_event_set_priority(switch_event_t *event, switch_priority_t priority)
Set the priority of an event.
Definition: switch_event.c:760
struct switch_event * next
Definition: switch_event.h:101
switch_event_header_t * last_header
Definition: switch_event.h:92
void switch_event_channel_permission_clear(const char *cookie)
A representation of an XML tree.
Definition: switch_xml.h:76
switch_bool_t switch_live_array_isnew(switch_live_array_t *la)
A node to store binded events.
Definition: switch_event.c:46
switch_status_t switch_event_dup(switch_event_t **event, switch_event_t *todup)
Duplicate an event.
#define _Ret_opt_z_
cJSON * switch_live_array_get(switch_live_array_t *la, const char *name)
void(* switch_live_array_command_handler_t)(switch_live_array_t *la, const char *cmd, const char *sessid, cJSON *jla, void *user_data)
Definition: switch_event.h:435
switch_status_t switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id)
switch_status_t switch_event_shutdown(void)
Stop the eventing system.
Definition: switch_event.c:524
switch_status_t switch_event_init(switch_memory_pool_t *pool)
Start the eventing system.
Definition: switch_event.c:664
void switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event)
switch_status_t switch_event_bind(const char *id, switch_event_types_t event, const char *subclass_name, switch_event_callback_t callback, void *user_data)
Bind an event callback to a specific event.
switch_status_t switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data)
Fire an event with full arguement list.
switch_status_t switch_live_array_clear(switch_live_array_t *la)
switch_status_t switch_live_array_add(switch_live_array_t *la, const char *name, int index, cJSON **obj, switch_bool_t destroy)
switch_byte_t in
switch_event_types_t event_id
Definition: switch_event.c:50
switch_status_t switch_event_create_subclass_detailed(const char *file, const char *func, int line, switch_event_t **event, switch_event_types_t event_id, const char *subclass_name)
Create an event.
Definition: switch_event.c:718
void switch_event_merge(switch_event_t *event, switch_event_t *tomerge)
char * switch_event_get_body(switch_event_t *event)
Retrieve the body value from an event.
Definition: switch_event.c:838
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
switch_status_t switch_event_binary_deserialize(switch_event_t **eventp, void **data, switch_size_t len, switch_bool_t duplicate)
Render a string representation of an event suitable for printing or network transport.
const char * switch_event_name(switch_event_types_t event)
Render the name of an event id enumeration.
Definition: switch_event.c:422
switch_status_t switch_status_t switch_event_set_subclass_name(switch_event_t *event, const char *subclass_name)
void switch_live_array_set_command_handler(switch_live_array_t *la, switch_live_array_command_handler_t command_handler)
void switch_event_deliver(switch_event_t **event)
Deliver an event to all of the registered event listeners.
Definition: switch_event.c:392
uintptr_t switch_size_t
switch_status_t switch_event_create_json(switch_event_t **event, const char *json)
char * owner
Definition: switch_event.h:86
#define _In_z_
static switch_status_t switch_event_create_plain(switch_event_t **event, switch_event_types_t event_id)
Definition: switch_event.h:385
switch_status_t switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val)
Definition: switch_event.c:843
void(* switch_event_callback_t)(switch_event_t *)
switch_bool_t switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name)
void(* switch_event_channel_func_t)(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id)
#define PRINTF_FUNCTION(fmtstr, vars)
switch_status_t switch_live_array_bootstrap(switch_live_array_t *la, const char *sessid, switch_event_channel_id_t channel_id)
switch_status_t
Common return values.
switch_bool_t switch_live_array_clear_alias(switch_live_array_t *la, const char *event_channel, const char *name)
switch_status_t switch_live_array_create(const char *event_channel, const char *name, switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP)
struct switch_event_header * next
Definition: switch_event.h:76
struct switch_serial_event_s switch_serial_event_t
char * switch_event_expand_headers_check(switch_event_t *event, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur)
void switch_live_array_set_user_data(switch_live_array_t *la, void *user_data)
switch_status_t switch_event_dup_reply(switch_event_t **event, switch_event_t *todup)
Main Library Header.
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
Definition: switch_event.h:383
#define SWITCH_DECLARE(type)
void switch_live_array_unlock(switch_live_array_t *la)
switch_status_t switch_event_channel_bind(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t *id)
switch_status_t switch_live_array_del(switch_live_array_t *la, const char *name)
void * event_user_data
Definition: switch_event.h:98
switch_status_t switch_event_free_subclass_detailed(const char *owner, const char *subclass_name)
Definition: switch_event.c:446
switch_status_t switch_event_create_array_pair(switch_event_t **event, char **names, char **vals, int len)
char * switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map)
struct apr_pool_t switch_memory_pool_t
switch_stack_t
Expression of how to stack a list.
switch_status_t switch_event_unbind_callback(switch_event_callback_t callback)
switch_status_t switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line, _In_z_ const char *proto, _In_z_ const char *login, _In_z_ const char *from, _In_z_ const char *from_domain, _In_z_ const char *status, _In_z_ const char *event_type, _In_z_ const char *alt_event_type, _In_ int event_count, _In_z_ const char *unique_id, _In_z_ const char *channel_state, _In_z_ const char *answer_state, _In_z_ const char *call_direction)
switch_status_t switch_event_reserve_subclass_detailed(const char *owner, const char *subclass_name)
Reserve a subclass name for private use with a custom event.
Definition: switch_event.c:473
switch_event_callback_t callback
Definition: switch_event.c:54
switch_status_t switch_status_t switch_event_set_body(switch_event_t *event, const char *body)
switch_status_t switch_event_rename_header(switch_event_t *event, const char *header_name, const char *new_header_name)
Definition: switch_event.c:767
void switch_event_destroy(switch_event_t **event)
Destroy an event.
char * subclass_name
Definition: switch_event.h:88
void * bind_user_data
Definition: switch_event.h:96
switch_event_header_t * switch_event_get_header_ptr(switch_event_t *event, const char *header_name)
Retrieve a header value from an event.
Definition: switch_event.c:796
uint32_t switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func)
switch_bool_t switch_event_channel_permission_verify(const char *cookie, const char *event_channel)
switch_status_t switch_event_serialize(switch_event_t *event, char **str, switch_bool_t encode)
switch_event_flag_t
Definition: switch_event.h:119
unsigned long hash
Definition: switch_event.h:75
switch_event_header_t * headers
Definition: switch_event.h:90
switch_status_t switch_event_get_custom_events(switch_console_callback_match_t **matches)
#define _In_
#define SWITCH_BEGIN_EXTERN_C
Definition: switch.h:42
switch_xml_t switch_event_xmlize(switch_event_t *event, const char *fmt,...) PRINTF_FUNCTION(2
Render a XML representation of an event suitable for printing or network transport.
switch_status_t switch_event_unbind(switch_event_node_t **node)
Unbind a bound event consumer.