| 1 | /* |
| 2 | * Asterisk -- An open source telephony toolkit. |
| 3 | * |
| 4 | * Copyright (C) 2024, Sangoma Technologies Corporation |
| 5 | * |
| 6 | * George Joseph <[email protected]> |
| 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 | #ifndef CHANNEL_PRIVATE_H_ |
| 20 | #define CHANNEL_PRIVATE_H_ |
| 21 | |
| 22 | #if defined(__cplusplus) || defined(c_plusplus) |
| 23 | extern "C" { |
| 24 | #endif |
| 25 | |
| 26 | /*! |
| 27 | * \brief Channel UniqueId structure |
| 28 | * \note channel creation time used for determining LinkedId Propagation |
| 29 | */ |
| 30 | struct ast_channel_id { |
| 31 | time_t creation_time; /*!< Creation time */ |
| 32 | int creation_unique; /*!< sub-second unique value */ |
| 33 | char unique_id[AST_MAX_UNIQUEID]; /*!< Unique Identifier */ |
| 34 | char tenant_id[AST_MAX_TENANT_ID]; /*!< Multi-tenant identifier */ |
| 35 | }; |
| 36 | |
| 37 | /*! |
| 38 | * \brief Main Channel structure associated with a channel. |
| 39 | * |
| 40 | * \note When adding fields to this structure, it is important to add the field |
| 41 | * 'in position' with like-aligned fields, so as to keep the compiler from |
| 42 | * having to add padding to align fields. The structure's fields are sorted |
| 43 | * in this order: pointers, structures, long, int/enum, short, char. This |
| 44 | * is especially important on 64-bit architectures, where mixing 4-byte |
| 45 | * and 8-byte fields causes 4 bytes of padding to be added before many |
| 46 | * 8-byte fields. |
| 47 | */ |
| 48 | struct ast_channel { |
| 49 | const struct ast_channel_tech *tech; /*!< Technology (point to channel driver) */ |
| 50 | void *tech_pvt; /*!< Private data used by the technology driver */ |
| 51 | void *music_state; /*!< Music State*/ |
| 52 | void *generatordata; /*!< Current generator data if there is any */ |
| 53 | struct ast_generator *generator; /*!< Current active data generator */ |
| 54 | struct ast_channel *masq; /*!< Channel that will masquerade as us */ |
| 55 | struct ast_channel *masqr; /*!< Who we are masquerading as */ |
| 56 | const char *blockproc; /*!< Procedure causing blocking */ |
| 57 | const char *appl; /*!< Current application */ |
| 58 | const char *data; /*!< Data passed to current application */ |
| 59 | struct ast_sched_context *sched; /*!< Schedule context */ |
| 60 | struct ast_filestream *stream; /*!< Stream itself. */ |
| 61 | struct ast_filestream *vstream; /*!< Video Stream itself. */ |
| 62 | ast_timing_func_t timingfunc; |
| 63 | void *timingdata; |
| 64 | struct ast_pbx *pbx; /*!< PBX private structure for this channel */ |
| 65 | struct ast_trans_pvt *writetrans; /*!< Write translation path */ |
| 66 | struct ast_trans_pvt *readtrans; /*!< Read translation path */ |
| 67 | struct ast_audiohook_list *audiohooks; |
| 68 | struct ast_framehook_list *framehooks; |
| 69 | struct ast_cdr *cdr; /*!< Call Detail Record */ |
| 70 | struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or |
| 71 | * in the CHANNEL dialplan function */ |
| 72 | ast_callid callid; /*!< Bound call identifier pointer */ |
| 73 | struct ao2_container *dialed_causes; /*!< Contains tech-specific and Asterisk cause data from dialed channels */ |
| 74 | |
| 75 | AST_DECLARE_STRING_FIELDS( |
| 76 | AST_STRING_FIELD(name); /*!< ASCII unique channel name */ |
| 77 | AST_STRING_FIELD(language); /*!< Language requested for voice prompts */ |
| 78 | AST_STRING_FIELD(musicclass); /*!< Default music class */ |
| 79 | AST_STRING_FIELD(latest_musicclass); /*!< Latest active music class */ |
| 80 | AST_STRING_FIELD(accountcode); /*!< Account code for billing */ |
| 81 | AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */ |
| 82 | AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */ |
| 83 | AST_STRING_FIELD(call_forward); /*!< Where to forward to if asked to dial on this interface */ |
| 84 | AST_STRING_FIELD(parkinglot); /*! Default parking lot, if empty, default parking lot */ |
| 85 | AST_STRING_FIELD(hangupsource); /*! Who is responsible for hanging up this channel */ |
| 86 | AST_STRING_FIELD(dialcontext); /*!< Dial: Extension context that we were called from */ |
| 87 | ); |
| 88 | |
| 89 | struct ast_channel_id uniqueid; /*!< Unique Channel Identifier - can be specified on creation */ |
| 90 | struct ast_channel_id linkedid; /*!< Linked Channel Identifier - oldest propagated when bridged */ |
| 91 | |
| 92 | struct timeval whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */ |
| 93 | pthread_t blocker; /*!< If anyone is blocking, this is them */ |
| 94 | |
| 95 | /*! |
| 96 | * \brief Dialed/Called information. |
| 97 | * \note Set on incoming channels to indicate the originally dialed party. |
| 98 | * \note Dialed Number Identifier (DNID) |
| 99 | */ |
| 100 | struct ast_party_dialed dialed; |
| 101 | |
| 102 | /*! |
| 103 | * \brief Channel Caller ID information. |
| 104 | * \note The caller id information is the caller id of this |
| 105 | * channel when it is used to initiate a call. |
| 106 | */ |
| 107 | struct ast_party_caller caller; |
| 108 | |
| 109 | /*! |
| 110 | * \brief Channel Connected Line ID information. |
| 111 | * \note The connected line information identifies the channel |
| 112 | * connected/bridged to this channel. |
| 113 | */ |
| 114 | struct ast_party_connected_line connected; |
| 115 | |
| 116 | /*! |
| 117 | * \brief Channel Connected Line ID information that was last indicated. |
| 118 | */ |
| 119 | struct ast_party_connected_line connected_indicated; |
| 120 | |
| 121 | /*! \brief Redirecting/Diversion information */ |
| 122 | struct ast_party_redirecting redirecting; |
| 123 | |
| 124 | struct ast_frame dtmff; /*!< DTMF frame */ |
| 125 | struct varshead varshead; /*!< A linked list for channel variables. See \ref AstChanVar */ |
| 126 | ast_group_t callgroup; /*!< Call group for call pickups */ |
| 127 | ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */ |
| 128 | struct ast_namedgroups *named_callgroups; /*!< Named call group for call pickups */ |
| 129 | struct ast_namedgroups *named_pickupgroups; /*!< Named pickup group - which call groups can be picked up? */ |
| 130 | struct timeval creationtime; /*!< The time of channel creation */ |
| 131 | struct timeval answertime; /*!< The time the channel was answered */ |
| 132 | struct ast_readq_list readq; |
| 133 | struct ast_jb jb; /*!< The jitterbuffer state */ |
| 134 | struct timeval dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */ |
| 135 | struct ast_hangup_handler_list hangup_handlers;/*!< Hangup handlers on the channel. */ |
| 136 | struct ast_datastore_list datastores; /*!< Data stores on the channel */ |
| 137 | struct ast_autochan_list autochans; /*!< Autochans on the channel */ |
| 138 | unsigned long insmpl; /*!< Track the read/written samples for monitor use */ |
| 139 | unsigned long outsmpl; /*!< Track the read/written samples for monitor use */ |
| 140 | |
| 141 | int blocker_tid; /*!< If anyone is blocking, this is their thread id */ |
| 142 | AST_VECTOR(, int) fds; /*!< File descriptors for channel -- Drivers will poll on |
| 143 | * these file descriptors, so at least one must be non -1. |
| 144 | * See \arg \ref AstFileDesc */ |
| 145 | int softhangup; /*!< Whether or not we have been hung up... Do not set this value |
| 146 | * directly, use ast_softhangup() */ |
| 147 | int fdno; /*!< Which fd had an event detected on */ |
| 148 | int streamid; /*!< For streaming playback, the schedule ID */ |
| 149 | int vstreamid; /*!< For streaming video playback, the schedule ID */ |
| 150 | struct ast_format *oldwriteformat; /*!< Original writer format */ |
| 151 | int timingfd; /*!< Timing fd */ |
| 152 | enum ast_channel_state state; /*!< State of line -- Don't write directly, use ast_setstate() */ |
| 153 | int rings; /*!< Number of rings so far */ |
| 154 | int priority; /*!< Dialplan: Current extension priority */ |
| 155 | int amaflags; /*!< Set BEFORE PBX is started to determine AMA flags */ |
| 156 | enum ast_channel_adsicpe adsicpe; /*!< Whether or not ADSI is detected on CPE */ |
| 157 | unsigned int fin; /*!< Frames in counters. The high bit is a debug mask, so |
| 158 | * the counter is only in the remaining bits */ |
| 159 | unsigned int fout; /*!< Frames out counters. The high bit is a debug mask, so |
| 160 | * the counter is only in the remaining bits */ |
| 161 | int hangupcause; /*!< Why is the channel hanged up. See causes.h */ |
| 162 | int tech_hangupcause; /*!< Technology-specific off-nominal hangup cause. |
| 163 | * Leave set to 0 for nominal call termination. |
| 164 | */ |
| 165 | unsigned int finalized:1; /*!< Whether or not the channel has been successfully allocated */ |
| 166 | struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */ |
| 167 | int alertpipe[2]; |
| 168 | struct ast_format_cap *nativeformats; /*!< Kinds of data this channel can natively handle */ |
| 169 | struct ast_format *readformat; /*!< Requested read format (after translation) */ |
| 170 | struct ast_format *writeformat; /*!< Requested write format (before translation) */ |
| 171 | struct ast_format *rawreadformat; /*!< Raw read format (before translation) */ |
| 172 | struct ast_format *rawwriteformat; /*!< Raw write format (after translation) */ |
| 173 | unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */ |
| 174 | int visible_indication; /*!< Indication currently playing on the channel */ |
| 175 | int hold_state; /*!< Current Hold/Unhold state */ |
| 176 | |
| 177 | unsigned short transfercapability; /*!< ISDN Transfer Capability - AST_FLAG_DIGITAL is not enough */ |
| 178 | |
| 179 | struct ast_bridge *bridge; /*!< Bridge this channel is participating in */ |
| 180 | struct ast_bridge_channel *bridge_channel;/*!< The bridge_channel this channel is linked with. */ |
| 181 | struct ast_timer *timer; /*!< timer object that provided timingfd */ |
| 182 | |
| 183 | char context[AST_MAX_CONTEXT]; /*!< Dialplan: Current extension context */ |
| 184 | char exten[AST_MAX_EXTENSION]; /*!< Dialplan: Current extension number */ |
| 185 | char lastcontext[AST_MAX_CONTEXT]; /*!< Dialplan: Previous extension context */ |
| 186 | char lastexten[AST_MAX_EXTENSION]; /*!< Dialplan: Previous extension number */ |
| 187 | char unbridged; /*!< non-zero if the bridge core needs to re-evaluate the current |
| 188 | bridging technology which is in use by this channel's bridge. */ |
| 189 | char is_t38_active; /*!< non-zero if T.38 is active on this channel. */ |
| 190 | char dtmf_digit_to_emulate; /*!< Digit being emulated */ |
| 191 | char sending_dtmf_digit; /*!< Digit this channel is currently sending out. (zero if not sending) */ |
| 192 | struct timeval sending_dtmf_tv; /*!< The time this channel started sending the current digit. (Invalid if sending_dtmf_digit is zero.) */ |
| 193 | struct stasis_topic *topic; /*!< Topic for this channel */ |
| 194 | struct stasis_forward *channel_forward; /*!< Subscription for event forwarding to all channel topic */ |
| 195 | struct stasis_forward *endpoint_forward; /*!< Subscription for event forwarding to endpoint's topic */ |
| 196 | struct ast_stream_topology *stream_topology; /*!< Stream topology */ |
| 197 | void *stream_topology_change_source; /*!< Source that initiated a stream topology change */ |
| 198 | struct ast_stream *default_streams[AST_MEDIA_TYPE_END]; /*!< Default streams indexed by media type */ |
| 199 | struct ast_channel_snapshot *snapshot; /*!< The current up to date snapshot of the channel */ |
| 200 | struct ast_flags snapshot_segment_flags; /*!< Flags regarding the segments of the snapshot */ |
| 201 | int linked_in_container; /*!< Whether this channel is linked in a storage container */ |
| 202 | struct ast_endpoint *endpoint; /*!< The endpoint associated with this channel */ |
| 203 | AST_VECTOR(, char *) ari_report_vars; /*!< Channel variable names to be included in ARI events */ |
| 204 | }; |
| 205 | |
| 206 | #if defined(__cplusplus) || defined(c_plusplus) |
| 207 | } |
| 208 | #endif |
| 209 | |
| 210 | #endif /* CHANNEL_PRIVATE_H_ */ |