⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 channel.h

📁 asterisk 是一个很有知名度开源软件
💻 H
📖 第 1 页 / 共 5 页
字号:
/*! \brief Indicates condition of channel, with payload * \note Indicate a condition such as AST_CONTROL_HOLD with payload being music on hold class * \param chan channel to change the indication * \param condition which condition to indicate on the channel * \param data pointer to payload data * \param datalen size of payload data * \return Returns 0 on success, -1 on failure */int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen);/* Misc stuff ------------------------------------------------ *//*! \brief Wait for input on a channel  * \param chan channel to wait on * \param ms length of time to wait on the channel * Wait for input on a channel for a given # of milliseconds (<0 for indefinite).   \return Returns < 0 on  failure, 0 if nothing ever arrived, and the # of ms remaining otherwise */int ast_waitfor(struct ast_channel *chan, int ms);/*! \brief Wait for a specified amount of time, looking for hangups  * \param chan channel to wait for * \param ms length of time in milliseconds to sleep * Waits for a specified amount of time, servicing the channel as required. * \return returns -1 on hangup, otherwise 0. */int ast_safe_sleep(struct ast_channel *chan, int ms);/*! \brief Wait for a specified amount of time, looking for hangups and a condition argument  * \param chan channel to wait for * \param ms length of time in milliseconds to sleep * \param cond a function pointer for testing continue condition * \param data argument to be passed to the condition test function * \return returns -1 on hangup, otherwise 0. * Waits for a specified amount of time, servicing the channel as required. If cond * returns 0, this function returns. */int ast_safe_sleep_conditional(struct ast_channel *chan, int ms, int (*cond)(void*), void *data );/*! \brief Waits for activity on a group of channels  * \param chan an array of pointers to channels * \param n number of channels that are to be waited upon * \param fds an array of fds to wait upon * \param nfds the number of fds to wait upon * \param exception exception flag * \param outfd fd that had activity on it * \param ms how long the wait was * Big momma function here.  Wait for activity on any of the n channels, or any of the nfds   file descriptors.   \return Returns the channel with activity, or NULL on error or if an FD   came first.  If the FD came first, it will be returned in outfd, otherwise, outfd   will be -1 */struct ast_channel *ast_waitfor_nandfds(struct ast_channel **chan, int n,	int *fds, int nfds, int *exception, int *outfd, int *ms);/*! \brief Waits for input on a group of channels   Wait for input on an array of channels for a given # of milliseconds. 	\return Return channel with activity, or NULL if none has activity.  	\param chan an array of pointers to channels	\param n number of channels that are to be waited upon	\param ms time "ms" is modified in-place, if applicable */struct ast_channel *ast_waitfor_n(struct ast_channel **chan, int n, int *ms);/*! \brief Waits for input on an fd	This version works on fd's only.  Be careful with it. */int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception);/*! \brief Reads a frame * \param chan channel to read a frame from * \return Returns a frame, or NULL on error.  If it returns NULL, you	best just stop reading frames and assume the channel has been	disconnected. */struct ast_frame *ast_read(struct ast_channel *chan);/*! \brief Reads a frame, returning AST_FRAME_NULL frame if audio.  	\param chan channel to read a frame from	\return  Returns a frame, or NULL on error.  If it returns NULL, you		best just stop reading frames and assume the channel has been		disconnected.  	\note Audio is replaced with AST_FRAME_NULL to avoid 	transcode when the resulting audio is not necessary. */struct ast_frame *ast_read_noaudio(struct ast_channel *chan);/*! \brief Write a frame to a channel  * This function writes the given frame to the indicated channel. * \param chan destination channel of the frame * \param frame frame that will be written * \return It returns 0 on success, -1 on failure. */int ast_write(struct ast_channel *chan, struct ast_frame *frame);/*! \brief Write video frame to a channel  * This function writes the given frame to the indicated channel. * \param chan destination channel of the frame * \param frame frame that will be written * \return It returns 1 on success, 0 if not implemented, and -1 on failure. */int ast_write_video(struct ast_channel *chan, struct ast_frame *frame);/*! \brief Write text frame to a channel  * This function writes the given frame to the indicated channel. * \param chan destination channel of the frame * \param frame frame that will be written * \return It returns 1 on success, 0 if not implemented, and -1 on failure. */int ast_write_text(struct ast_channel *chan, struct ast_frame *frame);/*! \brief Send empty audio to prime a channel driver */int ast_prod(struct ast_channel *chan);/*! \brief Sets read format on channel chan * Set read format for channel to whichever component of "format" is best.  * \param chan channel to change * \param format format to change to * \return Returns 0 on success, -1 on failure */int ast_set_read_format(struct ast_channel *chan, int format);/*! \brief Sets write format on channel chan * Set write format for channel to whichever component of "format" is best.  * \param chan channel to change * \param format new format for writing * \return Returns 0 on success, -1 on failure */int ast_set_write_format(struct ast_channel *chan, int format);/*!  * \brief Sends text to a channel  * * \param chan channel to act upon * \param text string of text to send on the channel * * Write text to a display on a channel * * \note The channel does not need to be locked before calling this function. * * \retval 0 on success  * \retval -1 on failure */int ast_sendtext(struct ast_channel *chan, const char *text);/*! \brief Receives a text character from a channel * \param chan channel to act upon * \param timeout timeout in milliseconds (0 for infinite wait) * Read a char of text from a channel * Returns 0 on success, -1 on failure */int ast_recvchar(struct ast_channel *chan, int timeout);/*! \brief Send a DTMF digit to a channel * Send a DTMF digit to a channel. * \param chan channel to act upon * \param digit the DTMF digit to send, encoded in ASCII * \param duration the duration of the digit ending in ms * \return Returns 0 on success, -1 on failure */int ast_senddigit(struct ast_channel *chan, char digit, unsigned int duration);/*! \brief Send a DTMF digit to a channel * Send a DTMF digit to a channel. * \param chan channel to act upon * \param digit the DTMF digit to send, encoded in ASCII * \return Returns 0 on success, -1 on failure */int ast_senddigit_begin(struct ast_channel *chan, char digit);/*! \brief Send a DTMF digit to a channel * Send a DTMF digit to a channel. * \param chan channel to act upon * \param digit the DTMF digit to send, encoded in ASCII * \param duration the duration of the digit ending in ms * \return Returns 0 on success, -1 on failure */int ast_senddigit_end(struct ast_channel *chan, char digit, unsigned int duration);/*! \brief Receives a text string from a channel * Read a string of text from a channel * \param chan channel to act upon * \param timeout timeout in milliseconds (0 for infinite wait) * \return the received text, or NULL to signify failure. */char *ast_recvtext(struct ast_channel *chan, int timeout);/*! \brief Browse channels in use * Browse the channels currently in use  * \param prev where you want to start in the channel list * \return Returns the next channel in the list, NULL on end. * 	If it returns a channel, that channel *has been locked*! */struct ast_channel *ast_channel_walk_locked(const struct ast_channel *prev);/*! \brief Get channel by name or uniqueid (locks channel) */struct ast_channel *ast_get_channel_by_name_locked(const char *chan);/*! \brief Get channel by name or uniqueid prefix (locks channel) */struct ast_channel *ast_get_channel_by_name_prefix_locked(const char *name, const int namelen);/*! \brief Get channel by name or uniqueid prefix (locks channel) */struct ast_channel *ast_walk_channel_by_name_prefix_locked(const struct ast_channel *chan, const char *name, const int namelen);/*! \brief Get channel by exten (and optionally context) and lock it */struct ast_channel *ast_get_channel_by_exten_locked(const char *exten, const char *context);/*! \brief Get next channel by exten (and optionally context) and lock it */struct ast_channel *ast_walk_channel_by_exten_locked(const struct ast_channel *chan, const char *exten,						     const char *context);/*! ! \brief Waits for a digit * \param c channel to wait for a digit on * \param ms how many milliseconds to wait * \return Returns <0 on error, 0 on no entry, and the digit on success. */int ast_waitfordigit(struct ast_channel *c, int ms);/*! \brief Wait for a digit Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to monitor for reading.  * \param c channel to wait for a digit on * \param ms how many milliseconds to wait * \param audiofd audio file descriptor to write to if audio frames are received * \param ctrlfd control file descriptor to monitor for reading * \return Returns 1 if ctrlfd becomes available */int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int ctrlfd);/*! Reads multiple digits  * \param c channel to read from * \param s string to read in to.  Must be at least the size of your length * \param len how many digits to read (maximum) * \param timeout how long to timeout between digits * \param rtimeout timeout to wait on the first digit * \param enders digits to end the string * Read in a digit string "s", max length "len", maximum timeout between    digits "timeout" (-1 for none), terminated by anything in "enders".  Give them rtimeout   for the first digit.  Returns 0 on normal return, or 1 on a timeout.  In the case of   a timeout, any digits that were read before the timeout will still be available in s.     RETURNS 2 in full version when ctrlfd is available, NOT 1*/int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders);int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders, int audiofd, int ctrlfd);/*! \brief Report DTMF on channel 0 */#define AST_BRIDGE_DTMF_CHANNEL_0		(1 << 0)		/*! \brief Report DTMF on channel 1 */#define AST_BRIDGE_DTMF_CHANNEL_1		(1 << 1)		/*! \brief Return all voice frames on channel 0 */#define AST_BRIDGE_REC_CHANNEL_0		(1 << 2)		/*! \brief Return all voice frames on channel 1 */#define AST_BRIDGE_REC_CHANNEL_1		(1 << 3)		/*! \brief Ignore all signal frames except NULL */#define AST_BRIDGE_IGNORE_SIGS			(1 << 4)		/*! \brief Makes two channel formats compatible  * \param c0 first channel to make compatible * \param c1 other channel to make compatible * Set two channels to compatible formats -- call before ast_channel_bridge in general .   * \return Returns 0 on success and -1 if it could not be done */int ast_channel_make_compatible(struct ast_channel *c0, struct ast_channel *c1);/*! Bridge two channels together (early) * \param c0 first channel to bridge * \param c1 second channel to bridge * Bridge two channels (c0 and c1) together early. This implies either side may not be answered yet. * \return Returns 0 on success and -1 if it could not be done */int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1);/*! Bridge two channels together  * \param c0 first channel to bridge * \param c1 second channel to bridge * \param config config for the channels * \param fo destination frame(?) * \param rc destination channel(?) * Bridge two channels (c0 and c1) together.  If an important frame occurs, we return that frame in   *rf (remember, it could be NULL) and which channel (0 or 1) in rc *//* int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc); */int ast_channel_bridge(struct ast_channel *c0,struct ast_channel *c1,	struct ast_bridge_config *config, struct ast_frame **fo, struct ast_channel **rc);/*!  * \brief Weird function made for call transfers * * \param original channel to make a copy of * \param clone copy of the original channel * * This is a very strange and freaky function used primarily for transfer.  Suppose that * "original" and "clone" are two channels in random situations.  This function takes * the guts out of "clone" and puts them into the "original" channel, then alerts the * channel driver of the change, asking it to fixup any private information (like the * p->owner pointer) that is affected by the change.  The physical layer of the original * channel is hung up.   * * \note Neither channel passed here needs to be locked before calling this function. */int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone);/*! Gives the string form of a given cause code *//*!  * \param state cause to get the description of * Give a name to a cause code * Returns the text form of the binary cause code given */const char *ast_cause2str(int state) attribute_pure;/*! Convert the string form of a cause code to a number *//*!  * \param name string form of the cause * Returns the cause code */int ast_str2cause(const char *name) attribute_pure;/*! Gives the string form of a given channel state *//*!  * \param ast_channel_state state to get the name of * Give a name to a state  * Returns the text form of the binary state given */const char *ast_state2str(enum ast_channel_state);/*! Gives the string form of a given transfer capability *//*! * \param transfercapability transfercapabilty to get the name of * Give a name to a transfercapbility * See above * Returns the text form of the binary transfer capability */char *ast_transfercapability2str(int transfercapability) attribute_const;/* Options: Some low-level drivers may implement "options" allowing fine tuning of the   low level channel.  See frame.h for options.  Note that many channel drivers may support   none or a subset of those features, and you should not count on this if you want your   asterisk application to be portable.  They're mainly useful for tweaking performance *//*! Sets an option on a channel *//*!  * \param channel channel to set options on * \param option option to change * \param data data specific to option * \param datalen length of the data

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -