Asterisk - The Open Source Telephony Project  GIT-master-e8cda4b
stasis_channels.h
Go to the documentation of this file.
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 };
116 
117 /*!
118  * \since 17
119  * \brief Structure containing peer information for a channel snapshot.
120  */
122  char *linkedid; /*!< Linked Channel Identifier -- gets propagated by linkage */
123  char account[0]; /*!< Peer account code for billing */
124 };
125 
126 /*!
127  * \since 17
128  * \brief Structure containing hangup information for a channel snapshot.
129  */
131  int cause; /*!< Why is the channel hanged up. See causes.h */
132  char source[0]; /*!< Who is responsible for hanging up this channel */
133 };
134 
135 /*!
136  * \since 12
137  * \brief Structure representing a snapshot of channel state.
138  *
139  * While not enforced programmatically, this object is shared across multiple
140  * threads, and should be treated as an immutable object.
141  *
142  * It is guaranteed that the segments of this snapshot will always exist
143  * when accessing the snapshot.
144  */
146  struct ast_channel_snapshot_base *base; /*!< Base information about the channel */
147  struct ast_channel_snapshot_peer *peer; /*!< Peer information */
148  struct ast_channel_snapshot_caller *caller; /*!< Information about the caller */
149  struct ast_channel_snapshot_connected *connected; /*!< Information about who this channel is connected to */
150  struct ast_channel_snapshot_bridge *bridge; /*!< Information about the bridge */
151  struct ast_channel_snapshot_dialplan *dialplan; /*!< Information about the dialplan */
152  struct ast_channel_snapshot_hangup *hangup; /*!< Hangup information */
153  enum ast_channel_state state; /*!< State of line */
154  int amaflags; /*!< AMA flags for billing */
155  struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */
156  struct ast_flags softhangup_flags; /*!< softhangup channel flags */
157  struct varshead *manager_vars; /*!< Variables to be appended to manager events */
158  struct varshead *ari_vars; /*!< Variables to be appended to ARI events */
159 };
160 
161 /*!
162  * \since 17
163  * \brief Structure representing a change of snapshot of channel state.
164  *
165  * While not enforced programmatically, this object is shared across multiple
166  * threads, and should be treated as an immutable object.
167  *
168  * \note This structure will not have a transition of an old snapshot with no
169  * new snapshot to indicate that a channel has gone away. A new snapshot will
170  * always exist and a channel going away can be determined by checking for the
171  * AST_FLAG_DEAD flag on the new snapshot.
172  */
174  struct ast_channel_snapshot *old_snapshot; /*!< The old channel snapshot */
175  struct ast_channel_snapshot *new_snapshot; /*!< The new channel snapshot */
176 };
177 
178 /*!
179  * \since 12
180  * \brief Blob of data associated with a channel.
181  *
182  * This blob is actually shared amongst several \ref stasis_message_type's.
183  */
185  /*! Channel blob is associated with (or NULL for global/all channels) */
187  /*! JSON blob of data */
188  struct ast_json *blob;
189 };
190 
191 /*!
192  * \since 12
193  * \brief A set of channels with blob objects - see \ref ast_channel_blob
194  */
196 
198 
199 /*!
200  * \since 12
201  * \brief A topic which publishes the events for all channels.
202  * \retval Topic for all channel events.
203  */
204 struct stasis_topic *ast_channel_topic_all(void);
205 
206 /*!
207  * \since 12
208  * \brief Secondary channel cache, indexed by name.
209  *
210  * \retval Cache of \ref ast_channel_snapshot.
211  */
213 
214 /*!
215  * \since 12
216  * \brief Message type for \ref ast_channel_snapshot_update.
217  *
218  * \retval Message type for \ref ast_channel_snapshot_update.
219  */
221 
222 /*!
223  * \since 12
224  * \brief Generate a snapshot of the channel state. This is an ao2 object, so
225  * ao2_cleanup() to deallocate.
226  *
227  * \pre chan is locked
228  *
229  * \param chan The channel from which to generate a snapshot
230  *
231  * \retval pointer on success (must be unreffed)
232  * \retval NULL on error
233  */
235  struct ast_channel *chan);
236 
237 /*!
238  * \since 12
239  * \brief Obtain the latest \ref ast_channel_snapshot from the \ref stasis cache. This is
240  * an ao2 object, so use \ref ao2_cleanup() to deallocate.
241  *
242  * \param unique_id The channel's unique ID
243  *
244  * \retval A \ref ast_channel_snapshot on success
245  * \retval NULL on error
246  */
247 struct ast_channel_snapshot *ast_channel_snapshot_get_latest(const char *uniqueid);
248 
249 /*!
250  * \since 12
251  * \brief Obtain the latest \ref ast_channel_snapshot from the \ref stasis cache. This is
252  * an ao2 object, so use \ref ao2_cleanup() to deallocate.
253  *
254  * \param name The channel's name
255  *
256  * \retval A \ref ast_channel_snapshot on success
257  * \retval NULL on error
258  */
260 
261 /*!
262  * \since 17
263  * \brief Send the final channel snapshot for a channel, thus removing it from cache
264  *
265  * \pre chan is locked
266  *
267  * \param chan The channel to send the final channel snapshot for
268  *
269  * \note This will also remove the cached snapshot from the channel itself
270  */
272 
273 /*!
274  * \since 12
275  * \brief Creates a \ref ast_channel_blob message.
276  *
277  * The given \a blob should be treated as immutable and not modified after it is
278  * put into the message.
279  *
280  * \pre chan is locked
281  *
282  * \param chan Channel blob is associated with, or \c NULL for global/all channels.
283  * \param type Message type for this blob.
284  * \param blob JSON object representing the data, or \c NULL for no data. If
285  * \c NULL, ast_json_null() is put into the object.
286  *
287  * \return \ref ast_channel_blob message.
288  * \return \c NULL on error
289  */
291  struct stasis_message_type *type, struct ast_json *blob);
292 
293 /*!
294  * \since 12
295  * \brief Create a \ref ast_channel_blob message, pulling channel state from
296  * the cache.
297  *
298  * \param uniqueid Uniqueid of the channel.
299  * \param type Message type for this blob.
300  * \param blob JSON object representing the data, or \c NULL for no data. If
301  * \c NULL, ast_json_null() is put into the object.
302  *
303  * \return \ref ast_channel_blob message.
304  * \return \c NULL on error
305  */
307  const char *uniqueid, struct stasis_message_type *type,
308  struct ast_json *blob);
309 
310 /*!
311  * \since 12
312  * \brief Create a \ref ast_multi_channel_blob suitable for a \ref stasis_message.
313  *
314  * The given \a blob should be treated as immutable and not modified after it is
315  * put into the message.
316  *
317  * \param blob The JSON blob that defines the data of this \ref ast_multi_channel_blob
318  *
319  * \return \ref ast_multi_channel_blob object
320  * \return \c NULL on error
321 */
323 
324 /*!
325  * \since 12
326  * \brief Retrieve a channel snapshot associated with a specific role from a
327  * \ref ast_multi_channel_blob
328  *
329  * \note The reference count of the \ref ast_channel_snapshot returned from
330  * this function is not changed. The caller of this function does not own the
331  * reference to the snapshot.
332  *
333  * \param obj The \ref ast_multi_channel_blob containing the channel snapshot
334  * to retrieve
335  * \param role The role associated with the channel snapshot
336  *
337  * \retval \ref ast_channel_snapshot matching the role on success
338  * \retval NULL on error or not found for the role specified
339  */
341  struct ast_multi_channel_blob *obj, const char *role);
342 
343 /*!
344  * \since 12
345  * \brief Retrieve all channel snapshots associated with a specific role from
346  * a \ref ast_multi_channel_blob
347  *
348  * \note Because this function returns an ao2_container (hashed by channel name)
349  * of all channel snapshots that matched the passed in role, the reference of
350  * the snapshots is increased by this function. The caller of this function must
351  * release the reference to the snapshots by disposing of the container
352  * appropriately.
353  *
354  * \param obj The \ref ast_multi_channel_blob containing the channel snapshots to
355  * retrieve
356  * \param role The role associated with the channel snapshots
357  *
358  * \retval A container containing all \ref ast_channel_snapshot objects matching
359  * the role on success.
360  * \retval NULL on error or not found for the role specified
361  */
363  struct ast_multi_channel_blob *obj, const char *role);
364 
365 /*!
366  * \since 12
367  * \brief Retrieve the JSON blob from a \ref ast_multi_channel_blob.
368  * Returned \ref ast_json is still owned by \a obj
369  *
370  * \param obj Channel blob object.
371  * \return Type field value from the blob.
372  * \return \c NULL on error.
373  */
375 
376 /*!
377  * \since 12
378  * \brief Add a \ref ast_channel_snapshot to a \ref ast_multi_channel_blob object
379  *
380  * \note This will increase the reference count by 1 for the channel snapshot. It is
381  * assumed that the \ref ast_multi_channel_blob will own a reference to the object.
382  *
383  * \param obj The \ref ast_multi_channel_blob object that will reference the snapshot
384  * \param role A \a role that the snapshot has in the multi channel relationship
385  * \param snapshot The \ref ast_channel_snapshot being added to the
386  * \ref ast_multi_channel_blob object
387  */
389  const char *role, struct ast_channel_snapshot *snapshot);
390 
391 /*!
392  * \brief Publish a channel blob message.
393  * \since 12.0.0
394  *
395  * \pre chan is locked
396  *
397  * \param chan Channel publishing the blob.
398  * \param type Type of stasis message.
399  * \param blob The blob being published. (NULL if no blob)
400  *
401  * \note This will use the current snapshot on the channel and will not generate a new one.
402  *
403  * \return Nothing
404  */
406  struct ast_json *blob);
407 
408 /*!
409  * \brief Publish a channel blob message using the latest snapshot from the cache
410  * \since 12.4.0
411  *
412  * \param chan Channel publishing the blob.
413  * \param type Type of stasis message.
414  * \param blob The blob being published. (NULL if no blob)
415  *
416  * \note As this only accesses the uniqueid and topic of the channel - neither of
417  * which should ever be changed on a channel anyhow - a channel does not have to
418  * be locked when calling this function.
419  *
420  * \return Nothing
421  */
423  struct ast_json *blob);
424 
425 /*!
426  * \since 12
427  * \brief Set flag to indicate channel snapshot is being staged.
428  *
429  * \pre chan is locked
430  *
431  * \param chan Channel being staged.
432  */
433 void ast_channel_stage_snapshot(struct ast_channel *chan);
434 
435 /*!
436  * \since 12
437  * \brief Clear flag to indicate channel snapshot is being staged, and publish snapshot.
438  *
439  * \pre chan is locked
440  *
441  * \param chan Channel being staged.
442  */
444 
445 /*!
446  * \since 17
447  * \brief Invalidate a channel snapshot segment from being reused
448  *
449  * \pre chan is locked
450  *
451  * \param chan Channel to invalidate the segment on.
452  * \param segment The segment to invalidate.
453  */
456 
457 /*!
458  * \since 12
459  * \brief Publish a \ref ast_channel_snapshot for a channel.
460  *
461  * \pre chan is locked
462  *
463  * \param chan Channel to publish.
464  */
465 void ast_channel_publish_snapshot(struct ast_channel *chan);
466 
467 /*!
468  * \since 12
469  * \brief Publish a \ref ast_channel_varset for a channel.
470  *
471  * \pre chan is locked
472  *
473  * \param chan Channel to publish the event for, or \c NULL for 'none'.
474  * \param variable Name of the variable being set
475  * \param value Value.
476  */
477 void ast_channel_publish_varset(struct ast_channel *chan,
478  const char *variable, const char *value);
479 
480 /*!
481  * \since 12
482  * \brief Message type for when a channel dials another channel
483  *
484  * \retval A stasis message type
485  */
487 
488 /*!
489  * \since 12
490  * \brief Message type for when a variable is set on a channel.
491  *
492  * \retval A stasis message type
493  */
495 
496 /*!
497  * \since 12
498  * \brief Message type for when a hangup is requested on a channel.
499  *
500  * \retval A stasis message type
501  */
503 
504 /*!
505  * \since 16
506  * \brief Message type for when a channel is being masqueraded
507  *
508  * \retval A stasis message type
509  */
511 
512 /*!
513  * \since 12
514  * \brief Message type for when DTMF begins on a channel.
515  *
516  * \retval A stasis message type
517  */
519 
520 /*!
521  * \since 12
522  * \brief Message type for when DTMF ends on a channel.
523  *
524  * \retval A stasis message type
525  */
527 
528 /*!
529  * \brief Message type for when a hook flash occurs on a channel.
530  *
531  * \retval A stasis message type
532  */
534 
535 /*!
536  * \since 12
537  * \brief Message type for when a channel is placed on hold.
538  *
539  * \retval A stasis message type
540  */
542 
543 /*!
544  * \since 12
545  * \brief Message type for when a channel is removed from hold.
546  *
547  * \retval A stasis message type
548  */
550 
551 /*!
552  * \since 12
553  * \brief Message type for when a channel starts spying on another channel
554  *
555  * \retval A stasis message type
556  */
558 
559 /*!
560  * \since 12
561  * \brief Message type for when a channel stops spying on another channel
562  *
563  * \retval A stasis message type
564  */
566 
567 /*!
568  * \since 12
569  * \brief Message type for a fax operation
570  *
571  * \retval A stasis message type
572  */
574 
575 /*!
576  * \since 12
577  * \brief Message type for hangup handler related actions
578  *
579  * \retval A stasis message type
580  */
582 
583 /*!
584  * \since 12
585  * \brief Message type for starting monitor on a channel
586  *
587  * \retval A stasis message type
588  */
590 
591 /*!
592  * \since 12
593  * \brief Message type for stopping monitor on a channel
594  *
595  * \retval A stasis message type
596  */
598 
599 /*!
600  * \since 18
601  * \brief Message type for starting mixmonitor on a channel
602  *
603  * \retval A stasis message type
604  */
606 
607 /*!
608  * \since 18
609  * \brief Message type for stopping mixmonitor on a channel
610  *
611  * \retval A stasis message type
612  */
614 
615 /*!
616  * \since 18
617  * \brief Message type for muting or unmuting mixmonitor on a channel
618  *
619  * \retval A stasis message type
620  */
622 
623 /*!
624  * \since 18.0.0
625  * \brief Message type for agent login on a channel
626  *
627  * \retval A stasis message type
628  */
630 
631 /*!
632  * \since 12.0.0
633  * \brief Message type for agent logoff on a channel
634  *
635  * \retval A stasis message type
636  */
638 
639 /*!
640  * \since 12
641  * \brief Message type for starting music on hold on a channel
642  *
643  * \retval A stasis message type
644  */
646 
647 /*!
648  * \since 12
649  * \brief Message type for stopping music on hold on a channel
650  *
651  * \retval A stasis message type
652  */
654 
655 /*!
656  * \since 12.4.0
657  * \brief Message type for a channel starting talking
658  *
659  * \retval A stasis message type
660  */
662 
663 /*!
664  * \since 12.4.0
665  * \brief Message type for a channel stopping talking
666  *
667  * \retval A stasis message type
668  */
670 
671 /*!
672  * \since 12
673  * \brief Publish in the \ref ast_channel_topic or \ref ast_channel_topic_all
674  * topics a stasis message for the channels involved in a dial operation.
675  *
676  * \param caller The channel performing the dial operation
677  * \param peer The channel being dialed
678  * \param dialstring When beginning a dial, the information passed to the
679  * dialing application
680  * \param dialstatus The current status of the dial operation (NULL if no
681  * status is known)
682  */
683 void ast_channel_publish_dial(struct ast_channel *caller,
684  struct ast_channel *peer,
685  const char *dialstring,
686  const char *dialstatus);
687 
688 /*!
689  * \since 12
690  * \brief Publish in the \ref ast_channel_topic or \ref ast_channel_topic_all
691  * topics a stasis message for the channels involved in a dial operation that
692  * is forwarded.
693  *
694  * \param caller The channel performing the dial operation
695  * \param peer The channel being dialed
696  * \param forwarded The channel created as a result of the call forwarding
697  * \param dialstring The information passed to the dialing application when beginning a dial
698  * \param dialstatus The current status of the dial operation
699  * \param forward The call forward string provided by the dialed channel
700  */
702  struct ast_channel *peer,
703  struct ast_channel *forwarded,
704  const char *dialstring,
705  const char *dialstatus,
706  const char *forward);
707 
708 /*! @} */
709 
710 /*!
711  * \brief Build a JSON object from a \ref ast_channel_snapshot.
712  *
713  * \param snapshot The snapshot to convert to JSON
714  * \param sanitize The message sanitizer to use on the snapshot
715  *
716  * \return JSON object representing channel snapshot.
717  * \return \c NULL on error
718  */
719 struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot,
720  const struct stasis_message_sanitizer *sanitize);
721 
722 /*!
723  * \brief Compares the context, exten and priority of two snapshots.
724  * \since 12
725  *
726  * \param old_snapshot Old snapshot
727  * \param new_snapshot New snapshot
728  *
729  * \return True (non-zero) if context, exten or priority are identical.
730  * \return False (zero) if context, exten and priority changed.
731  */
733  const struct ast_channel_snapshot *old_snapshot,
734  const struct ast_channel_snapshot *new_snapshot);
735 
736 /*!
737  * \brief Compares the callerid info of two snapshots.
738  * \since 12
739  *
740  * \param old_snapshot Old snapshot
741  * \param new_snapshot New snapshot
742  *
743  * \return True (non-zero) if callerid are identical.
744  * \return False (zero) if callerid changed.
745  */
747  const struct ast_channel_snapshot *old_snapshot,
748  const struct ast_channel_snapshot *new_snapshot);
749 
750 /*!
751  * \brief Compares the connected line info of two snapshots.
752  * \since 13.1.0
753  *
754  * \param old_snapshot Old snapshot
755  * \param new_snapshot New snapshot
756  *
757  * \return True (non-zero) if callerid are identical.
758  * \return False (zero) if callerid changed.
759  */
761  const struct ast_channel_snapshot *old_snapshot,
762  const struct ast_channel_snapshot *new_snapshot);
763 
764 /*!
765  * \brief Initialize the stasis channel topic and message types
766  * \return 0 on success
767  * \return Non-zero on error
768  */
769 int ast_stasis_channels_init(void);
770 
771 #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.
static const char type[]
Definition: chan_ooh323.c:109
enum sip_cc_notify_state state
Definition: chan_sip.c:960
static char accountcode[AST_MAX_ACCOUNT_CODE]
Definition: chan_iax2.c:428
static char exten[AST_MAX_EXTENSION]
Definition: chan_alsa.c:118
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
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.
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.
unsigned int flags
Definition: utils.h:200
Structure representing a snapshot of channel state.
ast_channel_state
ast_channel states
Definition: channelstate.h:35
struct stasis_message_type * ast_channel_flash_type(void)
Message type for when a hook flash occurs on a channel.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Definition: stringfields.h:337
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.
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.
struct stasis_message_type * ast_channel_monitor_start_type(void)
Message type for starting monitor on a channel.
int value
Definition: syslog.c:37
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.
Structure representing a change of snapshot of channel state.
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.
Number structure.
Definition: app_followme.c:154
ast_channel_snapshot_segment_invalidation
Channel snapshot invalidation flags, used to force generation of segments.
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.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
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:299
Structure containing dialplan information for a channel snapshot.
struct stasis_message_type * ast_channel_monitor_stop_type(void)
Message type for stopping monitor on a channel.
struct ast_channel_snapshot_hangup * hangup
static char language[MAX_LANGUAGE]
Definition: chan_alsa.c:117
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_channel_cache_all(void)
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 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.
Structure containing peer information for a channel snapshot.
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.
void ast_channel_publish_varset(struct ast_channel *chan, const char *variable, const char *value)
Publish a ast_channel_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...
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 stasis_message_type * ast_channel_hangup_handler_type(void)
Message type for hangup handler related actions.
static const char name[]
Definition: cdr_mysql.c:74
struct ast_channel_snapshot * new_snapshot
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.
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_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, ...).
int ast_stasis_channels_init(void)
Initialize the stasis channel topic and message types.
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.
void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message.
static char context[AST_MAX_CONTEXT]
Definition: chan_alsa.c:116
struct stasis_message_type * ast_channel_moh_stop_type(void)
Message type for stopping music on hold on a channel.
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.
struct stasis_message_type * ast_channel_mixmonitor_mute_type(void)
Message type for muting or unmuting mixmonitor on a channel.