📄 channel.h
字号:
int (* const write_video)(struct ast_channel *chan, struct ast_frame *frame); /*! \brief Write a text frame, in standard format */ int (* const write_text)(struct ast_channel *chan, struct ast_frame *frame); /*! \brief Find bridged channel */ struct ast_channel *(* const bridged_channel)(struct ast_channel *chan, struct ast_channel *bridge); /*! \brief Provide additional read items for CHANNEL() dialplan function */ int (* func_channel_read)(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len); /*! \brief Provide additional write items for CHANNEL() dialplan function */ int (* func_channel_write)(struct ast_channel *chan, const char *function, char *data, const char *value); /*! \brief Retrieve base channel (agent and local) */ struct ast_channel* (* get_base_channel)(struct ast_channel *chan); /*! \brief Set base channel (agent and local) */ int (* set_base_channel)(struct ast_channel *chan, struct ast_channel *base); /*! \brief Get the unique identifier for the PVT, i.e. SIP call-ID for SIP */ const char * (* get_pvt_uniqueid)(struct ast_channel *chan);};struct ast_epoll_data;/*! * The high bit of the frame count is used as a debug marker, so * increments of the counters must be done with care. * Please use c->fin = FRAMECOUNT_INC(c->fin) and the same for c->fout. */#define DEBUGCHAN_FLAG 0x80000000/* XXX not ideal to evaluate x twice... */#define FRAMECOUNT_INC(x) ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) )/*! * The current value of the debug flags is stored in the two * variables global_fin and global_fout (declared in main/channel.c) */extern unsigned long global_fin, global_fout;enum ast_channel_adsicpe { AST_ADSI_UNKNOWN, AST_ADSI_AVAILABLE, AST_ADSI_UNAVAILABLE, AST_ADSI_OFFHOOKONLY,};/*! * \brief ast_channel states * * \note Bits 0-15 of state are reserved for the state (up/down) of the line * Bits 16-32 of state are reserved for flags */enum ast_channel_state { AST_STATE_DOWN, /*!< Channel is down and available */ AST_STATE_RESERVED, /*!< Channel is down, but reserved */ AST_STATE_OFFHOOK, /*!< Channel is off hook */ AST_STATE_DIALING, /*!< Digits (or equivalent) have been dialed */ AST_STATE_RING, /*!< Line is ringing */ AST_STATE_RINGING, /*!< Remote end is ringing */ AST_STATE_UP, /*!< Line is up */ AST_STATE_BUSY, /*!< Line is busy */ AST_STATE_DIALING_OFFHOOK, /*!< Digits (or equivalent) have been dialed while offhook */ AST_STATE_PRERING, /*!< Channel has detected an incoming call and is waiting for ring */ AST_STATE_MUTE = (1 << 16), /*!< Do not transmit voice data */};/*! * \brief Possible T38 states on channels */enum ast_t38_state { T38_STATE_UNAVAILABLE, /*!< T38 is unavailable on this channel or disabled by configuration */ T38_STATE_UNKNOWN, /*!< The channel supports T38 but the current status is unknown */ T38_STATE_NEGOTIATING, /*!< T38 is being negotiated */ T38_STATE_REJECTED, /*!< Remote side has rejected our offer */ T38_STATE_NEGOTIATED, /*!< T38 established */};/*! \brief Main Channel structure associated with a channel. * This is the side of it mostly used by the pbx and call management. * * \note XXX It is important to remember to increment .cleancount each time * this structure is changed. XXX */struct ast_channel { const struct ast_channel_tech *tech; /*!< Technology (point to channel driver) */ void *tech_pvt; /*!< Private data used by the technology driver */ AST_DECLARE_STRING_FIELDS( AST_STRING_FIELD(name); /*!< ASCII unique channel name */ AST_STRING_FIELD(language); /*!< Language requested for voice prompts */ AST_STRING_FIELD(musicclass); /*!< Default music class */ AST_STRING_FIELD(accountcode); /*!< Account code for billing */ AST_STRING_FIELD(call_forward); /*!< Where to forward to if asked to dial on this interface */ AST_STRING_FIELD(uniqueid); /*!< Unique Channel Identifier */ ); int fds[AST_MAX_FDS]; /*!< File descriptors for channel -- Drivers will poll on these file descriptors, so at least one must be non -1. See \arg \ref AstFileDesc */ void *music_state; /*!< Music State*/ void *generatordata; /*!< Current generator data if there is any */ struct ast_generator *generator; /*!< Current active data generator */ struct ast_channel *_bridge; /*!< Who are we bridged to, if we're bridged. Who is proxying for us, if we are proxied (i.e. chan_agent). Do not access directly, use ast_bridged_channel(chan) */ struct ast_channel *masq; /*!< Channel that will masquerade as us */ struct ast_channel *masqr; /*!< Who we are masquerading as */ int cdrflags; /*!< Call Detail Record Flags */ int _softhangup; /*!< Whether or not we have been hung up... Do not set this value directly, use ast_softhangup() */ time_t whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */ pthread_t blocker; /*!< If anyone is blocking, this is them */ ast_mutex_t lock_dont_use; /*!< Lock a channel for some operations. See ast_channel_lock() */ const char *blockproc; /*!< Procedure causing blocking */ const char *appl; /*!< Current application */ const char *data; /*!< Data passed to current application */ int fdno; /*!< Which fd had an event detected on */ struct sched_context *sched; /*!< Schedule context */ int streamid; /*!< For streaming playback, the schedule ID */ struct ast_filestream *stream; /*!< Stream itself. */ int vstreamid; /*!< For streaming video playback, the schedule ID */ struct ast_filestream *vstream; /*!< Video Stream itself. */ int oldwriteformat; /*!< Original writer format */ int timingfd; /*!< Timing fd */ int (*timingfunc)(const void *data); void *timingdata; enum ast_channel_state _state; /*!< State of line -- Don't write directly, use ast_setstate() */ int rings; /*!< Number of rings so far */ struct ast_callerid cid; /*!< Caller ID, name, presentation etc */ char unused_old_dtmfq[AST_MAX_EXTENSION]; /*!< (deprecated, use the readq) Any/all queued DTMF characters */ struct ast_frame dtmff; /*!< DTMF frame */ char context[AST_MAX_CONTEXT]; /*!< Dialplan: Current extension context */ char exten[AST_MAX_EXTENSION]; /*!< Dialplan: Current extension number */ int priority; /*!< Dialplan: Current extension priority */ char macrocontext[AST_MAX_CONTEXT]; /*!< Macro: Current non-macro context. See app_macro.c */ char macroexten[AST_MAX_EXTENSION]; /*!< Macro: Current non-macro extension. See app_macro.c */ int macropriority; /*!< Macro: Current non-macro priority. See app_macro.c */ char dialcontext[AST_MAX_CONTEXT]; /*!< Dial: Extension context that we were called from */ struct ast_pbx *pbx; /*!< PBX private structure for this channel */ int amaflags; /*!< Set BEFORE PBX is started to determine AMA flags */ struct ast_cdr *cdr; /*!< Call Detail Record */ enum ast_channel_adsicpe adsicpe; /*!< Whether or not ADSI is detected on CPE */ struct tone_zone *zone; /*!< Tone zone as set in indications.conf or in the CHANNEL dialplan function */ struct ast_channel_monitor *monitor; /*!< Channel monitoring */ unsigned long insmpl; /*!< Track the read/written samples for monitor use */ unsigned long outsmpl; /*!< Track the read/written samples for monitor use */ unsigned int fin; /*!< Frames in counters. The high bit is a debug mask, so the counter is only in the remaining bits */ unsigned int fout; /*!< Frames out counters. The high bit is a debug mask, so the counter is only in the remaining bits */ int hangupcause; /*!< Why is the channel hanged up. See causes.h */ struct varshead varshead; /*!< A linked list for channel variables. See \ref AstChanVar */ ast_group_t callgroup; /*!< Call group for call pickups */ ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */ unsigned int flags; /*!< channel flags of AST_FLAG_ type */ unsigned short transfercapability; /*!< ISDN Transfer Capbility - AST_FLAG_DIGITAL is not enough */ AST_LIST_HEAD_NOLOCK(, ast_frame) readq; int alertpipe[2]; int nativeformats; /*!< Kinds of data this channel can natively handle */ int readformat; /*!< Requested read format */ int writeformat; /*!< Requested write format */ struct ast_trans_pvt *writetrans; /*!< Write translation path */ struct ast_trans_pvt *readtrans; /*!< Read translation path */ int rawreadformat; /*!< Raw read format */ int rawwriteformat; /*!< Raw write format */ struct ast_audiohook_list *audiohooks; AST_LIST_ENTRY(ast_channel) chan_list; /*!< For easy linking */ struct ast_jb jb; /*!< The jitterbuffer state */ char emulate_dtmf_digit; /*!< Digit being emulated */ unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */ struct timeval dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */ AST_LIST_HEAD_NOLOCK(datastores, ast_datastore) datastores; /*!< Data stores on the channel */#ifdef HAVE_EPOLL int epfd; struct ast_epoll_data *epfd_data[AST_MAX_FDS];#endif int visible_indication; /*!< Indication currently playing on the channel */};/*! \brief ast_channel_tech Properties */enum { /*! \brief Channels have this property if they can accept input with jitter; * i.e. most VoIP channels */ AST_CHAN_TP_WANTSJITTER = (1 << 0), /*! \brief Channels have this property if they can create jitter; * i.e. most VoIP channels */ AST_CHAN_TP_CREATESJITTER = (1 << 1),};/*! \brief ast_channel flags */enum { /*! Queue incoming dtmf, to be released when this flag is turned off */ AST_FLAG_DEFER_DTMF = (1 << 1), /*! write should be interrupt generator */ AST_FLAG_WRITE_INT = (1 << 2), /*! a thread is blocking on this channel */ AST_FLAG_BLOCKING = (1 << 3), /*! This is a zombie channel */ AST_FLAG_ZOMBIE = (1 << 4), /*! There is an exception pending */ AST_FLAG_EXCEPTION = (1 << 5), /*! Listening to moh XXX anthm promises me this will disappear XXX */ AST_FLAG_MOH = (1 << 6), /*! This channel is spying on another channel */ AST_FLAG_SPYING = (1 << 7), /*! This channel is in a native bridge */ AST_FLAG_NBRIDGE = (1 << 8), /*! the channel is in an auto-incrementing dialplan processor, * so when ->priority is set, it will get incremented before * finding the next priority to run */ AST_FLAG_IN_AUTOLOOP = (1 << 9), /*! This is an outgoing call */ AST_FLAG_OUTGOING = (1 << 10), /*! A DTMF_BEGIN frame has been read from this channel, but not yet an END */ AST_FLAG_IN_DTMF = (1 << 12), /*! A DTMF_END was received when not IN_DTMF, so the length of the digit is * currently being emulated */ AST_FLAG_EMULATE_DTMF = (1 << 13), /*! This is set to tell the channel not to generate DTMF begin frames, and * to instead only generate END frames. */ AST_FLAG_END_DTMF_ONLY = (1 << 14), /*! Flag to show channels that this call is hangup due to the fact that the call was indeed anwered, but in another channel */ AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), /*! This flag indicates that on a masquerade, an active stream should not * be carried over */ AST_FLAG_MASQ_NOSTREAM = (1 << 16), /*! This flag indicates that the hangup exten was run when the bridge terminated, * a message aimed at preventing a subsequent hangup exten being run at the pbx_run * level */ AST_FLAG_BRIDGE_HANGUP_RUN = (1 << 17), /*! This flag indicates that the hangup exten should NOT be run when the * bridge terminates, this will allow the hangup in the pbx loop to be run instead. * */ AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18),};/*! \brief ast_bridge_config flags */enum { AST_FEATURE_PLAY_WARNING = (1 << 0), AST_FEATURE_REDIRECT = (1 << 1), AST_FEATURE_DISCONNECT = (1 << 2), AST_FEATURE_ATXFER = (1 << 3), AST_FEATURE_AUTOMON = (1 << 4), AST_FEATURE_PARKCALL = (1 << 5), AST_FEATURE_AUTOMIXMON = (1 << 6), AST_FEATURE_NO_H_EXTEN = (1 << 7),};/*! \brief bridge configuration */struct ast_bridge_config { struct ast_flags features_caller; struct ast_flags features_callee; struct timeval start_time; long feature_timer; long timelimit; long play_warning; long warning_freq; const char *warning_sound; const char *end_sound; const char *start_sound; int firstpass; unsigned int flags; void (* end_bridge_callback)(void *); /*!< A callback that is called after a bridge attempt */ void *end_bridge_callback_data; /*!< Data passed to the callback */ /*! If the end_bridge_callback_data refers to a channel which no longer is going to * exist when the end_bridge_callback is called, then it needs to be fixed up properly */ void (*end_bridge_callback_data_fixup)(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator);};struct chanmon;struct outgoing_helper { const char *context; const char *exten; int priority; const char *cid_num; const char *cid_name; const char *account; struct ast_variable *vars; struct ast_channel *parent_channel;};enum { AST_CDR_TRANSFER = (1 << 0), AST_CDR_FORWARD = (1 << 1), AST_CDR_CALLWAIT = (1 << 2), AST_CDR_CONFERENCE = (1 << 3),};enum { /*! Soft hangup by device */ AST_SOFTHANGUP_DEV = (1 << 0), /*! Soft hangup for async goto */ AST_SOFTHANGUP_ASYNCGOTO = (1 << 1), AST_SOFTHANGUP_SHUTDOWN = (1 << 2), AST_SOFTHANGUP_TIMEOUT = (1 << 3), AST_SOFTHANGUP_APPUNLOAD = (1 << 4), AST_SOFTHANGUP_EXPLICIT = (1 << 5), AST_SOFTHANGUP_UNBRIDGE = (1 << 6),};/*! \brief Channel reload reasons for manager events at load or reload of configuration */enum channelreloadreason { CHANNEL_MODULE_LOAD, CHANNEL_MODULE_RELOAD, CHANNEL_CLI_RELOAD,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -