Call State and Recording
This content is not available in your language yet.
0. 规范语言
本文中的规范关键字(MUST / SHOULD / MAY 等)按 conformance/normative-language.md 解释;仅大写形式具规范约束力。
1. 目标与范围
本文件定义通话 / 会议的 durable 真源:ak.call.create 创世、通话模型与状态机、ak.call.state payload 字段语义与 reducer 校验规则、participant 绑定的落地校验,以及录制 / 转写的生命周期。实时媒体本身不进入 Realm Event history;高频信令走 ephemeral 通道,但它们只能引用已 accepted 的 Call。
边界:
- ephemeral 信令(offer/answer/candidate、ICE/TURN、一对一通话、推送、
ak.call.*权限模型)见webrtc-signaling.md。 - 媒体服务发现、token / participant binding 兑换、focus 选举、媒体 E2EE 帧密钥注入见
media-service-binding.md。
2. 通话模型
| 模式 | 适用 | 说明 |
|---|---|---|
p2p | 1 对 1 或极小规模 | 双方直接 WebRTC 连接,必要时经 TURN server。 |
mesh | 3-4 人小会 | 每个客户端与其他客户端建连接,复杂度高,不建议默认。 |
sfu | 多方会议默认 | Selective Forwarding Unit 转发 RTP,不解密 E2EE 内容。 |
mcu | PSTN / 录制 / 低端设备 | Multipoint Control Unit 混流,通常会接触明文或解密后媒体,MUST 强提示和审计。 |
默认多人会议 SHOULD 使用 SFU。
3. Call Morph
会议或通话 SHOULD 用标准 Morph 表示:
{ "morph_kind": "call", "realm_id": "ak:realm:...", "title": "Design review", "fields": { "call_id": "ak:call:ARzVic5s2NUShp82C8GPo-shbkm7isUWyvILLThc3aNL", "mode": "sfu", "state": "ringing", "started_at": null, "ended_at": null }}Morph 中的 call_id 只是对已创建 Call 的引用;Morph 不创建 Call,也不得在 ak.call.create accepted 前先行发布。
state(通话生命周期,完整枚举、合法转换与终态见 §4.2):
scheduledringingconnectingactiveendedmissedfailedcancelled
录制不是通话生命周期的一部分,走独立
recording_transitiondelta,与state_transition正交,见 §4.2 / §5。
4. 会议状态事件
每个 Call 首先由一条 accepted ak.call.create 创建:
{ "kind": "ak.call.create", "realm_id": "ak:realm:...", "payload": { "initial_state": "ringing" }}create payload MUST 省略 call_id;call_id = retype(event_id, "call"),因而使用与 Event 相同的 33-octet / 44-character content-bound token。只有在这条 Event accepted 后,才能签发媒体 token、发送 offer/answer/candidate/focus_join 信令、创建引用该 Call 的 Morph,或提交 ak.call.state。接收方对未解析到 accepted create 的任何引用 MUST fail closed,不得为裸 call_id 自动建立占位 Call。
后续状态以 durable event 记录:
{ "kind": "ak.call.state", "realm_id": "ak:realm:...", "payload": { "call_id": "ak:call:ARzVic5s2NUShp82C8GPo-shbkm7isUWyvILLThc3aNL", "state_transition": { "from": "connecting", "to": "active" }, "focus": { "mode": "sfu", "session_focus": "fra-1" }, "roster_delta": { "operation": "join", "participant": { "actor_id": { "kind": "account", "account_id": { "principal_id": "ak:did_core:web:participant.example", "station_id": "ak:did_core:web:station.example" } }, "device_id": "ak:device:01964137-0000-7000-8000-000000000000", "joined_at": "2026-04-26T00:00:00Z", "foci_preferred": [ "fra-1", "us-east-1" ], "participant_id": "ak:rtc_participant:0198c2f4-0000-7000-8000-000000000000", "participant_binding": { "expires_at": "2026-04-26T00:05:00Z", "issuer_kid": "did:webvh:zCxjAemtszNh7bTFGWFS4m8gv:media.example#key-1", "signature": "base64url..." }, "media": { "audio": true, "video": true, "screen": false }, "focus_id": "fra-1" } } }}4.1 字段语义(normative)
current state 归属(normative):每项 write 先按 canonical registry 的 condition 求值。只含 ready/failed 产物更新的 Event 为普通数据;只要含安全 write,整个 Event 原子等待唯一安全确认。
| 承载字段 | current state family | domain reducer | 值形状 |
|---|---|---|---|
state_transition | call_state | commit-ordered projection | 领域状态 |
focus | call_focus | commit-ordered projection | register |
recording_transition.to=stopped | call_recording_state | commit-ordered projection | 捕获许可状态 |
recording_transition.capture_metadata | call_recording_artifact | stream-ordered reducer | {status,details} |
transcript_transition.to=stopped | call_transcript_state | commit-ordered projection | 捕获许可状态 |
transcript_transition.capture_metadata | call_transcript_artifact | stream-ordered reducer | {status,details} |
moderation_delta | call_moderation | commit-ordered projection | set |
roster_delta | call_roster | commit-ordered projection | set |
mute_override(v1 禁用) | call_mute_override(保留形状,无可接纳写入) | 不执行 | 单 leg register,不可当多 leg 集合 |
所有状态与结果按所属 stream 的 RealmCommit 顺序确认。会覆盖现有结果的 Event 必须携带该领域 current state 的 expected_commit_id;竞争写至多一笔成功。result 不授予采集、密钥或读取权限。
未变更的轴 MUST NOT 产生 projected write(normative):payload.call_id 之外的每个准入 delta 字段都是可选的,单条 ak.call.state MUST 只携带本次实际变更的轴,并且至少携带一个准入 delta(schema anyOf)。上表准入轴的每条 state_writes[] 都是条件性目标;字段存在则对应 write 必需,字段缺席则对应 write MUST NOT 产生。mute_override 在 schema 阶段拒绝,不能触发保留的 result-write 行。recording_transition.capture_metadata / transcript_transition.capture_metadata 各自额外产生 result current state write。完整 op 由 registry state_projection 派生,producer 不得自选 from / to / tag / value。
捕获态按段切分:录制 / 转写 current state 的 subject 是 (call_id, recording_id) composite,因此同一通话的多段捕获天然落在不同 current state,互不冲突。段键选用 payload.recording_id 而不是 start Event 的 event_id:envelope.event_id 只在 create-once 对象的 id:<种类> 派生形态下可用(../conformance/encoding.md §9.5.1),而录制段不是这样的对象——一次通话里有多段捕获,start Event 不是任何一段的身份来源;而 recording_id 已经是 ak.call.recording.start 的 required 字段、已按 §5 要求在同一通话内逐段唯一、且已是录制 / 转写 key exporter Context 的 member,因此是两侧都能派生的同一个键。ak.call.recording.start 按 payload.capture_kind 写入 call_recording_state 或 call_transcript_state,subject 为 [payload.call_id, payload.recording_id];后续 ak.call.state 用 recording_transition.recording_id / transcript_transition.recording_id 指向同一段,其值 MUST 与该段 start event 的 recording_id 逐字节相同。capture_kind 是 required 字段,MUST NOT 由 missing-field default 推断——它决定目标 current state family。
捕获 transition 与 result 分离(normative):开始后安全状态为 capturing;停止命令只把安全状态推进到 stopped。ready/failed 结果必须从 stopped 发布。治理 Station MUST 从同段 stopped current 的 revision 定位其唯一原生 RealmCommit 与 event_ref,独立验证原 stop Event 的 scope、call、段、capture kind、精确 from/to 和唯一确认结果;ready 录制不得另传 stop 镜像,failed 及转写已有 stop metadata MUST 与该原件相同。transition MUST 携带 scalar expected_commit_id,精确比较产物轴当前 revision;停止分支 MUST NOT 携带该字段。result 保存 {status,details},status 为 pending/ready/failed,details 保留所属分支 metadata,写入 guard 不存入 value;唯一接受位置是外层 revision。治理 Station 按 stream 顺序执行并拒绝 stale revision,且结果不能重开捕获。start 的 pending result 与许可创建在同一原子提交内生效。 call_capture_pending_details 的唯一定义是复制已接受 Start 的 capture_metadata,再由接收方按 capture_kind 附加完整原 EventID 至 recording_start_event_id 或 transcript_start_event_id;该字段不得签回 Start。停止不改写 pending 结果。已 ready 的产物不得被 failed 覆盖而抹去其保留/删除审计义务;ready 再写必须保持同一 Blob、加密 Context、原 start 和生产/authority 绑定,retention/audit 更新仍须通过既有具名权限与 hold 门。failed 可在精确 CAS 下重试为 ready。
focus:是call_focus的完整目标值,moderequired、session_focusoptional。首个 committedsession_focus后,任何后继focus写入都 MUST 原样携带它;省略或改写均以session_focus_already_committed拒绝。mode只允许按 §6 单向升级。roster_delta:participant 的稳定领域身份是(call_id, actor_id, device_id)。operation=join创建或更新该 participant;operation=leave携带同一actor_id/device_id与 rosterexpected_commit_id。未知 participant、跨 call、身份不匹配或 stale revision MUST 拒绝。每 Event 只允许一个 roster delta;effective roster 上限为 1,000。roster_delta.participant的actor_idMUST 为完整 ActorId,account分支同时保留 exactprincipal_id与station_id;device_idMUST 为真实认证 DeviceId。join、leave、token outcome 和媒体续期 MUST 使用同一身份,不使用匿名 DID 或设备别名。joined_at若写入 durable event MUST 向下取整到 5 分钟 bucket。- participant_binding 直接签署完整 ActorId、真实 DeviceId 与本次媒体范围。refresh 从 accepted 活跃 roster 核对认证主体,不使用私有主体映射、subject_binding 回执或其摘要;具体生命周期见 media-service-binding §3.2。
roster_delta.participant.foci_preferred:客户端本地 focus 偏好列表;后加入者不得改变已 committedsession_focus。roster_delta.participant.participant_id:来自 token exchange 响应的 SFU-local handle,scope 限(call_id, focus_id, sfu_did)。roster_delta.participant.participant_binding:token issuer 对(realm_id, call_id, focus_id, actor_id, device_id, participant_id, expires_at, media, issuer_kid)的签名承诺。reducer MUST 验证:issuer_kid解析到的 service DID 出现在当前 epochak.realm.media_service.service_id;- 从 enclosing Event/Call 取得
realm_id/call_id,从该 participant entry 取得focus_id/ 完整actor_id/ 真实device_id/participant_id/ 完整media,并与 binding 的expires_at、issuer_kid重建唯一签名九字段;写入时 entry 的focus_id必须等于已接受的 selected focus,后续 focus 变化不得重解释旧 entry; expires_at> eventcreated_at(不接受已过期 binding);signature通过签名验证。 任一失败 →failed_preconditionreason="participant_binding_invalid"。
- P2P / mesh roster 分支:当当前
focus.mode ∈ {p2p, mesh}且尚无session_focus时,roster join MUST 省略participant_id与participant_binding;participant identity 由 signed answer proof 中的(call_id, actor_id, device_id)组成,admission service 验证 answer 后接受 durable join。 当focus.mode ∈ {sfu, mcu}或已 committedsession_focus时,上述两个字段反而都 MUST 出现并按本节四项校验。模式分支由包含 roster delta 的同一 accepted call-state basis 决定,producer 不得自行声明第三个判据。 mute_override:v1 暂不开放主持人强制静音。ak.call.state只要携带此字段(即使同时携带其它合法 delta)就 MUST 以schema_violation拒绝,零 Event/Commit/current state 写入;旧 call-onlycall_mute_overrideselector 与单 leg value 不得被解释为多 leg 集合。该保留形状不授权生产端写入。普通通话、自主mute_state{by=self}、kick/ban/end-for-all 仍按各自合同接纳。moderation_delta.operation=remove_participant:以(call_id, actor_id, device_id?)作为稳定领域目标;kickMUST 含device_id,banMUST 省略它。moderation_delta.operation=restore_participant必须携带 moderationexpected_commit_id,且只能恢复 actor 一致的 active ban,不能恢复 kick。
高频 speaking、自主 mute/video 状态 SHOULD 走 encrypted Signal Extension;主持人强制静音在 v1 失败关闭,不能用仅作用于客户端的信令冒充服务端媒体权限。
4.2 state 状态机(normative)
call_state_payload.state_transition 是通话生命周期 delta,显式携带 from / to。它写入 call_state,且只承载这一条轴。合法转换、终态与并发语义如下:
state | 语义 | 合法后继 | 终态? |
|---|---|---|---|
scheduled | 已排期,未开始 | ringing、connecting、cancelled、missed、failed(排期通话自动启动失败) | 否 |
ringing | 呼叫已发起,待应答 | connecting、active、missed、cancelled、failed | 否 |
connecting | 应答后媒体协商中 | active、failed、ended | 否 |
active | 通话进行中 | ended、failed | 否 |
ended | 正常结束 | —(终态) | 是 |
missed | 未应答 | —(终态) | 是 |
failed | 出错失败 | —(终态) | 是 |
cancelled | 连接前取消 | —(终态) | 是 |
- 初始 state 集合:
ak.call.create.payload.initial_stateMUST ∈{ scheduled, ringing, connecting },并以from=null初始化call_state。ak.call.state.state_transition.from不再允许null;它必须匹配已 accepted head。创世直接进入active或任一终态 MUSTfailed_precondition,reason_code="call_state_transition_invalid"。 - 终态集合:
{ ended, missed, failed, cancelled }。reducer MUST 拒绝从任一终态转出(单调推进),违反用failed_preconditionreason="call_state_terminal"。 - 非法转换通用规则:源 state 为非终态时,任何不在上表”合法后继”列内的
state转换 MUSTfailed_precondition,reason_code="call_state_transition_invalid"(见artifacts/registry/error-code-registry.json);源为终态时用call_state_terminal,二者不混用。 - 同状态重放:同一 basis 上重复提交相同
from -> to转换是幂等 no-op;reducer MUST 不产生新的分叉 head,也不得把同值重放当成非法转换。 - 并发命令:相同安全前态的竞争命令按唯一确认顺序至多一个成功。其余返回持久前置失败,不形成权限多头。
- 终态吸收:一旦某 accepted head 进入终态,任何后续转出都按
call_state_terminal拒绝;终态不能被并发 winner 规则覆盖,因为本状态机没有 winner 规则。
超时推进(normative):ring_timeout_ms 默认且最大为 60,000;scheduled_start_grace_ms 默认且最大为 300,000;connecting_timeout_ms 默认且最大为 120,000。计时锚分别为进入 ringing 的 accepted event created_at、排期开始时间、进入 connecting 的 accepted event created_at。focus / token issuer(无 focus 时为 Station)MUST 在窗口到达后以当前 accepted head 为 CAS basis 提交显式状态事件:ringing → missed、未在 grace 内开始的 scheduled → missed、connecting → failed(state_transition.failure_reason_code="media_negotiation_timeout";该成员在 to="failed" 时必填、其余转换禁止携带)。计时器本身不得直接改写 reducer state。若迟到的 active 与超时终态竞争,按唯一安全确认顺序及精确 revision 处理;提交方 MUST NOT 用本地到达顺序选择 winner。
- 空 roster 终态推进:当 focus / token issuer 观察到 active media roster 为空时,最后离开的、仍持有
ak.call.join的成员 SHOULD 立即提交state_transition={from:"active",to:"ended"};focus / token issuer MUST 启动call_empty_timeout_ms(默认且最大 120,000 ms),超时前 roster 仍为空时 MUST 代表该 call 提交同一显式 transition。若没有 focus(纯 P2P),承载该 Realm 的 Station MUST 以相同窗口根据 authenticated ephemeral leave / leg expiry 证据推进终态。任何新 leg 在该窗口内重新加入会取消计时;终态 accepted 后不得复活,重新加入必须创建新call_id。
录制维度(与通话 state 正交,normative):ak.call.recording.start 创建一段 capturing 安全状态;唯一后继是 stopped,stopped 不可转回 capturing。新段使用新的 recording_id 并重新经过许可检查。recording_transition / transcript_transition 的 wire from/to 按 schema 的精确分支解释,ready/failed 的 from=stopped 是产物 provenance 前置,不是写安全状态。
- 同一段不可重开,停止的
from=recording/from=transcribing是充分的一次性前置条件;停止不携带冗余 revision,竞争停止至多一个成功,失败不改变许可。 - ready/failed 必须引用已确认 stop,先停止捕获才发布产物。缺 stop 或属于其它段的 stop 均不生效。
- 结果独立按所属 stream 的 Commit 顺序与
expected_commit_id更新;异值竞争不冻结其它段或主通话状态。 - roster/moderation 更新在同一 authority commit 事务中原子执行;不能脱离该序列释放 token 或移除访问屏障。
4.3 完整有效 current 与接受来源(normative)
call_roster 与 call_moderation 的 value MUST 为完整 {entries,last_source},closed shape 由
current-state.schema.json 的同名 value 定义。
它们仍属于 commit-ordered projection;canonical registry 使用 set 与下列封闭 derivation,
不再使用 Call 的累计 keyed_set_add。该变更不改变 Event delta、接受顺序或其它 keyed-set family。
确定性投影:治理 Station MUST 在接受原 Event/RealmCommit 的同一事务内,从锁定的完整前态 及本次 accepted delta 计算完整后态;副本 MUST 按原 stream 顺序重建同一结果,不得重新接纳或重签来源。
call_roster_effective_entries:以(完整 ActorId,真实 DeviceId)为键,join 用本次原 join entry 替换同键旧 join,leave 仅删除同键 entry;未知目标、错身份及 staleexpected_commit_id按 §4.1 拒绝。entries只含尚未 leave 的最新 join,不保留被替换 join 或 leave 历史;有效 roster 上限仍为 1,000。 moderation 不暗中改写 roster:是否允许媒体仍联合读取两个轴及其它当前门禁。call_moderation_effective_entries:ban 以完整 ActorId 为键保留最新 remove;kick 以(完整 ActorId,真实 DeviceId)为独立键保留最新 remove。restore 只删除同 actor 的 active ban, MUST NOT 删除 kick。ban 与该 actor 的设备 kick 可以并存。重复同目标 remove 只替换本分支旧来源; 不同 Station 的同 principal 不合并,kick 不获隐含期限,也不因 leave、restore 或后来 join 被删除。call_axis_last_source:恰为本轴本次 accepted delta 的{tag_id,source_commit,value}, 其中value逐字保留完整原 delta,tag_id为 canonical<event_id>:<write_index>,write_index 是 canonical registry 的原state_writes下标,不能按本 Event 实际出现的轴重新编号。source_commit是 materializer 附加的实际原接受 RealmCommit,producer 不得提供或覆盖来源。
每个有效 entry 同样保留 {tag_id,source_commit,value} 的完整原 join/remove delta,不裁 participant、
media、public binding、moderator 或其它原字段。roster entry 有 participant_binding 时还 MUST 带
participant_signing_key{public_key_base64url},否则 MUST 省略此成员。它是原 issuer 在该 join
source_commit.committed_at 适用的 Ed25519 公钥,不是当前其它 key、producer key 或新身份。
治理接纳 MUST 从独立验证的原 issuer 方法权威取得并耐久保留该精确材料;副本/消费 Account Station
MUST 独立核原时点 issuer authority、kid/controller 与该 key 的配对,不能只因 snapshot 内有公钥就判其权威。
该窄公开 key 随已有可见 join 披露,不披露方法历史、Device 目录、PCR 原件或私有回执。缺材料时
MUST 按既有 operation 不可用合同失败,不能用当前 key 补齐或返回缺 key 的伪完整结果。
来源、排序与修订:两条 entries 都按 canonical tag_id 字节升序排列,目标键唯一;MUST 拒绝
重复 dot、重复目标、同一轴 entry 的重复 position 或不同同 dot carrier。last_source 与某 entry
引用同一来源时,三字段 MUST 完全相等,此引用复用不算重复 entry。consumer MUST 核所有来源的
Realm、Call 所属 stream、source_commit.event_ref 与 dot 的 EventId、write index 对应轴,以及
source position 不晚于该轴 revision/enclosing head;同一来源 Commit 可在不同轴用各自 dot 被引用。
来源中稀疏 position 不构成连续历史,不得补出隐含全局 position 或拿它推进 stream head。
原 delta 与 Event 的对应由真实 materializer/已验证 replica 原件保证;Commit 单独没有承诺 delta bytes,
故仅凭 dot 和 Commit 不得声称完成 producer 验证或独立遗漏证明。
row revision MUST 精确等于 last_source.source_commit 的 {commit_id,stream_position},
source_stream_ref MUST 与它的 stream_ref 相等;last_source 必须实际写过本轴。leave/restore 即使令
entries 变空,也 MUST 保留该最后来源并推进整轴 revision,不回退到最后幸存 join/ban。
expected_commit_id 始终比较整个对应轴,不能比较某 entry 的旧 revision。两轴 revision 可以不同;
若一个 Event 同时更新两轴,原子可见并共享该 Commit,但 dot 下标各自不同。
完整性与读取:普通读取复用完整内联、原治理签名的 Snapshot,经已持久绑定完整 AccountId 的自己
Station 消费(server-trusted-results §2.1);不新增 Call exact-current
operation、裸 complete/verified、独立摘要、可复用 allow 票或 portable proof。value 的封闭形状与
enclosing 原签名绑定该 selector 的完整有效集合,不允许 partial/截断 entries。Snapshot 的当前任期、
请求、Realm、scope、heads/floors、已知高水位、同 revision 异字节及原子安装规则全部适用。
entries:[]配完整 last_source 是“轴已写入且现在为空”。从未写过该轴不制造 row、revision 或 last_source;只有完整且覆盖目标可见 Call 的获准 Snapshot 能确认“未初始化”,该事实不授媒体权限。- 普通响应缺 row、局部 cache 无 row、授权 scope 不明、缺来源/key、混合 cut 或 partial 不能解释为空。 MUST 保持未解决并拒绝依赖该状态的操作;不得拼接缓存或截断当前值以绕过 Snapshot 容量门。
- current head MUST 属 fresh current governance generation,不低于已知高水位;有效 entry 和 last_source 可以来自链内旧任期,但其原签名/原时点 key 仍须成立。旧任期 Snapshot 只可按 exact 历史 by-ref 使用,不能安装覆盖较新 current。有效同 revision 异 value/source/key MUST 整批拒绝。
- materializer 与持有完整原投影的 replica MUST 拒绝漏成员、错成员和与前态不符的结果;普通客户端 拒绝签名字节篡改和已知矛盾,但不能仅凭名单证明治理方没有重新签出遗漏。不得宣称比既有 单 authority 信任模型更强的 Byzantine omission proof。
Call、focus、roster、moderation、membership、device、capability、Consent 与适用 MLS 状态 MUST 在本次授权所需同一稳定 accepted cut 读取。不同 stream 使用各自 head/revision 与明确的跨流依赖, 不制造 Call 全局计数。issuer 最终交付前仍须重验当前权限、终态及稳定 cut;先前 current 不成为租约。 对同一完整 actor/device,kick source position 晚于当前 join source 时 MUST 拒绝该旧 leg refresh;只可在同一实际 stream 比较,无法确认来源则失败关闭。之后合法重新 join 的较新来源不被 旧 kick 永久禁止;active ban 仍拒绝加入与续期。首次接触及 Consent 三层检查保持独立。
4.3.1 消费材料与历史边界
| 消费能力 | 必须取得并验证的材料 |
|---|---|
| 显示/冷恢复当前名单 | 完整 Snapshot 的获准 roster/moderation rows、entries 与 last_source;保留完整 ActorId/真实 DeviceId,不依赖过程 fold cache |
| SFU 身份交叉校验与续期 | 原有效 join、其 Commit 时点、原 public participant_binding 与该 entry 的 participant_signing_key;客户端独立重建九字段并验 Ed25519,issuer 同时核当前认证主体、participant_id、focus、media 与全部当前门禁 |
| P2P/mesh | 既有 signed answer proof 与 admission 验证职责不变;current join 不捏造 SFU participant/key,不把 delta 当 producer envelope |
| leave/restore 与 kick 旧 leg 拒绝 | 对应整轴 revision、有效目标及其原来源;restore 不移除 kick,空后态仍保留 last_source |
| Event producer/MLS/附件独立验证 | 仍用既有获准完整 committed_event_view,或本次冻结自签 Event+对应 self accepted outcome,及 exact historical signer 材料;current 内 delta 不是完整 Event,嵌套 Commit 不自行授予 signer query 或历史读取 |
| 授权审计/完整重建 | 原 accepted Event/RealmCommit 历史、producer proof 与原历史授权材料;按原 stream scan/exact Snapshot basis、披露权限和 history floor 读取,不从 current 猜出已移除历史 |
所有原 accepted 历史按原保留与审计合同保存;本节只移除普通 current 的失效断言,不授权删除历史、 扩大 floor 或回填伪来源。若某操作必须独立验证 producer 原件,而其原件/历史 key 超出当前披露范围或 暂不可得,该操作 MUST 返回既有不可用结果,不能用 current 摘要替代,也不能要求其它成员代取。 冷恢复可从完整 current 恢复活跃 participant_id,但仍须本次认证及实际独立签名验证;不恢复私有 receipt。 有效 ban/不同设备 kick 数量不受 roster 的 1,000 人上限约束;本节只消除重复历史成本, 不改动 Snapshot 的全局 8 MiB、完整 inline 与容量接纳规则。
可执行规范样例与拒绝向量:ak.vector.call_state.compact_current.v1。它们验证 schema、确定性投影、
来源坐标与真实签名字节,不冒充生产接纳、原生方法历史验证或产品/联合性能验收。
5. 录制与转写
录制和转写默认关闭,必须由 Realm policy 和 call capability 显式允许。
启动录制:
{ "kind": "ak.call.recording.start", "realm_id": "ak:realm:...", "payload": { "call_id": "ak:call:ARzVic5s2NUShp82C8GPo-shbkm7isUWyvILLThc3aNL", "recording_id": "rtc-recording-0196441d-0000-7000-8000-000000000000", "recording_agent_id": "ak:did_core:web:recorder.example", "capture_kind": "recording", "mode": "audio_video", "visible_notice": true, "capture_metadata": { "key_ref": {"algorithm": "MLS", "group_state_ref": "ak:event:..."}, "retention": {"consent_confirmed": true, "retention_expires_at": "2027-09-20T00:00:00.000Z"} } }}要求:
-
需要
ak.call.recordcapability。ak.call.recording.start通过 requiredcapture_kind(recording/transcript)区分录制与转写两条平行生命周期(转写见 §5.1);它选择目标 current state family(call_recording_state/call_transcript_state),因此 MUST 显式携带,缺失 MUSTschema_violation,MUST NOT 由 missing-field default 推断。 -
payload.modeMUST 显式携带,封闭为audio/audio_video;无缺省值,缺失 MUSTschema_violation。 -
payload.visible_noticeMUST 显式为true;客户端 MUST 对所有参会者显示录制中。 -
payload.capture_metadataMUST NOT 携带recording_start_event_id或transcript_start_event_id:本 Event 的 ID 依赖 payload digest,写入自身 ID 会形成无解自引用。capture_metadata.retention.consent_confirmedMUST 为true,否则 reducer 在创建 capture 领域状态 current state 前拒绝recording_consent_required。Event 完成 digest / ID 校验后,reducer 按capture_kind把完整 accepted Event identity 写入对应 projected artifact current state;该 receiver-derived 字段不属于原 Event preimage。start event 原子写入 capture FSM 与独立 artifact current state,不能先进入捕获态再补交同意事实。 -
recording Start 的
capture_metadata.key_refMUST 按 §5.3 冻结同接纳截点的真实 accepted winning MLS state;pending result 复制该 exact 引用。该字段不适用于 transcript Start,不替代原 consent、capability、当前 Service 或原签门。 -
payload.recording_idMUST 是该录制 artifact lifecycle 的稳定 opaque string,并进入 recording key exporter Context;缺失时 recording start event MUSTschema_violationreject。它不是ak:*typed ID;最终持久化产物仍通过 Arkret blob / Morph / artifact 引用暴露。由于recording_id是跨实现密钥派生输入(进入 §5 第 3 步的Context),其 canonical 形态 MUST 由ak.call.staterecording start event 一次性固定并逐字节保留:取值 MUST 为 ASCII 子集[A-Za-z0-9._-]、长度 1–128 字节;发送方写入后该字符串即为 canonical,接收方 MUST NOT 做任何 normalize(大小写折叠、Unicode NFC/NFKC、trim、re-encode 等),并 MUST 在所有引用该录制的 event / key 派生中逐字节复用 start event 的原值。任何对recording_id的本地规范化都会令派生出的 recording key 与发送方分裂、导致解密失败。 -
手动停止录制不注册独立
ak.call.recording.stopevent;holder ofak.call.record通过ak.call.state写recording_transition={recording_id,from:"recording",to:"stopped"}。若同时携带recording_transition.capture_metadata,其中的recording_start_event_id继续指向该段的ak.call.recording.start作为 provenance;该 capture metadata 写入独立 artifact current state,不进入 FSM transition op。stopped是该录制段的终态,不要求产生 artifact;若 backend 已经产出可用 artifact,后续 MAY 以同一recording_start_event_id写to="ready",否则保持stopped。 -
同一通话允许多段录制。
ready/failed/stopped之后再次进入recording时,MUST 先接受新的ak.call.recording.start,且新的recording_idMUST 不同于该 call 任何既有 recording start 的recording_id。物化投影 MAY 只展示最新捕获态,但历史段以各自ak.call.recording.start与后续ak.call.stateevent 保持可审计。 -
录制 artifact MUST 作为 encrypted Blob 或受控 media object 存储。
-
Backend-generated recording 必经 Arkret blob pipeline(参见
media-service-binding.md§8.1):backend 可能自带录制能力(LiveKit Egress、Janus recording plugin 等),但生成的 artifact MUST:- 作为加密 blob 上传到 Arkret media service(通过
media-and-blob.md的 authenticated upload 端点),不得 backend 自行托管。 - 普通 Blob 上传继续执行既有身份、ACL 与 quota 门,不引入录制专用上传字段,也不在上传时声称已验证录制许可。发布 ready 的签名 artifact MUST 携带
recording_initiator_capability_ref;治理 Station 在发布准入时独立核对真实原 start、发起 actor、该 grant 的原接受来源和持续 live 资格。原 Start 行动的审批、quota 与字段限制在真实 Start Event/Commit 的接受事务履行一次;ready 不重做原计费或要求为旧 Event 新造审批。发布时 MUST 以原 capture 事实与当前动态源重核该 grant 的 status、root/lineage、时窗、资源及 claim/device/Applet/session/policy 等持续限制;未知动态源 MUST 拒绝。ready 作者自己的当前 Event 则独立执行其完整授权、审批及 quota 门。未发布的 Blob 不因此授予录制、读取或解密权限。 - 加密 key MUST 由 Arkret 协议层提供(与
media-service-binding.md§8.1 同源,从 MLS exporter 派生),backend 不持久化明文。Recording artifact key label 固定为"ak.rtc-recording-key/v1",Context=canonical_json({realm_id, call_id, focus_id, recording_id, media_service_id, recording_start_event_id}),输出 32 bytes;不得复用 SFrame label"ak.rtc-frame-key/v1"或空 Context。 - 入库后通过
ak.call.state的recording_transition发布 lifecycle;ready 的capture_metadata仅携唯一完整 artifact,其他字段从该 artifact 派生。 绕过该 pipeline(如 backend 直接对外暴露 recording URL)MUST 被客户端拒绝并报recording_artifact_pipeline_bypassed。这保证 backend 是 “录制执行单元” 而非 “录制档案库”。
- 作为加密 blob 上传到 Arkret media service(通过
-
Start 的 envelope MUST 用既有
authorization_ref签定实际选择的 GrantId,按 capture_kind 精确消费ak.call.record或ak.call.transcribe;治理 Station MUST 实际履行这条正向路径,不能以 owner implicit 或另一个 grant 代替,所有其它当前 grant 的全局拒绝仍有效。其后产物只能引用该原 source,不能事后选择一个仅当时存在的 grant。真正开始捕获 MUST 以当前activeCall 为前态,并使用已 committed 的 focus;focus MUST 精确属于当前 Realm media descriptor,录制还 MUST 显式满足recording_supported=true。scheduled/ringing 不提前创建捕获许可或 pending;转写仍使用其独立 capability/support 与 label 门,不以 recording_supported 冒替。 -
录制结果 MUST 通过现有
ak.call.state.recording_transition发布。to="ready"的capture_metadataMUST 是唯一 closed{artifact},artifact MUST 符合call-recording-artifact.schema.json。Realm/Call/recording_id、真实 start、原 init capability、produced_by、exporter label/context 和当前权限 MUST 与 accepted source 对齐。blob_ref承诺 exact stored ciphertext bytes,MUST NOT 再携同原像 content_digest/ciphertext_digest;下载按该 ref 验字节,再独立执行 AEAD/AAD。duration/media_type/retention 等仅在 artifact 内,查询索引从其只读派生,外层镜像 MUST 拒绝。ready 原件 MUST 由原 recorder/current Media Service 真实签署,并使用现有已验证及保留的HistoricalProducerSignerFact::Service绑定当前 Event、Commit、fact digest、原签名和当前 installation/grant 门;仅声明 actor/executed_by 或放一个 producer_proof 字段不构成证据。该 Service 对完整 artifact/BlobRef 作签名责任承诺。ciphertext 可由既有合格 uploader 搬运,uploader 不必等于 producer,也不因此证明谁生产或加密;不得为重复身份门另造 Service 上传能力。原 start 的 consent 事实和当前 retention/policy/legal-hold 门仍全部必需;ready 不得重开撤回同意。stopped 不要求产物,failed 保留原 failure 诊断而 MUST NOT 携 artifact、明文片段或 backend URL。v1 不注册独立 recording.result/stop kind。 录制与转写的failure_reason_code共用封闭 core 集:media_negotiation_timeout/permission_denied/backend_unavailable/media_source_unavailable/storage_failed/policy_revoked/consent_withdrawn/integrity_failed。扩展值 MUST 使用x_前缀并匹配^x_[a-z0-9_]{1,62}$;其它值 MUSTschema_violation。 -
转写需要
ak.call.transcribe,转写文本应作为 Morph 或 Artifact,并遵守同一 Realm policy。
5.1 转写生命周期(normative)
转写与录制平行:默认关闭,MUST 由 Realm policy 与 ak.call.transcribe capability 显式允许。转写态走 ak.call.state 的独立 transcript_transition(to ∈ { stopped, ready, failed },缺省=未转写;进入 transcribing 只能由下述 ak.call.recording.start 派生),与 state_transition 及 recording_transition 三者正交。
- 启动转写复用
ak.call.recording.startevent kind,但capture_kind="transcript"(该字段 required,无 missing-field default);其recording_id同样是稳定 opaque 句柄,约束与 §5 录制recording_id完全一致(ASCII 子集[A-Za-z0-9._-]、1–128 字节、逐字节 canonical、接收方 MUST NOT normalize),并进入 transcript key exporter Context。缺少ak.call.transcribe时 MUST 拒绝,reason_code="transcription_denied"。 - 客户端 MUST 对所有参会者显示转写进行中提示(与录制提示同等级别)。
- 转写文本 MUST 作为 encrypted Blob / 受控 media object 存储,绝不明文落 backend。转写 artifact 的加密 key MUST 由 Arkret MLS exporter 派生,label 固定为 ASCII 字符串
"ak.rtc-transcript-key/v1"(与 SFrame"ak.rtc-frame-key/v1"、录制"ak.rtc-recording-key/v1"区分),Context=canonical_json({realm_id, call_id, focus_id, recording_id, media_service_id, transcript_start_event_id}),输出 32 bytes;canonical 登记见../../artifacts/registry/exporter-label-registry.json。复用其它 label、空 Context,或接受 backend / KMS 自生成的 transcript key MUST fail closedtranscription_artifact_pipeline_bypassed。 - 转写结果通过
ak.call.state写入transcript_transition,并在transcript_transition.capture_metadata中引用transcript_start_event_id;to="ready"/to="failed"时还 SHOULD 携带 content digest、media type、language 与 retention policy。手动停止时写to="stopped",不要求产生 artifact。 - v1 不为转写注册独立的 result / stop event kind;转写态变化一律通过
ak.call.state写入。
5.2 录制 / 转写 retention policy(normative)
录制 ready 的保留/删除依据唯一为 recording_transition.capture_metadata.artifact.retention 及其 retention_policy_id;转写和未产物阶段仍走各自现有 capture_metadata.retention。两者均保留原删除、审计锁和二次同意义务。
- 保留期:
retention.retention_expires_at是协议固定的最早可删除时间;缺省时由retention_policy_id指向的 Realm retention policy 决定。写入时 MUST NOT 为过去时刻。 - 删除触发:
retention.deletion_trigger ∈ { retention_expiry, manual, realm_policy, participant_erasure }。participant_erasure对应某参与者发起 erasure 时对其媒体片段的级联删除(见 account erasure 流程)。实际删除尝试的触发事实写入 result artifact 的deletion_audit.trigger(或转写后续定义的等价 artifact 字段);该值 MUST 与 retention 的deletion_trigger一致,不得由 Blob 服务或媒体 backend 自行改写。 - 审计锁定:
retention.audit_lock=true时该 artifact 处于 legal / audit hold,任何删除(含 retention 到期、manual)MUST 被拒绝legal_hold_active,直到 audit 级 action 解除锁定;audit_lock 优先于retention_expires_at与 capability。解除后删除(normative):audit_lock 被 audit 级 action 解除后,删除按原本适用的deletion_trigger继续(retention_expiry若已到期、否则按触发来源取manual/realm_policy/participant_erasure),不新增独立 trigger 枚举值;该次删除的 deletion audit MUST 记录解锁来源(legal_hold_ref+ 对应trigger_event_id),使”曾被 legal hold 阻塞、解锁后按原 trigger 删除”在审计上可追溯。 - 删除审计:每次删除尝试 MUST 至少在服务审计日志中记录
trigger、status、requested_by?、trigger_event_id?、requested_at、completed_at?、erasure_receipt_ref?、legal_hold_ref?与failure_reason_code?,其 wire 形态见call-recording-artifact.schema.json#/$defs/call_recording_deletion_audit。删除完成时 MUST 产出或引用ak.schema.erasure_receipt.v1(可作为ak.audit.erasure_receiptdurable event),并把erasure_receipt_ref绑定到 deletion audit;因 legal hold 阻塞时 MUST 记录status="blocked_by_legal_hold"与legal_hold_ref,不得伪造成已删除。 - 客户端二次确认:录制 / 转写进入捕获态只能由
ak.call.recording.start完成;接受该 Event 前 MUST 取得用户的第二次显式同意,并将事实记入payload.capture_metadata.retention.consent_confirmed=true。reducer MUST 原子验证该事实并写入独立 artifact current state,缺失或不为 true 时 MUSTfailed_preconditionreason_code="recording_consent_required";ak.call.state不得提交to="recording"/to="transcribing"绕过 start gate。 consent_confirmed的保证类别(normative,诚实标注):consent_confirmed=true是流程性约束,不是密码学同意证明——它由发起方客户端单方面置真,协议层无法强制其真实性。实现、UI、采购或合规文案 MUST NOT 把consent_confirmed=true表述为”已获得(被录制方的)密码学同意”或等价措辞,避免 false-positive 合规声明;该字段只表示”发起方声明已在本端取得用户二次确认”。- per-participant consent acknowledgment(更强合规 profile,normative):每个被录制方设备签名的 consent acknowledgment,其 signing input MUST 覆盖
(call_id, recording_artifact_ref 或 capture epoch, consenting_actor_id, consenting_device_id, consented_at),签名身份按device-lifecycle.md§8.2/§8.3 的设备验签公钥目录解析并 fail-closed 验证。security_class=high_assurance或启用 attested / disclosed audit profile 的 Realm MUST 启用该门禁;其它 Realm MAY 启用。启用时,reducer MUST 对缺少任一当前被录制方有效 acknowledgment 的捕获态failed_preconditionreason_code="recording_consent_required",且成员加入、设备切换或 capture epoch 改变后 MUST 重新取得 ack 后才能继续捕获。该签名集合是disclosed_policy之上的attested-类强保证,可作为可审计同意证据。未启用该 profile 的部署仍只具备上一条的流程性保证,不得声称等价。 - ready 录制的 retention 只位于唯一 artifact;未产物阶段及转写的原 retention 路径保持。保留期与捕获 FSM 正交,不新增写入权或第二份可写镜像。
5.3 录制 Blob 的单一 STREAM 编码(normative)
本节补足 §5 的录制密文编码;不复用附件的 AttachmentContentKeyContext、content salt 或 key commitment。仅 Call recording 使用 encryption_algorithm="mls_exporter_aead_xchacha20poly1305_stream";本对象不接受其它 whole-file/AES 算法或兼容分支。普通附件、file-transfer、frame 与转写各自合同不变。
5.3.1 Start 来源与 epoch
recording Start 的 capture_metadata.key_ref MUST 是现 closed MLS 引用 {algorithm:"MLS",group_state_ref}(blob.schema.json 的同一字段类型)。首次接纳 MUST 从真实来源核对该引用对应同一 effective ScopeRef(含 Sidecar)、immutable genesis 和当前 accepted winning MLS state;该判定与原 Start 的接纳截点一致。不得用 timestamp 跨 stream 猜顺序、用 bare epoch 或 ready 时的 latest state 补值,也不得把引用存在或持钥等同授权。Event ref/等价 Event-content hash 的解析、producer proof、治理接受、winning state、scope 和独立历史读取资格沿 media-and-blob.md §3;不新增 hash 查询接口。
Start 原件与其 accepted key source 必须可从原接受来源重建;pending current details MUST 复制原 key_ref、retention 并附原完整 recording_start_event_id。后继唯一 artifact 的 encryption.key_ref MUST 与原 signed Start 的引用 byte-equivalent,不能换成相同 epoch 的另一 raw 表示。它是后继自足解密描述与前态选择的固定绑定,不是独立可改写镜像。
key_ref 唯一导出原 scope/genesis/epoch,不在 wire 重复传 epoch。实际 MLS checkpoint MUST 对应该 state;RTC key 继续为原六字段 Context 下的 MLS-Exporter("ak.rtc-recording-key/v1", Context, 32)(RFC 9420)。不得用当前群、另一同数字 epoch、附件 content root 或裸 key assertion 代替原来源。原 Start 已存在后才能得到其 EventId 和 RTC Context,因此不存在把自身 EventId 签回 Start 的循环。
此单文件绑定固定原 Start epoch。producer 观察到经验证的 epoch/捕获资格变化时 MUST 停止向原段采集;不得合成未授权 Stop Event。 已认证的新 epoch frame-key 安装/新 epoch 媒体帧交付,MUST 先在同一真实本地 writer fence 停写旧 Start key_ref/K_e 段,再允许新 epoch 明文进入捕获管线;异步通知 recording job 稍后暂停不足以满足此要求。codec 本身不证明 adapter 已执行该 fence。通过既有授权 Stop 及新 recording_id/新 Start/新 key_ref 才能续段,原二次确认不得被跳过。旧段可以在后继 epoch 才发布 ready,但不得改用新 key_ref。即使最终才加密单文件,旧 epoch key 持有者仍可解原 K 加密的全部内容;不能声称一个 K 跨成员变更保护后续新 epoch 内容。缺原合法 key/checkpoint 时保持不可解密,不借 Welcome、Recovery 或当前 metadata 授予历史密钥。
5.3.2 唯一形状与字节
artifact.encryption MUST 恰含 encryption_algorithm、exporter_label、context、key_ref、nonce_prefix、segment_bytes。前两者固定为本节算法与原 recording label;Context 保持 §5 六字段。nonce_prefix 是 canonical base64url-no-pad 的恰好 19 octets,production MUST 取 CSPRNG。segment_bytes=L 显式声明并沿既有 STREAM 的 1KiB–8MiB、段数 2^20 及 u32 index 上限;不存在 scheme、plaintext_size、segment_count、ciphertext_digest 或 content_digest wire 镜像。普通 Blob storage 的独立 classification 仍为 {scheme:"ak.blob.stream_aead.v1"},上传授权不变。
Blob 的 exact stored bytes 是各段 ciphertext || 16-octet tag 按顺序直接拼接,不嵌新的 header/framing。除最后一段外明文长度恰 L,最后为 1..L;空文件为唯一一个 0-byte 明文末段。nonce 严格是 nonce_prefix[19] || u32_be(segment_index) || last_segment_flag,flag 为单字节 0x00/0x01。每段从 0 连续编号,既有 STREAM 的 nonce、AEAD 和拼接算法不变。
artifact.size_bytes 是包含所有 tag 的完整 stored ciphertext octet 数 B,必须等于真实 Blob 长度;不是明文长度。接收方必须用 checked arithmetic 计算 N=max(1,ceil(B/(L+16)))、P=B-16N,并回验 N=max(1,ceil(P/L)) 及全部上限。B 必须至少 16;P 不得负,P=0 只允许 N=1,其它末段必须 1..L;不允许额外空尾段。ceil 必须用商/余数或受检等价计算,不能先溢出 B+L+15。因为 (N-1)L<P<=NL 蕴含 (N-1)(L+16)<B<=N(L+16),反解唯一;不满足逆式的长度间隙必须拒绝。内存/offset/下载预算在分配前按既有 limits 核对,不 wrap 或 saturate。
5.3.3 独立在线 AAD
每段 AAD MUST 恰为下列 closed object 的 RFC 8785 JCS UTF-8 bytes,无换行/BOM;index 是 uint,flag 是数值 0/1,由段位置计算,不接受 caller 副本:
{encryption_algorithm, exporter_label, context, key_ref, nonce_prefix, segment_bytes, media_type, segment_index, last_segment_flag}前七项来自完整已认证 artifact 及其原 Start;media_type 为媒体格式,Blob transport 仍为 application/octet-stream。AAD MUST NOT 携 BlobRef/内嵌 digest、B/P/N、created_at、retention 或 deletion_audit。这里的 key 与 AAD 属于 RTC,不得构造假的 EncryptedAttachment 来借附件编码。
总长不入 AAD 允许未知总时长时在线加密:producer 至多保留最后一段,看到后继才把前段标 non-last;Stop 时将保留段标 last,精确 L 倍数不加空尾。不得因后续长度改变而重算已有 tag 或迫使 backend 持久化明文。接收方从 signed B 反解 N/P,严格按序与边界重建 nonce/AAD:截断会把旧 non-last nonce 的 flag 改成 last,追加会反向改变原 last;两者 tag 均失败。重排/重复受 index 约束。signed B/真实长度与完整 BlobRef 继续独立承诺整体,删去总长 AAD 不允许忽略任一校验。
5.3.4 重试、崩溃与接收
同一 frozen attempt 的 exact retry MUST 重发同 ciphertext/BlobRef/key_ref/prefix/L,不重新加密。源 bytes、MIME、L、key source 或加密尝试改变时 MUST 取 fresh prefix;同 K 下不同 object/attempt 不得复用 prefix。同 Start 内恢复只复用已耐久冻结的 exact bytes;若不确定某段是否已输出,必须放弃该未发布尝试并取 fresh prefix,不能用旧 nonce 编码可能变化的输入。producer 并发所有权与恢复必须用真实持久原语,不以进程 mutex 或 caller bool 代替。发现 prefix 重复必须重抽;CSPRNG 不得被宣称数学上绝无碰撞。
达到既有段数/资源上限或 epoch 变化时停止采集,禁止 index wrap 或 random fallback。已 accepted ready 的 response loss 不授权改 Blob/Context 或另造 artifact。新 key_ref 不授读取、删除或密钥披露权限;原 Start 一次性 approval/quota、ready 当前完整 Service 准入、Blob ACL、consent/retention/hold 门全部独立保持。
接收方先验完整 artifact/真实来源/当前读取资格,再解析获准的原 key state;核实际 B、参数、反解和每段 tag/顺序/末段/长度,最终核完整 BlobRef。流式可按既有 STREAM 合同暂消费已过 tag 的段,但最终持久化或标完整前必须整体 digest 通过;失败丢弃不完整结果,不推进完整 checkpoint。服务器不读 E2EE 明文,真实 producer 签名不是媒体真实性或密码学同意证明。
6. P2P→SFU 升级(normative)
通话可以 P2P 起步(mode="p2p"),但当并发参与者人数 > 2 时 MUST 从 P2P 收敛到 SFU。
并发升级收敛性(normative):分布式下各设备对”将达 3 人”的本地观测可能不同步,因而多台设备可能并发发起升级。这不产生 split-brain:升级 MUST 复用 media-service-binding.md §5 的 deterministic, no-vote focus 选举(由 oldest_membership 的 foci_preferred[0] 确定性选出 session_focus),且 session_focus 为 write-once(本文 §6 第 5 条 / §4.1,由 call_focus 的 commit-ordered projection CAS precondition 表达),任意子集设备并发发起的升级最终都被同一 session_focus 值吸收——首个被接受的 CAS 写入定锚,其余并发 CAS 收敛到同值或以 session_focus_already_committed 失败。因此并发升级收敛到同一 SFU focus,不依赖各设备观测同步,也不引入投票或 leader 选举。
触发与协商规则:
- 触发条件:任一参与设备观察到当前 active 参与者(已 accepted answer 的 leg)将达到 3 人时,MUST 发起升级,不得继续以 P2P / full-mesh 承载 3 人以上(
mesh仅 SHOULD 用于 3–4 人且不作为默认,见 §2)。 - focus 协商:升级 MUST 复用
media-service-binding.md§5 的 deterministic, no-vote focus 选举——由 oldest_membership 的foci_preferred[0]选出session_focus并写入首个携带focus={mode:"sfu",session_focus}的ak.call.state。升级不引入新的投票或 leader 选举路径。 - 加入信令:各设备通过
ak.call.signal{signal_kind=focus_join}(见webrtc-signaling.md§5)向选定 focus 迁移媒体;原 P2P leg 在所有参与者完成focus_join后 MUST 优雅拆除,迁移期间不得丢媒体(参照 §4.2 credential refresh 的”保留旧 allocation 直到迁移完成”原则)。 mode写入:升级落定后,下一条ak.call.state的focus.modeMUST 写sfu,且一旦session_focuscommitted 即不可在本生命周期内回退到p2p(回退 P2P 需新 call)。- 单调性:
session_focus一经 committed 即 write-once——由call_focus的 CAS precondition 强制,改写 MUST 以session_focus_already_committed失败(见 §4.1);升级到 SFU 后人数回落到 2 人 MUST NOT 自动降级回 P2P。 - 升级失败 / 迁移中断(normative):升级编排可能在三处失败——focus 不可达(选举出的
session_focus无法建立媒体)、某设备focus_join中途失败、原 P2P leg 已拆除但 SFU leg 未建成的部分迁移态。处置规则:- focus 不可达且无可选 focus:发起方 MUST 保留旧 P2P/mesh leg(尚未拆除时)继续承载已有媒体,并 SHOULD 在新的 accepted basis 上以下一候选 focus 重试
media-service-binding.md§5.1 的选举(基于剩余foci_preferred);候选耗尽后,通话整体 MUST 提交state_transition={from:"active",to:"failed"}(reason_code="call_state_transition_invalid"不适用——这是终态推进,按 §4.2active → failed合法转换),不得停留在”已拆 P2P 又无 SFU”的不可解释悬挂态。 - 单设备
focus_join失败:不影响其它已迁移设备;该设备 SHOULD 重试focus_join,持续失败则按本地策略以ak.call.signal{signal_kind=leave}退出本通话,通话state不因单设备迁移失败而回退。 - 迁移期间不得丢媒体:在所有参与者完成
focus_join之前,原 leg MUST NOT 被拆除(§6 第 3 条);若实现因故已提前拆除且 SFU 未建成,MUST 视为升级失败并按上面第一条处置(重试 focus 或转failed),MUST NOT 静默丢弃通话状态。 session_focus一旦 committed 即 write-once:升级失败重试只能在session_focus尚未 committed 时切换候选 focus;已 committed 后 focus 不可达只能转failed并由用户新建通话(§6 第 4 条回退 P2P 需新 call 同理)。
- focus 不可达且无可选 focus:发起方 MUST 保留旧 P2P/mesh leg(尚未拆除时)继续承载已有媒体,并 SHOULD 在新的 accepted basis 上以下一候选 focus 重试
7. 通话记录(normative)
协议不定义独立的通话摘要 Event。通话到达终态后的持久记录由 call_state 终态 head(state、mode 等)与各捕获段 current state(call_recording_artifact / call_transcript_artifact)共同给出;客户端从这些 typed current 渲染通话记录,无需重放 ephemeral 信令。逐段捕获状态只读对应段的 capture typed current,不存在把多段折叠成单值的持久字段。