I'd like to resubmit my patch to smsc_smpp.c. We've had this running in a productive environment for some time now, and it works well. The process has been running for 14 days straight now, and correctly handles most types of MO traffic. In particular, we have been able to successfully forward MO picture messages and business cards over the patched SMPP implementation. (The unpatched version will not handle these data types correctly; the UDH will not be present, and the encoding parameters will contain incorrect values.)

Stipe? Did you actually try the patch out? It'd be nice to know if it has any subtle errors or problems that may bite me, especially now that I am using it in production. :)

Please let me know if there are problems, or if I need to update the patch to apply cleanly on a current CVS checkout.

David WHITE
CONNECT AUSTRIA

? smpp-patch.txt
? smpp.patch
Index: gw/smsc/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.22
diff -u -r1.22 smsc_smpp.c
--- gw/smsc/smsc_smpp.c 2 Jan 2003 14:43:00 -0000       1.22
+++ gw/smsc/smsc_smpp.c 18 Feb 2003 12:37:58 -0000
@@ -234,6 +234,7 @@
 static Msg *pdu_to_msg(SMPP *smpp, SMPP_PDU *pdu) 
 { 
     Msg *msg; 
+    int udh_offset = 0;
  
     gw_assert(pdu->type == deliver_sm); 
      
@@ -242,10 +243,17 @@
     pdu->u.deliver_sm.source_addr = NULL; 
     msg->sms.receiver = pdu->u.deliver_sm.destination_addr; 
     pdu->u.deliver_sm.destination_addr = NULL; 
-    msg->sms.msgdata = pdu->u.deliver_sm.short_message; 
-    pdu->u.deliver_sm.short_message = NULL; 
     dcs_to_fields(&msg, pdu->u.deliver_sm.data_coding);
 
+    if (pdu->u.deliver_sm.esm_class & ESM_CLASS_SUBMIT_UDH_INDICATOR) {
+        udh_offset = octstr_get_char(pdu->u.deliver_sm.short_message,0)+1; 
+        msg->sms.udhdata = octstr_copy(pdu->u.deliver_sm.short_message,0,udh_offset);
+        msg->sms.msgdata = 
octstr_copy(pdu->u.deliver_sm.short_message,udh_offset,octstr_len(pdu->u.deliver_sm.short_message)-udh_offset);
+    } else {
+       msg->sms.msgdata = pdu->u.deliver_sm.short_message;
+        pdu->u.deliver_sm.short_message = NULL;
+    }
+
     /* handle default data coding */
     switch (pdu->u.deliver_sm.data_coding) { 
         case 0x00: /* default SMSC alphabet */
@@ -257,11 +265,9 @@
                 if (charset_convert(msg->sms.msgdata, 
octstr_get_cstr(smpp->alt_charset), "ISO-8859-1") != 0)
                     error(0, "Failed to convert msgdata from charset <%s> to <%s>, 
will leave as is.",
                              octstr_get_cstr(smpp->alt_charset), "ISO-8859-1");
-                msg->sms.coding = DC_7BIT;
 
             } else { /* assume GSM 03.38 7-bit alphabet */
                 charset_gsm_to_latin1(msg->sms.msgdata); 
-                msg->sms.coding = DC_7BIT;
             }
             break;
         case 0x01: /* ASCII or IA5 - not sure if I need to do anything */
@@ -288,7 +294,6 @@
              * you implement them if you feel like it 
              */
         default: 
-            msg->sms.coding = DC_7BIT;
     }
     msg->sms.pid = pdu->u.deliver_sm.protocol_id; 
 

Reply via email to