# Ovoz first-party voice architecture

Proposed design for an Ovoz-operated voice platform. The profiles, voice IDs,
timing budgets, and capacity calculations below are planning examples.

## System boundaries

- **Control plane.** Studio submits the purpose, destination, authorization,
  and idempotency key. The Call API atomically records the accepted call,
  reserves usage, and writes a dispatch record. The saved configuration pins
  locale, routing policy, recording policy, and voice release.
- **Telephony and media.** The number registry maps an inbound dialed number to
  a workspace and validates outbound caller identity. A regional SIP edge owns
  signaling. The media gateway receives RTP, buffers jitter, resamples audio for
  recognition, and converts synthesized audio to the negotiated codec.
- **Speech and dialogue.** A call worker owns turn state. Recognition emits
  provisional and committed text. Dialogue emits speakable clauses and policy
  actions. The synthesizer streams frames tagged with the turn generation so
  late frames can be discarded after an interruption.
- **Outcomes.** Stable event IDs allow call-state, usage, and result updates to
  be replayed. The terminal event reconciles reserved and connected time.
  Finalization stores the transcript, then builds a summary and follow-up tied
  to the relevant transcript turns. Optional media and transcripts carry their
  own retention policies.

## Number ownership and routing

A public number uses E.164 format. A registry entry stores number, workspace,
region, status, and whether inbound and outbound directions are authorized.
Private extensions have their own namespace.

For inbound calls, look up the active number and apply the workspace's hours,
assistant selection, and routing policy. For outbound calls, resolve the
authorized caller identity, validate the destination, and choose a healthy,
eligible route. Retry on an alternate route only after confirming the pre-answer
attempt has ended. Terminal events close the media leg and reconcile usage once.

Ovoz extensions route directly to a workspace or assistant. Public numbers use
the public telephone network at the Ovoz signaling and media boundary.

## Model and voice releases

| Component | Proposed starting design | Acceptance measurements |
| --- | --- | --- |
| Recognition | 300M-parameter streaming encoder with incremental decoding | Word error rate, exact match on names, times and numbers |
| Dialogue | 3B-parameter instruction model with typed policy actions | Task completion, policy adherence, time to first speakable clause |
| Synthesis | Multilingual acoustic model with a streaming vocoder trained for 24 kHz output | First-audio latency, pronunciation, listener ratings, voice identity |

Train the weights from rights-cleared data and serve them on Ovoz inference
clusters. Record the dataset manifest, checkpoint, tokenizer and preprocessing
versions, and evaluation outcomes. Evaluate each release by locale, accent,
codec, background noise, and task.

Start with English and Korean. Example voice-release IDs are `en-neutral@1` and
`ko-neutral@1`. Each catalog entry binds a consented recording set, pronunciation
lexicon, synthesis release, and approved same-locale fallback. Resolve the voice
when admitting the call and pin it for that session. Confirm critical fields
when recognition confidence falls below the field's threshold.

## Turn latency

Measure first audio from the end of caller speech to the start of audible
playback. Targets for ordinary turns without a tool round trip are 600 ms at p50
and 1,100 ms at p95. Observe tool-dependent turns and ringing separately.

| Stage | Warm path | Queue pressure |
| --- | ---: | ---: |
| Ingress | 35 ms | 55 ms |
| Endpointing and ASR | 165 ms | 240 ms |
| Dialogue to first speakable clause | 190 ms | 360 ms |
| Synthesis to first audio | 140 ms | 250 ms |
| Egress and playback | 70 ms | 145 ms |
| **Example total** | **600 ms** | **1,050 ms** |

The examples add the stages in sequence. In practice, the recognizer runs
during the caller's utterance and response preparation can overlap with speech
processing. Record monotonic service timestamps and use an instrumented caller
to measure playback. Break out distributions by load, region, and locale.

For interruptions, listen during playback, confirm caller speech, cancel the
old turn, and flush queued audio. The p95 target from speech onset to playback
stop is 150 ms.

## Capacity and rollout

For one bidirectional 64 kb/s G.711 media leg using 20 ms packets, each open
call contributes 128 kb/s of audio payload and 100 packets per second across
both directions. At 100 concurrent calls, that is 12.8 Mb/s and 10,000 packets
per second before headers, additional legs, redundancy, and headroom. Size
inference replicas separately from measured throughput at the desired p95.

