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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 26 09:46:36 CDT 2013


Author: mmichelson
Date: Fri Jul 26 09:46:34 2013
New Revision: 395501

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395501
Log:
Group identification configuration together.


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_caller_id.c
    team/mmichelson/sip_endpoint_reorg/res/res_sip_diversion.c
    team/mmichelson/sip_endpoint_reorg/res/res_sip_messaging.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=395501&r1=395500&r2=395501
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c (original)
+++ team/mmichelson/sip_endpoint_reorg/channels/chan_gulp.c Fri Jul 26 09:46:34 2013
@@ -988,7 +988,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;

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=395501&r1=395500&r2=395501
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h (original)
+++ team/mmichelson/sip_endpoint_reorg/include/asterisk/res_sip.h Fri Jul 26 09:46:34 2013
@@ -422,8 +422,21 @@
 		/*! Whether to rewrite the Contact header with the source IP address/port or not */
 		unsigned int rewrite_contact;
 	} nat;
-	/*! Identification information for this endpoint */
-	struct ast_party_id id;
+	struct {
+		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;
+	} id;
 	/*! Domain to which this endpoint belongs */
 	struct ast_sip_domain *domain;
 	/*! Address of record for incoming registrations */
@@ -442,18 +455,6 @@
 	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;
-	/*! When performing connected line update, which method should be used */
-	enum ast_sip_session_refresh_method connected_line_method;
-	/*! 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;
 	/*! Is one-touch recording permitted? */
 	unsigned int one_touch_recording;
 	/*! Boolean indicating if ringing should be sent as inband progress */

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=395501&r1=395500&r2=395501
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip/sip_configuration.c Fri Jul 26 09:46:34 2013
@@ -386,9 +386,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));
@@ -424,18 +424,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 +447,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)
@@ -651,11 +651,11 @@
 	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);
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_inbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, trust_id_inbound));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_outbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, trust_id_outbound));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_pai", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_pai));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_rpid", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_rpid));
-	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_diversion", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_diversion));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_inbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_inbound));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_outbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_outbound));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_pai", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_pai));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_rpid", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_rpid));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_diversion", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_diversion));
 	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, subscription.mwi.aggregate));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "media_encryption", "no", media_encryption_handler, NULL, 0, 0);
@@ -769,7 +769,7 @@
 	}
 	destroy_auths(endpoint->sip_inbound_auths, endpoint->num_inbound_auths);
 	destroy_auths(endpoint->sip_outbound_auths, endpoint->num_outbound_auths);
-	ast_party_id_free(&endpoint->id);
+	ast_party_id_free(&endpoint->id.self);
 	endpoint->named_callgroups = ast_unref_namedgroups(endpoint->named_callgroups);
 	endpoint->named_pickupgroups = ast_unref_namedgroups(endpoint->named_pickupgroups);
 	ao2_cleanup(endpoint->persistent);
@@ -789,7 +789,7 @@
 		ao2_cleanup(endpoint);
 		return NULL;
 	}
-	ast_party_id_init(&endpoint->id);
+	ast_party_id_init(&endpoint->id.self);
 	return endpoint;
 }
 

Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip_caller_id.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip_caller_id.c?view=diff&rev=395501&r1=395500&r2=395501
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip_caller_id.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip_caller_id.c Fri Jul 26 09:46:34 2013
@@ -313,7 +313,7 @@
 {
 	struct ast_party_id id;
 
-	if (!session->endpoint->trust_id_inbound) {
+	if (!session->endpoint->id.trust_inbound) {
 		return;
 	}
 
@@ -344,12 +344,12 @@
 {
 	if (session->inv_session->state < PJSIP_INV_STATE_CONFIRMED) {
 		/* Initial inbound INVITE. Set the session ID directly */
-		if (session->endpoint->trust_id_inbound &&
+		if (session->endpoint->id.trust_inbound &&
 				(!set_id_from_pai(rdata, &session->id) || !set_id_from_rpid(rdata, &session->id))) {
 			return 0;
 		}
-		ast_party_id_copy(&session->id, &session->endpoint->id);
-		if (!session->endpoint->id.number.valid) {
+		ast_party_id_copy(&session->id, &session->endpoint->id.self);
+		if (!session->endpoint->id.self.number.valid) {
 			set_id_from_from(rdata, &session->id);
 		}
 	} else {
@@ -615,13 +615,13 @@
 {
 	if (((id->name.presentation & AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED ||
 			(id->number.presentation & AST_PRES_RESTRICTION) == AST_PRES_RESTRICTED) &&
-			!session->endpoint->trust_id_outbound) {
-		return;
-	}
-	if (session->endpoint->send_pai) {
+			!session->endpoint->id.trust_outbound) {
+		return;
+	}
+	if (session->endpoint->id.send_pai) {
 		add_pai_header(tdata, id);
 	}
-	if (session->endpoint->send_rpid) {
+	if (session->endpoint->id.send_rpid) {
 		add_rpid_header(tdata, id);
 	}
 }
@@ -648,7 +648,7 @@
 
 	connected_id = ast_channel_connected_effective_id(session->channel);
 	if (session->inv_session->state < PJSIP_INV_STATE_CONFIRMED &&
-			(session->endpoint->trust_id_outbound ||
+			(session->endpoint->id.trust_outbound ||
 			((connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED &&
 			(connected_id.number.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED))) {
 		/* Only change the From header on the initial outbound INVITE. Switching it
@@ -662,8 +662,8 @@
 
 		modify_id_header(tdata->pool, from, &connected_id);
 		modify_id_header(dlg->pool, dlg->local.info, &connected_id);
-		if (should_queue_connected_line_update(session, &session->endpoint->id)) {
-			queue_connected_line_update(session, &session->endpoint->id);
+		if (should_queue_connected_line_update(session, &session->endpoint->id.self)) {
+			queue_connected_line_update(session, &session->endpoint->id.self);
 		}
 	}
 	add_id_headers(session, tdata, &connected_id);

Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip_diversion.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip_diversion.c?view=diff&rev=395501&r1=395500&r2=395501
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip_diversion.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip_diversion.c Fri Jul 26 09:46:34 2013
@@ -280,7 +280,7 @@
 {
 	struct ast_party_redirecting *data;
 
-	if (session->channel && session->endpoint->send_diversion &&
+	if (session->channel && session->endpoint->id.send_diversion &&
 	    (data = ast_channel_redirecting(session->channel))->count) {
 		add_diversion_header(tdata, data);
 	}

Modified: team/mmichelson/sip_endpoint_reorg/res/res_sip_messaging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/sip_endpoint_reorg/res/res_sip_messaging.c?view=diff&rev=395501&r1=395500&r2=395501
==============================================================================
--- team/mmichelson/sip_endpoint_reorg/res/res_sip_messaging.c (original)
+++ team/mmichelson/sip_endpoint_reorg/res/res_sip_messaging.c Fri Jul 26 09:46:34 2013
@@ -402,8 +402,8 @@
 	}
 
 	/* endpoint name */
-	if (endpt->id.name.valid) {
-		CHECK_RES(ast_msg_set_var(msg, "SIP_PEERNAME", endpt->id.name.str));
+	if (endpt->id.self.name.valid) {
+		CHECK_RES(ast_msg_set_var(msg, "SIP_PEERNAME", endpt->id.self.name.str));
 	}
 
 	CHECK_RES(headers_to_vars(rdata, msg));




More information about the asterisk-commits mailing list