SMS Gateway SMSC/ESME TON/NPI
I'm developing an SMS Gateway and I was thinking about the features that I should implement in it. So I reviewed some SMS gateways (SMSNOW, SMS studio, and Ozeki) for examples.
I almost finished the implementation but I came across a feature in almost all SMS gateways whi开发者_开发技巧ch allows the user to specify TON/NPI for SMSC and ESME.
I understand that when the SMS gateway is preparing to send the sms using the SMPP protocol it would need to parse the sender/reciever number and based on that, specify TON/NPI. And I understand that it's great to allow you to override the defaults and specify your own TON/NPI.
What I don't understand is why all SMS gateways give you the option to specify your own TON/NPI for the SMS gateway when it acts as SMSC (when it receives SMS, not sending them).
What would the SMS gateway do with the specified TON/NPI when it recieves an smpp SMS?
The full specification of an SMS source address involves 3 attributes:
- TON
- NPI
- The actual Address
TON = Type of Number.
This specifies whether the number is a full International Number (i.e. needs the +
prefix), or a National Number, or even an alphanumeric sender (i.e. includes up to 11 characters of text instead of a numeric sender, quite useful for advertising).
NPI = Numbering Plan Indicator
This specifies which numbering standard the number is following. It could be the E.164 standard international numbering, or the operator's private numbering (for premium rated services for instance).
The actual Address.
An SMSC would need the TON/NPI to know how to interpret the bytes stored in the Address. If for example the TON is alphanumeric (5), it knows the bytes in the address need to be interpreted as characters and encoded accordingly, while if it is International (1), it would split each byte into 2, with each half byte representing a different digit for the sender.
You can refer to the SMPP 3.4 specification Sections 5.2.5 and 5.2.6 for a full list of these TON/NPI possibilities. The specific SMS gateway you're using might restrict you from using some of them.
TON (Type of Number)
If you wish to specify a special value for the TON, the available options are:
0: Unknown 1: International 2: National 3: Network Specific 4: Subscriber Number 5: Alphanumeric 6: Abbreviated
NPI (Numbering Plan Identification)
For NPI, the available options are:
Unknown = 0
ISDN/telephone numbering plan (E163/E164) = 1
Data numbering plan (X.121) = 3
Telex numbering plan (F.69) = 4
Land Mobile (E.212) =6
National numbering plan = 8
Private numbering plan = 9
ERMES numbering plan (ETSI DE/PS 3 01-3) = 10
Internet (IP) = 13
WAP Client Id (to be defined by WAP Forum) = 18
TON and NPI Defaults
Short Code (3 digits to 8 digits in length) If the source code/address is a Short Code
TON = 3
NPI = 0
Long Code (10 digits to 15 digits in length, excludes the plus sign)
TON = 1
NPI = 1
Alphanumeric If the source code/address is Alphanumeric (contains both letters and numbers or only letters)
TON = 5
NPI = 0
精彩评论