Asterisk - The Open Source Telephony Project  GIT-master-a24979a
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  * \return 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  * \return Cache of \ref ast_channel_snapshot.
211  */
213 
214 /*!
215  * \since 12
216  * \brief Message type for \ref ast_channel_snapshot_update.
217  *
218  * \return 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  * \return 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 uniqueid The channel's unique ID
243  *
244  * \return 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  * \return 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  * \retval 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  * \retval 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  * \retval 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  * \return \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  * \return 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  * \retval 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  */
404  struct ast_json *blob);
405 
406 /*!
407  * \brief Publish a channel blob message using the latest snapshot from the cache
408  * \since 12.4.0
409  *
410  * \param chan Channel publishing the blob.
411  * \param type Type of stasis message.
412  * \param blob The blob being published. (NULL if no blob)
413  *
414  * \note As this only accesses the uniqueid and topic of the channel - neither of
415  * which should ever be changed on a channel anyhow - a channel does not have to
416  * be locked when calling this function.
417  */
419  struct ast_json *blob);
420 
421 /*!
422  * \since 12
423  * \brief Set flag to indicate channel snapshot is being staged.
424  *
425  * \pre chan is locked
426  *
427  * \param chan Channel being staged.
428  */
429 void ast_channel_stage_snapshot(struct ast_channel *chan);
430 
431 /*!
432  * \since 12
433  * \brief Clear flag to indicate channel snapshot is being staged, and publish snapshot.
434  *
435  * \pre chan is locked
436  *
437  * \param chan Channel being staged.
438  */
440 
441 /*!
442  * \since 17
443  * \brief Invalidate a channel snapshot segment from being reused
444  *
445  * \pre chan is locked
446  *
447  * \param chan Channel to invalidate the segment on.
448  * \param segment The segment to invalidate.
449  */
452 
453 /*!
454  * \since 12
455  * \brief Publish a \ref ast_channel_snapshot for a channel.
456  *
457  * \pre chan is locked
458  *
459  * \param chan Channel to publish.
460  */
461 void ast_channel_publish_snapshot(struct ast_channel *chan);
462 
463 /*!
464  * \since 12
465  * \brief Publish a \ref ast_channel_publish_varset for a channel.
466  *
467  * \pre chan is locked
468  *
469  * \param chan Channel to publish the event for, or \c NULL for 'none'.
470  * \param variable Name of the variable being set
471  * \param value Value.
472  */
473 void ast_channel_publish_varset(struct ast_channel *chan,
474  const char *variable, const char *value);
475 
476 /*!
477  * \since 12
478  * \brief Message type for when a channel dials another channel
479  *
480  * \return A stasis message type
481  */
483 
484 /*!
485  * \since 12
486  * \brief Message type for when a variable is set on a channel.
487  *
488  * \return A stasis message type
489  */
491 
492 /*!
493  * \since 12
494  * \brief Message type for when a hangup is requested on a channel.
495  *
496  * \return A stasis message type
497  */
499 
500 /*!
501  * \since 16
502  * \brief Message type for when a channel is being masqueraded
503  *
504  * \return A stasis message type
505  */
507 
508 /*!
509  * \since 12
510  * \brief Message type for when DTMF begins on a channel.
511  *
512  * \return A stasis message type
513  */
515 
516 /*!
517  * \since 12
518  * \brief Message type for when DTMF ends on a channel.
519  *
520  * \return A stasis message type
521  */
523 
524 /*!
525  * \brief Message type for when a hook flash occurs on a channel.
526  *
527  * \return A stasis message type
528  */
530 
531 /*!
532  * \brief Message type for when a wink occurs on a channel.
533  *
534  * \return A stasis message type
535  */
537 
538 /*!
539  * \since 12
540  * \brief Message type for when a channel is placed on hold.
541  *
542  * \return A stasis message type
543  */
545 
546 /*!
547  * \since 12
548  * \brief Message type for when a channel is removed from hold.
549  *
550  * \return A stasis message type
551  */
553 
554 /*!
555  * \since 12
556  * \brief Message type for when a channel starts spying on another channel
557  *
558  * \return A stasis message type
559  */
561 
562 /*!
563  * \since 12
564  * \brief Message type for when a channel stops spying on another channel
565  *
566  * \return A stasis message type
567  */
569 
570 /*!
571  * \since 12
572  * \brief Message type for a fax operation
573  *
574  * \return A stasis message type
575  */
577 
578 /*!
579  * \since 12
580  * \brief Message type for hangup handler related actions
581  *
582  * \return A stasis message type
583  */
585 
586 /*!
587  * \since 12
588  * \brief Message type for starting monitor on a channel
589  *
590  * \return A stasis message type
591  */
593 
594 /*!
595  * \since 12
596  * \brief Message type for stopping monitor on a channel
597  *
598  * \return A stasis message type
599  */
601 
602 /*!
603  * \since 18
604  * \brief Message type for starting mixmonitor on a channel
605  *
606  * \return A stasis message type
607  */
609 
610 /*!
611  * \since 18
612  * \brief Message type for stopping mixmonitor on a channel
613  *
614  * \return A stasis message type
615  */
617 
618 /*!
619  * \since 18
620  * \brief Message type for muting or unmuting mixmonitor on a channel
621  *
622  * \return A stasis message type
623  */
625 
626 /*!
627  * \since 18.0.0
628  * \brief Message type for agent login on a channel
629  *
630  * \return A stasis message type
631  */
633 
634 /*!
635  * \since 12.0.0
636  * \brief Message type for agent logoff on a channel
637  *
638  * \return A stasis message type
639  */
641 
642 /*!
643  * \since 12
644  * \brief Message type for starting music on hold on a channel
645  *
646  * \return A stasis message type
647  */
649 
650 /*!
651  * \since 12
652  * \brief Message type for stopping music on hold on a channel
653  *
654  * \return A stasis message type
655  */
657 
658 /*!
659  * \since 12.4.0
660  * \brief Message type for a channel starting talking
661  *
662  * \return A stasis message type
663  */
665 
666 /*!
667  * \since 12.4.0
668  * \brief Message type for a channel stopping talking
669  *
670  * \return A stasis message type
671  */
673 
674 /*!
675  * \since 12
676  * \brief Publish in the \ref ast_channel_topic or \ref ast_channel_topic_all
677  * topics a stasis message for the channels involved in a dial operation.
678  *
679  * \param caller The channel performing the dial operation
680  * \param peer The channel being dialed
681  * \param dialstring When beginning a dial, the information passed to the
682  * dialing application
683  * \param dialstatus The current status of the dial operation (NULL if no
684  * status is known)
685  */
686 void ast_channel_publish_dial(struct ast_channel *caller,
687  struct ast_channel *peer,
688  const char *dialstring,
689  const char *dialstatus);
690 
691 /*!
692  * \since 12
693  * \brief Publish in the \ref ast_channel_topic or \ref ast_channel_topic_all
694  * topics a stasis message for the channels involved in a dial operation that
695  * is forwarded.
696  *
697  * \param caller The channel performing the dial operation
698  * \param peer The channel being dialed
699  * \param forwarded The channel created as a result of the call forwarding
700  * \param dialstring The information passed to the dialing application when beginning a dial
701  * \param dialstatus The current status of the dial operation
702  * \param forward The call forward string provided by the dialed channel
703  */
705  struct ast_channel *peer,
706  struct ast_channel *forwarded,
707  const char *dialstring,
708  const char *dialstatus,
709  const char *forward);
710 
711 /*! @} */
712 
713 /*!
714  * \brief Build a JSON object from a \ref ast_channel_snapshot.
715  *
716  * \param snapshot The snapshot to convert to JSON
717  * \param sanitize The message sanitizer to use on the snapshot
718  *
719  * \return JSON object representing channel snapshot.
720  * \retval NULL on error
721  */
722 struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot,
723  const struct stasis_message_sanitizer *sanitize);
724 
725 /*!
726  * \brief Compares the context, exten and priority of two snapshots.
727  * \since 12
728  *
729  * \param old_snapshot Old snapshot
730  * \param new_snapshot New snapshot
731  *
732  * \retval True (non-zero) if context, exten or priority are identical.
733  * \retval False (zero) if context, exten and priority changed.
734  */
736  const struct ast_channel_snapshot *old_snapshot,
737  const struct ast_channel_snapshot *new_snapshot);
738 
739 /*!
740  * \brief Compares the callerid info of two snapshots.
741  * \since 12
742  *
743  * \param old_snapshot Old snapshot
744  * \param new_snapshot New snapshot
745  *
746  * \retval True (non-zero) if callerid are identical.
747  * \retval False (zero) if callerid changed.
748  */
750  const struct ast_channel_snapshot *old_snapshot,
751  const struct ast_channel_snapshot *new_snapshot);
752 
753 /*!
754  * \brief Compares the connected line info of two snapshots.
755  * \since 13.1.0
756  *
757  * \param old_snapshot Old snapshot
758  * \param new_snapshot New snapshot
759  *
760  * \retval True (non-zero) if callerid are identical.
761  * \retval False (zero) if callerid changed.
762  */
764  const struct ast_channel_snapshot *old_snapshot,
765  const struct ast_channel_snapshot *new_snapshot);
766 
767 /*!
768  * \brief Initialize the stasis channel topic and message types
769  * \retval 0 on success
770  * \retval Non-zero on error
771  */
772 int ast_stasis_channels_init(void);
773 
774 #endif /* STASIS_CHANNELS_H_ */
static const char type[]
Definition: chan_ooh323.c:109
General Asterisk PBX channel definitions.
ast_channel_state
ast_channel states
Definition: channelstate.h:35
static const char name[]
Definition: format_mp3.c:68
struct stasis_message_type * ast_channel_agent_login_type(void)
Message type for agent login on a channel.
struct stasis_message_type * ast_channel_monitor_stop_type(void)
Message type for stopping monitor on a channel.
void ast_channel_publish_varset(struct ast_channel *chan, const char *variable, const char *value)
Publish a ast_channel_publish_varset for a channel.
struct stasis_message_type * ast_channel_mixmonitor_start_type(void)
Message type for starting mixmonitor on a channel.
struct ao2_container * ast_channel_cache_all(void)
struct stasis_message_type * ast_channel_moh_stop_type(void)
Message type for stopping music on hold on a channel.
struct stasis_message_type * ast_channel_talking_stop(void)
Message type for a channel stopping talking.
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
struct stasis_message_type * ast_channel_mixmonitor_mute_type(void)
Message type for muting or unmuting mixmonitor on a channel.
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.
struct stasis_message_type * ast_channel_flash_type(void)
Message type for when a hook flash occurs on a channel.
struct stasis_message_type * ast_channel_agent_logoff_type(void)
Message type for agent logoff on a channel.
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.
struct stasis_message_type * ast_channel_wink_type(void)
Message type for when a wink occurs on a channel.
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.
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 stasis_message_type * ast_channel_hold_type(void)
Message type for when a channel is placed on hold.
struct stasis_message_type * ast_channel_monitor_start_type(void)
Message type for starting monitor on a channel.
struct stasis_message_type * ast_channel_chanspy_stop_type(void)
Message type for when a channel stops spying on another channel.
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 stasis_message_type * ast_channel_fax_type(void)
Message type for a fax operation.
struct stasis_message_type * ast_channel_masquerade_type(void)
Message type for when a channel is being masqueraded.
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_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 stasis_message_type * ast_channel_chanspy_start_type(void)
Message type for when a channel starts spying on another channel.
void ast_channel_publish_final_snapshot(struct ast_channel *chan)
Send the final channel snapshot for a channel, thus removing it from cache.
struct stasis_message_type * ast_channel_talking_start(void)
Message type for a channel starting talking.
struct stasis_message_type * ast_channel_snapshot_type(void)
Message type for ast_channel_snapshot_update.
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.
struct stasis_message_type * ast_channel_dtmf_begin_type(void)
Message type for when DTMF begins on a channel.
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,...
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_hangup_request_type(void)
Message type for when a hangup is requested on a channel.
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 stasis_message_type * ast_channel_unhold_type(void)
Message type for when a channel is removed from hold.
struct stasis_message_type * ast_channel_mixmonitor_stop_type(void)
Message type for stopping mixmonitor on a channel.
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_moh_start_type(void)
Message type for starting music on hold on a channel.
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.
struct ao2_container * ast_channel_cache_by_name(void)
Secondary channel cache, indexed by name.
ast_channel_snapshot_segment_invalidation
Channel snapshot invalidation flags, used to force generation of segments.
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
struct stasis_message_type * ast_channel_dial_type(void)
Message type for when a channel dials another channel.
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 stasis_message_type * ast_channel_hangup_handler_type(void)
Message type for hangup handler related actions.
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_multi_channel_blob * ast_multi_channel_blob_create(struct ast_json *blob)
Create a ast_multi_channel_blob suitable for a stasis_message.
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_PEER
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_CALLER
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_HANGUP
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_BRIDGE
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_BASE
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_CONNECTED
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_DIALPLAN
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
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.
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.
int ast_stasis_channels_init(void)
Initialize the stasis channel topic and message types.
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.
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.
#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
Generic container type.
Blob of data associated with a channel.
struct ast_channel_snapshot * snapshot
struct ast_json * blob
Structure containing base information for a channel snapshot.
const ast_string_field language
const ast_string_field accountcode
const ast_string_field userfield
const ast_string_field uniqueid
const ast_string_field type
const ast_string_field name
Structure containing bridge information for a channel snapshot.
Structure containing caller information for a channel snapshot.
const ast_string_field dialed_subaddr
const ast_string_field rdnis
const ast_string_field ani
const ast_string_field name
const ast_string_field subaddr
const ast_string_field dnid
Structure containing connected information for a channel snapshot.
Structure containing dialplan information for a channel snapshot.
const ast_string_field data
const ast_string_field context
const ast_string_field exten
const ast_string_field appl
Structure containing hangup information for a channel snapshot.
Structure containing peer information for a channel snapshot.
Structure representing a change of snapshot of channel state.
struct ast_channel_snapshot * old_snapshot
struct ast_channel_snapshot * new_snapshot
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_connected * connected
struct varshead * manager_vars
struct varshead * ari_vars
struct ast_channel_snapshot_dialplan * dialplan
struct ast_channel_snapshot_peer * peer
struct ast_channel_snapshot_bridge * bridge
struct ast_channel_snapshot_base * base
enum ast_channel_state state
struct ast_flags softhangup_flags
struct ast_channel_snapshot_caller * caller
struct ast_flags flags
struct ast_channel_snapshot_hangup * hangup
Main Channel structure associated with a channel.
Structure used to handle boolean flags.
Definition: utils.h:199
Abstract JSON element (object, array, string, int, ...).
A multi channel blob data structure for multi_channel_blob stasis messages.
struct ast_json * blob
Number structure.
Definition: app_followme.c:154
Structure containing callbacks for Stasis message sanitization.
Definition: stasis.h:200
int value
Definition: syslog.c:37