Skip to content

Real-time call-state monitoring

This operation family lets an external caller (e.g., a live agent-monitoring UI) subscribe to or poll real-time call-state updates for one or more users from the CallRex vendor system. Unlike the other operations in this library, it has no database interaction — it is a pure WCF pass-through to the vendor real-time feed.

Field Value
Operation ID OP-AV-07
Trigger External caller invokes CallRecordingSystem.StartMonitoring(CallUser user), StopMonitoring(), or GetAllUsersCurrentCallState(CallUser requestingUser).
Inputs CallUser (subscribe/poll target)
Outputs OnCallStateChanged events (subscribe path); IEnumerable<CallMonitorState> (poll path).
Primary components CallRecordingSystem.StartMonitoring / StopMonitoring / GetAllUsersCurrentCallState, CallRexStateServiceProxy, AgentStateCallback
Entry point Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\RecordingSystem.cs

Steps

  1. StartMonitoring(CallUser user) registers the caller's _clientToken and target user with CallRexStateServiceProxy.Register.
  2. The proxy calls the vendor AgentStateServiceClient.RegisterForRealtimeFeedOnReportsFiltered and immediately raises the initial state through the AgentStateCallback duplex WCF callback contract.
  3. Ongoing state changes arrive asynchronously via AgentStateCallback.ReceiveState, which filters to only the currently-monitored UserIdsToMonitor and raises CallStateChanged → CallRecordingSystem.CallState_Changed → the OnCallStateChanged event to the library's caller.
  4. StopMonitoring() calls CallRexStateServiceProxy.Unregister(_clientToken), which invokes the vendor UnregisterForRealtimeFeed.
  5. GetAllUsersCurrentCallState(CallUser requestingUser) is a synchronous poll variant: it registers, immediately reads via the vendor RegisterForRealtimeFeedOnReports, unregisters, and maps each vendor ExtendedRealtimeUserState to a CallMonitorState.

Process flow

The following diagram visualizes this operation family's control flow.

flowchart TD
    Start([StartMonitoring invoked]) --> Register[Register with CallRexStateServiceProxy]
    Register --> Vendor["Vendor: RegisterForRealtimeFeedOnReportsFiltered"]
    Vendor --> Callback[AgentStateCallback.ReceiveState]
    Callback --> Filter{User in UserIdsToMonitor?}
    Filter -->|Yes| Raise[Raise OnCallStateChanged]
    Filter -->|No| Ignore([Ignore update])
    Stop([StopMonitoring invoked]) --> Unregister[Unregister with CallRexStateServiceProxy]
    Poll([GetAllUsersCurrentCallState invoked]) --> RegisterPoll[Register] --> ReadPoll["Vendor: RegisterForRealtimeFeedOnReports"] --> UnregisterPoll[Unregister] --> Map[Map to CallMonitorState list]

Failure and edge-case behavior

  • No database interaction occurs in this operation family — it is purely a WCF pass-through to the vendor real-time feed.
  • CallRexStateServiceProxy uses WSDualHttpBinding with security mode None, so the real-time duplex channel carries no transport or message security.

Sources

  • Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\RecordingSystem.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\ClientProxies\ThirdParty\CallRexStateServiceProxy.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\ClientProxies\ThirdParty\AgentStateCallback.cs