[svn-commits] mmichelson: branch group/issue8824 r146681 - /team/group/issue8824/channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Oct 6 11:34:57 CDT 2008


Author: mmichelson
Date: Mon Oct  6 11:34:56 2008
New Revision: 146681

URL: http://svn.digium.com/view/asterisk?view=rev&rev=146681
Log:
Improve behavior of P-Asserted-Identity:

* Don't add extra parameters besides the URI
* If privacy is on, do not send the header at all


Modified:
    team/group/issue8824/channels/chan_sip.c

Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=146681&r1=146680&r2=146681
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Mon Oct  6 11:34:56 2008
@@ -8126,6 +8126,7 @@
 	const char *fromdomain;
 	const char *privacy = NULL;
 	const char *screen = NULL;
+	int private = 0;
 
 	if (p->owner && p->owner->connected.id.number)
 		lid_num = p->owner->connected.id.number;
@@ -8139,7 +8140,10 @@
 		lid_name = lid_num;
 	fromdomain = S_OR(p->fromdomain, ast_inet_ntoa(p->ourip.sin_addr));
 
-	snprintf(tmp, sizeof(tmp), "\"%s\" <sip:%s@%s>;party=%s", lid_name, lid_num, fromdomain, ast_test_flag(&p->flags[0], SIP_OUTGOING) ? "calling" : "called");
+	snprintf(tmp, sizeof(tmp), "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
+	if (ast_test_flag(&p->flags[1], SIP_SENDRPID_RPID)) {
+		snprintf(tmp + strlen(tmp), sizeof(tmp) - strlen(tmp), ";party=%s", ast_test_flag(&p->flags[0], SIP_OUTGOING) ? "calling" : "called");
+	}
 
 	switch (lid_pres) {
 	case AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED:
@@ -8156,29 +8160,33 @@
 	case AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN:
 		privacy = "full";
 		screen = "no";
+		private = 1;
 		break;
 	case AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN:
 	case AST_PRES_PROHIB_NETWORK_NUMBER:
 		privacy = "full";
 		screen = "yes";
+		private = 1;
 		break;
 	case AST_PRES_NUMBER_NOT_AVAILABLE:
 		break;
 	default:
-		if ((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED)
+		if ((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED) {
 			privacy = "full";
+			private = 1;
+		}
 		else
 			privacy = "off";
 		screen = "no";
 		break;
 	}
 
-	if (!ast_strlen_zero(privacy) && !ast_strlen_zero(screen))
+	if (ast_test_flag(&p->flags[1], SIP_SENDRPID_RPID) && !ast_strlen_zero(privacy) && !ast_strlen_zero(screen))
 		snprintf(tmp + strlen(tmp), sizeof(tmp) - strlen(tmp), ";privacy=%s;screen=%s", privacy, screen);
 
 	if (ast_test_flag(&p->flags[0], SIP_SENDRPID_RPID)) {
 		add_header(req, "Remote-Party-ID", tmp);
-	} else {
+	} else if (!private) {
 		add_header(req, "P-Asserted-Identity", tmp);
 	}
 	return 0;




More information about the svn-commits mailing list