Hi list,

I made a small patch whichs adds optional no-dlr parameter to CIMD2 SMSC
section. seems like some operators have prohibited DLR requests at all and
it reports with the following message:

ERROR: code 310: Incorrect status report request parameter usage

so, when no-dlr is set to true, neither
packet_add_int_parm(packet, P_STATUS_REPORT_REQUEST, 14, conn);
nor
packet_add_int_parm(packet, P_STATUS_REPORT_REQUEST, 0, conn);
won't be added to the packet.

comments and votes are welcome.

regards,
Dziugas Baltrunas
Index: doc/userguide/userguide.xml
===================================================================
RCS file: /home/cvs/gateway/doc/userguide/userguide.xml,v
retrieving revision 1.215
diff -u -r1.215 userguide.xml
--- doc/userguide/userguide.xml 27 Mar 2003 09:09:02 -0000      1.215
+++ doc/userguide/userguide.xml 2 Apr 2003 08:07:31 -0000
@@ -2167,6 +2167,15 @@
        Set it to 0 to disable this feature.
      </entry></row>
 
+   <row><entry><literal>no-dlr</literal></entry>
+     <entry><literal>boolean</literal></entry>
+     <entry valign="bottom">
+       Optional. If defined, status delivery report requests (DLR) won't be
+       requested at all. Some CIMD2 SMSC have prohibited these reports so
+       if you are getting error like "Incorrect status report request parameter
+       usage", this option is for you. Defaults to "false".
+     </entry></row>
+
    <row><entry><literal>my-number</literal></entry>
       <entry><literal>string</literal></entry>
       <entry valign="bottom">
Index: gwlib/cfg.def
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.def,v
retrieving revision 1.84
diff -u -r1.84 cfg.def
--- gwlib/cfg.def       19 Mar 2003 17:40:11 -0000      1.84
+++ gwlib/cfg.def       2 Apr 2003 08:07:31 -0000
@@ -244,6 +244,7 @@
     OCTSTR(notification-pid)
     OCTSTR(notification-addr)
     OCTSTR(msg-id-type)
+    OCTSTR(no-dlr)
 )
 
 
Index: gw/smsc/smsc_cimd2.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_cimd2.c,v
retrieving revision 1.9
diff -u -r1.9 smsc_cimd2.c
--- gw/smsc/smsc_cimd2.c        31 Mar 2003 13:25:21 -0000      1.9
+++ gw/smsc/smsc_cimd2.c        2 Apr 2003 08:07:32 -0000
@@ -47,6 +47,7 @@
     long    our_port;
     long    keepalive;
     Octstr  *my_number;
+    int no_dlr;
 
     int     socket;
     int     send_seq;
@@ -1263,6 +1264,7 @@
 static struct packet *packet_encode_message(Msg *msg, Octstr *sender_prefix, SMSCConn 
*conn)
 {
     struct packet *packet;
+    PrivData *pdata = conn->data;
     Octstr *text;
     int spaceleft;
     long truncated;
@@ -1363,12 +1365,14 @@
      * with those reports anyway. */
     /* ask for the delivery reports if needed*/
 
-    if (msg->sms.dlr_mask & 0x03)
-    {
-        packet_add_int_parm(packet, P_STATUS_REPORT_REQUEST, 14, conn);
-    }
-    else
-        packet_add_int_parm(packet, P_STATUS_REPORT_REQUEST, 0, conn);
+    if (!pdata->no_dlr)
+        if (msg->sms.dlr_mask & 0x03)
+            packet_add_int_parm(packet, P_STATUS_REPORT_REQUEST, 14, conn);
+       else
+            packet_add_int_parm(packet, P_STATUS_REPORT_REQUEST, 0, conn);
+    else if( !pdata->no_dlr && (msg->sms.dlr_mask & 0x03) )
+       warning(0, "CIMD2[%s]: dlr request make no sense while no-dlr set to false",
+                octstr_get_cstr(conn->id));
 
     /* Turn off reply path as default.
      * This avoids phones automatically asking for a reply
@@ -1878,7 +1882,7 @@
     }
 
     ret = cimd2_request(packet, conn, &ts);
-    if((ret == 0) && (ts) && (msg->sms.dlr_mask & 0x03)) {
+    if((ret == 0) && (ts) && (msg->sms.dlr_mask & 0x03) && !pdata->no_dlr) {
     
         dlr_add(octstr_get_cstr(conn->name),
             octstr_get_cstr(ts), 
@@ -2229,7 +2233,8 @@
     pdata = gw_malloc(sizeof(PrivData));
     conn->data = pdata;
     pdata->conn = conn;
-
+   
+    pdata->no_dlr = 0;
     pdata->quitting = 0;
     pdata->socket = -1;
     pdata->received = list_create();
@@ -2254,6 +2259,8 @@
     if (cfg_get_integer(&(pdata->keepalive), grp,octstr_imm("keepalive")) == -1)
         pdata->keepalive = 0;
 
+    cfg_get_bool(&pdata->no_dlr, grp, octstr_imm("no-dlr"));
+    
     /* Check that config is OK */
     ok = 1;
     if (pdata->host == NULL) {

Reply via email to