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]>
ok, here we go again, with corresponding change:

+    /* If we want message_payload to be used as PDU field, and no 
'max-sms-octets'
+     * is given, then we can switch to use a max-sms-octets size of 64K 
to support
+     * the full size of the message_payload field. */
+    if (cfg_get_bool(&smpp->message_payload, grp, 
octstr_imm("message-payload")) == 1 &&
+            cfg_get_integer(&conn->max_sms_octets, grp, 
octstr_imm("max-sms-octets")) == -1)
+        conn->max_sms_octets = 65536;

in order to switch only to the 64K size IF no other value has been given 
to be respected due to user configuration.

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.v3.diff (text/plain, 3.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,13 @@
         smpp->ssl_client_certkey_file = cfg_get(grp, octstr_imm("ssl-client-certkey-file"));
 #endif
 
+    /* If we want message_payload to be used as PDU field, and no 'max-sms-octets'
+     * is given, then we can switch to use a max-sms-octets size of 64K to support
+     * the full size of the message_payload field. */
+    if (cfg_get_bool(&smpp->message_payload, grp, octstr_imm("message-payload")) == 1 &&
+            cfg_get_integer(&conn->max_sms_octets, grp, octstr_imm("max-sms-octets")) == -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.