KOHAMI Docs
ReferenceEvents Catalog

Appel sortant — terminé

Auto-généré par scripts/gen-events-catalog.ts depuis le schéma Zod canonique dans packages/shared/src/events/widget-data-events.ts. Ne pas éditer ce fichier à la main — modifier la source puis relancer bun run gen:events.

Topic

outbound_call:ended
  • Famille : OutboundCall
  • Bloc d'origine : BLOC-09
  • Discriminant : kind: "outbound_call:ended"

Description

Publié à la résolution de l'appel (succès ou échec). outcome est mappé sur OUTBOUND_CALL_OUTCOMES.

Schéma JSON

{
  "$ref": "#/definitions/outbound-call-ended",
  "definitions": {
    "outbound-call-ended": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "outbound_call:ended"
        },
        "call_id": {
          "type": "string",
          "format": "uuid"
        },
        "ended_at": {
          "type": "string",
          "format": "date-time"
        },
        "duration_seconds": {
          "type": "integer",
          "minimum": 0
        },
        "outcome": {
          "type": "string",
          "enum": [
            "success_connected",
            "no_answer",
            "busy",
            "failed_twilio",
            "failed_killswitch",
            "failed_quota",
            "failed_cooldown",
            "failed_whitelist",
            "failed_phone_invalid",
            "failed_circuit_breaker",
            "failed_unknown",
            "confirmation_declined"
          ]
        }
      },
      "required": [
        "kind",
        "call_id",
        "ended_at",
        "duration_seconds",
        "outcome"
      ],
      "additionalProperties": false
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}

Import TypeScript

import {
  OutboundCallEndedEventSchema,
  type OutboundCallEndedEvent,
} from "@kohami/shared";

Parsing côté tablette

import { OutboundCallEndedEventSchema } from "@kohami/shared";

room.on(RoomEvent.DataReceived, (payload, _participant, _kind, topic) => {
  if (topic !== "outbound_call:ended") return;
  const raw = new TextDecoder().decode(payload);
  const event = OutboundCallEndedEventSchema.parse(JSON.parse(raw));
  // ... handle event
});