Notifications
Notification Messages
As part of handling any N2IWF action rule, a pre-configured notification message may be sent via SMPP or USSD.
All notifications for the N2IWF are configured in the NOTIFICATIONS
LogicApp service
global variable.
Several default parameters may be defined as additional LogicApp service global variables and these may be overridden on a per-notification basis. Note that if default values are not specified, all notification messages must specify all values.
Each parameter, both per-notification and default parameters are N2SVCD rule engine rulesets where the N2IWF selector rule extensions apply.
A sample notification configuration might be:
<global name="NOTIFICATION_TO_DEFAULT" from_var="logical"/>
<global name="NOTIFICATION_FROM_DEFAULT" type="array">
<rule from_var="notf_from"/>
</global>
<global name="NOTIFICATION_APP_DEFAULT" literal="SMPP"/>
<global name="NOTIFICATION_PROTO_DEFAULT" literal="smpp"/>
<global name="NOTIFICATIONS" type="array">
<notification name="notf1">I am a default notification.</notification>
<notification name="notf2">
<to from_var="called"/>
<protocol type="array">
<rule literal="ussd"/>
</protocol>
<app literal="SIGTRAN"/>
<text>I am a notification with overrides.</text>
</notification>
</global>
In the above, two notifications are defined and would have the following configuration:
Name | To Address | From Address | Protocol | Sending Application |
Body |
---|---|---|---|---|---|
notf1 |
Variable logical |
Variable notf_from |
SMPP | SMPP |
I am a default notification. |
notf2 |
Variable called |
(none) | USSD | SIGTRAN |
I am a notification with overrides. |
Note that sending notifications requires additional N2SVCD configuration for SMPP and/or USSD.
SMPP notifications are sent asynchronously and any response (submit_sm_resp
) or delivery notification (deliver_sm
)
messages are not waited for nor checked.
USSD notifications are sent synchronously and the result (ussdNotify_RR
) is waited for but not checked.
Notification Defaults
The following notification parameters may be specified as LogicApp service global variables:
Global | Type | Description |
---|---|---|
NOTIFICATION_TO_DEFAULT |
String | An N2IWF selector ruleset to specify the default notification to address. |
NOTIFICATION_FROM_DEFAULT |
String | An N2IWF selector ruleset to specify the default notification from address. Not applicable for USSD messages. |
NOTIFICATION_APP_DEFAULT |
String | An N2IWF selector ruleset to specify the default notification sending application. |
NOTIFICATION_PROTO_DEFAULT |
String | An N2IWF selector ruleset to specify the default notification protocol. Must be either smpp or ussd . |
NOTIFICATION_WAIT_SECONDS |
String | An N2IWF selector ruleset to specify the number of seconds to wait for a network response to the notification. Only applicable for USSD messages. (Default: 1 ) |
Notification Definition
Each notification
can support the following parameters:
Attribute | Type | Description |
---|---|---|
name |
String | [Required] The unique name for this notification message. Used in rules to specify the notification to send. |
to |
String | [Conditional] The normalised destination address for the notification message. Must be specified if no default value applies. |
from |
String | [Conditional] The normalised from address for the notification message. Must be specified if no default value applies. Not applicable for USSD messages. |
app |
String | [Conditional] The N2SVCD application to use to send the notification message. Must be specified if no default value applies. |
protocol |
String | [Conditional] The protocol to send the notification message in on the wire. Must be specified if no default value applies. |
flash |
Boolean | Whether the message should be treated as a flash message (i.e. displayed without storage). Only applicable to SMPP messages. (Default: false ) |
text |
String | The plain text body of the notification message. Will be encoded into the appropriate on-the-wire characters by the sending N2SVCD application. May contain dynamic notification text definitions. |
Dynamic Notification Text
Notification bodies may optionally contain any amount of dynamic text indications. These are indicated between %
characters and refer to rule engine variable of the same name. At runtime, dynamic text will be filled with
the variable value. For example, %var1%
would be expanded at runtime to contain the contents of the variable named var1
.
If a literal %
character is required within a notification body, escape it with a leading !
, i.e. !%
.
Dynamic text may also include a Lua string format pattern after a |
character, with or without a leading %
.
For example, the text bodies %balance|.2f%
and %balance|%.2f%
are identical and will both present the contents of
the variable named balance
formatted to two decimal places.
If no format pattern is specified, the pattern %s
(i.e. a normal string) will apply.
Dynamic notification text can also include balance information provided by the OCS. In these cases, the specific balance component must be specified after the balance name separated by a period:
balance1.units
will use the balance value of the balance namedbalance1
.balance1.currency
will use the currency translation of the balance namedbalance1
.
As a fully-worked example, given the following configured notification body:
Your balance is %cash.currency%%cash.units|.2f%. You have %percent|.1f%!% of your %units% remaining.
… the following notification text might be generated:
Your account balance is $1.20. You have 10.2% of your free minutes remaining.
Where:
- The balance information from the OCS for the balance named
cash
is1.2
. - The currency translation for the
cash
balance is defined as$
. - The rule engine variables
percent
andunits
are set as10.21
andfree minutes
, respectively.