[PATCH] autodetect smpp source_addr_ton should not remove + (plus)

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Centrium GmbH
Message-ID <[email protected]>
Hi,

attached patch adds new config option for smpp driver that allow not removing 
of leading plus in source/destination addr because some operators need them. 

Comments please...

-- 
Best Regards / Mit besten Grüßen aus Köln

Dipl.-Ing.
Alexander Malysh
___________________________________

Centrium GmbH
Ehrenstrasse 2
50672 Köln

Fon: +49 (0221) 277 49 240
Fax: +49 (0221) 277 49 109

email: [email protected]
web: http://www.centrium.de
msn: [email protected]
smsc_smpp_remove_leading_plus.diff (text/x-diff, 3.6 KB)
? doc/alligata/alligata.tex
? test/test_dbpool
Index: gw/smsc/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.31
diff -a -u -r1.31 smsc_smpp.c
--- gw/smsc/smsc_smpp.c	19 Mar 2003 17:43:11 -0000	1.31
+++ gw/smsc/smsc_smpp.c	25 Mar 2003 17:28:03 -0000
@@ -106,6 +106,7 @@
     int smpp_msg_id_type;  /* msg id in C string, hex or decimal */
     int autodetect_addr;
     Octstr *alt_charset;
+    int remove_leading_plus;
     SMSCConn *conn; 
 } SMPP; 
  
@@ -120,7 +121,7 @@
                          int max_pending_submits, int version, int priority,
                          Octstr *my_number, int smpp_msg_id_type, 
                          int autodetect_addr, Octstr *alt_charset, 
-                         Octstr *service_type) 
+                         Octstr *service_type, int remove_leading_plus) 
 { 
     SMPP *smpp; 
      
@@ -157,6 +158,7 @@
     smpp->smpp_msg_id_type = smpp_msg_id_type;    
     smpp->autodetect_addr = autodetect_addr;
     smpp->alt_charset = octstr_duplicate(alt_charset);
+    smpp->remove_leading_plus = remove_leading_plus;
  
     return smpp; 
 } 
@@ -366,7 +368,8 @@
                 pdu->u.submit_sm.source_addr_npi = GSM_ADDR_NPI_UNKNOWN;    /* short code */ 
             } else { 
                /* numeric sender address with + in front -> international (remove the +) */ 
-               octstr_delete(pdu->u.submit_sm.source_addr, 0, 1); 
+               if (smpp->remove_leading_plus)
+                   octstr_delete(pdu->u.submit_sm.source_addr, 0, 1); 
                pdu->u.submit_sm.source_addr_ton = GSM_ADDR_TON_INTERNATIONAL; 
     	    } 
         } else { 
@@ -394,7 +397,8 @@
      * '+' and set number type to international instead  
      */ 
     if (octstr_get_char(pdu->u.submit_sm.destination_addr,0) == '+') { 
-        octstr_delete(pdu->u.submit_sm.destination_addr, 0,1); 
+        if (smpp->remove_leading_plus)
+            octstr_delete(pdu->u.submit_sm.destination_addr, 0,1); 
         pdu->u.submit_sm.dest_addr_ton = GSM_ADDR_TON_INTERNATIONAL; 
     } 
  
@@ -1295,6 +1299,7 @@
     long smpp_msg_id_type;
     int autodetect_addr;
     Octstr *alt_charset;
+    int remove_leading_plus;
  
     my_number = alt_charset = NULL; 
     transceiver_mode = 0;
@@ -1405,13 +1410,17 @@
     /* check for an alternative charset */
     alt_charset = cfg_get(grp, octstr_imm("alt-charset"));
 
+    /* for not removing of leading '+' in dst/src set this to 0 */
+    if (cfg_get_bool(&remove_leading_plus, grp, octstr_imm("remove-leading-plus")) == -1)
+        remove_leading_plus = 1;
+
     smpp = smpp_create(conn, host, port, receive_port, system_type,  
     	    	       username, password, address_range,
                        source_addr_ton, source_addr_npi, dest_addr_ton,  
                        dest_addr_npi, alt_dcs, enquire_link_interval, 
                        max_pending_submits, version, priority, my_number, 
                        smpp_msg_id_type, autodetect_addr, alt_charset, 
-                       service_type); 
+                       service_type, remove_leading_plus); 
  
     conn->data = smpp; 
     conn->name = octstr_format("SMPP:%S:%d/%d:%S:%S",  
Index: gwlib/cfg.def
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.def,v
retrieving revision 1.84
diff -a -u -r1.84 cfg.def
--- gwlib/cfg.def	19 Mar 2003 17:40:11 -0000	1.84
+++ gwlib/cfg.def	25 Mar 2003 17:28:03 -0000
@@ -244,6 +244,7 @@
     OCTSTR(notification-pid)
     OCTSTR(notification-addr)
     OCTSTR(msg-id-type)
+    OCTSTR(remove-leading-plus)
 )
smime.p7s (application/pkcs7-signature, 2.5 KB) - not displayed
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.