Hahahaha

That's not a solutions :D,

I found a very simple solutions for this just now:
---- cut here ----
#include <stdio.h>

int main(){
       printf("B88B2856 = %lu\n",strtol("B88B2856",NULL,16));
       printf("B88B2856 = %ld\n",strtoll("B88B2856",NULL,16));
       printf("B88B2856 = %lu\n",strtoll("B88B2856",NULL,16));
}
---- cut here ----
B88B2856 is just an example of hexa number which is = 3096127574 in decimal
look at the result:

$ ./a.out
B88B2856 = 2147483647
B88B2856 = -1198839722
B88B2856 = 3096127574

The correct value is if we use printf("B88B2856 = %lu\n",strtoll("B88B2856",NULL,16));

I use kannel 1.4.0, and found this problem at file gw/smsc/smsc_smpp.c

1. in function static Msg *handle_dlr(SMPP *smpp, Octstr *destination_addr, Octstr *short_message, Octstr *message_payload, Octstr * receipted_message_id, long message_state)

------------ cut here -----------------
if (smpp->smpp_msg_id_type == -1) {
    /* the default, C string */
    tmp = octstr_duplicate(msgid);
} else {
    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));
    }
}
------------ cut here -----------------
to fix it, change line
tmp = octstr_format("%ld", strtol(octstr_get_cstr(msgid), NULL, 16));
to
tmp = octstr_format("%lu", strtoll(octstr_get_cstr(msgid), NULL, 16));

also
tmp = octstr_format("%ld", strtol(octstr_get_cstr(msgid), NULL, 10));
to
tmp = octstr_format("%lu", strtoll(octstr_get_cstr(msgid), NULL, 10));

2. in function
static void handle_pdu(SMPP *smpp, Connection *conn, SMPP_PDU *pdu,
                       long *pending_submits)

on case submit_sm_resp:
------------ cut here -----------------
               Octstr *tmp;

/* check if msg_id is C string, decimal or hex for this SMSC */
               if (smpp->smpp_msg_id_type == -1) {
                   /* the default, C string */
tmp = octstr_duplicate(pdu->u.submit_sm_resp.message_id);
               } else {
                   if (smpp->smpp_msg_id_type & 0x01) {
                       tmp = octstr_format("%ld", strtol(  /* hex */
octstr_get_cstr(pdu->u.submit_sm_resp.message_id), NULL, 16));
                   } else {
                       tmp = octstr_format("%ld", strtol(  /* decimal */
octstr_get_cstr(pdu->u.submit_sm_resp.message_id), NULL, 10));
                   }
               }

               /* SMSC ACK.. now we have the message id. */
               if (DLR_IS_ENABLED_DEVICE(msg->sms.dlr_mask))
                   dlr_add(smpp->conn->id, tmp, msg);
------------ cut here -----------------
change line :
                       tmp = octstr_format("%ld", strtol(  /* hex */
octstr_get_cstr(pdu->u.submit_sm_resp.message_id), NULL, 16));

to
                       tmp = octstr_format("%lu", strtoll(  /* hex */
octstr_get_cstr(pdu->u.submit_sm_resp.message_id), NULL, 16));

also:
                       tmp = octstr_format("%ld", strtol(  /* decimal */
octstr_get_cstr(pdu->u.submit_sm_resp.message_id), NULL, 10));

to
                       tmp = octstr_format("%lu", strtoll(  /* decimal */
octstr_get_cstr(pdu->u.submit_sm_resp.message_id), NULL, 10));


and recompile your kannel

Good luck




Vincent CHAVANIS wrote:
<joke>
buy a 64bit server :-)
</joke>

btw, please fill a bug report on mantis : http://bugs.kannel.org/main_page.php

regards

Vincent

--
Telemaque - NICE - (FR)
Service Technique - Developpement
http://www.telemaque.fr/
[EMAIL PROTECTED]
Tel : +33 4 93 97 71 64 (fax 68)

----- Original Message ----- From: "Ady Wicaksono" <[EMAIL PROTECTED]>
To: <users@kannel.org>
Sent: Thursday, May 18, 2006 11:42 AM
Subject: Message ID higher than 2147483647


Dear all

on 32 bit system, we have max int 2^31 - 1 = 2147483647

(look at /usr/include/stdint.h)
:# define INT32_MAX                (2147483647)

I have the problem with this, some of SMSC use hex/decimal pair.
submit_sm_resp is using hexadecimal

2006-05-18 15:30:18 [16274] [6] DEBUG:   type_name: submit_sm_resp
2006-05-18 15:30:18 [16274] [6] DEBUG:   command_id: 2147483652 = 0x80000004
2006-05-18 15:30:18 [16274] [6] DEBUG:   command_status: 0 = 0x00000000
2006-05-18 15:30:18 [16274] [6] DEBUG:   sequence_number: 13 = 0x0000000d
2006-05-18 15:30:18 [16274] [6] DEBUG:   message_id: "B88B2856"

Message ID is 3096127574 in decimal which is bigger than max-int so

2006-05-18 15:30:18 [16274] [6] DEBUG: SMPP PDU dump ends.
2006-05-18 15:30:18 [16274] [6] DEBUG: DLR[mysql]: Adding DLR smsc=smpp, ts=2147483647, src=xxx, dst=xxxxx, mask=31, boxc=

Kannel set ts to 2147483647 :(. It's bad since when i have deliver_sm as delivery report like this, they inform id 3096127574 state but our kannel can't find
DLR entries

2006-05-18 15:30:36 [16274] [9] DEBUG: data: 69 64 3a 33 30 39 36 31 32 37 35 37 34 20 73 75 id:3096127574 su 2006-05-18 15:30:36 [16274] [9] DEBUG: data: 62 3a 30 30 30 20 64 6c 76 72 64 3a 30 30 30 20 b:000 dlvrd:000 2006-05-18 15:30:36 [16274] [9] DEBUG: data: 73 75 62 6d 69 74 20 64 61 74 65 3a 30 36 30 35 submit date:0605 2006-05-18 15:30:36 [16274] [9] DEBUG: data: 31 38 31 35 33 32 20 64 6f 6e 65 20 64 61 74 65 181532 done date 2006-05-18 15:30:36 [16274] [9] DEBUG: data: 3a 30 36 30 35 31 38 31 35 33 32 20 73 74 61 74 :0605181532 stat 2006-05-18 15:30:36 [16274] [9] DEBUG: data: 3a 44 45 4c 49 56 52 44 20 65 72 72 3a 30 30 30 :DELIVRD err:000 2006-05-18 15:30:36 [16274] [9] DEBUG: data: 20 74 65 78 74 3a 54 65 72 69 6d 61 20 4b 61 73 text:xxxxxxxxxxxx
2006-05-18 15:30:36 [16274] [9] DEBUG:    Octet string dump ends.
2006-05-18 15:30:36 [16274] [9] DEBUG: SMPP PDU dump ends.
2006-05-18 15:30:36 [16274] [9] DEBUG: SMPP[smpp] handle_pdu, got DLR
2006-05-18 15:30:36 [16274] [9] DEBUG: DLR[mysql]: Looking for DLR smsc=smpp, ts=2147483647, dst=xxxxxxxx, type=1
2006-05-18 15:30:36 [16274] [9] DEBUG: no rows found
2006-05-18 15:30:36 [16274] [9] WARNING: DLR[mysql]: DLR for DST<xxxxxxx> not found. 2006-05-18 15:30:36 [16274] [9] ERROR: SMPP[smpp]: got DLR but could not find message or was not interested in it id<
2147483647> dst<xxxxx>, type<1>

Any issue on this limit?













Reply via email to