Re: Problem with TON=1

Stipe Tolj <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization tolj.org system architecture
Message-ID <[email protected]>
Alejandro Guerrieri wrote:

> Dear Devels,
> 
> I'm having problems receiving MO messages when addr-ton = 1
> 
> I get an error:
> 
> "Mallformed addr `12345, expected at least 7 digits."
> 
> I've isolated the problem to smsc_smpp.c, function convert_addr_from_pdu():
> 
> ...
>    switch(ton) {
>    case GSM_ADDR_TON_INTERNATIONAL:
>        /*
>         * Checks to perform:
>         *   1) assume international number has at least 7 chars
>         *   2) the whole source addr consist of digits, exception '+' in front
>         */
>        if (octstr_len(addr) < 7) {
>            error(0, "SMPP[%s]: Mallformed addr `%s', expected at
> least 7 digits. ",
>                     octstr_get_cstr(id),
>                     octstr_get_cstr(addr));
>            reason = SMPP_ESME_RINVSRCADR;
>            goto error;
>        } else if (octstr_get_char(addr, 0) == '+' &&
>                   !octstr_check_range(addr, 1, 256, gw_isdigit)) {
>            error(0, "SMPP[%s]: Mallformed addr `%s', expected all digits. ",
>                     octstr_get_cstr(id),
>                     octstr_get_cstr(addr));
>            reason = SMPP_ESME_RINVSRCADR;
>            goto error;
>        } else if (octstr_get_char(addr, 0) != '+' &&
>                   !octstr_check_range(addr, 0, 256, gw_isdigit)) {
>            error(0, "SMPP[%s]: Mallformed addr `%s', expected all digits. ",
>                     octstr_get_cstr(id),
>                     octstr_get_cstr(addr));
>            reason = SMPP_ESME_RINVSRCADR;
>            goto error;
>        }
> ....
> 
> Here's a sample MO PDU triggering the problem (numbers and smsc's
> changed but preserving their original length):
> 
> 2006-06-27 14:06:31 [11061] [37] DEBUG: SMPP[my-own-smsc]: Got PDU:
> 2006-06-27 14:06:31 [11061] [37] DEBUG: SMPP PDU 0x989cb08 dump:
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   type_name: deliver_sm
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   command_id: 5 = 0x00000005
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   command_status: 0 = 0x00000000
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   sequence_number: 1780 = 0x000006f4
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   service_type: NULL
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   source_addr_ton: 1 = 0x00000001
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   source_addr_npi: 1 = 0x00000001
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   source_addr: "12345678901"
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   dest_addr_ton: 1 = 0x00000001
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   dest_addr_npi: 1 = 0x00000001
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   destination_addr: "12345"
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   esm_class: 0 = 0x00000000
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   protocol_id: 0 = 0x00000000
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   priority_flag: 0 = 0x00000000
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   schedule_delivery_time: NULL
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   validity_period: NULL
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   registered_delivery: 0 = 0x00000000
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   replace_if_present_flag: 0 =
> 0x00000000
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   data_coding: 0 = 0x00000000
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   sm_default_msg_id: 0 = 0x00000000
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   sm_length: 6 = 0x00000006
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   short_message: "Test 6"
> 2006-06-27 14:06:31 [11061] [37] DEBUG: SMPP PDU dump ends.
> 2006-06-27 14:06:31 [11061] [37] ERROR: SMPP[my-own-smsc]: Mallformed
> addr `12345', expected at least 7 digits.
> 2006-06-27 14:06:31 [11061] [37] DEBUG: SMPP[my-own-smsc]: Sending PDU:
> 2006-06-27 14:06:31 [11061] [37] DEBUG: SMPP PDU 0x989ba20 dump:
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   type_name: deliver_sm_resp
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   command_id: 2147483653 = 0x80000005
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   command_status: 10 = 0x0000000a
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   sequence_number: 1780 = 0x000006f4
> 2006-06-27 14:06:31 [11061] [37] DEBUG:   message_id: NULL
> 2006-06-27 14:06:31 [11061] [37] DEBUG: SMPP PDU dump ends.
> 
> Is this a bug, or really the dest address must have at least 7 digits?
> Shouldn't be the source address? I've temporarily fixed it changing
> the "7" to a "4", but I'd like to know if I'm doing something wrong
> (maybe shall I prepend the short number with an international country
> code?? I don't think so...) or if I've spotted a real bug.
> 
> Note that the error thrown is SMPP_ESME_RINVSRCADR but the check is
> apparently performed over the destination_addr. Is this right?

the destination address (if configured with dest-addr-ton = 1 in the smsc group) 
has to have at least 7 digits, since a 5 digit TON=1 is not reasonable.

What you have here is a shortcode number as destination, hence a network 
internal number, that should map to TON=5.

So simply set 'dest-addr-ton = 5' in the 'my-own-smsc' group and that's it.

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
-------------------------------------------------------------------
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.