[svn-commits] rmudgett: trunk r194479 - in /trunk: ./ channels/ channels/misdn/ configs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 14 17:03:53 CDT 2009


Author: rmudgett
Date: Thu May 14 17:03:49 2009
New Revision: 194479

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=194479
Log:
Add outgoing_colp misdn.conf port parameter.

Select what to do with outgoing COLP information on this port.
0 - Send out COLP information unaltered. (default)
1 - Force COLP to restricted on all outgoing COLP information.
2 - Do not send COLP information.
outgoing_colp=0

Also fixed sending the EctInform message so it always has the
required redirectionNumber parameter when the status is active.

JIRA ABE-1853

Modified:
    trunk/CHANGES
    trunk/channels/chan_misdn.c
    trunk/channels/misdn/chan_misdn_config.h
    trunk/channels/misdn/isdn_lib.c
    trunk/channels/misdn/isdn_lib.h
    trunk/channels/misdn/isdn_msg_parser.c
    trunk/channels/misdn_config.c
    trunk/configs/misdn.conf.sample

Modified: trunk/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/CHANGES?view=diff&rev=194479&r1=194478&r2=194479
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu May 14 17:03:49 2009
@@ -110,6 +110,8 @@
     redirected-to party.  You still have to set the REDIRECTING(to-xxx,i)
     and the REDIRECTING(from-xxx,i) values.  The PTP call will update the
     redirecting-to presentation (COLR) when it becomes available.
+  * Added outgoing_colp parameter to misdn.conf to filter outgoing COLP
+    information.
 
 thirdparty mISDN enhancements
 -----------------------------

Modified: trunk/channels/chan_misdn.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=194479&r1=194478&r2=194479
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Thu May 14 17:03:49 2009
@@ -5868,6 +5868,7 @@
 
 	misdn_cfg_get(port, MISDN_CFG_DISPLAY_CONNECTED, &bc->display_connected, sizeof(bc->display_connected));
 	misdn_cfg_get(port, MISDN_CFG_DISPLAY_SETUP, &bc->display_setup, sizeof(bc->display_setup));
+	misdn_cfg_get(port, MISDN_CFG_OUTGOING_COLP, &bc->outgoing_colp, sizeof(bc->outgoing_colp));
 
 	misdn_cfg_get(port, MISDN_CFG_PICKUPGROUP, &pg, sizeof(pg));
 	misdn_cfg_get(port, MISDN_CFG_CALLGROUP, &cg, sizeof(cg));
@@ -6050,6 +6051,14 @@
 		bc->redirecting.to = bc->connected;
 	} else {
 		bc->redirecting.to = bc->caller;
+	}
+	switch (bc->outgoing_colp) {
+	case 1:/* restricted */
+	case 2:/* blocked */
+		bc->redirecting.to.presentation = 1;/* restricted */
+		break;
+	default:
+		break;
 	}
 
 	ch = MISDN_ASTERISK_TECH_PVT(ast);
@@ -6069,12 +6078,16 @@
 			bc->fac_out.Function = Fac_EctInform;
 			bc->fac_out.u.EctInform.InvokeID = ++misdn_invoke_id;
 			bc->fac_out.u.EctInform.Status = 1;/* active */
