Asterisk - The Open Source Telephony Project  GIT-master-b91fb3c
channel_internal_api.c
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2012, Digium, Inc.
5  *
6  * Mark Spencer <markster@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 /*! \file
20  *
21  * \brief Channel Accessor API
22  *
23  * This file is intended to be the only file that ever accesses the
24  * internals of an ast_channel. All other files should use the
25  * accessor functions defined here.
26  *
27  * \author Terry Wilson
28  */
29 
30 /*** MODULEINFO
31  <support_level>core</support_level>
32  ***/
33 
34 #include "asterisk.h"
35 
36 #include <unistd.h>
37 #include <fcntl.h>
38 
39 #include "asterisk/alertpipe.h"
40 #include "asterisk/paths.h"
41 #include "asterisk/channel.h"
43 #include "asterisk/endpoints.h"
44 #include "asterisk/indications.h"
47 #include "asterisk/stringfields.h"
48 #include "asterisk/stream.h"
49 #include "asterisk/test.h"
50 #include "asterisk/vector.h"
51 
52 /*!
53  * \brief Channel UniqueId structure
54  * \note channel creation time used for determining LinkedId Propagation
55  */
57  time_t creation_time; /*!< Creation time */
58  int creation_unique; /*!< sub-second unique value */
59  char unique_id[AST_MAX_UNIQUEID]; /*!< Unique Identifier */
60 };
61 
62 /*!
63  * \brief Main Channel structure associated with a channel.
64  *
65  * \note When adding fields to this structure, it is important to add the field
66  * 'in position' with like-aligned fields, so as to keep the compiler from
67  * having to add padding to align fields. The structure's fields are sorted
68  * in this order: pointers, structures, long, int/enum, short, char. This
69  * is especially important on 64-bit architectures, where mixing 4-byte
70  * and 8-byte fields causes 4 bytes of padding to be added before many
71  * 8-byte fields.
72  */
73 struct ast_channel {
74  const struct ast_channel_tech *tech; /*!< Technology (point to channel driver) */
75  void *tech_pvt; /*!< Private data used by the technology driver */
76  void *music_state; /*!< Music State*/
77  void *generatordata; /*!< Current generator data if there is any */
78  struct ast_generator *generator; /*!< Current active data generator */
79  struct ast_channel *masq; /*!< Channel that will masquerade as us */
80  struct ast_channel *masqr; /*!< Who we are masquerading as */
81  const char *blockproc; /*!< Procedure causing blocking */
82  const char *appl; /*!< Current application */
83  const char *data; /*!< Data passed to current application */
84  struct ast_sched_context *sched; /*!< Schedule context */
85  struct ast_filestream *stream; /*!< Stream itself. */
86  struct ast_filestream *vstream; /*!< Video Stream itself. */
88  void *timingdata;
89  struct ast_pbx *pbx; /*!< PBX private structure for this channel */
90  struct ast_trans_pvt *writetrans; /*!< Write translation path */
91  struct ast_trans_pvt *readtrans; /*!< Read translation path */
94  struct ast_cdr *cdr; /*!< Call Detail Record */
95  struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or
96  * in the CHANNEL dialplan function */
97  struct ast_channel_monitor *monitor; /*!< Channel monitoring */
98  ast_callid callid; /*!< Bound call identifier pointer */
99  struct ao2_container *dialed_causes; /*!< Contains tech-specific and Asterisk cause data from dialed channels */
100 
102  AST_STRING_FIELD(name); /*!< ASCII unique channel name */
103  AST_STRING_FIELD(language); /*!< Language requested for voice prompts */
104  AST_STRING_FIELD(musicclass); /*!< Default music class */
105  AST_STRING_FIELD(latest_musicclass); /*!< Latest active music class */
106  AST_STRING_FIELD(accountcode); /*!< Account code for billing */
107  AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */
108  AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */
109  AST_STRING_FIELD(call_forward); /*!< Where to forward to if asked to dial on this interface */
110  AST_STRING_FIELD(parkinglot); /*! Default parking lot, if empty, default parking lot */
111  AST_STRING_FIELD(hangupsource); /*! Who is responsible for hanging up this channel */
112  AST_STRING_FIELD(dialcontext); /*!< Dial: Extension context that we were called from */
113  );
114 
115  struct ast_channel_id uniqueid; /*!< Unique Channel Identifier - can be specified on creation */
116  struct ast_channel_id linkedid; /*!< Linked Channel Identifier - oldest propagated when bridged */
117 
118  struct timeval whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */
119  pthread_t blocker; /*!< If anyone is blocking, this is them */
120 
121  /*!
122  * \brief Dialed/Called information.
123  * \note Set on incoming channels to indicate the originally dialed party.
124  * \note Dialed Number Identifier (DNID)
125  */
126  struct ast_party_dialed dialed;
127 
128  /*!
129  * \brief Channel Caller ID information.
130  * \note The caller id information is the caller id of this
131  * channel when it is used to initiate a call.
132  */
133  struct ast_party_caller caller;
134 
135  /*!
136  * \brief Channel Connected Line ID information.
137  * \note The connected line information identifies the channel
138  * connected/bridged to this channel.
139  */
141 
142  /*!
143  * \brief Channel Connected Line ID information that was last indicated.
144  */
145  struct ast_party_connected_line connected_indicated;
146 
147  /*! \brief Redirecting/Diversion information */
148  struct ast_party_redirecting redirecting;
149 
150  struct ast_frame dtmff; /*!< DTMF frame */
151  struct varshead varshead; /*!< A linked list for channel variables. See \ref AstChanVar */
152  ast_group_t callgroup; /*!< Call group for call pickups */
153  ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */
154  struct ast_namedgroups *named_callgroups; /*!< Named call group for call pickups */
155  struct ast_namedgroups *named_pickupgroups; /*!< Named pickup group - which call groups can be picked up? */
156  struct timeval creationtime; /*!< The time of channel creation */
157  struct timeval answertime; /*!< The time the channel was answered */
158  struct ast_readq_list readq;
159  struct ast_jb jb; /*!< The jitterbuffer state */
160  struct timeval dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */
161  struct ast_hangup_handler_list hangup_handlers;/*!< Hangup handlers on the channel. */
162  struct ast_datastore_list datastores; /*!< Data stores on the channel */
163  struct ast_autochan_list autochans; /*!< Autochans on the channel */
164  unsigned long insmpl; /*!< Track the read/written samples for monitor use */
165  unsigned long outsmpl; /*!< Track the read/written samples for monitor use */
166 
167  int blocker_tid; /*!< If anyone is blocking, this is their thread id */
168  AST_VECTOR(, int) fds; /*!< File descriptors for channel -- Drivers will poll on
169  * these file descriptors, so at least one must be non -1.
170  * See \arg \ref AstFileDesc */
171  int softhangup; /*!< Whether or not we have been hung up... Do not set this value
172  * directly, use ast_softhangup() */
173  int fdno; /*!< Which fd had an event detected on */
174  int streamid; /*!< For streaming playback, the schedule ID */
175  int vstreamid; /*!< For streaming video playback, the schedule ID */
176  struct ast_format *oldwriteformat; /*!< Original writer format */
177  int timingfd; /*!< Timing fd */
178  enum ast_channel_state state; /*!< State of line -- Don't write directly, use ast_setstate() */
179  int rings; /*!< Number of rings so far */
180  int priority; /*!< Dialplan: Current extension priority */
181  int macropriority; /*!< Macro: Current non-macro priority. See app_macro.c */
182  int amaflags; /*!< Set BEFORE PBX is started to determine AMA flags */
183  enum ast_channel_adsicpe adsicpe; /*!< Whether or not ADSI is detected on CPE */
184  unsigned int fin; /*!< Frames in counters. The high bit is a debug mask, so
185  * the counter is only in the remaining bits */
186  unsigned int fout; /*!< Frames out counters. The high bit is a debug mask, so
187  * the counter is only in the remaining bits */
188  int hangupcause; /*!< Why is the channel hanged up. See causes.h */
189  unsigned int finalized:1; /*!< Whether or not the channel has been successfully allocated */
190  struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */
191  int alertpipe[2];
192  struct ast_format_cap *nativeformats; /*!< Kinds of data this channel can natively handle */
193  struct ast_format *readformat; /*!< Requested read format (after translation) */
194  struct ast_format *writeformat; /*!< Requested write format (before translation) */
195  struct ast_format *rawreadformat; /*!< Raw read format (before translation) */
196  struct ast_format *rawwriteformat; /*!< Raw write format (after translation) */
197  unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
198  int visible_indication; /*!< Indication currently playing on the channel */
199  int hold_state; /*!< Current Hold/Unhold state */
200 
201  unsigned short transfercapability; /*!< ISDN Transfer Capability - AST_FLAG_DIGITAL is not enough */
202 
203  struct ast_bridge *bridge; /*!< Bridge this channel is participating in */
204  struct ast_bridge_channel *bridge_channel;/*!< The bridge_channel this channel is linked with. */
205  struct ast_timer *timer; /*!< timer object that provided timingfd */
206 
207  char context[AST_MAX_CONTEXT]; /*!< Dialplan: Current extension context */
208  char exten[AST_MAX_EXTENSION]; /*!< Dialplan: Current extension number */
209  char macrocontext[AST_MAX_CONTEXT]; /*!< Macro: Current non-macro context. See app_macro.c */
210  char macroexten[AST_MAX_EXTENSION]; /*!< Macro: Current non-macro extension. See app_macro.c */
211  char unbridged; /*!< non-zero if the bridge core needs to re-evaluate the current
212  bridging technology which is in use by this channel's bridge. */
213  char is_t38_active; /*!< non-zero if T.38 is active on this channel. */
214  char dtmf_digit_to_emulate; /*!< Digit being emulated */
215  char sending_dtmf_digit; /*!< Digit this channel is currently sending out. (zero if not sending) */
216  struct timeval sending_dtmf_tv; /*!< The time this channel started sending the current digit. (Invalid if sending_dtmf_digit is zero.) */
217  struct stasis_topic *topic; /*!< Topic for trhis channel */
218  struct stasis_forward *channel_forward; /*!< Subscription for event forwarding to all channel topic */
219  struct stasis_forward *endpoint_forward; /*!< Subscription for event forwarding to endpoint's topic */
220  struct ast_stream_topology *stream_topology; /*!< Stream topology */
221  void *stream_topology_change_source; /*!< Source that initiated a stream topology change */
222  struct ast_stream *default_streams[AST_MEDIA_TYPE_END]; /*!< Default streams indexed by media type */
223  struct ast_channel_snapshot *snapshot; /*!< The current up to date snapshot of the channel */
224  struct ast_flags snapshot_segment_flags; /*!< Flags regarding the segments of the snapshot */
225 };
226 
227 /*! \brief The monotonically increasing integer counter for channel uniqueids */
228 static int uniqueint;
229 
230 /* ACCESSORS */
231 
232 #define DEFINE_STRINGFIELD_SETTERS_FOR(field, assert_on_null) \
233 void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
234 { \
235  if ((assert_on_null)) ast_assert(!ast_strlen_zero(value)); \
236  if (!strcmp(value, chan->field)) return; \
237  ast_string_field_set(chan, field, value); \
238 } \
239  \
240 void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
241 { \
242  ast_string_field_build_va(chan, field, fmt, ap); \
243 } \
244 void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
245 { \
246  va_list ap; \
247  va_start(ap, fmt); \
248  ast_channel_##field##_build_va(chan, fmt, ap); \
249  va_end(ap); \
250 }
251 
252 #define DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR(field, publish, assert_on_null, invalidate) \
253 void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
254 { \
255  if ((assert_on_null)) ast_assert(!ast_strlen_zero(value)); \
256  if (!strcmp(value, chan->field)) return; \
257  ast_string_field_set(chan, field, value); \
258  ast_channel_snapshot_invalidate_segment(chan, invalidate); \
259  if (publish && ast_channel_internal_is_finalized(chan)) ast_channel_publish_snapshot(chan); \
260 } \
261  \
262 void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
263 { \
264  ast_string_field_build_va(chan, field, fmt, ap); \
265  ast_channel_snapshot_invalidate_segment(chan, invalidate); \
266  if (publish && ast_channel_internal_is_finalized(chan)) ast_channel_publish_snapshot(chan); \
267 } \
268 void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
269 { \
270  va_list ap; \
271  va_start(ap, fmt); \
272  ast_channel_##field##_build_va(chan, fmt, ap); \
273  va_end(ap); \
274 }
275 
279 DEFINE_STRINGFIELD_SETTERS_FOR(latest_musicclass, 0);
283 DEFINE_STRINGFIELD_SETTERS_FOR(call_forward, 0);
287 
288 #define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \
289 { \
290  return chan->field; \
291 }
292 
296 DEFINE_STRINGFIELD_GETTER_FOR(latest_musicclass);
298 DEFINE_STRINGFIELD_GETTER_FOR(peeraccount);
300 DEFINE_STRINGFIELD_GETTER_FOR(call_forward);
302 DEFINE_STRINGFIELD_GETTER_FOR(hangupsource);
304 
305 const char *ast_channel_uniqueid(const struct ast_channel *chan)
306 {
307  ast_assert(chan->uniqueid.unique_id[0] != '\0');
308  return chan->uniqueid.unique_id;
309 }
310 
311 const char *ast_channel_linkedid(const struct ast_channel *chan)
312 {
313  ast_assert(chan->linkedid.unique_id[0] != '\0');
314  return chan->linkedid.unique_id;
315 }
316 
317 const char *ast_channel_appl(const struct ast_channel *chan)
318 {
319  return chan->appl;
320 }
321 void ast_channel_appl_set(struct ast_channel *chan, const char *value)
322 {
323  chan->appl = value;
325 }
326 const char *ast_channel_blockproc(const struct ast_channel *chan)
327 {
328  return chan->blockproc;
329 }
330 void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
331 {
332  chan->blockproc = value;
333 }
334 const char *ast_channel_data(const struct ast_channel *chan)
335 {
336  return chan->data;
337 }
338 void ast_channel_data_set(struct ast_channel *chan, const char *value)
339 {
340  chan->data = value;
342 }
343 
344 const char *ast_channel_context(const struct ast_channel *chan)
345 {
346  return chan->context;
347 }
348 void ast_channel_context_set(struct ast_channel *chan, const char *value)
349 {
350  ast_copy_string(chan->context, value, sizeof(chan->context));
352 }
353 const char *ast_channel_exten(const struct ast_channel *chan)
354 {
355  return chan->exten;
356 }
357 void ast_channel_exten_set(struct ast_channel *chan, const char *value)
358 {
359  ast_copy_string(chan->exten, value, sizeof(chan->exten));
361 }
362 const char *ast_channel_macrocontext(const struct ast_channel *chan)
363 {
364  return chan->macrocontext;
365 }
366 void ast_channel_macrocontext_set(struct ast_channel *chan, const char *value)
367 {
368  ast_copy_string(chan->macrocontext, value, sizeof(chan->macrocontext));
369 }
370 const char *ast_channel_macroexten(const struct ast_channel *chan)
371 {
372  return chan->macroexten;
373 }
374 void ast_channel_macroexten_set(struct ast_channel *chan, const char *value)
375 {
376  ast_copy_string(chan->macroexten, value, sizeof(chan->macroexten));
377 }
378 
380 {
381  return chan->dtmf_digit_to_emulate;
382 }
384 {
385  chan->dtmf_digit_to_emulate = value;
386 }
387 
389 {
390  return chan->sending_dtmf_digit;
391 }
393 {
394  chan->sending_dtmf_digit = value;
395 }
396 
397 struct timeval ast_channel_sending_dtmf_tv(const struct ast_channel *chan)
398 {
399  return chan->sending_dtmf_tv;
400 }
401 void ast_channel_sending_dtmf_tv_set(struct ast_channel *chan, struct timeval value)
402 {
403  chan->sending_dtmf_tv = value;
404 }
405 
407 {
408  return chan->amaflags;
409 }
410 
412 {
413  if (chan->amaflags == value) {
414  return;
415  }
416  chan->amaflags = value;
418 }
419 int ast_channel_fdno(const struct ast_channel *chan)
420 {
421  return chan->fdno;
422 }
423 void ast_channel_fdno_set(struct ast_channel *chan, int value)
424 {
425  chan->fdno = value;
426 }
427 int ast_channel_hangupcause(const struct ast_channel *chan)
428 {
429  return chan->hangupcause;
430 }
432 {
433  chan->hangupcause = value;
435 }
436 int ast_channel_macropriority(const struct ast_channel *chan)
437 {
438  return chan->macropriority;
439 }
441 {
442  chan->macropriority = value;
443 }
444 int ast_channel_priority(const struct ast_channel *chan)
445 {
446  return chan->priority;
447 }
449 {
450  chan->priority = value;
452 }
453 int ast_channel_rings(const struct ast_channel *chan)
454 {
455  return chan->rings;
456 }
457 void ast_channel_rings_set(struct ast_channel *chan, int value)
458 {
459  chan->rings = value;
460 }
461 int ast_channel_streamid(const struct ast_channel *chan)
462 {
463  return chan->streamid;
464 }
466 {
467  chan->streamid = value;
468 }
469 int ast_channel_timingfd(const struct ast_channel *chan)
470 {
471  return chan->timingfd;
472 }
474 {
475  chan->timingfd = value;
476 }
478 {
479  return chan->visible_indication;
480 }
482 {
483  chan->visible_indication = value;
484 }
485 int ast_channel_hold_state(const struct ast_channel *chan)
486 {
487  return chan->hold_state;
488 }
490 {
491  chan->hold_state = value;
492 }
493 int ast_channel_vstreamid(const struct ast_channel *chan)
494 {
495  return chan->vstreamid;
496 }
498 {
499  chan->vstreamid = value;
500 }
501 unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
502 {
503  return chan->transfercapability;
504 }
505 void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
506 {
507  chan->transfercapability = value;
508 }
509 unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
510 {
511  return chan->emulate_dtmf_duration;
512 }
514 {
515  chan->emulate_dtmf_duration = value;
516 }
517 unsigned int ast_channel_fin(const struct ast_channel *chan)
518 {
519  return chan->fin;
520 }
521 void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
522 {
523  chan->fin = value;
524 }
525 unsigned int ast_channel_fout(const struct ast_channel *chan)
526 {
527  return chan->fout;
528 }
529 void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
530 {
531  chan->fout = value;
532 }
533 unsigned long ast_channel_insmpl(const struct ast_channel *chan)
534 {
535  return chan->insmpl;
536 }
537 void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
538 {
539  chan->insmpl = value;
540 }
541 unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
542 {
543  return chan->outsmpl;
544 }
545 void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
546 {
547  chan->outsmpl = value;
548 }
549 void *ast_channel_generatordata(const struct ast_channel *chan)
550 {
551  return chan->generatordata;
552 }
554 {
555  chan->generatordata = value;
556 }
557 void *ast_channel_music_state(const struct ast_channel *chan)
558 {
559  return chan->music_state;
560 }
562 {
563  chan->music_state = value;
564 }
565 void *ast_channel_tech_pvt(const struct ast_channel *chan)
566 {
567  return chan->tech_pvt;
568 }
569 void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
570 {
571  chan->tech_pvt = value;
572 }
573 void *ast_channel_timingdata(const struct ast_channel *chan)
574 {
575  return chan->timingdata;
576 }
578 {
579  chan->timingdata = value;
580 }
582 {
583  return chan->audiohooks;
584 }
586 {
587  chan->audiohooks = value;
588 }
589 struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan)
590 {
591  return chan->cdr;
592 }
593 void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
594 {
595  chan->cdr = value;
596 }
597 struct ast_channel *ast_channel_masq(const struct ast_channel *chan)
598 {
599  return chan->masq;
600 }
602 {
603  chan->masq = value;
604 }
605 struct ast_channel *ast_channel_masqr(const struct ast_channel *chan)
606 {
607  return chan->masqr;
608 }
610 {
611  chan->masqr = value;
612 }
614 {
615  return chan->monitor;
616 }
618 {
619  chan->monitor = value;
620 }
621 struct ast_filestream *ast_channel_stream(const struct ast_channel *chan)
622 {
623  return chan->stream;
624 }
626 {
627  chan->stream = value;
628 }
629 struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan)
630 {
631  return chan->vstream;
632 }
634 {
635  chan->vstream = value;
636 }
638 {
639  return chan->nativeformats;
640 }
641 
642 static void channel_set_default_streams(struct ast_channel *chan)
643 {
644  enum ast_media_type type;
645 
646  ast_assert(chan != NULL);
647 
648  for (type = AST_MEDIA_TYPE_UNKNOWN; type < AST_MEDIA_TYPE_END; type++) {
649  if (chan->stream_topology) {
650  chan->default_streams[type] =
651  ast_stream_topology_get_first_stream_by_type(chan->stream_topology, type);
652  } else {
653  chan->default_streams[type] = NULL;
654  }
655  }
656 }
657 
659  struct ast_stream_topology *topology)
660 {
661  ast_stream_topology_free(chan->stream_topology);
662  chan->stream_topology = topology;
664 }
665 
667  struct ast_channel *chan, void *change_source)
668 {
669  chan->stream_topology_change_source = change_source;
670 }
671 
673 {
674  return chan->stream_topology_change_source;
675 }
676 
678  struct ast_format_cap *value)
679 {
680  SCOPE_ENTER(2, "%s: %sFormats: %s\n", S_OR(ast_channel_name(chan), "<initializing>"),
681  S_COR(ast_channel_is_multistream(chan), "Multistream", ""),
682  ast_str_tmp(128, ast_format_cap_get_names(value, &STR_TMP)));
683 
684  ast_assert(chan != NULL);
685 
686  ao2_replace(chan->nativeformats, value);
687 
688  /* If chan->stream_topology is NULL, the channel is being destroyed
689  * and topology is destroyed.
690  */
691  if (!chan->stream_topology) {
692  SCOPE_EXIT_RTN("Channel is being initialized or destroyed\n");
693  }
694 
695  if (!ast_channel_is_multistream(chan) || !value) {
696  struct ast_stream_topology *new_topology;
697 
698  new_topology = ast_stream_topology_create_from_format_cap(value);
699  ast_channel_internal_set_stream_topology(chan, new_topology);
700  SCOPE_EXIT_RTN("New %stopology set\n", value ? "" : "empty ");
701  }
702  SCOPE_EXIT_RTN("Set native formats but not topology\n");
703 }
704 
706 {
707  return chan->framehooks;
708 }
710 {
711  chan->framehooks = value;
712 }
714 {
715  return chan->generator;
716 }
718 {
719  chan->generator = value;
720 }
721 struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan)
722 {
723  return chan->pbx;
724 }
725 void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
726 {
727  chan->pbx = value;
728 }
730 {
731  return chan->sched;
732 }
734 {
735  chan->sched = value;
736 }
737 struct ast_timer *ast_channel_timer(const struct ast_channel *chan)
738 {
739  return chan->timer;
740 }
742 {
743  chan->timer = value;
744 }
745 struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan)
746 {
747  return chan->zone;
748 }
750 {
751  chan->zone = value;
752 }
754 {
755  return chan->readtrans;
756 }
758 {
759  chan->readtrans = value;
760 }
762 {
763  return chan->writetrans;
764 }
766 {
767  chan->writetrans = value;
768 }
769 const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan)
770 {
771  return chan->tech;
772 }
773 void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
774 {
775  if (value->read_stream || value->write_stream) {
776  ast_assert(value->read_stream && value->write_stream);
777  }
778 
779  chan->tech = value;
780 }
782 {
783  return chan->adsicpe;
784 }
786 {
787  chan->adsicpe = value;
788 }
790 {
791  return chan->state;
792 }
794 {
795  return chan->callid;
796 }
798 {
799  char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
800  char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
801  call_identifier_from[0] = '\0';
802  ast_callid_strnprint(call_identifier_to, sizeof(call_identifier_to), callid);
803  if (chan->callid) {
804  ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
805  ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
806  }
807 
808  chan->callid = callid;
809 
810  ast_test_suite_event_notify("CallIDChange",
811  "State: CallIDChange\r\n"
812  "Channel: %s\r\n"
813  "CallID: %s\r\n"
814  "PriorCallID: %s",
815  ast_channel_name(chan),
816  call_identifier_to,
817  call_identifier_from);
818 }
819 
821 {
822  chan->state = value;
823 }
825 {
826  ao2_replace(chan->oldwriteformat, format);
827 }
829 {
830  ao2_replace(chan->rawreadformat, format);
831 }
833 {
834  ao2_replace(chan->rawwriteformat, format);
835 }
837 {
838  ao2_replace(chan->readformat, format);
839 }
841 {
842  ao2_replace(chan->writeformat, format);
843 }
845 {
846  return chan->oldwriteformat;
847 }
849 {
850  return chan->rawreadformat;
851 }
853 {
854  return chan->rawwriteformat;
855 }
857 {
858  return chan->readformat;
859 }
861 {
862  return chan->writeformat;
863 }
865 {
866  return &chan->hangup_handlers;
867 }
869 {
870  return &chan->datastores;
871 }
873 {
874  return &chan->autochans;
875 }
877 {
878  return &chan->readq;
879 }
881 {
882  return &chan->dtmff;
883 }
884 struct ast_jb *ast_channel_jb(struct ast_channel *chan)
885 {
886  return &chan->jb;
887 }
889 {
890  return &chan->caller;
891 }
893 {
894  return &chan->connected;
895 }
897 {
898  return &chan->connected_indicated;
899 }
901 {
902  return ast_party_id_merge(&chan->connected.id, &chan->connected.priv);
903 }
905 {
906  return &chan->dialed;
907 }
909 {
910  return &chan->redirecting;
911 }
913 {
914  return ast_party_id_merge(&chan->redirecting.orig, &chan->redirecting.priv_orig);
915 }
917 {
918  return ast_party_id_merge(&chan->redirecting.from, &chan->redirecting.priv_from);
919 }
921 {
922  return ast_party_id_merge(&chan->redirecting.to, &chan->redirecting.priv_to);
923 }
924 struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan)
925 {
926  return &chan->dtmf_tv;
927 }
928 struct timeval *ast_channel_whentohangup(struct ast_channel *chan)
929 {
930  return &chan->whentohangup;
931 }
933 {
934  return &chan->varshead;
935 }
937 {
938  chan->dtmff = *value;
939 }
940 void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value)
941 {
942  chan->jb = *value;
943 }
945 {
946  chan->caller = *value;
948 }
950 {
951  chan->connected = *value;
953 }
955 {
956  chan->dialed = *value;
958 }
960 {
961  chan->redirecting = *value;
963 }
964 void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
965 {
966  chan->dtmf_tv = *value;
967 }
968 void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
969 {
970  chan->whentohangup = *value;
971 }
973 {
974  chan->varshead = *value;
975 }
976 struct timeval ast_channel_creationtime(struct ast_channel *chan)
977 {
978  return chan->creationtime;
979 }
980 void ast_channel_creationtime_set(struct ast_channel *chan, struct timeval *value)
981 {
982  chan->creationtime = *value;
984 }
985 
986 struct timeval ast_channel_answertime(struct ast_channel *chan)
987 {
988  return chan->answertime;
989 }
990 
991 void ast_channel_answertime_set(struct ast_channel *chan, struct timeval *value)
992 {
993  chan->answertime = *value;
994 }
995 
996 /* Evil softhangup accessors */
998 {
999  return chan->softhangup;
1000 }
1002 {
1003  chan->softhangup = value;
1004 }
1006 {
1007  chan->softhangup |= value;
1008 }
1010 {
1011  chan ->softhangup &= ~value;
1012 }
1013 
1015 {
1016  return chan->unbridged;
1017 }
1018 
1020 {
1021  int res;
1022  ast_channel_lock(chan);
1023  res = ast_channel_unbridged_nolock(chan);
1024  ast_channel_unlock(chan);
1025  return res;
1026 }
1027 
1029 {
1030  chan->unbridged = !!value;
1032 }
1033 
1035 {
1036  ast_channel_lock(chan);
1037  ast_channel_set_unbridged_nolock(chan, value);
1038  ast_channel_unlock(chan);
1039 }
1040 
1042 {
1043  return chan->is_t38_active;
1044 }
1045 
1047 {
1048  int res;
1049 
1050  ast_channel_lock(chan);
1052  ast_channel_unlock(chan);
1053  return res;
1054 }
1055 
1056 void ast_channel_set_is_t38_active_nolock(struct ast_channel *chan, int is_t38_active)
1057 {
1058  chan->is_t38_active = !!is_t38_active;
1059 }
1060 
1061 void ast_channel_set_is_t38_active(struct ast_channel *chan, int is_t38_active)
1062 {
1063  ast_channel_lock(chan);
1064  ast_channel_set_is_t38_active_nolock(chan, is_t38_active);
1065  ast_channel_unlock(chan);
1066 }
1067 
1069 {
1070  chan->callid = 0;
1071 }
1072 
1073 /* Typedef accessors */
1075 {
1076  return chan->callgroup;
1077 }
1079 {
1080  chan->callgroup = value;
1081 }
1083 {
1084  return chan->pickupgroup;
1085 }
1087 {
1088  chan->pickupgroup = value;
1089 }
1090 struct ast_namedgroups *ast_channel_named_callgroups(const struct ast_channel *chan)
1091 {
1092  return chan->named_callgroups;
1093 }
1094 void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
1095 {
1097  chan->named_callgroups = ast_ref_namedgroups(value);
1098 }
1099 struct ast_namedgroups *ast_channel_named_pickupgroups(const struct ast_channel *chan)
1100 {
1101  return chan->named_pickupgroups;
1102 }
1103 void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
1104 {
1106  chan->named_pickupgroups = ast_ref_namedgroups(value);
1107 }
1108 
1109 /* Alertpipe functions */
1111 {
1112  return ast_alertpipe_write(chan->alertpipe);
1113 }
1114 
1116 {
1117  return ast_alertpipe_flush(chan->alertpipe);
1118 }
1119 
1121 {
1122  return ast_alertpipe_read(chan->alertpipe);
1123 }
1124 
1126 {
1127  return ast_alertpipe_writable(chan->alertpipe);
1128 }
1129 
1131 {
1132  return ast_alertpipe_readable(chan->alertpipe);
1133 }
1134 
1136 {
1137  ast_alertpipe_clear(chan->alertpipe);
1138 }
1139 
1141 {
1142  ast_alertpipe_close(chan->alertpipe);
1143 }
1144 
1146 {
1147  return ast_alertpipe_init(chan->alertpipe);
1148 }
1149 
1151 {
1152  return ast_alertpipe_readfd(chan->alertpipe);
1153 }
1154 
1156 {
1157  ast_alertpipe_swap(chan1->alertpipe, chan2->alertpipe);
1158 }
1159 
1160 /* file descriptor array accessors */
1161 void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
1162 {
1163  int pos;
1164 
1165  /* This ensures that if the vector has to grow with unused positions they will be
1166  * initialized to -1.
1167  */
1168  for (pos = AST_VECTOR_SIZE(&chan->fds); pos < which; pos++) {
1169  AST_VECTOR_REPLACE(&chan->fds, pos, -1);
1170  }
1171 
1172  AST_VECTOR_REPLACE(&chan->fds, which, value);
1173 }
1174 void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
1175 {
1176  if (which >= AST_VECTOR_SIZE(&chan->fds)) {
1177  return;
1178  }
1179 
1180  AST_VECTOR_REPLACE(&chan->fds, which, -1);
1181 }
1183 {
1185 }
1186 int ast_channel_fd(const struct ast_channel *chan, int which)
1187 {
1188  return (which >= AST_VECTOR_SIZE(&chan->fds)) ? -1 : AST_VECTOR_GET(&chan->fds, which);
1189 }
1190 int ast_channel_fd_isset(const struct ast_channel *chan, int which)
1191 {
1192  return ast_channel_fd(chan, which) > -1;
1193 }
1194 
1195 int ast_channel_fd_count(const struct ast_channel *chan)
1196 {
1197  return AST_VECTOR_SIZE(&chan->fds);
1198 }
1199 
1200 int ast_channel_fd_add(struct ast_channel *chan, int value)
1201 {
1202  int pos = AST_EXTENDED_FDS;
1203 
1204  while (ast_channel_fd_isset(chan, pos)) {
1205  pos += 1;
1206  }
1207 
1208  AST_VECTOR_REPLACE(&chan->fds, pos, value);
1209 
1210  return pos;
1211 }
1212 
1213 pthread_t ast_channel_blocker(const struct ast_channel *chan)
1214 {
1215  return chan->blocker;
1216 }
1217 void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value)
1218 {
1219  chan->blocker = value;
1220 }
1221 
1222 int ast_channel_blocker_tid(const struct ast_channel *chan)
1223 {
1224  return chan->blocker_tid;
1225 }
1227 {
1228  chan->blocker_tid = value;
1229 }
1230 
1232 {
1233  return chan->timingfunc;
1234 }
1236 {
1237  chan->timingfunc = value;
1238 }
1239 
1241 {
1242  return chan->bridge;
1243 }
1245 {
1246  chan->bridge = value;
1249 }
1250 
1252 {
1253  return chan->bridge_channel;
1254 }
1256 {
1257  chan->bridge_channel = value;
1258 }
1259 
1261 {
1262  return &chan->flags;
1263 }
1264 
1265 static int collect_names_cb(void *obj, void *arg, int flags) {
1266  struct ast_control_pvt_cause_code *cause_code = obj;
1267  struct ast_str **str = arg;
1268 
1269  ast_str_append(str, 0, "%s%s", (ast_str_strlen(*str) ? "," : ""), cause_code->chan_name);
1270 
1271  return 0;
1272 }
1273 
1275 {
1276  struct ast_str *chanlist = ast_str_create(128);
1277 
1278  if (!chanlist) {
1279  return NULL;
1280  }
1281 
1282  ao2_callback(chan->dialed_causes, 0, collect_names_cb, &chanlist);
1283 
1284  return chanlist;
1285 }
1286 
1288 {
1289  return ao2_find(chan->dialed_causes, chan_name, OBJ_KEY);
1290 }
1291 
1292 int ast_channel_dialed_causes_add(const struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
1293 {
1294  struct ast_control_pvt_cause_code *ao2_cause_code;
1295  ao2_find(chan->dialed_causes, cause_code->chan_name, OBJ_KEY | OBJ_UNLINK | OBJ_NODATA);
1296  ao2_cause_code = ao2_alloc(datalen, NULL);
1297 
1298  if (ao2_cause_code) {
1299  memcpy(ao2_cause_code, cause_code, datalen);
1300  ao2_link(chan->dialed_causes, ao2_cause_code);
1301  ao2_ref(ao2_cause_code, -1);
1302  return 0;
1303  } else {
1304  return -1;
1305  }
1306 }
1307 
1309 {
1311 }
1312 
1313 /* \brief Hash function for pvt cause code frames */
1314 static int pvt_cause_hash_fn(const void *vpc, const int flags)
1315 {
1316  const struct ast_control_pvt_cause_code *pc = vpc;
1318 }
1319 
1320 /* \brief Comparison function for pvt cause code frames */
1321 static int pvt_cause_cmp_fn(void *obj, void *vstr, int flags)
1322 {
1323  struct ast_control_pvt_cause_code *pc = obj;
1324  char *str = ast_tech_to_upper(ast_strdupa(vstr));
1325  char *pc_str = ast_tech_to_upper(ast_strdupa(pc->chan_name));
1326  return !strcmp(pc_str, str) ? CMP_MATCH | CMP_STOP : 0;
1327 }
1328 
1329 #define DIALED_CAUSES_BUCKETS 37
1330 
1331 struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj), const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *file, int line, const char *function)
1332 {
1333  struct ast_channel *tmp;
1334 
1335  tmp = __ao2_alloc(sizeof(*tmp), destructor,
1336  AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function);
1337 
1338  if (!tmp) {
1339  return NULL;
1340  }
1341 
1342  if ((ast_string_field_init(tmp, 128))) {
1343  return ast_channel_unref(tmp);
1344  }
1345 
1348  if (!tmp->dialed_causes) {
1349  return ast_channel_unref(tmp);
1350  }
1351 
1352  /* set the creation time in the uniqueid */
1353  tmp->uniqueid.creation_time = time(NULL);
1354  tmp->uniqueid.creation_unique = ast_atomic_fetchadd_int(&uniqueint, 1);
1355 
1356  /* use provided id or default to historical {system-}time.# format */
1357  if (assignedids && !ast_strlen_zero(assignedids->uniqueid)) {
1358  ast_copy_string(tmp->uniqueid.unique_id, assignedids->uniqueid, sizeof(tmp->uniqueid.unique_id));
1360  snprintf(tmp->uniqueid.unique_id, sizeof(tmp->uniqueid.unique_id), "%li.%d",
1361  (long)(tmp->uniqueid.creation_time),
1362  tmp->uniqueid.creation_unique);
1363  } else {
1364  snprintf(tmp->uniqueid.unique_id, sizeof(tmp->uniqueid.unique_id), "%s-%li.%d",
1366  (long)(tmp->uniqueid.creation_time),
1367  tmp->uniqueid.creation_unique);
1368  }
1369 
1370  /* copy linked id from parent channel if known */
1371  if (requestor) {
1372  tmp->linkedid = requestor->linkedid;
1373  } else {
1374  tmp->linkedid = tmp->uniqueid;
1375  }
1376 
1377  AST_VECTOR_INIT(&tmp->fds, AST_MAX_FDS);
1378 
1379  /* Force all channel snapshot segments to be created on first use, so we don't have to check if
1380  * an old snapshot exists.
1381  */
1382  ast_set_flag(&tmp->snapshot_segment_flags, AST_FLAGS_ALL);
1383 
1384  return tmp;
1385 }
1386 
1388 {
1391 
1393  return a;
1394  }
1396  return b;
1397  }
1399  return a;
1400  }
1401  return b;
1402 }
1403 
1405 {
1406  if (dest->linkedid.creation_time == source->linkedid.creation_time
1407  && dest->linkedid.creation_unique == source->linkedid.creation_unique
1408  && !strcmp(dest->linkedid.unique_id, source->linkedid.unique_id)) {
1409  return;
1410  }
1411  dest->linkedid = source->linkedid;
1414 }
1415 
1417 {
1418  struct ast_channel_id temp;
1419 
1420  /* This operation is used as part of masquerading and so does not invalidate the peer
1421  * segment. This is due to the masquerade process invalidating all segments.
1422  */
1423 
1424  temp = a->uniqueid;
1425  a->uniqueid = b->uniqueid;
1426  b->uniqueid = temp;
1427 
1428  temp = a->linkedid;
1429  a->linkedid = b->linkedid;
1430  b->linkedid = temp;
1431 }
1432 
1434 {
1435  struct stasis_topic *topic;
1436  struct stasis_forward *forward;
1437 
1438  topic = a->topic;
1439  a->topic = b->topic;
1440  b->topic = topic;
1441 
1442  forward = a->channel_forward;
1443  a->channel_forward = b->channel_forward;
1444  b->channel_forward = forward;
1445 }
1446 
1448 {
1449  struct stasis_forward *temp;
1450 
1451  temp = a->endpoint_forward;
1452  a->endpoint_forward = b->endpoint_forward;
1453  b->endpoint_forward = temp;
1454 }
1455 
1457 {
1458  struct ast_channel_snapshot *snapshot;
1459 
1460  snapshot = a->snapshot;
1461  a->snapshot = b->snapshot;
1462  b->snapshot = snapshot;
1463 }
1464 
1465 void ast_channel_internal_set_fake_ids(struct ast_channel *chan, const char *uniqueid, const char *linkedid)
1466 {
1467  ast_copy_string(chan->uniqueid.unique_id, uniqueid, sizeof(chan->uniqueid.unique_id));
1468  ast_copy_string(chan->linkedid.unique_id, linkedid, sizeof(chan->linkedid.unique_id));
1469 }
1470 
1472 {
1473  if (chan->dialed_causes) {
1474  ao2_t_ref(chan->dialed_causes, -1,
1475  "done with dialed causes since the channel is going away");
1476  chan->dialed_causes = NULL;
1477  }
1478 
1480 
1481  chan->channel_forward = stasis_forward_cancel(chan->channel_forward);
1482  chan->endpoint_forward = stasis_forward_cancel(chan->endpoint_forward);
1483 
1484  ao2_cleanup(chan->topic);
1485  chan->topic = NULL;
1486 
1488 
1489  AST_VECTOR_FREE(&chan->fds);
1490 }
1491 
1493 {
1494  chan->finalized = 1;
1495 }
1496 
1498 {
1499  return chan->finalized;
1500 }
1501 
1503 {
1504  if (!chan) {
1505  return ast_channel_topic_all();
1506  }
1507 
1508  return chan->topic;
1509 }
1510 
1512  struct ast_endpoint *endpoint)
1513 {
1514  ast_assert(chan != NULL);
1515  ast_assert(endpoint != NULL);
1516 
1517  chan->endpoint_forward =
1519  ast_endpoint_topic(endpoint));
1520  if (!chan->endpoint_forward) {
1521  return -1;
1522  }
1523 
1524  return 0;
1525 }
1526 
1528 {
1529  char *topic_name;
1530  int ret;
1531  ast_assert(chan->topic == NULL);
1532 
1533  if (ast_strlen_zero(chan->uniqueid.unique_id)) {
1534  static int dummy_id;
1535  ret = ast_asprintf(&topic_name, "channel:dummy-%d", ast_atomic_fetchadd_int(&dummy_id, +1));
1536  } else {
1537  ret = ast_asprintf(&topic_name, "channel:%s", chan->uniqueid.unique_id);
1538  }
1539 
1540  if (ret < 0) {
1541  return -1;
1542  }
1543 
1544  chan->topic = stasis_topic_create(topic_name);
1545  ast_free(topic_name);
1546  if (!chan->topic) {
1547  return -1;
1548  }
1549 
1550  chan->channel_forward = stasis_forward_all(ast_channel_topic(chan),
1552  if (!chan->channel_forward) {
1553  ao2_ref(chan->topic, -1);
1554  chan->topic = NULL;
1555  return -1;
1556  }
1557 
1558  return 0;
1559 }
1560 
1562 
1564 {
1565  enum ast_channel_error *error_code = ast_threadstorage_get(&channel_errno, sizeof(*error_code));
1566  if (!error_code) {
1567  return;
1568  }
1569 
1570  *error_code = error;
1571 }
1572 
1574 {
1575  enum ast_channel_error *error_code = ast_threadstorage_get(&channel_errno, sizeof(*error_code));
1576  if (!error_code) {
1578  }
1579 
1580  return *error_code;
1581 }
1582 
1584  const struct ast_channel *chan)
1585 {
1586  ast_assert(chan != NULL);
1587 
1588  return chan->stream_topology;
1589 }
1590 
1592  struct ast_stream_topology *topology)
1593 {
1594  struct ast_stream_topology *new_topology;
1595  SCOPE_ENTER(1, "%s: %s\n", ast_channel_name(chan),
1596  ast_str_tmp(256, ast_stream_topology_to_str(topology, &STR_TMP)));
1597 
1598  ast_assert(chan != NULL);
1599 
1600  /* A non-MULTISTREAM channel can't manipulate topology directly */
1602 
1603  /* Unless the channel is being destroyed, we always want a topology on
1604  * it even if its empty.
1605  */
1606  if (!topology) {
1607  new_topology = ast_stream_topology_alloc();
1608  } else {
1609  new_topology = topology;
1610  }
1611 
1612  if (new_topology) {
1613  ast_channel_internal_set_stream_topology(chan, new_topology);
1614  }
1615 
1616  SCOPE_EXIT_RTN_VALUE(new_topology, "Used %s topology\n", topology ? "provided" : "empty");
1617 }
1618 
1620  enum ast_media_type type)
1621 {
1622  ast_assert(chan != NULL);
1624 
1625  return chan->default_streams[type];
1626 }
1627 
1629  struct ast_channel *chan2)
1630 {
1631  struct ast_stream_topology *tmp_topology;
1632 
1633  ast_assert(chan1 != NULL && chan2 != NULL);
1634 
1635  tmp_topology = chan1->stream_topology;
1636  chan1->stream_topology = chan2->stream_topology;
1637  chan2->stream_topology = tmp_topology;
1638 
1641 }
1642 
1644 {
1645  return (chan->tech && chan->tech->read_stream && chan->tech->write_stream);
1646 }
1647 
1649 {
1650  return chan->snapshot;
1651 }
1652 
1653 void ast_channel_snapshot_set(struct ast_channel *chan, struct ast_channel_snapshot *snapshot)
1654 {
1655  ao2_cleanup(chan->snapshot);
1656  chan->snapshot = ao2_bump(snapshot);
1657 }
1658 
1660 {
1661  return &chan->snapshot_segment_flags;
1662 }
int ast_channel_fdno(const struct ast_channel *chan)
#define ao2_t_ref(o, delta, tag)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:463
void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value)
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
static int collect_names_cb(void *obj, void *arg, int flags)
int ast_channel_unbridged(struct ast_channel *chan)
This function will check if the bridge needs to be re-evaluated due to external changes.
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
Definition: vector.h:174
void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
static char musicclass[MAX_MUSICCLASS]
Definition: chan_mgcp.c:162
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
Definition: threadstorage.h:84
void * ast_channel_generatordata(const struct ast_channel *chan)
void ast_channel_creationtime_set(struct ast_channel *chan, struct timeval *value)
unsigned long long ast_group_t
Definition: channel.h:214
static const char type[]
Definition: chan_ooh323.c:109
void ast_channel_callid_cleanup(struct ast_channel *chan)
Information needed to identify an endpoint in a call.
Definition: channel.h:339
enum sip_cc_notify_state state
Definition: chan_sip.c:957
Tone Indication Support.
ast_alert_status_t ast_channel_internal_alert_flush(struct ast_channel *chan)
static char accountcode[AST_MAX_ACCOUNT_CODE]
Definition: chan_iax2.c:429
int ast_channel_internal_is_finalized(struct ast_channel *chan)
struct ast_channel * masqr
#define ast_channel_lock(chan)
Definition: channel.h:2890
static int pvt_cause_hash_fn(const void *vpc, const int flags)
static char exten[AST_MAX_EXTENSION]
Definition: chan_alsa.c:118
Main Channel structure associated with a channel.
struct ast_format * ast_channel_rawreadformat(struct ast_channel *chan)
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
const char * ast_channel_appl(const struct ast_channel *chan)
struct ast_channel * masq
struct ast_party_connected_line connected
Channel Connected Line ID information.
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
void ast_channel_set_unbridged_nolock(struct ast_channel *chan, int value)
Variant of ast_channel_set_unbridged. Use this if the channel is already locked prior to calling...
void ast_channel_set_unbridged(struct ast_channel *chan, int value)
Sets the unbridged flag and queues a NULL frame on the channel to trigger a check by bridge_channel_w...
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
Asterisk main include file. File version handling, generic pbx functions.
struct timeval answertime
struct ast_party_connected_line * ast_channel_connected_indicated(struct ast_channel *chan)
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_rings_set(struct ast_channel *chan, int value)
char chan_name[AST_CHANNEL_NAME]
static char parkinglot[AST_MAX_CONTEXT]
Definition: chan_mgcp.c:163
struct ast_party_caller caller
Channel Caller ID information.
struct ast_tone_zone * zone
void * ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size)
Retrieve thread storage.
const char * ast_channel_blockproc(const struct ast_channel *chan)
static int amaflags
Definition: chan_iax2.c:432
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
struct ast_channel_id linkedid
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_masqr_set(struct ast_channel *chan, struct ast_channel *value)
void ast_channel_internal_alertpipe_swap(struct ast_channel *chan1, struct ast_channel *chan2)
Swap the interal alertpipe between two channels.
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
struct varshead * ast_channel_varshead(struct ast_channel *chan)
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2926
enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan)
void ast_channel_internal_bridge_channel_set(struct ast_channel *chan, struct ast_bridge_channel *value)
#define OBJ_KEY
Definition: astobj2.h:1155
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value)
static void channel_set_default_streams(struct ast_channel *chan)
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
struct ast_autochan_list * ast_channel_autochans(struct ast_channel *chan)
Channel UniqueId structure.
int ast_channel_streamid(const struct ast_channel *chan)
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
#define ast_set_flag(p, flag)
Definition: utils.h:70
void ast_channel_fdno_set(struct ast_channel *chan, int value)
void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value)
const char * blockproc
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
#define ao2_callback(c, flags, cb_fn, arg)
Definition: astobj2.h:1716
unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
struct ast_autochan_list autochans
void ast_channel_generatordata_set(struct ast_channel *chan, void *value)
ast_timing_func_t timingfunc
static int tmp()
Definition: bt_open.c:389
unsigned int flags
Definition: utils.h:200
int ast_channel_is_t38_active_nolock(struct ast_channel *chan)
ast_channel_is_t38_active variant. Use this if the channel is already locked prior to calling...
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
struct ast_generator * generator
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
void ast_channel_sending_dtmf_tv_set(struct ast_channel *chan, struct timeval value)
Structure representing a snapshot of channel state.
struct ast_frame *(*const read_stream)(struct ast_channel *chan)
Read a frame (or chain of frames from the same stream), in standard format (see frame.h), with stream num.
Definition: channel.h:748
int ast_channel_forward_endpoint(struct ast_channel *chan, struct ast_endpoint *endpoint)
Forward channel stasis messages to the given endpoint.
void * __ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result
Definition: astobj2.c:765
Test Framework API.
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
void ast_channel_macrocontext_set(struct ast_channel *chan, const char *value)
Structure to pass both assignedid values to channel drivers.
Definition: channel.h:605
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
unsigned long outsmpl
struct ast_sched_context * sched
ast_channel_state
ast_channel states
Definition: channelstate.h:35
struct ast_frame * ast_channel_dtmff(struct ast_channel *chan)
char unique_id[AST_MAX_UNIQUEID]
struct stasis_topic * ast_endpoint_topic(struct ast_endpoint *endpoint)
Returns the topic for a specific endpoint.
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
void ast_channel_internal_finalize(struct ast_channel *chan)
Definition of a media format.
Definition: format.c:43
void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1091
void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value)
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Definition: stringfields.h:337
struct ast_stream_topology * ast_stream_topology_create_from_format_cap(struct ast_format_cap *cap)
A helper function that, given a format capabilities structure, creates a topology and separates the m...
Definition: stream.c:848
struct ast_cdr * ast_channel_cdr(const struct ast_channel *chan)
void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value)
unsigned int ast_callid
Definition: logger.h:87
const char * uniqueid
Definition: channel.h:606
#define ast_assert(a)
Definition: utils.h:650
void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
struct ast_cdr * cdr
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_priority_set(struct ast_channel *chan, int value)
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
Endpoint abstractions.
const char * str
Definition: app_jack.c:147
void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value)
struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan)
int ast_alertpipe_readable(int alert_pipe[2])
Determine if the alert pipe is readable.
Definition: alertpipe.h:112
void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
#define NULL
Definition: resample.c:96
void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value)
const char * data
struct ast_namedgroups * ast_channel_named_pickupgroups(const struct ast_channel *chan)
int value
Definition: syslog.c:37
int ast_channel_hangupcause(const struct ast_channel *chan)
#define DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR(field, publish, assert_on_null, invalidate)
const char * ast_channel_exten(const struct ast_channel *chan)
struct ast_readq_list readq
static int priority
void ast_channel_dialed_causes_clear(const struct ast_channel *chan)
Clear all cause information from the channel.
ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan)
void ast_channel_macropriority_set(struct ast_channel *chan, int value)
ast_group_t pickupgroup
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
const char * appl
struct timeval ast_channel_answertime(struct ast_channel *chan)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
Definition: lock.h:755
ast_group_t callgroup
void ast_channel_internal_swap_topics(struct ast_channel *a, struct ast_channel *b)
Swap topics beteween two channels.
Media Stream API.
struct ast_frame dtmff
void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value)
int ast_channel_is_t38_active(struct ast_channel *chan)
This function will check if T.38 is active on the channel.
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
Definition: astmm.h:269
void ast_alertpipe_close(int alert_pipe[2])
Close an alert pipe.
Definition: alertpipe.c:79
int ast_channel_is_multistream(struct ast_channel *chan)
Determine if a channel is multi-stream capable.
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
const char * ast_config_AST_SYSTEM_NAME
Definition: options.c:167
ssize_t ast_alertpipe_write(int alert_pipe[2])
Write an event to an alert pipe.
Definition: alertpipe.c:120
const struct ast_channel_tech * tech
#define ao2_bump(obj)
Definition: astobj2.h:491
struct ast_audiohook_list * ast_channel_audiohooks(const struct ast_channel *chan)
int ast_channel_priority(const struct ast_channel *chan)
void ast_channel_macroexten_set(struct ast_channel *chan, const char *value)
void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value)
void ast_alertpipe_clear(int alert_pipe[2])
Sets the alert pipe file descriptors to default values.
Definition: alertpipe.h:97
void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value)
const char * ast_channel_context(const struct ast_channel *chan)
void ast_channel_internal_alertpipe_close(struct ast_channel *chan)
void ast_channel_internal_set_fake_ids(struct ast_channel *chan, const char *uniqueid, const char *linkedid)
Set uniqueid and linkedid string value only (not time)
void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value)
#define ast_str_tmp(init_len, __expr)
Definition: strings.h:1136
Definition: pbx.h:211
int ast_channel_blocker_tid(const struct ast_channel *chan)
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:444
struct ast_channel * ast_channel_masqr(const struct ast_channel *chan)
struct ast_framehook_list * ast_channel_framehooks(const struct ast_channel *chan)
int ast_channel_internal_alertpipe_init(struct ast_channel *chan)
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
Definition: stream.c:936
void ast_channel_data_set(struct ast_channel *chan, const char *value)
int ast_alertpipe_writable(int alert_pipe[2])
Determine if the alert pipe is writable.
Definition: alertpipe.h:127
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
Definition: vector.h:113
struct ast_stream * ast_stream_topology_get_first_stream_by_type(const struct ast_stream_topology *topology, enum ast_media_type type)
Gets the first active stream of a specific type from the topology.
Definition: stream.c:964
General Asterisk PBX channel definitions.
static char dialcontext[AST_MAX_CONTEXT]
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
Asterisk file paths, configured in asterisk.conf.
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
Definition: vector.h:573
#define DEFINE_STRINGFIELD_SETTERS_FOR(field, assert_on_null)
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
A set of tones for a given locale.
Definition: indications.h:74
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:353
const char * ast_channel_uniqueid(const struct ast_channel *chan)
static struct ast_threadstorage channel_errno
struct ast_audiohook_list * audiohooks
unsigned int ast_channel_fin(const struct ast_channel *chan)
int ast_channel_internal_alert_readable(struct ast_channel *chan)
void ast_channel_internal_swap_stream_topology(struct ast_channel *chan1, struct ast_channel *chan2)
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
#define AST_MAX_EXTENSION
Definition: channel.h:135
struct ast_stream_topology * ast_channel_set_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
Set the topology of streams on a channel.
#define AST_STRING_FIELD(name)
Declare a string field.
Definition: stringfields.h:299
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid callid)
Caller Party information.
Definition: channel.h:419
void ast_channel_internal_swap_snapshots(struct ast_channel *a, struct ast_channel *b)
Swap snapshots beteween two channels.
struct ast_format * ast_channel_rawwriteformat(struct ast_channel *chan)
#define ao2_ref(o, delta)
Definition: astobj2.h:464
void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value)
struct ast_jb * ast_channel_jb(struct ast_channel *chan)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
Definition: strings.h:85
struct ast_party_id ast_channel_redirecting_effective_orig(struct ast_channel *chan)
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
List of channel drivers.
Definition: app_dial.c:795
void ast_channel_vstreamid_set(struct ast_channel *chan, int value)
int ast_channel_unbridged_nolock(struct ast_channel *chan)
ast_channel_unbridged variant. Use this if the channel is already locked prior to calling...
struct ao2_container * dialed_causes
int ast_alertpipe_init(int alert_pipe[2])
Initialize an alert pipe.
Definition: alertpipe.c:38
static char language[MAX_LANGUAGE]
Definition: chan_alsa.c:117
int ast_channel_internal_setup_topics(struct ast_channel *chan)
void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value)
#define AST_VECTOR(name, type)
Define a vector structure.
Definition: vector.h:44
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
Definition: stasis.c:614
void ast_channel_internal_set_stream_topology_change_source(struct ast_channel *chan, void *change_source)
void ast_channel_hold_state_set(struct ast_channel *chan, int value)
int ast_channel_visible_indication(const struct ast_channel *chan)
int ast_channel_fd_count(const struct ast_channel *chan)
Retrieve the number of file decriptor positions present on the channel.
#define DEFINE_STRINGFIELD_GETTER_FOR(field)
struct ast_bridge * ast_channel_internal_bridge(const struct ast_channel *chan)
int ast_channel_alert_write(struct ast_channel *chan)
void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value)
void ast_channel_blocker_tid_set(struct ast_channel *chan, int value)
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Definition: channel.h:629
int(* ast_timing_func_t)(const void *data)
Definition: channel.h:900
struct ast_flags * ast_channel_snapshot_segment_flags(struct ast_channel *chan)
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel&#39;s frame queue.
Definition: channel.c:1135
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_internal_copy_linkedid(struct ast_channel *dest, struct ast_channel *source)
Copy the full linkedid channel id structure from one channel to another.
void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value)
void ast_channel_internal_errno_set(enum ast_channel_error error)
#define ast_test_suite_event_notify(s, f,...)
Definition: test.h:196
struct ast_format * ast_channel_oldwriteformat(struct ast_channel *chan)
void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value)
struct ast_party_dialed dialed
Dialed/Called information.
void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
struct ast_trans_pvt * writetrans
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
struct ast_datastore_list * ast_channel_datastores(struct ast_channel *chan)
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
Dialed/Called Party information.
Definition: channel.h:379
Responsible for call detail data.
Definition: cdr.h:276
Structure that contains information about a bridge.
Definition: bridge.h:357
struct ast_hangup_handler_list hangup_handlers
int ast_channel_timingfd(const struct ast_channel *chan)
#define AST_EXTENDED_FDS
Definition: channel.h:196
char * ast_tech_to_upper(char *dev_str)
Convert the tech portion of a device string to upper case.
Definition: strings.h:1183
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Definition: astobj2.h:1310
int(*const write_stream)(struct ast_channel *chan, int stream_num, struct ast_frame *frame)
Write a frame on a specific stream, in standard format (see frame.h)
Definition: channel.h:754
ast_alert_status_t ast_alertpipe_read(int alert_pipe[2])
Read an event from an alert pipe.
Definition: alertpipe.c:102
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:584
void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value)
Format capabilities structure, holds formats + preference order + etc.
Definition: format_cap.c:54
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
Definition: translate.h:213
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
Internal channel functions for channel.c to use.
struct ast_party_id ast_party_id_merge(struct ast_party_id *base, struct ast_party_id *overlay)
Merge a given party id into another given party id.
Definition: channel.c:1888
struct ast_stream_topology * ast_stream_topology_alloc(void)
Create a stream topology.
Definition: stream.c:650
struct ast_channel_monitor * ast_channel_monitor(const struct ast_channel *chan)
void ast_channel_answertime_set(struct ast_channel *chan, struct timeval *value)
void * ast_channel_get_stream_topology_change_source(struct ast_channel *chan)
Retrieve the source that initiated the last stream topology change.
int ast_alertpipe_readfd(int alert_pipe[2])
Get the alert pipe&#39;s read file descriptor.
Definition: alertpipe.h:143
ast_callid ast_channel_callid(const struct ast_channel *chan)
void ast_channel_internal_cleanup(struct ast_channel *chan)
unsigned long insmpl
void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid)
copy a string representation of the callid into a target string
Definition: logger.c:1917
struct ast_framehook_list * framehooks
ast_channel_adsicpe
Definition: channel.h:869
const char * ast_channel_data(const struct ast_channel *chan)
struct ast_namedgroups * named_pickupgroups
struct ast_channel * ast_channel_internal_oldest_linkedid(struct ast_channel *a, struct ast_channel *b)
Determine which channel has an older linkedid.
int ast_channel_hold_state(const struct ast_channel *chan)
Connected Line/Party information.
Definition: channel.h:457
void ast_channel_set_is_t38_active(struct ast_channel *chan, int is_t38_active)
Sets the is_t38_active flag.
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:411
ast_channel_error
Definition: channel.h:4965
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
Definition: channel.h:523
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
const char * ast_format_cap_get_names(const struct ast_format_cap *cap, struct ast_str **buf)
Get the names of codecs of a set of formats.
Definition: format_cap.c:736
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
#define SCOPE_EXIT_RTN(...)
Definition: logger.h:900
General jitterbuffer state.
Definition: abstract_jb.h:140
struct ast_control_pvt_cause_code * ast_channel_dialed_causes_find(const struct ast_channel *chan, const char *chan_name)
Retrieve a ref-counted cause code information structure.
int ast_channel_dialed_causes_add(const struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Add cause code information to the channel.
#define ast_strlen_zero(a)
Definition: muted.c:73
struct ast_namedgroups * ast_ref_namedgroups(struct ast_namedgroups *groups)
Definition: channel.c:7701
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
#define ast_channel_unlock(chan)
Definition: channel.h:2891
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
#define AST_MAX_CONTEXT
Definition: channel.h:136
static const char name[]
Definition: cdr_mysql.c:74
#define ast_free(a)
Definition: astmm.h:182
void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
Definition: vector.h:627
struct ast_filestream * vstream
struct ast_jb jb
pthread_t ast_channel_blocker(const struct ast_channel *chan)
void ast_channel_sending_dtmf_digit_set(struct ast_channel *chan, char value)
void * ast_channel_music_state(const struct ast_channel *chan)
#define AST_MAX_FDS
Definition: channel.h:195
#define AST_FLAGS_ALL
Definition: utils.h:196
struct ast_datastore_list datastores
#define SCOPE_ENTER(level,...)
Definition: logger.h:885
struct stasis_forward * stasis_forward_cancel(struct stasis_forward *forward)
Definition: stasis.c:1544
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
void ast_channel_internal_alertpipe_clear(struct ast_channel *chan)
struct timeval creationtime
void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
char ast_channel_sending_dtmf_digit(const struct ast_channel *chan)
struct ast_bridge_channel * ast_channel_internal_bridge_channel(const struct ast_channel *chan)
Vector container support.
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
struct ast_timer * ast_channel_timer(const struct ast_channel *chan)
struct ast_channel_snapshot * ast_channel_snapshot(const struct ast_channel *chan)
Structure used to handle boolean flags.
Definition: utils.h:199
struct timeval ast_channel_sending_dtmf_tv(const struct ast_channel *chan)
ast_alert_status_t ast_alertpipe_flush(int alert_pipe[2])
Consume all alerts written to the alert pipe.
Definition: alertpipe.c:134
struct ast_str * ast_channel_dialed_causes_channels(const struct ast_channel *chan)
Retrieve a comma-separated list of channels for which dialed cause information is available...
struct ast_party_connected_line connected_indicated
Channel Connected Line ID information that was last indicated.
void ast_channel_internal_swap_uniqueid_and_linkedid(struct ast_channel *a, struct ast_channel *b)
Swap uniqueid and linkedid beteween two channels.
struct ast_frame ast_null_frame
Definition: main/frame.c:79
struct timeval * ast_channel_dtmf_tv(struct ast_channel *chan)
#define SCOPE_EXIT_RTN_VALUE(__return_value,...)
Definition: logger.h:904
int ast_channel_vstreamid(const struct ast_channel *chan)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
Definition: strings.h:688
void ast_channel_set_is_t38_active_nolock(struct ast_channel *chan, int is_t38_active)
Variant of ast_channel_set_is_t38_active. Use this if the channel is already locked prior to calling...
struct ast_channel * ast_channel_masq(const struct ast_channel *chan)
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
Definition: vector.h:682
struct ast_channel * chan
Structure that contains information regarding a channel in a bridge.
void ast_channel_timingfd_set(struct ast_channel *chan, int value)
void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value)
This structure is allocated by file.c in one chunk, together with buf_size and desc_size bytes of mem...
Definition: mod_format.h:101
struct ast_namedgroups * ast_channel_named_callgroups(const struct ast_channel *chan)
struct timeval ast_channel_creationtime(struct ast_channel *chan)
#define ao2_replace(dst, src)
Definition: astobj2.h:517
unsigned int ast_channel_fout(const struct ast_channel *chan)
void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value)
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
struct ast_hangup_handler_list * ast_channel_hangup_handlers(struct ast_channel *chan)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
Definition: strings.h:79
const char * ast_channel_name(const struct ast_channel *chan)
void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value)
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
void ast_channel_internal_fd_clear_all(struct ast_channel *chan)
int ast_channel_rings(const struct ast_channel *chan)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
#define AST_CALLID_BUFFER_LENGTH
Definition: logger.h:46
enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan)
#define AST_VECTOR_REPLACE(vec, idx, elem)
Replace an element at a specific position in a vector, growing the vector if needed.
Definition: vector.h:284
void ast_channel_music_state_set(struct ast_channel *chan, void *value)
struct ast_readq_list * ast_channel_readq(struct ast_channel *chan)
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
Data structure associated with a single frame of data.
void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
struct ast_namedgroups * named_callgroups
void ast_channel_timingdata_set(struct ast_channel *chan, void *value)
void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_filestream * ast_channel_vstream(const struct ast_channel *chan)
struct ast_channel_id uniqueid
static struct test_val b
int error(const char *format,...)
Definition: utils/frame.c:999
Forwarding information.
Definition: stasis.c:1527
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
struct timeval dtmf_tv
const char * ast_channel_macrocontext(const struct ast_channel *chan)
struct timeval whentohangup
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
void ast_channel_snapshot_set(struct ast_channel *chan, struct ast_channel_snapshot *snapshot)
int ast_channel_macropriority(const struct ast_channel *chan)
ast_media_type
Types of media.
Definition: codec.h:30
void ast_alertpipe_swap(int alert_pipe_1[2], int alert_pipe_2[2])
Swap the file descriptors from two alert pipes.
Definition: alertpipe.h:158
const char * ast_channel_macroexten(const struct ast_channel *chan)
void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value)
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
Generic container type.
struct ast_trans_pvt * readtrans
ama_flags
Channel AMA Flags.
Definition: channel.h:1178
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
Definition: channel.c:7695
int ast_channel_fd_isset(const struct ast_channel *chan, int which)
static char context[AST_MAX_CONTEXT]
Definition: chan_alsa.c:116
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
struct ast_channel_monitor * monitor
unsigned long ast_channel_insmpl(const struct ast_channel *chan)
static int pvt_cause_cmp_fn(void *obj, void *vstr, int flags)
struct stasis_forward * stasis_forward_all(struct stasis_topic *from_topic, struct stasis_topic *to_topic)
Create a subscription which forwards all messages from one topic to another.
Definition: stasis.c:1574
void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
void ast_channel_streamid_set(struct ast_channel *chan, int value)
struct ast_stream * ast_channel_get_default_stream(struct ast_channel *chan, enum ast_media_type type)
Retrieve the default stream of a specific media type on a channel.
struct ast_party_id ast_channel_redirecting_effective_to(struct ast_channel *chan)
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
Definition: stream.c:743
void * ast_channel_tech_pvt(const struct ast_channel *chan)
struct ast_channel * __ast_channel_internal_alloc(void(*destructor)(void *obj), const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *file, int line, const char *function)
struct ast_filestream * stream
enum ama_flags ast_channel_amaflags(const struct ast_channel *chan)
struct ast_party_id ast_channel_redirecting_effective_from(struct ast_channel *chan)
static struct ast_timer * timer
Definition: chan_iax2.c:361
char connected
Definition: eagi_proxy.c:82
const char * ast_channel_linkedid(const struct ast_channel *chan)
#define AST_MAX_UNIQUEID
Definition: channel.h:169
int ast_channel_fd(const struct ast_channel *chan, int which)
int ast_channel_internal_alert_readfd(struct ast_channel *chan)
static snd_pcm_format_t format
Definition: chan_alsa.c:102
unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
void * ast_channel_timingdata(const struct ast_channel *chan)
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Definition: stringfields.h:368
struct ast_generator * ast_channel_generator(const struct ast_channel *chan)
Endpoint abstractions.
ast_alert_status_t
Definition: alertpipe.h:24
void ast_channel_internal_swap_endpoint_forward(struct ast_channel *a, struct ast_channel *b)
Swap endpoint_forward between two channels.
void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
struct varshead varshead
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
Definition: vector.h:611
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
#define DIALED_CAUSES_BUCKETS
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
static int uniqueint
The monotonically increasing integer counter for channel uniqueids.
void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value)
void ast_channel_internal_set_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
#define ast_str_create(init_len)
Create a malloc&#39;ed dynamic length string.
Definition: strings.h:620
int ast_channel_fd_add(struct ast_channel *chan, int value)
Add a file descriptor to the channel without a fixed position.
struct ast_pbx * pbx
enum ast_channel_error ast_channel_internal_errno(void)
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
Definition: strings.h:1206
int ast_channel_alert_writable(struct ast_channel *chan)
static struct test_val a
void ast_channel_context_set(struct ast_channel *chan, const char *value)
#define ao2_link(container, obj)
Definition: astobj2.h:1549