Topic Keywords: 2-way SMS, retry attempts
This article will explain how NowSMS handles retry situations when processing inbound SMS messages via a 2-way command, and there is a connectivity or other problem processing the 2-way command, particularly with regard to HTTP based 2-way SMS message processing commands.
There are other articles that explain how NowSMS handles retry situations for outbound message delivery. A good overview can be found in the article SMPP Error Code Handling in NowSMS. While that article focuses primarily on SMPP connections, the general parameters do also apply to modems. Additional issues specific to CIMD2 and UCP/EMI SMSC connections can be found in the article SMS Retry Error Handling with UCP/EMI and CIMD2.
There are two types of error conditions to consider. One condition is that the 2-way command is unable to process a message and returns an error response, such as “500 Internal Error”. This could happen because of a web server configuration problem, or it could also happen because of a logic error in the 2-way command … for example, it is not uncommon to find programming errors in a 2-way command where unexpected message content causes unexpected problems. The other type of condition, is a connectivity problem where it is not possible to connect to the web server hosting the 2-way command.
If a web server returns a valid HTTP error response, such as “500 Internal Error”, NowSMS policy is to mark the message as bad and never retry the message. Over 5 years ago, older versions of NowSMS used to retry messages in these situations, but customers who encountered script problems complained about duplicate messages when their scripts returned unexpected errors. When a message in the 2-way SMS queue fails in this manner, a file with a .BAD file extension is created inside the NowSMS\SMS-IN directory structure. It is possible to rename the file with a .IN file extension to trigger NowSMS to reprocess the message.
The remainder of this document explains retry procedures for messages where it is not possible to connect to the web server hosting the 2-way command, or the web server does not return a valid HTTP response (timeout).
By default, NowSMS will retry 20 times with a staggered delay based upon the number of previous failures.
The default behaviour for the delayed retry schedule works like this:
After the first error, a retry can be attempted immediately (but first NowSMS will try other pending messages).
After the second error, NowSMS will wait 30 seconds before allowing the message to be retried.
After the third error, NowSMS will wait 60 seconds before allowing the message to be retried.
For each successive error, NowSMS waits an additional 30 seconds before allowing a retry.
After 20 errors, the message will be considered as failed.
The following parameters can be applied to the [2Way] section of the SMSGW.INI file to provide additional control for this retry schedule (this section of the file will not exist until you create it):
RetryDelay=
RetryDelayMultiplier=
RetryDelayAfterAttempts=
RetryDelayMax=
RetryMaxAttempts=
RetryDelay=#### specifies a number of seconds to wait to retry sending after an error condition, the default value is 30.
RetryDelayMultiplier=### specifies a multiplier to be applied for successive send failures, the default value is 1. For each failed attempt, the retry delay will be the product of RetryDelay*RetryDelayMultiplier*#FailedAttempts. To use a fixed retry delay of RetryDelay, specify RetryDelayMultiplier=0.
RetryDelayAfterAttempts=### specifies that the retry delay should only be applied after ### failed attempts, the default value is 2. NowSMS will immediately retry a failed message send until it has made RetryDelayAfterAttempts, after which it will apply a retry delay.
RetryDelayMax=### specifies the maximum number of seconds that NowSMS will allow to elapse between retries, putting a limit on the multiplier.
RetryMaxAttempts=### specifies the maximum number of retries that NowSMS will attempt before a message is rejected, the default value is 20.
Note: If memory serves me correctly, the default values will result in about 90 minutes worth of retries before erroring out. (And the message file being renamed with a .BAD extension.)
Note that if these same settings names are also used to control retry behaviour for outbound messages.
Retry settings set under the [SMSGW] section header will apply to both inbound (2-way) and outbound messages. If retry settings exist under both [2Way] and [SMSGW], [2Way] settings are used for inbound (2-way) messages and [SMSGW] settings are used for outbound messages.
Retry settings can also be placed under connection specific headers (e.g., [Modem – xxx] or [SMPP – server:port]) so that different rules can apply to different outbound connections.
For comments and further discussion, please click here to visit the NowSMS Technical Forums (Discussion Board)...