[asterisk-commits] mmichelson: trunk r395748 - in /trunk: channels/ include/asterisk/ res/ res/r...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 30 10:18:01 CDT 2013
Author: mmichelson
Date: Tue Jul 30 10:17:56 2013
New Revision: 395748
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395748
Log:
Reorganize the ast_sip_endpoint structure into substructures.
(closes issue ASTERISK-22135)
reported by Matt Jordan
Review: https://reviewboard.asterisk.org/r/2707
Modified:
trunk/channels/chan_gulp.c
trunk/include/asterisk/res_sip.h
trunk/res/res_sip.c
trunk/res/res_sip.exports.in
trunk/res/res_sip/sip_configuration.c
trunk/res/res_sip/sip_distributor.c
trunk/res/res_sip/sip_options.c
trunk/res/res_sip/sip_outbound_auth.c
trunk/res/res_sip_authenticator_digest.c
trunk/res/res_sip_caller_id.c
trunk/res/res_sip_diversion.c
trunk/res/res_sip_messaging.c
trunk/res/res_sip_mwi.c
trunk/res/res_sip_nat.c
trunk/res/res_sip_one_touch_record_info.c
trunk/res/res_sip_outbound_authenticator_digest.c
trunk/res/res_sip_outbound_registration.c
trunk/res/res_sip_pubsub.c
trunk/res/res_sip_sdp_rtp.c
trunk/res/res_sip_session.c
trunk/res/res_sip_t38.c
Modified: trunk/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_gulp.c?view=diff&rev=395748&r1=395747&r2=395748
==============================================================================
--- trunk/channels/chan_gulp.c (original)
+++ trunk/channels/chan_gulp.c Tue Jul 30 10:17:56 2013
@@ -386,11 +386,11 @@
ao2_ref(*instance, +1);
ast_assert(endpoint != NULL);
- if (endpoint->media_encryption != AST_SIP_MEDIA_ENCRYPT_NONE) {
+ if (endpoint->media.rtp.encryption != AST_SIP_MEDIA_ENCRYPT_NONE) {
return AST_RTP_GLUE_RESULT_FORBID;
}
- if (endpoint->direct_media) {
+ if (endpoint->media.direct_media.enabled) {
return AST_RTP_GLUE_RESULT_REMOTE;
}
@@ -414,7 +414,7 @@
ao2_ref(*instance, +1);
ast_assert(endpoint != NULL);
- if (endpoint->media_encryption != AST_SIP_MEDIA_ENCRYPT_NONE) {
+ if (endpoint->media.rtp.encryption != AST_SIP_MEDIA_ENCRYPT_NONE) {
return AST_RTP_GLUE_RESULT_FORBID;
}
@@ -426,14 +426,15 @@
{
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
- ast_format_cap_copy(result, channel->session->endpoint->codecs);
+ ast_format_cap_copy(result, channel->session->endpoint->media.codecs);
}
static int send_direct_media_request(void *data)
{
RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
- return ast_sip_session_refresh(session, NULL, NULL, NULL, session->endpoint->direct_media_method, 1);
+ return ast_sip_session_refresh(session, NULL, NULL, NULL,
+ session->endpoint->media.direct_media.method, 1);
}
static struct ast_datastore_info direct_media_mitigation_info = { };
@@ -442,7 +443,7 @@
{
RAII_VAR(struct ast_datastore *, datastore, NULL, ao2_cleanup);
- if (session->endpoint->direct_media_glare_mitigation ==
+ if (session->endpoint->media.direct_media.glare_mitigation ==
AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE) {
return 0;
}
@@ -455,10 +456,10 @@
/* Removing the datastore ensures we won't try to mitigate glare on subsequent reinvites */
ast_sip_session_remove_datastore(session, "direct_media_glare_mitigation");
- if ((session->endpoint->direct_media_glare_mitigation ==
+ if ((session->endpoint->media.direct_media.glare_mitigation ==
AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING &&
session->inv_session->role == PJSIP_ROLE_UAC) ||
- (session->endpoint->direct_media_glare_mitigation ==
+ (session->endpoint->media.direct_media.glare_mitigation ==
AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING &&
session->inv_session->role == PJSIP_ROLE_UAS)) {
return 1;
@@ -511,7 +512,7 @@
}
ast_channel_cleanup(bridge_peer);
- if (nat_active && session->endpoint->disable_direct_media_on_nat) {
+ if (nat_active && session->endpoint->media.direct_media.disable_on_nat) {
return 0;
}
@@ -589,13 +590,13 @@
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_VIDEO]->rtp, ast_channel_uniqueid(chan));
}
- if (ast_format_cap_is_empty(session->req_caps) || !ast_format_cap_has_joint(session->req_caps, session->endpoint->codecs)) {
- ast_format_cap_copy(ast_channel_nativeformats(chan), session->endpoint->codecs);
+ if (ast_format_cap_is_empty(session->req_caps) || !ast_format_cap_has_joint(session->req_caps, session->endpoint->media.codecs)) {
+ ast_format_cap_copy(ast_channel_nativeformats(chan), session->endpoint->media.codecs);
} else {
ast_format_cap_copy(ast_channel_nativeformats(chan), session->req_caps);
}
- ast_codec_choose(&session->endpoint->prefs, ast_channel_nativeformats(chan), 1, &fmt);
+ ast_codec_choose(&session->endpoint->media.prefs, ast_channel_nativeformats(chan), 1, &fmt);
ast_format_copy(ast_channel_writeformat(chan), &fmt);
ast_format_copy(ast_channel_rawwriteformat(chan), &fmt);
ast_format_copy(ast_channel_readformat(chan), &fmt);
@@ -611,11 +612,11 @@
ast_channel_exten_set(chan, S_OR(exten, "s"));
ast_channel_priority_set(chan, 1);
- ast_channel_callgroup_set(chan, session->endpoint->callgroup);
- ast_channel_pickupgroup_set(chan, session->endpoint->pickupgroup);
-
- ast_channel_named_callgroups_set(chan, session->endpoint->named_callgroups);
- ast_channel_named_pickupgroups_set(chan, session->endpoint->named_pickupgroups);
+ ast_channel_callgroup_set(chan, session->endpoint->pickup.callgroup);
+ ast_channel_pickupgroup_set(chan, session->endpoint->pickup.pickupgroup);
+
+ ast_channel_named_callgroups_set(chan, session->endpoint->pickup.named_callgroups);
+ ast_channel_named_pickupgroups_set(chan, session->endpoint->pickup.named_pickupgroups);
if (!ast_strlen_zero(session->endpoint->language)) {
ast_channel_language_set(chan, session->endpoint->language);
@@ -942,7 +943,7 @@
switch (option) {
case AST_OPTION_T38_STATE:
- if (session->endpoint->t38udptl) {
+ if (session->endpoint->media.t38.enabled) {
switch (session->t38state) {
case T38_LOCAL_REINVITE:
case T38_PEER_REINVITE:
@@ -1085,7 +1086,7 @@
}
}
} else {
- enum ast_sip_session_refresh_method method = session->endpoint->connected_line_method;
+ enum ast_sip_session_refresh_method method = session->endpoint->id.refresh_method;
if (session->inv_session->invite_tsx && (session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE)) {
method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
@@ -1891,7 +1892,7 @@
{
RAII_VAR(struct ast_datastore *, datastore, NULL, ao2_cleanup);
- if (session->endpoint->direct_media_glare_mitigation ==
+ if (session->endpoint->media.direct_media.glare_mitigation ==
AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE) {
return;
}
@@ -2007,7 +2008,7 @@
static int gulp_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
{
if (rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD) {
- if (session->endpoint->direct_media) {
+ if (session->endpoint->media.direct_media.enabled) {
ast_queue_control(session->channel, AST_CONTROL_SRCCHANGE);
}
}
Modified: trunk/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/res_sip.h?view=diff&rev=395748&r1=395747&r2=395748
==============================================================================
--- trunk/include/asterisk/res_sip.h (original)
+++ trunk/include/asterisk/res_sip.h Tue Jul 30 10:17:56 2013
@@ -270,14 +270,19 @@
enum ast_sip_auth_type type;
};
+struct ast_sip_auth_array {
+ /*! Array of Sorcery IDs of auth sections */
+ const char **names;
+ /*! Number of credentials in the array */
+ unsigned int num;
+};
+
/*!
* \brief Different methods by which incoming requests can be matched to endpoints
*/
enum ast_sip_endpoint_identifier_type {
/*! Identify based on user name in From header */
AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME = (1 << 0),
- /*! Identify based on source location of the SIP message */
- AST_SIP_ENDPOINT_IDENTIFY_BY_LOCATION = (1 << 1),
};
enum ast_sip_session_refresh_method {
@@ -312,6 +317,207 @@
};
/*!
+ * \brief Session timers options
+ */
+struct ast_sip_timer_options {
+ /*! Minimum session expiration period, in seconds */
+ unsigned int min_se;
+ /*! Session expiration period, in seconds */
+ unsigned int sess_expires;
+};
+
+/*!
+ * \brief Endpoint configuration for SIP extensions.
+ *
+ * SIP extensions, in this case refers to features
+ * indicated in Supported or Required headers.
+ */
+struct ast_sip_endpoint_extensions {
+ /*! Enabled SIP extensions */
+ unsigned int flags;
+ /*! Timer options */
+ struct ast_sip_timer_options timer;
+};
+
+/*!
+ * \brief Endpoint configuration for unsolicited MWI
+ */
+struct ast_sip_mwi_configuration {
+ AST_DECLARE_STRING_FIELDS(
+ /*! Configured voicemail boxes for this endpoint. Used for MWI */
+ AST_STRING_FIELD(mailboxes);
+ /*! Username to use when sending MWI NOTIFYs to this endpoint */
+ AST_STRING_FIELD(fromuser);
+ );
+ /* Should mailbox states be combined into a single notification? */
+ unsigned int aggregate;
+};
+
+/*!
+ * \brief Endpoint subscription configuration
+ */
+struct ast_sip_endpoint_subscription_configuration {
+ /*! Indicates if endpoint is allowed to initiate subscriptions */
+ unsigned int allow;
+ /*! The minimum allowed expiration for subscriptions from endpoint */
+ unsigned int minexpiry;
+ /*! Message waiting configuration */
+ struct ast_sip_mwi_configuration mwi;
+};
+
+/*!
+ * \brief NAT configuration options for endpoints
+ */
+struct ast_sip_endpoint_nat_configuration {
+ /*! Whether to force using the source IP address/port for sending responses */
+ unsigned int force_rport;
+ /*! Whether to rewrite the Contact header with the source IP address/port or not */
+ unsigned int rewrite_contact;
+};
+
+/*!
+ * \brief Party identification options for endpoints
+ *
+ * This includes caller ID, connected line, and redirecting-related options
+ */
+struct ast_sip_endpoint_id_configuration {
+ struct ast_party_id self;
+ /*! Do we accept identification information from this endpoint */
+ unsigned int trust_inbound;
+ /*! Do we send private identification information to this endpoint? */
+ unsigned int trust_outbound;
+ /*! Do we send P-Asserted-Identity headers to this endpoint? */
+ unsigned int send_pai;
+ /*! Do we send Remote-Party-ID headers to this endpoint? */
+ unsigned int send_rpid;
+ /*! Do we add Diversion headers to applicable outgoing requests/responses? */
+ unsigned int send_diversion;
+ /*! When performing connected line update, which method should be used */
+ enum ast_sip_session_refresh_method refresh_method;
+};
+
+/*!
+ * \brief Call pickup configuration options for endpoints
+ */
+struct ast_sip_endpoint_pickup_configuration {
+ /*! Call group */
+ ast_group_t callgroup;
+ /*! Pickup group */
+ ast_group_t pickupgroup;
+ /*! Named call group */
+ struct ast_namedgroups *named_callgroups;
+ /*! Named pickup group */
+ struct ast_namedgroups *named_pickupgroups;
+};
+
+/*!
+ * \brief Configuration for one-touch INFO recording
+ */
+struct ast_sip_info_recording_configuration {
+ AST_DECLARE_STRING_FIELDS(
+ /*! Feature to enact when one-touch recording INFO with Record: On is received */
+ AST_STRING_FIELD(onfeature);
+ /*! Feature to enact when one-touch recording INFO with Record: Off is received */
+ AST_STRING_FIELD(offfeature);
+ );
+ /*! Is one-touch recording permitted? */
+ unsigned int enabled;
+};
+
+/*!
+ * \brief Endpoint configuration options for INFO packages
+ */
+struct ast_sip_endpoint_info_configuration {
+ /*! Configuration for one-touch recording */
+ struct ast_sip_info_recording_configuration recording;
+};
+
+/*!
+ * \brief RTP configuration for SIP endpoints
+ */
+struct ast_sip_media_rtp_configuration {
+ AST_DECLARE_STRING_FIELDS(
+ /*! Configured RTP engine for this endpoint. */
+ AST_STRING_FIELD(engine);
+ );
+ /*! Whether IPv6 RTP is enabled or not */
+ unsigned int ipv6;
+ /*! Whether symmetric RTP is enabled or not */
+ unsigned int symmetric;
+ /*! Whether ICE support is enabled or not */
+ unsigned int ice_support;
+ /*! Whether to use the "ptime" attribute received from the endpoint or not */
+ unsigned int use_ptime;
+ /*! Do we use AVPF exclusively for this endpoint? */
+ unsigned int use_avpf;
+ /*! \brief DTLS-SRTP configuration information */
+ struct ast_rtp_dtls_cfg dtls_cfg;
+ /*! Should SRTP use a 32 byte tag instead of an 80 byte tag? */
+ unsigned int srtp_tag_32;
+ /*! Do we use media encryption? what type? */
+ enum ast_sip_session_media_encryption encryption;
+};
+
+/*!
+ * \brief Direct media options for SIP endpoints
+ */
+struct ast_sip_direct_media_configuration {
+ /*! Boolean indicating if direct_media is permissible */
+ unsigned int enabled;
+ /*! When using direct media, which method should be used */
+ enum ast_sip_session_refresh_method method;
+ /*! Take steps to mitigate glare for direct media */
+ enum ast_sip_direct_media_glare_mitigation glare_mitigation;
+ /*! Do not attempt direct media session refreshes if a media NAT is detected */
+ unsigned int disable_on_nat;
+};
+
+struct ast_sip_t38_configuration {
+ /*! Whether T.38 UDPTL support is enabled or not */
+ unsigned int enabled;
+ /*! Error correction setting for T.38 UDPTL */
+ enum ast_t38_ec_modes error_correction;
+ /*! Explicit T.38 max datagram value, may be 0 to indicate the remote side can be trusted */
+ unsigned int maxdatagram;
+ /*! Whether NAT Support is enabled for T.38 UDPTL sessions or not */
+ unsigned int nat;
+ /*! Whether to use IPv6 for UDPTL or not */
+ unsigned int ipv6;
+};
+
+/*!
+ * \brief Media configuration for SIP endpoints
+ */
+struct ast_sip_endpoint_media_configuration {
+ AST_DECLARE_STRING_FIELDS(
+ /*! Optional external media address to use in SDP */
+ AST_STRING_FIELD(external_address);
+ /*! SDP origin username */
+ AST_STRING_FIELD(sdpowner);
+ /*! SDP session name */
+ AST_STRING_FIELD(sdpsession);
+ );
+ /*! RTP media configuration */
+ struct ast_sip_media_rtp_configuration rtp;
+ /*! Direct media options */
+ struct ast_sip_direct_media_configuration direct_media;
+ /*! T.38 (FoIP) options */
+ struct ast_sip_t38_configuration t38;
+ /*! Codec preferences */
+ struct ast_codec_pref prefs;
+ /*! Configured codecs */
+ struct ast_format_cap *codecs;
+ /*! DSCP TOS bits for audio streams */
+ unsigned int tos_audio;
+ /*! Priority for audio streams */
+ unsigned int cos_audio;
+ /*! DSCP TOS bits for video streams */
+ unsigned int tos_video;
+ /*! Priority for video streams */
+ unsigned int cos_video;
+};
+
+/*!
* \brief An entity with which Asterisk communicates
*/
struct ast_sip_endpoint {
@@ -325,148 +531,67 @@
AST_STRING_FIELD(outbound_proxy);
/*! Explicit AORs to dial if none are specified */
AST_STRING_FIELD(aors);
- /*! Musiconhold class to suggest that the other side use when placing on hold */
- AST_STRING_FIELD(mohsuggest);
- /*! Optional external media address to use in SDP */
- AST_STRING_FIELD(external_media_address);
- /*! Configured voicemail boxes for this endpoint. Used for MWI */
- AST_STRING_FIELD(mailboxes);
- /*! Configured RTP engine for this endpoint. */
- AST_STRING_FIELD(rtp_engine);
+ /*! Musiconhold class to suggest that the other side use when placing on hold */
+ AST_STRING_FIELD(mohsuggest);
/*! Configured tone zone for this endpoint. */
AST_STRING_FIELD(zone);
/*! Configured language for this endpoint. */
AST_STRING_FIELD(language);
- /*! Feature to enact when one-touch recording INFO with Record: On is received */
- AST_STRING_FIELD(recordonfeature);
- /*! Feature to enact when one-touch recording INFO with Record: Off is received */
- AST_STRING_FIELD(recordofffeature);
- /*! SDP origin username */
- AST_STRING_FIELD(sdpowner);
- /*! SDP session name */
- AST_STRING_FIELD(sdpsession);
/*! Default username to place in From header */
AST_STRING_FIELD(fromuser);
/*! Domain to place in From header */
AST_STRING_FIELD(fromdomain);
- /*! Username to use when sending MWI NOTIFYs to this endpoint */
- AST_STRING_FIELD(mwi_from);
);
- /*! Identification information for this endpoint */
- struct ast_party_id id;
- /*! Domain to which this endpoint belongs */
- struct ast_sip_domain *domain;
- /*! Address of record for incoming registrations */
- struct ast_sip_aor *aor;
- /*! Codec preferences */
- struct ast_codec_pref prefs;
- /*! Configured codecs */
- struct ast_format_cap *codecs;
- /*! Names of inbound authentication credentials */
- const char **sip_inbound_auths;
- /*! Number of configured auths */
- size_t num_inbound_auths;
- /*! Names of outbound authentication credentials */
- const char **sip_outbound_auths;
- /*! Number of configured outbound auths */
- size_t num_outbound_auths;
+ /*! Configuration for extensions */
+ struct ast_sip_endpoint_extensions extensions;
+ /*! Configuration relating to media */
+ struct ast_sip_endpoint_media_configuration media;
+ /*! SUBSCRIBE/NOTIFY configuration options */
+ struct ast_sip_endpoint_subscription_configuration subscription;
+ /*! NAT configuration */
+ struct ast_sip_endpoint_nat_configuration nat;
+ /*! Party identification options */
+ struct ast_sip_endpoint_id_configuration id;
+ /*! Configuration options for INFO packages */
+ struct ast_sip_endpoint_info_configuration info;
+ /*! Call pickup configuration */
+ struct ast_sip_endpoint_pickup_configuration pickup;
+ /*! Inbound authentication credentials */
+ struct ast_sip_auth_array inbound_auths;
+ /*! Outbound authentication credentials */
+ struct ast_sip_auth_array outbound_auths;
/*! DTMF mode to use with this endpoint */
enum ast_sip_dtmf_mode dtmf;
- /*! Whether IPv6 RTP is enabled or not */
- unsigned int rtp_ipv6;
- /*! Whether symmetric RTP is enabled or not */
- unsigned int rtp_symmetric;
- /*! Whether ICE support is enabled or not */
- unsigned int ice_support;
- /*! Whether to use the "ptime" attribute received from the endpoint or not */
- unsigned int use_ptime;
- /*! Whether to force using the source IP address/port for sending responses */
- unsigned int force_rport;
- /*! Whether to rewrite the Contact header with the source IP address/port or not */
- unsigned int rewrite_contact;
- /*! Enabled SIP extensions */
- unsigned int extensions;
- /*! Minimum session expiration period, in seconds */
- unsigned int min_se;
- /*! Session expiration period, in seconds */
- unsigned int sess_expires;
- /*! List of outbound registrations */
- AST_LIST_HEAD_NOLOCK(, ast_sip_registration) registrations;
/*! Method(s) by which the endpoint should be identified. */
enum ast_sip_endpoint_identifier_type ident_method;
- /*! Boolean indicating if direct_media is permissible */
- unsigned int direct_media;
- /*! When using direct media, which method should be used */
- enum ast_sip_session_refresh_method direct_media_method;
- /*! When performing connected line update, which method should be used */
- enum ast_sip_session_refresh_method connected_line_method;
- /*! Take steps to mitigate glare for direct media */
- enum ast_sip_direct_media_glare_mitigation direct_media_glare_mitigation;
- /*! Do not attempt direct media session refreshes if a media NAT is detected */
- unsigned int disable_direct_media_on_nat;
- /*! Do we trust the endpoint with our outbound identity? */
- unsigned int trust_id_outbound;
- /*! Do we trust identity information that originates externally (e.g. P-Asserted-Identity header)? */
- unsigned int trust_id_inbound;
- /*! Do we send P-Asserted-Identity headers to this endpoint? */
- unsigned int send_pai;
- /*! Do we send Remote-Party-ID headers to this endpoint? */
- unsigned int send_rpid;
- /*! Do we add Diversion headers to applicable outgoing requests/responses? */
- unsigned int send_diversion;
- /*! Should unsolicited MWI be aggregated into a single NOTIFY? */
- unsigned int aggregate_mwi;
- /*! Do we use media encryption? what type? */
- enum ast_sip_session_media_encryption media_encryption;
- /*! Do we use AVPF exclusively for this endpoint? */
- unsigned int use_avpf;
- /*! Is one-touch recording permitted? */
- unsigned int one_touch_recording;
/*! Boolean indicating if ringing should be sent as inband progress */
unsigned int inband_progress;
- /*! Call group */
- ast_group_t callgroup;
- /*! Pickup group */
- ast_group_t pickupgroup;
- /*! Named call group */
- struct ast_namedgroups *named_callgroups;
- /*! Named pickup group */
- struct ast_namedgroups *named_pickupgroups;
/*! Pointer to the persistent Asterisk endpoint */
struct ast_endpoint *persistent;
/*! The number of channels at which busy device state is returned */
unsigned int devicestate_busy_at;
- /*! Whether T.38 UDPTL support is enabled or not */
- unsigned int t38udptl;
- /*! Error correction setting for T.38 UDPTL */
- enum ast_t38_ec_modes t38udptl_ec;
- /*! Explicit T.38 max datagram value, may be 0 to indicate the remote side can be trusted */
- unsigned int t38udptl_maxdatagram;
/*! Whether fax detection is enabled or not (CNG tone detection) */
unsigned int faxdetect;
- /*! Whether NAT Support is enabled for T.38 UDPTL sessions or not */
- unsigned int t38udptl_nat;
- /*! Whether to use IPv6 for UDPTL or not */
- unsigned int t38udptl_ipv6;
/*! Determines if transfers (using REFER) are allowed by this endpoint */
unsigned int allowtransfer;
- /*! DSCP TOS bits for audio streams */
- unsigned int tos_audio;
- /*! Priority for audio streams */
- unsigned int cos_audio;
- /*! DSCP TOS bits for video streams */
- unsigned int tos_video;
- /*! Priority for video streams */
- unsigned int cos_video;
- /*! Indicates if endpoint is allowed to initiate subscriptions */
- unsigned int allowsubscribe;
- /*! The minimum allowed expiration for subscriptions from endpoint */
- unsigned int subminexpiry;
- /*! \brief DTLS-SRTP configuration information */
- struct ast_rtp_dtls_cfg dtls_cfg;
- /*! Should SRTP use a 32 byte tag instead of an 80 byte tag? */
- unsigned int srtp_tag_32;
-};
+};
+
+/*!
+ * \brief Initialize an auth array with the configured values.
+ *
+ * \param array Array to initialize
+ * \param auth_names Comma-separated list of names to set in the array
+ * \retval 0 Success
+ * \retval non-zero Failure
+ */
+int ast_sip_auth_array_init(struct ast_sip_auth_array *array, const char *auth_names);
+
+/*!
+ * \brief Free contents of an auth array.
+ *
+ * \param array Array whose contents are to be freed
+ */
+void ast_sip_auth_array_destroy(struct ast_sip_auth_array *array);
/*!
* \brief Possible returns from ast_sip_check_authentication
@@ -519,14 +644,13 @@
* \brief Create a new request with authentication credentials
*
* \param auths An array of IDs of auth sorcery objects
- * \param num_auths The number of IDs in the array
* \param challenge The SIP response with authentication challenge(s)
* \param tsx The transaction in which the challenge was received
* \param new_request The new SIP request with challenge response(s)
* \retval 0 Successfully created new request
* \retval -1 Failed to create a new request
*/
- int (*create_request_with_auth)(const char **auths, size_t num_auths, struct pjsip_rx_data *challenge,
+ int (*create_request_with_auth)(const struct ast_sip_auth_array *auths, struct pjsip_rx_data *challenge,
struct pjsip_transaction *tsx, struct pjsip_tx_data **new_request);
};
@@ -1183,7 +1307,7 @@
* callback in the \ref ast_sip_outbound_authenticator structure for details about
* the parameters and return values.
*/
-int ast_sip_create_request_with_auth(const char **auths, size_t num_auths, pjsip_rx_data *challenge,
+int ast_sip_create_request_with_auth(const struct ast_sip_auth_array *auths, pjsip_rx_data *challenge,
pjsip_transaction *tsx, pjsip_tx_data **new_request);
/*!
@@ -1294,11 +1418,10 @@
/*!
* \brief Retrieve relevant SIP auth structures from sorcery
*
- * \param auth_names The sorcery IDs of auths to retrieve
- * \param num_auths The number of auths to retrieve
+ * \param auths Array of sorcery IDs of auth credentials to retrieve
* \param[out] out The retrieved auths are stored here
*/
-int ast_sip_retrieve_auths(const char *auth_names[], size_t num_auths, struct ast_sip_auth **out);
+int ast_sip_retrieve_auths(const struct ast_sip_auth_array *auths, struct ast_sip_auth **out);
/*!
* \brief Clean up retrieved auth structures from memory
Modified: trunk/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_sip.c?view=diff&rev=395748&r1=395747&r2=395748
==============================================================================
--- trunk/res/res_sip.c (original)
+++ trunk/res/res_sip.c Tue Jul 30 10:17:56 2013
@@ -1068,14 +1068,14 @@
ast_module_unref(ast_module_info->self);
}
-int ast_sip_create_request_with_auth(const char **auths, size_t num_auths, pjsip_rx_data *challenge,
+int ast_sip_create_request_with_auth(const struct ast_sip_auth_array *auths, pjsip_rx_data *challenge,
pjsip_transaction *tsx, pjsip_tx_data **new_request)
{
if (!registered_outbound_authenticator) {
ast_log(LOG_WARNING, "No SIP outbound authenticator registered. Cannot respond to authentication challenge\n");
return -1;
}
- return registered_outbound_authenticator->create_request_with_auth(auths, num_auths, challenge, tsx, new_request);
+ return registered_outbound_authenticator->create_request_with_auth(auths, challenge, tsx, new_request);
}
struct endpoint_identifier_list {
@@ -1475,7 +1475,7 @@
return;
}
- if (!ast_sip_create_request_with_auth(endpoint->sip_outbound_auths, endpoint->num_outbound_auths, challenge, tsx, &tdata)) {
+ if (!ast_sip_create_request_with_auth(&endpoint->outbound_auths, challenge, tsx, &tdata)) {
pjsip_endpt_send_request(ast_sip_get_pjsip_endpoint(), tdata, -1, NULL, NULL);
}
}
Modified: trunk/res/res_sip.exports.in
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_sip.exports.in?view=diff&rev=395748&r1=395747&r2=395748
==============================================================================
--- trunk/res/res_sip.exports.in (original)
+++ trunk/res/res_sip.exports.in Tue Jul 30 10:17:56 2013
@@ -65,6 +65,8 @@
LINKER_SYMBOL_PREFIXast_sip_add_global_request_header;
LINKER_SYMBOL_PREFIXast_sip_add_global_response_header;
LINKER_SYMBOL_PREFIXast_sip_initialize_sorcery_global;
+ LINKER_SYMBOL_PREFIXast_sip_auth_array_init;
+ LINKER_SYMBOL_PREFIXast_sip_auth_array_destroy;
local:
*;
};
Modified: trunk/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_sip/sip_configuration.c?view=diff&rev=395748&r1=395747&r2=395748
==============================================================================
--- trunk/res/res_sip/sip_configuration.c (original)
+++ trunk/res/res_sip/sip_configuration.c Tue Jul 30 10:17:56 2013
@@ -247,11 +247,11 @@
struct ast_sip_endpoint *endpoint = obj;
if (ast_true(var->value)) {
- endpoint->extensions |= PJSIP_INV_SUPPORT_100REL;
+ endpoint->extensions.flags |= PJSIP_INV_SUPPORT_100REL;
} else if (ast_false(var->value)) {
- endpoint->extensions &= PJSIP_INV_SUPPORT_100REL;
+ endpoint->extensions.flags &= PJSIP_INV_SUPPORT_100REL;
} else if (!strcasecmp(var->value, "required")) {
- endpoint->extensions |= PJSIP_INV_REQUIRE_100REL;
+ endpoint->extensions.flags |= PJSIP_INV_REQUIRE_100REL;
} else {
return -1;
}
@@ -264,21 +264,21 @@
struct ast_sip_endpoint *endpoint = obj;
if (ast_true(var->value)) {
- endpoint->extensions |= PJSIP_INV_SUPPORT_TIMER;
+ endpoint->extensions.flags |= PJSIP_INV_SUPPORT_TIMER;
} else if (ast_false(var->value)) {
- endpoint->extensions &= PJSIP_INV_SUPPORT_TIMER;
+ endpoint->extensions.flags &= PJSIP_INV_SUPPORT_TIMER;
} else if (!strcasecmp(var->value, "required")) {
- endpoint->extensions |= PJSIP_INV_REQUIRE_TIMER;
+ endpoint->extensions.flags |= PJSIP_INV_REQUIRE_TIMER;
} else if (!strcasecmp(var->value, "always")) {
- endpoint->extensions |= PJSIP_INV_ALWAYS_USE_TIMER;
- } else {
- return -1;
- }
-
- return 0;
-}
-
-static void destroy_auths(const char **auths, size_t num_auths)
+ endpoint->extensions.flags |= PJSIP_INV_ALWAYS_USE_TIMER;
+ } else {
+ return -1;
+ }
+
+ return 0;
+}
+
+void ast_sip_auth_array_destroy(struct ast_sip_auth_array *auths)
{
int i;
@@ -286,63 +286,57 @@
return;
}
- for (i = 0; i < num_auths; ++i) {
- ast_free((char *) auths[i]);
- }
- ast_free(auths);
+ for (i = 0; i < auths->num; ++i) {
+ ast_free((char *) auths->names[i]);
+ }
+ ast_free(auths->names);
+ auths->num = 0;
}
#define AUTH_INCREMENT 4
-static const char **auth_alloc(const char *value, size_t *num_auths)
-{
- char *auths = ast_strdupa(value);
+int ast_sip_auth_array_init(struct ast_sip_auth_array *auths, const char *value)
+{
+ char *auth_names = ast_strdupa(value);
char *val;
int num_alloced = 0;
const char **alloced_auths = NULL;
- while ((val = strsep(&auths, ","))) {
- if (*num_auths >= num_alloced) {
+ while ((val = strsep(&auth_names, ","))) {
+ if (auths->num >= num_alloced) {
size_t size;
num_alloced += AUTH_INCREMENT;
size = num_alloced * sizeof(char *);
- alloced_auths = ast_realloc(alloced_auths, size);
- if (!alloced_auths) {
+ auths->names = ast_realloc(alloced_auths, size);
+ if (!auths->names) {
goto failure;
}
}
- alloced_auths[*num_auths] = ast_strdup(val);
- if (!alloced_auths[*num_auths]) {
+ auths->names[auths->num] = ast_strdup(val);
+ if (!auths->names[auths->num]) {
goto failure;
}
- ++(*num_auths);
- }
- return alloced_auths;
+ ++auths->num;
+ }
+ return 0;
failure:
- destroy_auths(alloced_auths, *num_auths);
- return NULL;
+ ast_sip_auth_array_destroy(auths);
+ return -1;
}
static int inbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct ast_sip_endpoint *endpoint = obj;
- endpoint->sip_inbound_auths = auth_alloc(var->value, &endpoint->num_inbound_auths);
- if (!endpoint->sip_inbound_auths) {
- return -1;
- }
- return 0;
-}
+ return ast_sip_auth_array_init(&endpoint->inbound_auths, var->value);
+}
+
static int outbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct ast_sip_endpoint *endpoint = obj;
- endpoint->sip_outbound_auths = auth_alloc(var->value, &endpoint->num_outbound_auths);
- if (!endpoint->sip_outbound_auths) {
- return -1;
- }
- return 0;
+ return ast_sip_auth_array_init(&endpoint->outbound_auths, var->value);
}
static int ident_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
@@ -354,8 +348,6 @@
while ((val = strsep(&idents, ","))) {
if (!strcasecmp(val, "username")) {
endpoint->ident_method |= AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME;
- } else if (!strcasecmp(val, "location")) {
- endpoint->ident_method |= AST_SIP_ENDPOINT_IDENTIFY_BY_LOCATION;
} else {
ast_log(LOG_ERROR, "Unrecognized identification method %s specified for endpoint %s\n",
val, ast_sorcery_object_get_id(endpoint));
@@ -370,9 +362,9 @@
struct ast_sip_endpoint *endpoint = obj;
if (!strcasecmp(var->value, "invite") || !strcasecmp(var->value, "reinvite")) {
- endpoint->direct_media_method = AST_SIP_SESSION_REFRESH_METHOD_INVITE;
+ endpoint->media.direct_media.method = AST_SIP_SESSION_REFRESH_METHOD_INVITE;
} else if (!strcasecmp(var->value, "update")) {
- endpoint->direct_media_method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
+ endpoint->media.direct_media.method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
} else {
ast_log(LOG_NOTICE, "Unrecognized option value %s for %s on endpoint %s\n",
var->value, var->name, ast_sorcery_object_get_id(endpoint));
@@ -386,9 +378,9 @@
struct ast_sip_endpoint *endpoint = obj;
if (!strcasecmp(var->value, "invite") || !strcasecmp(var->value, "reinvite")) {
- endpoint->connected_line_method = AST_SIP_SESSION_REFRESH_METHOD_INVITE;
+ endpoint->id.refresh_method = AST_SIP_SESSION_REFRESH_METHOD_INVITE;
} else if (!strcasecmp(var->value, "update")) {
- endpoint->connected_line_method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
+ endpoint->id.refresh_method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
} else {
ast_log(LOG_NOTICE, "Unrecognized option value %s for %s on endpoint %s\n",
var->value, var->name, ast_sorcery_object_get_id(endpoint));
@@ -402,11 +394,11 @@
struct ast_sip_endpoint *endpoint = obj;
if (!strcasecmp(var->value, "none")) {
- endpoint->direct_media_glare_mitigation = AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE;
+ endpoint->media.direct_media.glare_mitigation = AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE;
} else if (!strcasecmp(var->value, "outgoing")) {
- endpoint->direct_media_glare_mitigation = AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING;
+ endpoint->media.direct_media.glare_mitigation = AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING;
} else if (!strcasecmp(var->value, "incoming")) {
- endpoint->direct_media_glare_mitigation = AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING;
+ endpoint->media.direct_media.glare_mitigation = AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING;
} else {
ast_log(LOG_NOTICE, "Unrecognized option value %s for %s on endpoint %s\n",
var->value, var->name, ast_sorcery_object_get_id(endpoint));
@@ -424,18 +416,18 @@
ast_callerid_split(var->value, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
if (!ast_strlen_zero(cid_name)) {
- endpoint->id.name.str = ast_strdup(cid_name);
- if (!endpoint->id.name.str) {
+ endpoint->id.self.name.str = ast_strdup(cid_name);
+ if (!endpoint->id.self.name.str) {
return -1;
}
- endpoint->id.name.valid = 1;
+ endpoint->id.self.name.valid = 1;
}
if (!ast_strlen_zero(cid_num)) {
- endpoint->id.number.str = ast_strdup(cid_num);
- if (!endpoint->id.number.str) {
+ endpoint->id.self.number.str = ast_strdup(cid_num);
+ if (!endpoint->id.self.number.str) {
return -1;
}
- endpoint->id.number.valid = 1;
+ endpoint->id.self.number.valid = 1;
}
return 0;
}
@@ -447,16 +439,16 @@
if (callingpres == -1 && sscanf(var->value, "%d", &callingpres) != 1) {
return -1;
}
- endpoint->id.number.presentation = callingpres;
- endpoint->id.name.presentation = callingpres;
+ endpoint->id.self.number.presentation = callingpres;
+ endpoint->id.self.name.presentation = callingpres;
return 0;
}
static int caller_id_tag_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct ast_sip_endpoint *endpoint = obj;
- endpoint->id.tag = ast_strdup(var->value);
- return endpoint->id.tag ? 0 : -1;
+ endpoint->id.self.tag = ast_strdup(var->value);
+ return endpoint->id.self.tag ? 0 : -1;
}
static int media_encryption_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
@@ -464,12 +456,12 @@
struct ast_sip_endpoint *endpoint = obj;
if (!strcasecmp("no", var->value)) {
- endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_NONE;
+ endpoint->media.rtp.encryption = AST_SIP_MEDIA_ENCRYPT_NONE;
} else if (!strcasecmp("sdes", var->value)) {
- endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_SDES;
+ endpoint->media.rtp.encryption = AST_SIP_MEDIA_ENCRYPT_SDES;
} else if (!strcasecmp("dtls", var->value)) {
- endpoint->media_encryption = AST_SIP_MEDIA_ENCRYPT_DTLS;
- ast_rtp_dtls_cfg_parse(&endpoint->dtls_cfg, "dtlsenable", "yes");
+ endpoint->media.rtp.encryption = AST_SIP_MEDIA_ENCRYPT_DTLS;
+ ast_rtp_dtls_cfg_parse(&endpoint->media.rtp.dtls_cfg, "dtlsenable", "yes");
} else {
return -1;
}
@@ -483,11 +475,11 @@
struct ast_sip_endpoint *endpoint = obj;
if (!strncmp(var->name, "callgroup", 9)) {
- if (!(endpoint->callgroup = ast_get_group(var->value))) {
+ if (!(endpoint->pickup.callgroup = ast_get_group(var->value))) {
return -1;
}
} else if (!strncmp(var->name, "pickupgroup", 11)) {
- if (!(endpoint->pickupgroup = ast_get_group(var->value))) {
+ if (!(endpoint->pickup.pickupgroup = ast_get_group(var->value))) {
return -1;
}
} else {
@@ -503,12 +495,12 @@
struct ast_sip_endpoint *endpoint = obj;
if (!strncmp(var->name, "namedcallgroup", 14)) {
- if (!(endpoint->named_callgroups =
+ if (!(endpoint->pickup.named_callgroups =
ast_get_namedgroups(var->value))) {
return -1;
}
} else if (!strncmp(var->name, "namedpickupgroup", 16)) {
- if (!(endpoint->named_pickupgroups =
+ if (!(endpoint->pickup.named_pickupgroups =
ast_get_namedgroups(var->value))) {
return -1;
}
@@ -524,7 +516,7 @@
{
struct ast_sip_endpoint *endpoint = obj;
- return ast_rtp_dtls_cfg_parse(&endpoint->dtls_cfg, var->name, var->value);
+ return ast_rtp_dtls_cfg_parse(&endpoint->media.rtp.dtls_cfg, var->name, var->value);
}
static int t38udptl_ec_handler(const struct aco_option *opt,
@@ -533,11 +525,11 @@
struct ast_sip_endpoint *endpoint = obj;
if (!strcmp(var->value, "none")) {
- endpoint->t38udptl_ec = UDPTL_ERROR_CORRECTION_NONE;
+ endpoint->media.t38.error_correction = UDPTL_ERROR_CORRECTION_NONE;
} else if (!strcmp(var->value, "fec")) {
- endpoint->t38udptl_ec = UDPTL_ERROR_CORRECTION_FEC;
+ endpoint->media.t38.error_correction = UDPTL_ERROR_CORRECTION_FEC;
} else if (!strcmp(var->value, "redundancy")) {
- endpoint->t38udptl_ec = UDPTL_ERROR_CORRECTION_REDUNDANCY;
+ endpoint->media.t38.error_correction = UDPTL_ERROR_CORRECTION_REDUNDANCY;
} else {
return -1;
}
@@ -640,75 +632,74 @@
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "type", "", OPT_NOOP_T, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "context", "default", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, context));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disallow", "", OPT_CODEC_T, 0, FLDSET(struct ast_sip_endpoint, prefs, codecs));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow", "", OPT_CODEC_T, 1, FLDSET(struct ast_sip_endpoint, prefs, codecs));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disallow", "", OPT_CODEC_T, 0, FLDSET(struct ast_sip_endpoint, media.prefs, media.codecs));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow", "", OPT_CODEC_T, 1, FLDSET(struct ast_sip_endpoint, media.prefs, media.codecs));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtmfmode", "rfc4733", dtmf_handler, NULL, 0, 0);
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_ipv6", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, rtp_ipv6));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_symmetric", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, rtp_symmetric));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "ice_support", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, ice_support));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_ptime", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, use_ptime));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "force_rport", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, force_rport));
- ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rewrite_contact", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, rewrite_contact));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_ipv6", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.ipv6));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_symmetric", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.symmetric));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "ice_support", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.ice_support));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_ptime", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.use_ptime));
[... 1166 lines stripped ...]
More information about the asterisk-commits
mailing list