A small helpdesk system: an office Pixel running a patched GrapheneOS Dialer answers technician calls, records both call legs as separate channels, and a Ruby backend transcribes them through Whisper and files an AI summary against the caller. Squashed to a single commit for sharing. No credentials are included; secrets live outside the repo in /etc/helpdesk/env on the server or a gitignored .claude/env.local locally. See .claude/env.local.example for the shape. Start at README.md, then docs/architecture.md.
42 lines
1.9 KiB
Java
42 lines
1.9 KiB
Java
package com.android.dialer.helpdesk.util;
|
|
|
|
import java.io.BufferedReader;
|
|
import java.io.InputStreamReader;
|
|
|
|
/**
|
|
* Standalone off-device test for {@link CzE164}. Two modes:
|
|
* - default: assertion suite.
|
|
* - "xcheck": read raw numbers from stdin, print normalized output per line — used by the harness
|
|
* to diff against the real backend Helpdesk::Phone.e164.
|
|
*/
|
|
public class CzE164Test {
|
|
static int pass = 0, fail = 0;
|
|
static void eq(String got, String want, String d) {
|
|
if (got == null ? want == null : got.equals(want)) { pass++; System.out.println(" ok " + d); }
|
|
else { fail++; System.out.println(" FAIL " + d + " (got: " + got + ", want: " + want + ")"); }
|
|
}
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
if (args.length > 0 && args[0].equals("xcheck")) {
|
|
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
|
|
String line;
|
|
while ((line = r.readLine()) != null) {
|
|
String out = CzE164.normalize(line);
|
|
System.out.println(out == null ? "<nil>" : out);
|
|
}
|
|
return;
|
|
}
|
|
eq(CzE164.normalize("601 234 567"), "+420601234567", "bare CZ national -> +420");
|
|
eq(CzE164.normalize("00420601234567"), "+420601234567", "00420 -> +420");
|
|
eq(CzE164.normalize("+420601234567"), "+420601234567", "already E.164 passthrough");
|
|
eq(CzE164.normalize("+420 601-234-567"), "+420601234567", "strips spaces/dashes");
|
|
eq(CzE164.normalize("(602) 000 000"), "+420602000000", "strips parens");
|
|
eq(CzE164.normalize("hidden"), null, "non-numeric -> nil");
|
|
eq(CzE164.normalize(""), null, "empty -> nil");
|
|
eq(CzE164.normalize(null), null, "null -> nil");
|
|
eq(CzE164.normalize("12345"), null, "too short -> nil");
|
|
eq(CzE164.normalize("+441632960000"), "+441632960000", "foreign E.164 passthrough");
|
|
System.out.println("\n" + pass + " passed, " + fail + " failed");
|
|
System.exit(fail == 0 ? 0 : 1);
|
|
}
|
|
}
|