Hi,

You are fairly correct in your findings. If the user guide was as detailed as 
you suggest, it would be ~5000 pages long and very difficult to use and 
maintain. Its main task is to get newcomers up and running as fast as possible, 
while addressing 90% of their questions. Specific in depth issues that arise 
once in 4 years are to be handled by the ultimate documentation in all open 
source projects, the code, or in user groups. Even at the size it is now, ~150 
pages, newcomers prefer asking the list than to read it. Thus in effect asking 
contributors to rewrite it in each mail.

Now, with your questions:

addr_ton and npi codes are implemented only for smpp and smasi. Other smscs do 
not support it. The smpp autodetect function is very straightforward and simple 
(./gw/smsc/smsc_smpp.c: 772):

1) It affects both source and destination addresses.
2) If first digit is "+" it is international.
3) else if it is only digits or destination address it is national.
4) else if it is source address and contains letters, it is alphanumeric.

There are 6 npi and 6 ton possible values according to the GSM spec. These 
cannot be set by URL variables (in SMS push).

BR,
Nikos

----- Original Message ----- 
  From: shaded 4 
  To: [email protected] 
  Sent: Thursday, September 10, 2009 9:41 AM
  Subject: How kannel sets TON/NPI - international vs national numbers


  Hi,

  I knew very little about TON and NPI before, but I'm learning fast now.

  When we give a message to kannel to send it to a SMSC, and the destination
  number is a normal 10-digit raw number, kannel sends it with TON/NPI of 2/1 .
  (I believe TON=2 means "national number").

  It appears that at least one of our SMSC's is configured in this way:
  When kannel gives it a message to send to the customer, this default
  TON of 2 works fine only as long as the destination number begins
  with 04 or 61 (61 being Australia, our country code).
  Our SMSC treats any other number as "international" and will reject
  the message unless we send the message with a TON of 1
  ("international number").

  But how do we get kannel to 'recognize' an international number
  and therefore set the correct TON? There is very little about TON/NPI
  in the user guide unless I'm missing something.

  A couple of ways that I could find:
  a) If you give kannel a destination number and explicitly prefix it with "+"
      (must be URL-encoded as %2B or it won't work), then kannel treats it
      as an 'international' number and automatically sets the TON to 1.

      According to http://www.kannel.org/pipermail/devel/2006-July/000067.html ,
      this is the "only" method that kannel uses to distinguish between
      national and international numbers.
      Is that the case?

      So our application would have to be modified to put a "+" in front of
      an "international" number, before pushing it to kannel.
  b) In kannel's smsc configuration, the following setting could be made in
      order to force the TON to 1 no matter what.
          dest-addr-ton = 1
      So for each SMSC that we connect to, we would probably have to have
      to have a pair of near-identical smsc configs in kannel (e.g. SMSC_BOB1
      and SMSC_BOB2) - one which forces the dest TON to 1, and one normal one 
which
      acts as normal.
   
      Our application would then have to be modified to send it to the correct
      smsc name configured in kannel, i.e. SMSC_BOB1 or SMSC_BOB2, depending on
      if the number is "international".

  So in either case, we would have to modify our application, to "recognize"
  an international number before passing to kannel.

  Is there any way to configure kannel itself to "recognize" an international 
number
  without having to modify our application? (i.e. in our case: if the number
  begins with 04 or 61 then kannel sets the TON to 1, otherwise use the
  default TON of 2.)
  I can't find any way of doing this so I don't think there is a way?

  A couple more questions:
  - Is there any documentation on the algorithm kannel uses to set the TON/NPI
      of the destination number?

      One of the very few references in the user guide say that
      dest-addr-ton is 0 by default and dest-addr-npi is 1 by default.

      So if the dest-addr-ton setting was omitted from my config, I expected 
that 
      kannel would always set it to 0.

      But it obviously doesn't because as described above, it automatically 
sets it to 2
      (National) for a fairly normal-looking raw numbers, and to 1 for a number
      with a + in front (%2B).

      So even though it's not evident from the user's guide, kannel does
      follow some sort of algorithm to set the dest-addr-ton dynamically.
  - Are there any official websites which correctly describe all possible values
      for TON and NPI?
      E.g. I've found
          
http://www.quintum.com/support/products/rs/sysdoc/webhelp/type_of_number_(ton).htm
          http://en.wikipedia.org/wiki/Numbering_plan
      but I'm sure I've seen more values than just these.

Reply via email to