Condition engine¶
The Condition engine is a general-purpose framework for defining conditions. Conditions control the visibility or execution of application features, such as Functions, and determine when Buttons appear. They evaluate criteria against real-time application state and can be combined with logical operators to express complex rules.
Syntax¶
Conditions are represented as JSON and defined by the Condition JSON schema.
A condition is a JSON object containing an "@": "type" property. The remaining properties depend on the condition type.
The following sections describe all available condition types.
Account key¶
Checks whether an account-level property matches a specified value.
Type: accountKey
| Field | Type | Description |
|---|---|---|
key |
String | Account property to check. |
matchType |
equal, startWith, endWith, contain |
Matching strategy. |
matchPattern |
String | Pattern to match against. |
Scope memory variable¶
Checks whether a scope memory variable matches a specified value. The applicable scope depends on where the condition is used.
Type: variable
| Field | Type | Description |
|---|---|---|
name |
String | Variable name. Can include a scope prefix (see Scopes). |
matchType |
equal, startWith, endWith, contain |
Matching strategy. |
matchPattern |
String | Pattern to match against. |
{
"@": "variable",
"name": "sipHeader[myVariableName]",
"matchType": "equal",
"matchPattern": "hello"
}
Call direction¶
Matches the direction of the current call.
Type: callDirection
| Field | Type | Description |
|---|---|---|
direction |
incoming, outgoing |
The call direction to match. |
Call state¶
Checks whether the current call is in one of the specified states.
Type: callState
| Field | Type | Description |
|---|---|---|
states |
Array of strings | List of call states to match (see Call FSM). |
Caller display name¶
Matches the caller's display name against a pattern.
Type: callerDisplayName
| Field | Type | Description |
|---|---|---|
matchType |
equal, startWith, endWith, contain |
Matching strategy. |
matchPattern |
String | Pattern to match. |
Caller transport URI¶
Matches the caller's SIP transport URI against a pattern.
Type: callerTransportUri
| Field | Type | Description |
|---|---|---|
matchType |
equal, startWith, endWith, contain |
Matching strategy. |
matchPattern |
String | Pattern to match. |
Group size¶
Checks the number of calls in the current group.
Type: groupSize
| Field | Type | Default | Description |
|---|---|---|---|
size |
Number | — | Number to compare against. |
op |
==, !=, >, <, >=, <= |
>= |
Comparison operator. |
Preference key¶
Matches a preference key's current value against a pattern.
Type: prefKey
| Field | Type | Description |
|---|---|---|
key |
String | Preference key name. |
matchType |
equal, startWith, endWith, contain |
Matching strategy. |
matchPattern |
String | Pattern to match. |
Version¶
Checks the application library version against a range.
Type: version
| Field | Type | Description |
|---|---|---|
minimum |
String | Lower version bound (exclusive). Semantic version format. |
maximum |
String | Upper version bound (exclusive). Semantic version format. |
Platform¶
Checks the platform the app is running on.
Type: platform
| Field | Type | Description |
|---|---|---|
platform |
String | One of: Android, iOS, Windows, Mac, Linux, Desktop, Mobile, Shared. |
Is conference¶
Checks whether the current call scope refers to a conference. Returns true when the scope represents a call that is part of a conference but does not resolve to a specific call within that conference.
Type: isConference
No fields.
Logical operators¶
AND¶
All listed conditions must evaluate to true.
Type: and
| Field | Type | Description |
|---|---|---|
operands |
Array of conditions | Conditions to combine. |
{
"@": "and",
"operands": [
{ "@": "callDirection", "direction": "incoming" },
{ "@": "callState", "states": ["established"] }
]
}
OR¶
At least one condition must evaluate to true.
Type: or
| Field | Type | Description |
|---|---|---|
operands |
Array of conditions | Conditions to combine. |
{
"@": "or",
"operands": [
{ "@": "callerDisplayName", "matchType": "contain", "matchPattern": "Support" },
{ "@": "callerDisplayName", "matchType": "contain", "matchPattern": "Helpdesk" }
]
}
NOT¶
Negates a condition.
Type: not
| Field | Type | Description |
|---|---|---|
operand |
Condition | The condition to negate. |
Testing utilities¶
Always true¶
Always evaluates to true. Useful for testing.
Type: alwaysTrue
Always false¶
Always evaluates to false. Useful for testing.
Type: alwaysFalse
Random¶
Randomly evaluates to true or false. Useful for testing. When Random is used in a reactive context, intervalMilliseconds controls the refresh rate.
Type: random
| Field | Type | Description | Default |
|---|---|---|---|
intervalMilliseconds |
int | How often the random value changes. If set to 0, the value does not refresh. Added in 26.2. |
1000 |
Internal conditions¶
Is Native Messaging enabled¶
Checks whether the conditions for displaying the Native Messaging tab are met.
These conditions include:
- Whether the messaging preference key is enabled.
- Whether the history contains messages.
This does not mean that the Messaging tab is currently displayed.
Type: isNativeMessagingEnabled
No fields.
Added in 26.2
Is Conferencing enabled¶
Checks whether the conditions for displaying the Conferencing tab are met.
These conditions include:
- Whether any type of conferencing is enabled.
This does not mean that the Conferencing tab is currently displayed.
Type: isConferencingEnabled
No fields.
Added in 26.2