[asterisk-commits] mmichelson: branch mmichelson/sip_endpoint_reorg r395467 - in /team/mmichelso...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 25 17:15:20 CDT 2013


Author: mmichelson
Date: Thu Jul 25 17:15:18 2013
New Revision: 395467

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395467
Log:
Place media-related endpoint options into their own sub-structure.


Modified:
    team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c
    team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h
    team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c
    team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c
    team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c

Modified: team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c?view=diff&rev=395467&r1=395466&r2=395467
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c (original)
+++ team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c Thu Jul 25 17:15:18 2013
@@ -384,11 +384,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;
 	}
 
@@ -412,7 +412,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;
 	}
 
@@ -424,14 +424,14 @@
 {
 	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, session->endpoint->direct_media_method, 1);
+	return ast_sip_session_refresh(session, NULL, NULL, session->endpoint->media.direct_media.method, 1);
 }
 
 static struct ast_datastore_info direct_media_mitigation_info = { };
@@ -440,7 +440,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;
 	}
@@ -453,10 +453,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;
@@ -509,7 +509,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;
 	}
 
@@ -587,13 +587,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);
@@ -1782,7 +1782,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;
 	}
@@ -1898,7 +1898,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: team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h?view=diff&rev=395467&r1=395466&r2=395467
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h (original)
+++ team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h Thu Jul 25 17:15:18 2013
@@ -350,7 +350,7 @@
 		/*! Username to use when sending MWI NOTIFYs to this endpoint */
 		AST_STRING_FIELD(mwi_from);
 	);
-	/* Configuration for extensions (i.e. Supported and Required headers) */
+	/*! Configuration for extensions (i.e. Supported and Required headers) */
 	struct {
 		/*! Enabled SIP extensions */
 		unsigned int flags;
@@ -361,16 +361,57 @@
 			unsigned int sess_expires;
 		} timer;
 	} extensions;
