[svn-commits] mmichelson: branch group/v14_colp r147637 - /team/group/v14_colp/channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Oct 8 15:15:11 CDT 2008


Author: mmichelson
Date: Wed Oct  8 15:15:11 2008
New Revision: 147637

URL: http://svn.digium.com/view/asterisk?view=rev&rev=147637
Log:
Merge issue8824 branch revision 147636 and fix a few
flag errors I noticed


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

Modified: team/group/v14_colp/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/v14_colp/channels/chan_sip.c?view=diff&rev=147637&r1=147636&r2=147637
==============================================================================
--- team/group/v14_colp/channels/chan_sip.c (original)
+++ team/group/v14_colp/channels/chan_sip.c Wed Oct  8 15:15:11 2008
@@ -6329,7 +6329,11 @@
 	const char *fromdomain;
 	const char *privacy = NULL;
 	const char *screen = NULL;
-	int private = 0;
+	const char *anonymous_string = "\"Anonymous\" <anonymous at anonymous.invalid>"; 
+
+	if (!ast_test_flag(&p->flags[1], SIP_PAGE2_SENDRPID)) {
+		return 0;
+	}
 
 	if (p->owner && p->owner->connected.id.number)
 		lid_num = p->owner->connected.id.number;
@@ -6342,56 +6346,54 @@
 	if (ast_strlen_zero(lid_name))
 		lid_name = lid_num;
 	fromdomain = S_OR(p->fromdomain, ast_inet_ntoa(p->ourip));
-
-	snprintf(tmp, sizeof(tmp), "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
-	if (ast_test_flag(&p->flags[1], SIP_PAGE2_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:
-	case AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN:
-		privacy = "off";
-		screen = "no";
-		break;
-	case AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN:
-	case AST_PRES_ALLOWED_NETWORK_NUMBER:
-		privacy = "off";
-		screen = "yes";
-		break;
-	case AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED:
-	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 (ast_test_flag(&p->flags[1], SIP_PAGE2_SENDRPID_PAI)) {
 		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))
-		snprintf(tmp + strlen(tmp), sizeof(tmp) - strlen(tmp), ";privacy=%s;screen=%s", privacy, screen);
-
-	if (ast_test_flag(&p->flags[0], SIP_PAGE2_SENDRPID_RPID)) {
-		add_header(req, "Remote-Party-ID", tmp);
-	} else if (!private) {
+			snprintf(tmp, sizeof(tmp), "%s", anonymous_string); 
+		} else {
+			snprintf(tmp, sizeof(tmp), "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
+		}
 		add_header(req, "P-Asserted-Identity", tmp);
 	} else {
-		add_header(req, "P-Asserted-Identity", "<anonymous at anonymous.invalid>");
+		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");
+
+		switch (lid_pres) {
+		case AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED:
+		case AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN:
+			privacy = "off";
+			screen = "no";
+			break;
+		case AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN:
+		case AST_PRES_ALLOWED_NETWORK_NUMBER:
+			privacy = "off";
+			screen = "yes";
+			break;
+		case AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED:
+		case AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN:
+			privacy = "full";
+			screen = "no";
+			break;
+		case AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN:
+		case AST_PRES_PROHIB_NETWORK_NUMBER:
+			privacy = "full";
+			screen = "yes";
+			break;
+		case AST_PRES_NUMBER_NOT_AVAILABLE:
+			break;
+		default:
+			if ((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED) {
+				privacy = "full";
+			}
+			else
+				privacy = "off";
+			screen = "no";
+			break;
+		}
+
+		if (!ast_strlen_zero(privacy) && !ast_strlen_zero(screen))
+			snprintf(tmp + strlen(tmp), sizeof(tmp) - strlen(tmp), ";privacy=%s;screen=%s", privacy, screen);
+		
+		add_header(req, "Remote-Party-ID", tmp);
 	}
 	return 0;
 }
@@ -7295,7 +7297,7 @@
 
 		ast_channel_unlock(chan);
 	}
-	if ((sipmethod == SIP_INVITE || sipmethod == SIP_UPDATE) && ast_test_flag(&p->flags[0], SIP_PAGE2_SENDRPID))
+	if ((sipmethod == SIP_INVITE || sipmethod == SIP_UPDATE) && ast_test_flag(&p->flags[1], SIP_PAGE2_SENDRPID))
 		add_rpid(&req, p);
 	if (sipmethod == SIP_INVITE) {
 		add_diversion_header(&req, p);
@@ -7597,7 +7599,7 @@
 static void update_connectedline(struct sip_pvt *p, const void *data, size_t datalen)
 {
 	
-	if (!ast_test_flag(&p->flags[0], SIP_PAGE2_SENDRPID))
+	if (!ast_test_flag(&p->flags[1], SIP_PAGE2_SENDRPID))
 		return;
 	if (ast_strlen_zero(p->owner->connected.id.number))
 		return;
@@ -17214,13 +17216,13 @@
 		ast_set_flag(&mask[0], SIP_TRUSTRPID);
 		ast_set2_flag(&flags[0], ast_true(v->value), SIP_TRUSTRPID);
 	} else if (!strcasecmp(v->name, "sendrpid")) {
-		ast_set_flag(&mask[0], SIP_PAGE2_SENDRPID);
+		ast_set_flag(&mask[1], SIP_PAGE2_SENDRPID);
 		if (!strcasecmp(v->value, "pai")) {
-			ast_set_flag(&flags[0], SIP_PAGE2_SENDRPID_PAI);
+			ast_set_flag(&flags[1], SIP_PAGE2_SENDRPID_PAI);
 		} else if (!strcasecmp(v->value, "rpid")) {
-			ast_set_flag(&flags[0], SIP_PAGE2_SENDRPID_RPID);
+			ast_set_flag(&flags[1], SIP_PAGE2_SENDRPID_RPID);
 		} else if (ast_true(v->value)) {
-			ast_set_flag(&flags[0], SIP_PAGE2_SENDRPID_RPID);
+			ast_set_flag(&flags[1], SIP_PAGE2_SENDRPID_RPID);
 		}
 	} else if (!strcasecmp(v->name, "g726nonstandard")) {
 		ast_set_flag(&mask[0], SIP_G726_NONSTANDARD);




More information about the svn-commits mailing list