RTS API Documentation  1.10.11
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 SWITCH_DECLARE(switch_status_t) switch_event_add_header_string_nodup(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data);
210 
211 SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val);
212 #define switch_event_del_header(_e, _h) switch_event_del_header_val(_e, _h, NULL)
213 SWITCH_DECLARE(int) switch_event_add_array(switch_event_t *event, const char *var, const char *val);
214 /*!
215  \brief Destroy an event
216  \param event pointer to the pointer to event to destroy
217 */
219 #define switch_event_safe_destroy(_event) if (_event) switch_event_destroy(&_event)
220 
221 /*!
222  \brief Duplicate an event
223  \param event a NULL pointer on which to duplicate the event
224  \param todup an event to duplicate
225  \return SWITCH_STATUS_SUCCESS if the event was duplicated
226 */
230 
231 /*!
232  \brief Fire an event with full arguement list
233  \param file the calling file
234  \param func the calling function
235  \param line the calling line number
236  \param event the event to send (will be nulled on success)
237  \param user_data optional private data to pass to the event handlers
238  \return
239 */
240 SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data);
241 
242 SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event);
243 #define switch_event_prep_for_delivery(_event) switch_event_prep_for_delivery_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _event)
244 
245 
246 /*!
247  \brief Bind an event callback to a specific event
248  \param id an identifier token of the binder
249  \param event the event enumeration to bind to
250  \param subclass_name the event subclass to bind to in the case if SWITCH_EVENT_CUSTOM
251  \param callback the callback functon to bind
252  \param user_data optional user specific data to pass whenever the callback is invoked
253  \return SWITCH_STATUS_SUCCESS if the event was binded
254 */
256  void *user_data);
257 
259 
260 /*!
261  \brief Bind an event callback to a specific event
262  \param id an identifier token of the binder
263  \param event the event enumeration to bind to
264  \param subclass_name the event subclass to bind to in the case if SWITCH_EVENT_CUSTOM
265  \param callback the callback functon to bind
266  \param user_data optional user specific data to pass whenever the callback is invoked
267  \param node bind handle to later remove the binding.
268  \return SWITCH_STATUS_SUCCESS if the event was binded
269 */
272 /*!
273  \brief Unbind a bound event consumer
274  \param node node to unbind
275  \return SWITCH_STATUS_SUCCESS if the consumer was unbinded
276 */
279 
280 /*!
281  \brief Render the name of an event id enumeration
282  \param event the event id to render the name of
283  \return the rendered name
284 */
286 
287 /*!
288  \brief return the event id that matches a given event name
289  \param name the name of the event
290  \param type the event id to return
291  \return SWITCH_STATUS_SUCCESS if there was a match
292 */
294 
295 /*!
296  \brief Reserve a subclass name for private use with a custom event
297  \param owner the owner of the event name
298  \param subclass_name the name to reserve
299  \return SWITCH_STATUS_SUCCESS if the name was reserved
300  \note There is nothing to enforce this but I recommend using module::event_name for the subclass names
301 
302 */
304 
306 
307 /*!
308  \brief Render a string representation of an event suitable for printing or network transport
309  \param event the event to render
310  \param str a string pointer to point at the allocated data
311  \param encode url encode the headers
312  \return SWITCH_STATUS_SUCCESS if the operation was successful
313  \note you must free the resulting string when you are finished with it
314 */
321 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);
322 SWITCH_DECLARE(switch_status_t) switch_event_create_array_pair(switch_event_t **event, char **names, char **vals, int len);
323 
324 #ifndef SWIG
325 /*!
326  \brief Render a XML representation of an event suitable for printing or network transport
327  \param event the event to render
328  \param fmt optional body of the event (varargs see standard sprintf family)
329  \return the xml object if the operation was successful
330  \note the body supplied by this function will supersede an existing body the event may have
331 */
333 #endif
334 
335 /*!
336  \brief Determine if the event system has been initialized
337  \return SWITCH_STATUS_SUCCESS if the system is running
338 */
340 
341 #ifndef SWIG
342 /*!
343  \brief Add a body to an event
344  \param event the event to add to body to
345  \param fmt optional body of the event (varargs see standard sprintf family)
346  \return SWITCH_STATUS_SUCCESS if the body was added to the event
347  \note the body parameter can be shadowed by the switch_event_reserve_subclass_detailed function
348 */
350 #endif
351 
353 
354 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);
355 #define switch_event_expand_headers(_event, _in) switch_event_expand_headers_check(_event, _in, NULL, NULL, 0)
356 
358  _In_z_ const char *proto, _In_z_ const char *login,
359  _In_z_ const char *from, _In_z_ const char *from_domain,
360  _In_z_ const char *status, _In_z_ const char *event_type,
361  _In_z_ const char *alt_event_type, _In_ int event_count,
362  _In_z_ const char *unique_id, _In_z_ const char *channel_state,
363  _In_z_ const char *answer_state, _In_z_ const char *call_direction);
364 #define switch_event_create_pres_in(event) switch_event_create_pres_in_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, \
365  proto, login, from, from_domain, status, event_type, alt_event_type, event_count, \
366  unique_id, channel_state, answer_state, call_direction)
367 
368 
369 /*!
370  \brief Reserve a subclass assuming the owner string is the current filename
371  \param subclass_name the subclass name to reserve
372  \return SWITCH_STATUS_SUCCESS if the operation was successful
373  \note the body supplied by this function will supersede an existing body the event may have
374 */
375 #define switch_event_reserve_subclass(subclass_name) switch_event_reserve_subclass_detailed(__FILE__, subclass_name)
376 #define switch_event_free_subclass(subclass_name) switch_event_free_subclass_detailed(__FILE__, subclass_name)
377 
378 /*!
379  \brief Create a new event assuming it will not be custom event and therefore hiding the unused parameters
380  \param event a NULL pointer on which to create the event
381  \param id the event id enumeration of the desired event
382  \return SWITCH_STATUS_SUCCESS on success
383 */
384 #define switch_event_create(event, id) switch_event_create_subclass(event, id, SWITCH_EVENT_SUBCLASS_ANY)
385 
387 {
389  if (status == SWITCH_STATUS_SUCCESS) {
390  (*event)->event_id = event_id;
391 
392  if (event_id == SWITCH_EVENT_REQUEST_PARAMS || event_id == SWITCH_EVENT_CHANNEL_DATA) {
393  (*event)->flags |= EF_UNIQ_HEADERS;
394  }
395  }
396 
397  return status;
398 }
399 
400 /*!
401  \brief Deliver an event to all of the registered event listeners
402  \param event the event to send (will be nulled)
403  \note normaly use switch_event_fire for delivering events (only use this when you wish to deliver the event blocking on your thread)
404 */
406 
407 /*!
408  \brief Fire an event filling in most of the arguements with obvious values
409  \param event the event to send (will be nulled on success)
410  \return SWITCH_STATUS_SUCCESS if the operation was successful
411  \note the body supplied by this function will supersede an existing body the event may have
412 */
413 #define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, NULL)
414 
415 /*!
416  \brief Fire an event filling in most of the arguements with obvious values and allowing user_data to be sent
417  \param event the event to send (will be nulled on success)
418  \param data user data to send to the event handlers
419  \return SWITCH_STATUS_SUCCESS if the operation was successful
420  \note the body supplied by this function will supersede an existing body the event may have
421 */
422 #define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, data)
423 
424 SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map);
426 SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix);
427 SWITCH_DECLARE(void) switch_json_add_presence_data_cols(switch_event_t *event, cJSON *json, const char *prefix);
428 
430 
431 SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id);
432 SWITCH_DECLARE(switch_status_t) switch_event_channel_deliver(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id);
433 SWITCH_DECLARE(uint32_t) switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func, void *user_data);
435 
436 
437 typedef void (*switch_live_array_command_handler_t)(switch_live_array_t *la, const char *cmd, const char *sessid, cJSON *jla, void *user_data);
438 
439 #define NO_EVENT_CHANNEL_ID 0
440 #define SWITCH_EVENT_CHANNEL_GLOBAL "__global__"
441 
445 SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_channel, const char *name,
446  switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP);
458 SWITCH_DECLARE(switch_bool_t) switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name);
459 SWITCH_DECLARE(switch_bool_t) switch_live_array_clear_alias(switch_live_array_t *la, const char *event_channel, const char *name);
460 SWITCH_DECLARE(switch_bool_t) switch_event_channel_permission_verify(const char *cookie, const char *event_channel);
461 SWITCH_DECLARE(void) switch_event_channel_permission_modify(const char *cookie, const char *event_channel, switch_bool_t set);
462 SWITCH_DECLARE(void) switch_event_channel_permission_clear(const char *cookie);
463 
464 ///\}
465 
467 #endif
468 /* For Emacs:
469  * Local Variables:
470  * mode:c
471  * indent-tabs-mode:t
472  * tab-width:4
473  * c-basic-offset:4
474  * End:
475  * For VIM:
476  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
477  */
_Ret_opt_z_ char * switch_event_get_header_idx(switch_event_t *event, const char *header_name, int idx)
Definition: switch_event.c:846
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
switch_status_t switch_event_channel_bind(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t *id, void *user_data)
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:425
switch_status_t switch_event_add_header_string_nodup(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
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:962
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:441
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)
const cJSON *const b
Definition: switch_cJSON.h:243
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:438
switch_priority_t
Priority Indication.
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:653
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:789
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:79
switch_bool_t switch_live_array_isnew(switch_live_array_t *la)
A node to store binded events.
Definition: switch_event.c:48
switch_status_t switch_event_dup(switch_event_t **event, switch_event_t *todup)
Duplicate an event.
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:437
#define _Ret_opt_z_
cJSON * switch_live_array_get(switch_live_array_t *la, const char *name)
switch_status_t switch_event_channel_deliver(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id)
int cJSON_bool fmt
Definition: switch_cJSON.h:150
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:549
switch_status_t switch_event_init(switch_memory_pool_t *pool)
Start the eventing system.
Definition: switch_event.c:692
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:52
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:747
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:867
int index
Definition: switch_cJSON.h:160
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:430
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:400
void(* switch_event_channel_func_t)(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id, void *user_data)
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:386
switch_status_t switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val)
Definition: switch_event.c:872
uint32_t switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func, void *user_data)
switch_bool_t switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name)
#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:384
#define SWITCH_DECLARE(type)
void switch_live_array_unlock(switch_live_array_t *la)
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:454
switch_status_t switch_event_create_array_pair(switch_event_t **event, char **names, char **vals, int len)
char * key
Definition: switch_msrp.c:64
char * switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map)
switch_stack_t
Expression of how to stack a list.
switch_status_t switch_event_unbind_callback(switch_event_callback_t callback)
void(* switch_event_callback_t)(switch_event_t *)
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:485
struct fspr_pool_t switch_memory_pool_t
switch_event_callback_t callback
Definition: switch_event.c:56
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:796
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:825
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.