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 |
|
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 |
|
sm.destination_addr | Destination mobile number |
|
sm.destination_addr.country/dialcode | Country dialcode |
|
π·ββοΈ sm.destination_addr.country/iso3166 | Country two-letter code |
|
π·ββοΈ sm.destination_addr.network/mnc | Network MNC |
|
sm.short_message | Short message text |
|
π·ββοΈ 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 30 days ago