---
title: CallRexServiceProxy
summary: API reference for CallRexServiceProxy.
status: draft
owner: <owner>
last_reviewed: 2026-09-15
library: SAIF.Application.Services.AudioVideo
reference_type: package
---

# CallRexServiceProxy

`CallRexServiceProxy` is the WCF client proxy for the CallRex on-demand recording SOAP service. It performs recording lookup, deletion, invalidation, and start/stop/pause/resume recording control, and is the sole consumer of the CallRex `ClientServiceClient` generated client. It is wrapped by [CallRecordingSystem](../services-utilities-audiovideo/CallRecordingSystem.md).

## Purpose
- Translate `IRecordingSystem`-style recording operations into calls against the CallRex `ClientServiceClient` SOAP endpoint, including authentication header injection on every call.
- Map vendor `RecordedCallContainer`/`AttachedDataContainer` responses onto the library's `CallRecording` DTO, computing description, discoverability flags, and call direction.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| (constructor) | `public CallRexServiceProxy(string serviceUrl, IEnvironmentService envSvc, ILogService logSvc)` | Configures a `BasicHttpsBinding` with NTLM transport security, constructs the `ClientServiceClient`, and logs in with fixed vendor credentials. |
| OnFileTransferCompleted | `public FileTransferCompleted OnFileTransferCompleted` (delegate event field) | Raised when the underlying vendor client reports a completed file transfer. |
| OnFileProgressChanged | `public FileProgressChanged OnFileProgressChanged` (delegate event field) | Raised when the underlying vendor client reports file-transfer progress. |
| MarkInvalid | `public virtual void MarkInvalid(CallRecording recording)` | Updates the recording's attached description to prefix `"Invalid:"` via `UpdateAttachedDataByCallLogID` (see [BR-AV-10](../../business-rules.md#br-av-10-invalidate-annotates-vendor-description)). |
| DeleteRecording | `public virtual bool DeleteRecording(Guid recordingId)` | Deletes a recording from CallRex, returning whether the call succeeded. |
| GetAllRecordings | `public virtual IEnumerable<CallRecording> GetAllRecordings()` | Retrieves and maps all recorded calls. |
| GetRecordings | `public virtual IEnumerable<CallRecording> GetRecordings(Guid userId)` | Retrieves and maps all recorded calls for a specific vendor user ID. |
| GetRecording | `public virtual CallRecording GetRecording(Guid recordingId)` | Retrieves all recorded calls and filters/maps to the single matching recording. |
| GetUsers | `public virtual IEnumerable<CallUser> GetUsers()` | Retrieves and maps all CallRex-registered users. |
| StartRecording | `public virtual void StartRecording(Guid userId)` | Starts on-demand recording for a user via `StartOnDemandRecording`. |
| StopRecording | `public virtual void StopRecording(Guid userId)` | Stops on-demand recording for a user via `StopOnDemandRecording`. |
| PauseRecording | `public virtual void PauseRecording(Guid userId)` | Pauses on-demand recording for a user via `PauseOnDemandRecording`. |
| ResumeRecording | `public virtual void ResumeRecording(Guid userId)` | Resumes a paused on-demand recording via `ResumeOnDemandRecording`. |
| Dispose | `public void Dispose()` (from `IDisposable`) | Closes the underlying `ClientServiceClient` WCF channel. |

## Behavioral notes
- Authenticates using a hardcoded username (`"AI"`) and password (`"AudioImporter"`) supplied as SOAP message headers on every service-affecting call via `AuthorizeClientServiceCall` (see `dependencies.md` for the associated hardcoded-credential note).
- `GetRecording(Guid)` retrieves the *entire* recorded-call list and filters client-side rather than calling a single-recording vendor endpoint — an explicit `todo` comment in source notes this as a placeholder pending a dedicated vendor call.
- Recording mapping (`GetRecording(RecordedCallContainer)`) computes `CallDirection` via a private `GetCallDirection` helper (dialed number takes precedence over caller-ID number — see [RecordingCallDirection](../core-contracts-audiovideo/RecordingCallDirection.md)), and strips the literal word `"test"` from the vendor description while separately checking for it to set `IsProductionRecording` (see [BR-AV-11](../../business-rules.md#br-av-11-test-and-invalid-detection-via-regex)).
- Most public members are `virtual`, allowing test doubles to override behavior without a formal interface.*

## Constraints and usage notes
- All operational methods that call the vendor service inject authentication headers via `AuthorizeClientServiceCall`; direct calls to the underlying `ClientServiceClient` bypassing this proxy would fail authentication.
- Instances should be disposed after use to close the underlying WCF channel.

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources
- `Application\SAIF.Application.Services.AudioVideo\Services\ClientProxies\ThirdParty\CallRexServiceProxy.cs`
- `Application\SAIF.Application.Services.AudioVideo\Core\Contracts\AudioVideo\CallRecording.cs`