-			if (bc->redirecting.to.number[0]) {
-				misdn_PresentedNumberUnscreened_fill(&bc->fac_out.u.EctInform.Redirection,
-					&bc->redirecting.to);
-				bc->fac_out.u.EctInform.RedirectionPresent = 1;
-			} else {
-				bc->fac_out.u.EctInform.RedirectionPresent = 0;
+			bc->fac_out.u.EctInform.RedirectionPresent = 1;/* Must be present when status is active */
+			misdn_PresentedNumberUnscreened_fill(&bc->fac_out.u.EctInform.Redirection,
+				&bc->redirecting.to);
+			switch (bc->outgoing_colp) {
+			case 2:/* blocked */
+				/* Block the number going out */
+				bc->fac_out.u.EctInform.Redirection.Type = 1;/* presentationRestricted */
+				break;
+			default:
+				break;
 			}
 
 			/* Send message */
@@ -6166,6 +6179,14 @@
 	int is_ptmp;
 
 	misdn_copy_redirecting_from_ast(bc, ast);
+	switch (bc->outgoing_colp) {
+	case 1:/* restricted */
+	case 2:/* blocked */
+		bc->redirecting.to.presentation = 1;/* restricted */
+		break;
+	default:
+		break;
+	}
 
 	if (originator != ORG_MISDN) {
 		return;
@@ -6192,6 +6213,14 @@
 			bc->fac_out.u.DivertingLegInformation1.SubscriptionOption = 2;/* notificationWithDivertedToNr */
 			bc->fac_out.u.DivertingLegInformation1.DivertedToPresent = 1;
 			misdn_PresentedNumberUnscreened_fill(&bc->fac_out.u.DivertingLegInformation1.DivertedTo, &bc->redirecting.to);
+			switch (bc->outgoing_colp) {
+			case 2:/* blocked */
+				/* Block the number going out */
+				bc->fac_out.u.DivertingLegInformation1.DivertedTo.Type = 1;/* presentationRestricted */
+				break;
+			default:
+				break;
+			}
 			print_facility(&bc->fac_out, bc);
 			misdn_lib_send_event(bc, EVENT_FACILITY);
 		}
@@ -6368,6 +6397,14 @@
 		}
 
 		misdn_copy_redirecting_from_ast(newbc, ast);
