mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:51:23 +00:00
fix(voice-call): harden inbound policy
This commit is contained in:
19
extensions/voice-call/src/allowlist.ts
Normal file
19
extensions/voice-call/src/allowlist.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export function normalizePhoneNumber(input?: string): string {
|
||||
if (!input) {
|
||||
return "";
|
||||
}
|
||||
return input.replace(/\D/g, "");
|
||||
}
|
||||
|
||||
export function isAllowlistedCaller(
|
||||
normalizedFrom: string,
|
||||
allowFrom: string[] | undefined,
|
||||
): boolean {
|
||||
if (!normalizedFrom) {
|
||||
return false;
|
||||
}
|
||||
return (allowFrom ?? []).some((num) => {
|
||||
const normalizedAllow = normalizePhoneNumber(num);
|
||||
return normalizedAllow !== "" && normalizedAllow === normalizedFrom;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user