SMPP TLV Parameters for Advanced Message Routing

Posted by on May 5, 2011 in Support Blog

Topic Keywords: , , , ,

There has been some interesting recent discussion about the use of optional SMPP TLV parameters to help facilitate message routing between SMS hubs.

Some of this discussion can be found at the following message thread on the NowSMS discussion forum: https://nowsms.com/discus/messages/1/70053.html

This article attempts to summarise this information. Those interested in further information are encouraged to join the discussion thread.

Most NowSMS users will have no reason to be concerned with these parameters. This article is presented primarily for the interest of those using NowSMS as part of an SMS hub application.

Part of the inspiration for this discussion is the GSM Association document “Open Connectivity SMS Hubbing Architecture IR.75”, which can be found at the following link: http://www.gsmworld.com/documents/IR7520_unrest.pdf

That document suggests using the SMPP TLV parameters source_subaddress (0x202) and dest_subaddress (0x203) for encoding routing information for the MCC (mobile country code) and MNC (mobile network code) of the source (sender) and destination (recipient) addresses.

This is done to help simplify the routing of messages by intermediary hubs.

Historically, SMS service providers have defined their own proprietary SMPP TLV to encode this information (if it is made available at all). For example, mBlox defines an mblox_operator parameter using TLV parameter number 0x1402.

Hopefully more providers will use the GSM Association Recommendation in IR.75 in place of proprietary parameters.

Future versions of NowSMS (releases after 2011.05.05) will include automatically include support for forwarding these parameters.

Support can be enabled in prior versions of NowSMS by creating or editing an [SMPPOptions] section in SMSGW.INI and adding the following entries to this section:

[SMPPOptions]
source_subaddress=202,HexString
dest_subaddress=203,HexString

(Note: Support for the HexString parameter format was added in 2007.04.)

It is necessary to use the HexString encoding format for this parameter, because the SMPP specification defines first byte of the value as being a binary code value for the type of subaddress. In the case of the GSM Association values, this first byte is always A0 (hex), indicating user specified.

The next 3 bytes are the MCC, followed by 3 bytes for the MNC.

ASCII character values are used for the MCC and MNC, and then converted to a hex string.

The IR.75 document provides an example using the MCC and MNC for AT&T USA, where MCC=310 and MNC=380.

Converting the MCC value from ASCII to its hex string encoding would produce the following sequence of bytes: 33 31 30, and MNC would result in the following: 33 38 30.

The resulting parameter value in hex string format would be A0333130333830.

To specify this value as a source subaddress in NowSMS via HTTP, the following parameter value would be used:

SMPPOption_source_subaddress=A0333130333830

This thread discusses the use of NowSMS accounting callbacks, which can be used to query and/or update these parameters. (Update support was added in the 2011.04.17 release.)

Most NowSMS users will have no reason to be concerned with these parameters.

However, here are a few of the scenarios where it may be necessary to use these parameters.

1.) 2-way (interactive) SMS applications may receive the SMPPOption_source_subaddress parameter to indicate the mobile network from which the request originated, and be required to supply this value as the SMPPOption_dest_subaddress when generating a reply.

Future versions of NowSMS (releases after 2011.05.05) will apply this logic automatically when processing a 2-way command that returns its text response directly. Other 2-way commands would need to look for the “&SMPPOption_source_subaddress=” URL parameter and generate an appropriate “&SMPPOption_dest_subaddress=” URL parameter when submitting a message reply back to NowSMS.

2.) When NowSMS is being used to route messages between providers, it may be desirable to route messages based upon the MCC/MNC value.

This can be done via SMS accounting callbacks. This concept is described in the following article:

https://nowsms.com/dynamic-sms-message-routing-with-http-callbacks

What is not mentioned in that article is that beginning with release 2010.05.17, NowSMS also includes SMPP TLV parameters in the accounting callbacks.

This allows the callback processor to inspect the “&SMPPOption_source_subaddress=” and “&SMPPOption_dest_subaddress=” parameters, using those values to determine which route to use for sending the message. (The callback returns a response of SMSCRoute=xxxxx to specify the route to be used, as described in the link referenced above.)

3.) As an extension to the previous scenario, it may be necessary for a system providing SMS hubbing services to apply or insert the above values.

For example, it may be desirable to apply a source_subaddress automatically to all messages received from a particular connection.

Or it may be desirable to perform HLR lookups and apply dest_subaddress parameters before routing.

NowSMS 2011.04.17 and later allow these TLV parameters to be updated by an accounting callback.

In addition to passing these parameters to accounting callbacks via HTTP URL parameters, NowSMS checks the response from the accounting callback to allow these parameters to be set or updated.

The accounting callback should return a “text/plain” response with any parameters to be updated separated by line breaks.

For example:

SMSCRoute=connectionA
SMPPOption_source_subaddress=A0333130333830
SMPPOption_dest_subaddress=A0323334303135

Note: To enable the ability to override SMPPOption parameter values in the accounting callback response, it is necessary at this time to add SMSAccountingAllowChanges=Yes to the [SMSGW] section of SMSGW.INI.

One other note for those not familiar with the NowSMS concept of accounting callbacks. These are HTTP callbacks where NowSMS send an HTTP request to a URL that you define.

These callbacks would normally reside on a separate web server. However, newer versions of NowSMS also support the ability to host PHP scripts locally, as described in the following article: https://nowsms.com/now-sms-native-php-scripts

For comments and further discussion, please click here to visit the NowSMS Technical Forums (Discussion Board)...