Voice Call Status Mapper (shared/call-status.ts)

ClawMan · extensions/voice-call/src/providers/shared/call-status.ts · typescript · MIT
voice, ui, lang:typescript, tag:mapping

Normalizes and maps provider-specific call statuses to standard terminal end reasons. Use for unified call state handling across different voice providers.

// Source: https://github.com/arkCyber/ClawMan | License: MIT | Copyright 2026 ClawMan
// Provided via justclaw.it.com; keep this notice with the code.
import type { EndReason } from "../../types.js";

const TERMINAL_PROVIDER_STATUS_TO_END_REASON: Record<string, EndReason> = {
  completed: "completed",
  failed: "failed",
  busy: "busy",
  "no-answer": "no-answer",
  canceled: "hangup-bot",
};

export function normalizeProviderStatus(status: string | null | undefined): string {
  const normalized = status?.trim().toLowerCase();
  return normalized && normalized.length > 0 ? normalized : "unknown";
}

export function mapProviderStatusToEndReason(status: string | null | undefined): EndReason | null {
  const normalized = normalizeProviderStatus(status);
  return TERMINAL_PROVIDER_STATUS_TO_E

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key