SCP Lua Service
LhoScpLuaService Module
Introduction
The LhoScpLuaService is a service for initiating LUA scripts running within the
LogicApp (see core n2svcd documentation). It operates in conjunction with
the Logic Hand-Off SCP Application,
LhoScpApp and the
SigtranApp.
The SigtrapApp receives the TCAP over SIGTRAN and passes it to the LhoScpApp which contains the INAP/CAMEL Codecs and performs the SCP state-machine management for each call.
The LhoScpApp sends SCP messages
to the LhoScpLuaService which is a plugin configured within the LogicApp.
The LhoScpLuaService receives the SCP-... messages and initiates a LUA
script execution within the LogicApp. The LUA script contains the service
logic which makes calls back via the LhoScpLuaService plugin to instruct the
LhoScpApp to perform SCP functions.
For underlying details, see the documentation for the SCP-… messages.
Configuring LhoScpLuaService
The LhoScpLuaService is configured within a LogicApp as follows:
<?xml version="1.0" encoding="utf-8"?>
<n2svcd>
...
<applications>
...
<application name="Logic" module="LogicApp">
<include>
<lib>../apps/logic/lib</lib>
</include>
<parameters>
...
</parameters>
<config>
<services>
<service module="LhoScpApp::LhoScpLuaService" libs="../../n2scp/apps/lho_scp/lib">
<triggers>
<trigger called_suffix="02" script_name="scenario_02_release_call"/>
<trigger called_suffix="03" script_name="scenario_03_continue"/>
<trigger called_suffix="04" script_name="scenario_04_abort"/>
<trigger called_suffix="05" script_name="scenario_05_connect"/>
</triggers>
</service>
</services>
<agents>
...
</agents>
</config>
</application>
...
</application>
...
</n2svcd>Under normal installation, following service attributes apply:
Attribute
Type
Description
module
LhoScpApp::LhoScpLuaService
[Required] The module name containing the LUA Service code.
libs
../apps/lho_scp/lib
Location of the
module for LhoScpLuaService.
script_subdir
String
An optional subdirectory for scripts used by this service.
.triggers
Array
Array of
trigger elements specifying LUA scripts to run for SCP calls.
.trigger
Object
Provisions a LUA script to run for a SCP call for a called/calling party.
Script Trigger Rules
Each SCP trigger rule defines the name of a script which is ready to handle an call for some/all called and/or calling party addresses.
Note that called and calling party addresses may contain hex digits A-F, and the matching is case-insensitive.
Each trigger Object in the config.triggers Array is configured as follows.
Attribute
Type
Description
called
Hex Digits
This trigger applies for only calls to this exact called party.
(Default = Trigger applies to all SCP calls).
called_prefix
Hex Digits
This trigger applies for only calls to called parties starting with this prefix.
(Default = Trigger applies to all SCP calls).
called_suffix
Hex Digits
This trigger applies for only calls to called parties ending with this prefix.
(Default = Trigger applies to all SCP calls).
calling
Hex Digits
This trigger applies for only calls from this exact calling party.
(Default = Trigger applies to all SCP calls).
calling_prefix
Integer
This trigger applies for only calls from calling parties starting with this prefix.
(Default = Trigger applies to all SCP calls).
calling_suffix
Integer
This trigger applies for only calls from calling parties ending with this suffix.
(Default = Trigger applies to all SCP calls).
script_name
String
The name of the LUA script to load (excluding the “.lua” suffix).
The script should reside in the directory configured for the LogicApp’s
lua_script_dir,
or in the specified subdirectory if script_subdir is configured for this service library.
Script Selection (SCP call Request)
The LUA Script selection to execute for a SCP InitialDP incall is a function of the called party and/or calling party digits derived from the InitialDP. These digits will have been normalised before handover.
The SCP LUA Service will iterate the configure trigger entries in the sequence
in which they are configured and find the first trigger which matches the received
called and/or calling parties (or a script which matches all called and/or calling parties).
Refer to the LogicApp configuration for more information on directories, library paths, and script caching parameters.
Script Entry Parameters (SCP Call Request)
The LUA script must be a LUA chunk which returns an n2svcd.handler, such as the following:
local n2svcd = require "n2.n2svcd"
local scp_api = require "n2.n2svcd.scp"
local handler = function (scp_call)
scp_api.release (32)
return
end
return n2svcd.handler (handler)The handler will be executed with a single scp_call entry parameter.
Field
Type
Description
scp_call
Object
[Required] The SCP control parameters for the message.
.ssp_inap
String
[Required] INAP/CAMEL variant.
The name of the INAP/CAMEL variant for the selected SSP Model handling this call.
This is camel1, camel2, etc.
.supported
Object
[Required] Container for supported feature flags.
.release_tone
0 / 1
[Required] Does the SSP Model support setting of
release_tone.
If this flag is not = 1 then service logic attempt to set release_tone
in charged call terminations or extensions will result in call-processing failure.
.fci
0 / 1
[Required] Does the SSP Model support sending of FCI information.
If this flag is not = 1 then service logic attempt to send FCI content
in call terminations will result in call-processing failure.
.interaction
0 / 1
[Required] Does the SSP Model support use of interaction using PlayAnnouncement
or PromptAndCollectUserInformation.
If this flag is not = 1 then service logic attempt to perform interaction
during the call control will result in call-processing failure.
.call_information
0 / 1
[Required] Does the SSP Model support sending of CallInformationReport (CIR).
If this flag is not = 1 then service logic attempt to use CIR features
in call terminations or extensions will result in call-processing failure.
.activity_test
0 / 1
[Required] Does the SSP Model support the use of gap-filling ActivityTest.
If this flag is not = 1 then service logic attempt to enable gap-filling
ActivityTest in call terminations or extensions will result in call-processing failure.
.call_trigger
ORIG / TERM / FWD
[Required] Indicator of the call trigger.
This distinguishes between originating, terminating, and forwarded call triggers.
.normalised_calling_party
Digit String
[Required] (Normalised) Calling Party Number address digits.
This is the calling party address digits after any configured ‘calling_party’ normalisation rules have been applied.
It is determined from the callingPartyNumber element of the InitialDP.
It is guaranteed to contain only 0-9A-F digits.
.normalised_called_party
Digit String
[Required] (Normalised) Called Party (BCD) Number address digits.
This is the called party address digits after any configured ‘called_party’ normalisation rules have been applied.
It is determined from the calledPartyBCDNumber (MO only) or calledPartyNumber element of the InitialDP.
It is guaranteed to contain only 0-9A-F digits.
.normalised_redirecting_party
Digit String
(Normalised) Redirecting Party ID address digits.
This is the redirecting party address digits after any configured ‘calling_party’ normalisation rules have been applied.
It is determined from the redirectingPartyID element of the InitialDP, if present.
It is guaranteed to contain only 0-9A-F digits.
.normalised_original_called_party
Digit String
(Normalised) Original Called Party address digits.
This is the redirecting party address digits after any configured ‘calling_party’ normalisation rules have been applied.
It is determined from the originalCalledPartyID element of the InitialDP, if present.
It is guaranteed to contain only 0-9A-F digits.
.forwarding_pending
1
This field is present and
1 if and only if the
gsm-ForwardingPending or callForwardingSS-Pending element is present in
the InitialDP.
.initialdp_arg
Object
[Required] Complete decoded InitialDP structure.
Script Return Parameters (SCP Call Response)
The return value from the LUA script should always be nil. Returning any other
value will generate a warning to the syslog.
The LhoScpLuaService API
A script processing SCP incalls must use the SCP API.
local scp_api = require "n2.n2svcd.scp"The following telephony functions are available for a controlled call.