[svn-commits] rmudgett: branch rmudgett/subaddr_xfer r2164 - /team/rmudgett/subaddr_xfer/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Dec 9 21:31:19 CST 2010


Author: rmudgett
Date: Thu Dec  9 21:31:14 2010
New Revision: 2164

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2164
Log:
Revert the subaddress restriction suppression code.

Let the upper layer suppress the restricted name/number/subaddress data if
the interface is crossing a trust domain.  This is a policy decision that
should be left up to user configuration.

Modified:
    team/rmudgett/subaddr_xfer/pri.c
    team/rmudgett/subaddr_xfer/pri_facility.c
    team/rmudgett/subaddr_xfer/pri_internal.h
    team/rmudgett/subaddr_xfer/q931.c

Modified: team/rmudgett/subaddr_xfer/pri.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/subaddr_xfer/pri.c?view=diff&rev=2164&r1=2163&r2=2164
==============================================================================
--- team/rmudgett/subaddr_xfer/pri.c (original)
+++ team/rmudgett/subaddr_xfer/pri.c Thu Dec  9 21:31:14 2010
@@ -963,8 +963,8 @@
 
 	new_name = q931_party_name_cmp(&party_id.name, &call->local_id.name);
 	new_number = q931_party_number_cmp(&party_id.number, &call->local_id.number);
-	new_subaddress =
-		q931_party_subaddress_cmp(&party_id.subaddress, &call->local_id.subaddress);
+	new_subaddress = party_id.subaddress.valid
+		&& q931_party_subaddress_cmp(&party_id.subaddress, &call->local_id.subaddress);
 
 	/* Update the call and all subcalls with new local_id. */
 	call->local_id = party_id;
@@ -1002,8 +1002,7 @@
 					q931_notify_redirection(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,
 						&party_id.number);
 				}
-				if ((new_number || new_subaddress)
-					&& q931_party_id_is_subaddress_presentable(&party_id)) {
+				if (new_subaddress || (party_id.subaddress.valid && new_number)) {
 					q931_subaddress_transfer(ctrl, call);
 				}
 			} else if (PTP_MODE(ctrl)) {
@@ -1012,8 +1011,7 @@
 					/* Immediately send EctInform APDU, callStatus=answered(0) */
 					send_call_transfer_complete(ctrl, call, 0);
 				}
-				if ((new_number || new_subaddress)
-					&& q931_party_id_is_subaddress_presentable(&party_id)) {
+				if (new_subaddress || (party_id.subaddress.valid && new_number)) {
 					q931_subaddress_transfer(ctrl, call);
 				}
 			}
@@ -1023,8 +1021,8 @@
 				/* Immediately send CallTransferComplete APDU, callStatus=answered(0) */
 				send_call_transfer_complete(ctrl, call, 0);
 			}
-			if ((new_name || new_number || new_subaddress)
-				&& q931_party_id_is_subaddress_presentable(&party_id)) {
+			if (new_subaddress
+				|| (party_id.subaddress.valid && (new_name || new_number))) {
 				q931_subaddress_transfer(ctrl, call);
 			}
 			break;
@@ -1049,8 +1047,7 @@
 					q931_request_subaddress(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,
 						&party_id.number);
 				}
-				if ((new_number || new_subaddress)
-					&& q931_party_id_is_subaddress_presentable(&party_id)) {
+				if (new_subaddress || (party_id.subaddress.valid && new_number)) {
 					q931_subaddress_transfer(ctrl, call);
 				}
 			} else if (PTP_MODE(ctrl)) {
@@ -1059,8 +1056,7 @@
 					/* Immediately send EctInform APDU, callStatus=answered(0) */
 					send_call_transfer_complete(ctrl, call, 0);
 				}
-				if ((new_number || new_subaddress)
-					&& q931_party_id_is_subaddress_presentable(&party_id)) {
+				if (new_subaddress || (party_id.subaddress.valid && new_number)) {
 					q931_subaddress_transfer(ctrl, call);
 				}
 			}
@@ -1070,8 +1066,8 @@
 				/* Immediately send CallTransferComplete APDU, callStatus=answered(0) */
 				send_call_transfer_complete(ctrl, call, 0);
 			}
-			if ((new_name || new_number || new_subaddress)
-				&& q931_party_id_is_subaddress_presentable(&party_id)) {
+			if (new_subaddress
+				|| (party_id.subaddress.valid && (new_name || new_number))) {
 				q931_subaddress_transfer(ctrl, call);
 			}
 			break;

Modified: team/rmudgett/subaddr_xfer/pri_facility.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/subaddr_xfer/pri_facility.c?view=diff&rev=2164&r1=2163&r2=2164
==============================================================================
--- team/rmudgett/subaddr_xfer/pri_facility.c (original)
+++ team/rmudgett/subaddr_xfer/pri_facility.c Thu Dec  9 21:31:14 2010
@@ -3607,8 +3607,8 @@
 		break;
 	}
 
-	/* Send our subaddress back if we can. */
-	if (q931_party_id_is_subaddress_presentable(&call->local_id)) {
+	/* Send our subaddress back if we have one. */
+	if (call->local_id.subaddress.valid) {
 		send_subaddress_transfer(ctrl, call);
 	}
 }
