Rules
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 | |
---|---|---|
| Value of field | SMPP system ID |
| Value of field | SMPP system type |
Routing
Field | Match using | |
---|---|---|
| Value of field | Has an SMSC been selected for routing message |
| Value of field | Selected SMSC API ID |
Short message (submit_sm) fields
Field | Match using | |
---|---|---|
| Value of field | Service type |
| Value of field | Source address |
| Digits of destination mobile number | Destination address |
| Country of destination mobile number | Country of destination address |
| Network of destination mobile number (based on mobile prefix) | Network of destination address |
| Value of field | TON of source address |
| Value of field | NPI of source address |
| Value of field | TON of destination address |
| Value of field | NPI of destination address |
| Value of field | Default message ID |
| Value of field | Protocol ID |
| Value of field | Data coding |
| Value of field | ESM class |
| Value of field | Registered delivery |
| Value of field | Priority 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:
|
|
Actions
Reject message
action | submit_sm_resp |
---|---|
| 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 |
---|---|---|
|
| type: string |
| 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 |
---|---|---|---|---|
|
|
| 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 |
---|---|---|---|
|
|
Replace short message text with value specified. | type: string Text for short message field. |
Insert at start of short message the value specified. | |||
Insert at end of short message the value specified. |
Modify short message field (regular expression replace)
action | parameter | op | re | fmt |
---|---|---|---|---|
|
|
Regular expression replacement of text. | type: string ECMAScript regular expression. Example: | type: string Example: |
Example:
Using re of |
Further examples for regex_replace
:
Input | regex_replace | Output |
---|---|---|
| re: fmt: Action: |
|
Set SMSC route (global routing rule)
action | smsc |
---|---|
| 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