diff options
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/autochan.h | 20 | ||||
-rw-r--r-- | include/asterisk/network.h | 5 | ||||
-rw-r--r-- | include/asterisk/res_hep.h | 2 | ||||
-rw-r--r-- | include/asterisk/res_pjsip.h | 82 | ||||
-rw-r--r-- | include/asterisk/res_pjsip_session.h | 2 | ||||
-rw-r--r-- | include/asterisk/rtp_engine.h | 11 |
6 files changed, 113 insertions, 9 deletions
diff --git a/include/asterisk/autochan.h b/include/asterisk/autochan.h index 319c203ab..128377b57 100644 --- a/include/asterisk/autochan.h +++ b/include/asterisk/autochan.h @@ -32,6 +32,7 @@ struct ast_autochan { struct ast_channel *chan; AST_LIST_ENTRY(ast_autochan) list; + ast_mutex_t lock; }; /*! @@ -61,19 +62,24 @@ struct ast_autochan { * ast_autochan_channel_lock and ast_autochan_channel_unlock. An attempt to lock * the autochan->chan directly may result in it being changed after you've * retrieved the value of chan, but before you've had a chance to lock it. - * First when chan is locked, the autochan structure is guaranteed to keep the + * While chan is locked, the autochan structure is guaranteed to keep the * same channel. */ +/*! + * \brief Lock the autochan's channel lock. + * + * \note We must do deadlock avoidance because the channel lock is + * superior to the autochan lock in locking order. + */ #define ast_autochan_channel_lock(autochan) \ do { \ - struct ast_channel *autochan_chan = autochan->chan; \ - ast_channel_lock(autochan_chan); \ - if (autochan->chan == autochan_chan) { \ - break; \ + ast_mutex_lock(&(autochan)->lock); \ + while (ast_channel_trylock((autochan)->chan)) { \ + DEADLOCK_AVOIDANCE(&(autochan)->lock); \ } \ - ast_channel_unlock(autochan_chan); \ - } while (1) + ast_mutex_unlock(&(autochan)->lock); \ + } while (0) #define ast_autochan_channel_unlock(autochan) \ ast_channel_unlock(autochan->chan) diff --git a/include/asterisk/network.h b/include/asterisk/network.h index 3371e5895..5216f4c61 100644 --- a/include/asterisk/network.h +++ b/include/asterisk/network.h @@ -86,6 +86,11 @@ const char *ast_inet_ntoa(struct in_addr ia); #endif #define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__ +#ifdef getprotobyname +#undef getprotobyname +#endif +#define getprotobyname __getprotobyname_is_not_threadsafe__do_not_use__ + /*! \brief Compares the source address and port of two sockaddr_in */ static force_inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2) { diff --git a/include/asterisk/res_hep.h b/include/asterisk/res_hep.h index cfd213ad7..dba86e88b 100644 --- a/include/asterisk/res_hep.h +++ b/include/asterisk/res_hep.h @@ -72,6 +72,8 @@ struct hepv3_capture_info { size_t len; /*! If non-zero, the payload accompanying this capture info will be compressed */ unsigned int zipped:1; + /*! The IPPROTO_* protocol where we captured the packet */ + int protocol_id; }; /*! diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index d8e172fc5..05a3eea44 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -194,6 +194,8 @@ struct ast_sip_transport { int write_timeout; /*! Allow reload */ int allow_reload; + /*! Automatically send requests out the same transport requests have come in on */ + int symmetric_transport; }; #define SIP_SORCERY_DOMAIN_ALIAS_TYPE "domain_alias" @@ -755,8 +757,14 @@ struct ast_sip_endpoint { char *contact_user; /*! Do we allow an asymmetric RTP codec? */ unsigned int asymmetric_rtp_codec; + /*! Use RTCP-MUX */ + unsigned int rtcp_mux; }; +/*! URI parameter for symmetric transport */ +#define AST_SIP_X_AST_TXP "x-ast-txp" +#define AST_SIP_X_AST_TXP_LEN 9 + /*! * \brief Initialize an auth vector with the configured values. * @@ -1700,6 +1708,26 @@ pjsip_dialog *ast_sip_create_dialog_uas(const struct ast_sip_endpoint *endpoint, /*! * \brief General purpose method for creating an rdata structure using specific information + * \since 13.15.0 + * + * \param rdata[out] The rdata structure that will be populated + * \param packet A SIP message + * \param src_name The source IP address of the message + * \param src_port The source port of the message + * \param transport_type The type of transport the message was received on + * \param local_name The local IP address the message was received on + * \param local_port The local port the message was received on + * \param contact_uri The contact URI of the message + * + * \retval 0 success + * \retval -1 failure + */ +int ast_sip_create_rdata_with_contact(pjsip_rx_data *rdata, char *packet, + const char *src_name, int src_port, char *transport_type, const char *local_name, + int local_port, const char *contact_uri); + +/*! + * \brief General purpose method for creating an rdata structure using specific information * * \param rdata[out] The rdata structure that will be populated * \param packet A SIP message @@ -1712,8 +1740,8 @@ pjsip_dialog *ast_sip_create_dialog_uas(const struct ast_sip_endpoint *endpoint, * \retval 0 success * \retval -1 failure */ -int ast_sip_create_rdata(pjsip_rx_data *rdata, char *packet, const char *src_name, int src_port, char *transport_type, - const char *local_name, int local_port); +int ast_sip_create_rdata(pjsip_rx_data *rdata, char *packet, const char *src_name, + int src_port, char *transport_type, const char *local_name, int local_port); /*! * \brief General purpose method for creating a SIP request @@ -2752,4 +2780,54 @@ void ast_sip_modify_id_header(pj_pool_t *pool, pjsip_fromto_hdr *id_hdr, void ast_sip_get_unidentified_request_thresholds(unsigned int *count, unsigned int *period, unsigned int *prune_interval); +/*! + * \brief Get the transport name from an endpoint or request uri + * \since 13.15.0 + * + * \param endpoint + * \param sip_uri + * \param buf Buffer to receive transport name + * \param buf_len Buffer length + * + * \retval 0 Success + * \retval -1 Failure + * + * \note + * If endpoint->transport is not NULL, it is returned in buf. + * Otherwise if sip_uri has an 'x-ast-txp' parameter AND the sip_uri host is + * an ip4 or ip6 address, its value is returned, + */ +int ast_sip_get_transport_name(const struct ast_sip_endpoint *endpoint, + pjsip_sip_uri *sip_uri, char *buf, size_t buf_len); + +/*! + * \brief Sets pjsip_tpselector from an endpoint or uri + * \since 13.15.0 + * + * \param endpoint If endpoint->transport is set, it's used + * \param sip_uri If sip_uri contains a x-ast-txp parameter, it's used + * \param selector The selector to be populated + * + * \retval 0 success + * \retval -1 failure + */ +int ast_sip_set_tpselector_from_ep_or_uri(const struct ast_sip_endpoint *endpoint, + pjsip_sip_uri *sip_uri, pjsip_tpselector *selector); + +/*! + * \brief Set the transport on a dialog + * \since 13.15.0 + * + * \param endpoint + * \param dlg + * \param selector (optional) + * + * \note + * This API calls ast_sip_get_transport_name(endpoint, dlg->target) and if the result is + * non-NULL, calls pjsip_dlg_set_transport. If 'selector' is non-NULL, it is updated with + * the selector used. + */ +int ast_sip_dlg_set_transport(const struct ast_sip_endpoint *endpoint, pjsip_dialog *dlg, + pjsip_tpselector *selector); + #endif /* _RES_PJSIP_H */ diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h index 7e65e6d7c..c41cc3ab9 100644 --- a/include/asterisk/res_pjsip_session.h +++ b/include/asterisk/res_pjsip_session.h @@ -83,6 +83,8 @@ struct ast_sip_session_media { int timeout_sched_id; /*! \brief Stream is on hold */ unsigned int held:1; + /*! \brief Does remote support rtcp_mux */ + unsigned int remote_rtcp_mux:1; /*! \brief Stream type this session media handles */ char stream_type[1]; }; diff --git a/include/asterisk/rtp_engine.h b/include/asterisk/rtp_engine.h index c4a5b6b41..e8f3d78b4 100644 --- a/include/asterisk/rtp_engine.h +++ b/include/asterisk/rtp_engine.h @@ -237,6 +237,15 @@ enum ast_rtp_instance_stat { AST_RTP_INSTANCE_STAT_RXOCTETCOUNT, }; +enum ast_rtp_instance_rtcp { + /*! RTCP should not be sent/received */ + AST_RTP_INSTANCE_RTCP_DISABLED = 0, + /*! RTCP should be sent/received based on standard port rules */ + AST_RTP_INSTANCE_RTCP_STANDARD, + /*! RTCP should be sent/received on the same port as RTP */ + AST_RTP_INSTANCE_RTCP_MUX, +}; + /* Codes for RTP-specific data - not defined by our AST_FORMAT codes */ /*! DTMF (RFC2833) */ #define AST_RTP_DTMF (1 << 0) @@ -443,6 +452,8 @@ struct ast_rtp_engine_ice { void (*turn_request)(struct ast_rtp_instance *instance, enum ast_rtp_ice_component_type component, enum ast_transport transport, const char *server, unsigned int port, const char *username, const char *password); + /*! Callback to alter the number of ICE components on a session */ + void (*change_components)(struct ast_rtp_instance *instance, int num_components); }; /*! \brief DTLS setup types */ |