@@ -4703,8 +4703,8 @@
 			call->incoming_ct_state = INCOMING_CT_STATE_POST_CONNECTED_LINE;
 		}
 
-		/* Send our subaddress back if we can. */
-		if (q931_party_id_is_subaddress_presentable(&call->local_id)) {
+		/* Send our subaddress back if we have one. */
+		if (call->local_id.subaddress.valid) {
 			send_subaddress_transfer(ctrl, call);
 		}
 		break;
@@ -5131,8 +5131,8 @@
 			call->incoming_ct_state = INCOMING_CT_STATE_POST_CONNECTED_LINE;
 		}
 
-		/* Send our subaddress back if we can. */
-		if (q931_party_id_is_subaddress_presentable(&call->local_id)) {
+		/* Send our subaddress back if we have one. */
+		if (call->local_id.subaddress.valid) {
 			send_subaddress_transfer(ctrl, call);
 		}
 		break;

Modified: team/rmudgett/subaddr_xfer/pri_internal.h
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/subaddr_xfer/pri_internal.h?view=diff&rev=2164&r1=2163&r2=2164
==============================================================================
--- team/rmudgett/subaddr_xfer/pri_internal.h (original)
+++ team/rmudgett/subaddr_xfer/pri_internal.h Thu Dec  9 21:31:14 2010
@@ -938,7 +938,6 @@
 void pri_copy_party_id_to_q931(struct q931_party_id *q931_id, const struct pri_party_id *pri_id);
 
 void q931_party_id_fixup(const struct pri *ctrl, struct q931_party_id *id);
-int q931_party_id_is_subaddress_presentable(const struct q931_party_id *id);
 int q931_party_id_presentation(const struct q931_party_id *id);
 
 const char *q931_call_state_str(enum Q931_CALL_STATE callstate);

Modified: team/rmudgett/subaddr_xfer/q931.c
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/subaddr_xfer/q931.c?view=diff&rev=2164&r1=2163&r2=2164
==============================================================================
--- team/rmudgett/subaddr_xfer/q931.c (original)
+++ team/rmudgett/subaddr_xfer/q931.c Thu Dec  9 21:31:14 2010
@@ -864,63 +864,6 @@
 }
 
 /*!
- * \internal
- * \brief Determine if the subaddress is presentable.
- *
- * \param number Party number associated with subaddress.
- * \param subaddr Subaddress to determine if presentable.
- *
- * \retval TRUE if the subaddress is presentable.
- * \retval FALSE if the subaddress is not presentable.
- */
-static int is_number_subaddress_presentable(const struct q931_party_number *number, const struct q931_party_subaddress *subaddr)
-{
-	/* If unsure about the presentation, we will restrict it. */
-	if (!subaddr->valid) {
-		return 0;
-	}
-	if (!number->valid) {
-		return 0;
-	}
-	switch (number->presentation & PRI_PRES_RESTRICTION) {
-	case PRI_PRES_ALLOWED:
-	case PRI_PRES_UNAVAILABLE:
-		break;
-	default:
-	case PRI_PRES_RESTRICTED:
-		return 0;
-	}
-	return 1;
-}
-
-/*!
- * \internal
- * \brief Determine if the subaddress in the party address is presentable.
- *
- * \param addr Party address to check.
- *
- * \retval TRUE if the subaddress is presentable.
- * \retval FALSE if the subaddress is not presentable.
- */
-static int q931_party_address_is_subaddress_presentable(const struct q931_party_address *addr)
-{
-	return is_number_subaddress_presentable(&addr->number, &addr->subaddress);
-}
-
-/*!
- * \brief Determine if the subaddress in the party id is presentable.
- *
- * \param id Party ID to check.
- *
- * \retval TRUE if the subaddress is presentable.
- * \retval FALSE if the subaddress is not presentable.
- */
-int q931_party_id_is_subaddress_presentable(const struct q931_party_id *id)
-{
-	return is_number_subaddress_presentable(&id->number, &id->subaddress);
-}
-
-/*!
  * \brief Determine the overall presentation value for the given party.
  *
  * \param id Party to determine the overall presentation value.
@@ -2110,9 +2053,6 @@
 
 static int transmit_connected_subaddr(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
-	if (!q931_party_id_is_subaddress_presentable(&call->local_id)) {
-		return 0;
-	}
 	return transmit_subaddr_helper(full_ie, ctrl, &call->local_id.subaddress, msgtype, ie,
 		1, len, order);
 }
@@ -2236,9 +2176,6 @@
 
 static int transmit_calling_party_subaddr(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
-	if (!q931_party_id_is_subaddress_presentable(&call->local_id)) {
-		return 0;
-	}
 	return transmit_subaddr_helper(full_ie, ctrl, &call->local_id.subaddress, msgtype, ie,
 		1, len, order);
 }
@@ -2254,9 +2191,6 @@
 
 static int transmit_called_party_subaddr(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order)
 {
-	if (!q931_party_address_is_subaddress_presentable(&call->called)) {
-		return 0;
-	}
 	return transmit_subaddr_helper(full_ie, ctrl, &call->called.subaddress, msgtype, ie,
 		1, len, order);
 }




More information about the svn-commits mailing list