1. Prove the audio loop and interruption handling with private Ovoz calling.
2. Bring up number routing and phone media in one supported region.
3. Evaluate owned speech checkpoints and voice packs on representative calls.
4. Roll out new release manifests to a small cohort, compare their quality and
   timing, and keep a rollback pointer for newly admitted calls.

## Call contracts and event order

| Record | Required fields | Invariant |
| --- | --- | --- |
| CallRequest | workspace, caller identity, destination, purpose, locale, idempotency key | Compare normalized payload on key reuse within the workspace. |
| CallSnapshot | call ID, policy revision, route, model manifest, voice release, duration limit, recording policy | Admission freezes the configuration for the life of the call. |
| CallOutcome | terminal reason, connected duration, transcript revision, evidence links | Finalization is retryable and produces one outcome per call revision. |

The call event writer allocates sequence numbers. Downstream readers apply
events in order and resume from their last durable cursor. Retry with the same
event ID. Use relative audio timestamps to align turns with the media session.

```json
{
  "type": "turn.transcript.committed",
  "schema_version": 1,
  "event_id": "evt_example_42",
  "call_id": "call_example",
  "sequence": 42,
  "turn_id": "turn_04",
  "start_ms": 8120,
  "end_ms": 9710,
  "locale": "ko-KR"
}
```

The terminal event seals the media session and a separate stage completes the
outcome. A known connected duration settles the reservation. A definitive
pre-connect outcome releases it without charging connected time.

## Dataset and release gates

Link each consented recording to a versioned data manifest. Capture prompted
reads, natural conversations, critical names and times, interruptions, and
overlap. Align text to audio, retain preprocessing lineage, and keep speaker and
session partitions separate from evaluation. Produce telephone-codec and noise
variants for replay. Track exact match separately for Korean number readbacks,
mixed-script names, dates, and honorifics.

Run each candidate checkpoint through the complete call loop. Report error rate
and exact match for recognition, task completion and evidence for dialogue,
and intelligibility and identity consistency for synthesis. Measure clipped
utterances, false interruptions, and first reply audio on the same calls.
Report counts and confidence intervals by locale, codec, accent, noise, and
concurrency. Test packet loss and worker restarts before rollout.

## Compute sizing example

At 100 simultaneous calls on a single full-duplex G.711 leg, 40 bytes of IPv4,
UDP, and RTP headers add 3.2 Mb/s to the 12.8 Mb/s payload. Add link overhead,
encryption overhead, and redundancy capacity separately.

Four turns per minute across 100 calls produce about 6.7 turns per second on
average. If a dialogue replica sustains 10 turns per second at the target p95,
a 60% operating limit gives 6 turns per second of usable throughput. Two
replicas cover this example average. Three preserve that capacity through one
replica loss. Use peak turn arrivals and queue age to set production capacity.

## Workspace data lifecycle

Keep live audio in bounded regional buffers. Persist recordings only when
enabled for the call. Recordings, transcripts, follow-ups, and usage have their
own access and retention policies. Scope reads to the workspace and call, and
collect aggregate timing without call content. Write a durable tombstone on
deletion before clearing objects and derived views. Late events check the
tombstone before creating any new record.

## Research references

- Compare recognition accuracy, partial transcript stability, and endpoint
  latency against a streaming recurrent transducer. [Streaming End-to-end Speech Recognition for Mobile Devices](https://arxiv.org/abs/1811.06621)
- Test a convolution-augmented encoder with constrained context and different
  chunk sizes on telephone audio. [Conformer: Convolution-augmented Transformer for Speech Recognition](https://arxiv.org/abs/2005.08100)
- Benchmark a turn classifier against a silence threshold on pauses,
  acknowledgments, and overlap. [Voice Activity Projection: Self-supervised Learning of Turn-taking Events](https://arxiv.org/abs/2205.09812)
- Test a compact vocoder for first-chunk latency and audible seams after codec
  conversion. [HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis](https://arxiv.org/abs/2010.05646)
- Measure key-value cache pressure and time to first clause under mixed
  concurrency. [Efficient Memory Management for Large Language Model Serving with PagedAttention](https://arxiv.org/abs/2309.06180)
