Core Configuration
Configuration
This LogicApp instance may specify the following N2SVCD Lua service global variables for use with the N2CUG SVC library:
CUG_ACTION_RULES: (required) the possible CUG action rule configurations that may be used.CUG_LOOKUP_RULES: (required) the possible CUG lookup rule configurations that may be used.CUG_SELECTORS: (required) the available CUG selector rules to use for selecting the appropriate configuration to apply.VARIABLES: optional N2SVCD rule engine variable definitions for use with other selector rules.RELEASE_ON_ERROR: set to a truthy value if calls should be released if an error occurs. If not present or not truthy, the call will be allowed to continue.CUG_CACHES: optional list of CUG rulesets to use N2SVCD rule engine caching with.
Protocol Selection
The runtime SVC library requires a single protocol handler to be included within the include path of the N2SVCD LogicApp, e.g.:
<application name="N2CUG-Logic" module="LogicApp">
...
<config>
...
<services>
<service module="LhoScpApp::LhoScpLuaService"
libs="../../n2scp/apps/lho_scp/lib"
script_dir="../../n2cug/lua/svc/common/n2/n2svcd"
lua_lib_path="../lua/lib/?.lua;../../n2cug/lua/lib/n2/protocol/scp/?.lua;../../n2cug/lua/lib/?.lua;../../n2scp/lua/lib/?.lua">
The CUG protocol library selected must match the LogicApp service used, in this case LhoScpLuaService. The base
library for each protocol’s service must also be included as per the service’s documentation - in this case, the
N2SVCD LhoScpLuaService.
CUG Configuration Selector Rules
The rules used to select the CUG action rules configuration and CUG
lookup rules configuration to apply for a given call are standard
N2SVCD rule engine selector rules
within the CUG_SELECTORS LogicApp global. Each rule must contain two additional attributes that provide the
configuration to load when this selector applies:
actions- the name of a CUG action rule configuration to use.lookup- the name of a CUG lookup rule configuration to use.
Simple CUG configuration selector rules using the CUG SCP SVC library might be:
<global name="CUG_SELECTORS" type="array">
<rule service.terminating="1"
actions="terminating_actions"
lookup="terminating_lookup" />
<rule actions="originating_actions"
lookup="originating_lookup"/>
</global>
CUG Action Rule Configurations
Within the CUG_ACTION_RULES LogicApp global, individual CUG action rule configurations may be specified. Each of these
configurations in turn specifies the values that are used when the rule(s) that trigger them apply for the any given CUG
outcome.
The CUG action rule configuration global takes the following structure:
<global name="CUG_ACTION_RULES" type="array">
...
<actions name="actions1"
apply_lists="0"
show_sc="1">
<no_user_found type="array">
<!-- rule(s) for when no user is found -->
</no_user_found>
<not_allowed_list type="array">
<!-- rule(s) for when a number list disallows a call -->
</not_allowed_list>
<not_allowed_user type="array">
<!-- rule(s) for when user configuration disallows a call -->
</not_allowed_user>
<match_found type="array">
<!-- rule(s) for when a user and a match are found -->
</match_found>
<no_match_found type="array">
<!-- rule(s) for when a user is found, but no match is found -->
</no_match_found>
</actions>
...
</global>
Each CUG action rule configuration allows the following parameters.
| Parameter | Location | Type | Description |
|---|---|---|---|
name |
configuration attribute |
String | The name of this CUG configuration, as referenced in CUG configuration selector rules or other CUG configuration include directives. |
no_user_found |
configuration child |
Array | The list of CUG action rule rule elements to use to select the action to take when no CUG user_number is found. |
not_allowed_list |
configuration child |
Array | The list of CUG action rule rule elements to use to select the action to take when the CUG user cannot make/receive calls to/from the CUG match due to blacklist or whitelists applying. |
not_allowed_user |
configuration child |
Array | The list of CUG action rule rule elements to use to select the action to take when the CUG user cannot make/receive calls to/from the CUG match (or lack of match) due to user restriction settings applying. |
no_match_found |
configuration child |
Array | The list of CUG action rule rule elements to use to select the action to take when a CUG user_number is found but a CUG match_number is not found (and the call is not disallowed by list or user configuration). |
match_found |
configuration child |
Array | The list of CUG action rule rule elements to use to select the action to take when a CUG user_number is found and a CUG match_number is also found (and the call is not disallowed by list or user configuration). |
apply_lists |
configuration attribute |
Boolean | Whether to apply the restrictions of number lists. |
show_sc |
configuration attribute |
Boolean | Whether to send the match_number for display to the other party as part of a terminating operation. |
Each protocol handler specifies its own default values for these configuration fields. In the case of rule lists such as
no_user_found, any user-defined rules will be processed before the default rules. For simple parameters such as
show_sc, any user-defined value will override the protocol handler default.
CUG Action Rule Selection
Each CUG action rule configuration array list supports selecting the action to take when a CUG user is or isn’t found or when a call is disallowed. Each of these is supported as a list of rules that are applied in the order listed until a match is made.
Each rule can support the following attributes:
| Attribute | Type | Description |
|---|---|---|
action |
String | [Required] The action to take when this rule is matched. The possible values are protocol-specific. |
| (other available fields) | (various) | Any number of protocol-specific or core rule engine selector rule available fields to be used for matching. |
CUG Lookup Rule Configurations
Within the CUG_LOOKUP_RULES LogicApp global, individual CUG configurations may be specified. Each of these configurations
in turn specifies the values that are used when the rule(s) that trigger them apply for CUG lookups.
The CUG lookup rule configuration global takes the following structure:
<global name="CUG_LOOKUP_RULES" type="array">
...
<configuration name="lookup1"
allow_sc_user="1"
allow_match_sc="0">
<user_number type="array">
<!-- rule(s) for selecting a user number -->
</user_number>
<match_number type="array">
<!-- rule(s) for selecting a match number -->
</match_number>
</configuration>
...
</global>
Each CUG lookup configuration allows the following parameters.
| Parameter | Location | Type | Description |
|---|---|---|---|
name |
configuration attribute |
String | The name of this CUG configuration, as referenced in CUG configuration selector rules or other CUG configuration include directives. |
user_number |
configuration child |
Array | The list of N2SVCD rule engine selector rules rule elements to use to populate the CUG user number. |
match_number |
configuration child |
Array | The list of N2SVCD rule engine selector rules rule elements to use to populate the CUG match number. |
allow_sc_user |
configuration attribute |
Boolean | Whether to allow the user_number to be populated via a short code search. |
allow_match_sc |
configuration attribute |
Boolean | Whether to allow the match_number to be matched against short codes. |
Each protocol handler specifies its own default values for these configuration fields. In the case of rule lists such as
user_number, any user-defined rules will be processed before the default rules. For simple parameters such as
allow_sc_user, any user-defined value will override the protocol handler default.
CUG Action Rule Selection
Each CUG lookup rule configuration array list supports selecting the source to use for CUG lookups. Each of these is supported as a list of rules that are applied in the order listed until a match is made.
Each rule can support the following attributes:
| Attribute | Type | Description |
|---|---|---|
literal |
String | [Conditional] A literal value to use. One of literal, source, or from_var must be specified. |
source |
String | [Conditional] The source field to read, usually from the input context (i.e. starts with input.). The possible values are protocol-specific. One of literal, source, or from_var must be specified. |
from_var |
String | [Conditional] The rule engine variable name to read from. One of literal, source, or from_var must be specified. |
| (other available fields) | (various) | Any number of protocol-specific or core rule engine selector rule available fields to be used for matching. |
CUG Rule Caching
N2SVCD rule engine caching may be specified to be used for service logic processing. This must be defined within
the N2SVCD Lua service global variables CUG_CACHES.
Each cache definition is a single string that:
- Must begin with a valid configuration location.
- For everything except configuration selector rules, may also include a valid configuration item’s name within that location.
- For lookup rules or action rules, may also include a specific CUG concept within that configuration item.
Any cache definition that does not provide all applicable parts will be treated as applying to all unspecified parts.
A simple CUG configuration with cache might be:
<global name="VARIABLES" type="array">
<variable name="direction" mandatory="1">
...
</variable>
...
</global>
<global name="CUG_SELECTORS" type="array">
...
</global>
<global name="CUG_LOOKUP_RULES" type="array">
<lookup name="originating_lookup">
...
</lookup>
...
</global>
<global name="CUG_ACTION_RULES" type="array">
<actions name="originating_actions">
...
<not_allowed_list action="release" />
</actions>
...
</global>
<global name="CUG_CACHES" type="array">
<cache>CUG_SELECTORS</cache>
<cache>CUG_LOOKUP_RULES.originating_lookup</cache>
<cache>CUG_ACTION_RULES.originating_actions.not_allowed_list</cache>
<cache>VARIABLES.direction</cache>
</global>
This would result in the following lookups being cached:
- All configuration selector rules.
- All lookup rules within the configuration named
originating_lookup, regardless of lookup type. - Only
not_allowed_listaction rules within the configuration namedoriginating_actions. - Only N2SVCD rule engine variable lookups for the variable named
direction.
Valid configuration locations (the first part of a cache definition) are:
CUG_SELECTORfor configuration selector rules.CUG_LOOKUP_RULESfor lookup rules.CUG_ACTION_RULESfor action rules.VARIABLESfor N2SVCD rule engine variables.
Valid CUG concepts (the last part of a cache definition) are:
- Lookup rules:
USER_NUMBER- theuser_numberlookup rule array.MATCH_NUMBER- thematch_numberlookup rule array.
- Action rules:
MATCH_FOUND- thematch_foundaction rule array.NO_MATCH_FOUND- theno_match_foundaction rule array.NO_USER_FOUND- theno_user_foundaction rule array.NOT_ALLOWED_LIST- thenot_allowed_listaction rule array.NOT_ALLOWED_USER- thenot_allowed_useraction rule array.