Add ability for chan_dahdi ISDN to block connected line updates per span.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 13 Mar 2012 21:18:31 +0000 (21:18 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 13 Mar 2012 21:18:31 +0000 (21:18 +0000)
Added new chan_dahdi.conf colp_send option parameter to block connected
line updates per span.

(closes issue ASTERISK-17025)
Reported by: Michael Smith

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

channels/chan_dahdi.c
channels/sig_pri.c
channels/sig_pri.h
configs/chan_dahdi.conf.sample

index 5dad539..84a7025 100644 (file)
@@ -1407,6 +1407,7 @@ static struct dahdi_chan_conf dahdi_chan_conf_default(void)
                        .localprefix = "",
                        .privateprefix = "",
                        .unknownprefix = "",
+                       .colp_send = SIG_PRI_COLP_UPDATE,
                        .resetinterval = -1,
                },
 #endif
@@ -12691,6 +12692,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
 #if defined(HAVE_PRI_L2_PERSISTENCE)
                                                pris[span].pri.l2_persistence = conf->pri.pri.l2_persistence;
 #endif /* defined(HAVE_PRI_L2_PERSISTENCE) */
+                                               pris[span].pri.colp_send = conf->pri.pri.colp_send;
 #if defined(HAVE_PRI_AOC_EVENTS)
                                                pris[span].pri.aoc_passthrough_flag = conf->pri.pri.aoc_passthrough_flag;
                                                pris[span].pri.aoce_delayhangup = conf->pri.pri.aoce_delayhangup;
@@ -17975,6 +17977,16 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
                                        confp->pri.pri.l2_persistence = PRI_L2_PERSISTENCE_DEFAULT;
                                }
 #endif /* defined(HAVE_PRI_L2_PERSISTENCE) */
+                       } else if (!strcasecmp(v->name, "colp_send")) {
+                               if (!strcasecmp(v->value, "block")) {
+                                       confp->pri.pri.colp_send = SIG_PRI_COLP_BLOCK;
+                               } else if (!strcasecmp(v->value, "connect")) {
+                                       confp->pri.pri.colp_send = SIG_PRI_COLP_CONNECT;
+                               } else if (!strcasecmp(v->value, "update")) {
+                                       confp->pri.pri.colp_send = SIG_PRI_COLP_UPDATE;
+                               } else {
+                                       confp->pri.pri.colp_send = SIG_PRI_COLP_UPDATE;
+                               }
 #endif /* HAVE_PRI */
 #if defined(HAVE_SS7)
                        } else if (!strcasecmp(v->name, "ss7type")) {
index 093d8ad..feb86fd 100644 (file)
@@ -8019,8 +8019,34 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
                        struct pri_party_connected_line connected;
                        int dialplan;
                        int prefix_strip;
+                       int colp_allowed = 0;
 
                        pri_grab(p, p->pri);
+
+                       /* Check if a connected line update is allowed at this time. */
+                       switch (p->pri->colp_send) {
+                       case SIG_PRI_COLP_BLOCK:
+                               break;
+                       case SIG_PRI_COLP_CONNECT:
+                               /*
+                                * Outgoing calls receive CONNECT and act like an update before
+                                * the call is connected.
+                                */
+                               if (p->call_level <= SIG_PRI_CALL_LEVEL_ALERTING && !p->outgoing) {
+                                       colp_allowed = 1;
+                               }
+                               break;
+                       case SIG_PRI_COLP_UPDATE:
+                               colp_allowed = 1;
+                               break;
+                       }
+                       if (!colp_allowed) {
+                               pri_rel(p->pri);
+                               ast_debug(1, "Blocked AST_CONTROL_CONNECTED_LINE on %s\n",
+                                       ast_channel_name(chan));
+                               break;
+                       }
+
                        memset(&connected, 0, sizeof(connected));
                        sig_pri_party_id_from_ast(&connected.id, &ast_channel_connected(chan)->id);
 
index 8123f6b..3317c7e 100644 (file)
@@ -391,6 +391,15 @@ struct sig_pri_mbox {
 };
 #endif /* defined(HAVE_PRI_MWI) */
 
+enum sig_pri_colp_signaling {
+       /*! Block all connected line updates. */
+       SIG_PRI_COLP_BLOCK,
+       /*! Only send connected line information with the CONNECT message. */
+       SIG_PRI_COLP_CONNECT,
+       /*! Allow all connected line updates. */
+       SIG_PRI_COLP_UPDATE,
+};
+
 struct sig_pri_span {
        /* Should be set by user */
        struct ast_cc_config_params *cc_params;                 /*!< CC config parameters for each new call. */
@@ -452,6 +461,8 @@ struct sig_pri_span {
        char privateprefix[20];                                 /*!< for private dialplans */
        char unknownprefix[20];                                 /*!< for unknown dialplans */
        enum sig_pri_moh_signaling moh_signaling;
+       /*! Send connected line signaling to peer option. */
+       enum sig_pri_colp_signaling colp_send;
        long resetinterval;                                             /*!< Interval (in seconds) for resetting unused channels */
 #if defined(HAVE_PRI_DISPLAY_TEXT)
        unsigned long display_flags_send;               /*!< PRI_DISPLAY_OPTION_xxx flags for display text sending */
index d83bba8..4ba5699 100644 (file)
@@ -249,6 +249,15 @@ context=public
 ;
 ;datetime_send=
 
+; Send ISDN conected line information.
+;
+; block:   Do not send any connected line information.
+; connect: Send connected line information on initial connect.
+; update:  Same as connect but also send any updates during a call.
+;          Updates happen if the call is transferred. (Default)
+;
+;colp_send=update
+
 ; Allow inband audio (progress) when a call is DISCONNECTed by the far end of a PRI
 ;
 ;inbanddisconnect=yes