Skip to main content
Skip table of contents

Rules

Rules editor

Rules can be created to perform actions on messages based on defined criteria. One or more rules can optionally be associated with a customer’s SMPP account and applied to each message they send (MT) or receive (MO).

When using the rules GUI, criteria can be graphically constructed and actions added in the required order. JSON is used to define rule actions.

Actions include:

  • reject message (return negative submit_sm_resp)

  • modify message

    • change parameter (TON, NPI, ESM class, registered delivery, randomise source address, etc)

    • change message content (replace, regex replace, insert text left/right)

  • routing (set SMSC to be used)

Criteria can be specified based on the fields in a submitted message (submit_sm), SMPP account parameters, the date/time and SMSC status.

Rules can also be applied to inbound (MO) SMS messages. Source address and destination address fields (including TON, NPI) can be used in criteria.

Types of rules:

  • ESME submit rules: Applied to a customer’s messages where the rule has been associated with the customer’s SMPP account under the Rules tab of their SMPP account. Only these rules can currently be managed in the Rules section of the SSG.

  • Global routing rules: Applied to all outbound (MT) messages for an SSG instance and can be used to select the SMSC to which a message should be sent based on the rule’s criteria.

  • SMSC rules: Applied to messages once routing decision has been made and SMSC has been selected.

Criteria


Criteria can be defined using SMPP account details and fields from submitted messages.

SMPP account

Field

Match using

ac.system_id

Value of field

SMPP system ID

ac.system_type

Value of field

SMPP system type

Routing

Field

Match using

rt.is_smsc_selected

Value of field

Has an SMSC been selected for routing message

rt.selected_smsc

Value of field

Selected SMSC API ID

Short message (submit_sm) fields

Field

Match using

sm.service_type

Value of field

Service type

sm.source_addr

Value of field

Source address

sm.destination_addr

Digits of destination mobile number

Destination address

sm.destination_addr.country

Country of destination mobile number

Country of destination address

sm.destination_addr.network

Network of destination mobile number (based on mobile prefix)

Network of destination address

sm.source_addr_ton

Value of field

TON of source address

sm.source_addr_ton

Value of field

NPI of source address

sm.dest_addr_ton

Value of field

TON of destination address

sm.dest_addr_ton

Value of field

NPI of destination address

sm.sm_default_msg_id

Value of field

Default message ID

sm.protocol_id

Value of field

Protocol ID

sm.data_coding

Value of field

Data coding

sm.esm_class

Value of field

ESM class

sm.registered_delivery

Value of field

Registered delivery

sm.priority_flag

Value of field

Priority flag

sm.replace_if_present_flag

Value of field

Replace if present flag

Other

Field

TBA

Time of day

TBA

Day of week

TBA

SMSC load

TBA

SMSC pending messages

Level of messages undelivered (count or percentage)

TBA

SMSC submit_sm latency

Duration between SSG sending submit_sm and submit_sm_resp being received by SSG

Criteria operators that can be used with parameters in a short message include:

eq - equal to

neq - not equal to

isnull - is equal to null

isnotnull - is not equal to null

lt - less than

lte - less than or equal to

gt - greater than

gte - greater than or equal to

startswith

doesnotstartwith

endswith

doesnotendwith

contains

doesnotcontain

isempty

isnotempty

Actions


Reject message

action

submit_sm_resp

reject

type: number

Error number to be returned in SMPP command status field (default ESME_RSUBMITFAIL / 69 decimal).

Example: [{"action":"reject","submit_sm_resp":69}]

Modify message

General fields

Set field values.

action

parameter

value

modify

sm.service_type

sm.source_addr

sm.destination_addr

type: string

sm.source_addr_ton

sm.source_addr_npi

sm.dest_addr_ton

sm_dest_addr_npi

sm.sm_default_msg_id

sm.protocol_id

sm.data_coding

sm.esm_class

sm.registered_delivery

sm.priority_flag

sm_replace_if_present_flag

type: number

Example: [{"action":"modify","parameter":"sm.source_addr","value":"Google"}]

Modify source address field (random digits)

Set source address field value to begin with prefix digits and followed by specified number of random digits.

action

parameter

op

prefix

digits

modify

sm.source_addr

random

type: string

Digits at start of source address.

type: number

Number of random digits to append to prefix.

Example:

[{"action":"modify","parameter":"sm.source_addr","op":"random","prefix":"447700","digits":6}]

Modify short message field (assign, insert)

action

parameter

op

value

modify

sm.short_message

assign

Replace short message text with value specified.

type: string

Text for short message field.

insert_left

Insert at start of short message the value specified.

insert_right

Insert at end of short message the value specified.

Modify short message field (regular expression replace)

action

parameter

op

re

fmt

modify

sm.short_message

regex_replace

Regular expression replacement of text.

type: string

ECMAScript regular expression.

Example: a|e|i|o|u

type: string

Example: [$&]

Example:

[{"action":"modify","parameter":"sm.short_message","op":"regex_replace","re":"a|e|i|o|u","fmt":"[$&]"}]

Using re of a|e|i|o|u and fmt of [$&], an sm.short_message field with “Quick brown fox” will be replaced with “Q[u][i]ck br[o]wn f[o]x“.

Further examples for regex_replace:

Input

regex_replace

Output

Hello Petra. 1232 è il tuo codice di verifica.                                 

re: ^(.+)\s(\d*)\s.+

fmt: PIN code: $2. Please keep this safe.

Action:[{"action":"modify","parameter":"sm.short_message","op":"regex_replace","re":"^(.+)\\s(\\d*)\\s.+","fmt":"PIN code: $2. Please keep this safe."}]

PIN code: 1232. Please keep this safe.

Set SMSC route (global routing rule)

action

smsc

route

type: string

SMSC API ID of the SMSC to which the message should be routed. This ID can be found under the Control tab of the SMSC’s configuration dialog.

Example: [{"action":"route","smsc":"131234b8-aaaa-11eb-abcd-0123455c3860"}]

Resources

Useful resource for regular expression testing: https://regex101.com

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.