Skip to content

SAIF.Application.Services.AudioVideo.32 architecture

SAIF.Application.Services.AudioVideo.32 is the x86 build variant of the audio/video call-recording import library: it compiles the identical linked source tree as the sibling SAIF.Application.Services.AudioVideo project, orchestrating recording import, third-party CallRex integration, and NHibernate-backed persistence of import status and recording metadata for a 32-bit host process.

Responsibilities

  • Import call recordings raised by the third-party CallRex call-recording system into the SAIF data model, including validation, local backup, audio-format conversion, and verification (AudioVideoService.ImportRecording).
  • Track per-recording import status (InProgress/Completed/Errored/Missing) via ImportStatusManager, backed by the audio_import_status table.
  • Provide a façade (CallRecordingSystem) over two WCF client proxies (CallRexServiceProxy, CallRexStateServiceProxy) that talk to the third-party CallRex ClientService and AgentStateService endpoints for recording retrieval, control (start/stop/pause/resume), invalidation/deletion, and real-time agent call-state monitoring.
  • Validate import requests against business rules (required claim/case numbers, description length) via AudioVideoValidator.
  • Expose a lightweight, always-available query (AudioVideoService.HasMedia) for checking whether a claim has associated recordings, usable even when the service is constructed without the full dependency set.
  • Provide the identical business logic and data-access surface as SAIF.Application.Services.AudioVideo, but packaged and compiled specifically to run inside 32-bit (x86) host processes.

Component boundaries

  • Core.Contracts.AudioVideo: DTOs, event-arg classes, and enums (CallRecording, CallUser, ImportAudioRequest, RecordingInfo, CallMonitorState, etc.) — no behavior, pure data contracts consumed across all other components.
  • Core.Services.IAudioVideoService: the public service contract implemented by AudioVideoService; defines the orchestration boundary consumed by host applications.
  • Services.Utilities.AudioVideo.AudioVideoService: the orchestration/business-logic entry point. Composes IUnitOfWork (persistence), IEnvironmentService (configuration), IImportStatusManager (status tracking), IRecordingSystem (third-party recording system abstraction), and IConsoleLogService (logging).
  • Services.Utilities.AudioVideo.AudioVideoValidator: a FluentValidation validator invoked synchronously at the start of ImportRecording, isolating input-validation rules from orchestration logic.
  • Services.Utilities.AudioVideo.CallRecordingExtensions: centralizes two small pure-function business rules (IsDiscoverable, GetDescription) shared between the validator and the service, avoiding duplicated rule logic.
  • Services.Utilities.AudioVideo.ImportStatusManager: a small NHibernate-repository-backed implementation of IImportStatusManager, isolated from AudioVideoService so import-status tracking can be reasoned about independently.
  • Services.Utilities.AudioVideo.CallRecordingSystem (implements IRecordingSystem): the sole third-party integration façade; composes CallRexServiceProxy and CallRexStateServiceProxy and hides WCF proxy/channel details from AudioVideoService.
  • Services.ClientProxies.ThirdParty.CallRexServiceProxy / CallRexStateServiceProxy / AgentStateCallback: thin wrappers around the generated WCF service-reference proxies (Core.ThirdParty.CallRex, Core.ThirdParty.CallRexAgentState), isolating SOAP/WCF plumbing (custom auth headers, duplex callbacks) from the rest of the library.
  • Data.Model.AudioVideo / Data.NHibernate.Mappings.AudioVideo: NHibernate entities (AudioImportStatus, Recording, both extending EntityBase<T> from SAIF.Framework.Common) and their FluentNHibernate ClassMap<T> mappings, forming the persistence boundary consumed only through IUnitOfWork/IRepository<T>.

Interaction model

  • A host application (batch job, service, or console process) resolves IAudioVideoService and calls ImportRecording(ImportAudioRequest). AudioVideoService first delegates validation to AudioVideoValidator, then coordinates persistence (IUnitOfWork/IRepository<Recording>), local file operations (backup copy, MD5 verification, ffmpeg-based conversion via the vendored MediaToolkit package), and third-party deletion (IRecordingSystem.DeleteRecording) before reporting status through IImportStatusManager.
  • CallRecordingSystem is called by AudioVideoService (and other IRecordingSystem consumers) and internally routes each call to either CallRexServiceProxy (request/response SOAP operations against the CallRex ClientService) or CallRexStateServiceProxy (duplex/callback-based real-time agent-state monitoring against the CallRex AgentStateService).
  • CallRexServiceProxy authenticates once at construction (Login) and re-attaches the same hard-coded credentials as custom SOAP headers on every subsequent state-changing call via AuthorizeClientServiceCall.
  • ImportStatusManager and the entity-mapped repositories (Recording, AudioImportStatus) are called synchronously and transactionally (_uow.Begin()/_uow.Commit()) from within AudioVideoService.ImportRecording; there is no asynchronous or message-based interaction inside this library.
  • No consuming application project was found within this repository's scope that references this library directly; it is packaged as a standalone NuGet library consumed by an as-yet-undetermined 32-bit host application elsewhere in the SAIF application estate.

Architecture diagram

The following diagram shows the high-level component interactions inside this library and its principal external and framework dependencies.

