Skip to content

Commit b07b41b

Browse files
committed
ci: diagnose stalled inbound voice calls
1 parent 123aaa7 commit b07b41b

1 file changed

Lines changed: 48 additions & 1 deletion

File tree

tests/live/voice.test.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,31 @@ interface DriverState {
3232
number_id: string;
3333
handle: string;
3434
}
35+
36+
const callSummary = (call: {
37+
id: string;
38+
direction: string;
39+
status: string;
40+
localPhoneNumber: string | null;
41+
remotePhoneNumber: string;
42+
clientWebsocketUrl: string | null;
43+
useInkboxTts: boolean | null;
44+
useInkboxStt: boolean | null;
45+
hangupReason: string | null;
46+
isBlocked: boolean;
47+
}) => ({
48+
id: call.id,
49+
direction: call.direction,
50+
status: call.status,
51+
localPhoneNumber: call.localPhoneNumber,
52+
remotePhoneNumber: call.remotePhoneNumber,
53+
clientWebsocketUrl: call.clientWebsocketUrl,
54+
useInkboxTts: call.useInkboxTts,
55+
useInkboxStt: call.useInkboxStt,
56+
hangupReason: call.hangupReason,
57+
isBlocked: call.isBlocked,
58+
});
59+
3560
function driverState(): DriverState {
3661
return JSON.parse(readFileSync(STATE_FILE, "utf-8"));
3762
}
@@ -80,7 +105,29 @@ describe.skipIf(!LIVE || !REAL_MODEL)("live voice", () => {
80105
fromNumber: st.number,
81106
clientWebsocketUrl: st.ws_url,
82107
});
83-
const agentSaid = await waitTwoWayCall(remote, call.id, VOICE_TIMEOUT_MS);
108+
console.info(`inbound call placed: ${JSON.stringify(callSummary(call))}`);
109+
let agentSaid: string;
110+
try {
111+
agentSaid = await waitTwoWayCall(remote, call.id, VOICE_TIMEOUT_MS);
112+
} catch (error) {
113+
const [driverCall, autCalls, incomingAction, rules] = await Promise.all([
114+
remote.calls.get(call.id).catch((cause) => ({ error: String(cause) })),
115+
aut.calls.list({ limit: 10 }).catch((cause) => [{ error: String(cause) }]),
116+
aut.incomingCallAction.get().catch((cause) => ({ error: String(cause) })),
117+
aut.phoneIdentityContactRules
118+
.list((await aut.mailboxes.list())[0]?.emailAddress.split("@", 1)[0] ?? "")
119+
.catch((cause) => [{ error: String(cause) }]),
120+
]);
121+
throw new Error(
122+
`${String(error)}; inbound diagnostics=${JSON.stringify({
123+
placedCall: callSummary(call),
124+
driverCall,
125+
autCalls,
126+
incomingAction,
127+
rules,
128+
})}`,
129+
);
130+
}
84131
expect(agentSaid.length).toBeGreaterThan(0);
85132

86133
const mode = await autSpeechMode(aut, "inbound", st.number);

0 commit comments

Comments
 (0)