Flow Operations
Introduction
Flow operation data structures are the key containers for flow representation. Flows are stored as JSON within the N2ACD PostgreSQL database and are represented in JSON with the following key attributes:
Attribute | Type | Description |
---|---|---|
always_present_calling
|
Integer |
[Privileged] This parameter causes the service logic to override the Presentation
Indicator for the Calling Party Number. If always_present_calling is set to 1 then
any AttemptTermination operations performed as part of this flow will always
force the Calling Party Number Presentation Indicator to Presentation Allowed.
|
operations
|
Object | See the following section. |
Note features marked as [Privileged] are not available to all users, and the API and GUI will perform appropriate checking when the flow is created or updated.
Example Flow
An example JSON representation of a flow and its operations could be as follows:
{
"operations": {
"5": {
"id": 5,
"type": "Start",
"base_node": 1,
"exits": [ 4 ]
},
"4": {
"id": 4,
"base_node": 2,
"type": "Location",
"exits": [ 1, 2 ],
"config": {
"rules": [
{
"geography_entry": "Auckland 2",
"exit_idx": 1
},
{
"geography_entry": "Gisborne 6",
"exit_idx": 1
},
]
}
},
"2": {
"id": 2,
"type": "AttemptTerminate",
"base_node": 6,
"exits": [ null ],
"config": {
"destinations": [ { "number": "032420002" } ]
}
},
"1": {
"id": 1,
"type": "AttemptTerminate",
"base_node": 3,
"exits": [ null ],
"config": {
"destinations": [ { "number": "032420003" } ]
}
}
}
}
This represents a flow which performs geographic routing, and terminates to 032420002
for callers from Auckland
/Gisborne
and 032420003
otherwise.
Operation Attributes
The operations
is a Hash of Operation Objects, keyed by the operation id
.
All Operation Objects have the following parameters.
Parameter | Type | Description |
---|---|---|
id
|
Integer |
[Required] The numeric operation ID. This must match the Object's key in the operations hash.
|
type
|
String |
[Required] Name of the operation type, e.g. Start , Menu , etc.
|
exits
|
Array of Integer |
[Required] Array of all of the "next operation" IDs to which this operation is connected.
Indexes into this array should be zero-based. The Array element may also be null , which indicates that this exit leads to the
end of all processing. If the caller is still on the line when this exit is taken,
the call will be disconnected by the switch.
|
config
|
Object |
Most Operation Objects will have a config describing the particular configuration of
this operation instance. The structure of this config depends on the operation type .
|
Announcement Attributes
Several operations have announcements as part of their config
structure. All announcement configuration
Objects have the following parameters:
Parameter | Type | Description |
---|---|---|
set
|
String | [Required] Name of the (public or private) announcement set which contains this announcement. |
entry
|
String | [Required] Name of the announcement entry, which must be an announcement configured within the specified announcement set. |
repetition
|
Integer |
Number of times this announcement entry should be repeated.
Support for this feature is specific to the individual announcement audio platform (IVR/UIP/SRF). (Default = 1). |
duration
|
Integer |
If specified to a value greater than zero, the announcement will be extended to the indicated duration in seconds.
Support for this feature is specific to the individual announcement audio platform (IVR/UIP/SRF). (Default = 0). |
Pattern Matching
Many nodes within flows offer pattern matching for validation of user input, etc. In all cases, this uses Lua syntax for pattern matching. This syntax is similar to regular expressions, but more limited.
The following character patterns are most often used in Lua pattern matching within N2ACD:
Pattern | Contents |
---|---|
%a |
Letters |
%l |
Lower case letters |
%u |
Upper case letters |
%d |
Digits |
%w |
Alphanumeric characters |
%x |
Hexadecimal digits |
%p |
Punctuation characters |
%s |
Space characters |
Some characters have special meanings in a pattern:
Character | Contents |
---|---|
( and ) |
Specify the start and stop of a capture group. |
. |
Matches any single character. |
+ |
Matches one or more occurrences of the previous pattern. |
* |
Matches zero or more occurrencs of the previous pattern. |
- |
As for * , but matches the shortest match possible. |
? |
Matches zero or one occurrences of the previous pattern. |
[ |
Specifies the start of a custom character class, and is terminated with ] . This class matches any of the characters in it as a pattern. |
^ |
Either used within a customer character class to invert the class, or used within a pattern to match the start of the string. |
$ |
Matches the end of the string. |
% |
Escape character for other special characters. |
Some examples of pattern matches are:
Pattern | Description | Example Matches |
---|---|---|
021 |
Match 021 exactly. |
021 |
0212* |
Match 021 followed by zero or more 2 digits. |
021 0212 02122 |
(021)* |
Match zero or more of the entire group 021 . |
<empty> 021 021021 |
[AB1-5]* |
Match zero or more A or B characters or digits within the range 1 to 5 . |
<empty> 53B212 ``B1234A543` |
[^AB1-5]* |
Match zero or more characters that are not A or B characters or digits within the range 1 to 5 . |
<empty> F8976 8879D |
.* |
Match zero or more of any digit or character. | <empty> 02123B 022335 |
.*021 |
Match any number which ends in 012. | 021 54321021 |
For further details, refer to the official Lua pattern matching documentation.