Make outgoing_colp=2 misdn.conf port parameter not send redirecting or transfer messages.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 23 Jun 2009 21:38:21 +0000 (21:38 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 23 Jun 2009 21:38:21 +0000 (21:38 +0000)
If the outgoing_colp parameter is set to not send COLP information, then
it does not make sense to send redirecting or transfer messages announcing
new COLP information that is blocked.  The service provider may supply the
listed number for that line when it passes the messages to the next hop.
Why tell the switch that these events happened when the information is
otherwise suppressed?

Also blocked the number of previous redirects that may have occurred to
calls going out the port when outgoing_colp is 2.

Follow on to JIRA ABE-1853.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@202755 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_misdn.c

index db1eb55..44e096d 100644 (file)
@@ -6052,9 +6052,11 @@ static void misdn_update_connected_line(struct ast_channel *ast, struct misdn_bc
        }
        switch (bc->outgoing_colp) {
        case 1:/* restricted */
-       case 2:/* blocked */
                bc->redirecting.to.presentation = 1;/* restricted */
                break;
+       case 2:/* blocked */
+               /* Don't tell the remote party that the call was transferred. */
+               return;
        default:
                break;
        }
@@ -6079,14 +6081,6 @@ static void misdn_update_connected_line(struct ast_channel *ast, struct misdn_bc
                        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 */
                        print_facility(&bc->fac_out, bc);
@@ -6179,9 +6173,11 @@ static void misdn_update_redirecting(struct ast_channel *ast, struct misdn_bchan
        misdn_copy_redirecting_from_ast(bc, ast);
        switch (bc->outgoing_colp) {
        case 1:/* restricted */
-       case 2:/* blocked */
                bc->redirecting.to.presentation = 1;/* restricted */
                break;
+       case 2:/* blocked */
+               /* Don't tell the remote party that the call was redirected. */
+               return;
        default:
                break;
        }
@@ -6211,14 +6207,6 @@ static void misdn_update_redirecting(struct ast_channel *ast, struct misdn_bchan
                        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);
                }
@@ -6405,13 +6393,13 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
                }
 #if defined(AST_MISDN_ENHANCEMENTS)
                if (newbc->redirecting.from.number[0] && misdn_lib_is_ptp(port)) {
+                       if (newbc->redirecting.count < 1) {
+                               newbc->redirecting.count = 1;
+                       }
+
                        /* Create DivertingLegInformation2 facility */
                        newbc->fac_out.Function = Fac_DivertingLegInformation2;
                        newbc->fac_out.u.DivertingLegInformation2.InvokeID = ++misdn_invoke_id;
-                       newbc->fac_out.u.DivertingLegInformation2.DiversionCounter =
-                               newbc->redirecting.count;
-                       newbc->fac_out.u.DivertingLegInformation2.DiversionReason =
-                               misdn_to_diversion_reason(newbc->redirecting.reason);
                        newbc->fac_out.u.DivertingLegInformation2.DivertingPresent = 1;
                        misdn_PresentedNumberUnscreened_fill(
                                &newbc->fac_out.u.DivertingLegInformation2.Diverting,
@@ -6420,12 +6408,20 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
                        case 2:/* blocked */
                                /* Block the number going out */
                                newbc->fac_out.u.DivertingLegInformation2.Diverting.Type = 1;/* presentationRestricted */
+
+                               /* Don't tell about any previous diversions or why for that matter. */
+                               newbc->fac_out.u.DivertingLegInformation2.DiversionCounter = 1;
+                               newbc->fac_out.u.DivertingLegInformation2.DiversionReason = 0;/* unknown */
                                break;
                        default:
+                               newbc->fac_out.u.DivertingLegInformation2.DiversionCounter =
+                                       newbc->redirecting.count;
+                               newbc->fac_out.u.DivertingLegInformation2.DiversionReason =
+                                       misdn_to_diversion_reason(newbc->redirecting.reason);
                                break;
                        }
                        newbc->fac_out.u.DivertingLegInformation2.OriginalCalledPresent = 0;
-                       if (1 < newbc->redirecting.count) {
+                       if (1 < newbc->fac_out.u.DivertingLegInformation2.DiversionCounter) {
                                newbc->fac_out.u.DivertingLegInformation2.OriginalCalledPresent = 1;
                                newbc->fac_out.u.DivertingLegInformation2.OriginalCalled.Type = 2;/* numberNotAvailableDueToInterworking */
                        }