Rules

Overview

This section let you configure rules to control your SIM cards, send notifications (email, SMS, push API, etc.) or perform actions (e.g. change rate plan, change SIM Card status), when the rule triggers.

You can configure three types of rules:

  1. Event Rules - handles specific events (e.g. New Device, New Call Detail Record, etc.), that happen during the life cycle of the selected SIM cards.
  2. Usage Rules - handles the usage (e.g. data, SMS, etc.) of the selected SIM Cards, you can customize how the total usage is calculated.

The rules are applicable to all SIM cards, a list of selected SIM Cards or filtered by the selected tags, depending on your choice.

Rules Page

To access the Rules sections, select the options Rules in the sidebar MENU. In the rule section, the main view has three panels, one for each rule type (see picture below), with a table inside that shows the rules created.

../_images/rules_main_view.png

Example panels with configured rules.

Each row contain the basic information (Label, Type, Date Created) for each rule. In the column Actions you can select if you want to View or Delete the rule.

In the upper right side of each panel there is a ‘+’ sign, that let you create new Rules for that type.

At the end of this view, there is the History button that redirects you to the rules triggered page.

Create Rules

To create new rules, go to the main Rules page view and click the ‘+’ sign on each panel to select which type of rule you want to create. You will be redirected to a wizard form that helps you create new rules, divided in five steps:

  1. Label
  2. Rules Triggers
  3. SIM Card(s)
  4. Actions
  5. Notifications

Step 1 - Label

In this step you give a name to the new rule.

../_images/rules_create_first_step.png

First step in wizard form - Label.

Step 2 - Rules Triggers

In this step, you configure the triggers that rule needs to check to perform the actions or send the notifications. Each rule type has their own configuration, which are described in the next subsections.

Event Rules

First, chose the event you want to configure.

../_images/rules_create_event_triggers.png

Second step in wizard form - Rules Triggers (Event Rules).

There are currently, six event types to configure:

  1. New Data Session
  2. New Platform Simple Short Message (SMS)
  3. New Device
  4. New Location
  5. New SIM Card State

Each options has their own settings to configure.

  • New Data Session

When you configure the New Data Session event, you need to chose when you want to receive the notification, at the start of the session or at the end.

../_images/event_rule_new_data_session.png

Rule triggers when the new data session ends.

  • New Platform Simple Short Message (SMS)

When you configure the New Platform Simple Short Message (SMS) event, the rule triggers when the selected SIM Cards receives a SMS from the platform or send a SMS to the platform.

../_images/event_rule_new_sms.png

Rule triggers when there are new short message

  • New Device

When you configure the New Device event, the rule triggers when the selected SIM Cards have a new IMEI attached. Depending on the rule configuration you can lock SIM Cards to a specific IMEI, or create an IMEI range preventing the SIM Cards to attache to other devices. See below examples for possible configurations:

../_images/event_rule_device_no_to_imei_with_prefix.png

Rule triggers when the SIM Card doesn’t have a device attached and receives a new device with an IMEI prefix ‘12345678’.

Note

The IMEI prefix must at least have 8 digits.

../_images/event_rule_device_no_to_imei_without_prefix.png

Rule triggers when the SIM Card doesn’t have a device attached and receives a new device with an IMEI prefix that doesn’t start with ‘12345678’.

Note

This example is a good way for you to lock SIM Cards to a specific IMEI range. You can choose to suspend the SIM Card, when the rule triggers, preventing from using in other devices.

../_images/event_rule_device_any_to_any.png

Rule triggers when the SIM Card changes from any device to another.

Note

This example is a good way for you to lock SIM Cards to any IMEI already attach. You can choose to suspend the SIM Card, when the rule triggers, preventing from using in other devices.

  • New Location

When you configure the New Location event, the rule triggers when the selected SIM Cards enter a new country or network, depending on your choice.

../_images/event_rule_location.png

Rule triggers when the SIM Card enters a new country.

  • New SIM Card State

When you configure the New SIM Card State event, the rule triggers when the selected SIM Cards changes from one state to another, depending on your choice. See below examples for possible configurations:

../_images/event_rule_state_provisioned_active.png

Rule triggers when the SIM Card changes from provisioned state to active.

Note

This example is a good way to send an email notifications when a SIM Card is Activated.

../_images/event_rule_state_any_any.png

Rule triggers when the SIM Card changes from any state to another.

