[libpri-commits] rmudgett: branch 1.4 r1212 - /branches/1.4/pri_facility.c

SVN commits to the libpri project libpri-commits at lists.digium.com
Thu Oct 15 17:34:56 CDT 2009


Author: rmudgett
Date: Thu Oct 15 17:34:52 2009
New Revision: 1212

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=1212
Log:
Take diverted-to-number from DivLegInfo1 and use it as connected number.

If no connected number is signaled in the CONNECT message we will use the
last diverted to number.

(issue 0014292)
Reported by: tomaso
Patches:
      divleginfo1_to_connectednum.patch uploaded by tomaso (license 564)
      (Used as a guide since it no longer will apply.)
      (This patch is unrelated to the issue.)

Modified:
    branches/1.4/pri_facility.c

Modified: branches/1.4/pri_facility.c
URL: http://svnview.digium.com/svn/libpri/branches/1.4/pri_facility.c?view=diff&rev=1212&r1=1211&r2=1212
==============================================================================
--- branches/1.4/pri_facility.c (original)
+++ branches/1.4/pri_facility.c Thu Oct 15 17:34:52 2009
@@ -2657,6 +2657,29 @@
 		break;
 #endif	/* Not handled yet */
 	case ROSE_ETSI_DivertingLegInformation1:
+		/*
+		 * Unless otherwise indicated by CONNECT, the divertedToNumber will be
+		 * the remote_id.number.
+		 *
+		 * Fortunately, the connected number ie is supposed to come after the
+		 * facility ie in the same message so it will be processed later.
+		 */
+		if (invoke->args.etsi.DivertingLegInformation1.diverted_to_present) {
+			rose_copy_presented_number_unscreened_to_q931(ctrl, &call->remote_id.number,
+				&invoke->args.etsi.DivertingLegInformation1.diverted_to);
+			/*
+			 * We set the presentation value since the sender cannot know the
+			 * presentation value preference of the destination party.
+			 */
+			if (call->remote_id.number.str[0]) {
+				call->remote_id.number.presentation =
+					PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED;
+			}
+		} else {
+			q931_party_number_init(&call->remote_id.number);
+			call->remote_id.number.valid = 1;
+		}
+
 		/* divertedToNumber is put in redirecting.to.number */
 		switch (invoke->args.etsi.DivertingLegInformation1.subscription_option) {
 		default:
@@ -2668,14 +2691,7 @@
 				PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
 			break;
 		case 2:	/* notificationWithDivertedToNr */
-			if (invoke->args.etsi.DivertingLegInformation1.diverted_to_present) {
-				rose_copy_presented_number_unscreened_to_q931(ctrl,
-					&call->redirecting.to.number,
-					&invoke->args.etsi.DivertingLegInformation1.diverted_to);
-			} else {
-				q931_party_number_init(&call->redirecting.to.number);
-				call->redirecting.to.number.valid = 1;
-			}
+			call->redirecting.to.number = call->remote_id.number;
 			break;
 		}
 
@@ -2719,7 +2735,16 @@
 		}
 		break;
 	case ROSE_ETSI_DivertingLegInformation3:
+		/*
+		 * Unless otherwise indicated by CONNECT, this will be the
+		 * remote_id.number.presentation.
+		 *
+		 * Fortunately, the connected number ie is supposed to come after the
+		 * facility ie in the same message so it will be processed later.
+		 */
 		if (!invoke->args.etsi.DivertingLegInformation3.presentation_allowed_indicator) {
+			call->remote_id.number.presentation =
+				PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
 			call->redirecting.to.number.presentation =
 				PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
 		}
@@ -2945,6 +2970,21 @@
 		break;
 #endif	/* Not handled yet */
 	case ROSE_QSIG_DivertingLegInformation1:
+		/*
+		 * Unless otherwise indicated by CONNECT, the nominatedNr will be
+		 * the remote_id.number.
+		 *
+		 * Fortunately, the connected number ie is supposed to come after the
+		 * facility ie in the same message so it will be processed later.
+		 */
+		q931_party_number_init(&call->remote_id.number);
+		rose_copy_number_to_q931(ctrl, &call->remote_id.number,
+			&invoke->args.qsig.DivertingLegInformation1.nominated_number);
+		if (call->remote_id.number.str[0]) {
+			call->remote_id.number.presentation =
+				PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED;
+		}
+
 		/* nominatedNr is put in redirecting.to.number */
 		switch (invoke->args.qsig.DivertingLegInformation1.subscription_option) {
 		default:
@@ -2956,13 +2996,7 @@
 				PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
 			break;
 		case QSIG_NOTIFICATION_WITH_DIVERTED_TO_NR:
-			q931_party_number_init(&call->redirecting.to.number);
-			rose_copy_number_to_q931(ctrl, &call->redirecting.to.number,
-				&invoke->args.qsig.DivertingLegInformation1.nominated_number);
-			if (call->redirecting.to.number.str[0]) {
-				call->redirecting.to.number.presentation =
-					PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED;
-			}
+			call->redirecting.to.number = call->remote_id.number;
 			break;
 		}
 
@@ -3026,7 +3060,16 @@
 		}
 		break;
 	case ROSE_QSIG_DivertingLegInformation3:
+		/*
+		 * Unless otherwise indicated by CONNECT, this will be the
+		 * remote_id.number.presentation.
+		 *
+		 * Fortunately, the connected number ie is supposed to come after the
+		 * facility ie in the same message so it will be processed later.
+		 */
 		if (!invoke->args.qsig.DivertingLegInformation3.presentation_allowed_indicator) {
+			call->remote_id.number.presentation =
+				PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
 			call->redirecting.to.number.presentation =
 				PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
 		}




More information about the libpri-commits mailing list