---
title: CallRexStateServiceProxy
summary: API reference for CallRexStateServiceProxy.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-15
library: SAIF.Application.Services.AudioVideo.32
reference_type: package
---

# CallRexStateServiceProxy

`CallRexStateServiceProxy` wraps the generated dual/duplex WCF client `Core.ThirdParty.CallRexAgentState.AgentStateServiceClient`, registering an [AgentStateCallback](AgentStateCallback.md) to receive real-time agent call-state notifications that [CallRecordingSystem](../saif-services-utilities-audiovideo/CallRecordingSystem.md) exposes via its `OnCallStateChanged` event; see [CallRex WCF proxy operations](../../operations/callrex-wcf-proxy-operations.md).

## Purpose
- Establishes and manages the duplex WCF channel to the CallRex agent-state service (`net.tcp://localhost:8015/AgentStateService` or `http://localhost:8003/AgentStateService2` in `app.config`).
- Registers/unregisters an `AgentStateCallback` instance to receive push notifications for monitored users.
- Retrieves the current call state for all monitored users on demand via `GetAllUsersCurrentCallState`.

## Context
- Namespace: `SAIF.Services.ClientProxies.ThirdParty`
- Assembly/package: `SAIF.Application.Services.AudioVideo.32`
- Implements: `IDisposable`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| CallRexStateServiceProxy(...) | `CallRexStateServiceProxy(string serviceUrl, ILogService logService, AgentStateCallback callback)` | Constructs the proxy and its duplex WCF channel, wiring the given `AgentStateCallback` to receive push notifications. |
| Register | `void Register(...)` | Registers the callback with the CallRex agent-state service for a set of user IDs.* |
| GetAllUsersCurrentCallState | `IEnumerable<CallMonitorState> GetAllUsersCurrentCallState()` | Retrieves the current [CallMonitorState](../saif-core-contracts-audiovideo/CallMonitorState.md) for every monitored user via a synchronous call to the service. |
| Unregister | `void Unregister(...)` | Unregisters the callback, stopping further push notifications.* |
| Dispose | `void Dispose()` | Closes the underlying duplex WCF client channel. |

## Behavioral notes
- Push notifications flow: CallRex agent-state service → `AgentStateCallback.ReceiveState` → `AgentStateCallback.CallStateChanged` delegate → `CallRecordingSystem.CallState_Changed` → `CallRecordingSystem.OnCallStateChanged` event exposed to callers.

## Constraints and usage notes
- Because this proxy uses a duplex binding, it must remain open for the lifetime of any registered callback; disposing it before unregistering may leave the CallRex-side registration in an inconsistent state.*

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Application\SAIF.Application.Services.AudioVideo\Services\ClientProxies\ThirdParty\CallRexStateServiceProxy.cs`
- `Application\SAIF.Application.Services.AudioVideo\Services\ClientProxies\ThirdParty\AgentStateCallback.cs`
- `Application\SAIF.Application.Services.AudioVideo.32\app.config`