Usage Rules

First, chose the usage you want the rule to control. From the five possible options:

  1. Inbound Call(s)
  2. Outbound Call(s)
  3. Outbound SMS
  4. Data Usage
  5. Number of Data Connection
../_images/usage_rule_when.png

Usage type select list.

The second option let you choose how the rule counts the usage. There are two option:

  • “Each SIM Card” - the rule tracks the usage for each SIM Card.
  • “All selected SIM Card(s)” - the rule tracks the usage sum of all SIM Card(s).
../_images/usage_rule_sum.png

Usage sum type select box.

The third option let you type the usage amount cap, in order to trigger the rule.

../_images/usage_rule_usage_cap.png

Usage amount box.

The units and the total amount change depending on usage type. See the table below for more information:

Units Usage Type Max value
KB Data Usage 4294967295
MB Data Usage 4194303
SMS(s) SMS Usage 4294967295
Seconds Voice Usage 4294967295
Minutes Voice Usage 71582788
Hours Voice Usage 1193046

The fourth option let you choose the period in which the rule gatherers information to calculate to total usage.

../_images/usage_rule_period.png

Rule period select box.

Period Comment
Calendar Month Uses the data of the current month
Billing Cycle Uses the data of the current billing cycle of the triggered SIM Card
Calendar Week Uses the data of the current week
Calendar Day Uses the data of the current day
Past 24 Hours Uses the data from the last 24 hours
Past 7 Days Uses the data from the last 7 days
Past 14 Days Uses the data from the last 14 days
Past 30 Days Uses the data from the last 30 days
Custom Period Uses the data from the custom select period, counted in minutes or hours
Last Session Uses the data from the last session

Note

If you select Custom Period it will show the following box:

../_images/usage_rule_custom_period.png

Custom Period field in usage rules.

Step 3 - SIM Card(s)

In this step, you select the SIM Card(s) for the rule. There are three possible choices:

  1. SIM Card(s)
  2. Tags
  3. All SIM Cards

SIM Card(s)

Manually select the list of SIM Card(s) from your inventory. Use Ctrl key (or Cmd key in Mac) to select the SIM Card(s) you want to use or not.

../_images/rules_sim_cards.png

SIM Card list selection box.

Note

If your inventory has more then 1000 SIM Card(s), this feature is disable. Apply tags to your SIM Card() and create rules with them (see below).

Tags

If you use the Tags option, the rule will use the SIM Card(s) that have all of the Tags selected. You can create more tags using the Tags section.

../_images/rules_sim_tags.png

Tags options selection view.

All SIM Card(s)

If you use this option, the rules uses all SIM Cards in your account.

Step 4 - Actions

After selecting the SIM Cards, choose which actions you want the rule to perform in the SIM card(s) if it triggers. You can leave the options blank and the rule will jump this step.

For all rule types you can choose to change the SIM Card status. For examples, if one SIM Card triggers a scpecifc Rule triggers it will suspend the SIM Card(s) in question.

../_images/event_usage_rules_action.png

Actions step for Event and Usage Rules

Step 5 - Notifications

After selecting or not the actions, choose which notifications you want the rule to send when it triggers. You can leave the options blank and the rule will jump this step.

There are currently four types of notification to send:

  1. Email
  2. SMS
  3. Webhook (Push notification)
../_images/rules_notifications.png

Notifications step for all the Rules

  • Email

Sends an email with a default message to the selected email.

  • SMS

Sends a message to the selected number.

The selected number can be the Triggered Number or a Custom Number.

Note

SMS’s can only be sent to Truphone numbers.

The message sent can be the default message (select Default Message) or customizable (select Custom Message).

The following figures shows possible configurations:

../_images/rules_rule_actions_sms1.png

Send SMS with Custom Number and Custom Message.

../_images/rules_rule_actions_sms2.png

Send SMS with Default Number and Default Message.

  • Webhook (Push notification)

Sends a push notification to the selected server.

View Rule Details

You can click in the View button to view the details of a specific rule. The new page will show in a single page the triggers, SIM cards, the actions adn the notifications. You can click Edit to start editing the page.

../_images/rules_detail_view.png

Details of existing rule.

History

You can click in the History button to view all the list of all the triggered rules and the actions.

../_images/rules_history.png

History of triggered rules.

To export the information you can click “Export” and choose the method to export the information, see Rules History Export for more information.