Asterisk - The Open Source Telephony Project  21.4.1
stasis_channels.h
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2013, Digium, Inc.
5  *
6  * Matt Jordan <mjordan@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 
20 #ifndef STASIS_CHANNELS_H_
21 #define STASIS_CHANNELS_H_
22 
23 #include "asterisk/stringfields.h"
24 #include "asterisk/stasis.h"
25 #include "asterisk/channel.h"
26 
27 /*! \addtogroup StasisTopicsAndMessages
28  * @{
29  */
30 
31 /*!
32  * \since 17
33  * \brief Channel snapshot invalidation flags, used to force generation of segments
34  */
36  /*! Invalidate the bridge segment */
38  /*! Invalidate the dialplan segment */
40  /*! Invalidate the connected segment */
42  /*! Invalidate the caller segment */
44  /*! Invalidate the hangup segment */
46  /*! Invalidate the peer segment */
48  /*! Invalidate the base segment */
50 };
51 
52 /*!
53  * \since 17
54  * \brief Structure containing bridge information for a channel snapshot.
55  */
57  char id[0]; /*!< Unique Bridge Identifier */
58 };
59 
60 /*!
61  * \since 17
62  * \brief Structure containing dialplan information for a channel snapshot.
63  */
66  AST_STRING_FIELD(appl); /*!< Current application */
67  AST_STRING_FIELD(data); /*!< Data passed to current application */
68  AST_STRING_FIELD(context); /*!< Current extension context */
69  AST_STRING_FIELD(exten); /*!< Current extension number */
70  );
71  int priority; /*!< Current extension priority */
72 };
73 
74 /*!
75  * \since 17
76  * \brief Structure containing caller information for a channel snapshot.
77  */
80  AST_STRING_FIELD(name); /*!< Caller ID Name */
81  AST_STRING_FIELD(number); /*!< Caller ID Number */
82  AST_STRING_FIELD(dnid); /*!< Dialed ID Number */
83  AST_STRING_FIELD(dialed_subaddr); /*!< Dialed subaddress */
84  AST_STRING_FIELD(ani); /*!< Caller ID ANI Number */
85  AST_STRING_FIELD(rdnis); /*!< Caller ID RDNIS Number */
86  AST_STRING_FIELD(subaddr); /*!< Caller subaddress */
87  );
88  int pres; /*!< Caller ID presentation. */
89 };
90 
91 /*!
92  * \since 17
93  * \brief Structure containing connected information for a channel snapshot.
94  */
96  char *number; /*!< Connected Line Number */
97  char name[0]; /*!< Connected Line Name */
98 };
99 
100 /*!
101  * \since 17
102  * \brief Structure containing base information for a channel snapshot.
103  */
106  AST_STRING_FIELD(name); /*!< ASCII unique channel name */
107  AST_STRING_FIELD(uniqueid); /*!< Unique Channel Identifier */
108  AST_STRING_FIELD(accountcode); /*!< Account code for billing */
109  AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */
110  AST_STRING_FIELD(language); /*!< The default spoken language for the channel */
111  AST_STRING_FIELD(type); /*!< Type of channel technology */
112  );
113  struct timeval creationtime; /*!< The time of channel creation */
114  int tech_properties; /*!< Properties of the channel's technology */
115  AST_STRING_FIELD_EXTENDED(protocol_id); /*!< Channel driver protocol id (i.e. Call-ID for chan_pjsip) */
116 };
117 
118 /*!
119  * \since 17
120  * \brief Structure containing peer information for a channel snapshot.
121  */
123  char *linkedid; /*!< Linked Channel Identifier -- gets propagated by linkage */
124  char account[0]; /*!< Peer account code for billing */
125 };
126 
127 /*!
128  * \since 17
129  * \brief Structure containing hangup information for a channel snapshot.
130  */
132  int cause; /*!< Why is the channel hanged up. See causes.h */
133  char source[0]; /*!< Who is responsible for hanging up this channel */
134 };
135 
136 /*!
137  * \since 12
138  * \brief Structure representing a snapshot of channel state.
139  *
140  * While not enforced programmatically, this object is shared across multiple
141  * threads, and should be treated as an immutable object.
142  *
143  * It is guaranteed that the segments of this snapshot will always exist
144  * when accessing the snapshot.
145  */
147  struct ast_channel_snapshot_base *base; /*!< Base information about the channel */
148  struct ast_channel_snapshot_peer *peer; /*!< Peer information */
149  struct ast_channel_snapshot_caller *caller; /*!< Information about the caller */
150  struct ast_channel_snapshot_connected *connected; /*!< Information about who this channel is connected to */
151  struct ast_channel_snapshot_bridge *bridge; /*!< Information about the bridge */
152  struct ast_channel_snapshot_dialplan *dialplan; /*!< Information about the dialplan */
153  struct ast_channel_snapshot_hangup *hangup; /*!< Hangup information */
154  enum ast_channel_state state; /*!< State of line */
155  int amaflags; /*!< AMA flags for billing */
156  struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */
157  struct ast_flags softhangup_flags; /*!< softhangup channel flags */
158  struct varshead *manager_vars; /*!< Variables to be appended to manager events */
159  struct varshead *ari_vars; /*!< Variables to be appended to ARI events */
160 };
161 
162 /*!
163  * \since 17
164  * \brief Structure representing a change of snapshot of channel state.
165  *
166  * While not enforced programmatically, this object is shared across multiple
167  * threads, and should be treated as an immutable object.
168  *
169  * \note This structure will not have a transition of an old snapshot with no
170  * new snapshot to indicate that a channel has gone away. A new snapshot will
171  * always exist and a channel going away can be determined by checking for the
172  * AST_FLAG_DEAD flag on the new snapshot.
173  */
175  struct ast_channel_snapshot *old_snapshot; /*!< The old channel snapshot */
176  struct ast_channel_snapshot *new_snapshot; /*!< The new channel snapshot */
177 };
178 
179 /*!
180  * \since 12
181  * \brief Blob of data associated with a channel.
182  *
183  * This blob is actually shared amongst several \ref stasis_message_type's.
184  */
186  /*! Channel blob is associated with (or NULL for global/all channels) */
188  /*! JSON blob of data */
189  struct ast_json *blob;
190 };
191 
192 /*!
193  * \since 12
194  * \brief A set of channels with blob objects - see \ref ast_channel_blob
195  */
197 
198 struct ao2_container *ast_channel_cache_all(void);
199 
200 /*!
201  * \since 12
202  * \brief A topic which publishes the events for all channels.
203  * \return Topic for all channel events.
204  */
205 struct stasis_topic *ast_channel_topic_all(void);
206 
207 /*!
208  * \since 12
209  * \brief Secondary channel cache, indexed by name.
210  *
211  * \return Cache of \ref ast_channel_snapshot.
212  */
214 
215 /*!
216  * \since 12
217  * \brief Message type for \ref ast_channel_snapshot_update.
218  *
219  * \return Message type for \ref ast_channel_snapshot_update.
220  */
222 
223 /*!
224  * \since 12
225  * \brief Generate a snapshot of the channel state. This is an ao2 object, so
226  * ao2_cleanup() to deallocate.
227  *
228  * \pre chan is locked
229  *
230  * \param chan The channel from which to generate a snapshot
231  *
232  * \return pointer on success (must be unreffed)
233  * \retval NULL on error
234  */
236  struct ast_channel *chan);
237 
238 /*!
239  * \since 12
240  * \brief Obtain the latest \ref ast_channel_snapshot from the \ref stasis cache. This is
241  * an ao2 object, so use \ref ao2_cleanup() to deallocate.
242  *
243  * \param uniqueid The channel's unique ID
244  *
245  * \return A \ref ast_channel_snapshot on success
246  * \retval NULL on error
247  */
248 struct ast_channel_snapshot *ast_channel_snapshot_get_latest(const char *uniqueid);
249 
250 /*!
251  * \since 12
252  * \brief Obtain the latest \ref ast_channel_snapshot from the \ref stasis cache. This is
253  * an ao2 object, so use \ref ao2_cleanup() to deallocate.
254  *
255  * \param name The channel's name
256  *
257  * \return A \ref ast_channel_snapshot on success
258  * \retval NULL on error
259  */
261 
262 /*!
263  * \since 17
264  * \brief Send the final channel snapshot for a channel, thus removing it from cache
265  *
266  * \pre chan is locked
267  *
268  * \param chan The channel to send the final channel snapshot for
269  *
270  * \note This will also remove the cached snapshot from the channel itself
271  */
273 
274 /*!
275  * \since 12
276  * \brief Creates a \ref ast_channel_blob message.
277  *
278  * The given \a blob should be treated as immutable and not modified after it is
279  * put into the message.
280  *
281  * \pre chan is locked
282  *
283  * \param chan Channel blob is associated with, or \c NULL for global/all channels.
284  * \param type Message type for this blob.
285  * \param blob JSON object representing the data, or \c NULL for no data. If
286  * \c NULL, ast_json_null() is put into the object.
287  *
288  * \return \ref ast_channel_blob message.
289  * \retval NULL on error
290  */
292  struct stasis_message_type *type, struct ast_json *blob);
293 
294 /*!
295  * \since 12
296  * \brief Create a \ref ast_channel_blob message, pulling channel state from
297  * the cache.
298  *
299  * \param uniqueid Uniqueid of the channel.
300  * \param type Message type for this blob.
301  * \param blob JSON object representing the data, or \c NULL for no data. If
302  * \c NULL, ast_json_null() is put into the object.
303  *
304  * \return \ref ast_channel_blob message.
305  * \retval NULL on error
306  */
308  const char *uniqueid, struct stasis_message_type *type,
309  struct ast_json *blob);
310 
311 /*!
312  * \since 12
313  * \brief Create a \ref ast_multi_channel_blob suitable for a \ref stasis_message.
314  *
315  * The given \a blob should be treated as immutable and not modified after it is
316  * put into the message.
317  *
318  * \param blob The JSON blob that defines the data of this \ref ast_multi_channel_blob
319  *
320  * \return \ref ast_multi_channel_blob object
321  * \retval NULL on error
322 */
324 
325 /*!
326  * \since 12
327  * \brief Retrieve a channel snapshot associated with a specific role from a
328  * \ref ast_multi_channel_blob
329  *
330  * \note The reference count of the \ref ast_channel_snapshot returned from
331  * this function is not changed. The caller of this function does not own the
332  * reference to the snapshot.
333  *
334  * \param obj The \ref ast_multi_channel_blob containing the channel snapshot
335  * to retrieve
336  * \param role The role associated with the channel snapshot
337  *
338  * \return \ref ast_channel_snapshot matching the role on success
339  * \retval NULL on error or not found for the role specified
340  */
342  struct ast_multi_channel_blob *obj, const char *role);
343 
344 /*!
345  * \since 12
346  * \brief Retrieve all channel snapshots associated with a specific role from
347  * a \ref ast_multi_channel_blob
348  *
349  * \note Because this function returns an ao2_container (hashed by channel name)
350  * of all channel snapshots that matched the passed in role, the reference of
351  * the snapshots is increased by this function. The caller of this function must
352  * release the reference to the snapshots by disposing of the container
353  * appropriately.
354  *
355  * \param obj The \ref ast_multi_channel_blob containing the channel snapshots to
356  * retrieve
357  * \param role The role associated with the channel snapshots
358  *
359  * \return A container containing all \ref ast_channel_snapshot objects matching
360  * the role on success.
361  * \retval NULL on error or not found for the role specified
362  */
364  struct ast_multi_channel_blob *obj, const char *role);
365 
366 /*!
367  * \since 12
368  * \brief Retrieve the JSON blob from a \ref ast_multi_channel_blob.
369  * Returned \ref ast_json is still owned by \a obj
370  *
371  * \param obj Channel blob object.
372  * \return Type field value from the blob.
373  * \retval NULL on error.
374  */
376 
377 /*!
378  * \since 12
379  * \brief Add a \ref ast_channel_snapshot to a \ref ast_multi_channel_blob object
380  *
381  * \note This will increase the reference count by 1 for the channel snapshot. It is
382  * assumed that the \ref ast_multi_channel_blob will own a reference to the object.
383  *
384  * \param obj The \ref ast_multi_channel_blob object that will reference the snapshot
385  * \param role A \a role that the snapshot has in the multi channel relationship
386  * \param snapshot The \ref ast_channel_snapshot being added to the
387  * \ref ast_multi_channel_blob object
388  */
390  const char *role, struct ast_channel_snapshot *snapshot);
391 
392 /*!
393  * \brief Publish a channel blob message.
394  * \since 12.0.0
395  *
396  * \pre chan is locked
397  *
398  * \param chan Channel publishing the blob.
399  * \param type Type of stasis message.
400  * \param blob The blob being published. (NULL if no blob)
401  *
402  * \note This will use the current snapshot on the channel and will not generate a new one.
403  */
404 void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type,
405  struct ast_json *blob);
406 
407 /*!
408  * \brief Publish a channel blob message using the latest snapshot from the cache
409  * \since 12.4.0
410  *
411  * \param chan Channel publishing the blob.
412  * \param type Type of stasis message.
413  * \param blob The blob being published. (NULL if no blob)
414  *
415  * \note As this only accesses the uniqueid and topic of the channel - neither of
416  * which should ever be changed on a channel anyhow - a channel does not have to
417  * be locked when calling this function.
418  */
419 void ast_channel_publish_cached_blob(struct ast_channel *chan, struct stasis_message_type *type,
420  struct ast_json *blob);
421 
422 /*!
423  * \since 12
424  * \brief Set flag to indicate channel snapshot is being staged.
425  *
426  * \pre chan is locked
427  *
428  * \param chan Channel being staged.
429  */
430 void ast_channel_stage_snapshot(struct ast_channel *chan);
431 
432 /*!
433  * \since 12
434  * \brief Clear flag to indicate channel snapshot is being staged, and publish snapshot.
435  *
436  * \pre chan is locked
437  *
438  * \param chan Channel being staged.
439  */
441 
442 /*!
443  * \since 17
444  * \brief Invalidate a channel snapshot segment from being reused
445  *
446  * \pre chan is locked
447  *
448  * \param chan Channel to invalidate the segment on.
449  * \param segment The segment to invalidate.
450  */
453 
454 /*!
455  * \since 12
456  * \brief Publish a \ref ast_channel_snapshot for a channel.
457  *
458  * \pre chan is locked
459  *
460  * \param chan Channel to publish.
461  */
462 void ast_channel_publish_snapshot(struct ast_channel *chan);
463 
464 /*!
465  * \since 12
466  * \brief Publish a \ref ast_channel_publish_varset for a channel.
467  *
468  * \pre chan is locked
469  *
470  * \param chan Channel to publish the event for, or \c NULL for 'none'.
471  * \param variable Name of the variable being set
472  * \param value Value.
473  */
474 void ast_channel_publish_varset(struct ast_channel *chan,
475  const char *variable, const char *value);
476 
477 /*!
478  * \since 12
479  * \brief Message type for when a channel dials another channel
480  *
481  * \return A stasis message type
482  */
484 
485 /*!
486  * \since 12
487  * \brief Message type for when a variable is set on a channel.
488  *
489  * \return A stasis message type
490  */
492 
493 /*!
494  * \since 12
495  * \brief Message type for when a hangup is requested on a channel.
496  *
497  * \return A stasis message type
498  */
500 
501 /*!
502  * \since 16
503  * \brief Message type for when a channel is being masqueraded
504  *
505  * \return A stasis message type
506  */
508 
509 /*!
510  * \since 12
511  * \brief Message type for when DTMF begins on a channel.
512  *
513  * \return A stasis message type
514  */
516 
517 /*!
518  * \since 12
519  * \brief Message type for when DTMF ends on a channel.
520  *
521  * \return A stasis message type
522  */
524 
525 /*!
526  * \brief Message type for when a hook flash occurs on a channel.
527  *
528  * \return A stasis message type
529  */
531 
532 /*!
533  * \brief Message type for when a wink occurs on a channel.
534  *
535  * \return A stasis message type
536  */
538 
539 /*!
540  * \since 12
541  * \brief Message type for when a channel is placed on hold.
542  *
543  * \return A stasis message type
544  */
546 
547 /*!
548  * \since 12
549  * \brief Message type for when a channel is removed from hold.
550  *
551  * \return A stasis message type
552  */
554 
555 /*!
556  * \since 12
557  * \brief Message type for when a channel starts spying on another channel
558  *
559  * \return A stasis message type
560  */
562 
563 /*!
564  * \since 12
565  * \brief Message type for when a channel stops spying on another channel
566  *
567  * \return A stasis message type
568  */
570 
571 /*!
572  * \since 12
573  * \brief Message type for a fax operation
574  *
575  * \return A stasis message type
576  */
578 
579 /*!
580  * \since 12
581  * \brief Message type for hangup handler related actions
582  *
583  * \return A stasis message type
584  */
586 
587 /*!
588  * \since 18
589  * \brief Message type for starting mixmonitor on a channel
590  *
591  * \return A stasis message type
592  */
594 
595 /*!
596  * \since 18
597  * \brief Message type for stopping mixmonitor on a channel
598  *
599  * \return A stasis message type
600  */
602 
603 /*!
604  * \since 18
605  * \brief Message type for muting or unmuting mixmonitor on a channel
606  *
607  * \return A stasis message type
608  */
610 
611 /*!
612  * \since 18.0.0
613  * \brief Message type for agent login on a channel
614  *
615  * \return A stasis message type
616  */
618 
619 /*!
620  * \since 12.0.0
621  * \brief Message type for agent logoff on a channel
622  *
623  * \return A stasis message type
624  */
626 
627 /*!
628  * \since 12
629  * \brief Message type for starting music on hold on a channel
630  *
631  * \return A stasis message type
632  */
634 
635 /*!
636  * \since 12
637  * \brief Message type for stopping music on hold on a channel
638  *
639  * \return A stasis message type
640  */
642 
643 /*!
644  * \since 12.4.0
645  * \brief Message type for a channel starting talking
646  *
647  * \return A stasis message type
648  */
650 
651 /*!
652  * \since 12.4.0
653  * \brief Message type for a channel stopping talking
654  *
655  * \return A stasis message type
656  */
658 
659 /*!
660  * \since 12
661  * \brief Publish in the \ref ast_channel_topic or \ref ast_channel_topic_all
662  * topics a stasis message for the channels involved in a dial operation.
663  *
664  * \param caller The channel performing the dial operation
665  * \param peer The channel being dialed
666  * \param dialstring When beginning a dial, the information passed to the
667  * dialing application
668  * \param dialstatus The current status of the dial operation (NULL if no
669  * status is known)
670  */
671 void ast_channel_publish_dial(struct ast_channel *caller,
672  struct ast_channel *peer,
673  const char *dialstring,
674  const char *dialstatus);
675 
676 /*!
677  * \since 12
678  * \brief Publish in the \ref ast_channel_topic or \ref ast_channel_topic_all
679  * topics a stasis message for the channels involved in a dial operation that
680  * is forwarded.
681  *
682  * \param caller The channel performing the dial operation
683  * \param peer The channel being dialed
684  * \param forwarded The channel created as a result of the call forwarding
685  * \param dialstring The information passed to the dialing application when beginning a dial
686  * \param dialstatus The current status of the dial operation
687  * \param forward The call forward string provided by the dialed channel
688  */
690  struct ast_channel *peer,
691  struct ast_channel *forwarded,
692  const char *dialstring,
693  const char *dialstatus,
694  const char *forward);
695 
696 /*! @} */
697 
698 /*!
699  * \brief Build a JSON object from a \ref ast_channel_snapshot.
700  *
701  * \param snapshot The snapshot to convert to JSON
702  * \param sanitize The message sanitizer to use on the snapshot
703  *
704  * \return JSON object representing channel snapshot.
705  * \retval NULL on error
706  */
707 struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot,
708  const struct stasis_message_sanitizer *sanitize);
709 
710 /*!
711  * \brief Compares the context, exten and priority of two snapshots.
712  * \since 12
713  *
714  * \param old_snapshot Old snapshot
715  * \param new_snapshot New snapshot
716  *
717  * \retval True (non-zero) if context, exten or priority are identical.
718  * \retval False (zero) if context, exten and priority changed.
719  */
721  const struct ast_channel_snapshot *old_snapshot,
722  const struct ast_channel_snapshot *new_snapshot);
723 
724 /*!
725  * \brief Compares the callerid info of two snapshots.
726  * \since 12
727  *
728  * \param old_snapshot Old snapshot
729  * \param new_snapshot New snapshot
730  *
731  * \retval True (non-zero) if callerid are identical.
732  * \retval False (zero) if callerid changed.
733  */
735  const struct ast_channel_snapshot *old_snapshot,
736  const struct ast_channel_snapshot *new_snapshot);
737 
738 /*!
739  * \brief Compares the connected line info of two snapshots.
740  * \since 13.1.0
741  *
742  * \param old_snapshot Old snapshot
743  * \param new_snapshot New snapshot
744  *
745  * \retval True (non-zero) if callerid are identical.
746  * \retval False (zero) if callerid changed.
747  */
749  const struct ast_channel_snapshot *old_snapshot,
750  const struct ast_channel_snapshot *new_snapshot);
751 
752 /*!
753  * \brief Initialize the stasis channel topic and message types
754  * \retval 0 on success
755  * \retval Non-zero on error
756  */
757 int ast_stasis_channels_init(void);
758 
759 #endif /* STASIS_CHANNELS_H_ */
struct stasis_message_type * ast_channel_hold_type(void)
Message type for when a channel is placed on hold.
struct ao2_container * ast_channel_cache_by_name(void)
Secondary channel cache, indexed by name.
struct stasis_message_type * ast_channel_talking_stop(void)
Message type for a channel stopping talking.
const ast_string_field data
Main Channel structure associated with a channel.
struct ast_channel_snapshot_base * base
struct stasis_message_type * ast_channel_dtmf_end_type(void)
Message type for when DTMF ends on a channel.
struct stasis_message_type * ast_channel_unhold_type(void)
Message type for when a channel is removed from hold.
struct ast_json * blob
int ast_channel_snapshot_cep_equal(const struct ast_channel_snapshot *old_snapshot, const struct ast_channel_snapshot *new_snapshot)
Compares the context, exten and priority of two snapshots.
void ast_channel_snapshot_invalidate_segment(struct ast_channel *chan, enum ast_channel_snapshot_segment_invalidation segment)
Invalidate a channel snapshot segment from being reused.
const ast_string_field name
void ast_channel_publish_cached_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message using the latest snapshot from the cache.
void ast_channel_publish_dial(struct ast_channel *caller, struct ast_channel *peer, const char *dialstring, const char *dialstatus)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
struct ast_json * blob
struct ast_channel_snapshot * snapshot
struct stasis_message_type * ast_channel_moh_start_type(void)
Message type for starting music on hold on a channel.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
const ast_string_field rdnis
AST_STRING_FIELD_EXTENDED(protocol_id)
Structure representing a snapshot of channel state.
struct stasis_message_type * ast_channel_wink_type(void)
Message type for when a wink occurs on a channel.
ast_channel_state
ast_channel states
Definition: channelstate.h:35
const ast_string_field accountcode
struct stasis_message_type * ast_channel_flash_type(void)
Message type for when a hook flash occurs on a channel.
const ast_string_field uniqueid
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Definition: stringfields.h:341
struct stasis_message_type * ast_channel_varset_type(void)
Message type for when a variable is set on a channel.
struct stasis_message_type * ast_channel_chanspy_start_type(void)
Message type for when a channel starts spying on another channel.
Structure containing connected information for a channel snapshot.
Structure representing a change of snapshot of channel state.
const ast_string_field type
struct stasis_message_type * ast_channel_talking_start(void)
Message type for a channel starting talking.
struct ast_channel_snapshot_dialplan * dialplan
Structure containing callbacks for Stasis message sanitization.
Definition: stasis.h:200
struct ast_channel_snapshot * ast_channel_snapshot_create(struct ast_channel *chan)
Generate a snapshot of the channel state. This is an ao2 object, so ao2_cleanup() to deallocate...
struct ast_json * ast_multi_channel_blob_get_json(struct ast_multi_channel_blob *obj)
Retrieve the JSON blob from a ast_multi_channel_blob. Returned ast_json is still owned by obj...
Blob of data associated with a channel.
int ast_channel_snapshot_caller_id_equal(const struct ast_channel_snapshot *old_snapshot, const struct ast_channel_snapshot *new_snapshot)
Compares the callerid info of two snapshots.
Number structure.
Definition: app_followme.c:154
const ast_string_field dialed_subaddr
ast_channel_snapshot_segment_invalidation
Channel snapshot invalidation flags, used to force generation of segments.
struct stasis_message_type * type
const ast_string_field context
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
struct varshead * ari_vars
struct ast_channel_snapshot * ast_channel_snapshot_get_latest_by_name(const char *name)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object...
Structure containing hangup information for a channel snapshot.
General Asterisk PBX channel definitions.
const ast_string_field appl
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
int ast_stasis_channels_init(void)
Initialize the stasis channel topic and message types.
void ast_multi_channel_blob_add_channel(struct ast_multi_channel_blob *obj, const char *role, struct ast_channel_snapshot *snapshot)
Add a ast_channel_snapshot to a ast_multi_channel_blob object.
#define AST_STRING_FIELD(name)
Declare a string field.
Definition: stringfields.h:303
Structure containing dialplan information for a channel snapshot.
const ast_string_field subaddr
const ast_string_field exten
struct ast_channel_snapshot_hangup * hangup
struct stasis_message_type * ast_channel_agent_login_type(void)
Message type for agent login on a channel.
struct stasis_message_type * ast_channel_agent_logoff_type(void)
Message type for agent logoff on a channel.
struct ao2_container * ast_multi_channel_blob_get_channels(struct ast_multi_channel_blob *obj, const char *role)
Retrieve all channel snapshots associated with a specific role from a ast_multi_channel_blob.
struct ast_channel_snapshot_caller * caller
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
struct ast_flags softhangup_flags
struct stasis_message_type * ast_channel_mixmonitor_start_type(void)
Message type for starting mixmonitor on a channel.
struct varshead * manager_vars
struct stasis_message_type * ast_channel_mixmonitor_stop_type(void)
Message type for stopping mixmonitor on a channel.
const ast_string_field dnid
Structure containing peer information for a channel snapshot.
void ast_channel_publish_varset(struct ast_channel *chan, const char *variable, const char *value)
Publish a ast_channel_publish_varset for a channel.
void ast_channel_publish_final_snapshot(struct ast_channel *chan)
Send the final channel snapshot for a channel, thus removing it from cache.
Structure containing caller information for a channel snapshot.
Structure containing base information for a channel snapshot.
struct stasis_message * ast_channel_blob_create(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Creates a ast_channel_blob message.
void ast_channel_publish_dial_forward(struct ast_channel *caller, struct ast_channel *peer, struct ast_channel *forwarded, const char *dialstring, const char *dialstatus, const char *forward)
Publish in the ast_channel_topic or ast_channel_topic_all topics a stasis message for the channels in...
const ast_string_field userfield
struct stasis_message_type * ast_channel_hangup_handler_type(void)
Message type for hangup handler related actions.
struct ast_channel_snapshot * new_snapshot
enum ast_channel_state state
struct stasis_message_type * ast_channel_snapshot_type(void)
Message type for ast_channel_snapshot_update.
struct ast_channel_snapshot * old_snapshot
struct stasis_message_type * ast_channel_dtmf_begin_type(void)
Message type for when DTMF begins on a channel.
Structure used to handle boolean flags.
Definition: utils.h:199
struct stasis_message * ast_channel_blob_create_from_cache(const char *uniqueid, struct stasis_message_type *type, struct ast_json *blob)
Create a ast_channel_blob message, pulling channel state from the cache.
const ast_string_field ani
const ast_string_field language
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object...
struct ast_flags flags
struct ast_channel_snapshot * ast_multi_channel_blob_get_channel(struct ast_multi_channel_blob *obj, const char *role)
Retrieve a channel snapshot associated with a specific role from a ast_multi_channel_blob.
struct ast_channel_snapshot_bridge * bridge
A multi channel blob data structure for multi_channel_blob stasis messages.
Abstract JSON element (object, array, string, int, ...).
struct stasis_message_type * ast_channel_dial_type(void)
Message type for when a channel dials another channel.
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
Generic container type.
int ast_channel_snapshot_connected_line_equal(const struct ast_channel_snapshot *old_snapshot, const struct ast_channel_snapshot *new_snapshot)
Compares the connected line info of two snapshots.
void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message.
struct stasis_message_type * ast_channel_moh_stop_type(void)
Message type for stopping music on hold on a channel.
struct ast_json * ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot, const struct stasis_message_sanitizer *sanitize)
Build a JSON object from a ast_channel_snapshot.
struct ast_channel_snapshot_peer * peer
struct stasis_message_type * ast_channel_hangup_request_type(void)
Message type for when a hangup is requested on a channel.
struct stasis_message_type * ast_channel_masquerade_type(void)
Message type for when a channel is being masqueraded.
struct stasis_message_type * ast_channel_fax_type(void)
Message type for a fax operation.
Structure containing bridge information for a channel snapshot.
struct ast_channel_snapshot_connected * connected
struct ast_multi_channel_blob * ast_multi_channel_blob_create(struct ast_json *blob)
Create a ast_multi_channel_blob suitable for a stasis_message.
struct stasis_message_type * ast_channel_chanspy_stop_type(void)
Message type for when a channel stops spying on another channel.
const ast_string_field name
struct stasis_message_type * ast_channel_mixmonitor_mute_type(void)
Message type for muting or unmuting mixmonitor on a channel.