+	/*! Configuration relating to media */
+	struct {
+		/*! RTP media configuration */
+		struct {
+			/*! 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;
+		} rtp;
+		/*! Direct media options */
+		struct {
+			/*! 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;
+		} direct_media;
+		/*! 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;
+	} media;
 	/*! 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 */
@@ -381,14 +422,6 @@
 	size_t num_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 */
@@ -397,16 +430,8 @@
 	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)? */
@@ -419,10 +444,6 @@
 	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 */
@@ -441,22 +462,10 @@
 	unsigned int devicestate_busy_at;
 	/*! 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;
 };
 
 /*!

Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c?view=diff&rev=395467&r1=395466&r2=395467
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c Thu Jul 25 17:15:18 2013
@@ -370,9 +370,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));
@@ -402,11 +402,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));
@@ -464,12 +464,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;
 	}
@@ -524,7 +524,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 void *sip_nat_hook_alloc(const char *name)
@@ -622,13 +622,13 @@
 
 	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", "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));
 	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", "transport", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, transport));
@@ -643,11 +643,11 @@
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aors", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, aors));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "external_media_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, external_media_address));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "identify_by", "username,location", ident_handler, NULL, 0, 0);
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "direct_media", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, direct_media));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "direct_media", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.enabled));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_method", "invite", direct_media_method_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "connected_line_method", "invite", connected_line_method_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_glare_mitigation", "none", direct_media_glare_mitigation_handler, NULL, 0, 0);
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, disable_direct_media_on_nat));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.disable_on_nat));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid", "", caller_id_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid_privacy", "", caller_id_privacy_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid_tag", "", caller_id_tag_handler, NULL, 0, 0);
@@ -659,7 +659,7 @@
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mailboxes", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, mailboxes));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aggregate_mwi", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, aggregate_mwi));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "media_encryption", "no", media_encryption_handler, NULL, 0, 0);
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_avpf", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, use_avpf));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_avpf", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.use_avpf));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "one_touch_recording", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, one_touch_recording));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "inband_progress", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, inband_progress));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callgroup", "", group_handler, NULL, 0, 0);
@@ -675,10 +675,10 @@
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allowtransfer", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allowtransfer));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdpowner", "-", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, sdpowner));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdpsession", "Asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, sdpsession));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, tos_audio));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, tos_video));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, cos_audio));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, cos_video));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.tos_audio));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.tos_video));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_audio));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_video));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allowsubscribe", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allowsubscribe));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subminexpiry", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subminexpiry));
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subminexpirey", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subminexpiry));
@@ -693,7 +693,7 @@
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtlscafile", "", dtls_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtlscapath", "", dtls_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtlssetup", "", dtls_handler, NULL, 0, 0);
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "srtp_tag_32", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, srtp_tag_32));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "srtp_tag_32", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.srtp_tag_32));
 
 	if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
 		ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
@@ -764,8 +764,8 @@
 
 	ast_string_field_free_memory(endpoint);
 
-	if (endpoint->codecs) {
-		ast_format_cap_destroy(endpoint->codecs);
+	if (endpoint->media.codecs) {
+		ast_format_cap_destroy(endpoint->media.codecs);
 	}
 	destroy_auths(endpoint->sip_inbound_auths, endpoint->num_inbound_auths);
 	destroy_auths(endpoint->sip_outbound_auths, endpoint->num_outbound_auths);
@@ -785,7 +785,7 @@
 		ao2_cleanup(endpoint);
 		return NULL;
 	}
-	if (!(endpoint->codecs = ast_format_cap_alloc_nolock())) {
+	if (!(endpoint->media.codecs = ast_format_cap_alloc_nolock())) {
 		ao2_cleanup(endpoint);
 		return NULL;
 	}

Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c?view=diff&rev=395467&r1=395466&r2=395467
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip_sdp_rtp.c Thu Jul 25 17:15:18 2013
@@ -114,16 +114,16 @@
 	}
 
 	ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_RTCP, 1);
-	ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_NAT, session->endpoint->rtp_symmetric);
+	ast_rtp_instance_set_prop(session_media->rtp, AST_RTP_PROPERTY_NAT, session->endpoint->media.rtp.symmetric);
 
 	ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(session_media->rtp),
-					 session_media->rtp, &session->endpoint->prefs);
+					 session_media->rtp, &session->endpoint->media.prefs);
 
 	if (session->endpoint->dtmf == AST_SIP_DTMF_INBAND) {
 		ast_rtp_instance_dtmf_mode_set(session_media->rtp, AST_RTP_DTMF_MODE_INBAND);
 	}
 
-	if (!session->endpoint->ice_support && (ice = ast_rtp_instance_get_ice(session_media->rtp))) {
+	if (!session->endpoint->media.rtp.ice_support && (ice = ast_rtp_instance_get_ice(session_media->rtp))) {
 		ice->stop(session_media->rtp);
 	}
 
@@ -134,13 +134,13 @@
 	}
 
 	if (!strcmp(session_media->stream_type, STR_AUDIO) &&
-			(session->endpoint->tos_audio || session->endpoint->cos_video)) {
-		ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->tos_audio,
-				session->endpoint->cos_audio, "SIP RTP Audio");
+			(session->endpoint->media.tos_audio || session->endpoint->media.cos_video)) {
+		ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->media.tos_audio,
+				session->endpoint->media.cos_audio, "SIP RTP Audio");
 	} else if (!strcmp(session_media->stream_type, STR_VIDEO) &&
-			(session->endpoint->tos_video || session->endpoint->cos_video)) {
-		ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->tos_video,
-				session->endpoint->cos_video, "SIP RTP Video");
+			(session->endpoint->media.tos_video || session->endpoint->media.cos_video)) {
+		ast_rtp_instance_set_qos(session_media->rtp, session->endpoint->media.tos_video,
+				session->endpoint->media.cos_video, "SIP RTP Video");
 	}
 
 	return 0;
@@ -213,9 +213,9 @@
 
 	/* get the endpoint capabilities */
 	if (direct_media_enabled) {
-		ast_format_cap_joint_copy(session->endpoint->codecs, session->direct_media_cap, caps);
+		ast_format_cap_joint_copy(session->endpoint->media.codecs, session->direct_media_cap, caps);
 	} else {
-		ast_format_cap_copy(caps, session->endpoint->codecs);
+		ast_format_cap_copy(caps, session->endpoint->media.codecs);
 	}
 	format_cap_only_type(caps, media_type);
 
@@ -246,7 +246,7 @@
 	if (session->channel) {
 		ast_format_cap_copy(caps, ast_channel_nativeformats(session->channel));
 		ast_format_cap_remove_bytype(caps, media_type);
-		ast_codec_choose(&session->endpoint->prefs, joint, 1, &fmt);
+		ast_codec_choose(&session->endpoint->media.prefs, joint, 1, &fmt);
 		ast_format_cap_add(caps, &fmt);
 
 		/* Apply the new formats to the channel, potentially changing read/write formats while doing so */
@@ -328,7 +328,7 @@
 	struct ao2_iterator it_candidates;
 	struct ast_rtp_engine_ice_candidate *candidate;
 
-	if (!session->endpoint->ice_support || !(ice = ast_rtp_instance_get_ice(session_media->rtp)) ||
+	if (!session->endpoint->media.rtp.ice_support || !(ice = ast_rtp_instance_get_ice(session_media->rtp)) ||
 		!(candidates = ice->get_local_candidates(session_media->rtp))) {
 		return;
 	}
@@ -387,7 +387,7 @@
 	unsigned int attr_i;
 
 	/* If ICE support is not enabled or available exit early */
-	if (!session->endpoint->ice_support || !(ice = ast_rtp_instance_get_ice(session_media->rtp))) {
+	if (!session->endpoint->media.rtp.ice_support || !(ice = ast_rtp_instance_get_ice(session_media->rtp))) {
 		return;
 	}
 
@@ -466,7 +466,7 @@
 	struct ast_codec_pref *pref = &ast_rtp_instance_get_codecs(session_media->rtp)->pref;
 
 	/* Apply packetization if available and configured to do so */
-	if (!session->endpoint->use_ptime || !(attr = pjmedia_sdp_media_find_attr2(remote_stream, "ptime", NULL))) {
+	if (!session->endpoint->media.rtp.use_ptime || !(attr = pjmedia_sdp_media_find_attr2(remote_stream, "ptime", NULL))) {
 		return;
 	}
 
@@ -517,7 +517,7 @@
 {
 	enum ast_sip_session_media_encryption incoming_encryption;
 
-	if (endpoint->use_avpf) {
+	if (endpoint->media.rtp.use_avpf) {
 		char transport_end = stream->desc.transport.ptr[stream->desc.transport.slen - 1];
 		if (transport_end != 'F') {
 			return AST_SIP_MEDIA_TRANSPORT_INVALID;
@@ -526,7 +526,7 @@
 
 	incoming_encryption = get_media_encryption_type(stream->desc.transport);
 
-	if (incoming_encryption == endpoint->media_encryption) {
+	if (incoming_encryption == endpoint->media.rtp.encryption) {
 		return incoming_encryption;
 	}
 
@@ -557,7 +557,7 @@
 {
 	struct ast_rtp_engine_dtls *dtls;
 
-	if (!session->endpoint->dtls_cfg.enabled || !session_media->rtp) {
+	if (!session->endpoint->media.rtp.dtls_cfg.enabled || !session_media->rtp) {
 		return -1;
 	}
 
@@ -566,8 +566,8 @@
 		return -1;
 	}
 
-	session->endpoint->dtls_cfg.suite = ((session->endpoint->srtp_tag_32) ? AST_AES_CM_128_HMAC_SHA1_32 : AST_AES_CM_128_HMAC_SHA1_80);
-	if (dtls->set_configuration(session_media->rtp, &session->endpoint->dtls_cfg)) {
+	session->endpoint->media.rtp.dtls_cfg.suite = ((session->endpoint->media.rtp.srtp_tag_32) ? AST_AES_CM_128_HMAC_SHA1_32 : AST_AES_CM_128_HMAC_SHA1_80);
+	if (dtls->set_configuration(session_media->rtp, &session->endpoint->media.rtp.dtls_cfg)) {
 		ast_log(LOG_ERROR, "Attempted to set an invalid DTLS-SRTP configuration on RTP instance '%p'\n",
 			session_media->rtp);
 		return -1;
@@ -675,7 +675,7 @@
 	struct ast_sip_session_media *session_media,
 	const struct pjmedia_sdp_media *stream)
 {
-	switch (session->endpoint->media_encryption) {
+	switch (session->endpoint->media.rtp.encryption) {
 	case AST_SIP_MEDIA_ENCRYPT_SDES:
 		if (setup_sdes_srtp(session_media, stream)) {
 			return -1;
@@ -706,7 +706,7 @@
 	enum ast_format_type media_type = stream_to_media_type(session_media->stream_type);
 
 	/* If no type formats have been configured reject this stream */
-	if (!ast_format_cap_has_type(session->endpoint->codecs, media_type)) {
+	if (!ast_format_cap_has_type(session->endpoint->media.codecs, media_type)) {
 		return 0;
 	}
 
@@ -750,7 +750,7 @@
 	static const pj_str_t STR_ACTPASS = { "actpass", 7 };
 	static const pj_str_t STR_HOLDCONN = { "holdconn", 8 };
 
-	switch (session->endpoint->media_encryption) {
+	switch (session->endpoint->media.rtp.encryption) {
 	case AST_SIP_MEDIA_ENCRYPT_NONE:
 	case AST_SIP_MEDIA_TRANSPORT_INVALID:
 		break;
@@ -764,7 +764,7 @@
 
 		crypto_attribute = ast_sdp_srtp_get_attrib(session_media->srtp,
 			0 /* DTLS running? No */,
-			session->endpoint->srtp_tag_32 /* 32 byte tag length? */);
+			session->endpoint->media.rtp.srtp_tag_32 /* 32 byte tag length? */);
 		if (!crypto_attribute) {
 			/* No crypto attribute to add, bad news */
 			return -1;
@@ -860,13 +860,13 @@
 
 	int use_override_prefs = session->override_prefs.formats[0].id;
 	struct ast_codec_pref *prefs = use_override_prefs ?
-		&session->override_prefs : &session->endpoint->prefs;
+		&session->override_prefs : &session->endpoint->media.prefs;
 
 	if ((use_override_prefs && !codec_pref_has_type(&session->override_prefs, media_type)) ||
-	    (!use_override_prefs && !ast_format_cap_has_type(session->endpoint->codecs, media_type))) {
+	    (!use_override_prefs && !ast_format_cap_has_type(session->endpoint->media.codecs, media_type))) {
 		/* If no type formats are configured don't add a stream */
 		return 0;
-	} else if (!session_media->rtp && create_rtp(session, session_media, session->endpoint->rtp_ipv6)) {
+	} else if (!session_media->rtp && create_rtp(session, session_media, session->endpoint->media.rtp.ipv6)) {
 		return -1;
 	}
 
@@ -881,8 +881,8 @@
 
 	media->desc.media = pj_str(session_media->stream_type);
 	media->desc.transport = pj_str(ast_sdp_get_rtp_profile(
-		session->endpoint->media_encryption == AST_SIP_MEDIA_ENCRYPT_SDES,
-		session_media->rtp, session->endpoint->use_avpf));
+		session->endpoint->media.rtp.encryption == AST_SIP_MEDIA_ENCRYPT_SDES,
+		session_media->rtp, session->endpoint->media.rtp.use_avpf));
 
 	/* Add connection level details */
 	if (direct_media_enabled) {
@@ -890,7 +890,7 @@
 	} else if (ast_strlen_zero(session->endpoint->external_media_address)) {
 		pj_sockaddr localaddr;
 
-		if (pj_gethostip(session->endpoint->rtp_ipv6 ? pj_AF_INET6() : pj_AF_INET(), &localaddr)) {
+		if (pj_gethostip(session->endpoint->media.rtp.ipv6 ? pj_AF_INET6() : pj_AF_INET(), &localaddr)) {
 			return -1;
 		}
 		pj_sockaddr_print(&localaddr, hostip, sizeof(hostip), 2);
@@ -899,7 +899,7 @@
 	}
 
 	media->conn->net_type = STR_IN;
-	media->conn->addr_type = session->endpoint->rtp_ipv6 ? STR_IP6 : STR_IP4;
+	media->conn->addr_type = session->endpoint->media.rtp.ipv6 ? STR_IP6 : STR_IP4;
 	pj_strdup2(pool, &media->conn->addr, hostip);
 	ast_rtp_instance_get_local_address(session_media->rtp, &addr);
 	media->desc.port = direct_media_enabled ? ast_sockaddr_port(&session_media->direct_media_addr) : (pj_uint16_t) ast_sockaddr_port(&addr);
@@ -914,9 +914,9 @@
 	}
 
 	if (direct_media_enabled) {
-		ast_format_cap_joint_copy(session->endpoint->codecs, session->direct_media_cap, caps);
-	} else if (ast_format_cap_is_empty(session->req_caps) || !ast_format_cap_has_joint(session->req_caps, session->endpoint->codecs)) {
-		ast_format_cap_copy(caps, session->endpoint->codecs);
+		ast_format_cap_joint_copy(session->endpoint->media.codecs, session->direct_media_cap, caps);
+	} else 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(caps, session->endpoint->media.codecs);
 	} else {
 		ast_format_cap_copy(caps, session->req_caps);
 	}
@@ -1013,7 +1013,7 @@
 	}
 
 	/* Create an RTP instance if need be */
-	if (!session_media->rtp && create_rtp(session, session_media, session->endpoint->rtp_ipv6)) {
+	if (!session_media->rtp && create_rtp(session, session_media, session->endpoint->media.rtp.ipv6)) {
 		return -1;
 	}
 

Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c?view=diff&rev=395467&r1=395466&r2=395467
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip_session.c Thu Jul 25 17:15:18 2013
@@ -1803,7 +1803,7 @@
 
 	pj_strdup2(inv->pool, &local->origin.user, session->endpoint->sdpowner);
 	local->origin.net_type = STR_IN;
-	local->origin.addr_type = session->endpoint->rtp_ipv6 ? STR_IP6 : STR_IP4;
+	local->origin.addr_type = session->endpoint->media.rtp.ipv6 ? STR_IP6 : STR_IP4;
 	local->origin.addr = *pj_gethostname();
 	pj_strdup2(inv->pool, &local->name, session->endpoint->sdpsession);
 




More information about the asterisk-commits mailing list