Added new option to interface.conf: "nonotify" to disable notify messages.
authorAndreas Eversberg <jolly@eversberg.eu>
Fri, 15 Jan 2010 20:55:25 +0000 (21:55 +0100)
committerAndreas Eversberg <jolly@eversberg.eu>
Fri, 15 Jan 2010 20:55:25 +0000 (21:55 +0100)
modified:   README
modified:   dss1.cpp
modified:   interface.c
modified:   interface.h
modified:   mISDN.cpp
modified:   mISDN.h

README
dss1.cpp
interface.c
interface.h
mISDN.cpp
mISDN.h

diff --git a/README b/README
index fc9bd4b..c495bd7 100644 (file)
--- a/README
+++ b/README
@@ -531,6 +531,7 @@ Changes after Version 1.6
 New release Version 1.7
 
 Changes after Version 1.7
 New release Version 1.7
 
 Changes after Version 1.7
+- Added new option to interface.conf: "nonotify" to disable notify messages.
 
 
 
 
 
 
index e318aa3..75ff448 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -2240,6 +2240,13 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet
        int notify;
        int plan = 0, type = -1, present = 0;
 
        int notify;
        int plan = 0, type = -1, present = 0;
 
+       if (p_m_mISDNport->ifport->nonotify) {
+               l1l2l3_trace_header(p_m_mISDNport, this, L3_NOTIFY_REQ, DIRECTION_OUT);
+               add_trace("info", NULL, "blocked by config");
+               end_trace();
+               return;
+       }
+
 //     printf("if = %d\n", param->notifyinfo.notify);
        if (param->notifyinfo.notify>INFO_NOTIFY_NONE)
                notify = param->notifyinfo.notify & 0x7f;
 //     printf("if = %d\n", param->notifyinfo.notify);
        if (param->notifyinfo.notify>INFO_NOTIFY_NONE)
                notify = param->notifyinfo.notify & 0x7f;
index 0b72061..a4bac2d 100644 (file)
@@ -916,6 +916,22 @@ static int inter_gsm(struct interface *interface, char *filename, int line, char
        return(0);
 #endif
 }
        return(0);
 #endif
 }
