Skip to content

Commit 6a11507

Browse files
committed
test: restore unassisted hosted SMS scenario
1 parent 19a3086 commit 6a11507

2 files changed

Lines changed: 2 additions & 21 deletions

File tree

.github/workflows/live-voice.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ jobs:
9595
echo "HOSTED_POST_CALL_MARKER=$HOSTED_MARKER" >> "$GITHUB_ENV"
9696
export VOICE_DRIVER_LINE="After we hang up, send me one SMS containing exactly these three words: $HOSTED_MARKER. Create one post-call action now. Set both the action title and the action details to this exact five-word phrase: Send SMS $HOSTED_MARKER. Wait for the action tool to succeed, then read the exact three-word SMS body back to me. Do not paraphrase, omit a word, or send the SMS during the call."
9797
export VOICE_DRIVER_LISTEN=180
98-
export VOICE_DRIVER_REASK=30
99-
export VOICE_DRIVER_REASK_LINE="Please verify the one queued SMS contains exactly: $HOSTED_MARKER. Correct the existing action if needed, or record one only if absent. Do not create a duplicate action or send it yet. Read the exact SMS body back."
10098
export VOICE_DRIVER_AUTO_STOP=false
10199
fi
102100
nohup node tests/live/voice-driver.mjs > "$RUNNER_TEMP/driver.log" 2>&1 &

tests/live/voice-driver.mjs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ const GREETING = process.env.VOICE_DRIVER_GREETING || "Hello?";
3434
const SPEAK_AFTER_MS = Number(process.env.VOICE_DRIVER_SPEAK_AFTER || "5") * 1000;
3535
const LISTEN_MS = Number(process.env.VOICE_DRIVER_LISTEN || "12") * 1000;
3636
const AUTO_STOP = process.env.VOICE_DRIVER_AUTO_STOP !== "false";
37-
const REASK_MS = Number(process.env.VOICE_DRIVER_REASK || "0") * 1000;
38-
const REASK_LINE = process.env.VOICE_DRIVER_REASK_LINE || LINE;
3937

4038
if (!API_KEY) {
4139
console.error("REMOTE_INKBOX_API_KEY required");
@@ -60,8 +58,6 @@ async function callWsHandler(ws) {
6058
});
6159
console.log("call WS accepted");
6260
let spoke = false;
63-
let closed = false;
64-
let lastHeard = Date.now();
6561
const say = async (text) => {
6662
await ws.send(JSON.stringify({ event: "text", delta: text }));
6763
await ws.send(JSON.stringify({ event: "text", done: true }));
@@ -76,18 +72,7 @@ async function callWsHandler(ws) {
7672
await say(GREETING);
7773
await sleep(SPEAK_AFTER_MS);
7874
await speak(LINE);
79-
const deadline = Date.now() + LISTEN_MS;
80-
let lastPrompt = Date.now();
81-
let nudges = 0;
82-
while (!closed && Date.now() < deadline) {
83-
await sleep(1000);
84-
if (closed) return;
85-
if (REASK_MS > 0 && nudges < 2 && Date.now() - Math.max(lastPrompt, lastHeard) >= REASK_MS) {
86-
await say(REASK_LINE);
87-
lastPrompt = Date.now();
88-
nudges++;
89-
}
90-
}
75+
await sleep(LISTEN_MS);
9176
if (!AUTO_STOP) return;
9277
try {
9378
await ws.send(JSON.stringify({ event: "stop" }));
@@ -106,9 +91,8 @@ async function callWsHandler(ws) {
10691
}
10792
if (ev.event === "start") {
10893
console.log("call start");
109-
void runTurn().catch(() => console.log("scripted turn ended"));
94+
void runTurn();
11095
} else if (ev.event === "transcript" && ev.is_final) {
111-
lastHeard = Date.now();
11296
console.log("heard (final):", ev.text);
11397
await speak(LINE); // speak now if the greeting beat our timer
11498
} else if (ev.event === "stop") {
@@ -119,7 +103,6 @@ async function callWsHandler(ws) {
119103
} catch (e) {
120104
console.log("WS loop ended:", String(e));
121105
} finally {
122-
closed = true;
123106
try {
124107
await ws.close();
125108
} catch {

0 commit comments

Comments
 (0)