Re: [PATCH] Fixing SMPP re-routing, DLR request indication

Stipe Tolj <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization tolj.org system architecture
Message-ID <[email protected]>
Hi list,

after we cleared the .registered_delivery DEFINED values for the
[submit|deliver]_sm PDUs, please find an updates patch against CVS HEAD.

It also requires to "create" the payload msg->sms.msgdata here in case there is
non (i.e. if the DLR is a v3.4 style DLR without payload text). This is
necessary, since we otherwise segfault in extract_msgdata_part() ->
octstr_copy() while doing the MT smscconn_send().

Best Regards,
Stipe

-- 
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 DÃŒsseldorf, NRW, Germany

tolj.org system architecture      Kannel Software Foundation (KSF)
http://www.tolj.org/              http://www.kannel.org/

mailto:st_{at}_tolj.org           mailto:stolj_{at}_kannel.org
-------------------------------------------------------------------
smsc-smpp-reroute.diff (text/plain, 1.4 KB)
### Eclipse Workspace Patch 1.0
#P gateway-cvs-head
Index: gw/smsc/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.112
diff -u -r1.112 smsc_smpp.c
--- gw/smsc/smsc_smpp.c	29 Jan 2009 11:38:28 -0000	1.112
+++ gw/smsc/smsc_smpp.c	29 Jan 2009 16:38:58 -0000
@@ -407,7 +407,6 @@
 }
 
 
-
 /*
  * Convert SMPP PDU to internal Msgs structure.
  * Return the Msg if all was fine and NULL otherwise, while getting 
@@ -417,7 +416,7 @@
 static Msg *pdu_to_msg(SMPP *smpp, SMPP_PDU *pdu, long *reason)
 {
     Msg *msg;
-    int ton, npi;
+    int ton, npi, rd;
 
     gw_assert(pdu->type == deliver_sm);
 
@@ -559,6 +558,18 @@
 
     /* set priority flag */
     msg->sms.priority = pdu->u.deliver_sm.priority_flag;
+    
+    /* set DLR mask */
+    rd = pdu->u.deliver_sm.registered_delivery;
+    if (rd == 4 || rd == 8 || rd == 12)
+        msg->sms.dlr_mask = (DLR_SUCCESS | DLR_FAIL);
+    
+    /* If we got a v3.4 style DLR, then no message payload was set,
+     * so we need to check that the possibly re-routed msgdata has
+     * at least an empty octstr, otherwise we crash with segfault 
+     * later in extract_msgdata_part() while copy_octstr(). */
+    if (msg->sms.msgdata == NULL)
+        msg->sms.msgdata = octstr_create("");
 
     if (msg->sms.meta_data == NULL)
         msg->sms.meta_data = octstr_create("");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.