+static int inter_nonotify(struct interface *interface, char *filename, int line, char *parameter, char *value)
+{
+       struct interface_port *ifport;
+
+       /* port in chain ? */
+       if (!interface->ifport) {
+               SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects previous 'port' definition.\n", filename, line, parameter);
+               return(-1);
+       }
+       /* goto end of chain */
+       ifport = interface->ifport;
+       while(ifport->next)
+               ifport = ifport->next;
+       ifport->nonotify = 1;
+       return(0);
+}
 #ifdef WITH_SS5
 static int inter_ss5(struct interface *interface, char *filename, int line, char *parameter, char *value)
 {
 #ifdef WITH_SS5
 static int inter_ss5(struct interface *interface, char *filename, int line, char *parameter, char *value)
 {
@@ -1097,7 +1113,12 @@ struct interface_param interface_param[] = {
        {"gsm", &inter_gsm, "",
        "Sets up GSM interface for using OpenBSC.\n"
        "This interface must be a loopback interface. The second loopback interface\n"
        {"gsm", &inter_gsm, "",
        "Sets up GSM interface for using OpenBSC.\n"
        "This interface must be a loopback interface. The second loopback interface\n"
-       "must be assigned to OpenBSC"},
+       "must be assigned to OpenBSC."},
+
+       {"nonotify", &inter_nonotify, "",
+       "Prevents sending notify messages to this interface. A call placed on hold will\n"
+       "Not affect the remote end (phone or telcom switch).\n"
+       "This parameter must follow a 'port' parameter."},
 
 #ifdef WITH_SS5
        {"ccitt5", &inter_ss5, "[<feature> [feature ...]]",
 
 #ifdef WITH_SS5
        {"ccitt5", &inter_ss5, "[<feature> [feature ...]]",
@@ -1430,7 +1451,7 @@ void load_port(struct interface_port *ifport)
        struct mISDNport *mISDNport;
 
        /* open new port */
        struct mISDNport *mISDNport;
 
        /* open new port */
-       mISDNport = mISDNport_open(ifport->portnum, ifport->portname, ifport->ptp, ifport->nt, ifport->tespecial, ifport->l1hold, ifport->l2hold, ifport->interface, ifport->gsm, ifport->ss5);
+       mISDNport = mISDNport_open(ifport);
        if (mISDNport) {
                /* link port */
                ifport->mISDNport = mISDNport;
        if (mISDNport) {
                /* link port */
                ifport->mISDNport = mISDNport;
index 508a33e..7dce3ad 100644 (file)
@@ -67,6 +67,7 @@ struct interface_port {
 //     int                     tout_park;
        int                     dialmax; /* maximum number of digits to dial */
        char                    tones_dir[128];
 //     int                     tout_park;
        int                     dialmax; /* maximum number of digits to dial */
        char                    tones_dir[128];
+       int                     nonotify; /* blocks outgoing notify messages  */
 };
 
 struct interface_msn {
 };
 
 struct interface_msn {
index ce885d9..e531b14 100644 (file)
--- a/mISDN.cpp
+++ b/mISDN.cpp
@@ -2045,10 +2045,17 @@ int mISDN_getportbyname(int sock, int cnt, char *portname)
 /*
  * global function to add a new card (port)
  */
 /*
  * global function to add a new card (port)
  */
-struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt, int te_special, int l1hold, int l2hold, struct interface *interface, int gsm, unsigned int ss5)
+struct mISDNport *mISDNport_open(struct interface_port *ifport)
 {
        int ret;
        struct mISDNport *mISDNport, **mISDNportp;
 {
        int ret;
        struct mISDNport *mISDNport, **mISDNportp;
+       int port = ifport->portnum;
+       int ptp = ifport->ptp;
+       int force_nt = ifport->nt;
+       int l1hold = ifport->l1hold;
+       int l2hold = ifport->l2hold;
+       int gsm = ifport->gsm;
+       int ss5 = ifport->ss5;
        int i, cnt;
        int pri, bri, pots;
        int nt, te;
        int i, cnt;
        int pri, bri, pots;
        int nt, te;
@@ -2068,12 +2075,12 @@ struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt
                return(NULL);
        }
        if (port < 0) {
                return(NULL);
        }
        if (port < 0) {
-               port = mISDN_getportbyname(mISDNsocket, cnt, portname);
+               port = mISDN_getportbyname(mISDNsocket, cnt, ifport->portname);
                if (port < 0) {
                        if (gsm)
                if (port < 0) {
                        if (gsm)
-                               PERROR_RUNTIME("Port name '%s' not found, did you load loopback interface for GSM?.\n", portname);
+                               PERROR_RUNTIME("Port name '%s' not found, did you load loopback interface for GSM?.\n", ifport->portname);
                        else
                        else
-                               PERROR_RUNTIME("Port name '%s' not found, use 'misdn_info' tool to list all existing ports.\n", portname);
+                               PERROR_RUNTIME("Port name '%s' not found, use 'misdn_info' tool to list all existing ports.\n", ifport->portname);
                        return(NULL);
                }
                // note: 'port' has still the port number
                        return(NULL);
                }
                // note: 'port' has still the port number
@@ -2275,7 +2282,7 @@ struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt
                        mqueue_purge(&mISDNport->upqueue);
                        PERROR_RUNTIME("open_layer3() failed for port %d\n", port);
                        start_trace(port,
                        mqueue_purge(&mISDNport->upqueue);
                        PERROR_RUNTIME("open_layer3() failed for port %d\n", port);
                        start_trace(port,
-                               interface,
+                               ifport->interface,
                                NULL,
                                NULL,
                                DIRECTION_NONE,
                                NULL,
                                NULL,
                                DIRECTION_NONE,
@@ -2292,7 +2299,7 @@ struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt
        mISDNport->b_num = devinfo.nrbchan;
        mISDNport->portnum = port;
        mISDNport->ntmode = nt;
        mISDNport->b_num = devinfo.nrbchan;
        mISDNport->portnum = port;
        mISDNport->ntmode = nt;
-       mISDNport->tespecial = te_special;
+       mISDNport->tespecial = ifport->tespecial;
        mISDNport->pri = pri;
        mISDNport->ptp = ptp;
        mISDNport->l1hold = l1hold;
        mISDNport->pri = pri;
        mISDNport->ptp = ptp;
        mISDNport->l1hold = l1hold;
@@ -2322,7 +2329,7 @@ struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt
        PDEBUG(DEBUG_BCHANNEL, "using 'mISDN_dsp.o' module\n");
 
        start_trace(mISDNport->portnum,
        PDEBUG(DEBUG_BCHANNEL, "using 'mISDN_dsp.o' module\n");
 
        start_trace(mISDNport->portnum,
-                   interface,
+                   ifport->interface,
                    NULL,
                    NULL,
                    DIRECTION_NONE,
                    NULL,
                    NULL,
                    DIRECTION_NONE,
diff --git a/mISDN.h b/mISDN.h
index f8d2341..cbebcac 100644 (file)
--- a/mISDN.h
+++ b/mISDN.h
@@ -92,7 +92,7 @@ calls with no bchannel (call waiting, call on hold).
 int mISDN_initialize(void);
 void mISDN_deinitialize(void);
 int mISDN_getportbyname(int sock, int cnt, char *portname);
 int mISDN_initialize(void);
 void mISDN_deinitialize(void);
 int mISDN_getportbyname(int sock, int cnt, char *portname);
-struct mISDNport *mISDNport_open(int port, char *portname, int ptp, int force_nt, int te_special, int l1hold, int l2hold, struct interface *interface, int gsm, unsigned int ss5);
+struct mISDNport *mISDNport_open(struct interface_port *ifport);
 void mISDNport_static(struct mISDNport *mISDNport);
 void mISDNport_close_all(void);
 void mISDNport_close(struct mISDNport *mISDNport);
 void mISDNport_static(struct mISDNport *mISDNport);
 void mISDNport_close_all(void);
 void mISDNport_close(struct mISDNport *mISDNport);