Script code
Routing script code
A script starts with the begin keyword and ends with the end keyword.
begin
# route all messages to O2 UK SMSC 2
SMSC = smscid("O2-SMSC-2")
end
Use the # character at the start of a line to include comments within a script.
SMSC assignment (SMSC =)
Sets an SMSC to where a message should be routed.
Specify the SMSC by its short name:
SMSC = smscid("MLSMSCSimX")
Specify the SMSC by its API ID:
SMSC = smscapiid("1387e426-c962-78fd-ac30-06666d5c3860")
Select the next SMSC from a group:
SMSC = smscgroup("MLSimulators1").rr
match <field>
The match statement allows the comparison of <field> with values, where a match to a value will result in an SMSC assignment taking place.
match sm.destination_addr
startswith 447711 { SMSC = smscid("BTC-SMSC1A"); done; }
startswith 447722 { SMSC = smscid("BTC-SMSC1B"); done; }
matchend
The done keyword can be used to stop further execution of the script when a match takes place.
Match fields
<field> may be any of the following:
| Field | Description | |
|---|---|---|
| SMPP account | ||
| ac.system_id | Account system ID sending the message | match system_idabcd12340def { ... }abcd23450def { ... }abcd34560def { ... }matchend |
| ac.system_type | Account system type sending the message | |
| Short message | ||
| sm.service_type | Service type field in the short message | |
| sm.source_addr | Source address in the short message | match sm.source_addr447700123456 { ... }447700222333 { ... }447700444555 { ... }matchend |
| sm.destination_addr | Destination mobile number | match sm.destination_addr447700123456 { ... }447700222333 { ... }447700444555 { ... }matchend |
| sm.destination_addr.country/dialcode | Country dialcode | match sm.destination_addr.country/dialcode44 { ... }46 { ... }47 { ... }matchend |
| 👷♂️ sm.destination_addr.country/iso3166 | Country two-letter code | match sm.destination_addr.country/iso3166GB { ... }SE { ... }NO { ... }matchend |
| 👷♂️ sm.destination_addr.network/mnc | Network MNC | match sm.destination_addr.network/mnc23415 { ... }23433 { ... }23450 { ... }matchend |
| sm.short_message | Short message text | match sm.short_messagecontains hello { ... }startswith abc { ... }endswith def { ... }matchend |
| 👷♂️ sg.cost("...")/dialcode | SMSC group cost for country | |
| 👷♂️ sg.cost("...")/mnc | SMSC group for network |
Data topics may also be used as fields.
Match values
The following comparison operators may be used with the value being compared:
| Operator | Description | |
|---|---|---|
| eq | Equals (may be ommited) | |
| neq | Not equal | |
| startswith | Starts with |
|
| endswith | Ends with | |
| contains | Contains |
if <expression> 👷♂️
Perform actions based on one or more criteria.
The fields used in criteria for match are supported in if statements.
if
sm.destination_addr.country/dialcode eq 44 and
sg.cost("O2Bulk").dialcode("44") < sg.cost("VFBulk").dialcode("44")
{ SMSC = smscid("O2SMSC-1A") }
else
{ SMSC = smscid("VFSMSC-1A") }Updated about 1 year ago