+		switch (newbc->outgoing_colp) {
+		case 1:/* restricted */
+		case 2:/* blocked */
+			newbc->redirecting.from.presentation = 1;/* restricted */
+			break;
+		default:
+			break;
+		}
 #if defined(AST_MISDN_ENHANCEMENTS)
 		if (newbc->redirecting.from.number[0] && misdn_lib_is_ptp(port)) {
 			/* Create DivertingLegInformation2 facility */
@@ -6381,6 +6418,14 @@
 			misdn_PresentedNumberUnscreened_fill(
 				&newbc->fac_out.u.DivertingLegInformation2.Diverting,
 				&newbc->redirecting.from);
+			switch (newbc->outgoing_colp) {
+			case 2:/* blocked */
+				/* Block the number going out */
+				newbc->fac_out.u.DivertingLegInformation2.Diverting.Type = 1;/* presentationRestricted */
+				break;
+			default:
+				break;
+			}
 			newbc->fac_out.u.DivertingLegInformation2.OriginalCalledPresent = 0;
 			if (1 < newbc->redirecting.count) {
 				newbc->fac_out.u.DivertingLegInformation2.OriginalCalledPresent = 1;
@@ -6510,6 +6555,15 @@
 		p->bc->connected.screening = 0;	/* unscreened */
 		p->bc->connected.number_type = p->bc->dialed.number_type;
 		p->bc->connected.number_plan = p->bc->dialed.number_plan;
+	}
+
+	switch (p->bc->outgoing_colp) {
+	case 1:/* restricted */
+	case 2:/* blocked */
+		p->bc->connected.presentation = 1;/* restricted */
+		break;
+	default:
+		break;
 	}
 
 #if defined(AST_MISDN_ENHANCEMENTS)

Modified: trunk/channels/misdn/chan_misdn_config.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/misdn/chan_misdn_config.h?view=diff&rev=194479&r1=194478&r2=194479
==============================================================================
--- trunk/channels/misdn/chan_misdn_config.h (original)
+++ trunk/channels/misdn/chan_misdn_config.h Thu May 14 17:03:49 2009
@@ -66,6 +66,7 @@
 	MISDN_CFG_INCOMING_EARLY_AUDIO,      /* int (bool) */
 	MISDN_CFG_ECHOCANCEL,          /* int */
 	MISDN_CFG_CC_REQUEST_RETENTION,/* bool */
+	MISDN_CFG_OUTGOING_COLP,       /* int */
 #ifdef MISDN_1_2
 	MISDN_CFG_PIPELINE,      /* char[] */
 #endif

Modified: trunk/channels/misdn/isdn_lib.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/misdn/isdn_lib.c?view=diff&rev=194479&r1=194478&r2=194479
==============================================================================
--- trunk/channels/misdn/isdn_lib.c (original)
+++ trunk/channels/misdn/isdn_lib.c Thu May 14 17:03:49 2009
@@ -752,6 +752,8 @@
 
 	bc->display_connected = 0;	/* none */
 	bc->display_setup = 0;	/* none */
+
+	bc->outgoing_colp = 0;/* pass */
 
 	bc->presentation = 0;	/* allowed */
 	bc->set_presentation = 0;

Modified: trunk/channels/misdn/isdn_lib.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/misdn/isdn_lib.h?view=diff&rev=194479&r1=194478&r2=194479
==============================================================================
--- trunk/channels/misdn/isdn_lib.h (original)
+++ trunk/channels/misdn/isdn_lib.h Thu May 14 17:03:49 2009
@@ -589,6 +589,15 @@
 	 */
 	int display_setup;
 
+	/*!
+	 * \brief Select what to do with outgoing COLP information.
+	 * \details
+	 * 0 - pass (Send out COLP information unaltered.)
+	 * 1 - restricted (Force COLP to restricted on all outgoing COLP information.)
+	 * 2 - block (Do not send COLP information.)
+	 */
+	int outgoing_colp;
+
 	/*! \brief User set presentation restriction code
 	 * 0=Allowed, 1=Restricted, 2=Unavailable
 	 * \note It is settable by the misdn_set_opt() application.

Modified: trunk/channels/misdn/isdn_msg_parser.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/misdn/isdn_msg_parser.c?view=diff&rev=194479&r1=194478&r2=194479
==============================================================================
--- trunk/channels/misdn/isdn_msg_parser.c (original)
+++ trunk/channels/misdn/isdn_msg_parser.c Thu May 14 17:03:49 2009
@@ -519,18 +519,26 @@
 		enc_ie_called_pn(&setup->CALLED_PN, msg, bc->dialed.number_type, bc->dialed.number_plan, bc->dialed.number, nt, bc);
 	}
 
-	if (bc->redirecting.from.number[0]) {
+	switch (bc->outgoing_colp) {
+	case 0:/* pass */
+	case 1:/* restricted */
+		if (bc->redirecting.from.number[0]) {
 #if 1
-		/* ETSI and Q.952 do not define the screening field */
-		enc_ie_redir_nr(&setup->REDIR_NR, msg, bc->redirecting.from.number_type, bc->redirecting.from.number_plan,
-			bc->redirecting.from.presentation, 0, bc->redirecting.reason,
-			bc->redirecting.from.number, nt, bc);
+			/* ETSI and Q.952 do not define the screening field */
+			enc_ie_redir_nr(&setup->REDIR_NR, msg, bc->redirecting.from.number_type,
+				bc->redirecting.from.number_plan, bc->redirecting.from.presentation, 0,
+				bc->redirecting.reason, bc->redirecting.from.number, nt, bc);
 #else
-		/* Q.931 defines the screening field */
-		enc_ie_redir_nr(&setup->REDIR_NR, msg, bc->redirecting.from.number_type, bc->redirecting.from.number_plan,
-			bc->redirecting.from.presentation, bc->redirecting.from.screening, bc->redirecting.reason,
-			bc->redirecting.from.number, nt, bc);
-#endif
+			/* Q.931 defines the screening field */
+			enc_ie_redir_nr(&setup->REDIR_NR, msg, bc->redirecting.from.number_type,
+				bc->redirecting.from.number_plan, bc->redirecting.from.presentation,
+				bc->redirecting.from.screening, bc->redirecting.reason,
+				bc->redirecting.from.number, nt, bc);
+#endif
+		}
+		break;
+	default:
+		break;
 	}
 
 	if (bc->keypad[0]) {
@@ -667,8 +675,16 @@
 		enc_ie_date(&connect->DATE, msg, now, nt,bc);
 	}
 
