Re: [PATCH] Optional usage of submit_sm.message_payload for large MTs

Stipe Tolj <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Kannel Software Foundation (KSF)
Message-ID <[email protected]>
Am 26.05.2014 18:59, schrieb Alexander Malysh:
> Hi Stipe,
>
> why this limit of 254? It's hard to explain for users what this mean, IMHO. I think, the beast would be to have config switch to use
> either short_message or message_payload. Another argument for simple switch that some SMSCs expect message_payload even
> for short message body.

adressing the concerns of Alex, please find here another variant of the 
patchset which uses a simple boolean switch in the config group, i.e.:

   group = smsc
   smsc = smpp
   ...
   message-payload = yes
   ...

to switch over to the use of submit_sm.mesage_payload instread of 
.short_message. Messages up to 64K in size are then not segmented and 
send as one PDU.

Comments, votes please.
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
-------------------------------------------------------------------
smpp-message-payload.v2.diff (text/plain, 3 KB)
Index: doc/userguide/userguide.xml
===================================================================
--- doc/userguide/userguide.xml	(revision 5090)
+++ doc/userguide/userguide.xml	(working copy)
@@ -3639,6 +3639,17 @@
        Defaults to 3.
      </entry></row>
 
+   <row><entry><literal>message-payload</literal></entry>
+     <entry><literal>boolean</literal></entry>
+     <entry valign="bottom"> 
+       Optional, defines if we are using the 
+       <literal>submit_sm.message_payload</literal> field
+       for SMPP v3.4 or higher connections instead of the
+       <literal>submit_sm.short_message</literal> field.
+       Which also means that no segmentation of SMS messages
+       is performed up to a size of 64K.
+     </entry></row>
+
    </tbody></tgroup></informaltable>
 
 </sect2>
Index: gw/smsc/smsc_smpp.c
===================================================================
--- gw/smsc/smsc_smpp.c	(revision 5090)
+++ gw/smsc/smsc_smpp.c	(working copy)
@@ -173,6 +173,7 @@
     long wait_ack;
     int wait_ack_action;
     int esm_class;
+    int message_payload;
     Load *load;
     SMSCConn *conn;
 } SMPP;
@@ -995,6 +996,13 @@
 
     pdu->u.submit_sm.sm_length = octstr_len(pdu->u.submit_sm.short_message);
 
+    /* Use .message_payload if configured to do so. */
+    if (smpp->version > 0x33 && smpp->message_payload) {
+        pdu->u.submit_sm.message_payload = pdu->u.submit_sm.short_message;
+        pdu->u.submit_sm.short_message = NULL;
+        pdu->u.submit_sm.sm_length = 0;
+    }
+
     /*
      * check for validity and deferred settings
      * were message value has higher priority then smsc config group value
@@ -2478,6 +2486,10 @@
         /* convert decimal to BCD */
         version = ((version / 10) << 4) + (version % 10);
 
+    /* check if 'message-payload' is allowed based on SMPP version used. */
+    if (cfg_get_bool(&ok, grp, octstr_imm("message-payload")) == 1 && version < SMPP_DEFAULT_VERSION)
+        panic(0, "SMPP: Configuration can't set 'message-payload' if interface version is v3.3.");
+
     /* check for any specified priority value in range [0-5] */
     if (cfg_get_integer(&priority, grp, octstr_imm("priority")) == -1)
         priority = SMPP_DEFAULT_PRIORITY;
@@ -2546,6 +2558,10 @@
         smpp->ssl_client_certkey_file = cfg_get(grp, octstr_imm("ssl-client-certkey-file"));
 #endif
 
+    /* PDU allowed payload size is 64K, so change max SMS octet value */
+    if (cfg_get_bool(&smpp->message_payload, grp, octstr_imm("message-payload")) == 1)
+        conn->max_sms_octets = 65536;
+
     conn->data = smpp;
     conn->name = octstr_format("SMPP:%S:%d/%d:%S:%S",
                                host, port,
Index: gwlib/cfg.def
===================================================================
--- gwlib/cfg.def	(revision 5077)
+++ gwlib/cfg.def	(working copy)
@@ -373,6 +373,7 @@
     OCTSTR(bind-addr-npi)
     OCTSTR(service-type)
     OCTSTR(esm-class)
+    OCTSTR(message-payload)
     OCTSTR(source-addr-autodetect)
     OCTSTR(enquire-link-interval)
     OCTSTR(max-pending-submits)
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.