diff options
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/autoconfig.h.in | 6 | ||||
-rw-r--r-- | include/asterisk/bridge.h | 9 | ||||
-rw-r--r-- | include/asterisk/channel.h | 79 | ||||
-rw-r--r-- | include/asterisk/iostream.h | 118 | ||||
-rw-r--r-- | include/asterisk/json.h | 12 | ||||
-rw-r--r-- | include/asterisk/manager.h | 2 | ||||
-rw-r--r-- | include/asterisk/stasis_bridges.h | 4 | ||||
-rw-r--r-- | include/asterisk/stasis_channels.h | 1 | ||||
-rw-r--r-- | include/asterisk/tcptls.h | 92 |
9 files changed, 233 insertions, 90 deletions
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 45bc800ee..e8bd8118a 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -399,6 +399,9 @@ /* Define if your system has the LIBEDIT libraries. */ #undef HAVE_LIBEDIT +/* Define if your system has the LIBEDIT_IS_UNICODE headers. */ +#undef HAVE_LIBEDIT_IS_UNICODE + /* Define to 1 if you have the <libintl.h> header file. */ #undef HAVE_LIBINTL_H @@ -589,6 +592,9 @@ /* Define if your system has PJPROJECT_BUNDLED */ #undef HAVE_PJPROJECT_BUNDLED +/* Define to 1 if PJPROJECT has the pjsip_auth_clt_deinit support feature. */ +#undef HAVE_PJSIP_AUTH_CLT_DEINIT + /* Define to 1 if PJPROJECT has the PJSIP Dialog Create UAS with Incremented Lock feature. */ #undef HAVE_PJSIP_DLG_CREATE_UAS_AND_INC_LOCK diff --git a/include/asterisk/bridge.h b/include/asterisk/bridge.h index acea2f01f..61cecbdd6 100644 --- a/include/asterisk/bridge.h +++ b/include/asterisk/bridge.h @@ -903,6 +903,15 @@ int ast_bridge_is_video_src(struct ast_bridge *bridge, struct ast_channel *chan) */ void ast_bridge_remove_video_src(struct ast_bridge *bridge, struct ast_channel *chan); +/*! + * \brief Converts an enum representation of a bridge video mode to string + * + * \param video_mode The video mode + * + * \retval A string representation of \c video_mode + */ +const char *ast_bridge_video_mode_to_string(enum ast_bridge_video_mode_type video_mode); + enum ast_transfer_result { /*! The transfer completed successfully */ AST_BRIDGE_TRANSFER_SUCCESS, diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index ff92cc878..5c73c777e 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -967,6 +967,16 @@ enum { * The channel is executing a subroutine or macro */ AST_FLAG_SUBROUTINE_EXEC = (1 << 27), + /*! + * The channel is currently in an operation where + * frames should be deferred. + */ + AST_FLAG_DEFER_FRAMES = (1 << 28), + /*! + * The channel is currently deferring hangup frames + * in addition to other frame types. + */ + AST_FLAG_DEFER_HANGUP_FRAMES = (1 << 29), }; /*! \brief ast_bridge_config flags */ @@ -4340,6 +4350,36 @@ void ast_channel_set_manager_vars(size_t varc, char **vars); struct varshead *ast_channel_get_manager_vars(struct ast_channel *chan); /*! + * \since 14.2.0 + * \brief Return whether or not any ARI variables have been set + * + * \retval 0 if no ARI variables are expected + * \retval 1 if ARI variables are expected + */ +int ast_channel_has_ari_vars(void); + +/*! + * \since 14.2.0 + * \brief Sets the variables to be stored in the \a ari_vars field of all + * snapshots. + * \param varc Number of variable names. + * \param vars Array of variable names. + */ +void ast_channel_set_ari_vars(size_t varc, char **vars); + +/*! + * \since 14.2.0 + * \brief Gets the variables for a given channel, as specified by ast_channel_set_ari_vars(). + * + * The returned variable list is an AO2 object, so ao2_cleanup() to free it. + * + * \param chan Channel to get variables for. + * \return List of channel variables. + * \return \c NULL on error + */ +struct varshead *ast_channel_get_ari_vars(struct ast_channel *chan); + +/*! * \since 12 * \brief Gets the variables for a given channel, as set using pbx_builtin_setvar_helper(). * @@ -4671,4 +4711,43 @@ enum ast_channel_error { */ enum ast_channel_error ast_channel_errno(void); +/*! + * \brief Retrieve the deferred read queue. + */ +struct ast_readq_list *ast_channel_deferred_readq(struct ast_channel *chan); + +/*! + * \brief Start deferring deferrable frames on this channel + * + * Sometimes, a channel gets entered into a mode where a "main" application + * is tasked with servicing frames on the channel, but that application does + * not need to act on those frames. However, it would be imprudent to simply + * drop important frames. This function can be called so that important frames + * will be deferred, rather than placed in the channel frame queue as normal. + * + * Hangups are an interesting frame type. Hangups will always be detectable by + * a reader when a channel is deferring frames. If the defer_hangups parameter + * is non-zero, then the hangup frame will also be duplicated and deferred, so + * that the next reader of the channel will get the hangup frame, too. + * + * \pre chan MUST be locked before calling + * + * \param chan The channel on which frames should be deferred + * \param defer_hangups Defer hangups in addition to other deferrable frames + */ +void ast_channel_start_defer_frames(struct ast_channel *chan, int defer_hangups); + +/*! + * \brief Stop deferring deferrable frames on this channel + * + * When it is time to stop deferring frames on the channel, all deferred frames + * will be queued onto the channel's read queue so that the next servicer of + * the channel can handle those frames as necessary. + * + * \pre chan MUST be locked before calling + * + * \param chan The channel on which to stop deferring frames. + */ +void ast_channel_stop_defer_frames(struct ast_channel *chan); + #endif /* _ASTERISK_CHANNEL_H */ diff --git a/include/asterisk/iostream.h b/include/asterisk/iostream.h new file mode 100644 index 000000000..c641ffb37 --- /dev/null +++ b/include/asterisk/iostream.h @@ -0,0 +1,118 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 1999 - 2015, Digium, Inc. + * + * Timo Teräs <timo.teras@iki.fi> + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +#ifndef _ASTERISK_IOSTREAM_H +#define _ASTERISK_IOSTREAM_H + +/*! + * \file iostream.h + * + * \brief Generic abstraction for input/output streams. + */ + +#if defined(HAVE_OPENSSL) +#define DO_SSL /* comment in/out if you want to support ssl */ +#endif + +#ifdef DO_SSL +#include <openssl/ssl.h> +#include <openssl/err.h> +#include <openssl/x509v3.h> +#else +/* declare dummy types so we can define a pointer to them */ +typedef struct {} SSL; +typedef struct {} SSL_CTX; +#endif /* DO_SSL */ + +struct ast_iostream; + +/*! + * \brief Disable the iostream timeout timer. + * + * \param stream iostream control data. + * + * \return Nothing + */ +void ast_iostream_set_timeout_disable(struct ast_iostream *stream); + +/*! + * \brief Set the iostream inactivity timeout timer. + * + * \param stream iostream control data. + * \param timeout Number of milliseconds to wait for data transfer with the peer. + * + * \details This is basically how much time we are willing to spend + * in an I/O call before we declare the peer unresponsive. + * + * \note Setting timeout to -1 disables the timeout. + * \note Setting this timeout replaces the I/O sequence timeout timer. + * + * \return Nothing + */ +void ast_iostream_set_timeout_inactivity(struct ast_iostream *stream, int timeout); + +void ast_iostream_set_timeout_idle_inactivity(struct ast_iostream *stream, int timeout, int timeout_reset); + +/*! + * \brief Set the iostream I/O sequence timeout timer. + * + * \param stream iostream control data. + * \param start Time the I/O sequence timer starts. + * \param timeout Number of milliseconds from the start time before timeout. + * + * \details This is how much time are we willing to allow the peer + * to complete an operation that can take several I/O calls. The + * main use is as an authentication timer with us. + * + * \note Setting timeout to -1 disables the timeout. + * \note Setting this timeout replaces the inactivity timeout timer. + * + * \return Nothing + */ +void ast_iostream_set_timeout_sequence(struct ast_iostream *stream, struct timeval start, int timeout); + +/*! + * \brief Set the iostream if it can exclusively depend upon the set timeouts. + * + * \param stream iostream control data. + * \param exclusive_input TRUE if stream can exclusively wait for fd input. + * Otherwise, the stream will not wait for fd input. It will wait while + * trying to send data. + * + * \note The stream timeouts still need to be set. + * + * \return Nothing + */ +void ast_iostream_set_exclusive_input(struct ast_iostream *stream, int exclusive_input); + +int ast_iostream_get_fd(struct ast_iostream *stream); +void ast_iostream_nonblock(struct ast_iostream *stream); + +SSL* ast_iostream_get_ssl(struct ast_iostream *stream); + +ssize_t ast_iostream_read(struct ast_iostream *stream, void *buf, size_t count); +ssize_t ast_iostream_gets(struct ast_iostream *stream, char *buf, size_t count); +ssize_t ast_iostream_discard(struct ast_iostream *stream, size_t count); +ssize_t ast_iostream_write(struct ast_iostream *stream, const void *buf, size_t count); +ssize_t ast_iostream_printf(struct ast_iostream *stream, const void *fmt, ...); + +struct ast_iostream* ast_iostream_from_fd(int *fd); +int ast_iostream_start_tls(struct ast_iostream **stream, SSL_CTX *ctx, int client); +int ast_iostream_close(struct ast_iostream *stream); + +#endif /* _ASTERISK_IOSTREAM_H */ diff --git a/include/asterisk/json.h b/include/asterisk/json.h index cfd9a2997..bd6ba86b9 100644 --- a/include/asterisk/json.h +++ b/include/asterisk/json.h @@ -1076,6 +1076,18 @@ enum ast_json_to_ast_vars_code { */ enum ast_json_to_ast_vars_code ast_json_to_ast_variables(struct ast_json *json_variables, struct ast_variable **variables); +struct varshead; + +/*! + * \brief Construct a JSON object from a \c ast_var_t list + * \since 14.2.0 + * + * \param channelvars The list of \c ast_var_t to represent as JSON + * + * \return JSON object with variable names as keys and variable values as values + */ +struct ast_json *ast_json_channel_vars(struct varshead *channelvars); + /*!@}*/ #endif /* _ASTERISK_JSON_H */ diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h index 1ec1cbae3..60c51de85 100644 --- a/include/asterisk/manager.h +++ b/include/asterisk/manager.h @@ -54,7 +54,7 @@ - \ref manager.c Main manager code file */ -#define AMI_VERSION "2.8.0" +#define AMI_VERSION "3.1.0" #define DEFAULT_MANAGER_PORT 5038 /* Default port for Asterisk management via TCP */ #define DEFAULT_MANAGER_TLS_PORT 5039 /* Default port for Asterisk management via TCP */ diff --git a/include/asterisk/stasis_bridges.h b/include/asterisk/stasis_bridges.h index d549e4620..05d356cc2 100644 --- a/include/asterisk/stasis_bridges.h +++ b/include/asterisk/stasis_bridges.h @@ -58,6 +58,10 @@ struct ast_bridge_snapshot { unsigned int num_channels; /*! Number of active channels in the bridge. */ unsigned int num_active; + /*! The video mode of the bridge */ + enum ast_bridge_video_mode_type video_mode; + /*! Unique ID of the channel providing video, if one exists */ + AST_STRING_FIELD_EXTENDED(video_source_id); }; /*! diff --git a/include/asterisk/stasis_channels.h b/include/asterisk/stasis_channels.h index 6c6cd51f1..deb79b0d0 100644 --- a/include/asterisk/stasis_channels.h +++ b/include/asterisk/stasis_channels.h @@ -73,6 +73,7 @@ struct ast_channel_snapshot { struct ast_flags softhangup_flags; /*!< softhangup channel flags */ struct varshead *manager_vars; /*!< Variables to be appended to manager events */ int tech_properties; /*!< Properties of the channel's technology */ + struct varshead *ari_vars; /*!< Variables to be appended to ARI events */ }; /*! diff --git a/include/asterisk/tcptls.h b/include/asterisk/tcptls.h index 3c5f4504c..883cb9229 100644 --- a/include/asterisk/tcptls.h +++ b/include/asterisk/tcptls.h @@ -57,20 +57,7 @@ #include "asterisk/netsock2.h" #include "asterisk/utils.h" - -#if defined(HAVE_OPENSSL) && (defined(HAVE_FUNOPEN) || defined(HAVE_FOPENCOOKIE)) -#define DO_SSL /* comment in/out if you want to support ssl */ -#endif - -#ifdef DO_SSL -#include <openssl/ssl.h> -#include <openssl/err.h> -#include <openssl/x509v3.h> -#else -/* declare dummy types so we can define a pointer to them */ -typedef struct {} SSL; -typedef struct {} SSL_CTX; -#endif /* DO_SSL */ +#include "asterisk/iostream.h" /*! SSL support */ #define AST_CERTFILE "asterisk.pem" @@ -153,72 +140,10 @@ struct ast_tcptls_session_args { const char *name; }; -struct ast_tcptls_stream; - -/*! - * \brief Disable the TCP/TLS stream timeout timer. - * - * \param stream TCP/TLS stream control data. - * - * \return Nothing - */ -void ast_tcptls_stream_set_timeout_disable(struct ast_tcptls_stream *stream); - -/*! - * \brief Set the TCP/TLS stream inactivity timeout timer. - * - * \param stream TCP/TLS stream control data. - * \param timeout Number of milliseconds to wait for data transfer with the peer. - * - * \details This is basically how much time we are willing to spend - * in an I/O call before we declare the peer unresponsive. - * - * \note Setting timeout to -1 disables the timeout. - * \note Setting this timeout replaces the I/O sequence timeout timer. - * - * \return Nothing - */ -void ast_tcptls_stream_set_timeout_inactivity(struct ast_tcptls_stream *stream, int timeout); - -/*! - * \brief Set the TCP/TLS stream I/O sequence timeout timer. - * - * \param stream TCP/TLS stream control data. - * \param start Time the I/O sequence timer starts. - * \param timeout Number of milliseconds from the start time before timeout. - * - * \details This is how much time are we willing to allow the peer - * to complete an operation that can take several I/O calls. The - * main use is as an authentication timer with us. - * - * \note Setting timeout to -1 disables the timeout. - * \note Setting this timeout replaces the inactivity timeout timer. - * - * \return Nothing - */ -void ast_tcptls_stream_set_timeout_sequence(struct ast_tcptls_stream *stream, struct timeval start, int timeout); - -/*! - * \brief Set the TCP/TLS stream I/O if it can exclusively depend upon the set timeouts. - * - * \param stream TCP/TLS stream control data. - * \param exclusive_input TRUE if stream can exclusively wait for fd input. - * Otherwise, the stream will not wait for fd input. It will wait while - * trying to send data. - * - * \note The stream timeouts still need to be set. - * - * \return Nothing - */ -void ast_tcptls_stream_set_exclusive_input(struct ast_tcptls_stream *stream, int exclusive_input); - /*! \brief * describes a server instance */ struct ast_tcptls_session_instance { - FILE *f; /*!< fopen/funopen result */ - int fd; /*!< the socket returned by accept() */ - SSL *ssl; /*!< ssl state */ int client; struct ast_sockaddr remote_address; struct ast_tcptls_session_args *parent; @@ -228,20 +153,12 @@ struct ast_tcptls_session_instance { * extra data. */ struct ast_str *overflow_buf; - /*! ao2 FILE stream cookie object associated with f. */ - struct ast_tcptls_stream *stream_cookie; + /*! ao2 stream object associated with this session. */ + struct ast_iostream *stream; /*! ao2 object private data of parent->worker_fn */ void *private_data; }; -#if defined(HAVE_FUNOPEN) -#define HOOK_T int -#define LEN_T int -#else -#define HOOK_T ssize_t -#define LEN_T size_t -#endif - /*! * \brief attempts to connect and start tcptls session, on error the tcptls_session's * ref count is decremented, fd and file are closed, and NULL is returned. @@ -297,7 +214,4 @@ void ast_ssl_teardown(struct ast_tls_config *cfg); */ int ast_tls_read_conf(struct ast_tls_config *tls_cfg, struct ast_tcptls_session_args *tls_desc, const char *varname, const char *value); -HOOK_T ast_tcptls_server_read(struct ast_tcptls_session_instance *ser, void *buf, size_t count); -HOOK_T ast_tcptls_server_write(struct ast_tcptls_session_instance *ser, const void *buf, size_t count); - #endif /* _ASTERISK_TCPTLS_H */ |