fix recording timing and sync call contracts
management-images / build-and-publish (push) Successful in 34s

This commit is contained in:
2026-09-17 17:43:37 +08:00
parent fa6925010b
commit d17bbe15d9
6 changed files with 773 additions and 19 deletions
+11 -2
View File
@@ -11,6 +11,7 @@ from __future__ import annotations
import base64
import contextlib
import http.client
import io
import ipaddress
import json
import os
@@ -23,6 +24,7 @@ import struct
import threading
import time
import uuid
import wave
from collections.abc import Mapping
from dataclasses import dataclass, field
from pathlib import Path
@@ -618,6 +620,8 @@ class RealCellCall:
)
self.target_channel_id = self._channel_id(target)
self._add_when_ready(self.target_channel_id)
self._wait_answer(result)
result.connected = True
self.ari.request(
"POST",
f"bridges/{self.bridge_id}/record",
@@ -628,8 +632,6 @@ class RealCellCall:
"beepEnabled": False,
},
)
self._wait_answer(result)
result.connected = True
opening = str(self.engine.config["conversation"].get("opening", ""))
if opening:
opening_result = self.engine.speak(opening, f"opening_{self.call_id}")
@@ -1016,6 +1018,13 @@ class RealCellCall:
return None
if not isinstance(raw, bytes) or not raw:
return None
try:
with wave.open(io.BytesIO(raw), "rb") as source:
frames = source.getnframes()
except (EOFError, OSError, wave.Error):
return None
if not frames > 0:
return None
path = Path(self.config.recording_dir) / f"{self.recording_name}.wav"
try:
if path.is_symlink():