-	enc_ie_connected_pn(&connect->CONNECT_PN, msg, bc->connected.number_type, bc->connected.number_plan,
-		bc->connected.presentation, bc->connected.screening, bc->connected.number, nt, bc);
+	switch (bc->outgoing_colp) {
+	case 0:/* pass */
+	case 1:/* restricted */
+		enc_ie_connected_pn(&connect->CONNECT_PN, msg, bc->connected.number_type,
+			bc->connected.number_plan, bc->connected.presentation,
+			bc->connected.screening, bc->connected.number, nt, bc);
+		break;
+	default:
+		break;
+	}
 
 	if (nt && bc->connected.presentation == 0) {
 		char display[sizeof(bc->display)];
@@ -1456,9 +1472,16 @@
 
 	if (bc->redirecting.to_changed) {
 		bc->redirecting.to_changed = 0;
-		enc_ie_redir_dn(&notify->REDIR_DN, msg, bc->redirecting.to.number_type,
-			bc->redirecting.to.number_plan, bc->redirecting.to.presentation,
-			bc->redirecting.to.number, nt, bc);
+		switch (bc->outgoing_colp) {
+		case 0:/* pass */
+		case 1:/* restricted */
+			enc_ie_redir_dn(&notify->REDIR_DN, msg, bc->redirecting.to.number_type,
+				bc->redirecting.to.number_plan, bc->redirecting.to.presentation,
+				bc->redirecting.to.number, nt, bc);
+			break;
+		default:
+			break;
+		}
 	}
 	return msg;
 }

Modified: trunk/channels/misdn_config.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/misdn_config.c?view=diff&rev=194479&r1=194478&r2=194479
==============================================================================
--- trunk/channels/misdn_config.c (original)
+++ trunk/channels/misdn_config.c Thu May 14 17:03:49 2009
@@ -221,6 +221,12 @@
 		"\n"
 		"\tscreen=0, presentation=0 -> callerid presented\n"
 		"\tscreen=1, presentation=1 -> callerid restricted (the remote end doesn't see it!)" },
+	{ "outgoing_colp", MISDN_CFG_OUTGOING_COLP, MISDN_CTYPE_INT, "0", NONE,
+		"Select what to do with outgoing COLP information on this port.\n"
+		"\n"
+		"\t0 - Send out COLP information unaltered.\n"
+		"\t1 - Force COLP to restricted on all outgoing COLP information.\n"
+		"\t2 - Do not send COLP information." },
 	{ "display_connected", MISDN_CFG_DISPLAY_CONNECTED, MISDN_CTYPE_INT, "0", NONE,
 		"Put a display ie in the CONNECT message containing the following\n"
 		"\tinformation if it is available (nt port only):\n"

Modified: trunk/configs/misdn.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/configs/misdn.conf.sample?view=diff&rev=194479&r1=194478&r2=194479
==============================================================================
--- trunk/configs/misdn.conf.sample (original)
+++ trunk/configs/misdn.conf.sample Thu May 14 17:03:49 2009
@@ -397,6 +397,13 @@
 presentation=-1
 screen=-1
 
+; Select what to do with outgoing COLP information on this port.
+;
+; 0 - Send out COLP information unaltered. (default)
+; 1 - Force COLP to restricted on all outgoing COLP information.
+; 2 - Do not send COLP information.
+outgoing_colp=0
+
 ; Put a display ie in the CONNECT message containing the following
 ; information if it is available (nt port only):
 ;




More information about the svn-commits mailing list