Hi

A patch to help resolve the fact that different SMSCs use different 
standards for the number base  of the msg_id in the submit_sm_resp and 
deliver_sm.. they use hex or decimal or a mixture...

Here is a patch lets you set them independently.

The config file works like this.
smpp-msg-id-type;       

bit 1 submit_sm_resp
bit 2 deliver_sm
if he bit is set the value is hex

0x00 deliver_sm decimal, submit_sm_resp decimal
0x01 (default) deliver_sm decimal, submit_sm_resp hex
0x02 deliver_sm hex, submit_sm_resp decimal
0x03 deliver_sm hex, submit_sm_resp hex *

nisan


--- cvs/gateway/gw/smsc/smsc_smpp.c     Mon Aug 19 20:57:59 2002
+++ ./smsc_smpp.c       Mon Aug 19 20:54:30 2002
@@ -97,6 +97,16 @@
      int version;
      int priority;       /* set default priority for messages */
      time_t throttling_err_time;
+    int smpp_msg_id_type; /* msg id in hex or decimal..
+                          * bit 1 submit_sm_resp bit 2 deliver_sm &
+                          * bit set value is hex
+                          * 0x00 deliver_sm decimal, submit_sm_resp decimal
+                          * 0x01 (default) deliver_sm decimal, 
submit_sm_resp hex
+                          * 0x02 deliver_sm hex, submit_sm_resp decimal
+                          * 0x03 deliver_sm hex, submit_sm_resp hex *
+                          */
+
+
      SMSCConn *conn;
  } SMPP;

@@ -109,7 +119,8 @@
                           int dest_addr_ton, int dest_addr_npi,
                           int alt_dcs, int enquire_link_interval,
                           int max_pending_submits, int reconnect_delay,
-                         int version, int priority, Octstr *my_number)
+                         int version, int priority, Octstr *my_number,
+                                                int smpp_msg_id_type)
  {
      SMPP *smpp;

@@ -143,6 +154,7 @@
      smpp->priority = priority;
      smpp->conn = conn;
      smpp->throttling_err_time = 0;
+       smpp->smpp_msg_id_type = smpp_msg_id_type;

      return smpp;
  }
@@ -657,7 +669,12 @@

                  if (msgid != NULL) {
                      Octstr *tmp;
+                    if ((smpp->smpp_msg_id_type & 0x02))
+                        tmp = octstr_format("%ld", 
strtol(octstr_get_cstr(msgid), NULL, 16));
+                    else
                      tmp = octstr_format("%ld", 
strtol(octstr_get_cstr(msgid), NULL, 10));
+
+
                      dlrmsg = dlr_find(octstr_get_cstr(smpp->conn->id),
                                        octstr_get_cstr(tmp), /* smsc 
message id */
                                        
octstr_get_cstr(pdu->u.deliver_sm.destination_addr), 
/* destination */
@@ -773,9 +790,14 @@
              } else {
                  Octstr *tmp;

-                /* deliver gives mesg id in decimal, submit_sm in hex.. */
+                if ((smpp->smpp_msg_id_type & 0x01))
                  tmp = octstr_format("%ld", strtol(
                          octstr_get_cstr(pdu->u.submit_sm_resp.message_id), 
NULL, 16));
+                else
+                    tmp = octstr_format("%ld", strtol(
+                        octstr_get_cstr(pdu->u.submit_sm_resp.message_id), 
NULL, 10));
+
+
                  /* SMSC ACK.. now we have the message id. */

                  if (msg->sms.dlr_mask & 
(DLR_SMSC_SUCCESS|DLR_SUCCESS|DLR_FAIL|DLR_BUFFERED))
@@ -1089,6 +1111,7 @@
      long reconnect_delay;
      long version;
      long priority;
+       long smpp_msg_id_type;


      my_number = NULL;
@@ -1180,13 +1203,16 @@
      if (cfg_get_integer(&priority, grp, octstr_imm("priority")) == -1)
          priority = SMPP_DEFAULT_PRIORITY;

+    if (cfg_get_integer(&smpp_msg_id_type, grp, 
octstr_imm("smpp-msg-id-type")) == -1)
+        smpp_msg_id_type = 0x01; /* default(0x01) deliver_sm decimal,
+ 
submit_sm_resp hex */

      smpp = smpp_create(conn, host, port, receive_port, system_type,
                        username, password, address_range, our_host,
                         source_addr_ton, source_addr_npi, dest_addr_ton,
                         dest_addr_npi, alt_dcs, enquire_link_interval,
                         max_pending_submits, reconnect_delay,
-                       version, priority, my_number);
+                       version, priority, my_number, smpp_msg_id_type);

      conn->data = smpp;
      conn->name = octstr_format("SMPP:%S:%d/%d:%S:%S",


Reply via email to