This feature creates and maintains records in the Rhino Session Ownership Facility for all SIP legs that have been flagged for tracking.
Feature Cheat Sheet
Feature Script Name |
ExternalSessionTracking |
---|---|
Applicable Contexts |
SIP service |
Call-Type |
All |
Session Plan |
All |
Execution Point |
Most SipAccess, SipMidSession, Subscription, and EndSession system post-scripts |
Network Operator Config |
None |
Subscriber Config |
None |
POJO or SBB |
POJO |
Feature FSMs |
None |
Feature Parameters |
None |
SAS Support |
No |
Prerequisite features |
None |
Feature Statistics
ExternalSessionTracking
statistics are tracked by the sentinel.sip
SBB and can be found under the following parameter set:
SLEE-Usage → sentinel.sip service ID → sentinel.sip SBB ID → feature.ExternalSessionTracking
Name | Type | Description |
---|---|---|
Started |
Counter |
Incremented when the feature is triggered. |
FailedToStart |
Counter |
Incremented when the feature fails to start. |
FailedDuringExecution |
Counter |
Incremented when the feature fails while executing. |
IssuedWarning |
Counter |
Incremented when the feature issues a warning. |
TimedOut |
Counter |
Incremented when the feature times out during execution. |
RequestedStore |
Counter |
Incremented when the feature attempts to store a record in the session ownership facility. |
StoreSuccess |
Counter |
Incremented when the Session Ownership Facility successfully stores a full record. |
StorePartialFailure |
Counter |
Incremented when the Session Ownership Facility fails to store some parts of a record. |
StoreFailure |
Counter |
Incremented when the Session Ownership Facility fails to store any parts of a record. |
RequestedDelete |
Counter |
Incremented when the feature attempts to remove a record from the session ownership facility. |
DeleteSuccess |
Counter |
Incremented when the Session Ownership Facility successfully deletes a full record. |
DeletePartialFailure |
Counter |
Incremented when the Session Ownership Facility fails to delete some parts of a record. |
DeleteFailure |
Counter |
Incremented when the Session Ownership Facility fails to delete any part a record. |
StartedSessionOwnershipActivity |
Counter |
Incremented when the feature starts a new session ownership activity. |
EndedSessionOwnershipActivity |
Counter |
Incremented when the feature ends its session ownership activity. |
FoundNewDialogIdThatRequiresTracking |
Counter |
Incremented when the feature detects that a new leg needs to be tracked, or that an existing tracked leg’s dialog ID has changed. |
FoundDialogIdRequiringUpdate |
Counter |
Incremented when the feature detects that a leg has new information that needs to be tracked on its session ownership record. |
FoundDialogIdDueForRefresh |
Counter |
Incremented when the feature detects that a leg’s session ownership record is approaching its TTL expiration, and needs to be refreshed. |
ChangedOwnershipOfLeg |
Counter |
Incremented when the feature changes the owner of a session from one node to a different node. |
SuccessfulQueryTime |
Sample |
Samples the time taken for a success response to be received from the session ownership facility for any given request. |
PartiallyFailedQueryTime |
Sample |
Samples the time taken for a partial failure response to be received from the session ownership facility for any given request. |
FailedQueryTime |
Sample |
Samples the time taken for a failure response to be received from the session ownership facility for any given request. |
Behaviour
This feature monitors all legs in a session, regularly checking if any of the legs require a session ownership record, and if so, what information should be stored in that record. The feature maintains its own list of which legs currently have records in the session ownership facility, and when those records were last updated.
The exact behaviour of the feature differs based on how it is invoked:
-
If the feature is invoked at the
SipEndSession
feature execution point, it will execute End Session Clean-Up behaviour. -
If it is invoked at any other feature execution point, it will execute Leg Tracking behaviour.
-
If the feature is invoked with a
SessionOwnershipWriteResultEvent
via the Session Ownership Event Handler, it will execute Result Processing behaviour.
Session Ownership Records
Session ownership records are used to track information about specific sessions across multiple Rhino nodes. Their main purpose it to indicate which node is currently responsible for processing a session, but they can also be used for other information that Sentinel features might need to keep track of across nodes. They are stored the in Rhino Session Ownership Facility. In Sentinel SIP these records have a one to one relationship with SIP legs within the Sentinel SIP Leg Manager. Session ownership records are not maintained for all legs at all times, instead individual legs can be flagged for tracking in the session ownership facility. When that flag is seen by this feature, it will create a session ownership record for the leg. The flag can be set by the Sentinel SIP service when session replication is triggered, or by user features that need a leg to be tracked for their own purposes.
Certain fields on the Sentinel SIP Leg
API are used to populate associated fields on a session ownership record.
The following table outlines the relationship between data stored using the Leg
API, and data stored on a session ownership record.
Session Ownership Record Field | Corresponding Leg API Getter | Corresponding Leg API Setter | Notes |
---|---|---|---|
PrimaryKey |
getDialogID().toTrackingKey() |
N/A |
The primary key cannot be modified and is always based on the SIP Dialog ID associated with the leg. |
OwnerURI |
getOwner() |
setOwner() |
While the owner can be modified by other features, it should generally be left to this feature to set it. |
AdditionalKeys |
getAdditionalTrackingKeys() |
setAdditionalTrackingKeys() |
- |
Attributes |
getAdditionalTrackedAttributes() |
setAdditionalTrackedAttributes() |
- |
The dialog ID of a leg is used as the primary key for the session ownership record. This means that if the dialog ID changes (e.g. when the dialog is confirmed by the remote party) a new record is created and the old one is deleted.
There are a few other SIP Leg
API calls that relate to Session Ownership Records:
- setTrackingEnabled()
and isTrackingEnabled()
are used set and read the flag that determines whether a session ownership record will be created for a leg.
- setWaitForTrackingResultEnabled() and `isWaitForTrackingResultEnabled()
are used to set and read a flag that affects how this feature manages asynchronous queries to the session ownership facility (see below).
- getLastTrackingDataChangeTime()
provides the timestamp of the last time that a call to any of: setTrackingEnabled()
, setOwner()
, setAdditionalTrackingKeys()
, or setAdditionalTrackedAttributes()
on the Leg
API actually resulted in a meaningful change in the leg’s tracked state.
Leg Tracking
When the feature is invoked to do standard tracking behaviour, it will get the set of current legs from the leg manager and iterate over it. For each leg in the set, the feature will go through the following steps:
-
Check if the leg is flagged for tracking.
-
If it is not it will skip the remaining steps and move on to the next leg.
-
If it is flagged for tracking, the feature will move on to the next step.
-
-
Check if there is already a session ownership record stored under the leg’s Dialog ID.
-
If not, the feature will create a new record and write it into the session ownership facility. The remaining steps will then be skipped and the feature will move on to the next leg.
-
If so, it will move on to the next step.
-
-
Check if the owner node in the record matches the node currently executing the feature.
-
If not, then the feature will take ownership of the leg (using
Leg.setOwner()
), and write an updated record into the session ownership facility. Then skip the remaining steps and move on to the next leg.
-
-
Check when the tracked data on the leg was last modified against the last time that the session ownership record was updated.
-
If the leg’s tracked data has been modified since the last time the session ownership record was updated, then the feature will create and write an updated record into the session ownership facility. It will then skip the remaining step and move on to the next leg.
-
-
Check whether the record’s TTL could expire before the feature is next invoked.
-
If so, then the existing record will be rewritten into the session ownership facility with a refreshed TTL.
-
Otherwise the feature will move on to the next leg.
-
After processing all of the legs, the feature will look for any records it has stored under Dialog IDs that no longer correspond to any leg that has tracking enabled. If it finds any such records, it will delete them from the facility.
All store and delete requests sent to the session ownership facility are executed asynchronously.
The value of isWaitForTrackingResultEnabled()
on the Leg API will affect the feature’s behaviour while it waits for the result for requests relating to that leg’s session ownership record.
If any leg that has an outstanding store request to session ownership facility returns true for that API call, the feature will enter a featureWaiting
state while it has nothing to do.
This will prevent the session plan advancing to the next feature while the session ownership request is in progress.
This is useful if further down the session plan, there is a feature that requires the session ownership record to be in place.
If all legs with outstanding requests return false, then the feature will enter the featureHasFinished
state while it waits, and session processing will continue in the mean time.
The feature will not normally enter the featureWaiting
state for delete requests.
Result Processing
When a result is received from the session ownership facility, the feature simply records statistics and logs messages based on whether the result is successful, partially successful, or unsuccessful.
After processing the result, the feature will decide to enter a featureWaiting
or featureHasFinished
state based on the same criteria used in Leg Tracking behaviour.
End Session Clean-Up
When the feature is triggered at session end, it create delete requests for all remaining session ownership records associated with the session.
While under normal circumstances, the feature would not enter the featureWaiting
state for delete requests, during end session behaviour the feature will keep going into the featureWaiting
state until ALL outstanding requests are answered.
This prevents to session from ending until all records have been handled.