flowchart TD
    Host["Host application<br>(32-bit process)"] --> AVS["AudioVideoService<br>(IAudioVideoService)"]
    AVS --> Validator["AudioVideoValidator"]
    AVS --> Ext["CallRecordingExtensions"]
    AVS --> UOW["IUnitOfWork / IRepository&lt;T&gt;<br>(SAIF.Framework.Core)"]
    AVS --> ISM["ImportStatusManager<br>(IImportStatusManager)"]
    AVS --> RS["CallRecordingSystem<br>(IRecordingSystem)"]
    AVS --> MTK["MediaToolkit (ffmpeg)"]
    ISM --> UOW
    RS --> Proxy1["CallRexServiceProxy"]
    RS --> Proxy2["CallRexStateServiceProxy"]
    Proxy1 --> CallRex["CallRex ClientService<br>(third-party WCF)"]
    Proxy2 --> AgentState["CallRex AgentStateService<br>(third-party WCF, duplex)"]
    UOW --> NH32["SAIF.Framework.Data.NHibernate.32<br>(bundles x86 Oracle.DataAccess.dll)"]
    NH32 --> Oracle[("Oracle database")]

Sequence diagram

The following diagram shows the primary import-recording sequence, including the error-handling branch when the CallRex deletion step fails after local processing has already succeeded.

sequenceDiagram
    participant Host as Host application
    participant AVS as AudioVideoService
    participant Val as AudioVideoValidator
    participant UOW as IUnitOfWork/Repository
    participant ISM as ImportStatusManager
    participant RS as CallRecordingSystem (CallRex)
    Host->>AVS: ImportRecording(request)
    AVS->>Val: Validate(request)
    Val-->>AVS: ValidationResult
    AVS->>UOW: Find/create Recording row
    UOW-->>AVS: Recording entity
    AVS->>AVS: Backup copy + MD5 verify + convert (MediaToolkit)
    AVS->>AVS: VerifyImport (file/size checks)
    AVS->>RS: DeleteRecording(callRexId)
    RS-->>AVS: success/failure
    alt CallRex delete fails
        AVS->>ISM: SetErrored
        AVS-->>Host: throws ApplicationException
    else success
        AVS->>ISM: SetCompleted
        AVS-->>Host: RecordingInfo
    end

Design constraints

  • 32-bit (x86) build variant, not an independently designed library: this project's .csproj sets <PlatformTarget>x86</PlatformTarget> across all configured build configurations (Debug|AnyCPU, Release|AnyCPU, and the explicit Debug|x86/Release|x86 property groups), and it has no source of its own apart from Properties\AssemblyInfo.cs and generated WCF proxy files — every <Compile> item under Core\, Data\, and Services\ is a linked file (<Link>) whose physical source lives in the sibling SAIF.Application.Services.AudioVideo project. Every behavioral, business-rule, and data-access finding is identical to (and traceable to the same source lines as) that sibling library.
  • 32-bit Oracle client dependency drives the build variant: this project references the 32-bit-specific NuGet package SAIF.Framework.Data.NHibernate.32 (rather than the sibling's AnyCPU/64-bit-capable package), which bundles the x86 Oracle.DataAccess.dll (ODP.NET unmanaged) via a <Reference Include="Oracle.DataAccess...processorArchitecture=x86"> entry. The unmanaged Oracle client requires bitness-matched hosting, so this variant exists specifically for host processes that only run as x86 (for example, a legacy Windows Service, an IIS application pool running in 32-bit mode, or a batch console executable constrained to x86).
  • No independent runtime dependency on the sibling assembly: because collaboration with SAIF.Application.Services.AudioVideo source is via linked .cs files (not a <ProjectReference> or assembly reference), the .32 assembly is self-contained at compile time and carries no runtime dependency on the sibling project's compiled output.
  • Vendored third-party binaries are not NuGet-restored: CallRex.Utilities.dll and CallrexAPIUtilities.dll are referenced directly by HintPath from Libs\ThirdParty\CallRex\, outside the NuGet package-restore pipeline.
  • No consuming application found in this repository's scope: the library is packaged as a standalone NuGet library (per its .nuspec) for consumption by an as-yet-undetermined 32-bit host application elsewhere in the SAIF application estate.

Sources

  • Application\SAIF.Application.Services.AudioVideo.32\SAIF.Application.Services.AudioVideo.32.csproj
  • Application\SAIF.Application.Services.AudioVideo.32\app.config
  • Application\SAIF.Application.Services.AudioVideo\Core\Services\IAudioVideoService.cs
  • Application\SAIF.Application.Services.AudioVideo\Core\Contracts\AudioVideo\IRecordingSystem.cs
  • Application\SAIF.Application.Services.AudioVideo\Core\Contracts\AudioVideo\IImportStatusManager.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\AudioVideoService.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\AudioVideoValidator.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\CallRecordingExtensions.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\ImportStatusManager.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\RecordingSystem.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\ClientProxies\ThirdParty\CallRexServiceProxy.cs
  • 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\Data\Model\AudioImportStatus.cs
  • Application\SAIF.Application.Services.AudioVideo\Data\Model\Recording.cs
  • Application\SAIF.Application.Services.AudioVideo\Data\Mappings\AudioImportStatusMap.cs
  • Application\SAIF.Application.Services.AudioVideo\Data\Mappings\RecordingMap.cs