SMPP Error Code Handling in NowSMS

Posted by on Jun 14, 2007 in Support Blog

Topic Keywords: , ,

The default SMPP error code handling behaviour for NowSMS with an SMPP connection is as follows:

For most SMPP error codes, NowSMS will assume that the error is temporary, and retry message delivery with a delayed retry schedule.

The exceptions to this are detailed below: The following error conditions cause NowSMS to record a message delivery failure and NOT retry sending:

ESME_RINVDSTADDR (0x0B, invalid destination/recipient address)
ESME_RINVSRCADDR (0x0A, invalid source/sender address)
ESME_RX_R_APPN (0x66, receiver reject message)

The following error codes cause NowSMS to retry more times than the RetryMaxAttempts setting (default=20) allows:

ESME_RTHROTTLED (0x58, throttle error, slow down)
ESME_RMSGQFUL (0x14, message queue full)

For ESME_RMSGQFUL and ESME_RTHROTTLED errors, instead of expiring after RetryMaxAttempts, additional retries are allowed, up to RetryMaxAge minutes. By default, RetryMaxAge is 1440 minutes (or 24 hours).

For all other errors, NowSMS will retry sending the message up to RetryMaxAttempts times (default=20).

However, if you have particular error codes from your SMS provider that you need to treat as failure, you can add them to the SMPPRejectErrorCodes setting. For example, some SMPP providers have defined their own extended error codes that you need to configure NowSMS to treat as a failure without performing any retries.

For example, to treat the 0xFE error as a permanent error, you would edit SMSGW.INI, and under the [SMSGW] header, add:

SMPPRejectErrorCodes=FE

(Note that you must specify the error code value in hexadecimal.)

For error codes other than those listed above (or that are configured under the SMPPRejectErrorCodes setting in SMSGW.INI), NowSMS applies a delayed retry schedule.

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 in the outbound queue).

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 added to the [SMSGW] section of the SMSGW.INI file to provide additional control for the retry schedule:

RetryDelay=
RetryDelayMultiplier=
RetryDelayAfterAttempts=
RetryDelayMax=
RetryMaxAttempts=
RetryMaxAge=

The above parameters control retry behaviour for when NowSMS is submitting messages to an SMSC and an error occurs. If the settings are under the [SMSGW] header, they will apply to all SMSC connections. These settings can also be added to an SMSC specific header (e.g., [SMPP – server:port]) if they should only apply to that connection.

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.

For ESME_RMSGQFUL and ESME_RTHROTTLED errors, instead of expiring after RetryMaxAttempts, additional retries are allowed, up to RetryMaxAge minutes. By default, RetryMaxAge is 1440 minutes (or 24 hours).

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

9 Responses to “SMPP Error Code Handling in NowSMS”

  1. marc_orange says:

    is the retry options can be specific to an error message or for all the error?

  2. marc_orange says:

    sorry, i have to be more explicit.
    we have a recurent error coming when a subscriber try to send MMS to a short number that is not configured in the MM7 routing. The behaviour of NOW MMS for this kind of MMS is that the MMS are send to MM1 interface. the result is a “Message queue full” message (that is supposed to be “destination unreachable ” but…). The message cause when high trafic load a high CPU usage.
    to prevent the comsumption of CPU , is it possible to change the default value for retry ( RetryMaxAttemps = 20 )to a value like “1” but only in case of ESME_RMSGQFUL (0x14, message queue full)
    error ?, this is because this kind of message ( destination short number that are not configured in MM7 ) are not wanted.

  3. Bryce Norwood says:

    Hi Marc,

    What you can do in this case is add ESME_RMSGQFUL (0x14) to the SMPPRejectErrorCodes list by editing SMSGW.INI, and adding SMPPRejectErrorCodes=14 under the [SMSGW] header.

    This will change the default handling for that error code so that NowSMS will immediately record the message as a delivery failure with no further retry.

    -bn

  4. Bryce Norwood says:

    Further to my last comment, I should also mention that the normal behaviour for NowSMS when it gets an ESME_RMSGQFUL response is to continue to retry for more than MaxRetryAttempts. (ESME_RMSGQFUL and ESME_RTHROTTLED are “special” errors that normally get more retries.)

    The reason for this is because this error is often returned when there is a temporary overload problem at an SMSC or service provider, and we want to allow time for the provider to correct the problem.

    For these special errors, NowSMS will apply an increased delay before retrying the message … however NowSMS will retry for more than RetryMaxAttempt times. By default, NowSMS will continue to retry for 1440 minutes (24 hours).

    By adding ESME_RMSGQFUL to the SMPPRejectErrorCodes list as I mentioned above, a message will not be retried at all if the SMSC returns this error code.

    -bn

  5. marc_orange says:

    Hi Bryce,
    thanks for your response,
    i will try asap, because we plan some happy hour MMS that will cause trouble in the current configuration.
    but is there any configuration issue to prevent sending MMS to shortnumber via MM1 Interface. Or to prevent sending MMS to a number with less than 4 digit by example?

  6. marc_orange says:

    Sorry for spam,
    Do we have to restart the sms service in order the change take effect?
    Regards
    Marc

  7. Bryce Norwood says:

    For most SMSGW.INI file edits, the SMS gateway service needs to be restarted for the setting to take effect.

    This particular setting (SMPPRejectErrorCodes) should be detected without requiring a restart, but a restart is probably a good idea.

    The MMS related question would probably be better handled on the discussion board … unfortunately summer holidays have left me a bit behind in responding to queries there (I think we’re back to normal staffing next week). It is possible to define an “MMSC Routing”, where the route type (route messages via) is “Block/Reject Message”. Put “?,??,???,????” in for “Route messages to this account for recipient phone number(s)” and this will cause the MMSC not to accept any messages that are addressed to a 1, 2, 3 or 4 character recipient number.

    -bn

  8. marc_orange says:

    thanks a lot
    be the force wih you to forget holiday 😉

  9. Bryce Norwood says:

    Effective with the 2008.10.01 release, we added a new option for SMPPRejectErrorCodes.

    It is now also possible to specify “SMPPRejectErrorCodes=All”, which indicates that all error codes, except ESME_RTHROTTLED and ESME_RMSGQFUL should be considered a permanent error, so that NowSMS will not retry submitting the message. If you want to also treat ESME_RTHROTTLED and ESME_RMSGQFUL, it is also possible to include their error codes (58 for ESME_RTHROTTLED and 14 for ESME_RMSGQFUL) in this setting, e.g., “SMPPRejectErrorCodes=All,58,14”.