Member Junction
    Preparing search index...

    Function RecoverRealtimeRecordingFromSegments

    • Rebuilds a session's recording from the seg-* crash-recovery shards left in its storage folder — for a call whose browser died or whose end-of-call upload never ran, so no recording.* exists. Shards are concatenated in order (silence for absent ones), uploaded under a per-attempt recording-recovered-<epoch ms>-<random hex>.wav, stamped on the session, linked, and only then deleted. Deletion happens only after a reload confirms the session points at the recovered file, so a failure at any step leaves the shards for the next try. If the session has (or gains) another recording, the outcome is Superseded and the shards are kept. Deferring to that recording is best effort: the session is re-checked immediately before the stamp, but a recording stamped inside that one load -> save window is overwritten (there is no compare-and-set).

      The sample rate comes from the shard keys (seg-NNNN.r<rate>.pcm) or, for legacy seg-NNNN.pcm shards, from each object's stored content type. When no shard declares a rate (a legacy shard on a driver that keeps no content type, such as Box), it is inferred from the size of the full shards; see LEGACY_SHARD_SECONDS.

      Once the stamp has saved, the outcome is Recovered even if the confirming reload or a shard delete fails; the shards it could not remove are named in a LogError (nothing revisits a stamped session).

      Never throws: every failure is logged with the session id and returned as Failed.

      Parameters

      Returns Promise<RecoverRealtimeRecordingResult>