Asterisk - The Open Source Telephony Project GIT-master-67613d1
channel.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2006, 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 * \brief General Asterisk PBX channel definitions.
21 * \par See also:
22 * \arg \ref Def_Channel
23 * \arg \ref channel_drivers
24 */
25
26/*! \page Def_Channel Asterisk Channels
27 \par What is a Channel?
28 A phone call through Asterisk consists of an incoming
29 connection and an outbound connection. Each call comes
30 in through a channel driver that supports one technology,
31 like SIP, DAHDI, IAX2 etc.
32 \par
33 Each channel driver, technology, has it's own private
34 channel or dialog structure, that is technology-dependent.
35 Each private structure is "owned" by a generic Asterisk
36 channel structure, defined in channel.h and handled by
37 channel.c .
38 \par Call scenario
39 This happens when an incoming call arrives to Asterisk
40 -# Call arrives on a channel driver interface
41 -# Channel driver creates a PBX channel and starts a
42 pbx thread on the channel
43 -# The dial plan is executed
44 -# At this point at least two things can happen:
45 -# The call is answered by Asterisk and
46 Asterisk plays a media stream or reads media
47 -# The dial plan forces Asterisk to create an outbound
48 call somewhere with the dial (see \ref app_dial.c)
49 application
50 .
51
52 \par Bridging channels
53 If Asterisk dials out this happens:
54 -# Dial creates an outbound PBX channel and asks one of the
55 channel drivers to create a call
56 -# When the call is answered, Asterisk bridges the media streams
57 so the caller on the first channel can speak with the callee
58 on the second, outbound channel
59 -# In some cases where we have the same technology on both
60 channels and compatible codecs, a native bridge is used.
61 In a native bridge, the channel driver handles forwarding
62 of incoming audio to the outbound stream internally, without
63 sending audio frames through the PBX.
64 -# In SIP, theres an "external native bridge" where Asterisk
65 redirects the endpoint, so audio flows directly between the
66 caller's phone and the callee's phone. Signalling stays in
67 Asterisk in order to be able to provide a proper CDR record
68 for the call.
69
70
71 \par Masquerading channels
72 In some cases, a channel can masquerade itself into another
73 channel. This happens frequently in call transfers, where
74 a new channel takes over a channel that is already involved
75 in a call. The new channel sneaks in and takes over the bridge
76 and the old channel, now a zombie, is hung up.
77
78 \par Reference
79 \arg channel.c - generic functions
80 \arg channel.h - declarations of functions, flags and structures
81 \arg translate.h - Transcoding support functions
82 \arg \ref channel_drivers - Implemented channel drivers
83 \arg \ref Def_Frame Asterisk Multimedia Frames
84 \arg \ref Def_Bridge
85
86*/
87/*! \page Def_Bridge Asterisk Channel Bridges
88
89 In Asterisk, there's several media bridges.
90
91 The Core bridge handles two channels (a "phone call") and bridge
92 them together.
93
94 The conference bridge (meetme) handles several channels simultaneously
95 with the support of an external timer (DAHDI timer). This is used
96 not only by the Conference application (meetme) but also by the
97 page application and the SLA system introduced in 1.4.
98 The conference bridge does not handle video.
99
100 When two channels of the same type connect, the channel driver
101 or the media subsystem used by the channel driver (i.e. RTP)
102 can create a native bridge without sending media through the
103 core.
104
105 Native bridging can be disabled by a number of reasons,
106 like DTMF being needed by the core or codecs being incompatible
107 so a transcoding module is needed.
108
109References:
110 \li \see ast_channel_early_bridge()
111 \li \see ast_channel_bridge()
112 \li \see app_meetme.c
113 \li \see ast_rtp_bridge()
114 \li \ref Def_Channel
115*/
116
117/*! \page AstFileDesc File descriptors
118 Asterisk File descriptors are connected to each channel (see \ref Def_Channel)
119 in the \ref ast_channel structure.
120*/
121
122#ifndef _ASTERISK_CHANNEL_H
123#define _ASTERISK_CHANNEL_H
124
125#include "asterisk/alertpipe.h"
126#include "asterisk/abstract_jb.h"
127#include "asterisk/astobj2.h"
128#include "asterisk/poll-compat.h"
129
130#if defined(__cplusplus) || defined(c_plusplus)
131extern "C" {
132#endif
133
134#define AST_MAX_EXTENSION 80 /*!< Max length of an extension */
135#define AST_MAX_CONTEXT 80 /*!< Max length of a context */
136
137/*!
138 * Max length of a channel uniqueid reported to the outside world.
139 *
140 * \details
141 * 149 = 127 (max systemname) + "-" + 10 (epoch timestamp)
142 * + "." + 10 (monotonically incrementing integer).
143 *
144 * \note If this value is ever changed, MAX_CHANNEL_ID should
145 * be updated in rtp_engine.h.
146 */
147#define AST_MAX_PUBLIC_UNIQUEID 149
148
149/*!
150 * The number of buckets to store channels or channel information
151 */
152#ifdef LOW_MEMORY
153#define AST_NUM_CHANNEL_BUCKETS 61
154#else
155#define AST_NUM_CHANNEL_BUCKETS 1567
156#endif
157
158/*!
159 * Maximum size of an internal Asterisk channel unique ID.
160 *
161 * \details
162 * Add two for the Local;2 channel to append a ';2' if needed
163 * plus nul terminator.
164 *
165 * \note If this value is ever changed, MAX_CHANNEL_ID should
166 * be updated in rtp_engine.h.
167 */
168#define AST_MAX_UNIQUEID (AST_MAX_PUBLIC_UNIQUEID + 2 + 1)
169
170#define AST_MAX_ACCOUNT_CODE 80 /*!< Max length of an account code */
171#define AST_CHANNEL_NAME 80 /*!< Max length of an ast_channel name */
172#define MAX_LANGUAGE 40 /*!< Max length of the language setting */
173#define MAX_MUSICCLASS 80 /*!< Max length of the music class setting */
174#define AST_MAX_USER_FIELD 256 /*!< Max length of the channel user field */
175
176#include "asterisk/frame.h"
177#include "asterisk/chanvars.h"
178#include "asterisk/config.h"
179#include "asterisk/lock.h"
180#include "asterisk/cdr.h"
181#include "asterisk/utils.h"
182#include "asterisk/linkedlists.h"
184#include "asterisk/datastore.h"
185#include "asterisk/format_cap.h"
187#include "asterisk/ccss.h"
188#include "asterisk/framehook.h"
189#include "asterisk/stasis.h"
190#include "asterisk/endpoints.h"
191
192#define DATASTORE_INHERIT_FOREVER INT_MAX
193
194#define AST_MAX_FDS 11 /*!< original maximum number of file descriptors */
195#define AST_EXTENDED_FDS 12 /*!< the start of extended file descriptor positions */
196/*
197 * We have AST_MAX_FDS file descriptors in a channel.
198 * Some of them have a fixed use:
199 */
200#define AST_ALERT_FD (AST_MAX_FDS-1) /*!< used for alertpipe */
201#define AST_TIMING_FD (AST_MAX_FDS-2) /*!< used for timingfd */
202#define AST_AGENT_FD (AST_MAX_FDS-3) /*!< used by agents for pass through */
203#define AST_GENERATOR_FD (AST_MAX_FDS-4) /*!< used by generator */
204#define AST_JITTERBUFFER_FD (AST_MAX_FDS-5) /*!< used by generator */
205
211};
212
213typedef unsigned long long ast_group_t;
214
216
217/*!
218 * \brief Set as the change source reason when a channel stream topology has
219 * been changed externally as a result of the remote side renegotiating.
220 */
221static const char ast_stream_topology_changed_external[] = "external";
222
223/*! \todo Add an explanation of an Asterisk generator
224*/
226 void *(*alloc)(struct ast_channel *chan, void *params);
227 /*! Channel is locked during this function callback. */
228 void (*release)(struct ast_channel *chan, void *data);
229 /*! This function gets called with the channel unlocked, but is called in
230 * the context of the channel thread so we know the channel is not going
231 * to disappear. This callback is responsible for locking the channel as
232 * necessary. */
233 int (*generate)(struct ast_channel *chan, void *data, int len, int samples);
234 /*! This gets called when DTMF_END frames are read from the channel */
235 void (*digit)(struct ast_channel *chan, char digit);
236 /*! This gets called when the write format on a channel is changed while
237 * generating. The channel is locked during this callback. */
238 void (*write_format_change)(struct ast_channel *chan, void *data);
239};
240
241/*! Party name character set enumeration values (values from Q.SIG) */
245 AST_PARTY_CHAR_SET_WITHDRAWN = 2,/* ITU withdrew this enum value. */
253};
254
255/*!
256 * \since 1.8
257 * \brief Information needed to specify a name in a call.
258 * \note All string fields here are malloc'ed, so they need to be
259 * freed when the structure is deleted.
260 * \note NULL and "" must be considered equivalent.
261 */
263 /*! \brief Subscriber name (Malloced) */
264 char *str;
265 /*!
266 * \brief Character set the name is using.
267 * \see enum AST_PARTY_CHAR_SET
268 * \note
269 * Set to AST_PARTY_CHAR_SET_ISO8859_1 if unsure what to use.
270 * \todo Start using the party name character set value. Not currently used.
271 */
273 /*!
274 * \brief Q.931 encoded presentation-indicator encoded field
275 * \note Must tolerate the Q.931 screening-indicator field values being present.
276 */
278 /*! \brief TRUE if the name information is valid/present */
279 unsigned char valid;
280};
281
282/*!
283 * \since 1.8
284 * \brief Information needed to specify a number in a call.
285 * \note All string fields here are malloc'ed, so they need to be
286 * freed when the structure is deleted.
287 * \note NULL and "" must be considered equivalent.
288 */
290 /*! \brief Subscriber phone number (Malloced) */
291 char *str;
292 /*! \brief Q.931 Type-Of-Number and Numbering-Plan encoded fields */
293 int plan;
294 /*! \brief Q.931 presentation-indicator and screening-indicator encoded fields */
296 /*! \brief TRUE if the number information is valid/present */
297 unsigned char valid;
298};
299
300/*!
301 * \since 1.8
302 * \brief Information needed to specify a subaddress in a call.
303 * \note All string fields here are malloc'ed, so they need to be
304 * freed when the structure is deleted.
305 * \note NULL and "" must be considered equivalent.
306 */
308 /*!
309 * \brief Malloced subaddress string.
310 * \note If the subaddress type is user specified then the subaddress is
311 * a string of ASCII hex because the actual subaddress is likely BCD encoded.
312 */
313 char *str;
314 /*!
315 * \brief Q.931 subaddress type.
316 * \details
317 * nsap(0),
318 * user_specified(2)
319 */
320 int type;
321 /*!
322 * \brief TRUE if odd number of address signals
323 * \note The odd/even indicator is used when the type of subaddress is
324 * user_specified and the coding is BCD.
325 */
326 unsigned char odd_even_indicator;
327 /*! \brief TRUE if the subaddress information is valid/present */
328 unsigned char valid;
329};
330
331/*!
332 * \since 1.8
333 * \brief Information needed to identify an endpoint in a call.
334 * \note All string fields here are malloc'ed, so they need to be
335 * freed when the structure is deleted.
336 * \note NULL and "" must be considered equivalent.
337 */
339 /*! \brief Subscriber name */
341 /*! \brief Subscriber phone number */
343 /*! \brief Subscriber subaddress. */
345
346 /*!
347 * \brief User-set "tag"
348 * \details
349 * A user-settable field used to help associate some extrinsic information
350 * about the channel or user of the channel to the party ID. This information
351 * is normally not transmitted over the wire and so is only useful within an
352 * Asterisk environment.
353 */
354 char *tag;
355};
356
357/*!
358 * \since 1.8
359 * \brief Indicate what information in ast_party_id should be set.
360 */
362 /*! TRUE if the ast_party_name information should be set. */
363 unsigned char name;
364 /*! TRUE if the ast_party_number information should be set. */
365 unsigned char number;
366 /*! TRUE if the ast_party_subaddress information should be set. */
367 unsigned char subaddress;
368};
369
370/*!
371 * \since 1.8
372 * \brief Dialed/Called Party information.
373 * \note Dialed Number Identifier (DNID)
374 * \note All string fields here are malloc'ed, so they need to be
375 * freed when the structure is deleted.
376 * \note NULL and "" must be considered equivalent.
377 */
379 /*!
380 * \brief Dialed/Called number
381 * \note Done this way in case we ever really need to use ast_party_number.
382 * We currently do not need all of the ast_party_number fields.
383 */
384 struct {
385 /*! \brief Subscriber phone number (Malloced) */
386 char *str;
387 /*! \brief Q.931 Type-Of-Number and Numbering-Plan encoded fields */
388 int plan;
390 /*! \brief Dialed/Called subaddress */
392 /*!
393 * \brief Transit Network Select
394 * \note Currently this value is just passed around the system.
395 * You can read it and set it but it is never used for anything.
396 */
398};
399
400/*!
401 * \since 1.8
402 * \brief Caller Party information.
403 * \note All string fields here are malloc'ed, so they need to be
404 * freed when the structure is deleted.
405 * \note NULL and "" must be considered equivalent.
406 *
407 * \note SIP and IAX2 has UTF8 encoded Unicode Caller ID names.
408 * In some cases, we also have an alternative (RPID) E.164 number that can
409 * be used as Caller ID on numeric E.164 phone networks (DAHDI or SIP/IAX2 to
410 * PSTN gateway).
411 *
412 * \todo Implement settings for transliteration between UTF8 Caller ID names in
413 * to ASCII Caller ID's (DAHDI). Östen Åsklund might be transliterated into
414 * Osten Asklund or Oesten Aasklund depending upon language and person...
415 * We need automatic routines for incoming calls and static settings for
416 * our own accounts.
417 */
419 /*! \brief Caller party ID */
421
422 /*!
423 * \brief Automatic Number Identification (ANI)
424 * \note The name subcomponent is only likely to be used by SIP.
425 * \note The subaddress subcomponent is not likely to be used.
426 */
428
429 /*! \brief Private caller party ID */
431
432 /*! \brief Automatic Number Identification 2 (Info Digits) */
433 int ani2;
434};
435
436/*!
437 * \since 1.8
438 * \brief Indicate what information in ast_party_caller should be set.
439 */
441 /*! What caller id information to set. */
443 /*! What ANI id information to set. */
445 /*! What private caller id information to set. */
447};
448
449/*!
450 * \since 1.8
451 * \brief Connected Line/Party information.
452 * \note All string fields here are malloc'ed, so they need to be
453 * freed when the structure is deleted.
454 * \note NULL and "" must be considered equivalent.
455 */
457 /*! \brief Connected party ID */
459
460 /*!
461 * \brief Automatic Number Identification (ANI)
462 * \note Not really part of connected line data but needed to
463 * save the corresponding caller id value.
464 */
466
467 /*! \brief Private connected party ID */
469
470 /*!
471 * \brief Automatic Number Identification 2 (Info Digits)
472 * \note Not really part of connected line data but needed to
473 * save the corresponding caller id value.
474 */
475 int ani2;
476
477 /*!
478 * \brief Information about the source of an update.
479 * \note enum AST_CONNECTED_LINE_UPDATE_SOURCE values
480 * for Normal-Answer and Call-transfer.
481 */
483};
484
485/*!
486 * \since 1.8
487 * \brief Indicate what information in ast_party_connected_line should be set.
488 */
490 /*! What connected line id information to set. */
492 /*! What ANI id information to set. */
494 /*! What private connected line id information to set. */
496};
497
498/*!
499 * \brief Redirecting reason information
500 */
502 /*! \brief a string value for the redirecting reason
503 *
504 * Useful for cases where an endpoint has specified a redirecting reason
505 * that does not correspond to an enum AST_REDIRECTING_REASON
506 */
507 char *str;
508
509 /*! \brief enum AST_REDIRECTING_REASON value for redirection */
510 int code;
511};
512
513/*!
514 * \since 1.8
515 * \brief Redirecting Line information.
516 * RDNIS (Redirecting Directory Number Information Service)
517 * Where a call diversion or transfer was invoked.
518 * \note All string fields here are malloc'ed, so they need to be
519 * freed when the structure is deleted.
520 * \note NULL and "" must be considered equivalent.
521 */
523 /*! \brief Who originally redirected the call (Sent to the party the call is redirected toward) */
525
526 /*! \brief Who is redirecting the call (Sent to the party the call is redirected toward) */
528
529 /*! \brief Call is redirecting to a new party (Sent to the caller) */
531
532 /*! \brief Who originally redirected the call (Sent to the party the call is redirected toward) - private representation */
534
535 /*! \brief Who is redirecting the call (Sent to the party the call is redirected toward) - private representation */
537
538 /*! \brief Call is redirecting to a new party (Sent to the caller) - private representation */
540
541 /*! \brief Reason for the redirection */
543
544 /*! \brief Reason for the redirection by the original party */
546
547 /*! \brief Number of times the call was redirected */
548 int count;
549};
550
551/*!
552 * \since 1.8
553 * \brief Indicate what information in ast_party_redirecting should be set.
554 */
556 /*! What redirecting-orig id information to set. */
558 /*! What redirecting-from id information to set. */
560 /*! What redirecting-to id information to set. */
562 /*! What private redirecting-orig id information to set. */
564 /*! What private redirecting-from id information to set. */
566 /*! What private redirecting-to id information to set. */
568};
569
570/*!
571 * \brief Typedef for a custom read function
572 * \note data should be treated as const char *.
573 */
574typedef int (*ast_acf_read_fn_t)(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len);
575
576/*!
577 * \brief Typedef for a custom read2 function
578 * \note data should be treated as const char *.
579 */
580typedef int (*ast_acf_read2_fn_t)(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **str, ssize_t len);
581
582/*!
583 * \brief Typedef for a custom write function
584 * \note data should be treated as const char *.
585 */
586typedef int (*ast_acf_write_fn_t)(struct ast_channel *chan, const char *function, char *data, const char *value);
587
588/*! \brief Structure to handle passing func_channel_write info to channels via setoption */
589typedef struct {
590 /*! \brief ast_chan_write_info_t version. Must be incremented if structure is changed */
591 #define AST_CHAN_WRITE_INFO_T_VERSION 1
592 uint32_t version;
595 const char *function;
596 char *data;
597 const char *value;
599
600/*!
601 * \brief Structure to pass both assignedid values to channel drivers
602 * \note The second value is used only by core_unreal (LOCAL)
603 */
605 const char *uniqueid;
606 const char *uniqueid2;
607};
608
609/*!
610 * \brief Forward declaration
611 */
612struct ast_msg_data;
613
614/*!
615 * \brief
616 * Structure to describe a channel "technology", ie a channel driver
617 * See for examples:
618 * \arg chan_iax2.c - The Inter-Asterisk exchange protocol
619 * \arg chan_pjsip.c - The SIP channel driver
620 * \arg chan_dahdi.c - PSTN connectivity (TDM, PRI, T1/E1, FXO, FXS)
621 *
622 * \details
623 * If you develop your own channel driver, this is where you
624 * tell the PBX at registration of your driver what properties
625 * this driver supports and where different callbacks are
626 * implemented.
627 */
629 const char * const type;
630 const char * const description;
631
632 struct ast_format_cap *capabilities; /*!< format capabilities this channel can handle */
633
634 int properties; /*!< Technology Properties */
635
636 /*!
637 * \brief Requester - to set up call data structures (pvt's)
638 *
639 * \param type type of channel to request
640 * \param cap Format capabilities for requested channel
641 * \param assignedid Unique ID string to assign to channel
642 * \param requestor channel asking for data
643 * \param addr destination of the call
644 * \param cause Cause of failure
645 *
646 * \details
647 * Request a channel of a given type, with addr as optional information used
648 * by the low level module
649 *
650 * \retval NULL failure
651 * \retval non-NULL channel on success
652 */
653 struct ast_channel *(* const requester)(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause);
654
655 /*!
656 * \brief Requester - to set up call data structures (pvt's) with stream topology
657 *
658 * \param type type of channel to request
659 * \param topology Stream topology for requested channel
660 * \param assignedid Unique ID string to assign to channel
661 * \param requestor channel asking for data
662 * \param addr destination of the call
663 * \param cause Cause of failure
664 *
665 * \details
666 * Request a channel of a given type, with addr as optional information used
667 * by the low level module
668 *
669 * \retval NULL failure
670 * \retval non-NULL channel on success
671 */
672 struct ast_channel *(* const requester_with_stream_topology)(const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause);
673
674
675 int (* const devicestate)(const char *device_number); /*!< Devicestate call back */
676 int (* const presencestate)(const char *presence_provider, char **subtype, char **message); /*!< Presencestate callback */
677
678 /*!
679 * \brief Start sending a literal DTMF digit
680 *
681 * \note The channel is not locked when this function gets called.
682 */
683 int (* const send_digit_begin)(struct ast_channel *chan, char digit);
684
685 /*!
686 * \brief Stop sending a literal DTMF digit
687 *
688 * \note The channel is not locked when this function gets called.
689 */
690 int (* const send_digit_end)(struct ast_channel *chan, char digit, unsigned int duration);
691
692 /*!
693 * \brief Make a call
694 * \note The channel is locked when called.
695 * \param chan which channel to make the call on
696 * \param addr destination of the call
697 * \param timeout time to wait on for connect (Doesn't seem to be used.)
698 * \retval 0 on success
699 * \retval -1 on failure
700 */
701 int (* const call)(struct ast_channel *chan, const char *addr, int timeout);
702
703 /*! \brief Hangup (and possibly destroy) the channel */
704 int (* const hangup)(struct ast_channel *chan);
705
706 /*! \brief Answer the channel */
707 int (* const answer)(struct ast_channel *chan);
708
709 /*!
710 * \brief Answer the channel with topology
711 * \since 18.0.0
712 *
713 * \param chan The channel to answer
714 * \param topology The topology to use, probably the peer's.
715 *
716 * \note The topology may be NULL when the peer doesn't support streams
717 * or, in the case where transcoding is in effect, when this channel should use
718 * its existing topology.
719 */
720 int (* const answer_with_stream_topology)(struct ast_channel *chan, struct ast_stream_topology *topology);
721
722 /*!
723 * \brief Read a frame (or chain of frames from the same stream), in standard format (see frame.h)
724 *
725 * \param chan channel to read frames from
726 *
727 * \retval non-NULL on success
728 * \retval NULL on failure
729 *
730 * \note Each media frame from this callback will have the stream_num of it changed to the default
731 * stream num based on the type of media returned. As a result a multistream capable channel
732 * should not implement this callback.
733 */
734 struct ast_frame * (* const read)(struct ast_channel *chan);
735
736 /*!
737 * \brief Read a frame (or chain of frames from the same stream), in standard format (see frame.h), with stream num
738 *
739 * \param chan channel to read frames from
740 *
741 * \retval non-NULL on success
742 * \retval NULL on failure
743 *
744 * \note Each media frame from this callback should contain a stream_num value which is set to the
745 * stream that the media frame originated from.
746 */
747 struct ast_frame * (* const read_stream)(struct ast_channel *chan);
748
749 /*! \brief Write a frame, in standard format (see frame.h) */
750 int (* const write)(struct ast_channel *chan, struct ast_frame *frame);
751
752 /*! \brief Write a frame on a specific stream, in standard format (see frame.h) */
753 int (* const write_stream)(struct ast_channel *chan, int stream_num, struct ast_frame *frame);
754
755 /*! \brief Display or transmit text */
756 int (* const send_text)(struct ast_channel *chan, const char *text);
757
758 /*! \brief Display or send an image */
759 int (* const send_image)(struct ast_channel *chan, struct ast_frame *frame);
760
761 /*! \brief Send HTML data */
762 int (* const send_html)(struct ast_channel *chan, int subclass, const char *data, int len);
763
764 /*! \brief Handle an exception, reading a frame */
765 struct ast_frame * (* const exception)(struct ast_channel *chan);
766
767 /*! \brief Bridge two channels of the same type together (early) */
768 enum ast_bridge_result (* const early_bridge)(struct ast_channel *c0, struct ast_channel *c1);
769
770 /*! \brief Indicate a particular condition (e.g. AST_CONTROL_BUSY or AST_CONTROL_RINGING or AST_CONTROL_CONGESTION */
771 int (* const indicate)(struct ast_channel *c, int condition, const void *data, size_t datalen);
772
773 /*! \brief Fix up a channel: If a channel is consumed, this is called. Basically update any ->owner links */
774 int (* const fixup)(struct ast_channel *oldchan, struct ast_channel *newchan);
775
776 /*! \brief Set a given option. Called with chan locked */
777 int (* const setoption)(struct ast_channel *chan, int option, void *data, int datalen);
778
779 /*! \brief Query a given option. Called with chan locked */
780 int (* const queryoption)(struct ast_channel *chan, int option, void *data, int *datalen);
781
782 /*! \brief Blind transfer other side (see app_transfer.c and ast_transfer() */
783 int (* const transfer)(struct ast_channel *chan, const char *newdest);
784
785 /*! \brief Write a frame, in standard format */
786 int (* const write_video)(struct ast_channel *chan, struct ast_frame *frame);
787
788 /*! \brief Write a text frame, in standard format */
789 int (* const write_text)(struct ast_channel *chan, struct ast_frame *frame);
790
791 /*!
792 * \brief Provide additional read items for CHANNEL() dialplan function
793 * \note data should be treated as a const char *.
794 */
795 int (* func_channel_read)(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len);
796
797 /*!
798 * \brief Provide additional write items for CHANNEL() dialplan function
799 * \note data should be treated as a const char *.
800 */
801 int (* func_channel_write)(struct ast_channel *chan, const char *function, char *data, const char *value);
802
803 /*! \brief Get the unique identifier for the PVT, i.e. SIP call-ID for SIP */
804 const char * (* get_pvt_uniqueid)(struct ast_channel *chan);
805
806 /*! \brief Call a function with cc parameters as a function parameter
807 *
808 * \details
809 * This is a highly specialized callback that is not likely to be needed in many
810 * channel drivers. When dealing with a busy channel, for instance, most channel
811 * drivers will successfully return a channel to the requester. Once called, the channel
812 * can then queue a busy frame when it receives an appropriate message from the far end.
813 * In such a case, the channel driver has the opportunity to also queue a CC frame.
814 * The parameters for the CC channel can be retrieved from the channel structure.
815 *
816 * For other channel drivers, notably those that deal with "dumb" phones, the channel
817 * driver will not return a channel when one is requested. In such a scenario, there is never
818 * an opportunity for the channel driver to queue a CC frame since the channel is never
819 * called. Furthermore, it is not possible to retrieve the CC configuration parameters
820 * for the desired channel because no channel is ever allocated or returned to the
821 * requester. In such a case, call completion may still be a viable option. What we do is
822 * pass the same string that the requester used originally to request the channel to the
823 * channel driver. The channel driver can then find any potential channels/devices that
824 * match the input and return call the designated callback with the device's call completion
825 * parameters as a parameter.
826 */
827 int (* cc_callback)(struct ast_channel *inbound, const char *dest, ast_cc_callback_fn callback);
828
829 /*!
830 * \brief Execute a Gosub call on the channel in a technology specific way before a call is placed.
831 * \since 11.0
832 *
833 * \param chan Channel to execute Gosub in a tech specific way.
834 * \param sub_args Gosub application parameter string.
835 *
836 * \note The chan is locked before calling.
837 *
838 * \retval 0 on success.
839 * \retval -1 on error.
840 */
841 int (*pre_call)(struct ast_channel *chan, const char *sub_args);
842
843 /*! \brief Display or transmit text with data*/
844 int (* const send_text_data)(struct ast_channel *chan, struct ast_msg_data *data);
845};
846
847/*! Kill the channel channel driver technology descriptor. */
848extern const struct ast_channel_tech ast_kill_tech;
849
850struct ast_epoll_data;
851
852/*!
853 * The high bit of the frame count is used as a debug marker, so
854 * increments of the counters must be done with care.
855 * Please use c->fin = FRAMECOUNT_INC(c->fin) and the same for c->fout.
856 */
857#define DEBUGCHAN_FLAG 0x80000000
858
859/* XXX not ideal to evaluate x twice... */
860#define FRAMECOUNT_INC(x) ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) )
861
862/*!
863 * The current value of the debug flags is stored in the two
864 * variables global_fin and global_fout (declared in main/channel.c)
865 */
866extern unsigned long global_fin, global_fout;
867
873};
874
875/*!
876 * \brief Possible T38 states on channels
877 */
879 T38_STATE_UNAVAILABLE, /*!< T38 is unavailable on this channel or disabled by configuration */
880 T38_STATE_UNKNOWN, /*!< The channel supports T38 but the current status is unknown */
881 T38_STATE_NEGOTIATING, /*!< T38 is being negotiated */
882 T38_STATE_REJECTED, /*!< Remote side has rejected our offer */
883 T38_STATE_NEGOTIATED, /*!< T38 established */
884};
885
886/*! Hangup handler instance node. */
888 /*! Next hangup handler node. */
890 /*! Hangup handler arg string passed to the Gosub application */
891 char args[0];
892};
893
898
899typedef int(*ast_timing_func_t)(const void *data);
900/*!
901 * \page AstChannel ast_channel locking and reference tracking
902 *
903 * \par Creating Channels
904 * A channel is allocated using the ast_channel_alloc() function. When created, it is
905 * automatically inserted into the main channels hash table that keeps track of all
906 * active channels in the system. The hash key is based on the channel name. Because
907 * of this, if you want to change the name, you _must_ use ast_change_name(), not change
908 * the name field directly. When ast_channel_alloc() returns a channel pointer, you now
909 * hold both a reference to that channel and a lock on the channel. Once the channel has
910 * been set up the lock can be released. In most cases the reference is given to ast_pbx_run().
911 *
912 * \par Channel Locking
913 * There is a lock associated with every ast_channel. It is allocated internally via astobj2.
914 * To lock or unlock a channel, you must use the ast_channel_lock() wrappers.
915 *
916 * Previously, before ast_channel was converted to astobj2, the channel lock was used in some
917 * additional ways that are no longer necessary. Before, the only way to ensure that a channel
918 * did not disappear out from under you if you were working with a channel outside of the channel
919 * thread that owns it, was to hold the channel lock. Now, that is no longer necessary.
920 * You simply must hold a reference to the channel to ensure it does not go away.
921 *
922 * The channel must be locked if you need to ensure that data that you reading from the channel
923 * does not change while you access it. Further, you must hold the channel lock if you are
924 * making a non-atomic change to channel data.
925 *
926 * \par Channel References
927 * There are multiple ways to get a reference to a channel. The first is that you hold a reference
928 * to a channel after creating it. The other ways involve using the channel search or the channel
929 * traversal APIs. These functions are the ast_channel_get_*() functions or ast_channel_iterator_*()
930 * functions. Once a reference is retrieved by one of these methods, you know that the channel will
931 * not go away. So, the channel should only get locked as needed for data access or modification.
932 * But, make sure that the reference gets released when you are done with it!
933 *
934 * There are different things you can do when you are done with a reference to a channel. The first
935 * is to simply release the reference using ast_channel_unref(). The other option is to call
936 * ast_channel_release(). This function is generally used where ast_channel_free() was used in
937 * the past. The release function releases a reference as well as ensures that the channel is no
938 * longer in the global channels container. That way, the channel will get destroyed as soon as any
939 * other pending references get released.
940 *
941 * \par Exceptions to the rules
942 * Even though ast_channel is reference counted, there are some places where pointers to an ast_channel
943 * get stored, but the reference count does not reflect it. The reason is mostly historical.
944 * The only places where this happens should be places where because of how the code works, we
945 * _know_ that the pointer to the channel will get removed before the channel goes away. The main
946 * example of this is in channel drivers. Channel drivers generally store a pointer to their owner
947 * ast_channel in their technology specific pvt struct. In this case, the channel drivers _know_
948 * that this pointer to the channel will be removed in time, because the channel's hangup callback
949 * gets called before the channel goes away.
950 */
951
952struct ast_channel;
953
954/*! \brief ast_channel_tech Properties */
955enum {
956 /*!
957 * \brief Channels have this property if they can accept input with jitter;
958 * i.e. most VoIP channels
959 */
961 /*!
962 * \brief Channels have this property if they can create jitter;
963 * i.e. most VoIP channels
964 */
966 /*!
967 * \brief Channels with this particular technology are an implementation detail of
968 * Asterisk and should generally not be exposed or manipulated by the outside
969 * world
970 */
972 /*!
973 * \brief Channels have this property if they implement send_text_data
974 */
976};
977
978/*! \brief ast_channel flags */
979enum {
980 /*! Queue incoming DTMF, to be released when this flag is turned off */
982 /*! write should be interrupt generator */
984 /*! a thread is blocking on this channel */
986 /*! This is a zombie channel */
987 AST_FLAG_ZOMBIE = (1 << 4),
988 /*! There is an exception pending */
990 /*! Listening to moh XXX anthm promises me this will disappear XXX */
991 AST_FLAG_MOH = (1 << 6),
992 /*! This channel is spying on another channel */
993 AST_FLAG_SPYING = (1 << 7),
994 /*! the channel is in an auto-incrementing dialplan processor,
995 * so when ->priority is set, it will get incremented before
996 * finding the next priority to run */
998 /*! This is an outgoing call */
999 AST_FLAG_OUTGOING = (1 << 10),
1000 /*! A DTMF_BEGIN frame has been read from this channel, but not yet an END */
1001 AST_FLAG_IN_DTMF = (1 << 12),
1002 /*! A DTMF_END was received when not IN_DTMF, so the length of the digit is
1003 * currently being emulated */
1005 /*! This is set to tell the channel not to generate DTMF begin frames, and
1006 * to instead only generate END frames. */
1008 /* OBSOLETED in favor of AST_CAUSE_ANSWERED_ELSEWHERE
1009 * Flag to show channels that this call is hangup due to the fact that the call
1010 * was indeed answered, but in another channel */
1011 /* AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), */
1012 /*! This flag indicates that on a masquerade, an active stream should not
1013 * be carried over */
1015 /*! This flag indicates that the hangup exten was run when the bridge terminated,
1016 * a message aimed at preventing a subsequent hangup exten being run at the pbx_run
1017 * level */
1019 /*! Disable certain workarounds. This reintroduces certain bugs, but allows
1020 * some non-traditional dialplans (like AGI) to continue to function.
1021 */
1023 /*!
1024 * Disable device state event caching. This allows channel
1025 * drivers to selectively prevent device state events from being
1026 * cached by certain channels such as anonymous calls which have
1027 * no persistent represenatation that can be tracked.
1028 */
1030 /*!
1031 * This flag indicates that a dual channel redirect is in
1032 * progress. The bridge needs to wait until the flag is cleared
1033 * to continue.
1034 */
1036 /*!
1037 * This flag indicates that the channel was originated.
1038 */
1040 /*!
1041 * The channel is well and truly dead. Once this is set and published, no further
1042 * actions should be taken upon the channel, and no further publications should
1043 * occur.
1044 */
1045 AST_FLAG_DEAD = (1 << 24),
1046 /*!
1047 * Channel snapshot should not be published, it is being staged for an explicit
1048 * publish.
1049 */
1051 /*!
1052 * The data on chan->timingdata is an astobj2 object.
1053 */
1055 /*!
1056 * The channel is executing a subroutine or macro
1057 */
1059};
1060
1061/*! \brief ast_bridge_config flags */
1062enum {
1070};
1071
1072#define AST_FEATURE_DTMF_MASK (AST_FEATURE_REDIRECT | AST_FEATURE_DISCONNECT |\
1073 AST_FEATURE_ATXFER | AST_FEATURE_AUTOMON | AST_FEATURE_PARKCALL | AST_FEATURE_AUTOMIXMON)
1074
1075/*! \brief bridge configuration */
1079 struct timeval start_time;
1080 struct timeval nexteventts;
1081 struct timeval feature_start_time;
1086 const char *warning_sound;
1087 const char *end_sound;
1088 const char *start_sound;
1089 unsigned int flags;
1090 void (* end_bridge_callback)(void *); /*!< A callback that is called after a bridge attempt */
1091 void *end_bridge_callback_data; /*!< Data passed to the callback */
1092 /*! If the end_bridge_callback_data refers to a channel which no longer is going to
1093 * exist when the end_bridge_callback is called, then it needs to be fixed up properly
1094 */
1095 void (*end_bridge_callback_data_fixup)(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator);
1096 /*! If the bridge answers the channel this topology should be passed to the channel
1097 * and used if the channel supports the answer_with_stream_topology callback.
1098 */
1100};
1101
1102struct chanmon;
1103
1105 const char *context;
1106 const char *exten;
1108 int connect_on_early_media; /* If set, treat session progress as answer */
1109 const char *cid_num;
1110 const char *cid_name;
1111 const char *account;
1114};
1115
1116enum {
1117 /*!
1118 * Soft hangup requested by device or other internal reason.
1119 * Actual hangup needed.
1120 */
1122 /*!
1123 * Used to break the normal frame flow so an async goto can be
1124 * done instead of actually hanging up.
1125 */
1127 /*!
1128 * Soft hangup requested by system shutdown. Actual hangup
1129 * needed.
1130 */
1132 /*!
1133 * Used to break the normal frame flow after a timeout so an
1134 * implicit async goto can be done to the 'T' exten if it exists
1135 * instead of actually hanging up. If the exten does not exist
1136 * then actually hangup.
1137 */
1139 /*!
1140 * Soft hangup requested by application/channel-driver being
1141 * unloaded. Actual hangup needed.
1142 */
1144 /*!
1145 * Soft hangup requested by non-associated party. Actual hangup
1146 * needed.
1147 */
1149 /*!
1150 * Used to indicate that the channel is currently executing hangup
1151 * logic in the dialplan. The channel has been hungup when this is
1152 * set.
1153 */
1155 /*!
1156 * \brief All softhangup flags.
1157 *
1158 * This can be used as an argument to ast_channel_clear_softhangup()
1159 * to clear all softhangup flags from a channel.
1160 */
1161 AST_SOFTHANGUP_ALL = (0xFFFFFFFF)
1163
1164
1165/*! \brief Channel reload reasons for manager events at load or reload of configuration */
1172};
1173
1174/*!
1175 * \brief Channel AMA Flags
1176 */
1182};
1183
1184/*!
1185 * \note None of the datastore API calls lock the ast_channel they are using.
1186 * So, the channel should be locked before calling the functions that
1187 * take a channel argument.
1188 */
1189
1190/*! \brief Inherit datastores from a parent to a child. */
1191int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to);
1192
1193/*!
1194 * \brief Add a datastore to a channel
1195 *
1196 * \note The channel should be locked before calling this function.
1197 *
1198 * \retval 0 success
1199 * \retval non-zero failure
1200 */
1201int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore);
1202
1203/*!
1204 * \brief Remove a datastore from a channel
1205 *
1206 * \note The channel should be locked before calling this function.
1207 *
1208 * \retval 0 success
1209 * \retval non-zero failure
1210 */
1211int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore);
1212
1213/*!
1214 * \brief Find a datastore on a channel
1215 *
1216 * \note The channel should be locked before calling this function.
1217 *
1218 * \note The datastore returned from this function must not be used if the
1219 * reference to the channel is released.
1220 *
1221 * \retval pointer to the datastore if found
1222 * \retval NULL if not found
1223 */
1224struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid);
1225
1226/*!
1227 * \brief Create a channel structure
1228 * \since 1.8
1229 *
1230 * \retval NULL failure
1231 * \retval non-NULL successfully allocated channel
1232 *
1233 * \note Absolutely _NO_ channel locks should be held before calling this function.
1234 * \note By default, new channels are set to the "s" extension
1235 * and "default" context.
1236 * \note Since 12.0.0 this function returns with the newly created channel locked.
1237 */
1238struct ast_channel * __attribute__((format(printf, 15, 16)))
1239 __ast_channel_alloc(int needqueue, int state, const char *cid_num,
1240 const char *cid_name, const char *acctcode,
1241 const char *exten, const char *context, const struct ast_assigned_ids *assignedids,
1242 const struct ast_channel *requestor, enum ama_flags amaflag,
1243 struct ast_endpoint *endpoint,
1244 const char *file, int line, const char *function,
1245 const char *name_fmt, ...);
1246
1247/*!
1248 * \brief Create a channel structure
1249 *
1250 * \retval NULL failure
1251 * \retval non-NULL successfully allocated channel
1252 *
1253 * \note Absolutely _NO_ channel locks should be held before calling this function.
1254 * \note By default, new channels are set to the "s" extension
1255 * and "default" context.
1256 * \note Since 12.0.0 this function returns with the newly created channel locked.
1257 */
1258#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, ...) \
1259 __ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, NULL, \
1260 __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
1261
1262#define ast_channel_alloc_with_endpoint(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint, ...) \
1263 __ast_channel_alloc((needqueue), (state), (cid_num), (cid_name), (acctcode), (exten), (context), (assignedids), (requestor), (amaflag), (endpoint), \
1264 __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
1265
1266/*!
1267 * \brief Create a fake channel structure
1268 *
1269 * \retval NULL failure
1270 * \retval non-NULL successfully allocated channel
1271 *
1272 * \note This function should ONLY be used to create a fake channel
1273 * that can then be populated with data for use in variable
1274 * substitution when a real channel does not exist.
1275 *
1276 * \note The created dummy channel should be destroyed by
1277 * ast_channel_unref(). Using ast_channel_release() needlessly
1278 * grabs the channel container lock and can cause a deadlock as
1279 * a result. Also grabbing the channel container lock reduces
1280 * system performance.
1281 */
1282#define ast_dummy_channel_alloc() __ast_dummy_channel_alloc(__FILE__, __LINE__, __PRETTY_FUNCTION__)
1283struct ast_channel *__ast_dummy_channel_alloc(const char *file, int line, const char *function);
1284
1285/*!
1286 * \brief Queue one or more frames to a channel's frame queue
1287 *
1288 * \param chan the channel to queue the frame(s) on
1289 * \param f the frame(s) to queue. Note that the frame(s) will be duplicated
1290 * by this function. It is the responsibility of the caller to handle
1291 * freeing the memory associated with the frame(s) being passed if
1292 * necessary.
1293 *
1294 * \retval 0 success
1295 * \retval non-zero failure
1296 */
1297int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f);
1298
1299/*!
1300 * \brief Queue one or more frames to the head of a channel's frame queue
1301 *
1302 * \param chan the channel to queue the frame(s) on
1303 * \param f the frame(s) to queue. Note that the frame(s) will be duplicated
1304 * by this function. It is the responsibility of the caller to handle
1305 * freeing the memory associated with the frame(s) being passed if
1306 * necessary.
1307 *
1308 * \retval 0 success
1309 * \retval non-zero failure
1310 */
1311int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f);
1312
1313/*!
1314 * \brief Queue a hangup frame
1315 *
1316 * \note The channel does not need to be locked before calling this function.
1317 */
1318int ast_queue_hangup(struct ast_channel *chan);
1319
1320/*!
1321 * \brief Queue a hangup frame with hangupcause set
1322 *
1323 * \note The channel does not need to be locked before calling this function.
1324 * \param[in] chan channel to queue frame onto
1325 * \param[in] cause the hangup cause
1326 * \retval 0 on success
1327 * \retval -1 on error
1328 * \since 1.6.1
1329 */
1330int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause);
1331
1332/*!
1333 * \brief Queue a hold frame
1334 *
1335 * \param chan channel to queue frame onto
1336 * \param musicclass The suggested musicclass for the other end to use
1337 *
1338 * \note The channel does not need to be locked before calling this function.
1339 *
1340 * \retval zero on success
1341 * \retval non-zero on failure
1342 */
1343int ast_queue_hold(struct ast_channel *chan, const char *musicclass);
1344
1345/*!
1346 * \brief Queue an unhold frame
1347 *
1348 * \param chan channel to queue frame onto
1349 *
1350 * \note The channel does not need to be locked before calling this function.
1351 *
1352 * \retval zero on success
1353 * \retval non-zero on failure
1354 */
1355int ast_queue_unhold(struct ast_channel *chan);
1356
1357/*!
1358 * \brief Queue a control frame without payload
1359 *
1360 * \param chan channel to queue frame onto
1361 * \param control type of control frame
1362 *
1363 * \note The channel does not need to be locked before calling this function.
1364 *
1365 * \retval zero on success
1366 * \retval non-zero on failure
1367 */
1368int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control);
1369
1370/*!
1371 * \brief Queue a control frame with payload
1372 *
1373 * \param chan channel to queue frame onto
1374 * \param control type of control frame
1375 * \param data pointer to payload data to be included in frame
1376 * \param datalen number of bytes of payload data
1377 *
1378 * \retval 0 success
1379 * \retval non-zero failure
1380 *
1381 * \details
1382 * The supplied payload data is copied into the frame, so the caller's copy
1383 * is not modified nor freed, and the resulting frame will retain a copy of
1384 * the data even if the caller frees their local copy.
1385 *
1386 * \note This method should be treated as a 'network transport'; in other
1387 * words, your frames may be transferred across an IAX2 channel to another
1388 * system, which may be a different endianness than yours. Because of this,
1389 * you should ensure that either your frames will never be expected to work
1390 * across systems, or that you always put your payload data into 'network byte
1391 * order' before calling this function.
1392 *
1393 * \note The channel does not need to be locked before calling this function.
1394 */
1395int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control,
1396 const void *data, size_t datalen);
1397
1398/*!
1399 * \brief Queue an ANSWER control frame with topology
1400 *
1401 * \param chan channel to queue frame onto
1402 * \param topology topology to be passed through the core to the peer channel
1403 *
1404 * \retval 0 success
1405 * \retval non-zero failure
1406 */
1407int ast_queue_answer(struct ast_channel *chan, const struct ast_stream_topology *topology);
1408
1409/*!
1410 * \brief Change channel name
1411 *
1412 * \pre Absolutely all channels _MUST_ be unlocked before calling this function.
1413 *
1414 * \param chan the channel to change the name of
1415 * \param newname the name to change to
1416 *
1417 * \note this function must _NEVER_ be used when any channels are locked
1418 * regardless if it is the channel who's name is being changed or not because
1419 * it invalidates our channel container locking order... lock container first,
1420 * then the individual channels, never the other way around.
1421 */
1422void ast_change_name(struct ast_channel *chan, const char *newname);
1423
1424/*!
1425 * \brief Unlink and release reference to a channel
1426 *
1427 * This function will unlink the channel from the global channels container
1428 * if it is still there and also release the current reference to the channel.
1429 *
1430 * \retval NULL convenient for clearing invalid pointers
1431 * \note Absolutely _NO_ channel locks should be held before calling this function.
1432 *
1433 * \since 1.8
1434 */
1435struct ast_channel *ast_channel_release(struct ast_channel *chan);
1436
1437/*!
1438 * \brief Requests a channel
1439 *
1440 * \param type type of channel to request
1441 * \param request_cap Format capabilities for requested channel
1442 * \param assignedids Unique ID to create channel with
1443 * \param requestor channel asking for data
1444 * \param addr destination of the call
1445 * \param cause Cause of failure
1446 *
1447 * \details
1448 * Request a channel of a given type, with addr as optional information used
1449 * by the low level module
1450 *
1451 * \retval NULL failure
1452 * \retval non-NULL channel on success
1453 */
1454struct ast_channel *ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause);
1455
1456/*!
1457 * \brief Requests a channel (specifying stream topology)
1458 *
1459 * \param type type of channel to request
1460 * \param topology Stream topology for requested channel
1461 * \param assignedids Unique ID to create channel with
1462 * \param requestor channel asking for data
1463 * \param addr destination of the call
1464 * \param cause Cause of failure
1465 *
1466 * \details
1467 * Request a channel of a given type, with addr as optional information used
1468 * by the low level module
1469 *
1470 * \retval NULL failure
1471 * \retval non-NULL channel on success
1472 */
1473struct ast_channel *ast_request_with_stream_topology(const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause);
1474
1476 /*! The requestor is the future bridge peer of the channel. */
1478 /*! The requestor is to be replaced by the channel. */
1480};
1481
1482/*!
1483 * \brief Setup new channel accountcodes from the requestor channel after ast_request().
1484 * \since 13.0.0
1485 *
1486 * \param chan New channel to get accountcodes setup.
1487 * \param requestor Requesting channel to get accountcodes from.
1488 * \param relationship What the new channel was created for.
1489 *
1490 * \pre The chan and requestor channels are already locked.
1491 *
1492 * \note Pre-existing accountcodes on chan will be overwritten.
1493 */
1494void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship);
1495
1496/*!
1497 * \brief Setup new channel accountcodes from the requestor channel after ast_request().
1498 * \since 13.0.0
1499 *
1500 * \param chan New channel to get accountcodes setup.
1501 * \param requestor Requesting channel to get accountcodes from.
1502 * \param relationship What the new channel was created for.
1503 *
1504 * \pre The chan and requestor channels are already locked.
1505 *
1506 * \note Pre-existing accountcodes on chan will not be overwritten.
1507 */
1508void ast_channel_req_accountcodes_precious(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship);
1509
1510/*!
1511 * \brief Request a channel of a given type, with data as optional information used
1512 * by the low level module and attempt to place a call on it
1513 *
1514 * \param type type of channel to request
1515 * \param cap format capabilities for requested channel
1516 * \param assignedids Unique Id to assign to channel
1517 * \param requestor channel asking for data
1518 * \param addr destination of the call
1519 * \param timeout maximum amount of time to wait for an answer
1520 * \param reason why unsuccessful (if unsuccessful)
1521 * \param cid_num Caller-ID Number
1522 * \param cid_name Caller-ID Name (ascii)
1523 *
1524 * \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
1525 * to know if the call was answered or not.
1526 */
1527struct ast_channel *ast_request_and_dial(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr,
1528 int timeout, int *reason, const char *cid_num, const char *cid_name);
1529
1530/*!
1531 * \brief Request a channel of a given type, with data as optional information used
1532 * by the low level module and attempt to place a call on it
1533 * \param type type of channel to request
1534 * \param cap format capabilities for requested channel
1535 * \param assignedids Unique Id to assign to channel
1536 * \param requestor channel requesting data
1537 * \param addr destination of the call
1538 * \param timeout maximum amount of time to wait for an answer
1539 * \param reason why unsuccessful (if unsuccessful)
1540 * \param cid_num Caller-ID Number
1541 * \param cid_name Caller-ID Name (ascii)
1542 * \param oh Outgoing helper
1543 * \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
1544 * to know if the call was answered or not.
1545 */
1546struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr,
1547 int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh);
1548
1549/*!
1550 * \brief Forwards a call to a new channel specified by the original channel's call_forward str. If possible, the new forwarded channel is created and returned while the original one is terminated.
1551 * \param caller in channel that requested orig
1552 * \param orig channel being replaced by the call forward channel
1553 * \param timeout maximum amount of time to wait for setup of new forward channel
1554 * \param cap format capabilities for requested channel
1555 * \param oh outgoing helper used with original channel
1556 * \param outstate reason why unsuccessful (if unsuccessful)
1557 * \return Returns the forwarded call's ast_channel on success or NULL on failure
1558 */
1559struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, struct ast_format_cap *cap, struct outgoing_helper *oh, int *outstate);
1560
1561/*!
1562 * \brief Register a channel technology (a new channel driver)
1563 * Called by a channel module to register the kind of channels it supports.
1564 * \param tech Structure defining channel technology or "type"
1565 * \return Returns 0 on success, -1 on failure.
1566 */
1567int ast_channel_register(const struct ast_channel_tech *tech);
1568
1569/*!
1570 * \brief Unregister a channel technology
1571 * \param tech Structure defining channel technology or "type" that was previously registered
1572 */
1573void ast_channel_unregister(const struct ast_channel_tech *tech);
1574
1575/*!
1576 * \brief Get a channel technology structure by name
1577 * \param name name of technology to find
1578 * \return a pointer to the structure, or NULL if no matching technology found
1579 */
1580const struct ast_channel_tech *ast_get_channel_tech(const char *name);
1581
1582/*!
1583 * \brief Hang up a channel
1584 * \note Absolutely _NO_ channel locks should be held before calling this function.
1585 * \note This function performs a hard hangup on a channel. Unlike the soft-hangup, this function
1586 * performs all stream stopping, etc, on the channel that needs to end.
1587 * chan is no longer valid after this call.
1588 * \param chan channel to hang up (NULL tolerant)
1589 */
1590void ast_hangup(struct ast_channel *chan);
1591
1592/*!
1593 * \brief Soft hangup all active channels.
1594 * \since 13.3.0
1595 */
1596void ast_softhangup_all(void);
1597
1598/*!
1599 * \brief Softly hangup up a channel
1600 *
1601 * \param chan channel to be soft-hung-up
1602 * \param cause an AST_SOFTHANGUP_* reason code
1603 *
1604 * \details
1605 * Call the protocol layer, but don't destroy the channel structure
1606 * (use this if you are trying to
1607 * safely hangup a channel managed by another thread.
1608 *
1609 * \note The channel passed to this function does not need to be locked.
1610 *
1611 * \return Returns 0 regardless
1612 */
1613int ast_softhangup(struct ast_channel *chan, int cause);
1614
1615/*!
1616 * \brief Softly hangup up a channel (no channel lock)
1617 * \param chan channel to be soft-hung-up
1618 * \param cause an AST_SOFTHANGUP_* reason code
1619 */
1620int ast_softhangup_nolock(struct ast_channel *chan, int cause);
1621
1622/*!
1623 * \brief Clear a set of softhangup flags from a channel
1624 *
1625 * Never clear a softhangup flag from a channel directly. Instead,
1626 * use this function. This ensures that all aspects of the softhangup
1627 * process are aborted.
1628 *
1629 * \param chan the channel to clear the flag on
1630 * \param flag the flag or flags to clear
1631 */
1632void ast_channel_clear_softhangup(struct ast_channel *chan, int flag);
1633
1634/*!
1635 * \brief Set the source of the hangup in this channel and it's bridge
1636 *
1637 * \param chan channel to set the field on
1638 * \param source a string describing the source of the hangup for this channel
1639 * \param force
1640 *
1641 * \note Absolutely _NO_ channel locks should be held before calling this function.
1642 *
1643 * \since 1.8
1644 *
1645 * Hangupsource is generally the channel name that caused the bridge to be
1646 * hung up, but it can also be other things such as "dialplan/agi"
1647 * This can then be logged in the CDR or CEL
1648 */
1649void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force);
1650
1651/*! \brief Check to see if a channel is needing hang up
1652 * \param chan channel on which to check for hang up
1653 * This function determines if the channel is being requested to be hung up.
1654 * \return Returns 0 if not, or 1 if hang up is requested (including time-out).
1655 */
1656int ast_check_hangup(struct ast_channel *chan);
1657
1658int ast_check_hangup_locked(struct ast_channel *chan);
1659
1660/*! \brief This function will check if the bridge needs to be re-evaluated due to
1661 * external changes.
1662 *
1663 * \param chan Channel on which to check the unbridge_eval flag
1664 *
1665 * \return Returns 0 if the flag is down or 1 if the flag is up.
1666 */
1667int ast_channel_unbridged(struct ast_channel *chan);
1668
1669/*! \brief ast_channel_unbridged variant. Use this if the channel
1670 * is already locked prior to calling.
1671 *
1672 * \param chan Channel on which to check the unbridge flag
1673 *
1674 * \return Returns 0 if the flag is down or 1 if the flag is up.
1675 */
1677
1678/*! \brief Sets the unbridged flag and queues a NULL frame on the channel to trigger
1679 * a check by bridge_channel_wait
1680 *
1681 * \param chan Which channel is having its unbridged value set
1682 * \param value What the unbridge value is being set to
1683 */
1684void ast_channel_set_unbridged(struct ast_channel *chan, int value);
1685
1686/*! \brief Variant of ast_channel_set_unbridged. Use this if the channel
1687 * is already locked prior to calling.
1688 *
1689 * \param chan Which channel is having its unbridged value set
1690 * \param value What the unbridge value is being set to
1691 */
1692void ast_channel_set_unbridged_nolock(struct ast_channel *chan, int value);
1693
1694/*!
1695 * \brief This function will check if T.38 is active on the channel.
1696 *
1697 * \param chan Channel on which to check the unbridge_eval flag
1698 *
1699 * \return Returns 0 if the flag is down or 1 if the flag is up.
1700 */
1701int ast_channel_is_t38_active(struct ast_channel *chan);
1702
1703/*!
1704 * \brief ast_channel_is_t38_active variant. Use this if the channel
1705 * is already locked prior to calling.
1706 *
1707 * \param chan Channel on which to check the is_t38_active flag
1708 *
1709 * \return Returns 0 if the flag is down or 1 if the flag is up.
1710 */
1712
1713/*!
1714 * \brief Sets the is_t38_active flag
1715 *
1716 * \param chan Which channel is having its is_t38_active value set
1717 * \param is_t38_active Non-zero if T.38 is active
1718 */
1719void ast_channel_set_is_t38_active(struct ast_channel *chan, int is_t38_active);
1720
1721/*!
1722 * \brief Variant of ast_channel_set_is_t38_active. Use this if the channel
1723 * is already locked prior to calling.
1724 *
1725 * \param chan Which channel is having its is_t38_active value set
1726 * \param is_t38_active Non-zero if T.38 is active
1727 */
1728void ast_channel_set_is_t38_active_nolock(struct ast_channel *chan, int is_t38_active);
1729
1730/*!
1731 * \brief Lock the given channel, then request softhangup on the channel with the given causecode
1732 * \param chan channel on which to hang up
1733 * \param causecode cause code to use (Zero if don't use cause code)
1734 */
1735void ast_channel_softhangup_withcause_locked(struct ast_channel *chan, int causecode);
1736
1737/*!
1738 * \brief Compare a offset with the settings of when to hang a channel up
1739 * \param chan channel on which to check for hangup
1740 * \param offset offset in seconds and microseconds from current time
1741 * \retval 1
1742 * \retval 0
1743 * \retval -1
1744 * This function compares a offset from current time with the absolute time
1745 * out on a channel (when to hang up). If the absolute time out on a channel
1746 * is earlier than current time plus the offset, it returns 1, if the two
1747 * time values are equal, it return 0, otherwise, it return -1.
1748 * \since 1.6.1
1749 */
1750int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offset);
1751
1752/*!
1753 * \brief Set when to hang a channel up
1754 *
1755 * \param chan channel on which to check for hang up
1756 * \param offset offset in seconds and useconds relative to the current time of when to hang up
1757 *
1758 * This function sets the absolute time out on a channel (when to hang up).
1759 *
1760 * \pre chan is locked
1761 *
1762 * \since 1.6.1
1763 */
1764void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset);
1765
1766/*!
1767 * \brief Answer a channel
1768 *
1769 * \param chan channel to answer
1770 *
1771 * \details
1772 * This function answers a channel and handles all necessary call
1773 * setup functions.
1774 *
1775 * \note The channel passed does not need to be locked, but is locked
1776 * by the function when needed.
1777 *
1778 * \note This function will wait up to 500 milliseconds for media to
1779 * arrive on the channel before returning to the caller, so that the
1780 * caller can properly assume the channel is 'ready' for media flow.
1781 *
1782 * \retval 0 on success
1783 * \retval non-zero on failure
1784 */
1785int ast_answer(struct ast_channel *chan);
1786
1787/*!
1788 * \brief Answer a channel, if it's not already answered.
1789 *
1790 * \param chan channel to answer
1791 *
1792 * \details See ast_answer()
1793 *
1794 * \retval 0 on success
1795 * \retval non-zero on failure
1796 */
1797int ast_auto_answer(struct ast_channel *chan);
1798
1799/*!
1800 * \brief Answer a channel
1801 *
1802 * \param chan channel to answer
1803 *
1804 * This function answers a channel and handles all necessary call
1805 * setup functions.
1806 *
1807 * \note The channel passed does not need to be locked, but is locked
1808 * by the function when needed.
1809 *
1810 * \note Unlike ast_answer(), this function will not wait for media
1811 * flow to begin. The caller should be careful before sending media
1812 * to the channel before incoming media arrives, as the outgoing
1813 * media may be lost.
1814 *
1815 * \retval 0 on success
1816 * \retval non-zero on failure
1817 */
1818int ast_raw_answer(struct ast_channel *chan);
1819
1820/*!
1821 * \brief Answer a channel passing in a stream topology
1822 * \since 18.0.0
1823 *
1824 * \param chan channel to answer
1825 * \param topology the peer's stream topology
1826 *
1827 * This function answers a channel and handles all necessary call
1828 * setup functions.
1829 *
1830 * \note The channel passed does not need to be locked, but is locked
1831 * by the function when needed.
1832 *
1833 * \note Unlike ast_answer(), this function will not wait for media
1834 * flow to begin. The caller should be careful before sending media
1835 * to the channel before incoming media arrives, as the outgoing
1836 * media may be lost.
1837 *
1838 * \note The topology is usually that of the peer channel and may be NULL.
1839 *
1840 * \retval 0 on success
1841 * \retval non-zero on failure
1842 */
1843int ast_raw_answer_with_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology);
1844
1845/*!
1846 * \brief Answer a channel, with a selectable delay before returning
1847 *
1848 * \param chan channel to answer
1849 * \param delay maximum amount of time to wait for incoming media
1850 *
1851 * This function answers a channel and handles all necessary call
1852 * setup functions.
1853 *
1854 * \note The channel passed does not need to be locked, but is locked
1855 * by the function when needed.
1856 *
1857 * \note This function will wait up to 'delay' milliseconds for media to
1858 * arrive on the channel before returning to the caller, so that the
1859 * caller can properly assume the channel is 'ready' for media flow. If
1860 * 'delay' is less than 500, the function will wait up to 500 milliseconds.
1861 *
1862 * \retval 0 on success
1863 * \retval non-zero on failure
1864 */
1865int __ast_answer(struct ast_channel *chan, unsigned int delay);
1866
1867/*!
1868 * \brief Execute a Gosub call on the channel before a call is placed.
1869 * \since 11.0
1870 *
1871 * \details
1872 * This is called between ast_request() and ast_call() to
1873 * execute a predial routine on the newly created channel.
1874 *
1875 * \param chan Channel to execute Gosub.
1876 * \param sub_args Gosub application parameter string.
1877 *
1878 * \note Absolutely _NO_ channel locks should be held before calling this function.
1879 *
1880 * \retval 0 on success.
1881 * \retval -1 on error.
1882 */
1883int ast_pre_call(struct ast_channel *chan, const char *sub_args);
1884
1885/*!
1886 * \brief Make a call
1887 * \note Absolutely _NO_ channel locks should be held before calling this function.
1888 * \param chan which channel to make the call on
1889 * \param addr destination of the call
1890 * \param timeout time to wait on for connect (Doesn't seem to be used.)
1891 * \details
1892 * Place a call, take no longer than timeout ms.
1893 * \retval 0 on success
1894 * \retval -1 on failure
1895 */
1896int ast_call(struct ast_channel *chan, const char *addr, int timeout);
1897
1898/*!
1899 * \brief Indicates condition of channel
1900 * \note Absolutely _NO_ channel locks should be held before calling this function.
1901 * \note Indicate a condition such as AST_CONTROL_BUSY, AST_CONTROL_RINGING, or AST_CONTROL_CONGESTION on a channel
1902 * \param chan channel to change the indication
1903 * \param condition which condition to indicate on the channel
1904 * \return Returns 0 on success, -1 on failure
1905 */
1906int ast_indicate(struct ast_channel *chan, int condition);
1907
1908/*!
1909 * \brief Indicates condition of channel, with payload
1910 * \note Absolutely _NO_ channel locks should be held before calling this function.
1911 * \note Indicate a condition such as AST_CONTROL_HOLD with payload being music on hold class
1912 * \param chan channel to change the indication
1913 * \param condition which condition to indicate on the channel
1914 * \param data pointer to payload data
1915 * \param datalen size of payload data
1916 * \return Returns 0 on success, -1 on failure
1917 */
1918int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen);
1919
1920/* Misc stuff ------------------------------------------------ */
1921
1922/*!
1923 * \brief Wait for input on a channel
1924 * \param chan channel to wait on
1925 * \param ms length of time to wait on the channel
1926 * \details
1927 * Wait for input on a channel for a given # of milliseconds (<0 for indefinite).
1928 * \retval < 0 on failure
1929 * \retval 0 if nothing ever arrived
1930 * \retval the # of ms remaining otherwise
1931 */
1932int ast_waitfor(struct ast_channel *chan, int ms);
1933
1934/*!
1935 * \brief Should we keep this frame for later?
1936 *
1937 * There are functions such as ast_safe_sleep which will
1938 * service a channel to ensure that it does not have a
1939 * large backlog of queued frames. When this happens,
1940 * we want to hold on to specific frame types and just drop
1941 * others. This function will tell if the frame we just
1942 * read should be held onto.
1943 *
1944 * \param frame The frame we just read
1945 * \retval 1 frame should be kept
1946 * \retval 0 frame should be dropped
1947 */
1948int ast_is_deferrable_frame(const struct ast_frame *frame);
1949
1950/*!
1951 * \brief Wait for a specified amount of time, looking for hangups
1952 * \param chan channel to wait for
1953 * \param ms length of time in milliseconds to sleep. This should never be less than zero.
1954 * \details
1955 * Waits for a specified amount of time, servicing the channel as required.
1956 * \return returns -1 on hangup, otherwise 0.
1957 */
1958int ast_safe_sleep(struct ast_channel *chan, int ms);
1959
1960/*!
1961 * \brief Wait for a specified amount of time, looking for hangups, and do not generate silence
1962 * \param chan channel to wait for
1963 * \param ms length of time in milliseconds to sleep. This should never be less than zero.
1964 * \details
1965 * Waits for a specified amount of time, servicing the channel as required.
1966 * \return returns -1 on hangup, otherwise 0.
1967 * \note Unlike ast_safe_sleep this will not generate silence if Asterisk is configured to do so.
1968 */
1969int ast_safe_sleep_without_silence(struct ast_channel *chan, int ms);
1970
1971/*!
1972 * \brief Wait for a specified amount of time, looking for hangups and a condition argument
1973 * \param chan channel to wait for
1974 * \param ms length of time in milliseconds to sleep.
1975 * \param cond a function pointer for testing continue condition
1976 * \param data argument to be passed to the condition test function
1977 * \return returns -1 on hangup, otherwise 0.
1978 * \details
1979 * Waits for a specified amount of time, servicing the channel as required. If cond
1980 * returns 0, this function returns.
1981 */
1982int ast_safe_sleep_conditional(struct ast_channel *chan, int ms, int (*cond)(void*), void *data );
1983
1984/*!
1985 * \brief Waits for activity on a group of channels
1986 * \param c an array of pointers to channels
1987 * \param n number of channels that are to be waited upon
1988 * \param fds an array of fds to wait upon
1989 * \param nfds the number of fds to wait upon
1990 * \param exception exception flag
1991 * \param outfd fd that had activity on it
1992 * \param ms how long the wait was
1993 * \details
1994 * Big momma function here. Wait for activity on any of the n channels, or any of the nfds
1995 * file descriptors.
1996 * \return Returns the channel with activity, or NULL on error or if an FD
1997 * came first. If the FD came first, it will be returned in outfd, otherwise, outfd
1998 * will be -1
1999 */
2000struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n,
2001 int *fds, int nfds, int *exception, int *outfd, int *ms);
2002
2003/*!
2004 * \brief Waits for input on a group of channels
2005 * Wait for input on an array of channels for a given # of milliseconds.
2006 * \return Return channel with activity, or NULL if none has activity.
2007 * \param chan an array of pointers to channels
2008 * \param n number of channels that are to be waited upon
2009 * \param ms time "ms" is modified in-place, if applicable
2010 */
2011struct ast_channel *ast_waitfor_n(struct ast_channel **chan, int n, int *ms);
2012
2013/*!
2014 * \brief Waits for input on an fd
2015 * \note This version works on fd's only. Be careful with it.
2016 */
2017int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception);
2018
2019
2020/*!
2021 * \brief Reads a frame
2022 *
2023 * \param chan channel to read a frame from
2024 *
2025 * \return Returns a frame, or NULL on error. If it returns NULL, you
2026 * best just stop reading frames and assume the channel has been
2027 * disconnected.
2028 *
2029 * \note This function will filter frames received from the channel so
2030 * that only frames from the default stream for each media type
2031 * are returned. All other media frames from other streams will
2032 * be absorbed internally and a NULL frame returned instead.
2033 */
2034struct ast_frame *ast_read(struct ast_channel *chan);
2035
2036/*!
2037 * \brief Reads a frame, but does not filter to just the default streams
2038 *
2039 * \param chan channel to read a frame from
2040 *
2041 * \return Returns a frame, or NULL on error. If it returns NULL, you
2042 * best just stop reading frames and assume the channel has been
2043 * disconnected.
2044 *
2045 * \note This function will not perform any filtering and will return
2046 * media frames from all streams on the channel. To determine which
2047 * stream a frame originated from the stream_num on it can be
2048 * examined.
2049 */
2050struct ast_frame *ast_read_stream(struct ast_channel *chan);
2051
2052/*!
2053 * \brief Reads a frame, returning AST_FRAME_NULL frame if audio.
2054 * \param chan channel to read a frame from
2055 * \return Returns a frame, or NULL on error. If it returns NULL, you
2056 * best just stop reading frames and assume the channel has been
2057 * disconnected.
2058 * \note Audio is replaced with AST_FRAME_NULL to avoid
2059 * transcode when the resulting audio is not necessary.
2060 */
2061struct ast_frame *ast_read_noaudio(struct ast_channel *chan);
2062
2063/*!
2064 * \brief Reads a frame, but does not filter to just the default streams,
2065 * returning AST_FRAME_NULL frame if audio.
2066 *
2067 * \param chan channel to read a frame from
2068 *
2069 * \return Returns a frame, or NULL on error. If it returns NULL, you
2070 * best just stop reading frames and assume the channel has been
2071 * disconnected.
2072 *
2073 * \note This function will not perform any filtering and will return
2074 * media frames from all streams on the channel. To determine which
2075 * stream a frame originated from the stream_num on it can be
2076 * examined.
2077 *
2078 * \note Audio is replaced with AST_FRAME_NULL to avoid
2079 * transcode when the resulting audio is not necessary.
2080 */
2081struct ast_frame *ast_read_stream_noaudio(struct ast_channel *chan);
2082
2083/*!
2084 * \brief Write a frame to a channel
2085 * This function writes the given frame to the indicated channel.
2086 * \param chan destination channel of the frame
2087 * \param frame frame that will be written
2088 * \return It returns 0 on success, -1 on failure.
2089 */
2090int ast_write(struct ast_channel *chan, struct ast_frame *frame);
2091
2092/*!
2093 * \brief Write video frame to a channel
2094 * This function writes the given frame to the indicated channel.
2095 * \param chan destination channel of the frame
2096 * \param frame frame that will be written
2097 * \return It returns 1 on success, 0 if not implemented, and -1 on failure.
2098 */
2099int ast_write_video(struct ast_channel *chan, struct ast_frame *frame);
2100
2101/*!
2102 * \brief Write text frame to a channel
2103 * This function writes the given frame to the indicated channel.
2104 * \param chan destination channel of the frame
2105 * \param frame frame that will be written
2106 * \return It returns 1 on success, 0 if not implemented, and -1 on failure.
2107 */
2108int ast_write_text(struct ast_channel *chan, struct ast_frame *frame);
2109
2110/*!
2111 * \brief Write a frame to a stream
2112 * This function writes the given frame to the indicated stream on the channel.
2113 * \param chan destination channel of the frame
2114 * \param stream_num destination stream on the channel
2115 * \param frame frame that will be written
2116 * \return It returns 0 on success, -1 on failure.
2117 * \note If -1 is provided as the stream number and a media frame is provided the
2118 * function will write to the default stream of the type of media.
2119 */
2120int ast_write_stream(struct ast_channel *chan, int stream_num, struct ast_frame *frame);
2121
2122/*! \brief Send empty audio to prime a channel driver */
2123int ast_prod(struct ast_channel *chan);
2124
2125/*!
2126 * \brief Set specific read path on channel.
2127 * \since 13.4.0
2128 *
2129 * \param chan Channel to setup read path.
2130 * \param raw_format Format to expect from the channel driver.
2131 * \param core_format What the core wants to read.
2132 *
2133 * \pre chan is locked
2134 *
2135 * \retval 0 on success.
2136 * \retval -1 on error.
2137 */
2138int ast_set_read_format_path(struct ast_channel *chan, struct ast_format *raw_format, struct ast_format *core_format);
2139
2140/*!
2141 * \brief Set specific write path on channel.
2142 * \since 13.13.0
2143 *
2144 * \param chan Channel to setup write path.
2145 * \param core_format What the core wants to write.
2146 * \param raw_format Raw write format.
2147 *
2148 * \pre chan is locked
2149 *
2150 * \retval 0 on success.
2151 * \retval -1 on error.
2152 */
2153int ast_set_write_format_path(struct ast_channel *chan, struct ast_format *core_format, struct ast_format *raw_format);
2154
2155/*!
2156 * \brief Sets read format on channel chan from capabilities
2157 * Set read format for channel to whichever component of "format" is best.
2158 * \param chan channel to change
2159 * \param formats new formats to pick from for reading
2160 * \return Returns 0 on success, -1 on failure
2161 */
2163
2164/*!
2165 * \brief Sets read format on channel chan
2166 * \param chan channel to change
2167 * \param format format to set for reading
2168 * \return Returns 0 on success, -1 on failure
2169 */
2170int ast_set_read_format(struct ast_channel *chan, struct ast_format *format);
2171
2172/*!
2173 * \brief Sets write format on channel chan
2174 * Set write format for channel to whichever component of "format" is best.
2175 * \param chan channel to change
2176 * \param formats new formats to pick from for writing
2177 * \return Returns 0 on success, -1 on failure
2178 */
2180
2181/*!
2182 * \brief Sets write format on channel chan
2183 * \param chan channel to change
2184 * \param format format to set for writing
2185 * \return Returns 0 on success, -1 on failure
2186 */
2187int ast_set_write_format(struct ast_channel *chan, struct ast_format *format);
2188
2189/*!
2190 * \brief Sets write format for a channel.
2191 * All internal data will than be handled in an interleaved format. (needed by binaural opus)
2192 *
2193 * \param chan channel to change
2194 * \param format format to set for writing
2195 * \return Returns 0 on success, -1 on failure
2196 */
2197int ast_set_write_format_interleaved_stereo(struct ast_channel *chan, struct ast_format *format);
2198
2199/*!
2200 * \brief Sends text to a channel
2201 *
2202 * \param chan channel to act upon
2203 * \param text string of text to send on the channel
2204 *
2205 * \details
2206 * Write text to a display on a channel
2207 *
2208 * \note The channel does not need to be locked before calling this function.
2209 *
2210 * \retval 0 on success
2211 * \retval -1 on failure
2212 */
2213int ast_sendtext(struct ast_channel *chan, const char *text);
2214
2215/*!
2216 * \brief Sends text to a channel in an ast_msg_data structure wrapper with ast_sendtext as fallback
2217 * \since 13.22.0
2218 * \since 15.5.0
2219 *
2220 * \param chan channel to act upon
2221 * \param msg ast_msg_data structure
2222 *
2223 * \details
2224 * Write text to a display on a channel. If the channel driver doesn't support the
2225 * send_text_data callback. then the original send_text callback will be used if
2226 * available.
2227 *
2228 * \note The channel does not need to be locked before calling this function.
2229 *
2230 * \retval 0 on success
2231 * \retval -1 on failure
2232 */
2233int ast_sendtext_data(struct ast_channel *chan, struct ast_msg_data *msg);
2234
2235/*!
2236 * \brief Receives a text character from a channel
2237 * \param chan channel to act upon
2238 * \param timeout timeout in milliseconds (0 for infinite wait)
2239 * \details
2240 * Read a char of text from a channel
2241 * \return 0 on success, -1 on failure
2242 */
2243int ast_recvchar(struct ast_channel *chan, int timeout);
2244
2245/*!
2246 * \brief End sending an MF digit to a channel.
2247 * \param chan channel to act upon
2248 * \return Returns 0 on success, -1 on failure
2249 */
2250int ast_senddigit_mf_end(struct ast_channel *chan);
2251
2252/*!
2253 * \brief Send an MF digit to a channel.
2254 *
2255 * \param chan channel to act upon
2256 * \param digit the MF digit to send, encoded in ASCII
2257 * \param duration the duration of a numeric digit ending in ms
2258 * \param durationkp the duration of a KP digit ending in ms
2259 * \param durationst the duration of a ST, STP, ST2P, or ST3P digit ending in ms
2260 * \param is_external 1 if called by a thread that is not the channel's media
2261 * handler thread, 0 if called by the channel's media handler
2262 * thread.
2263 *
2264 * \return 0 on success, -1 on failure
2265 */
2266int ast_senddigit_mf(struct ast_channel *chan, char digit, unsigned int duration,
2267 unsigned int durationkp, unsigned int durationst, int is_external);
2268
2269/*!
2270 * \brief Send a DTMF digit to a channel.
2271 *
2272 * \param chan channel to act upon
2273 * \param digit the DTMF digit to send, encoded in ASCII
2274 * \param duration the duration of the digit ending in ms
2275 *
2276 * \pre This must only be called by the channel's media handler thread.
2277 *
2278 * \return 0 on success, -1 on failure
2279 */
2280int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration);
2281
2282/*!
2283 * \brief Send a DTMF digit to a channel from an external thread.
2284 *
2285 * \param chan channel to act upon
2286 * \param digit the DTMF digit to send, encoded in ASCII
2287 * \param duration the duration of the digit ending in ms
2288 *
2289 * \pre This must only be called by threads that are not the channel's
2290 * media handler thread.
2291 *
2292 * \return 0 on success, -1 on failure
2293 */
2294int ast_senddigit_external(struct ast_channel *chan, char digit, unsigned int duration);
2295
2296/*!
2297 * \brief Send an MF digit to a channel.
2298 * \param chan channel to act upon
2299 * \param digit the MF digit to send, encoded in ASCII
2300 * \return 0 on success, -1 on failure
2301 */
2302int ast_senddigit_mf_begin(struct ast_channel *chan, char digit);
2303
2304/*!
2305 * \brief Send a DTMF digit to a channel.
2306 * \param chan channel to act upon
2307 * \param digit the DTMF digit to send, encoded in ASCII
2308 * \return 0 on success, -1 on failure
2309 */
2310int ast_senddigit_begin(struct ast_channel *chan, char digit);
2311
2312/*!
2313 * \brief Send a DTMF digit to a channel.
2314 * \param chan channel to act upon
2315 * \param digit the DTMF digit to send, encoded in ASCII
2316 * \param duration the duration of the digit ending in ms
2317 * \return Returns 0 on success, -1 on failure
2318 */
2319int ast_senddigit_end(struct ast_channel *chan, char digit, unsigned int duration);
2320
2321/*!
2322 * \brief Receives a text string from a channel
2323 * Read a string of text from a channel
2324 * \param chan channel to act upon
2325 * \param timeout timeout in milliseconds (0 for infinite wait)
2326 * \return the received text, or NULL to signify failure.
2327 */
2328char *ast_recvtext(struct ast_channel *chan, int timeout);
2329
2330/*!
2331 * \brief Waits for a digit
2332 * \param c channel to wait for a digit on
2333 * \param ms how many milliseconds to wait (<0 for indefinite).
2334 * \return Returns <0 on error, 0 on no entry, and the digit on success.
2335 */
2336int ast_waitfordigit(struct ast_channel *c, int ms);
2337
2338/*!
2339 * \brief Wait for a digit
2340 * Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to monitor for reading.
2341 * \param c channel to wait for a digit on
2342 * \param ms how many milliseconds to wait (<0 for indefinite).
2343 * \param breakon string of DTMF digits to break upon or NULL for any.
2344 * \param audiofd audio file descriptor to write to if audio frames are received
2345 * \param ctrlfd control file descriptor to monitor for reading
2346 * \return Returns 1 if ctrlfd becomes available
2347 */
2348int ast_waitfordigit_full(struct ast_channel *c, int ms, const char *breakon, int audiofd, int ctrlfd);
2349
2350/*!
2351 * \brief Reads multiple digits
2352 * \param c channel to read from
2353 * \param s string to read in to. Must be at least the size of your length
2354 * \param len how many digits to read (maximum)
2355 * \param timeout how long to timeout between digits
2356 * \param rtimeout timeout to wait on the first digit
2357 * \param enders digits to end the string
2358 * \details
2359 * Read in a digit string "s", max length "len", maximum timeout between
2360 * digits "timeout" (-1 for none), terminated by anything in "enders". Give them rtimeout
2361 * for the first digit.
2362 * \return Returns 0 on normal return, or 1 on a timeout. In the case of
2363 * a timeout, any digits that were read before the timeout will still be available in s.
2364 * RETURNS 2 in full version when ctrlfd is available, NOT 1
2365 */
2366int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders);
2367int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders, int audiofd, int ctrlfd);
2368
2369/*! \brief Report DTMF on channel 0 */
2370#define AST_BRIDGE_DTMF_CHANNEL_0 (1 << 0)
2371/*! \brief Report DTMF on channel 1 */
2372#define AST_BRIDGE_DTMF_CHANNEL_1 (1 << 1)
2373
2374
2375/*!
2376 * \brief Make the frame formats of two channels compatible.
2377 *
2378 * \param chan First channel to make compatible. Should be the calling party.
2379 * \param peer Other channel to make compatible. Should be the called party.
2380 *
2381 * \note Absolutely _NO_ channel locks should be held before calling this function.
2382 *
2383 * \details
2384 * Set two channels to compatible frame formats in both
2385 * directions. The path from peer to chan is made compatible
2386 * first to allow for in-band audio in case the other direction
2387 * cannot be made compatible.
2388 *
2389 * \retval 0 on success.
2390 * \retval -1 on error.
2391 */
2392int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *peer);
2393
2394/*!
2395 * \brief Bridge two channels together (early)
2396 * \param c0 first channel to bridge
2397 * \param c1 second channel to bridge
2398 * \details
2399 * Bridge two channels (c0 and c1) together early. This implies either side may not be answered yet.
2400 * \return Returns 0 on success and -1 if it could not be done
2401 */
2402int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1);
2403
2404/*!
2405 * \brief Gives the string form of a given cause code.
2406 *
2407 * \param cause cause to get the description of
2408 * \return the text form of the binary cause code given
2409 */
2410const char *ast_cause2str(int cause) attribute_pure;
2411
2412/*!
2413 * \brief Convert the string form of a cause code to a number
2414 *
2415 * \param name string form of the cause
2416 * \return the cause code
2417 */
2418int ast_str2cause(const char *name) attribute_pure;
2419
2420/*!
2421 * \brief Gives the string form of a given channel state
2422 *
2423 * \param state state to get the name of
2424 * \return the text form of the binary state given
2425 *
2426 * \note This function is not reentrant.
2427 */
2428const char *ast_state2str(enum ast_channel_state state);
2429
2430/*!
2431 * \brief Gives the string form of a given transfer capability
2432 *
2433 * \param transfercapability transfer capability to get the name of
2434 * \return the text form of the binary transfer capability
2435 */
2436char *ast_transfercapability2str(int transfercapability) attribute_const;
2437
2438/*
2439 * Options: Some low-level drivers may implement "options" allowing fine tuning of the
2440 * low level channel. See frame.h for options. Note that many channel drivers may support
2441 * none or a subset of those features, and you should not count on this if you want your
2442 * asterisk application to be portable. They're mainly useful for tweaking performance
2443 */
2444
2445/*!
2446 * \brief Sets an option on a channel
2447 *
2448 * \param channel channel to set options on
2449 * \param option option to change
2450 * \param data data specific to option
2451 * \param datalen length of the data
2452 * \param block blocking or not
2453 * \details
2454 * Set an option on a channel (see frame.h), optionally blocking awaiting the reply
2455 * \return 0 on success and -1 on failure
2456 */
2457int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block);
2458
2459/*!
2460 * \brief Checks the value of an option
2461 *
2462 * Query the value of an option
2463 * Works similarly to setoption except only reads the options.
2464 */
2465int ast_channel_queryoption(struct ast_channel *channel, int option, void *data, int *datalen, int block);
2466
2467/*!
2468 * \brief Checks for HTML support on a channel
2469 * \return 0 if channel does not support HTML or non-zero if it does
2470 */
2471int ast_channel_supports_html(struct ast_channel *channel);
2472
2473/*!
2474 * \brief Sends HTML on given channel
2475 * Send HTML or URL on link.
2476 * \return 0 on success or -1 on failure
2477 */
2478int ast_channel_sendhtml(struct ast_channel *channel, int subclass, const char *data, int datalen);
2479
2480/*!
2481 * \brief Sends a URL on a given link
2482 * Send URL on link.
2483 * \return 0 on success or -1 on failure
2484 */
2485int ast_channel_sendurl(struct ast_channel *channel, const char *url);
2486
2487/*!
2488 * \brief Defers DTMF so that you only read things like hangups and audio.
2489 * \return non-zero if channel was already DTMF-deferred or
2490 * 0 if channel is just now being DTMF-deferred
2491 */
2492int ast_channel_defer_dtmf(struct ast_channel *chan);
2493
2494/*! Undo defer. ast_read will return any DTMF characters that were queued */
2495void ast_channel_undefer_dtmf(struct ast_channel *chan);
2496
2497/*! \return number of channels available for lookup */
2498int ast_active_channels(void);
2499
2500/*! \return the number of channels not yet destroyed */
2501int ast_undestroyed_channels(void);
2502
2503/*! Activate a given generator */
2504int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params);
2505
2506/*! Deactivate an active generator */
2507void ast_deactivate_generator(struct ast_channel *chan);
2508
2509/*!
2510 * \since 13.27.0
2511 * \since 16.4.0
2512 * \brief Obtain how long it's been, in milliseconds, since the channel was created
2513 *
2514 * \param chan The channel object
2515 *
2516 * \retval 0 if the time value cannot be computed (or you called this really fast)
2517 * \retval The number of milliseconds since channel creation
2518 */
2519int64_t ast_channel_get_duration_ms(struct ast_channel *chan);
2520
2521/*!
2522 * \since 12
2523 * \brief Obtain how long the channel since the channel was created
2524 *
2525 * \param chan The channel object
2526 *
2527 * \retval 0 if the time value cannot be computed (or you called this really fast)
2528 * \retval The number of seconds the channel has been up
2529 */
2530int ast_channel_get_duration(struct ast_channel *chan);
2531
2532/*!
2533 * \since 13.27.0
2534 * \since 16.4.0
2535 * \brief Obtain how long it has been since the channel was answered in ms
2536 *
2537 * \param chan The channel object
2538 *
2539 * \retval 0 if the channel isn't answered (or you called this really fast)
2540 * \retval The number of milliseconds the channel has been up
2541 */
2542int64_t ast_channel_get_up_time_ms(struct ast_channel *chan);
2543
2544/*!
2545 * \since 12
2546 * \brief Obtain how long it has been since the channel was answered
2547 *
2548 * \param chan The channel object
2549 *
2550 * \retval 0 if the channel isn't answered (or you called this really fast)
2551 * \retval The number of seconds the channel has been up
2552 */
2553int ast_channel_get_up_time(struct ast_channel *chan);
2554
2555/*!
2556 * \brief Set caller ID number, name and ANI and generate AMI event.
2557 *
2558 * \note Use ast_channel_set_caller() and ast_channel_set_caller_event() instead.
2559 * \note The channel does not need to be locked before calling this function.
2560 */
2561void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani);
2562
2563/*!
2564 * \brief Set the caller id information in the Asterisk channel
2565 * \since 1.8
2566 *
2567 * \param chan Asterisk channel to set caller id information
2568 * \param caller Caller id information
2569 * \param update What caller information to update. NULL if all.
2570 *
2571 * \note The channel does not need to be locked before calling this function.
2572 */
2573void ast_channel_set_caller(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update);
2574
2575/*!
2576 * \brief Set the caller id information in the Asterisk channel and generate an AMI event
2577 * if the caller id name or number changed.
2578 * \since 1.8
2579 *
2580 * \param chan Asterisk channel to set caller id information
2581 * \param caller Caller id information
2582 * \param update What caller information to update. NULL if all.
2583 *
2584 * \note The channel does not need to be locked before calling this function.
2585 */
2586void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update);
2587
2588/*! Set the file descriptor on the channel */
2589void ast_channel_set_fd(struct ast_channel *chan, int which, int fd);
2590
2591/*! Start a tone going */
2592int ast_tonepair_start(struct ast_channel *chan, int freq1, int freq2, int duration, int vol);
2593/*! Stop a tone from playing */
2594void ast_tonepair_stop(struct ast_channel *chan);
2595/*! Play a tone pair for a given amount of time */
2596int ast_tonepair(struct ast_channel *chan, int freq1, int freq2, int duration, int vol);
2597
2598/*!
2599 * \brief Automatically service a channel for us...
2600 *
2601 * \retval 0 success
2602 * \retval -1 failure, or the channel is already being autoserviced
2603 */
2604int ast_autoservice_start(struct ast_channel *chan);
2605
2606/*!
2607 * \brief Stop servicing a channel for us...
2608 *
2609 * \note if chan is locked prior to calling ast_autoservice_stop, it
2610 * is likely that there will be a deadlock between the thread that calls
2611 * ast_autoservice_stop and the autoservice thread. It is important
2612 * that chan is not locked prior to this call
2613 *
2614 * \param chan
2615 * \retval 0 success
2616 * \retval -1 error, or the channel has been hungup
2617 */
2618int ast_autoservice_stop(struct ast_channel *chan);
2619
2620/*!
2621 * \brief Put chan into autoservice while hanging up peer.
2622 * \since 11.0
2623 *
2624 * \param chan Chan to put into autoservice.
2625 * \param peer Chan to run hangup handlers and hangup.
2626 */
2627void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer);
2628
2629/*!
2630 * \brief Ignore certain frame types
2631 * \note Normally, we cache DTMF, IMAGE, HTML, TEXT, and CONTROL frames
2632 * while a channel is in autoservice and queue them up when taken out of
2633 * autoservice. When this is not desireable, this API may be used to
2634 * cause the channel to ignore those frametypes after the channel is put
2635 * into autoservice, but before autoservice is stopped.
2636 * \retval 0 success
2637 * \retval -1 channel is not in autoservice
2638 */
2639int ast_autoservice_ignore(struct ast_channel *chan, enum ast_frame_type ftype);
2640
2641/*!
2642 * \brief Enable or disable timer ticks for a channel
2643 *
2644 * \param c channel
2645 * \param rate number of timer ticks per second
2646 * \param func callback function
2647 * \param data
2648 *
2649 * \details
2650 * If timers are supported, force a scheduled expiration on the
2651 * timer fd, at which point we call the callback function / data
2652 *
2653 * \note Call this function with a rate of 0 to turn off the timer ticks
2654 *
2655 * \version 1.6.1 changed samples parameter to rate, accommodates new timing methods
2656 */
2657int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const void *data), void *data);
2658int ast_settimeout_full(struct ast_channel *c, unsigned int rate, int (*func)(const void *data), void *data, unsigned int is_ao2_obj);
2659
2660/*!
2661 * \brief Transfer a channel (if supported).
2662 * \retval -1 on error
2663 * \retval 0 if not supported
2664 * \retval 1 if supported and requested
2665 * \param chan current channel
2666 * \param dest destination extension for transfer
2667 */
2668int ast_transfer(struct ast_channel *chan, char *dest);
2669
2670/*!
2671 * \brief Transfer a channel (if supported) receieve protocol result.
2672 * \retval -1 on error
2673 * \retval 0 if not supported
2674 * \retval 1 if supported and requested
2675 * \param chan channel to transfer
2676 * \param dest destination extension to transfer to
2677 * \param protocol protocol is the protocol result
2678 * SIP example, 0=success, 3xx-6xx is SIP error code
2679 */
2680int ast_transfer_protocol(struct ast_channel *chan, char *dest, int *protocol);
2681
2682/*!
2683 * \brief Inherits channel variable from parent to child channel
2684 * \param parent Parent channel
2685 * \param child Child channel
2686 *
2687 * \details
2688 * Scans all channel variables in the parent channel, looking for those
2689 * that should be copied into the child channel.
2690 * Variables whose names begin with a single '_' are copied into the
2691 * child channel with the prefix removed.
2692 * Variables whose names begin with '__' are copied into the child
2693 * channel with their names unchanged.
2694 */
2695void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child);
2696
2697/*!
2698 * \brief adds a list of channel variables to a channel
2699 * \param chan the channel
2700 * \param vars a linked list of variables
2701 *
2702 * \pre chan is locked
2703 *
2704 * \details
2705 * Variable names can be for a regular channel variable or a dialplan function
2706 * that has the ability to be written to.
2707 */
2708void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars);
2709
2710/*!
2711 * \brief An opaque 'object' structure use by silence generators on channels.
2712 */
2714
2715/*!
2716 * \brief Starts a silence generator on the given channel.
2717 * \param chan The channel to generate silence on
2718 * \return An ast_silence_generator pointer, or NULL if an error occurs
2719 *
2720 * \details
2721 * This function will cause SLINEAR silence to be generated on the supplied
2722 * channel until it is disabled; if the channel cannot be put into SLINEAR
2723 * mode then the function will fail.
2724 *
2725 * \note
2726 * The pointer returned by this function must be preserved and passed to
2727 * ast_channel_stop_silence_generator when you wish to stop the silence
2728 * generation.
2729 */
2731
2732/*!
2733 * \brief Stops a previously-started silence generator on the given channel.
2734 * \param chan The channel to operate on
2735 * \param state The ast_silence_generator pointer return by a previous call to
2736 * ast_channel_start_silence_generator.
2737 *
2738 * \details
2739 * This function will stop the operating silence generator and return the channel
2740 * to its previous write format.
2741 */
2743
2744/*!
2745 * \brief Determine which channel has an older linkedid
2746 * \param a First channel
2747 * \param b Second channel
2748 * \return Returns an ast_channel structure that has oldest linkedid
2749 */
2751
2752/*!
2753 * \brief Copy the full linkedid channel id structure from one channel to another
2754 * \param dest Destination to copy linkedid to
2755 * \param source Source channel to copy linkedid from
2756 */
2757void ast_channel_internal_copy_linkedid(struct ast_channel *dest, struct ast_channel *source);
2758
2759/*!
2760 * \brief Swap uniqueid and linkedid beteween two channels
2761 * \param a First channel
2762 * \param b Second channel
2763 *
2764 * \note
2765 * This is used in masquerade to exchange identities
2766 */
2768
2769/*!
2770 * \brief Swap topics beteween two channels
2771 * \param a First channel
2772 * \param b Second channel
2773 *
2774 * \note
2775 * This is used in masquerade to exchange topics for message routing
2776 */
2778
2779/*!
2780 * \brief Swap endpoint_forward between two channels
2781 * \param a First channel
2782 * \param b Second channel
2783 *
2784 * \note
2785 * This is used in masquerade to exchange endpoint details if one of the two or both
2786 * the channels were created with endpoint
2787 */
2789
2790/*!
2791 * \brief Swap snapshots beteween two channels
2792 * \param a First channel
2793 * \param b Second channel
2794 *
2795 * \note
2796 * This is used in masquerade to exchange snapshots
2797 */
2799
2800/*!
2801 * \brief Set uniqueid and linkedid string value only (not time)
2802 * \param chan The channel to set the uniqueid to
2803 * \param uniqueid The uniqueid to set
2804 * \param linkedid The linkedid to set
2805 *
2806 * \note
2807 * This is used only by ast_cel_fabricate_channel_from_event()
2808 * to create a temporary fake channel - time values are invalid
2809 */
2810void ast_channel_internal_set_fake_ids(struct ast_channel *chan, const char *uniqueid, const char *linkedid);
2811
2812/* Misc. functions below */
2813
2814/*!
2815 * \brief if fd is a valid descriptor, set *pfd with the descriptor
2816 * \return Return 1 (not -1!) if added, 0 otherwise (so we can add the
2817 * return value to the index into the array)
2818 */
2819static inline int ast_add_fd(struct pollfd *pfd, int fd)
2820{
2821 pfd->fd = fd;
2822 pfd->events = POLLIN | POLLPRI;
2823 return fd >= 0;
2824}
2825
2826/*! \brief Helper function for migrating select to poll */
2827static inline int ast_fdisset(struct pollfd *pfds, int fd, int maximum, int *start)
2828{
2829 int x;
2830 int dummy = 0;
2831
2832 if (fd < 0)
2833 return 0;
2834 if (!start)
2835 start = &dummy;
2836 for (x = *start; x < maximum; x++)
2837 if (pfds[x].fd == fd) {
2838 if (x == *start)
2839 (*start)++;
2840 return pfds[x].revents;
2841 }
2842 return 0;
2843}
2844
2845/*!
2846 * \brief Retrieves the current T38 state of a channel
2847 *
2848 * \note Absolutely _NO_ channel locks should be held before calling this function.
2849 */
2851{
2853 int datalen = sizeof(state);
2854
2856
2857 return state;
2858}
2859
2860/*!
2861 * \brief Set the blocking indication on the channel.
2862 *
2863 * \details
2864 * Indicate that the thread handling the channel is about to do a blocking
2865 * operation to wait for media on the channel. (poll, read, or write)
2866 *
2867 * Masquerading and ast_queue_frame() use this indication to wake up the thread.
2868 *
2869 * \pre The channel needs to be locked
2870 */
2871#define CHECK_BLOCKING(c) \
2872 do { \
2873 if (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING)) { \
2874 /* This should not happen as there should only be one thread handling a channel's media at a time. */ \
2875 ast_log(LOG_DEBUG, "Thread LWP %d is blocking '%s', already blocked by thread LWP %d in procedure %s\n", \
2876 ast_get_tid(), ast_channel_name(c), \
2877 ast_channel_blocker_tid(c), ast_channel_blockproc(c)); \
2878 ast_assert(0); \
2879 } \
2880 ast_channel_blocker_tid_set((c), ast_get_tid()); \
2881 ast_channel_blocker_set((c), pthread_self()); \
2882 ast_channel_blockproc_set((c), __PRETTY_FUNCTION__); \
2883 ast_set_flag(ast_channel_flags(c), AST_FLAG_BLOCKING); \
2884 } while (0)
2885
2886ast_group_t ast_get_group(const char *s);
2887
2888/*! \brief Print call and pickup groups into buffer */
2889char *ast_print_group(char *buf, int buflen, ast_group_t group);
2890
2891/*! \brief Opaque struct holding a namedgroups set, i.e. a set of group names */
2892struct ast_namedgroups;
2893
2894/*! \brief Create an ast_namedgroups set with group names from comma separated string */
2895struct ast_namedgroups *ast_get_namedgroups(const char *s);
2896struct ast_namedgroups *ast_unref_namedgroups(struct ast_namedgroups *groups);
2897struct ast_namedgroups *ast_ref_namedgroups(struct ast_namedgroups *groups);
2898/*! \brief Return TRUE if group a and b contain at least one common groupname */
2899int ast_namedgroups_intersect(struct ast_namedgroups *a, struct ast_namedgroups *b);
2900
2901/*! \brief Print named call groups and named pickup groups */
2902char *ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups);
2903
2904/*! \brief return an ast_variable list of channeltypes */
2906
2907/*!
2908 * \brief return an english explanation of the code returned thru __ast_request_and_dial's 'outstate' argument
2909 * \param reason The integer argument, usually taken from AST_CONTROL_ macros
2910 * \return char pointer explaining the code
2911 */
2912const char *ast_channel_reason2str(int reason);
2913
2914/*! \brief channel group info */
2918 char *group;
2920};
2921
2922#define ast_channel_lock(chan) ao2_lock(chan)
2923#define ast_channel_unlock(chan) ao2_unlock(chan)
2924#define ast_channel_trylock(chan) ao2_trylock(chan)
2925
2926/*!
2927 * \brief Lock two channels.
2928 */
2929#define ast_channel_lock_both(chan1, chan2) do { \
2930 ast_channel_lock(chan1); \
2931 while (ast_channel_trylock(chan2)) { \
2932 ast_channel_unlock(chan1); \
2933 sched_yield(); \
2934 ast_channel_lock(chan1); \
2935 } \
2936 } while (0)
2937
2938/*!
2939 * \brief Increase channel reference count
2940 *
2941 * \param c the channel
2942 *
2943 * \retval c always
2944 *
2945 * \since 1.8
2946 */
2947#define ast_channel_ref(c) ({ ao2_ref(c, +1); (c); })
2948
2949/*!
2950 * \brief Decrease channel reference count
2951 *
2952 * \param c the channel
2953 *
2954 * \retval NULL always
2955 *
2956 * \since 1.8
2957 */
2958#define ast_channel_unref(c) ({ ao2_ref(c, -1); (struct ast_channel *) (NULL); })
2959
2960/*!
2961 * \brief Cleanup a channel reference
2962 *
2963 * \param c the channel (NULL tolerant)
2964 *
2965 * \retval NULL always
2966 *
2967 * \since 12.0.0
2968 */
2969#define ast_channel_cleanup(c) ({ ao2_cleanup(c); (struct ast_channel *) (NULL); })
2970
2971/*! Channel Iterating @{ */
2972
2973/*!
2974 * \brief A channel iterator
2975 *
2976 * This is an opaque type.
2977 */
2979
2980/*!
2981 * \brief Destroy a channel iterator
2982 *
2983 * \param i the itereator to destroy
2984 *
2985 * \details
2986 * This function is used to destroy a channel iterator that was retrieved by
2987 * using one of the channel_iterator_xxx_new() functions.
2988 *
2989 * \retval NULL for convenience to clear out the pointer to the iterator that
2990 * was just destroyed.
2991 *
2992 * \since 1.8
2993 */
2995
2996/*!
2997 * \brief Create a new channel iterator based on extension
2998 *
2999 * \param exten The extension that channels must be in
3000 * \param context The context that channels must be in
3001 *
3002 * \details
3003 * After creating an iterator using this function, the ast_channel_iterator_next()
3004 * function can be used to iterate through all channels that are currently
3005 * in the specified context and extension.
3006 *
3007 * \note You must call ast_channel_iterator_destroy() when done.
3008 *
3009 * \retval NULL on failure
3010 * \retval a new channel iterator based on the specified parameters
3011 *
3012 * \since 1.8
3013 */
3014struct ast_channel_iterator *ast_channel_iterator_by_exten_new(const char *exten, const char *context);
3015
3016/*!
3017 * \brief Create a new channel iterator based on name
3018 *
3019 * \param name channel name or channel uniqueid to match
3020 * \param name_len number of characters in the channel name to match on. This
3021 * would be used to match based on name prefix. If matching on the full
3022 * channel name is desired, then this parameter should be 0.
3023 *
3024 * \details
3025 * After creating an iterator using this function, the ast_channel_iterator_next()
3026 * function can be used to iterate through all channels that exist that have
3027 * the specified name or name prefix.
3028 *
3029 * \note You must call ast_channel_iterator_destroy() when done.
3030 *
3031 * \retval NULL on failure
3032 * \retval a new channel iterator based on the specified parameters
3033 *
3034 * \since 1.8
3035 */
3036struct ast_channel_iterator *ast_channel_iterator_by_name_new(const char *name, size_t name_len);
3037
3038/*!
3039 * \brief Create a new channel iterator
3040 *
3041 * \details
3042 * After creating an iterator using this function, the ast_channel_iterator_next()
3043 * function can be used to iterate through all channels that exist.
3044 *
3045 * \note You must call ast_channel_iterator_destroy() when done.
3046 *
3047 * \retval NULL on failure
3048 * \retval a new channel iterator
3049 *
3050 * \since 1.8
3051 */
3053
3054/*!
3055 * \brief Get the next channel for a channel iterator
3056 *
3057 * \param i the channel iterator that was created using one of the
3058 * channel_iterator_xxx_new() functions.
3059 *
3060 * \details
3061 * This function should be used to iterate through all channels that match a
3062 * specified set of parameters that were provided when the iterator was created.
3063 *
3064 * \retval the next channel that matches the parameters used when the iterator
3065 * was created.
3066 * \retval NULL if no more channels match the iterator parameters.
3067 *
3068 * \since 1.8
3069 */
3071
3072/*! @} End channel iterator definitions. */
3073
3074/*!
3075 * \brief Call a function with every active channel
3076 *
3077 * \details
3078 * This function executes a callback one time for each active channel on the
3079 * system. The channel is provided as an argument to the function.
3080 *
3081 * \note Absolutely _NO_ channel locks should be held before calling this function.
3082 * \since 1.8
3083 */
3084struct ast_channel *ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg,
3085 void *data, int ao2_flags);
3086
3087/*! @{ Channel search functions */
3088
3089/*!
3090 * \brief Find a channel by name
3091 *
3092 * \param name the name or uniqueid of the channel to search for
3093 *
3094 * \details
3095 * Find a channel that has the same name as the provided argument.
3096 *
3097 * \retval a channel with the name specified by the argument
3098 * \retval NULL if no channel was found
3099 *
3100 * \since 1.8
3101 */
3102struct ast_channel *ast_channel_get_by_name(const char *name);
3103
3104/*!
3105 * \brief Find a channel by a name prefix
3106 *
3107 * \param name The channel name or uniqueid prefix to search for
3108 * \param name_len Only search for up to this many characters from the name
3109 *
3110 * \details
3111 * Find a channel that has the same name prefix as specified by the arguments.
3112 *
3113 * \retval a channel with the name prefix specified by the arguments
3114 * \retval NULL if no channel was found
3115 *
3116 * \since 1.8
3117 */
3118struct ast_channel *ast_channel_get_by_name_prefix(const char *name, size_t name_len);
3119
3120/*!
3121 * \brief Find a channel by extension and context
3122 *
3123 * \param exten the extension to search for
3124 * \param context the context to search for
3125 *
3126 * \details
3127 * Return a channel that is currently at the specified extension and context.
3128 *
3129 * \retval a channel that is at the specified extension and context
3130 * \retval NULL if no channel was found
3131 *
3132 * \since 1.8
3133 */
3134struct ast_channel *ast_channel_get_by_exten(const char *exten, const char *context);
3135
3136/*! @} End channel search functions. */
3137
3138/*!
3139 * \brief Initialize the given name structure.
3140 * \since 1.8
3141 *
3142 * \param init Name structure to initialize.
3143 */
3144void ast_party_name_init(struct ast_party_name *init);
3145
3146/*!
3147 * \brief Copy the source party name information to the destination party name.
3148 * \since 1.8
3149 *
3150 * \param dest Destination party name
3151 * \param src Source party name
3152 */
3153void ast_party_name_copy(struct ast_party_name *dest, const struct ast_party_name *src);
3154
3155/*!
3156 * \brief Initialize the given party name structure using the given guide
3157 * for a set update operation.
3158 * \since 1.8
3159 *
3160 * \details
3161 * The initialization is needed to allow a set operation to know if a
3162 * value needs to be updated. Simple integers need the guide's original
3163 * value in case the set operation is not trying to set a new value.
3164 * String values are simply set to NULL pointers if they are not going
3165 * to be updated.
3166 *
3167 * \param init Party name structure to initialize.
3168 * \param guide Source party name to use as a guide in initializing.
3169 */
3170void ast_party_name_set_init(struct ast_party_name *init, const struct ast_party_name *guide);
3171
3172/*!
3173 * \brief Set the source party name information into the destination party name.
3174 * \since 1.8
3175 *
3176 * \param dest The name one wishes to update
3177 * \param src The new name values to update the dest
3178 */
3179void ast_party_name_set(struct ast_party_name *dest, const struct ast_party_name *src);
3180
3181/*!
3182 * \brief Destroy the party name contents
3183 * \since 1.8
3184 *
3185 * \param doomed The party name to destroy.
3186 */
3187void ast_party_name_free(struct ast_party_name *doomed);
3188
3189/*!
3190 * \brief Initialize the given number structure.
3191 * \since 1.8
3192 *
3193 * \param init Number structure to initialize.
3194 */
3195void ast_party_number_init(struct ast_party_number *init);
3196
3197/*!
3198 * \brief Copy the source party number information to the destination party number.
3199 * \since 1.8
3200 *
3201 * \param dest Destination party number
3202 * \param src Source party number
3203 */
3204void ast_party_number_copy(struct ast_party_number *dest, const struct ast_party_number *src);
3205
3206/*!
3207 * \brief Initialize the given party number structure using the given guide
3208 * for a set update operation.
3209 * \since 1.8
3210 *
3211 * \details
3212 * The initialization is needed to allow a set operation to know if a
3213 * value needs to be updated. Simple integers need the guide's original
3214 * value in case the set operation is not trying to set a new value.
3215 * String values are simply set to NULL pointers if they are not going
3216 * to be updated.
3217 *
3218 * \param init Party number structure to initialize.
3219 * \param guide Source party number to use as a guide in initializing.
3220 */
3221void ast_party_number_set_init(struct ast_party_number *init, const struct ast_party_number *guide);
3222
3223/*!
3224 * \brief Set the source party number information into the destination party number.
3225 * \since 1.8
3226 *
3227 * \param dest The number one wishes to update
3228 * \param src The new number values to update the dest
3229 */
3230void ast_party_number_set(struct ast_party_number *dest, const struct ast_party_number *src);
3231
3232/*!
3233 * \brief Destroy the party number contents
3234 * \since 1.8
3235 *
3236 * \param doomed The party number to destroy.
3237 */
3238void ast_party_number_free(struct ast_party_number *doomed);
3239
3240/*!
3241 * \since 1.8
3242 * \brief Initialize the given subaddress structure.
3243 *
3244 * \param init Subaddress structure to initialize.
3245 */
3247
3248/*!
3249 * \since 1.8
3250 * \brief Copy the source party subaddress information to the destination party subaddress.
3251 *
3252 * \param dest Destination party subaddress
3253 * \param src Source party subaddress
3254 */
3255void ast_party_subaddress_copy(struct ast_party_subaddress *dest, const struct ast_party_subaddress *src);
3256
3257/*!
3258 * \since 1.8
3259 * \brief Initialize the given party subaddress structure using the given guide
3260 * for a set update operation.
3261 *
3262 * \details
3263 * The initialization is needed to allow a set operation to know if a
3264 * value needs to be updated. Simple integers need the guide's original
3265 * value in case the set operation is not trying to set a new value.
3266 * String values are simply set to NULL pointers if they are not going
3267 * to be updated.
3268 *
3269 * \param init Party subaddress structure to initialize.
3270 * \param guide Source party subaddress to use as a guide in initializing.
3271 */
3272void ast_party_subaddress_set_init(struct ast_party_subaddress *init, const struct ast_party_subaddress *guide);
3273
3274/*!
3275 * \since 1.8
3276 * \brief Set the source party subaddress information into the destination party subaddress.
3277 *
3278 * \param dest The subaddress one wishes to update
3279 * \param src The new subaddress values to update the dest
3280 */
3281void ast_party_subaddress_set(struct ast_party_subaddress *dest, const struct ast_party_subaddress *src);
3282
3283/*!
3284 * \since 1.8
3285 * \brief Destroy the party subaddress contents
3286 *
3287 * \param doomed The party subaddress to destroy.
3288 */
3290
3291/*!
3292 * \brief Set the update marker to update all information of a corresponding party id.
3293 * \since 11.0
3294 *
3295 * \param update_id The update marker for a corresponding party id.
3296 */
3297void ast_set_party_id_all(struct ast_set_party_id *update_id);
3298
3299/*!
3300 * \brief Initialize the given party id structure.
3301 * \since 1.8
3302 *
3303 * \param init Party id structure to initialize.
3304 */
3305void ast_party_id_init(struct ast_party_id *init);
3306
3307/*!
3308 * \brief Copy the source party id information to the destination party id.
3309 * \since 1.8
3310 *
3311 * \param dest Destination party id
3312 * \param src Source party id
3313 */
3314void ast_party_id_copy(struct ast_party_id *dest, const struct ast_party_id *src);
3315
3316/*!
3317 * \brief Initialize the given party id structure using the given guide
3318 * for a set update operation.
3319 * \since 1.8
3320 *
3321 * \details
3322 * The initialization is needed to allow a set operation to know if a
3323 * value needs to be updated. Simple integers need the guide's original
3324 * value in case the set operation is not trying to set a new value.
3325 * String values are simply set to NULL pointers if they are not going
3326 * to be updated.
3327 *
3328 * \param init Party id structure to initialize.
3329 * \param guide Source party id to use as a guide in initializing.
3330 */
3331void ast_party_id_set_init(struct ast_party_id *init, const struct ast_party_id *guide);
3332
3333/*!
3334 * \brief Set the source party id information into the destination party id.
3335 * \since 1.8
3336 *
3337 * \param dest The id one wishes to update
3338 * \param src The new id values to update the dest
3339 * \param update What id information to update. NULL if all.
3340 */
3341void ast_party_id_set(struct ast_party_id *dest, const struct ast_party_id *src, const struct ast_set_party_id *update);
3342
3343/*!
3344 * \brief Destroy the party id contents
3345 * \since 1.8
3346 *
3347 * \param doomed The party id to destroy.
3348 */
3349void ast_party_id_free(struct ast_party_id *doomed);
3350
3351/*!
3352 * \brief Determine the overall presentation value for the given party.
3353 * \since 1.8
3354 *
3355 * \param id Party to determine the overall presentation value.
3356 *
3357 * \return Overall presentation value for the given party.
3358 */
3359int ast_party_id_presentation(const struct ast_party_id *id);
3360
3361/*!
3362 * \brief Invalidate all components of the given party id.
3363 * \since 11.0
3364 *
3365 * \param id The party id to invalidate.
3366 */
3367void ast_party_id_invalidate(struct ast_party_id *id);
3368
3369/*!
3370 * \brief Destroy and initialize the given party id structure.
3371 * \since 11.0
3372 *
3373 * \param id The party id to reset.
3374 */
3375void ast_party_id_reset(struct ast_party_id *id);
3376
3377/*!
3378 * \brief Merge a given party id into another given party id.
3379 * \since 11.0
3380 *
3381 * \details
3382 * This function will generate an effective party id.
3383 *
3384 * Each party id component of the party id 'base' is overwritten
3385 * by components of the party id 'overlay' if the overlay
3386 * component is marked as valid. However the component 'tag' of
3387 * the base party id remains untouched.
3388 *
3389 * \param base The party id which is merged.
3390 * \param overlay The party id which is used to merge into.
3391 *
3392 * \return The merged party id as a struct, not as a pointer.
3393 * \note The merged party id returned is a shallow copy and must not be freed.
3394 */
3395struct ast_party_id ast_party_id_merge(struct ast_party_id *base, struct ast_party_id *overlay);
3396
3397/*!
3398 * \brief Copy a merge of a given party id into another given party id to a given destination party id.
3399 * \since 11.0
3400 *
3401 * \details
3402 * Each party id component of the party id 'base' is overwritten by components
3403 * of the party id 'overlay' if the 'overlay' component is marked as valid.
3404 * However the component 'tag' of the 'base' party id remains untouched.
3405 * The result is copied into the given party id 'dest'.
3406 *
3407 * \note The resulting merged party id is a real copy and has to be freed.
3408 *
3409 * \param dest The resulting merged party id.
3410 * \param base The party id which is merged.
3411 * \param overlay The party id which is used to merge into.
3412 */
3413void ast_party_id_merge_copy(struct ast_party_id *dest, struct ast_party_id *base, struct ast_party_id *overlay);
3414
3415/*!
3416 * \brief Initialize the given dialed structure.
3417 * \since 1.8
3418 *
3419 * \param init Dialed structure to initialize.
3420 */
3421void ast_party_dialed_init(struct ast_party_dialed *init);
3422
3423/*!
3424 * \brief Copy the source dialed party information to the destination dialed party.
3425 * \since 1.8
3426 *
3427 * \param dest Destination dialed party
3428 * \param src Source dialed party
3429 */
3430void ast_party_dialed_copy(struct ast_party_dialed *dest, const struct ast_party_dialed *src);
3431
3432/*!
3433 * \brief Initialize the given dialed structure using the given
3434 * guide for a set update operation.
3435 * \since 1.8
3436 *
3437 * \details
3438 * The initialization is needed to allow a set operation to know if a
3439 * value needs to be updated. Simple integers need the guide's original
3440 * value in case the set operation is not trying to set a new value.
3441 * String values are simply set to NULL pointers if they are not going
3442 * to be updated.
3443 *
3444 * \param init Caller structure to initialize.
3445 * \param guide Source dialed to use as a guide in initializing.
3446 */
3447void ast_party_dialed_set_init(struct ast_party_dialed *init, const struct ast_party_dialed *guide);
3448
3449/*!
3450 * \brief Set the dialed information based on another dialed source
3451 * \since 1.8
3452 *
3453 * This is similar to ast_party_dialed_copy, except that NULL values for
3454 * strings in the src parameter indicate not to update the corresponding dest values.
3455 *
3456 * \param dest The dialed one wishes to update
3457 * \param src The new dialed values to update the dest
3458 */
3459void ast_party_dialed_set(struct ast_party_dialed *dest, const struct ast_party_dialed *src);
3460
3461/*!
3462 * \brief Destroy the dialed party contents
3463 * \since 1.8
3464 *
3465 * \param doomed The dialed party to destroy.
3466 */
3467void ast_party_dialed_free(struct ast_party_dialed *doomed);
3468
3469/*!
3470 * \since 1.8
3471 * \brief Initialize the given caller structure.
3472 *
3473 * \param init Caller structure to initialize.
3474 */
3475void ast_party_caller_init(struct ast_party_caller *init);
3476
3477/*!
3478 * \since 1.8
3479 * \brief Copy the source caller information to the destination caller.
3480 *
3481 * \param dest Destination caller
3482 * \param src Source caller
3483 */
3484void ast_party_caller_copy(struct ast_party_caller *dest, const struct ast_party_caller *src);
3485
3486/*!
3487 * \brief Initialize the given caller structure using the given
3488 * guide for a set update operation.
3489 * \since 1.8
3490 *
3491 * \details
3492 * The initialization is needed to allow a set operation to know if a
3493 * value needs to be updated. Simple integers need the guide's original
3494 * value in case the set operation is not trying to set a new value.
3495 * String values are simply set to NULL pointers if they are not going
3496 * to be updated.
3497 *
3498 * \param init Caller structure to initialize.
3499 * \param guide Source caller to use as a guide in initializing.
3500 */
3501void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide);
3502
3503/*!
3504 * \brief Set the caller information based on another caller source
3505 * \since 1.8
3506 *
3507 * This is similar to ast_party_caller_copy, except that NULL values for
3508 * strings in the src parameter indicate not to update the corresponding dest values.
3509 *
3510 * \param dest The caller one wishes to update
3511 * \param src The new caller values to update the dest
3512 * \param update What caller information to update. NULL if all.
3513 */
3514void ast_party_caller_set(struct ast_party_caller *dest, const struct ast_party_caller *src, const struct ast_set_party_caller *update);
3515
3516/*!
3517 * \brief Destroy the caller party contents
3518 * \since 1.8
3519 *
3520 * \param doomed The caller party to destroy.
3521 */
3522void ast_party_caller_free(struct ast_party_caller *doomed);
3523
3524/*!
3525 * \since 1.8
3526 * \brief Initialize the given connected line structure.
3527 *
3528 * \param init Connected line structure to initialize.
3529 */
3531
3532/*!
3533 * \since 1.8
3534 * \brief Copy the source connected line information to the destination connected line.
3535 *
3536 * \param dest Destination connected line
3537 * \param src Source connected line
3538 */
3540
3541/*!
3542 * \since 1.8
3543 * \brief Initialize the given connected line structure using the given
3544 * guide for a set update operation.
3545 *
3546 * \details
3547 * The initialization is needed to allow a set operation to know if a
3548 * value needs to be updated. Simple integers need the guide's original
3549 * value in case the set operation is not trying to set a new value.
3550 * String values are simply set to NULL pointers if they are not going
3551 * to be updated.
3552 *
3553 * \param init Connected line structure to initialize.
3554 * \param guide Source connected line to use as a guide in initializing.
3555 */
3557
3558/*!
3559 * \since 1.8
3560 * \brief Set the connected line information based on another connected line source
3561 *
3562 * This is similar to ast_party_connected_line_copy, except that NULL values for
3563 * strings in the src parameter indicate not to update the corresponding dest values.
3564 *
3565 * \param dest The connected line one wishes to update
3566 * \param src The new connected line values to update the dest
3567 * \param update What connected line information to update. NULL if all.
3568 */
3570
3571/*!
3572 * \since 1.8
3573 * \brief Collect the caller party information into a connected line structure.
3574 *
3575 * \param connected Collected caller information for the connected line
3576 * \param caller Caller information.
3577 *
3578 * \warning This is a shallow copy.
3579 * \warning DO NOT call ast_party_connected_line_free() on the filled in
3580 * connected line structure!
3581 */
3583
3584/*!
3585 * \since 1.8
3586 * \brief Destroy the connected line information contents
3587 *
3588 * \param doomed The connected line information to destroy.
3589 */
3591
3592/*!
3593 * \brief Initialize the given redirecting reason structure
3594 *
3595 * \param init Redirecting reason structure to initialize
3596 */
3598
3599/*!
3600 * \brief Copy the source redirecting reason information to the destination redirecting reason.
3601 *
3602 * \param dest Destination redirecting reason
3603 * \param src Source redirecting reason
3604 */
3606 const struct ast_party_redirecting_reason *src);
3607
3608/*!
3609 * \brief Initialize the given redirecting reason structure using the given guide
3610 * for a set update operation.
3611 *
3612 * \details
3613 * The initialization is needed to allow a set operation to know if a
3614 * value needs to be updated. Simple integers need the guide's original
3615 * value in case the set operation is not trying to set a new value.
3616 * String values are simply set to NULL pointers if they are not going
3617 * to be updated.
3618 *
3619 * \param init Redirecting reason structure to initialize.
3620 * \param guide Source redirecting reason to use as a guide in initializing.
3621 */
3623 const struct ast_party_redirecting_reason *guide);
3624
3625/*!
3626 * \brief Set the redirecting reason information based on another redirecting reason source
3627 *
3628 * This is similar to ast_party_redirecting_reason_copy, except that NULL values for
3629 * strings in the src parameter indicate not to update the corresponding dest values.
3630 *
3631 * \param dest The redirecting reason one wishes to update
3632 * \param src The new redirecting reason values to update the dest
3633 */
3635 const struct ast_party_redirecting_reason *src);
3636
3637/*!
3638 * \brief Destroy the redirecting reason contents
3639 *
3640 * \param doomed The redirecting reason to destroy.
3641 */
3643
3644/*!
3645 * \brief Initialize the given redirecting structure.
3646 * \since 1.8
3647 *
3648 * \param init Redirecting structure to initialize.
3649 */
3651
3652/*!
3653 * \since 1.8
3654 * \brief Copy the source redirecting information to the destination redirecting.
3655 *
3656 * \param dest Destination redirecting
3657 * \param src Source redirecting
3658 */
3659void ast_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src);
3660
3661/*!
3662 * \since 1.8
3663 * \brief Initialize the given redirecting id structure using the given guide
3664 * for a set update operation.
3665 *
3666 * \details
3667 * The initialization is needed to allow a set operation to know if a
3668 * value needs to be updated. Simple integers need the guide's original
3669 * value in case the set operation is not trying to set a new value.
3670 * String values are simply set to NULL pointers if they are not going
3671 * to be updated.
3672 *
3673 * \param init Redirecting id structure to initialize.
3674 * \param guide Source redirecting id to use as a guide in initializing.
3675 */
3676void ast_party_redirecting_set_init(struct ast_party_redirecting *init, const struct ast_party_redirecting *guide);
3677
3678/*!
3679 * \brief Set the redirecting information based on another redirecting source
3680 * \since 1.8
3681 *
3682 * This is similar to ast_party_redirecting_copy, except that NULL values for
3683 * strings in the src parameter indicate not to update the corresponding dest values.
3684 *
3685 * \param dest The redirecting one wishes to update
3686 * \param src The new redirecting values to update the dest
3687 * \param update What redirecting information to update. NULL if all.
3688 */
3690
3691/*!
3692 * \since 1.8
3693 * \brief Destroy the redirecting information contents
3694 *
3695 * \param doomed The redirecting information to destroy.
3696 */
3698
3699/*!
3700 * \since 1.8
3701 * \brief Copy the caller information to the connected line information.
3702 *
3703 * \param dest Destination connected line information
3704 * \param src Source caller information
3705 *
3706 * \note Assumes locks are already acquired
3707 */
3709
3710/*!
3711 * \since 1.8
3712 * \brief Copy the connected line information to the caller information.
3713 *
3714 * \param dest Destination caller information
3715 * \param src Source connected line information
3716 *
3717 * \note Assumes locks are already acquired
3718 */
3720
3721/*!
3722 * \since 1.8
3723 * \brief Set the connected line information in the Asterisk channel
3724 *
3725 * \param chan Asterisk channel to set connected line information
3726 * \param connected Connected line information
3727 * \param update What connected line information to update. NULL if all.
3728 *
3729 * \note The channel does not need to be locked before calling this function.
3730 */
3732
3733/*!
3734 * \since 1.8
3735 * \brief Build the connected line information data frame.
3736 *
3737 * \param data Buffer to fill with the frame data
3738 * \param datalen Size of the buffer to fill
3739 * \param connected Connected line information
3740 * \param update What connected line information to build. NULL if all.
3741 *
3742 * \retval -1 if error
3743 * \retval Amount of data buffer used
3744 */
3745int ast_connected_line_build_data(unsigned char *data, size_t datalen, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update);
3746
3747/*!
3748 * \since 1.8
3749 * \brief Parse connected line indication frame data
3750 *
3751 * \param data Buffer with the frame data to parse
3752 * \param datalen Size of the buffer
3753 * \param connected Extracted connected line information
3754 *
3755 * \retval 0 on success.
3756 * \retval -1 on error.
3757 *
3758 * \note The filled in connected line structure needs to be initialized by
3759 * ast_party_connected_line_set_init() before calling. If defaults are not
3760 * required use ast_party_connected_line_init().
3761 * \note The filled in connected line structure needs to be destroyed by
3762 * ast_party_connected_line_free() when it is no longer needed.
3763 */
3764int ast_connected_line_parse_data(const unsigned char *data, size_t datalen, struct ast_party_connected_line *connected);
3765
3766/*!
3767 * \since 1.8
3768 * \brief Indicate that the connected line information has changed
3769 *
3770 * \param chan Asterisk channel to indicate connected line information
3771 * \param connected Connected line information
3772 * \param update What connected line information to update. NULL if all.
3773 */
3775
3776/*!
3777 * \since 1.8
3778 * \brief Queue a connected line update frame on a channel
3779 *
3780 * \param chan Asterisk channel to indicate connected line information
3781 * \param connected Connected line information
3782 * \param update What connected line information to update. NULL if all.
3783 */
3785
3786/*!
3787 * \since 1.8
3788 * \brief Set the redirecting id information in the Asterisk channel
3789 *
3790 * \param chan Asterisk channel to set redirecting id information
3791 * \param redirecting Redirecting id information
3792 * \param update What redirecting information to update. NULL if all.
3793 *
3794 * \note The channel does not need to be locked before calling this function.
3795 */
3796void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update);
3797
3798/*!
3799 * \since 1.8
3800 * \brief Build the redirecting id data frame.
3801 *
3802 * \param data Buffer to fill with the frame data
3803 * \param datalen Size of the buffer to fill
3804 * \param redirecting Redirecting id information
3805 * \param update What redirecting information to build. NULL if all.
3806 *
3807 * \retval -1 if error
3808 * \retval Amount of data buffer used
3809 */
3810int ast_redirecting_build_data(unsigned char *data, size_t datalen, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update);
3811
3812/*!
3813 * \since 1.8
3814 * \brief Parse redirecting indication frame data
3815 *
3816 * \param data Buffer with the frame data to parse
3817 * \param datalen Size of the buffer
3818 * \param redirecting Extracted redirecting id information
3819 *
3820 * \retval 0 on success.
3821 * \retval -1 on error.
3822 *
3823 * \note The filled in id structure needs to be initialized by
3824 * ast_party_redirecting_set_init() before calling.
3825 * \note The filled in id structure needs to be destroyed by
3826 * ast_party_redirecting_free() when it is no longer needed.
3827 */
3828int ast_redirecting_parse_data(const unsigned char *data, size_t datalen, struct ast_party_redirecting *redirecting);
3829
3830/*!
3831 * \since 1.8
3832 * \brief Indicate that the redirecting id has changed
3833 *
3834 * \param chan Asterisk channel to indicate redirecting id information
3835 * \param redirecting Redirecting id information
3836 * \param update What redirecting information to update. NULL if all.
3837 */
3838void ast_channel_update_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update);
3839
3840/*!
3841 * \since 1.8
3842 * \brief Queue a redirecting update frame on a channel
3843 *
3844 * \param chan Asterisk channel to indicate redirecting id information
3845 * \param redirecting Redirecting id information
3846 * \param update What redirecting information to update. NULL if all.
3847 */
3848void ast_channel_queue_redirecting_update(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update);
3849
3850/*!
3851 * \since 11
3852 * \brief Run a connected line interception subroutine and update a channel's connected line
3853 * information
3854 *
3855 * Whenever we want to update a channel's connected line information, we may need to run
3856 * a subroutine so that an administrator can manipulate the information before sending it
3857 * out. This function both runs the subroutine specified by CONNECTED_LINE_SEND_SUB and
3858 * sends the update to the channel.
3859 *
3860 * \param autoservice_chan Channel to place into autoservice while the sub is running.
3861 * It is perfectly safe for this to be NULL
3862 * \param sub_chan The channel to run the subroutine on. Also the channel from which we
3863 * determine which subroutine we need to run.
3864 * \param connected_info Either an ast_party_connected_line or ast_frame pointer of type
3865 * AST_CONTROL_CONNECTED_LINE
3866 * \param frame If true, then connected_info is an ast_frame pointer, otherwise it is an
3867 * ast_party_connected_line pointer.
3868 * \retval 0 Success
3869 * \retval -1 Either the subroutine does not exist, or there was an error while attempting to
3870 * run the subroutine
3871 */
3872int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame);
3873
3874/*!
3875 * \since 11
3876 * \brief Run a redirecting interception subroutine and update a channel's redirecting information
3877 *
3878 * \details
3879 * Whenever we want to update a channel's redirecting information, we may need to run
3880 * a subroutine so that an administrator can manipulate the information before sending it
3881 * out. This function both runs the subroutine specified by REDIRECTING_SEND_SUB and
3882 * sends the update to the channel.
3883 *
3884 * \param autoservice_chan Channel to place into autoservice while the subroutine is running.
3885 * It is perfectly safe for this to be NULL
3886 * \param sub_chan The channel to run the subroutine on. Also the channel from which we
3887 * determine which subroutine we need to run.
3888 * \param redirecting_info Either an ast_party_redirecting or ast_frame pointer of type
3889 * AST_CONTROL_REDIRECTING
3890 * \param is_frame If true, then redirecting_info is an ast_frame pointer, otherwise it is an
3891 * ast_party_redirecting pointer.
3892 *
3893 * \retval 0 Success
3894 * \retval -1 Either the subroutine does not exist, or there was an error while attempting to
3895 * run the subroutine
3896 */
3897int ast_channel_redirecting_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *redirecting_info, int is_frame);
3898
3899#include "asterisk/ccss.h"
3900
3901/*!
3902 * \since 1.8
3903 * \brief Set up datastore with CCSS parameters for a channel
3904 *
3905 * \note
3906 * If base_params is NULL, the channel will get the default
3907 * values for all CCSS parameters.
3908 *
3909 * \details
3910 * This function makes use of datastore operations on the channel, so
3911 * it is important to lock the channel before calling this function.
3912 *
3913 * \param chan The channel to create the datastore on
3914 * \param base_params CCSS parameters we wish to copy into the channel
3915 * \retval 0 Success
3916 * \retval -1 Failure
3917 */
3919 const struct ast_cc_config_params *base_params);
3920
3921/*!
3922 * \since 1.8
3923 * \brief Get the CCSS parameters from a channel
3924 *
3925 * \details
3926 * This function makes use of datastore operations on the channel, so
3927 * it is important to lock the channel before calling this function.
3928 *
3929 * \param chan Channel to retrieve parameters from
3930 * \retval NULL Failure
3931 * \retval non-NULL The parameters desired
3932 */
3934
3935
3936/*!
3937 * \since 1.8
3938 * \brief Get a device name given its channel structure
3939 *
3940 * \details
3941 * A common practice in Asterisk is to determine the device being talked
3942 * to by dissecting the channel name. For certain channel types, this is not
3943 * accurate. For instance, an ISDN channel is named based on what B channel is
3944 * used, not the device being communicated with.
3945 *
3946 * This function interfaces with a channel tech's queryoption callback to
3947 * retrieve the name of the device being communicated with. If the channel does not
3948 * implement this specific option, then the traditional method of using the channel
3949 * name is used instead.
3950 *
3951 * \param chan The channel to retrieve the information from
3952 * \param[out] device_name The buffer to place the device's name into
3953 * \param name_buffer_length The allocated space for the device_name
3954 * \return 0 always
3955 */
3956int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length);
3957
3958/*!
3959 * \since 1.8
3960 * \brief Find the appropriate CC agent type to use given a channel
3961 *
3962 * \details
3963 * During call completion, we will need to create a call completion agent structure. To
3964 * figure out the type of agent to construct, we need to ask the channel driver for the
3965 * appropriate type.
3966 *
3967 * Prior to adding this function, the call completion core attempted to figure this
3968 * out for itself by stripping the technology off the channel's name. However, in the
3969 * case of chan_dahdi, there are multiple agent types registered, and so simply searching
3970 * for an agent type called "DAHDI" is not possible. In a case where multiple agent types
3971 * are defined, the channel driver must have a queryoption callback defined in its
3972 * channel_tech, and the queryoption callback must handle AST_OPTION_CC_AGENT_TYPE
3973 *
3974 * If a channel driver does not have a queryoption callback or if the queryoption callback
3975 * does not handle AST_OPTION_CC_AGENT_TYPE, then the old behavior of using the technology
3976 * portion of the channel name is used instead. This is perfectly suitable for channel drivers
3977 * whose channel technologies are a one-to-one match with the agent types defined within.
3978 *
3979 * Note that this function is only called when the agent policy on a given channel is set
3980 * to "native." Generic agents' type can be determined automatically by the core.
3981 *
3982 * \param chan The channel for which we wish to retrieve the agent type
3983 * \param[out] agent_type The type of agent the channel driver wants us to use
3984 * \param size The size of the buffer to write to
3985 */
3986int ast_channel_get_cc_agent_type(struct ast_channel *chan, char *agent_type, size_t size);
3987#if defined(__cplusplus) || defined(c_plusplus)
3988}
3989#endif
3990
3991/*!
3992 * \brief Remove a channel from the global channels container
3993 *
3994 * \param chan channel to remove
3995 *
3996 * In a case where it is desired that a channel not be available in any lookups
3997 * in the global channels conatiner, use this function.
3998 */
3999void ast_channel_unlink(struct ast_channel *chan);
4000
4001/*!
4002 * \brief Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash
4003 * on the given channel
4004 *
4005 * \param chan channel on which to set the cause information
4006 * \param cause_code ast_control_pvt_cause_code structure containing cause information
4007 * \param datalen total length of the structure since it may vary
4008 */
4009void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen);
4010
4011/*!
4012 * \since 12
4013 * \brief Convert a string to a detail record AMA flag
4014 *
4015 * \param flag string form of flag
4016 *
4017 * \retval the enum (integer) form of the flag
4018 */
4019enum ama_flags ast_channel_string2amaflag(const char *flag);
4020
4021/*!
4022 * \since 12
4023 * \brief Convert the enum representation of an AMA flag to a string representation
4024 *
4025 * \param flags integer flag
4026 *
4027 * \retval A string representation of the flag
4028 */
4029const char *ast_channel_amaflags2string(enum ama_flags flags);
4030
4035
4036/* ACCESSOR FUNCTIONS */
4037
4038#define DECLARE_STRINGFIELD_SETTERS_FOR(field) \
4039 void ast_channel_##field##_set(struct ast_channel *chan, const char *field); \
4040 void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) __attribute__((format(printf, 2, 0))); \
4041 void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) __attribute__((format(printf, 2, 3)))
4042
4043/*!
4044 * The following string fields result in channel snapshot creation and
4045 * should have the channel locked when called:
4046 *
4047 * \li language
4048 * \li accountcode
4049 * \li peeraccount
4050 * \li linkedid
4051 */
4065
4066const char *ast_channel_name(const struct ast_channel *chan);
4067const char *ast_channel_language(const struct ast_channel *chan);
4068const char *ast_channel_musicclass(const struct ast_channel *chan);
4069const char *ast_channel_latest_musicclass(const struct ast_channel *chan);
4070const char *ast_channel_accountcode(const struct ast_channel *chan);
4071const char *ast_channel_peeraccount(const struct ast_channel *chan);
4072const char *ast_channel_userfield(const struct ast_channel *chan);
4073const char *ast_channel_call_forward(const struct ast_channel *chan);
4074const char *ast_channel_uniqueid(const struct ast_channel *chan);
4075const char *ast_channel_linkedid(const struct ast_channel *chan);
4076const char *ast_channel_parkinglot(const struct ast_channel *chan);
4077const char *ast_channel_hangupsource(const struct ast_channel *chan);
4078const char *ast_channel_dialcontext(const struct ast_channel *chan);
4079
4080const char *ast_channel_appl(const struct ast_channel *chan);
4081void ast_channel_appl_set(struct ast_channel *chan, const char *value);
4082const char *ast_channel_blockproc(const struct ast_channel *chan);
4083void ast_channel_blockproc_set(struct ast_channel *chan, const char *value);
4084const char *ast_channel_data(const struct ast_channel *chan);
4085void ast_channel_data_set(struct ast_channel *chan, const char *value);
4086
4087const char *ast_channel_lastcontext(const struct ast_channel *chan);
4088const char *ast_channel_context(const struct ast_channel *chan);
4089void ast_channel_context_set(struct ast_channel *chan, const char *value);
4090const char *ast_channel_lastexten(const struct ast_channel *chan);
4091const char *ast_channel_exten(const struct ast_channel *chan);
4092void ast_channel_exten_set(struct ast_channel *chan, const char *value);
4093
4094char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan);
4096char ast_channel_sending_dtmf_digit(const struct ast_channel *chan);
4098struct timeval ast_channel_sending_dtmf_tv(const struct ast_channel *chan);
4099void ast_channel_sending_dtmf_tv_set(struct ast_channel *chan, struct timeval value);
4100enum ama_flags ast_channel_amaflags(const struct ast_channel *chan);
4101
4102/*!
4103 * \pre chan is locked
4104 */
4105void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value);
4106int ast_channel_epfd(const struct ast_channel *chan);
4108int ast_channel_fdno(const struct ast_channel *chan);
4109void ast_channel_fdno_set(struct ast_channel *chan, int value);
4110int ast_channel_hangupcause(const struct ast_channel *chan);
4111void ast_channel_hangupcause_set(struct ast_channel *chan, int value);
4112int ast_channel_priority(const struct ast_channel *chan);
4113void ast_channel_priority_set(struct ast_channel *chan, int value);
4114int ast_channel_rings(const struct ast_channel *chan);
4115void ast_channel_rings_set(struct ast_channel *chan, int value);
4116int ast_channel_streamid(const struct ast_channel *chan);
4117void ast_channel_streamid_set(struct ast_channel *chan, int value);
4118int ast_channel_timingfd(const struct ast_channel *chan);
4119void ast_channel_timingfd_set(struct ast_channel *chan, int value);
4120int ast_channel_visible_indication(const struct ast_channel *chan);
4122int ast_channel_hold_state(const struct ast_channel *chan);
4123void ast_channel_hold_state_set(struct ast_channel *chan, int value);
4124int ast_channel_vstreamid(const struct ast_channel *chan);
4125void ast_channel_vstreamid_set(struct ast_channel *chan, int value);
4126unsigned short ast_channel_transfercapability(const struct ast_channel *chan);
4127void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value);
4128unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan);
4129void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value);
4130unsigned int ast_channel_fin(const struct ast_channel *chan);
4131void ast_channel_fin_set(struct ast_channel *chan, unsigned int value);
4132unsigned int ast_channel_fout(const struct ast_channel *chan);
4133void ast_channel_fout_set(struct ast_channel *chan, unsigned int value);
4134unsigned long ast_channel_insmpl(const struct ast_channel *chan);
4135void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value);
4136unsigned long ast_channel_outsmpl(const struct ast_channel *chan);
4137void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value);
4138void *ast_channel_generatordata(const struct ast_channel *chan);
4139void ast_channel_generatordata_set(struct ast_channel *chan, void *value);
4140void *ast_channel_music_state(const struct ast_channel *chan);
4141void ast_channel_music_state_set(struct ast_channel *chan, void *value);
4142void *ast_channel_tech_pvt(const struct ast_channel *chan);
4143void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value);
4144void *ast_channel_timingdata(const struct ast_channel *chan);
4145void ast_channel_timingdata_set(struct ast_channel *chan, void *value);
4146struct ast_audiohook_list *ast_channel_audiohooks(const struct ast_channel *chan);
4148struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan);
4149void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value);
4150struct ast_channel *ast_channel__bridge(const struct ast_channel *chan);
4152struct ast_channel *ast_channel_masq(const struct ast_channel *chan);
4153void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value);
4154struct ast_channel *ast_channel_masqr(const struct ast_channel *chan);
4155void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value);
4156struct ast_filestream *ast_channel_stream(const struct ast_channel *chan);
4157void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value);
4158struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan);
4159void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value);
4160struct ast_format_cap *ast_channel_nativeformats(const struct ast_channel *chan);
4162struct ast_framehook_list *ast_channel_framehooks(const struct ast_channel *chan);
4164struct ast_generator *ast_channel_generator(const struct ast_channel *chan);
4165void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value);
4166struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan);
4167void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value);
4168struct ast_sched_context *ast_channel_sched(const struct ast_channel *chan);
4169void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value);
4170struct ast_timer *ast_channel_timer(const struct ast_channel *chan);
4171void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value);
4172struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan);
4173void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value);
4174struct ast_trans_pvt *ast_channel_readtrans(const struct ast_channel *chan);
4175void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value);
4176struct ast_trans_pvt *ast_channel_writetrans(const struct ast_channel *chan);
4177void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value);
4178const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan);
4179void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value);
4180enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan);
4182enum ast_channel_state ast_channel_state(const struct ast_channel *chan);
4183ast_callid ast_channel_callid(const struct ast_channel *chan);
4184struct ast_channel_snapshot *ast_channel_snapshot(const struct ast_channel *chan);
4185void ast_channel_snapshot_set(struct ast_channel *chan, struct ast_channel_snapshot *snapshot);
4187
4188/*!
4189 * \pre chan is locked
4190 */
4192
4193/* XXX Internal use only, make sure to move later */
4194void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state);
4198void ast_channel_callid_cleanup(struct ast_channel *chan);
4200
4201/* Format getters */
4205struct ast_format *ast_channel_readformat(struct ast_channel *chan);
4206struct ast_format *ast_channel_writeformat(struct ast_channel *chan);
4207
4208/* Format setters - all of these functions will increment the reference count of the format passed in */
4209void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format);
4210void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format);
4211void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format);
4212void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format);
4213void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format);
4214
4215/* Other struct getters */
4216struct ast_frame *ast_channel_dtmff(struct ast_channel *chan);
4217struct ast_jb *ast_channel_jb(struct ast_channel *chan);
4218struct ast_party_caller *ast_channel_caller(struct ast_channel *chan);
4222struct ast_party_dialed *ast_channel_dialed(struct ast_channel *chan);
4227struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan);
4228struct timeval *ast_channel_whentohangup(struct ast_channel *chan);
4229struct varshead *ast_channel_varshead(struct ast_channel *chan);
4230
4231void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value);
4232void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value);
4233void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value);
4235void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value);
4237void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value);
4238
4239/*!
4240 * \pre chan is locked
4241 */
4242void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value);
4243void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value);
4244struct timeval ast_channel_creationtime(struct ast_channel *chan);
4245void ast_channel_creationtime_set(struct ast_channel *chan, struct timeval *value);
4246struct timeval ast_channel_answertime(struct ast_channel *chan);
4247void ast_channel_answertime_set(struct ast_channel *chan, struct timeval *value);
4248
4249/* List getters */
4253struct ast_readq_list *ast_channel_readq(struct ast_channel *chan);
4254
4255/* Typedef accessors */
4257/*!
4258 * \pre chan is locked
4259 */
4262/*!
4263 * \pre chan is locked
4264 */
4266struct ast_namedgroups *ast_channel_named_callgroups(const struct ast_channel *chan);
4267void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value);
4268struct ast_namedgroups *ast_channel_named_pickupgroups(const struct ast_channel *chan);
4269void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value);
4270
4271/* Alertpipe accessors--the "internal" functions for channel.c use only */
4272int ast_channel_alert_write(struct ast_channel *chan);
4273int ast_channel_alert_writable(struct ast_channel *chan);
4281/*! \brief Swap the interal alertpipe between two channels
4282 * \note Handle all of the necessary locking before calling this
4283 */
4284void ast_channel_internal_alertpipe_swap(struct ast_channel *chan1, struct ast_channel *chan2);
4285
4286/* file descriptor array accessors */
4287void ast_channel_internal_fd_clear(struct ast_channel *chan, int which);
4289void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value);
4290int ast_channel_fd(const struct ast_channel *chan, int which);
4291int ast_channel_fd_isset(const struct ast_channel *chan, int which);
4292
4293/*!
4294 * \since 15
4295 * \brief Retrieve the number of file decriptor positions present on the channel
4296 *
4297 * \param chan The channel to get the count of
4298 *
4299 * \pre chan is locked
4300 *
4301 * \return The number of file descriptor positions
4302 */
4303int ast_channel_fd_count(const struct ast_channel *chan);
4304
4305/*!
4306 * \since 15
4307 * \brief Add a file descriptor to the channel without a fixed position
4308 *
4309 * \param chan The channel to add the file descriptor to
4310 * \param value The file descriptor
4311 *
4312 * \pre chan is locked
4313 *
4314 * \return The position of the file descriptor
4315 */
4316int ast_channel_fd_add(struct ast_channel *chan, int value);
4317
4318pthread_t ast_channel_blocker(const struct ast_channel *chan);
4319void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value);
4320
4321int ast_channel_blocker_tid(const struct ast_channel *chan);
4322void ast_channel_blocker_tid_set(struct ast_channel *chan, int tid);
4323
4326
4327struct ast_bridge *ast_channel_internal_bridge(const struct ast_channel *chan);
4328/*!
4329 * \pre chan is locked
4330 */
4332
4335
4338
4339/*!
4340 * \since 11
4341 * \brief Retrieve a comma-separated list of channels for which dialed cause information is available
4342 *
4343 * \details
4344 * This function makes use of datastore operations on the channel, so
4345 * it is important to lock the channel before calling this function.
4346 *
4347 * \param chan The channel from which to retrieve information
4348 * \retval NULL on allocation failure
4349 * \retval Pointer to an ast_str object containing the desired information which must be freed
4350 */
4351struct ast_str *ast_channel_dialed_causes_channels(const struct ast_channel *chan);
4352
4353/*!
4354 * \since 11
4355 * \brief Retrieve a ref-counted cause code information structure
4356 *
4357 * \details
4358 * This function makes use of datastore operations on the channel, so
4359 * it is important to lock the channel before calling this function.
4360 * This function increases the ref count of the returned object, so the
4361 * calling function must decrease the reference count when it is finished
4362 * with the object.
4363 *
4364 * \param chan The channel from which to retrieve information
4365 * \param chan_name The name of the channel about which to retrieve information
4366 * \retval NULL on search failure
4367 * \retval Pointer to a ref-counted ast_control_pvt_cause_code object containing the desired information
4368 */
4370
4371/*!
4372 * \since 11
4373 * \brief Add cause code information to the channel
4374 *
4375 * \details
4376 * This function makes use of datastore operations on the channel, so
4377 * it is important to lock the channel before calling this function.
4378 * The passed in data is copied and so is still owned by the caller.
4379 *
4380 * \param chan The channel on which to add information
4381 * \param cause_code The cause information to be added to the channel
4382 * \param datalen The total length of the structure since its length is variable
4383 * \retval 0 on success
4384 * \retval -1 on error
4385 */
4386int ast_channel_dialed_causes_add(const struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen);
4387
4388/*!
4389 * \since 11
4390 * \brief Clear all cause information from the channel
4391 *
4392 * \details
4393 * This function makes use of datastore operations on the channel, so
4394 * it is important to lock the channel before calling this function.
4395 *
4396 * \param chan The channel from which to clear information
4397 */
4398void ast_channel_dialed_causes_clear(const struct ast_channel *chan);
4399
4400struct ast_flags *ast_channel_flags(struct ast_channel *chan);
4401
4402/*!
4403 * \since 13.17.0
4404 * \brief Set a flag on a channel
4405 *
4406 * \param chan The channel to set the flag on
4407 * \param flag The flag to set
4408 *
4409 * \note This will lock the channel internally. If the channel is already
4410 * locked it is still safe to call.
4411 */
4412
4413void ast_channel_set_flag(struct ast_channel *chan, unsigned int flag);
4414
4415/*!
4416 * \since 13.17.0
4417 * \brief Clear a flag on a channel
4418 *
4419 * \param chan The channel to clear the flag from
4420 * \param flag The flag to clear
4421 *
4422 * \note This will lock the channel internally. If the channel is already
4423 * locked it is still safe to call.
4424 */
4425void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag);
4426
4427/*!
4428 * \since 12.4.0
4429 * \brief Return whether or not any manager variables have been set
4430 *
4431 * \retval 0 if no manager variables are expected
4432 * \retval 1 if manager variables are expected
4433 */
4435
4436/*!
4437 * \since 12
4438 * \brief Sets the variables to be stored in the \a manager_vars field of all
4439 * snapshots.
4440 * \param varc Number of variable names.
4441 * \param vars Array of variable names.
4442 */
4443void ast_channel_set_manager_vars(size_t varc, char **vars);
4444
4445/*!
4446 * \since 12
4447 * \brief Gets the variables for a given channel, as specified by ast_channel_set_manager_vars().
4448 *
4449 * The returned variable list is an AO2 object, so ao2_cleanup() to free it.
4450 *
4451 * \param chan Channel to get variables for.
4452 * \return List of channel variables.
4453 * \retval NULL on error
4454 */
4456
4457/*!
4458 * \since 14.2.0
4459 * \brief Return whether or not any ARI variables have been set
4460 *
4461 * \retval 0 if no ARI variables are expected
4462 * \retval 1 if ARI variables are expected
4463 */
4464int ast_channel_has_ari_vars(void);
4465
4466/*!
4467 * \since 14.2.0
4468 * \brief Sets the variables to be stored in the \a ari_vars field of all
4469 * snapshots.
4470 * \param varc Number of variable names.
4471 * \param vars Array of variable names.
4472 */
4473void ast_channel_set_ari_vars(size_t varc, char **vars);
4474
4475/*!
4476 * \since 14.2.0
4477 * \brief Gets the variables for a given channel, as specified by ast_channel_set_ari_vars().
4478 *
4479 * The returned variable list is an AO2 object, so ao2_cleanup() to free it.
4480 *
4481 * \param chan Channel to get variables for.
4482 * \return List of channel variables.
4483 * \retval NULL on error
4484 */
4485struct varshead *ast_channel_get_ari_vars(struct ast_channel *chan);
4486
4487/*!
4488 * \since 12
4489 * \brief Gets the variables for a given channel, as set using pbx_builtin_setvar_helper().
4490 *
4491 * The returned variable list is an AO2 object, so ao2_cleanup() to free it.
4492 *
4493 * \param chan Channel to get variables for
4494 * \return List of channel variables.
4495 * \retval NULL on error
4496 */
4497struct varshead *ast_channel_get_vars(struct ast_channel *chan);
4498
4499/*!
4500 * \since 12
4501 * \brief A topic which publishes the events for a particular channel.
4502 *
4503 * If the given \a chan is \c NULL, ast_channel_topic_all() is returned.
4504 *
4505 * \param chan Channel, or \c NULL.
4506 *
4507 * \retval Topic for channel's events.
4508 * \retval ast_channel_topic_all() if \a chan is \c NULL.
4509 */
4510struct stasis_topic *ast_channel_topic(struct ast_channel *chan);
4511
4512/*!
4513 * \brief Get the bridge associated with a channel
4514 * \since 12.0.0
4515 *
4516 * \param chan The channel whose bridge we want
4517 *
4518 * \details
4519 * The bridge returned has its reference count incremented. Use
4520 * ao2_cleanup() or ao2_ref() in order to decrement the
4521 * reference count when you are finished with the bridge.
4522 *
4523 * \note This function expects the channel to be locked prior to
4524 * being called and will not grab the channel lock.
4525 *
4526 * \retval NULL No bridge present on the channel
4527 * \retval non-NULL The bridge the channel is in
4528 */
4529struct ast_bridge *ast_channel_get_bridge(const struct ast_channel *chan);
4530
4531/*!
4532 * \brief Determine if a channel is in a bridge
4533 * \since 12.0.0
4534 *
4535 * \param chan The channel to test
4536 *
4537 * \note This function expects the channel to be locked prior to
4538 * being called and will not grab the channel lock.
4539 *
4540 * \retval 0 The channel is not bridged
4541 * \retval non-zero The channel is bridged
4542 */
4543int ast_channel_is_bridged(const struct ast_channel *chan);
4544
4545/*!
4546 * \brief Determine if a channel is leaving a bridge, but \em not hung up
4547 * \since 12.4.0
4548 *
4549 * \param chan The channel to test
4550 *
4551 * \note If a channel is hung up, it is implicitly leaving any bridge it
4552 * may be in. This function is used to test if a channel is leaving a bridge
4553 * but may survive the experience, if it has a place to go to (dialplan or
4554 * otherwise)
4555 *
4556 * \retval 0 The channel is not leaving the bridge or is hung up
4557 * \retval non-zero The channel is leaving the bridge
4558 */
4560
4561/*!
4562 * \brief Get the channel's bridge peer only if the bridge is two-party.
4563 * \since 12.0.0
4564 *
4565 * \param chan Channel desiring the bridge peer channel.
4566 *
4567 * \note The returned peer channel is the current peer in the
4568 * bridge when called.
4569 *
4570 * \note Absolutely _NO_ channel locks should be held when calling this function.
4571 *
4572 * \retval NULL Channel not in a bridge or the bridge is not two-party.
4573 * \retval non-NULL Reffed peer channel at time of calling.
4574 */
4575struct ast_channel *ast_channel_bridge_peer(struct ast_channel *chan);
4576
4577/*!
4578 * \brief Get a reference to the channel's bridge pointer.
4579 * \since 12.0.0
4580 *
4581 * \param chan The channel whose bridge channel is desired
4582 *
4583 * \note This increases the reference count of the bridge_channel.
4584 * Use ao2_ref() or ao2_cleanup() to decrement the refcount when
4585 * you are finished with it.
4586 *
4587 * \note It is expected that the channel is locked prior to
4588 * placing this call.
4589 *
4590 * \retval NULL The channel has no bridge_channel
4591 * \retval non-NULL A reference to the bridge_channel
4592 */
4594
4595/*!
4596 * \since 12
4597 * \brief Gain control of a channel in the system
4598 *
4599 * The intention of this function is to take a channel that currently
4600 * is running in one thread and gain control of it in the current thread.
4601 * This can be used to redirect a channel to a different place in the dialplan,
4602 * for instance.
4603 *
4604 * \note This function is NOT intended to be used on bridged channels. If you
4605 * need to control a bridged channel, you can set a callback to be called
4606 * once the channel exits the bridge, and run your controlling logic in that
4607 * callback
4608 *
4609 * XXX Put name of callback-setting function in above paragraph once it is written
4610 *
4611 * \note When this function returns successfully, the yankee channel is in a state where
4612 * it cannot be used any further. Always use the returned channel instead.
4613 *
4614 * \note absolutely _NO_ channel locks should be held before calling this function.
4615 *
4616 * \note The dialplan location on the returned channel is where the channel
4617 * should be started in the dialplan if it is returned to it.
4618 *
4619 * \param yankee The channel to gain control of
4620 * \retval NULL Could not gain control of the channel
4621 * \retval non-NULL The channel
4622 */
4623struct ast_channel *ast_channel_yank(struct ast_channel *yankee);
4624
4625/*!
4626 * \since 12
4627 * \brief Move a channel from its current location to a new location
4628 *
4629 * The intention of this function is to have the destination channel
4630 * take on the identity of the source channel.
4631 *
4632 * \note This function is NOT intended to be used on bridged channels. If you
4633 * wish to move an unbridged channel into the place of a bridged channel, then
4634 * use ast_bridge_join() or ast_bridge_impart(). If you wish to move a bridged
4635 * channel into the place of another bridged channel, then use ast_bridge_move().
4636 *
4637 * \note When this function returns succesfully, the source channel is in a
4638 * state where its continued use is unreliable.
4639 *
4640 * \note absolutely _NO_ channel locks should be held before calling this function.
4641 *
4642 * \param dest The place to move the source channel
4643 * \param source The channel to move
4644 * \retval 0 Success
4645 * \retval non-zero Failure
4646 */
4647int ast_channel_move(struct ast_channel *dest, struct ast_channel *source);
4648
4649/*!
4650 * \since 12
4651 * \brief Forward channel stasis messages to the given endpoint
4652 *
4653 * \param chan The channel to forward from
4654 * \param endpoint The endpoint to forward to
4655 *
4656 * \retval 0 Success
4657 * \retval non-zero Failure
4658 */
4659int ast_channel_forward_endpoint(struct ast_channel *chan, struct ast_endpoint *endpoint);
4660
4661/*!
4662 * \brief Return the oldest linkedid between two channels.
4663 *
4664 * A channel linkedid is derived from the channel uniqueid which is formed like this:
4665 * [systemname-]ctime.seq
4666 *
4667 * The systemname, and the dash are optional, followed by the epoch time followed by an
4668 * integer sequence. Note that this is not a decimal number, since 1.2 is less than 1.11
4669 * in uniqueid land.
4670 *
4671 * To compare two uniqueids, we parse out the integer values of the time and the sequence
4672 * numbers and compare them, with time trumping sequence.
4673 *
4674 * \param a The linkedid value of the first channel to compare
4675 * \param b The linkedid value of the second channel to compare
4676 *
4677 * \retval NULL on failure
4678 * \retval The oldest linkedid value
4679 * \since 12.0.0
4680*/
4681const char *ast_channel_oldest_linkedid(const char *a, const char *b);
4682
4683/*!
4684 * \brief Check if the channel has active audiohooks, active framehooks, or a monitor.
4685 * \since 12.0.0
4686 *
4687 * \param chan The channel to check.
4688 *
4689 * \retval non-zero if channel has active audiohooks, framehooks, or monitor.
4690 */
4692
4693/*!
4694 * \brief Check if the channel has any active hooks that require audio.
4695 * \since 12.3.0
4696 *
4697 * \param chan The channel to check.
4698 *
4699 * \retval non-zero if channel has active audiohooks, audio framehooks, or monitor.
4700 */
4702
4703/*!
4704 * \brief Removes the trailing identifiers from a channel name string
4705 * \since 12.0.0
4706 *
4707 * \param channel_name string that you wish to turn into a dial string.
4708 * This string will be edited in place.
4709 */
4710void ast_channel_name_to_dial_string(char *channel_name);
4711
4712#define AST_MUTE_DIRECTION_READ (1 << 0)
4713#define AST_MUTE_DIRECTION_WRITE (1 << 1)
4714
4715/*!
4716 * \brief Suppress passing of a frame type on a channel
4717 *
4718 * \note The channel should be locked before calling this function.
4719 *
4720 * \param chan The channel to suppress
4721 * \param direction The direction in which to suppress
4722 * \param frametype The type of frame (AST_FRAME_VOICE, etc) to suppress
4723 *
4724 * \retval 0 Success
4725 * \retval -1 Failure
4726 */
4727int ast_channel_suppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype);
4728
4729/*!
4730 * \brief Stop suppressing of a frame type on a channel
4731 *
4732 * \note The channel should be locked before calling this function.
4733 *
4734 * \param chan The channel to stop suppressing
4735 * \param direction The direction in which to stop suppressing
4736 * \param frametype The type of frame (AST_FRAME_VOICE, etc) to stop suppressing
4737 *
4738 * \retval 0 Success
4739 * \retval -1 Failure
4740 */
4741int ast_channel_unsuppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype);
4742
4743/*!
4744 * \brief Simulate a DTMF end on a broken bridge channel.
4745 *
4746 * \param chan Channel sending DTMF that has not ended.
4747 * \param digit DTMF digit to stop.
4748 * \param start DTMF digit start time.
4749 * \param why Reason bridge broken.
4750 */
4751void ast_channel_end_dtmf(struct ast_channel *chan, char digit, struct timeval start, const char *why);
4752
4753struct ast_bridge_features;
4754
4755/*!
4756 * \brief Gets the channel-attached features a channel has access to upon being bridged.
4757 *
4758 * \note The channel must be locked when calling this function.
4759 *
4760 * \param chan Which channel to get features for
4761 *
4762 * \retval non-NULL The features currently set for this channel
4763 * \retval NULL if the features have not been set
4764 */
4766
4767/*!
4768 * \brief Appends to the channel-attached features a channel has access to upon being bridged.
4769 *
4770 * \note The channel must be locked when calling this function.
4771 *
4772 * \param chan Which channel to set features for
4773 * \param features The feature set to append to the channel's features
4774 *
4775 * \retval 0 on success
4776 * \retval -1 on failure
4777 */
4778int ast_channel_feature_hooks_append(struct ast_channel *chan, struct ast_bridge_features *features);
4779
4780/*!
4781 * \brief Sets the channel-attached features a channel has access to upon being bridged.
4782 *
4783 * \note The channel must be locked when calling this function.
4784 *
4785 * \param chan Which channel to set features for
4786 * \param features The feature set with which to replace the channel's features
4787 *
4788 * \retval 0 on success
4789 * \retval -1 on failure
4790 */
4791int ast_channel_feature_hooks_replace(struct ast_channel *chan, struct ast_bridge_features *features);
4792
4794 /* Unable to determine what error occurred. */
4796 /* Channel with this ID already exists */
4798};
4799
4800/*!
4801 * \brief Get error code for latest channel operation.
4802 */
4804
4805/*!
4806 * \brief Am I currently running an intercept dialplan routine.
4807 * \since 13.14.0
4808 *
4809 * \details
4810 * A dialplan intercept routine is equivalent to an interrupt
4811 * routine. As such, the routine must be done quickly and you
4812 * do not have access to the media stream. These restrictions
4813 * are necessary because the media stream is the responsibility
4814 * of some other code and interfering with or delaying that
4815 * processing is bad.
4816 *
4817 * \retval 0 Not in an intercept routine.
4818 * \retval 1 In an intercept routine.
4819 */
4821
4822/*!
4823 * \brief Retrieve the topology of streams on a channel
4824 *
4825 * \param chan The channel to get the stream topology of
4826 *
4827 * \pre chan is locked
4828 *
4829 * \retval non-NULL success
4830 * \retval NULL failure
4831 */
4833 const struct ast_channel *chan);
4834
4835/*!
4836 * \brief Set the topology of streams on a channel
4837 *
4838 * \param chan The channel to set the stream topology on
4839 * \param topology The stream topology to set
4840 *
4841 * \pre chan is locked
4842 *
4843 * \note If topology is NULL a new empty topology will be created
4844 * and returned.
4845 *
4846 * \retval non-NULL Success
4847 * \retval NULL failure
4848 */
4850 struct ast_channel *chan, struct ast_stream_topology *topology);
4851
4852/*!
4853 * \brief Retrieve the default stream of a specific media type on a channel
4854 *
4855 * \param chan The channel to get the stream from
4856 * \param type The media type of the default stream
4857 *
4858 * \pre chan is locked
4859 *
4860 * \retval non-NULL success
4861 * \retval NULL failure
4862 */
4864
4865/*!
4866 * \brief Determine if a channel is multi-stream capable
4867 *
4868 * \param chan The channel to test
4869 *
4870 * \pre chan is locked
4871 *
4872 * \retval true if the channel is multi-stream capable.
4873 */
4874int ast_channel_is_multistream(struct ast_channel *chan);
4875
4876/*!
4877 * \brief Request that the stream topology of a channel change
4878 *
4879 * \param chan The channel to change
4880 * \param topology The new stream topology
4881 * \param change_source The source that initiated the change
4882 *
4883 * \note Absolutely _NO_ channel locks should be held before calling this function.
4884 *
4885 * \retval 0 request has been accepted to be attempted
4886 * \retval -1 request could not be attempted
4887 *
4888 * \note This function initiates an asynchronous request to change the stream topology. It is not
4889 * guaranteed that the topology will change and until an AST_CONTROL_STREAM_TOPOLOGY_CHANGED
4890 * frame is received from the channel the current handler of the channel must tolerate the
4891 * stream topology as it currently exists.
4892 *
4893 * \note This interface is provided for applications and resources to request that the topology change.
4894 * It is not for use by the channel driver itself.
4895 */
4897 struct ast_stream_topology *topology, void *change_source);
4898
4899/*!
4900 * \brief Provide notice to a channel that the stream topology has changed
4901 *
4902 * \param chan The channel to provide notice to
4903 * \param topology The new stream topology
4904 *
4905 * \pre chan is locked Absolutely _NO_ other channels can be locked.
4906 *
4907 * \retval 0 success
4908 * \retval -1 failure
4909 *
4910 * \note This interface is provided for applications and resources to accept a topology change.
4911 * It is not for use by the channel driver itself.
4912 */
4913int ast_channel_stream_topology_changed(struct ast_channel *chan, struct ast_stream_topology *topology);
4914
4915/*!
4916 * \brief Provide notice from a channel that the topology has changed on it as a result
4917 * of the remote party renegotiating.
4918 *
4919 * \param chan The channel to provide notice from
4920 *
4921 * \retval 0 success
4922 * \retval -1 failure
4923 *
4924 * \note This interface is provided for channels to provide notice that a topology change
4925 * has occurred as a result of a remote party renegotiating the stream topology.
4926 */
4928
4929/*!
4930 * \brief Retrieve the source that initiated the last stream topology change
4931 *
4932 * \param chan The channel
4933 *
4934 * \retval The channel's stream topology change source
4935 */
4937
4938/*!
4939 * \brief Checks if a channel's technology implements a particular callback function
4940 * \since 18.0.0
4941 *
4942 * \param chan The channel
4943 * \param function The function to look for
4944 *
4945 * \retval 1 if the channel has a technology set and it implements the function
4946 * \retval 0 if the channel doesn't have a technology set or it doesn't implement the function
4947 */
4948#define ast_channel_has_tech_function(chan, function) \
4949 (ast_channel_tech(chan) ? ast_channel_tech(chan)->function != NULL : 0)
4950
4951
4952#endif /* _ASTERISK_CHANNEL_H */
Common implementation-independent jitterbuffer stuff.
ast_alert_status_t
Definition: alertpipe.h:24
static struct aco_type agent_type
char digit
static struct ast_generator gen
const char * str
Definition: app_jack.c:147
char * text
Definition: app_queue.c:1639
ast_cond_t cond
Definition: app_sla.c:330
static char dialcontext[AST_MAX_CONTEXT]
int() ao2_callback_data_fn(void *obj, void *arg, void *data, int flags)
Type of a generic callback function.
Definition: astobj2.h:1244
enum cc_state state
Definition: ccss.c:393
Call Completion Supplementary Services API.
void(* ast_cc_callback_fn)(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, void *private_data)
Callback made from ast_cc_callback for certain channel types.
Definition: ccss.h:1562
Call Detail Record API.
static char language[MAX_LANGUAGE]
Definition: chan_iax2.c:327
static char accountcode[AST_MAX_ACCOUNT_CODE]
Definition: chan_iax2.c:476
static const char type[]
Definition: chan_ooh323.c:109
static void dummy(char *unused,...)
Definition: chan_unistim.c:220
void ast_party_subaddress_copy(struct ast_party_subaddress *dest, const struct ast_party_subaddress *src)
Copy the source party subaddress information to the destination party subaddress.
Definition: channel.c:1705
void ast_channel_internal_alertpipe_swap(struct ast_channel *chan1, struct ast_channel *chan2)
Swap the interal alertpipe between two channels.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
struct varshead * ast_channel_get_manager_vars(struct ast_channel *chan)
Gets the variables for a given channel, as specified by ast_channel_set_manager_vars().
Definition: channel.c:7982
int ast_senddigit_mf_begin(struct ast_channel *chan, char digit)
Send an MF digit to a channel.
Definition: channel.c:4834
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
Definition: channel.c:3175
int ast_str2cause(const char *name) attribute_pure
Convert the string form of a cause code to a number.
Definition: channel.c:625
const char * ast_channel_linkedid(const struct ast_channel *chan)
const char * ast_channel_name(const struct ast_channel *chan)
static int ast_fdisset(struct pollfd *pfds, int fd, int maximum, int *start)
Helper function for migrating select to poll.
Definition: channel.h:2827
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Definition: autoservice.c:266
char * ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups)
Print named call groups and named pickup groups.
Definition: channel.c:8055
struct ast_bridge * ast_channel_internal_bridge(const struct ast_channel *chan)
void * ast_channel_get_stream_topology_change_source(struct ast_channel *chan)
Retrieve the source that initiated the last stream topology change.
struct timeval ast_channel_answertime(struct ast_channel *chan)
void ast_softhangup_all(void)
Soft hangup all active channels.
Definition: channel.c:493
int ast_channel_request_stream_topology_change(struct ast_channel *chan, struct ast_stream_topology *topology, void *change_source)
Request that the stream topology of a channel change.
Definition: channel.c:10965
void ast_channel_end_dtmf(struct ast_channel *chan, char digit, struct timeval start, const char *why)
Simulate a DTMF end on a broken bridge channel.
Definition: channel.c:10868
void ast_party_redirecting_reason_copy(struct ast_party_redirecting_reason *dest, const struct ast_party_redirecting_reason *src)
Copy the source redirecting reason information to the destination redirecting reason.
Definition: channel.c:2085
void ast_channel_rings_set(struct ast_channel *chan, int value)
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_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
struct ast_channel * ast_channel_get_by_exten(const char *exten, const char *context)
Find a channel by extension and context.
Definition: channel.c:1459
int(* ast_timing_func_t)(const void *data)
Definition: channel.h:899
struct ast_channel * ast_channel_masq(const struct ast_channel *chan)
void ast_party_name_init(struct ast_party_name *init)
Initialize the given name structure.
Definition: channel.c:1591
char * ast_recvtext(struct ast_channel *chan, int timeout)
Receives a text string from a channel Read a string of text from a channel.
Definition: channel.c:4716
enum ast_channel_error ast_channel_errno(void)
Get error code for latest channel operation.
Definition: channel.c:10960
int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
Definition: channel.c:2951
struct ast_channel * ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)
Call a function with every active channel.
Definition: channel.c:1278
int ast_channel_blocker_tid(const struct ast_channel *chan)
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value)
void ast_party_dialed_set_init(struct ast_party_dialed *init, const struct ast_party_dialed *guide)
Initialize the given dialed structure using the given guide for a set update operation.
Definition: channel.c:1950
void ast_channel_internal_bridged_channel_set(struct ast_channel *chan, struct ast_channel *value)
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length)
Get a device name given its channel structure.
Definition: channel.c:10495
const char * ast_channel_blockproc(const struct ast_channel *chan)
void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value)
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.
char * ast_transfercapability2str(int transfercapability) attribute_const
Gives the string form of a given transfer capability.
Definition: channel.c:672
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.
@ AST_CHAN_TP_INTERNAL
Channels with this particular technology are an implementation detail of Asterisk and should generall...
Definition: channel.h:971
@ AST_CHAN_TP_SEND_TEXT_DATA
Channels have this property if they implement send_text_data.
Definition: channel.h:975
@ AST_CHAN_TP_WANTSJITTER
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
Definition: channel.h:960
@ AST_CHAN_TP_CREATESJITTER
Channels have this property if they can create jitter; i.e. most VoIP channels.
Definition: channel.h:965
struct ast_channel * ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
Waits for activity on a group of channels.
Definition: channel.c:2988
int ast_auto_answer(struct ast_channel *chan)
Answer a channel, if it's not already answered.
Definition: channel.c:2811
struct ast_namedgroups * ast_channel_named_pickupgroups(const struct ast_channel *chan)
void ast_party_redirecting_init(struct ast_party_redirecting *init)
Initialize the given redirecting structure.
Definition: channel.c:2122
void * ast_channel_tech_pvt(const 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)
static enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *chan)
Retrieves the current T38 state of a channel.
Definition: channel.h:2850
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
Definition: channel.c:6460
const char * ast_channel_data(const struct ast_channel *chan)
void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Set the redirecting id information in the Asterisk channel.
Definition: channel.c:9118
int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders, int audiofd, int ctrlfd)
Definition: channel.c:6562
void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value)
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
Clear a flag on a channel.
Definition: channel.c:11033
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2385
struct ast_party_id ast_channel_redirecting_effective_to(struct ast_channel *chan)
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.
struct ast_channel * ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, struct ast_format_cap *cap, struct outgoing_helper *oh, int *outstate)
Forwards a call to a new channel specified by the original channel's call_forward str....
Definition: channel.c:5897
struct ast_format * ast_channel_rawreadformat(struct ast_channel *chan)
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition: channel.c:2394
struct ast_party_id ast_channel_redirecting_effective_from(struct ast_channel *chan)
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
Definition: channel.c:1757
int ast_set_read_format_path(struct ast_channel *chan, struct ast_format *raw_format, struct ast_format *core_format)
Set specific read path on channel.
Definition: channel.c:5487
void ast_channel_clear_softhangup(struct ast_channel *chan, int flag)
Clear a set of softhangup flags from a channel.
Definition: channel.c:2432
void * ast_channel_music_state(const struct ast_channel *chan)
struct ast_channel_iterator * ast_channel_iterator_by_name_new(const char *name, size_t name_len)
Create a new channel iterator based on name.
Definition: channel.c:1388
struct varshead * ast_channel_get_vars(struct ast_channel *chan)
Gets the variables for a given channel, as set using pbx_builtin_setvar_helper().
Definition: channel.c:7910
void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
int ast_prod(struct ast_channel *chan)
Send empty audio to prime a channel driver.
Definition: channel.c:4999
unsigned int ast_channel_fin(const struct ast_channel *chan)
int __ast_answer(struct ast_channel *chan, unsigned int delay)
Answer a channel, with a selectable delay before returning.
Definition: channel.c:2695
int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame)
Run a connected line interception subroutine and update a channel's connected line information.
Definition: channel.c:10337
const char * ast_channel_latest_musicclass(const struct ast_channel *chan)
void ast_channel_callid_cleanup(struct ast_channel *chan)
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
Definition: channel.c:1644
void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value)
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
Definition: channel.c:2541
void ast_channel_set_caller(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel.
Definition: channel.c:7358
struct varshead * ast_channel_varshead(struct ast_channel *chan)
int ast_channel_rings(const struct ast_channel *chan)
#define DECLARE_STRINGFIELD_SETTERS_FOR(field)
Definition: channel.h:4038
void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value)
int ast_write_video(struct ast_channel *chan, struct ast_frame *frame)
Write video frame to a channel This function writes the given frame to the indicated channel.
Definition: channel.c:5016
int ast_raw_answer_with_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
Answer a channel passing in a stream topology.
Definition: channel.c:2639
void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value)
void ast_channel_sending_dtmf_digit_set(struct ast_channel *chan, char value)
void * ast_channel_timingdata(const struct ast_channel *chan)
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Definition: channel.c:1360
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
Definition: channel.c:1150
int ast_channel_internal_alert_readfd(struct ast_channel *chan)
ast_channel_requestor_relationship
Definition: channel.h:1475
@ AST_CHANNEL_REQUESTOR_BRIDGE_PEER
Definition: channel.h:1477
@ AST_CHANNEL_REQUESTOR_REPLACEMENT
Definition: channel.h:1479
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
Definition: channel.c:10563
int ast_transfer_protocol(struct ast_channel *chan, char *dest, int *protocol)
Transfer a channel (if supported) receieve protocol result.
Definition: channel.c:6497
void ast_party_subaddress_set_init(struct ast_party_subaddress *init, const struct ast_party_subaddress *guide)
Initialize the given party subaddress structure using the given guide for a set update operation.
Definition: channel.c:1719
void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
struct ast_flags * ast_channel_snapshot_segment_flags(struct ast_channel *chan)
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Set the connected line information in the Asterisk channel.
Definition: channel.c:8307
int ast_senddigit_begin(struct ast_channel *chan, char digit)
Send a DTMF digit to a channel.
Definition: channel.c:4873
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
Definition: channel.c:1821
void ast_party_number_copy(struct ast_party_number *dest, const struct ast_party_number *src)
Copy the source party number information to the destination party number.
Definition: channel.c:1652
void ast_channel_internal_swap_endpoint_forward(struct ast_channel *a, struct ast_channel *b)
Swap endpoint_forward between two channels.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
const char * ast_channel_musicclass(const struct ast_channel *chan)
void ast_channel_unlink(struct ast_channel *chan)
Remove a channel from the global channels container.
Definition: channel.c:10528
int ast_channel_sendhtml(struct ast_channel *channel, int subclass, const char *data, int datalen)
Sends HTML on given channel Send HTML or URL on link.
Definition: channel.c:6627
int ast_channel_fdno(const struct ast_channel *chan)
void ast_party_number_set(struct ast_party_number *dest, const struct ast_party_number *src)
Set the source party number information into the destination party number.
Definition: channel.c:1674
void ast_channel_internal_fd_clear_all(struct ast_channel *chan)
void ast_party_subaddress_init(struct ast_party_subaddress *init)
Initialize the given subaddress structure.
Definition: channel.c:1697
int ast_channel_has_hook_requiring_audio(struct ast_channel *chan)
Check if the channel has any active hooks that require audio.
Definition: channel.c:2524
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
Definition: channel.c:2072
void ast_channel_internal_bridge_channel_set(struct ast_channel *chan, struct ast_bridge_channel *value)
void ast_channel_internal_alertpipe_close(struct ast_channel *chan)
int(* ast_acf_write_fn_t)(struct ast_channel *chan, const char *function, char *data, const char *value)
Typedef for a custom write function.
Definition: channel.h:586
int64_t ast_channel_get_up_time_ms(struct ast_channel *chan)
Obtain how long it has been since the channel was answered in ms.
Definition: channel.c:2835
void ast_channel_set_manager_vars(size_t varc, char **vars)
Sets the variables to be stored in the manager_vars field of all snapshots.
Definition: channel.c:7886
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
int ast_sendtext_data(struct ast_channel *chan, struct ast_msg_data *msg)
Sends text to a channel in an ast_msg_data structure wrapper with ast_sendtext as fallback.
Definition: channel.c:4750
void ast_channel_answertime_set(struct ast_channel *chan, struct timeval *value)
int ast_tonepair_start(struct ast_channel *chan, int freq1, int freq2, int duration, int vol)
Definition: channel.c:7581
void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name...
Definition: channel.c:7371
struct ast_channel * ast_waitfor_n(struct ast_channel **chan, int n, int *ms)
Waits for input on a group of channels Wait for input on an array of channels for a given # of millis...
Definition: channel.c:3157
void ast_channel_hold_state_set(struct ast_channel *chan, int value)
int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel.
Definition: channel.c:4973
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
void ast_party_redirecting_set(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src, const struct ast_set_party_redirecting *update)
Set the redirecting information based on another redirecting source.
Definition: channel.c:2166
const struct ast_channel_tech ast_kill_tech
Kill the channel channel driver technology descriptor.
Definition: channel.c:434
const char * ast_channel_lastexten(const struct ast_channel *chan)
int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *peer)
Make the frame formats of two channels compatible.
Definition: channel.c:6719
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
ast_t38_state
Possible T38 states on channels.
Definition: channel.h:878
@ T38_STATE_UNAVAILABLE
Definition: channel.h:879
@ T38_STATE_UNKNOWN
Definition: channel.h:880
@ T38_STATE_REJECTED
Definition: channel.h:882
@ T38_STATE_NEGOTIATED
Definition: channel.h:883
@ T38_STATE_NEGOTIATING
Definition: channel.h:881
void ast_channel_data_set(struct ast_channel *chan, const char *value)
@ AST_FEATURE_AUTOMIXMON
Definition: channel.h:1069
@ AST_FEATURE_REDIRECT
Definition: channel.h:1064
@ AST_FEATURE_ATXFER
Definition: channel.h:1066
@ AST_FEATURE_PARKCALL
Definition: channel.h:1068
@ AST_FEATURE_AUTOMON
Definition: channel.h:1067
@ AST_FEATURE_DISCONNECT
Definition: channel.h:1065
@ AST_FEATURE_PLAY_WARNING
Definition: channel.h:1063
struct timeval ast_channel_sending_dtmf_tv(const struct ast_channel *chan)
struct varshead * ast_channel_get_ari_vars(struct ast_channel *chan)
Gets the variables for a given channel, as specified by ast_channel_set_ari_vars().
Definition: channel.c:7987
void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
void ast_channel_snapshot_set(struct ast_channel *chan, struct ast_channel_snapshot *snapshot)
void ast_party_id_free(struct ast_party_id *doomed)
Destroy the party id contents.
Definition: channel.c:1811
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
Definition: channel.c:570
struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan)
void ast_party_subaddress_set(struct ast_party_subaddress *dest, const struct ast_party_subaddress *src)
Set the source party subaddress information into the destination party subaddress.
Definition: channel.c:1727
int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to the head of a channel's frame queue.
Definition: channel.c:1144
int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception)
Waits for input on an fd.
Definition: channel.c:2980
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
int ast_channel_stream_topology_changed(struct ast_channel *chan, struct ast_stream_topology *topology)
Provide notice to a channel that the stream topology has changed.
Definition: channel.c:10995
struct ast_namedgroups * ast_channel_named_callgroups(const struct ast_channel *chan)
channelreloadreason
Channel reload reasons for manager events at load or reload of configuration.
Definition: channel.h:1166
@ CHANNEL_CLI_RELOAD
Definition: channel.h:1169
@ CHANNEL_MODULE_RELOAD
Definition: channel.h:1168
@ CHANNEL_MODULE_LOAD
Definition: channel.h:1167
@ CHANNEL_ACL_RELOAD
Definition: channel.h:1171
@ CHANNEL_MANAGER_RELOAD
Definition: channel.h:1170
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
void ast_channel_blocker_tid_set(struct ast_channel *chan, int tid)
void ast_channel_vstreamid_set(struct ast_channel *chan, int value)
void ast_party_id_set(struct ast_party_id *dest, const struct ast_party_id *src, const struct ast_set_party_id *update)
Set the source party id information into the destination party id.
Definition: channel.c:1788
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Definition: channel.c:1422
void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars)
adds a list of channel variables to a channel
Definition: channel.c:8114
struct ast_namedgroups * ast_ref_namedgroups(struct ast_namedgroups *groups)
Definition: channel.c:7737
int ast_channel_feature_hooks_replace(struct ast_channel *chan, struct ast_bridge_features *features)
Sets the channel-attached features a channel has access to upon being bridged.
Definition: channel.c:10955
struct ast_silence_generator * ast_channel_start_silence_generator(struct ast_channel *chan)
Starts a silence generator on the given channel.
Definition: channel.c:8163
static const char ast_stream_topology_changed_external[]
Set as the change source reason when a channel stream topology has been changed externally as a resul...
Definition: channel.h:221
void ast_channel_timingdata_set(struct ast_channel *chan, void *value)
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
Definition: channel.c:2031
int ast_recvchar(struct ast_channel *chan, int timeout)
Receives a text character from a channel.
Definition: channel.c:4705
struct ast_format * ast_channel_oldwriteformat(struct ast_channel *chan)
int ast_channel_internal_alert_readable(struct ast_channel *chan)
struct ast_cdr * ast_channel_cdr(const struct ast_channel *chan)
struct ast_channel * ast_channel_yank(struct ast_channel *yankee)
Gain control of a channel in the system.
Definition: channel.c:10592
int ast_channel_queryoption(struct ast_channel *channel, int option, void *data, int *datalen, int block)
Checks the value of an option.
Definition: channel.c:7441
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
Definition: channel.c:3162
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
Definition: channel.c:1231
int ast_channel_cc_params_init(struct ast_channel *chan, const struct ast_cc_config_params *base_params)
Set up datastore with CCSS parameters for a channel.
Definition: channel.c:10450
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
struct ast_channel * __ast_request_and_dial(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
Request a channel of a given type, with data as optional information used by the low level module and...
Definition: channel.c:5975
void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value)
unsigned long long ast_group_t
Definition: channel.h:213
ast_channel_error
Definition: channel.h:4793
@ AST_CHANNEL_ERROR_ID_EXISTS
Definition: channel.h:4797
@ AST_CHANNEL_ERROR_UNKNOWN
Definition: channel.h:4795
int ast_channel_get_intercept_mode(void)
Am I currently running an intercept dialplan routine.
Definition: channel.c:10332
void ast_party_connected_line_set(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src, const struct ast_set_party_connected_line *update)
Set the connected line information based on another connected line source.
Definition: channel.c:2054
int ast_channel_priority(const struct ast_channel *chan)
void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
void ast_channel_stop_silence_generator(struct ast_channel *chan, struct ast_silence_generator *state)
Stops a previously-started silence generator on the given channel.
Definition: channel.c:8209
int ast_settimeout_full(struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data, unsigned int is_ao2_obj)
Definition: channel.c:3185
void ast_channel_streamid_set(struct ast_channel *chan, int value)
void ast_channel_generatordata_set(struct ast_channel *chan, void *value)
void ast_party_dialed_init(struct ast_party_dialed *init)
Initialize the given dialed structure.
Definition: channel.c:1928
int(* ast_acf_read2_fn_t)(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **str, ssize_t len)
Typedef for a custom read2 function.
Definition: channel.h:580
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
void ast_party_caller_copy(struct ast_party_caller *dest, const struct ast_party_caller *src)
Copy the source caller information to the destination caller.
Definition: channel.c:1986
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.
void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value)
ast_callid ast_channel_callid(const struct ast_channel *chan)
void ast_party_redirecting_reason_set(struct ast_party_redirecting_reason *dest, const struct ast_party_redirecting_reason *src)
Set the redirecting reason information based on another redirecting reason source.
Definition: channel.c:2102
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
Definition: channel.c:1139
int ast_namedgroups_intersect(struct ast_namedgroups *a, struct ast_namedgroups *b)
Return TRUE if group a and b contain at least one common groupname.
Definition: channel.c:8089
const char * ast_channel_uniqueid(const struct ast_channel *chan)
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
Definition: channel.c:2368
const char * ast_channel_accountcode(const struct ast_channel *chan)
struct ast_channel * ast_channel__bridge(const struct ast_channel *chan)
void ast_channel_undefer_dtmf(struct ast_channel *chan)
Unset defer DTMF flag on channel.
Definition: channel.c:1271
void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
Definition: channel.c:6433
const char * ast_channel_context(const struct ast_channel *chan)
const char * ast_channel_userfield(const struct ast_channel *chan)
char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan)
unsigned long ast_channel_insmpl(const struct ast_channel *chan)
int ast_channel_fd_add(struct ast_channel *chan, int value)
Add a file descriptor to the channel without a fixed position.
void ast_deactivate_generator(struct ast_channel *chan)
Definition: channel.c:2893
ast_alert_status_t ast_channel_internal_alert_flush(struct ast_channel *chan)
void ast_party_id_merge_copy(struct ast_party_id *dest, struct ast_party_id *base, struct ast_party_id *overlay)
Copy a merge of a given party id into another given party id to a given destination party id.
Definition: channel.c:1920
struct ast_channel_iterator * ast_channel_iterator_by_exten_new(const char *exten, const char *context)
Create a new channel iterator based on extension.
Definition: channel.c:1368
int ast_check_hangup_locked(struct ast_channel *chan)
Definition: channel.c:459
void ast_channel_timingfd_set(struct ast_channel *chan, int value)
int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Compare a offset with the settings of when to hang a channel up.
Definition: channel.c:523
unsigned long global_fin
Definition: channel.c:95
struct ast_channel * __ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, enum ama_flags amaflag, struct ast_endpoint *endpoint, const char *file, int line, const char *function, const char *name_fmt,...)
Create a channel structure.
Definition: channel.c:954
char * ast_print_group(char *buf, int buflen, ast_group_t group)
Print call and pickup groups into buffer.
Definition: channel.c:8030
struct ast_channel * ast_channel_get_by_name_prefix(const char *name, size_t name_len)
Find a channel by a name prefix.
Definition: channel.c:1434
pthread_t ast_channel_blocker(const struct ast_channel *chan)
void ast_party_redirecting_reason_set_init(struct ast_party_redirecting_reason *init, const struct ast_party_redirecting_reason *guide)
Initialize the given redirecting reason structure using the given guide for a set update operation.
Definition: channel.c:2096
ama_flags
Channel AMA Flags.
Definition: channel.h:1177
@ AST_AMA_DOCUMENTATION
Definition: channel.h:1181
@ AST_AMA_OMIT
Definition: channel.h:1179
@ AST_AMA_NONE
Definition: channel.h:1178
@ AST_AMA_BILLING
Definition: channel.h:1180
int ast_set_write_format_interleaved_stereo(struct ast_channel *chan, struct ast_format *format)
Sets write format for a channel. All internal data will than be handled in an interleaved format....
Definition: channel.c:5784
void ast_channel_sending_dtmf_tv_set(struct ast_channel *chan, struct timeval value)
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
Definition: channel.c:5143
void ast_party_caller_set(struct ast_party_caller *dest, const struct ast_party_caller *src, const struct ast_set_party_caller *update)
Set the caller information based on another caller source.
Definition: channel.c:2007
int ast_channel_suppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)
Suppress passing of a frame type on a channel.
Definition: channel.c:10776
int ast_channel_feature_hooks_append(struct ast_channel *chan, struct ast_bridge_features *features)
Appends to the channel-attached features a channel has access to upon being bridged.
Definition: channel.c:10950
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Definition: autoservice.c:200
void ast_channel_softhangup_withcause_locked(struct ast_channel *chan, int causecode)
Lock the given channel, then request softhangup on the channel with the given causecode.
Definition: channel.c:468
int ast_channel_epfd(const struct ast_channel *chan)
int ast_undestroyed_channels(void)
Definition: channel.c:504
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Definition: channel.c:4256
void ast_party_connected_line_collect_caller(struct ast_party_connected_line *connected, struct ast_party_caller *caller)
Collect the caller party information into a connected line structure.
Definition: channel.c:2063
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
Definition: channel.c:1238
struct ast_bridge_features * ast_channel_feature_hooks_get(struct ast_channel *chan)
Gets the channel-attached features a channel has access to upon being bridged.
Definition: channel.c:10902
void ast_channel_update_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Indicate that the connected line information has changed.
Definition: channel.c:9092
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.
int ast_senddigit_mf_end(struct ast_channel *chan)
End sending an MF digit to a channel.
Definition: channel.c:4942
int ast_channel_move(struct ast_channel *dest, struct ast_channel *source)
Move a channel from its current location to a new location.
Definition: channel.c:10665
void ast_channel_queue_redirecting_update(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Queue a redirecting update frame on a channel.
Definition: channel.c:10296
void ast_party_redirecting_reason_init(struct ast_party_redirecting_reason *init)
Initialize the given redirecting reason structure.
Definition: channel.c:2079
const char * ast_channel_parkinglot(const struct ast_channel *chan)
ast_channel_adsicpe
Definition: channel.h:868
@ AST_ADSI_UNKNOWN
Definition: channel.h:869
@ AST_ADSI_UNAVAILABLE
Definition: channel.h:871
@ AST_ADSI_AVAILABLE
Definition: channel.h:870
@ AST_ADSI_OFFHOOKONLY
Definition: channel.h:872
int ast_senddigit_external(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel from an external thread.
Definition: channel.c:4986
void ast_channel_internal_swap_topics(struct ast_channel *a, struct ast_channel *b)
Swap topics beteween two channels.
int ast_sendtext(struct ast_channel *chan, const char *text)
Sends text to a channel.
Definition: channel.c:4808
const char * ast_channel_appl(const struct ast_channel *chan)
struct ast_frame * ast_read_stream(struct ast_channel *chan)
Reads a frame, but does not filter to just the default streams.
Definition: channel.c:4261
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
Definition: channel.c:1999
int ast_channel_unbridged_nolock(struct ast_channel *chan)
ast_channel_unbridged variant. Use this if the channel is already locked prior to calling.
void ast_party_id_set_init(struct ast_party_id *init, const struct ast_party_id *guide)
Initialize the given party id structure using the given guide for a set update operation.
Definition: channel.c:1780
void ast_party_name_free(struct ast_party_name *doomed)
Destroy the party name contents.
Definition: channel.c:1638
void ast_channel_set_ari_vars(size_t varc, char **vars)
Sets the variables to be stored in the ari_vars field of all snapshots.
Definition: channel.c:7891
const char * ast_channel_peeraccount(const struct ast_channel *chan)
void ast_party_dialed_free(struct ast_party_dialed *doomed)
Destroy the dialed party contents.
Definition: channel.c:1971
void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value)
struct timeval ast_channel_creationtime(struct ast_channel *chan)
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
Definition: channel.c:7333
int ast_channel_redirecting_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *redirecting_info, int is_frame)
Run a redirecting interception subroutine and update a channel's redirecting information.
Definition: channel.c:10382
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
Definition: channel.c:6770
struct ast_channel_snapshot * ast_channel_snapshot(const struct ast_channel *chan)
struct ast_bridge_channel * ast_channel_internal_bridge_channel(const struct ast_channel *chan)
struct ast_framehook_list * ast_channel_framehooks(const struct ast_channel *chan)
struct ast_frame * ast_read_stream_noaudio(struct ast_channel *chan)
Reads a frame, but does not filter to just the default streams, returning AST_FRAME_NULL frame if aud...
Definition: channel.c:4271
void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value)
int ast_channel_fd(const struct ast_channel *chan, int which)
void ast_party_redirecting_set_init(struct ast_party_redirecting *init, const struct ast_party_redirecting *guide)
Initialize the given redirecting id structure using the given guide for a set update operation.
Definition: channel.c:2153
void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value)
int ast_set_read_format(struct ast_channel *chan, struct ast_format *format)
Sets read format on channel chan.
Definition: channel.c:5761
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
void ast_party_name_set_init(struct ast_party_name *init, const struct ast_party_name *guide)
Initialize the given party name structure using the given guide for a set update operation.
Definition: channel.c:1613
void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
Definition: channel.c:1166
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
struct ast_audiohook_list * ast_channel_audiohooks(const struct ast_channel *chan)
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
enum ama_flags ast_channel_amaflags(const struct ast_channel *chan)
int ast_connected_line_parse_data(const unsigned char *data, size_t datalen, struct ast_party_connected_line *connected)
Parse connected line indication frame data.
Definition: channel.c:8784
void ast_party_caller_free(struct ast_party_caller *doomed)
Destroy the caller party contents.
Definition: channel.c:2015
void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
struct ast_channel * __ast_dummy_channel_alloc(const char *file, int line, const char *function)
Definition: channel.c:975
void ast_party_dialed_copy(struct ast_party_dialed *dest, const struct ast_party_dialed *src)
Copy the source dialed party information to the destination dialed party.
Definition: channel.c:1936
int ast_active_channels(void)
returns number of active/allocated channels
Definition: channel.c:499
struct ast_channel * ast_request_with_stream_topology(const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel (specifying stream topology)
Definition: channel.c:6358
struct ast_namedgroups * ast_get_namedgroups(const char *s)
Create an ast_namedgroups set with group names from comma separated string.
Definition: channel.c:7674
int ast_channel_supports_html(struct ast_channel *channel)
Checks for HTML support on a channel.
Definition: channel.c:6622
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value)
void * ast_channel_generatordata(const struct ast_channel *chan)
struct ast_format * ast_channel_rawwriteformat(struct ast_channel *chan)
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.
const char * ast_channel_hangupsource(const struct ast_channel *chan)
AST_MONITORING_STATE
Definition: channel.h:4031
@ AST_MONITOR_PAUSED
Definition: channel.h:4033
@ AST_MONITOR_RUNNING
Definition: channel.h:4032
unsigned int ast_channel_fout(const struct ast_channel *chan)
const char * ast_channel_dialcontext(const struct ast_channel *chan)
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
Definition: channel.c:445
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
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...
void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
void ast_party_name_set(struct ast_party_name *dest, const struct ast_party_name *src)
Set the source party name information into the destination party name.
Definition: channel.c:1621
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_set_party_id_all(struct ast_set_party_id *update_id)
Set the update marker to update all information of a corresponding party id.
Definition: channel.c:1750
int ast_channel_is_bridged(const struct ast_channel *chan)
Determine if a channel is in a bridge.
Definition: channel.c:10544
void ast_party_dialed_set(struct ast_party_dialed *dest, const struct ast_party_dialed *src)
Set the dialed information based on another dialed source.
Definition: channel.c:1958
const char * ast_channel_reason2str(int reason)
return an english explanation of the code returned thru __ast_request_and_dial's 'outstate' argument
Definition: channel.c:5825
int ast_channel_timingfd(const struct ast_channel *chan)
void ast_channel_fdno_set(struct ast_channel *chan, int value)
struct ast_frame * ast_read_noaudio(struct ast_channel *chan)
Reads a frame, returning AST_FRAME_NULL frame if audio.
Definition: channel.c:4266
int64_t ast_channel_get_duration_ms(struct ast_channel *chan)
Obtain how long it's been, in milliseconds, since the channel was created.
Definition: channel.c:2820
struct ast_bridge * ast_channel_get_bridge(const struct ast_channel *chan)
Get the bridge associated with a channel.
Definition: channel.c:10533
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
AST_PARTY_CHAR_SET
Definition: channel.h:242
@ AST_PARTY_CHAR_SET_UNKNOWN
Definition: channel.h:243
@ AST_PARTY_CHAR_SET_ISO8859_4
Definition: channel.h:248
@ AST_PARTY_CHAR_SET_WITHDRAWN
Definition: channel.h:245
@ AST_PARTY_CHAR_SET_ISO8859_5
Definition: channel.h:249
@ AST_PARTY_CHAR_SET_ISO8859_7
Definition: channel.h:250
@ AST_PARTY_CHAR_SET_ISO8859_2
Definition: channel.h:246
@ AST_PARTY_CHAR_SET_ISO8859_1
Definition: channel.h:244
@ AST_PARTY_CHAR_SET_ISO10646_UTF_8STRING
Definition: channel.h:252
@ AST_PARTY_CHAR_SET_ISO10646_BMPSTRING
Definition: channel.h:251
@ AST_PARTY_CHAR_SET_ISO8859_3
Definition: channel.h:247
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
Definition: channel.c:1584
struct ast_channel * ast_channel_internal_bridged_channel(const struct ast_channel *chan)
void ast_channel_creationtime_set(struct ast_channel *chan, struct timeval *value)
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
Definition: channel.c:4652
int ast_redirecting_build_data(unsigned char *data, size_t datalen, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Build the redirecting id data frame.
Definition: channel.c:9267
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
Definition: channel.c:2499
void ast_channel_set_flag(struct ast_channel *chan, unsigned int flag)
Set a flag on a channel.
Definition: channel.c:11026
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
Definition: channel.c:2471
struct ast_party_id ast_channel_redirecting_effective_orig(struct ast_channel *chan)
void ast_channel_name_to_dial_string(char *channel_name)
Removes the trailing identifiers from a channel name string.
Definition: channel.c:6838
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.
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
int ast_channel_alert_write(struct ast_channel *chan)
void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash on the given channel.
Definition: channel.c:4345
const char * ast_channel_lastcontext(const struct ast_channel *chan)
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
Definition: channel.c:1216
ast_bridge_result
Definition: channel.h:206
@ AST_BRIDGE_FAILED_NOWARN
Definition: channel.h:209
@ AST_BRIDGE_RETRY
Definition: channel.h:210
@ AST_BRIDGE_COMPLETE
Definition: channel.h:207
@ AST_BRIDGE_FAILED
Definition: channel.h:208
int ast_channel_vstreamid(const struct ast_channel *chan)
struct ast_readq_list * ast_channel_readq(struct ast_channel *chan)
void ast_channel_update_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Indicate that the redirecting id has changed.
Definition: channel.c:10283
int ast_channel_has_manager_vars(void)
Return whether or not any manager variables have been set.
Definition: channel.c:7854
void ast_channel_set_is_t38_active(struct ast_channel *chan, int is_t38_active)
Sets the is_t38_active flag.
struct ast_jb * ast_channel_jb(struct ast_channel *chan)
void ast_party_id_reset(struct ast_party_id *id)
Destroy and initialize the given party id structure.
Definition: channel.c:1896
const char * ast_channel_amaflags2string(enum ama_flags flags)
Convert the enum representation of an AMA flag to a string representation.
Definition: channel.c:4372
void ast_channel__bridge_set(struct ast_channel *chan, struct ast_channel *value)
void ast_party_id_invalidate(struct ast_party_id *id)
Invalidate all components of the given party id.
Definition: channel.c:1889
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
Definition: channel.c:1191
int(* ast_acf_read_fn_t)(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
Typedef for a custom read function.
Definition: channel.h:574
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
int ast_connected_line_build_data(unsigned char *data, size_t datalen, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Build the connected line information data frame.
Definition: channel.c:8696
int ast_senddigit_end(struct ast_channel *chan, char digit, unsigned int duration)
Send a DTMF digit to a channel.
Definition: channel.c:4923
int ast_channel_has_ari_vars(void)
Return whether or not any ARI variables have been set.
Definition: channel.c:7859
void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value)
int ast_channel_register(const struct ast_channel_tech *tech)
Register a channel technology (a new channel driver) Called by a channel module to register the kind ...
Definition: channel.c:539
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
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:1902
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_channel * ast_request_and_dial(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int timeout, int *reason, const char *cid_num, const char *cid_name)
Request a channel of a given type, with data as optional information used by the low level module and...
Definition: channel.c:6173
struct ast_filestream * ast_channel_vstream(const struct ast_channel *chan)
int ast_channel_stream_topology_changed_externally(struct ast_channel *chan)
Provide notice from a channel that the topology has changed on it as a result of the remote party ren...
Definition: channel.c:11007
ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan)
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
void ast_party_number_set_init(struct ast_party_number *init, const struct ast_party_number *guide)
Initialize the given party number structure using the given guide for a set update operation.
Definition: channel.c:1666
int ast_settimeout(struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data)
Enable or disable timer ticks for a channel.
Definition: channel.c:3180
@ AST_SOFTHANGUP_ASYNCGOTO
Definition: channel.h:1126
@ AST_SOFTHANGUP_EXPLICIT
Definition: channel.h:1148
@ AST_SOFTHANGUP_DEV
Definition: channel.h:1121
@ AST_SOFTHANGUP_HANGUP_EXEC
Definition: channel.h:1154
@ AST_SOFTHANGUP_ALL
All softhangup flags.
Definition: channel.h:1161
@ AST_SOFTHANGUP_TIMEOUT
Definition: channel.h:1138
@ AST_SOFTHANGUP_SHUTDOWN
Definition: channel.h:1131
@ AST_SOFTHANGUP_APPUNLOAD
Definition: channel.h:1143
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
Definition: channel.c:5802
void ast_party_id_copy(struct ast_party_id *dest, const struct ast_party_id *src)
Copy the source party id information to the destination party id.
Definition: channel.c:1765
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
Definition: channel.c:1691
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_generator * ast_channel_generator(const struct ast_channel *chan)
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
int ast_channel_unbridged(struct ast_channel *chan)
This function will check if the bridge needs to be re-evaluated due to external changes.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
Definition: channel.c:2022
int ast_channel_get_up_time(struct ast_channel *chan)
Obtain how long it has been since the channel was answered.
Definition: channel.c:2845
int ast_channel_is_leaving_bridge(struct ast_channel *chan)
Determine if a channel is leaving a bridge, but not hung up.
Definition: channel.c:10549
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
Definition: channel.c:510
int ast_channel_hold_state(const struct ast_channel *chan)
int ast_channel_sendurl(struct ast_channel *channel, const char *url)
Sends a URL on a given link Send URL on link.
Definition: channel.c:6634
int ast_redirecting_parse_data(const unsigned char *data, size_t datalen, struct ast_party_redirecting *redirecting)
Parse redirecting indication frame data.
Definition: channel.c:9478
void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value)
int ast_safe_sleep_conditional(struct ast_channel *chan, int ms, int(*cond)(void *), void *data)
Wait for a specified amount of time, looking for hangups and a condition argument.
Definition: channel.c:1568
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
Definition: channel.c:188
const char * ast_channel_oldest_linkedid(const char *a, const char *b)
Return the oldest linkedid between two channels.
const char * ast_channel_language(const struct ast_channel *chan)
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
Definition: channel.c:10581
const char * ast_cause2str(int cause) attribute_pure
Gives the string form of a given cause code.
Definition: channel.c:612
int ast_senddigit_mf(struct ast_channel *chan, char digit, unsigned int duration, unsigned int durationkp, unsigned int durationst, int is_external)
Send an MF digit to a channel.
Definition: channel.c:4951
int ast_write_text(struct ast_channel *chan, struct ast_frame *frame)
Write text frame to a channel This function writes the given frame to the indicated channel.
struct ast_party_connected_line * ast_channel_connected_indicated(struct ast_channel *chan)
int ast_transfer(struct ast_channel *chan, char *dest)
Transfer a channel (if supported).
Definition: channel.c:6484
void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
int ast_channel_unsuppress(struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)
Stop suppressing of a frame type on a channel.
Definition: channel.c:10838
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
Definition: channel.c:2179
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
Definition: channel.c:2426
int ast_channel_streamid(const struct ast_channel *chan)
void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value)
const char * ast_state2str(enum ast_channel_state state)
Gives the string form of a given channel state.
Definition: channel.c:636
void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value)
struct ast_sched_context * ast_channel_sched(const struct ast_channel *chan)
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state)
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
Definition: channel.c:8292
int ast_softhangup_nolock(struct ast_channel *chan, int cause)
Softly hangup up a channel (no channel lock)
Definition: channel.c:2458
int ast_channel_forward_endpoint(struct ast_channel *chan, struct ast_endpoint *endpoint)
Forward channel stasis messages to the given endpoint.
int ast_channel_fd_count(const struct ast_channel *chan)
Retrieve the number of file decriptor positions present on the channel.
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
Definition: channel.c:4359
struct ast_frame * ast_channel_dtmff(struct ast_channel *chan)
void ast_channel_internal_swap_snapshots(struct ast_channel *a, struct ast_channel *b)
Swap snapshots beteween two channels.
void ast_channel_music_state_set(struct ast_channel *chan, void *value)
void ast_channel_req_accountcodes_precious(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
Definition: channel.c:6438
unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
static int ast_add_fd(struct pollfd *pfd, int fd)
if fd is a valid descriptor, set *pfd with the descriptor
Definition: channel.h:2819
const char * ast_channel_call_forward(const struct ast_channel *chan)
@ AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT
Definition: channel.h:1035
@ AST_FLAG_ZOMBIE
Definition: channel.h:987
@ AST_FLAG_DISABLE_DEVSTATE_CACHE
Definition: channel.h:1029
@ AST_FLAG_SNAPSHOT_STAGE
Definition: channel.h:1050
@ AST_FLAG_OUTGOING
Definition: channel.h:999
@ AST_FLAG_BRIDGE_HANGUP_RUN
Definition: channel.h:1018
@ AST_FLAG_MASQ_NOSTREAM
Definition: channel.h:1014
@ AST_FLAG_IN_AUTOLOOP
Definition: channel.h:997
@ AST_FLAG_END_DTMF_ONLY
Definition: channel.h:1007
@ AST_FLAG_DEAD
Definition: channel.h:1045
@ AST_FLAG_EXCEPTION
Definition: channel.h:989
@ AST_FLAG_EMULATE_DTMF
Definition: channel.h:1004
@ AST_FLAG_IN_DTMF
Definition: channel.h:1001
@ AST_FLAG_WRITE_INT
Definition: channel.h:983
@ AST_FLAG_DEFER_DTMF
Definition: channel.h:981
@ AST_FLAG_BLOCKING
Definition: channel.h:985
@ AST_FLAG_SPYING
Definition: channel.h:993
@ AST_FLAG_DISABLE_WORKAROUNDS
Definition: channel.h:1022
@ AST_FLAG_SUBROUTINE_EXEC
Definition: channel.h:1058
@ AST_FLAG_ORIGINATED
Definition: channel.h:1039
@ AST_FLAG_TIMINGDATA_IS_AO2_OBJ
Definition: channel.h:1054
@ AST_FLAG_MOH
Definition: channel.h:991
int ast_set_write_format_path(struct ast_channel *chan, struct ast_format *core_format, struct ast_format *raw_format)
Set specific write path on channel.
Definition: channel.c:5523
struct ast_filestream * ast_channel_stream(const struct ast_channel *chan)
void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
struct ast_autochan_list * ast_channel_autochans(struct ast_channel *chan)
int ast_pre_call(struct ast_channel *chan, const char *sub_args)
Execute a Gosub call on the channel before a call is placed.
Definition: channel.c:6443
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
int ast_queue_answer(struct ast_channel *chan, const struct ast_stream_topology *topology)
Queue an ANSWER control frame with topology.
Definition: channel.c:1246
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
struct ast_channel * ast_channel_masqr(const struct ast_channel *chan)
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
Definition: channel.c:7731
void ast_party_subaddress_free(struct ast_party_subaddress *doomed)
Destroy the party subaddress contents.
Definition: channel.c:1744
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
Definition: channel.c:7421
enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
int ast_set_read_format_from_cap(struct ast_channel *chan, struct ast_format_cap *formats)
Sets read format on channel chan from capabilities Set read format for channel to whichever component...
Definition: channel.c:5779
struct timeval * ast_channel_dtmf_tv(struct ast_channel *chan)
int ast_channel_get_duration(struct ast_channel *chan)
Obtain how long the channel since the channel was created.
Definition: channel.c:2830
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_queue_connected_line_update(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Queue a connected line update frame on a channel.
Definition: channel.c:9105
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation.
Definition: channel.c:2045
unsigned long global_fout
Definition: channel.h:866
char ast_channel_sending_dtmf_digit(const struct ast_channel *chan)
int ast_channel_visible_indication(const struct ast_channel *chan)
struct ast_timer * ast_channel_timer(const struct ast_channel *chan)
struct ast_hangup_handler_list * ast_channel_hangup_handlers(struct ast_channel *chan)
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid value)
int ast_write_stream(struct ast_channel *chan, int stream_num, struct ast_frame *frame)
Write a frame to a stream This function writes the given frame to the indicated stream on the channel...
Definition: channel.c:5148
void ast_channel_internal_alertpipe_clear(struct ast_channel *chan)
void ast_channel_priority_set(struct ast_channel *chan, int value)
int ast_safe_sleep_without_silence(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups, and do not generate silence.
Definition: channel.c:1579
int ast_autoservice_ignore(struct ast_channel *chan, enum ast_frame_type ftype)
Ignore certain frame types.
Definition: autoservice.c:352
int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders)
Reads multiple digits.
Definition: channel.c:6557
void ast_connected_line_copy_to_caller(struct ast_party_caller *dest, const struct ast_party_connected_line *src)
Copy the connected line information to the caller information.
Definition: channel.c:8299
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
void ast_autoservice_chan_hangup_peer(struct ast_channel *chan, struct ast_channel *peer)
Put chan into autoservice while hanging up peer.
Definition: autoservice.c:342
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
const struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
Definition: channel.c:592
int ast_channel_fd_isset(const struct ast_channel *chan, int which)
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Definition: channel.c:1454
int ast_channel_defer_dtmf(struct ast_channel *chan)
Defers DTMF so that you only read things like hangups and audio.
Definition: channel.c:1257
int ast_tonepair(struct ast_channel *chan, int freq1, int freq2, int duration, int vol)
Definition: channel.c:7599
int ast_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2805
void ast_change_name(struct ast_channel *chan, const char *newname)
Change channel name.
Definition: channel.c:6758
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
void ast_channel_dialed_causes_clear(const struct ast_channel *chan)
Clear all cause information from the channel.
void ast_channel_epfd_set(struct ast_channel *chan, int value)
ast_group_t ast_get_group(const char *s)
Definition: channel.c:7617
int ast_channel_is_multistream(struct ast_channel *chan)
Determine if a channel is multi-stream capable.
int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Bridge two channels together (early)
Definition: channel.c:7411
int ast_channel_internal_alertpipe_init(struct ast_channel *chan)
int ast_indicate(struct ast_channel *chan, int condition)
Indicates condition of channel.
Definition: channel.c:4276
void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value)
int ast_is_deferrable_frame(const struct ast_frame *frame)
Should we keep this frame for later?
Definition: channel.c:1467
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Definition: channel.c:1408
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
Definition: channel.c:1574
struct ast_channel * ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel.
Definition: channel.c:6353
const char * ast_channel_exten(const struct ast_channel *chan)
int ast_channel_is_t38_active(struct ast_channel *chan)
This function will check if T.38 is active on the channel.
struct ast_datastore_list * ast_channel_datastores(struct ast_channel *chan)
struct ast_cc_config_params * ast_channel_get_cc_config_params(struct ast_channel *chan)
Get the CCSS parameters from a channel.
Definition: channel.c:10473
void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value)
int ast_raw_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2690
int ast_waitfordigit_full(struct ast_channel *c, int ms, const char *breakon, int audiofd, int ctrlfd)
Wait for a digit Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to mon...
Definition: channel.c:3239
void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value)
void ast_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
Copy the source redirecting information to the destination redirecting.
Definition: channel.c:2135
void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
struct ast_channel * ast_channel_internal_oldest_linkedid(struct ast_channel *a, struct ast_channel *b)
Determine which channel has an older linkedid.
void ast_party_name_copy(struct ast_party_name *dest, const struct ast_party_name *src)
Copy the source party name information to the destination party name.
Definition: channel.c:1599
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value)
int ast_channel_get_cc_agent_type(struct ast_channel *chan, char *agent_type, size_t size)
Find the appropriate CC agent type to use given a channel.
Definition: channel.c:10512
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2399
void ast_party_redirecting_reason_free(struct ast_party_redirecting_reason *doomed)
Destroy the redirecting reason contents.
Definition: channel.c:2116
void ast_party_caller_init(struct ast_party_caller *init)
Initialize the given caller structure.
Definition: channel.c:1978
int ast_set_write_format_from_cap(struct ast_channel *chan, struct ast_format_cap *formats)
Sets write format on channel chan Set write format for channel to whichever component of "format" is ...
Definition: channel.c:5820
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
int ast_channel_alert_writable(struct ast_channel *chan)
void ast_tonepair_stop(struct ast_channel *chan)
Definition: channel.c:7594
int ast_channel_has_audio_frame_or_monitor(struct ast_channel *chan)
Check if the channel has active audiohooks, active framehooks, or a monitor.
Definition: channel.c:2518
Channel states.
ast_channel_state
ast_channel states
Definition: channelstate.h:35
Channel Variables.
ast_media_type
Types of media.
Definition: codec.h:30
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
Definition: codec_g726.c:367
#define attribute_pure
Definition: compiler.h:35
#define attribute_const
Definition: compiler.h:41
Asterisk datastore objects.
char connected
Definition: eagi_proxy.c:82
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
Endpoint abstractions.
long int flag
Definition: f2c.h:83
Format Capabilities API.
static const char name[]
Definition: format_mp3.c:68
FrameHook Architecture.
direction
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Configuration File Parser.
Asterisk internal frame definitions.
#define AST_OPTION_T38_STATE
ast_frame_type
Frame types.
ast_control_frame_type
Internal control frame subtype field values.
unsigned int ast_callid
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
Definition: linkedlists.h:225
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
Definition: linkedlists.h:410
Asterisk locking-related definitions:
def info(msg)
static char url[512]
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
Structure to pass both assignedid values to channel drivers.
Definition: channel.h:604
const char * uniqueid2
Definition: channel.h:606
const char * uniqueid
Definition: channel.h:605
Structure that contains information regarding a channel in a bridge.
struct ast_channel * chan
bridge configuration
Definition: channel.h:1076
const char * end_sound
Definition: channel.h:1087
struct timeval nexteventts
Definition: channel.h:1080
const char * warning_sound
Definition: channel.h:1086
struct ast_stream_topology * answer_topology
Definition: channel.h:1099
void * end_bridge_callback_data
Definition: channel.h:1091
struct ast_flags features_callee
Definition: channel.h:1078
struct timeval feature_start_time
Definition: channel.h:1081
struct ast_flags features_caller
Definition: channel.h:1077
struct timeval start_time
Definition: channel.h:1079
void(* end_bridge_callback)(void *)
Definition: channel.h:1090
unsigned int flags
Definition: channel.h:1089
void(* end_bridge_callback_data_fixup)(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator)
Definition: channel.h:1095
const char * start_sound
Definition: channel.h:1088
Structure that contains features information.
Structure that contains information about a bridge.
Definition: bridge.h:349
Responsible for call detail data.
Definition: cdr.h:279
Structure to handle passing func_channel_write info to channels via setoption.
Definition: channel.h:589
ast_acf_write_fn_t write_fn
Definition: channel.h:593
struct ast_channel * chan
Definition: channel.h:594
const char * value
Definition: channel.h:597
const char * function
Definition: channel.h:595
Structure representing a snapshot of channel state.
Structure to describe a channel "technology", ie a channel driver See for examples:
Definition: channel.h:628
int(*const write)(struct ast_channel *chan, struct ast_frame *frame)
Write a frame, in standard format (see frame.h)
Definition: channel.h:750
struct ast_format_cap * capabilities
Definition: channel.h:632
struct ast_frame *(*const read)(struct ast_channel *chan)
Read a frame (or chain of frames from the same stream), in standard format (see frame....
Definition: channel.h:734
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:753
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....
Definition: channel.h:747
int(*const indicate)(struct ast_channel *c, int condition, const void *data, size_t datalen)
Indicate a particular condition (e.g. AST_CONTROL_BUSY or AST_CONTROL_RINGING or AST_CONTROL_CONGESTI...
Definition: channel.h:771
int(*const send_text)(struct ast_channel *chan, const char *text)
Display or transmit text.
Definition: channel.h:756
int(*const write_text)(struct ast_channel *chan, struct ast_frame *frame)
Write a text frame, in standard format.
Definition: channel.h:789
struct ast_channel *(*const requester)(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requester - to set up call data structures (pvt's)
Definition: channel.h:653
int(*const send_digit_begin)(struct ast_channel *chan, char digit)
Start sending a literal DTMF digit.
Definition: channel.h:683
int(*const call)(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
Definition: channel.h:701
int(*const fixup)(struct ast_channel *oldchan, struct ast_channel *newchan)
Fix up a channel: If a channel is consumed, this is called. Basically update any ->owner links.
Definition: channel.h:774
enum ast_bridge_result(*const early_bridge)(struct ast_channel *c0, struct ast_channel *c1)
Bridge two channels of the same type together (early)
Definition: channel.h:768
int(* func_channel_write)(struct ast_channel *chan, const char *function, char *data, const char *value)
Provide additional write items for CHANNEL() dialplan function.
Definition: channel.h:801
int(*const send_image)(struct ast_channel *chan, struct ast_frame *frame)
Display or send an image.
Definition: channel.h:759
int(*const send_text_data)(struct ast_channel *chan, struct ast_msg_data *data)
Display or transmit text with data.
Definition: channel.h:844
int(*const hangup)(struct ast_channel *chan)
Hangup (and possibly destroy) the channel.
Definition: channel.h:704
const char *const type
Definition: channel.h:629
int(*const queryoption)(struct ast_channel *chan, int option, void *data, int *datalen)
Query a given option. Called with chan locked.
Definition: channel.h:780
int(*const setoption)(struct ast_channel *chan, int option, void *data, int datalen)
Set a given option. Called with chan locked.
Definition: channel.h:777
int(*const answer)(struct ast_channel *chan)
Answer the channel.
Definition: channel.h:707
const char *const description
Definition: channel.h:630
int(*const presencestate)(const char *presence_provider, char **subtype, char **message)
Definition: channel.h:676
struct ast_channel *(*const requester_with_stream_topology)(const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requester - to set up call data structures (pvt's) with stream topology.
Definition: channel.h:672
int(* pre_call)(struct ast_channel *chan, const char *sub_args)
Execute a Gosub call on the channel in a technology specific way before a call is placed.
Definition: channel.h:841
int(*const send_digit_end)(struct ast_channel *chan, char digit, unsigned int duration)
Stop sending a literal DTMF digit.
Definition: channel.h:690
int(* func_channel_read)(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
Provide additional read items for CHANNEL() dialplan function.
Definition: channel.h:795
int(*const transfer)(struct ast_channel *chan, const char *newdest)
Blind transfer other side (see app_transfer.c and ast_transfer()
Definition: channel.h:783
int(*const write_video)(struct ast_channel *chan, struct ast_frame *frame)
Write a frame, in standard format.
Definition: channel.h:786
struct ast_frame *(*const exception)(struct ast_channel *chan)
Handle an exception, reading a frame.
Definition: channel.h:765
int(*const send_html)(struct ast_channel *chan, int subclass, const char *data, int len)
Send HTML data.
Definition: channel.h:762
int(*const answer_with_stream_topology)(struct ast_channel *chan, struct ast_stream_topology *topology)
Answer the channel with topology.
Definition: channel.h:720
int(*const devicestate)(const char *device_number)
Definition: channel.h:675
int(* cc_callback)(struct ast_channel *inbound, const char *dest, ast_cc_callback_fn callback)
Call a function with cc parameters as a function parameter.
Definition: channel.h:827
Main Channel structure associated with a channel.
struct ast_channel_id uniqueid
const ast_string_field musicclass
struct ast_channel::@331 fds
char exten[AST_MAX_EXTENSION]
const char * data
const struct ast_channel_tech * tech
char x
Definition: extconf.c:81
struct ast_channel_id linkedid
struct ast_party_caller caller
Channel Caller ID information.
char chan_name[AST_CHANNEL_NAME]
Structure for a data store type.
Definition: datastore.h:31
Structure for a data store object.
Definition: datastore.h:64
const char * uid
Definition: datastore.h:65
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
Structure used to handle boolean flags.
Definition: utils.h:199
Format capabilities structure, holds formats + preference order + etc.
Definition: format_cap.c:54
Definition of a media format.
Definition: format.c:43
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
void(* digit)(struct ast_channel *chan, char digit)
Definition: channel.h:235
int(* generate)(struct ast_channel *chan, void *data, int len, int samples)
Definition: channel.h:233
void(* release)(struct ast_channel *chan, void *data)
Definition: channel.h:228
void(* write_format_change)(struct ast_channel *chan, void *data)
Definition: channel.h:238
channel group info
Definition: channel.h:2915
struct ast_group_info::@210 group_list
char * category
Definition: channel.h:2917
char * group
Definition: channel.h:2918
struct ast_channel * chan
Definition: channel.h:2916
struct ast_hangup_handler::@209 node
General jitterbuffer state.
Definition: abstract_jb.h:141
Structure used to transport a message through the frame core.
Caller Party information.
Definition: channel.h:418
struct ast_party_id priv
Private caller party ID.
Definition: channel.h:430
struct ast_party_id id
Caller party ID.
Definition: channel.h:420
int ani2
Automatic Number Identification 2 (Info Digits)
Definition: channel.h:433
struct ast_party_id ani
Automatic Number Identification (ANI)
Definition: channel.h:427
Connected Line/Party information.
Definition: channel.h:456
int source
Information about the source of an update.
Definition: channel.h:482
struct ast_party_id priv
Private connected party ID.
Definition: channel.h:468
struct ast_party_id id
Connected party ID.
Definition: channel.h:458
int ani2
Automatic Number Identification 2 (Info Digits)
Definition: channel.h:475
struct ast_party_id ani
Automatic Number Identification (ANI)
Definition: channel.h:465
Dialed/Called Party information.
Definition: channel.h:378
struct ast_party_dialed::@208 number
Dialed/Called number.
struct ast_party_subaddress subaddress
Dialed/Called subaddress.
Definition: channel.h:391
char * str
Subscriber phone number (Malloced)
Definition: channel.h:386
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
Definition: channel.h:388
int transit_network_select
Transit Network Select.
Definition: channel.h:397
Information needed to identify an endpoint in a call.
Definition: channel.h:338
struct ast_party_subaddress subaddress
Subscriber subaddress.
Definition: channel.h:344
char * tag
User-set "tag".
Definition: channel.h:354
struct ast_party_name name
Subscriber name.
Definition: channel.h:340
Information needed to specify a name in a call.
Definition: channel.h:262
int char_set
Character set the name is using.
Definition: channel.h:272
int presentation
Q.931 encoded presentation-indicator encoded field.
Definition: channel.h:277
unsigned char valid
TRUE if the name information is valid/present.
Definition: channel.h:279
char * str
Subscriber name (Malloced)
Definition: channel.h:264
Information needed to specify a number in a call.
Definition: channel.h:289
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
Definition: channel.h:295
unsigned char valid
TRUE if the number information is valid/present.
Definition: channel.h:297
char * str
Subscriber phone number (Malloced)
Definition: channel.h:291
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
Definition: channel.h:293
Redirecting reason information.
Definition: channel.h:501
int code
enum AST_REDIRECTING_REASON value for redirection
Definition: channel.h:510
char * str
a string value for the redirecting reason
Definition: channel.h:507
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
Definition: channel.h:522
struct ast_party_id priv_to
Call is redirecting to a new party (Sent to the caller) - private representation.
Definition: channel.h:539
struct ast_party_redirecting_reason orig_reason
Reason for the redirection by the original party.
Definition: channel.h:545
struct ast_party_redirecting_reason reason
Reason for the redirection.
Definition: channel.h:542
struct ast_party_id priv_from
Who is redirecting the call (Sent to the party the call is redirected toward) - private representatio...
Definition: channel.h:536
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
Definition: channel.h:527
int count
Number of times the call was redirected.
Definition: channel.h:548
struct ast_party_id to
Call is redirecting to a new party (Sent to the caller)
Definition: channel.h:530
struct ast_party_id orig
Who originally redirected the call (Sent to the party the call is redirected toward)
Definition: channel.h:524
struct ast_party_id priv_orig
Who originally redirected the call (Sent to the party the call is redirected toward) - private repres...
Definition: channel.h:533
Information needed to specify a subaddress in a call.
Definition: channel.h:307
unsigned char odd_even_indicator
TRUE if odd number of address signals.
Definition: channel.h:326
unsigned char valid
TRUE if the subaddress information is valid/present.
Definition: channel.h:328
char * str
Malloced subaddress string.
Definition: channel.h:313
int type
Q.931 subaddress type.
Definition: channel.h:320
Definition: pbx.h:214
Indicate what information in ast_party_caller should be set.
Definition: channel.h:440
struct ast_set_party_id priv
Definition: channel.h:446
struct ast_set_party_id ani
Definition: channel.h:444
struct ast_set_party_id id
Definition: channel.h:442
Indicate what information in ast_party_connected_line should be set.
Definition: channel.h:489
struct ast_set_party_id priv
Definition: channel.h:495
struct ast_set_party_id ani
Definition: channel.h:493
struct ast_set_party_id id
Definition: channel.h:491
Indicate what information in ast_party_id should be set.
Definition: channel.h:361
unsigned char subaddress
Definition: channel.h:367
unsigned char number
Definition: channel.h:365
unsigned char name
Definition: channel.h:363
Indicate what information in ast_party_redirecting should be set.
Definition: channel.h:555
struct ast_set_party_id priv_to
Definition: channel.h:567
struct ast_set_party_id from
Definition: channel.h:559
struct ast_set_party_id priv_orig
Definition: channel.h:563
struct ast_set_party_id priv_from
Definition: channel.h:565
struct ast_set_party_id orig
Definition: channel.h:557
struct ast_set_party_id to
Definition: channel.h:561
Support for dynamic strings.
Definition: strings.h:623
A set of tones for a given locale.
Definition: indications.h:74
Default structure for translators, with the basic fields and buffers, all allocated as part of the sa...
Definition: translate.h:213
Structure for variables, used for configurations and for channel variables.
Definition: file.c:69
Number structure.
Definition: app_followme.c:154
const char * cid_num
Definition: channel.h:1109
struct ast_variable * vars
Definition: channel.h:1112
int connect_on_early_media
Definition: channel.h:1108
const char * account
Definition: channel.h:1111
const char * cid_name
Definition: channel.h:1110
const char * exten
Definition: channel.h:1106
const char * context
Definition: channel.h:1105
struct ast_channel * parent_channel
Definition: channel.h:1113
int value
Definition: syslog.c:37
static struct test_val b
static struct test_val a
static struct test_val c
Utility functions.