Re: Internal rerouting issues

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Dziugas Baltrunas schrieb:
> Hi,
> 
>> > Moreover, I noticed one more minor issue with rerouting. One would
>> > expect that both source and destination TON/NPI would remain the same
>> > in submit_sm as they were in deliver_sm, however, they are not. What
>> > is more, even if, say, destination address has TON = 1, Kannel will
>> > not treat it as an international number since there are no "+" in the
>> > beginning and as a result it will set TON to 2 (national number).
>> > Again, having dest-addr-ton = 1 in the smsc group makes a "workaround"
>> > for international numbers.
>> >
>>
>> That could be caused by receiver SMSC module if sending SMSC doesn't set
>> ton/npi values to international. It's not a kannel fault but sending 
>> SMSC.
> 
> No, this is not true. As I said, deliver_sm comes with TON set to
> international but after Kannel unpacks it to internal structure and
> then packs again, it gets lost since number does not have a '+'
> prefix. This is clearly seen from gw/smsc/smsc_smpp.c, pdu_to_msg and
> msg_to_pdu() functions. To be more precise, pdu_to_msg() does
> 
> msg->sms.sender = pdu->u.deliver_sm.source_addr;
> 
> and msg_to_pdu() does a check:
> 
>    /*
>     * if its a international number starting with +, lets remove the
>     * '+' 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);
>        pdu->u.submit_sm.dest_addr_ton = GSM_ADDR_TON_INTERNATIONAL;
>    }
> 
> which will never be true since '+' is only for mnemonics and it will
> rarely be put before the number. So the problem indeed is that msg
> structure does not have such a marker to store the type of src/dst
> number.
> 


Did you read sources carefully?

in pdu_to_msg:

     /* check source addr */
     if ((*reason = convert_addr_from_pdu(smpp->conn->id, 
pdu->u.deliver_sm.source_addr, ton, npi, smpp->alt_addr_charset)) != 
SMPP_ESME_ROK)
         goto error;

in convert_addr_from_pdu if ton international:
         /* international, insert '+' if not already here */
         if (octstr_get_char(addr, 0) != '+')
             octstr_insert_char(addr, 0, '+');

The same is true for destination. If sending SMSC set ton=1 
(international) then your source_addr will always has '+' in front.

For the sending smpp module we check for '+' and set ton=1 international 
then because it's only possibility to know that this is international 
number.

Maybe you don't using fresh CVS? or maybe you disabled 
addr-auto-detection? Then it's your fault...

Thanks,
Alex
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.