Asterisk - The Open Source Telephony Project GIT-master-a358458
mwi.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2019, Sangoma Technologies Corporation
5 *
6 * Kevin Harwell <kharwell@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19#ifndef _ASTERISK_MWI_H
20#define _ASTERISK_MWI_H
21
22/*! \file
23 *
24 * \brief Asterisk MWI API.
25 *
26 * \par Intro
27 *
28 * This module manages, and processes all things MWI. Defined are mechanisms for subscribing
29 * and publishing to MWI topics. User modules wishing to receive MWI updates for a particular
30 * mailbox should do so by adding an MWI subscriber to that mailbox, followed by subscribing
31 * to the mailbox's topic. Likewise, user modules that want to publish MWI updates about a
32 * particular mailbox should first add a publisher for that mailbox prior to publishing.
33 *
34 * MWI state is managed via an underlying \ref stasis_state_manager (if interested see the
35 * stasis_state.c module for the gory details). As such all last known mailbox state can be
36 * retrieve and iterated over by using the \ref ast_mwi_subscribe_pool function.
37 *
38 * \par ast_mwi_subscriber
39 *
40 * Created via \ref ast_mwi_add_subscriber, a subscriber subscribes to a given mailbox in
41 * order to receive updates about the given mailbox. Adding a subscriber will create the
42 * underlying topic, and associated state data if those do not already exist for it. The
43 * topic, and last known state data is guaranteed to exist for the lifetime of the subscriber.
44 * State data can be NULL if nothing has been published to the mailbox's topic yet.
45 *
46 * NOTE, currently adding a subscriber here will either create, or add a reference to the
47 * underlying stasis state (and associated topic). However, it does not actually subscribe to
48 * the stasis topic itself. You still need to explicitly call \ref stasis_subscribe, or
49 * similar on the topic if you wish to receive published event updates.
50 *
51 * So given that when subscribing to an MWI topic the following order should be adhered to:
52 *
53 * 1. Add an MWI state subscriber using \ref ast_mwi_add_subscriber
54 * 2. Retrieve the topic from the subscriber using \ref ast_mwi_subscriber_topic
55 * 3. Subscribe to the topic itself using \ref stasis_subscribe or \ref stasis_subscribe_pool
56 *
57 * Or simply call \ref ast_mwi_subscribe_pool, which combines those steps into a single call and
58 * returns the subscriber that is now subscribed to both the stasis topic and state.
59 *
60 * Similarly, releasing the subscriber's reference removes a reference to the underlying state,
61 * but does not unsubscribe from the MWI topic. This should be done separately and prior to
62 * removing the subscriber's state reference:
63 *
64 * 1. Unsubscribe from the stasis topic subscription using \ref stasis_unsubscribe or
65 * \ref stasis_unsubscribe_and_join
66 * 2. Remove the MWI subscriber reference
67 *
68 * Or call \ref ast_mwi_unsubscribe (or _and_join), which combines those two steps into a
69 * single call.
70 *
71 * \par ast_mwi_publisher
72 *
73 * Before publishing to a particular topic a publisher should be created. This can be achieved
74 * by using \ref ast_mwi_add_publisher. Publishing to a mailbox should then be done using the
75 * \ref ast_mwi_publish function. This ensures the message is published to the appropriate
76 * topic, and the last known state is maintained.
77 *
78 * Publishing by mailbox id alone is also allowed. However, it is not recommended to do so,
79 * and exists mainly for backwards compatibility, and legacy subsystems. If, and when this
80 * method of publishing is employed a call to one of the \ref ast_delete_mwi_state functions
81 * should also be called for a given mailbox id after no more publishing will be done for
82 * that id. Otherwise a memory leak on the underlying stasis_state object will occur.
83 *
84 * \par ast_mwi_observer
85 *
86 * Add an observer in order to watch for particular MWI module related events. For instance if
87 * a submodule needs to know when a subscription is added to any mailbox an observer can be
88 * added to watch for that.
89 */
90
91#include "asterisk/utils.h"
93
94#if defined(__cplusplus) || defined(c_plusplus)
95extern "C" {
96#endif
97
98struct ast_json;
100struct ast_mwi_state;
101
102/*!
103 * \brief An MWI state subscriber
104 *
105 * An ao2 managed object. Holds a reference to the latest MWI state for its lifetime.
106 *
107 * \since 13.28.0
108 * \since 16.5.0
109 */
110struct ast_mwi_subscriber;
111
112/*!
113 * \brief Add an MWI state subscriber to the mailbox
114 *
115 * Adding a subscriber to a mailbox will create a stasis topic for the mailbox if one
116 * does not already exist. It does not however subscribe to the topic itself. This is
117 * done separately using a call to \ref stasis_subscribe or \ref stasis_subscribe_pool.
118 *
119 * A subscriber can be removed by releasing its reference. Doing so releases its underlying
120 * reference to the MWI state. It does not unsubscribe from the topic. Unsubscribing from
121 * a topic should be done prior to unsubscribing the state.
122 *
123 * \param mailbox The subscription state mailbox id
124 *
125 * \return An MWI subscriber object
126 * \retval NULL on error
127 *
128 * \since 13.28.0
129 * \since 16.5.0
130 */
132
133/*!
134 * \brief Add an MWI state subscriber, and stasis subscription to the mailbox
135 *
136 * Adding a subscriber to a mailbox will create a stasis topic for the mailbox if one
137 * does not already exist. Once successfully create the underlying stasis topic is then
138 * subscribed to as well.
139 *
140 * A subscriber can be removed by releasing its reference. Doing so releases its underlying
141 * reference to the MWI state. It does not unsubscribe from the topic. Unsubscribing from
142 * a topic should be done prior to unsubscribing the state.
143 *
144 * \param mailbox The subscription state mailbox id
145 * \param callback The stasis subscription callback
146 * \param data A user data object passed to the stasis subscription
147 *
148 * \return An MWI subscriber object
149 * \retval NULL on error
150 *
151 * \since 13.28.0
152 * \since 16.5.0
153 */
155 stasis_subscription_cb callback, void *data);
156
157/*!
158 * \brief Unsubscribe from the stasis topic and MWI.
159 *
160 * \param sub An MWI subscriber
161 *
162 * \since 13.28.0
163 * \since 16.5.0
164 */
166
167/*!
168 * \brief Unsubscribe from the stasis topic, block until the final message
169 * is received, and then unsubscribe from MWI.
170 *
171 * \param sub An MWI subscriber
172 *
173 * \since 13.28.0
174 * \since 16.5.0
175 */
177
178/*!
179 * \brief Retrieves the MWI subscriber's topic
180 *
181 * \note Returned topic's reference count is NOT incremented. However, the topic is
182 * guaranteed to live for the lifetime of the subscriber.
183 *
184 * \param sub An MWI subscriber
185 *
186 * \return A stasis topic subscribed to by the subscriber
187 *
188 * \since 13.28.0
189 * \since 16.5.0
190 */
192
193/*!
194 * \brief Retrieves the state data object associated with the MWI subscriber
195 *
196 * \note Returned data's reference count is incremented
197 *
198 * \param sub An MWI subscriber
199 *
200 * \return The state data object
201 *
202 * \since 13.28.0
203 * \since 16.5.0
204 */
206
207/*!
208 * \brief Retrieve the stasis MWI topic subscription if available.
209 *
210 * \param sub An MWI subscriber
211 *
212 * \return The subscriber's stasis subscription
213 * \retval NULL if no subscription available
214 *
215 * \since 13.28.0
216 * \since 16.5.0
217 */
219
220/*!
221 * \brief An MWI state publisher
222 *
223 * An ao2 managed object. Holds a reference to the latest MWI state for its lifetime.
224 *
225 * \since 13.28.0
226 * \since 16.5.0
227 */
228struct ast_mwi_publisher;
229
230/*!
231 * \brief Add an MWI state publisher to the mailbox
232 *
233 * Adding a publisher to a mailbox will create a stasis topic for the mailbox if one
234 * does not already exist. A publisher can be removed by releasing its reference. Doing
235 * so releases its underlying reference to the MWI state.
236 *
237 * \param mailbox The mailbox id to publish to
238 *
239 * \return An MWI publisher object
240 * \retval NULl on error
241 *
242 * \since 13.28.0
243 * \since 16.5.0
244 */
246
247/*! \brief MWI state event interface */
249 /*!
250 * \brief Raised when MWI is being subscribed
251 *
252 * \param mailbox The mailbox id subscribed
253 * \param sub The subscriber subscribed
254 */
255 void (*on_subscribe)(const char *mailbox, struct ast_mwi_subscriber *sub);
256
257 /*!
258 * \brief Raised when MWI is being unsubscribed
259 *
260 * \param mailbox The mailbox id being unsubscribed
261 * \param sub The subscriber to unsubscribe
262 */
263 void (*on_unsubscribe)(const char *mailbox, struct ast_mwi_subscriber *sub);
264};
265
266/*!
267 * \brief Add an observer to receive MWI state related events.
268 *
269 * \param observer The observer handling events
270 *
271 * \retval 0 if successfully registered
272 * \retval -1 otherwise
273 *
274 * \since 13.28.0
275 * \since 16.5.0
276 */
278
279/*!
280 * \brief Remove an MWI state observer.
281 *
282 * \param observer The observer being removed
283 *
284 * \since 13.28.0
285 * \since 16.5.0
286 */
288
289/*!
290 * \brief The delegate called for each managed mailbox state.
291 *
292 * \param mwi_state The mwi state object
293 * \param data User data passed in by the initiator
294 *
295 * \retval 0 to continue traversing
296 * \retval CMP_STOP (2) to stop traversing
297 *
298 * \since 13.28.0
299 * \since 16.5.0
300 */
301typedef int (*on_mwi_state)(struct ast_mwi_state *mwi_state, void *data);
302
303/*!
304 * \brief For each managed mailbox call the given handler.
305 *
306 * \param handler The mwi state handler to call for each managed mailbox
307 * \param data User to data to pass on to the handler
308 *
309 * \since 13.28.0
310 * \since 16.5.0
311 */
313
314/*!
315 * \brief For each managed mailbox that has a subscriber call the given handler.
316 *
317 * \param handler The mwi state handler to call for each managed mailbox
318 * \param data User to data to pass on to the handler
319 *
320 * \since 13.28.0
321 * \since 16.5.0
322 */
324
325/*!
326 * \brief Publish MWI for the given mailbox.
327 *
328 * \param publisher The publisher to publish a mailbox update on
329 * \param urgent_msgs The number of urgent messages in this mailbox
330 * \param new_msgs The number of new messages in this mailbox
331 * \param old_msgs The number of old messages in this mailbox
332 * \param channel_id A unique identifier for a channel associated with this
333 * change in mailbox state
334 * \param eid The EID of the server that originally published the message
335 *
336 * \retval 0 on success
337 * \retval -1 on failure
338 *
339 * \since 13.28.0
340 * \since 16.5.0
341 */
342int ast_mwi_publish(struct ast_mwi_publisher *publisher, int urgent_msgs,
343 int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid);
344
345/*!
346 * \brief Publish MWI for the given mailbox.
347 *
348 * \param mailbox The mailbox identifier string.
349 * \param context The context this mailbox resides in (NULL or "" if only using mailbox)
350 * \param urgent_msgs The number of urgent messages in this mailbox
351 * \param new_msgs The number of new messages in this mailbox
352 * \param old_msgs The number of old messages in this mailbox
353 * \param channel_id A unique identifier for a channel associated with this
354 * change in mailbox state
355 * \param eid The EID of the server that originally published the message
356 *
357 * \retval 0 on success
358 * \retval -1 on failure
359 *
360 * \since 13.28.0
361 * \since 16.5.0
362 */
363int ast_mwi_publish_by_mailbox(const char *mailbox, const char *context, int urgent_msgs,
364 int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid);
365
366/*!
367 * \since 12
368 * \brief Publish a MWI state update via stasis
369 *
370 * \param[in] mailbox The mailbox identifier string.
371 * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
372 * \param[in] new_msgs The number of new messages in this mailbox
373 * \param[in] old_msgs The number of old messages in this mailbox
374 *
375 * \retval 0 Success
376 * \retval -1 Failure
377 */
378#define ast_publish_mwi_state(mailbox, context, new_msgs, old_msgs) \
379 ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, NULL, NULL)
380
381/*!
382 * \since 12
383 * \brief Publish a MWI state update associated with some channel
384 *
385 * \param[in] mailbox The mailbox identifier string.
386 * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
387 * \param[in] new_msgs The number of new messages in this mailbox
388 * \param[in] old_msgs The number of old messages in this mailbox
389 * \param[in] channel_id A unique identifier for a channel associated with this
390 * change in mailbox state
391 *
392 * \retval 0 Success
393 * \retval -1 Failure
394 */
395#define ast_publish_mwi_state_channel(mailbox, context, new_msgs, old_msgs, channel_id) \
396 ast_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, channel_id, NULL)
397
398/*!
399 * \since 12
400 * \brief Publish a MWI state update via stasis with all parameters
401 *
402 * \param[in] mailbox The mailbox identifier string.
403 * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
404 * \param[in] new_msgs The number of new messages in this mailbox
405 * \param[in] old_msgs The number of old messages in this mailbox
406 * \param[in] channel_id A unique identifier for a channel associated with this
407 * change in mailbox state
408 * \param[in] eid The EID of the server that originally published the message
409 *
410 * \retval 0 Success
411 * \retval -1 Failure
412 */
414 const char *mailbox,
415 const char *context,
416 int new_msgs,
417 int old_msgs,
418 const char *channel_id,
419 struct ast_eid *eid);
420
421/*!
422 * \since 12.2.0
423 * \brief Delete MWI state cached by stasis
424 *
425 * \param[in] mailbox The mailbox identifier string.
426 * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
427 *
428 * \retval 0 Success
429 * \retval -1 Failure
430 */
431#define ast_delete_mwi_state(mailbox, context) \
432 ast_delete_mwi_state_full(mailbox, context, NULL)
433
434/*!
435 * \since 12.2.0
436 * \brief Delete MWI state cached by stasis with all parameters
437 *
438 * \param[in] mailbox The mailbox identifier string.
439 * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
440 * \param[in] eid The EID of the server that originally published the message
441 *
442 * \retval 0 Success
443 * \retval -1 Failure
444 */
445int ast_delete_mwi_state_full(const char *mailbox, const char *context, struct ast_eid *eid);
446
447/*!
448 * \addtogroup StasisTopicsAndMessages
449 */
450
451/*!
452 * \brief The structure that contains MWI state
453 * \since 12
454 */
457 AST_STRING_FIELD(uniqueid); /*!< Unique identifier for this mailbox */
458 );
459 int new_msgs; /*!< The current number of new messages for this mailbox */
460 int old_msgs; /*!< The current number of old messages for this mailbox */
461 /*! If applicable, a snapshot of the channel that caused this MWI change */
463 struct ast_eid eid; /*!< The EID of the server where this message originated */
464 int urgent_msgs; /*!< The current number of urgent messages for this mailbox */
465};
466
467/*!
468 * \brief Object that represents an MWI update with some additional application
469 * defined data
470 */
472 struct ast_mwi_state *mwi_state; /*!< MWI state */
473 struct ast_json *blob; /*!< JSON blob of data */
474};
475
476/*!
477 * \since 12
478 * \brief Create a \ref ast_mwi_state object
479 *
480 * \param[in] mailbox The mailbox identifier string.
481 * \param[in] context The context this mailbox resides in (NULL or "" if only using mailbox)
482 *
483 * \return \ref ast_mwi_state object on success
484 * \retval NULL on error
485 */
486struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context);
487
488/*!
489 * \since 12
490 * \brief Creates a \ref ast_mwi_blob message.
491 *
492 * The \a blob JSON object requires a \c "type" field describing the blob. It
493 * should also be treated as immutable and not modified after it is put into the
494 * message.
495 *
496 * \param mwi_state MWI state associated with the update
497 * \param message_type The type of message to create
498 * \param blob JSON object representing the data.
499 * \return \ref ast_mwi_blob message.
500 * \retval NULL on error
501 */
502struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
503 struct stasis_message_type *message_type,
504 struct ast_json *blob);
505
506/*!
507 * \brief Get the \ref stasis topic for MWI messages
508 * \return The topic structure for MWI messages
509 * \retval NULL if it has not been allocated
510 * \since 12
511 */
512struct stasis_topic *ast_mwi_topic_all(void);
513
514/*!
515 * \brief Get the \ref stasis topic for MWI messages on a unique ID
516 * \param uniqueid The unique id for which to get the topic
517 * \return The topic structure for MWI messages for a given uniqueid
518 * \retval NULL if it failed to be found or allocated
519 * \since 12
520 */
521struct stasis_topic *ast_mwi_topic(const char *uniqueid);
522
523/*!
524 * \brief Get the \ref stasis caching topic for MWI messages
525 * \return The caching topic structure for MWI messages
526 * \retval NULL if it has not been allocated
527 * \since 12
528 */
530
531/*!
532 * \brief Backend cache for ast_mwi_topic_cached().
533 * \return Cache of \ref ast_mwi_state.
534 */
536
537/*!
538 * \brief Get the \ref stasis message type for MWI messages
539 * \return The message type structure for MWI messages
540 * \retval NULL on error
541 * \since 12
542 */
544
545/*!
546 * \brief Get the \ref stasis message type for voicemail application specific messages
547 *
548 * This message type exists for those messages a voicemail application may wish to send
549 * that have no logical relationship with other voicemail applications. Voicemail apps
550 * that use this message type must pass a \ref ast_mwi_blob. Any extraneous information
551 * in the JSON blob must be packed as key/value pair tuples of strings.
552 *
553 * At least one key/value tuple must have a key value of "Event".
554 *
555 * \return The \ref stasis_message_type for voicemail application specific messages
556 * \retval NULL on error
557 * \since 12
558 */
560
561/*!
562 * \brief Initialize the mwi core
563 *
564 * \retval 0 Success
565 * \retval -1 Failure
566 *
567 * \since 13.27.0
568 * \since 16.4.0
569 */
570int mwi_init(void);
571
572#define AST_MAX_MAILBOX_UNIQUEID (AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2)
573
574#if defined(__cplusplus) || defined(c_plusplus)
575}
576#endif
577
578#endif /* _ASTERISK_MWI_H */
struct stasis_message_type * ast_mwi_state_type(void)
Get the Stasis Message Bus API message type for MWI messages.
void * ast_mwi_unsubscribe(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic and MWI.
Definition: mwi.c:254
struct ast_mwi_subscriber * ast_mwi_add_subscriber(const char *mailbox)
Add an MWI state subscriber to the mailbox.
Definition: mwi.c:229
struct stasis_subscription * ast_mwi_subscriber_subscription(struct ast_mwi_subscriber *sub)
Retrieve the stasis MWI topic subscription if available.
Definition: mwi.c:277
struct stasis_message_type * ast_mwi_vm_app_type(void)
Get the Stasis Message Bus API message type for voicemail application specific messages.
struct stasis_cache * ast_mwi_state_cache(void)
Backend cache for ast_mwi_topic_cached().
Definition: mwi.c:94
struct stasis_message * ast_mwi_blob_create(struct ast_mwi_state *mwi_state, struct stasis_message_type *message_type, struct ast_json *blob)
Creates a ast_mwi_blob message.
Definition: mwi.c:467
int mwi_init(void)
Initialize the mwi core.
Definition: mwi.c:507
struct stasis_topic * ast_mwi_topic(const char *uniqueid)
Get the Stasis Message Bus API topic for MWI messages on a unique ID.
Definition: mwi.c:104
int ast_publish_mwi_state_full(const char *mailbox, const char *context, int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid)
Publish a MWI state update via stasis with all parameters.
Definition: mwi.c:393
int(* on_mwi_state)(struct ast_mwi_state *mwi_state, void *data)
The delegate called for each managed mailbox state.
Definition: mwi.h:301
void ast_mwi_state_callback_all(on_mwi_state handler, void *data)
For each managed mailbox call the given handler.
Definition: mwi.c:338
void ast_mwi_state_callback_subscribed(on_mwi_state handler, void *data)
For each managed mailbox that has a subscriber call the given handler.
Definition: mwi.c:348
struct ast_mwi_publisher * ast_mwi_add_publisher(const char *mailbox)
Add an MWI state publisher to the mailbox.
Definition: mwi.c:295
int ast_mwi_add_observer(struct ast_mwi_observer *observer)
Add an observer to receive MWI state related events.
Definition: mwi.c:301
struct ast_mwi_state * ast_mwi_create(const char *mailbox, const char *context)
Create a ast_mwi_state object.
Definition: mwi.c:152
int ast_delete_mwi_state_full(const char *mailbox, const char *context, struct ast_eid *eid)
Delete MWI state cached by stasis with all parameters.
Definition: mwi.c:404
int ast_mwi_publish(struct ast_mwi_publisher *publisher, int urgent_msgs, int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid)
Publish MWI for the given mailbox.
Definition: mwi.c:358
void ast_mwi_remove_observer(struct ast_mwi_observer *observer)
Remove an MWI state observer.
Definition: mwi.c:307
struct stasis_topic * ast_mwi_topic_cached(void)
Get the Stasis Message Bus API caching topic for MWI messages.
Definition: mwi.c:99
void * ast_mwi_unsubscribe_and_join(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic, block until the final message is received, and then unsubscribe fr...
Definition: mwi.c:259
struct stasis_topic * ast_mwi_topic_all(void)
Get the Stasis Message Bus API topic for MWI messages.
Definition: mwi.c:89
struct ast_mwi_subscriber * ast_mwi_subscribe_pool(const char *mailbox, stasis_subscription_cb callback, void *data)
Add an MWI state subscriber, and stasis subscription to the mailbox.
Definition: mwi.c:235
int ast_mwi_publish_by_mailbox(const char *mailbox, const char *context, int urgent_msgs, int new_msgs, int old_msgs, const char *channel_id, struct ast_eid *eid)
Publish MWI for the given mailbox.
Definition: mwi.c:375
struct stasis_topic * ast_mwi_subscriber_topic(struct ast_mwi_subscriber *sub)
Retrieves the MWI subscriber's topic.
Definition: mwi.c:264
struct ast_mwi_state * ast_mwi_subscriber_data(struct ast_mwi_subscriber *sub)
Retrieves the state data object associated with the MWI subscriber.
Definition: mwi.c:269
struct stasis_forward * sub
Definition: res_corosync.c:240
struct ast_sorcery_instance_observer observer
void(* stasis_subscription_cb)(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Callback function type for Stasis subscriptions.
Definition: stasis.h:611
Stasis State API.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Definition: stringfields.h:341
#define AST_STRING_FIELD(name)
Declare a string field.
Definition: stringfields.h:303
Structure representing a snapshot of channel state.
An Entity ID is essentially a MAC address, brief and unique.
Definition: utils.h:813
Abstract JSON element (object, array, string, int, ...).
Object that represents an MWI update with some additional application defined data.
Definition: mwi.h:471
struct ast_mwi_state * mwi_state
Definition: mwi.h:472
struct ast_json * blob
Definition: mwi.h:473
MWI state event interface.
Definition: mwi.h:248
void(* on_subscribe)(const char *mailbox, struct ast_mwi_subscriber *sub)
Raised when MWI is being subscribed.
Definition: mwi.h:255
void(* on_unsubscribe)(const char *mailbox, struct ast_mwi_subscriber *sub)
Raised when MWI is being unsubscribed.
Definition: mwi.h:263
The structure that contains MWI state.
Definition: mwi.h:455
int urgent_msgs
Definition: mwi.h:464
struct ast_channel_snapshot * snapshot
Definition: mwi.h:462
int old_msgs
Definition: mwi.h:460
int new_msgs
Definition: mwi.h:459
const ast_string_field uniqueid
Definition: mwi.h:458
struct ast_eid eid
Definition: mwi.h:463
static void handler(const char *name, int response_code, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
Definition: test_ari.c:59
Utility functions.