The SIP B2BUA SCUR Pre and Post features define default session charging behaviour for Sentinel SIP as a B2BUA.
Overview
At a high level, the supported behaviour covers time-based session charging:
-
creating the reservation charging instance (
B2BUAChargingFeatureUtil.DEFAULT_SCUR_CHARGING_INSTANCE
) and default session counter on an initial request -
initial credit check
-
recurring credit re-authorisation and used unit reporting at regular intervals
-
responding to
ReAuthRequests
from an OCS or the Sentinel Diameter Mediation layer -
detection of session end conditions and credit finalisation.
The SCUR features can also be used in conjunction with other reservation charging features such as SDP Comparison and MMTel Adhoc Conference. The SCUR features automatically handle accounting by updating session counters and the charging timer. The charging timer is armed redundantly if the session is replicated.
User features wishing to enhance Sentinel’s SCUR behaviour might be concerned with:
-
requesting a credit reservation (for example, on a material SDP change)
-
inspecting and reacting to specific CCA result codes
-
temporarily suspending the sending of outgoing SIP messages scheduled on one or more legs during a credit check (already done for called party leg on initial credit check)
-
creating purpose-specific session counters (see the section on Charging API interactions)
-
temporarily suspending charging, for example during an announcement,
During any credit check, Sentinel automatically ensures all incoming messages are queued in the SLEE until the CCA (or a timeout) is received; that is, no further network events will be delivered to Sentinel and processed until the credit check is complete. Currently, Sentinel SIP only supports one charging instance per Sentinel session, though this instance may have multiple session counters. |
All Sentinel SIP’s charging features make use of the Sentinel SIP Charging Architecture.
Details
Feature script name |
B2BUAScurPreFeature and B2BUAScurPostFeature |
---|---|
Applicable contexts |
SIP service (INVITE dialog) |
SAS Support |
Yes |
Requisite features |
B2BUA |
Feature execution points |
|
Timer usage |
Execution-point targeted timer will trigger the feature at the SipAccess_ServiceTimer execution point on expiry. |
Session state inputs and outputs
Inputs
Name | Format | Description | Behaviour if null/invalid |
---|---|---|---|
SentinelSelectionKey com.opencloud.sentinel.common.SentinelSelectionKey |
selection key |
For selecting mappers |
Increment InputParameterErrors Common cleanup actions |
CurrentSipFeatureExecutionPoint com.opencloud.sentinel.feature.spi.SipFeatureScriptExecutionPoint |
Enum value |
Used to classify the triggering event; for example, the initial invite ACK may occur on SipAccess_PartyRequest. |
N/A |
B2BUAChargingCounterAddress com.opencloud.sentinel.charging.sessioncounters.SessionCounterAddress |
key/value pairs identifying the session charged service |
Determines which counter the feature will update with timing data (the SCUR features only treat one counter as the session charging counter at a time — concurrent time counters would need to be managed in part by other features, while tariff changes would require updating this field with the address of a new counter). Also see Outputs. |
No-op unless initial request |
LatestOcsAnswer org.jainslee.resources.diameter.ro.types.vcb0.CreditControlAnswer |
Last received CCA |
When the feature is triggered on an RAR or QUOTA_EXHAUSTION the feature checks if the Final-Units-Indication AVP was present in the last CCA before proceeding with pending credit reservation. If present it instead calls legManager.endSession(). |
Proceed with reservation |
CallEstablished java.lang.Boolean |
Alternative to an incoming initial invite ACK |
Indicates when to set the session start time and the initial charging timer in third party setup calls. |
Assumed false |
RequestUnitsSeconds java.lang.Long |
Non-negative long |
Number of seconds the post feature will request on the default session counter on any credit reservation if not already set. |
N/A - defaults to 60 |
Outputs
Name | Format | Description |
---|---|---|
B2BUAChargingCounterAddress com.opencloud.sentinel.charging.sessioncounters.SessionCounterAddress |
key/value pairs identifying the session charged service |
Mapped from initial incoming request in SIP-initiated sessions to determine the default session counter against which time will be charged. |
Charging API interactions
The charging API interactions fall under the following categories:
-
charging instructions issued on the
B2BUAChargingFeatureUtil.DEFAULT_SCUR_CHARGING_INSTANCE
itself -
updates made to all counters (which may or may not be time-based) on the charging instance, mainly limited to updates from CCAs and credit finalisation
-
complete implementation of time-based charging on the default counter.
Interaction with the default charging instance
Initialisation
When the pre feature is first triggered on an initial incoming request, it creates the default SCUR charging instance, under the name B2BUAChargingFeatureUtil.B2BUA_SCUR_CHARGING_INSTANCE
. It then maps the initial request to a session counter address written to the session state field B2BUAChargingCounterAddress. This is the default session counter on which all time-based charging is performed.
In a scenario with no initial incoming request, it is necessary for some user feature, such as the SIP Third Party Charging Feature, to initialize the charging instance and default session counter.
Initial and update credit checks
On any trigger other than an initial incoming request, both features check whether the B2BUAChargingFeatureUtil.DEFAULT_SCUR_CHARGING_INSTANCE
has been initialised. The first step is to check the instance exists in the ChargingManager, and then that the instance has a session counter with the address specified in session state B2BUAChargingCounterAddress. If either check fails, the feature ends immediately on the assumption that SCUR is not enabled.
The pre feature will issue a credit reservation:
-
On an initial SIP request
-
On expiry of the charging timer (
QUOTA_EXHAUSTED
) -
Or receipt of an RAR
If the Final-Units-Indicator
AVP was present in the previous CCA then a credit reservation will not occur, legManager.endSession() is called and a CCR-T is sent.
If a reservation was requested on the charging instance and there are no previous SIP requests on the calling party linked leg (in other words, the called party), the post feature treats it as an initial credit check. Therefore, the called party leg is suspended until the OCS authorises the call.
Interaction with all session counters
When a CCA is received, all counters on the ChargingInstance will be processed according to the algorithm outlined in Counter Update Algorithm Pseudo Code.
If a credit finalisation is raised, the post feature will clear the pending requested units on all session counters.
When charging using a non-default counter, another feature will need to set reported used and pending requested units on the counters as needed.
Interaction with the default session counter
The default SCUR session counter is fully managed by the SCUR pre and post features. Generally speaking, user features need not interact directly with this counter.
Setting end time on the default counter
When the post feature detects credit finalisation is raised, it sets the default counter’s end time to the current system time.
Setting reported units on the default counter
If either charging instruction is raised, the reported used units will be set on the default counter and the SCUR charging timer will be cancelled.
Setting start time on the default counter
On an incoming initial invite ACK, the pre feature records the current time as the start time on the default counter. In a third-party scenario the initial invite ACK is outgoing, so the start time is recorded when the CallEstablished session state field is true and the charging timer ID is null.
Setting pending requested units on the default counter
If a reservation instruction was issued by the user or pre features, and pending requested is 0, it will be set to the value of RequestUnitsSeconds in session state.
Setting reported used units on the default counter
If a finalisation or reservation instruction is issued, the post feature sets reported used units on the default counter. It uses the utility method in B2BUAChargingFeatureUtil.setReportedUsedMillis
, which simply deducts the cumulative committed units from the current chargeable time.
LegManager outputs
Instruction | Parameter | Description |
---|---|---|
suspend |
N/A |
Suspend the outgoing request leg on an initial credit check if it is not already suspended |
resume |
N/A |
Resume the leg suspended by the post feature on an initial CCA |
endSession |
SipResponse.SC_PAYMENT_REQUIRED |
Called when final units have been consumed |
Mappers
This feature uses two mappers:
-
The first converts the initial SIP request to SessionCounterAddress. The default implementation is SipRequestToSessionCounterAddress
// a mapper that takes a {{SipRequest}} and generates a {{SessionCounterAddress}}. final Mapper<SentinelSipSessionState> mapper = getMapperLibrary().findMapper( getSessionState().getSentinelSelectionKey(), SipRequest.class, SessionCounterAddress.class, mappingPoint);
-
The second mapper converts a CCA into a list of session counters. The default implementation is CCAtoSessionCounterList:
// a mapper that takes a {{CreditControlAnswer}} and generates a {{List<SessionCounter>}}. final Mapper<SentinelSipSessionState> mapper = getMapperLibrary().findMapper( getSessionState().getSentinelSelectionKey(), CreditControlAnswer.class, List.class mappingPoint);