{
  "openapi": "3.0.3",
  "info": {
    "title": "VoipCall PBX API",
    "version": "2026-11-22",
    "description": "REST API VoipCall PBX untuk mengelola ekstensi, trunk, panggilan, dan rekaman. Setiap tenant terisolasi: semua data dibatasi otomatis ke tenant milik token.\n\n**Path** di spesifikasi ini ditulis tanpa awalan `/api`; awalan itu sudah ada di *server URL*.\n\n- Body dan respons JSON, waktu ISO-8601 UTC, ID berupa UUID.\n- **Field yang tidak dikenal ditolak** (`400`).\n- Batas laju bawaan 20 request/60 detik/IP. `GET /extensions/states`, `GET /extensions/{id}/state`, endpoint Blast, dan unduhan bertanda tangan dikecualikan.\n- Contoh respons memakai nilai fiktif.\n- **Playground:** panel \"Try it\" mengirim request langsung ke server produksi. Jangan memasukkan kredensial produksi di browser yang tidak Anda percayai."
  },
  "servers": [
    {
      "url": "https://pbx.voipcall.co.id/api",
      "description": "Produksi"
    }
  ],
  "tags": [
    {
      "name": "Autentikasi",
      "description": "Login JWT, refresh, 2FA, dan pembuatan pengguna. Access token berlaku 15 menit, refresh token 7 hari (hanya satu yang berlaku per pengguna)."
    },
    {
      "name": "Ekstensi",
      "description": "Akun SIP/WebRTC milik pengguna. Nomor ekstensi unik global."
    },
    {
      "name": "Panggilan",
      "description": "CDR, panggilan aktif, click-to-call, dan perekaman capture."
    },
    {
      "name": "Supervisor",
      "description": "Dashboard supervisor dan kehadiran agen."
    },
    {
      "name": "Pengguna",
      "description": "Pembuatan pengguna lewat `POST /auth/register`."
    },
    {
      "name": "Trunk",
      "description": "Trunk SIP, WhatsApp Business, dan SBC. Semua endpoint: `TENANT_ADMIN`."
    },
    {
      "name": "Routing",
      "description": "Rute masuk dan rute keluar. Peran `TENANT_ADMIN`."
    },
    {
      "name": "IVR",
      "description": "Menu suara interaktif. Peran `TENANT_ADMIN`."
    },
    {
      "name": "Antrean & Ring Group",
      "description": "Antrean, ring group, dan tim. Tulis: `TENANT_ADMIN`; baca: `TENANT_ADMIN`, `SUPERVISOR`."
    },
    {
      "name": "Call Flow",
      "description": "Diagram alur panggilan dengan riwayat versi. Tulis: `TENANT_ADMIN`; baca: `TENANT_ADMIN`, `SUPERVISOR`."
    },
    {
      "name": "Telepon Meja",
      "description": "IP phone dan provisioning. Peran `TENANT_ADMIN`."
    },
    {
      "name": "Media & TTS",
      "description": "Berkas suara dan Text-to-Speech. Peran `TENANT_ADMIN`."
    },
    {
      "name": "Log & Monitoring",
      "description": "Log kejadian dan sinyal SIP."
    },
    {
      "name": "Unduhan Aplikasi",
      "description": "Rilis aplikasi softphone, rekaman, dan voicemail lewat tautan bertanda tangan."
    },
    {
      "name": "Webhook Panggilan",
      "description": "Pengaturan webhook per tenant (nonaktif secara bawaan). Format pesan dan verifikasi tanda tangan ada di panduan [Webhook panggilan](/docs/webhook). Peran `TENANT_ADMIN`."
    },
    {
      "name": "Blast",
      "description": "IVR outbound: satu panggilan keluar ke satu nomor, memutar prompt, membaca DTMF, menjalankan aksi, dan melaporkan hasil lewat webhook ke `{webhookUrl}/api/ivr-events`. Lihat panduan [API Blast](/docs/blast)."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Inti",
      "tags": [
        "Autentikasi",
        "Ekstensi",
        "Panggilan",
        "Supervisor",
        "Pengguna"
      ]
    },
    {
      "name": "Telefoni",
      "tags": [
        "Trunk",
        "Routing",
        "IVR",
        "Antrean & Ring Group",
        "Call Flow",
        "Telepon Meja",
        "Media & TTS"
      ]
    },
    {
      "name": "Integrasi",
      "tags": [
        "Webhook Panggilan",
        "Blast"
      ]
    },
    {
      "name": "Administrasi",
      "tags": [
        "Log & Monitoring",
        "Unduhan Aplikasi"
      ]
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/auth/login": {
      "post": {
        "tags": [
          "Autentikasi"
        ],
        "summary": "Login",
        "description": "Peran: `PUBLIC`.\n\nBatas 5 kali per menit per IP.",
        "x-roles": [
          "PUBLIC"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tenantSlug": {
                    "type": "string",
                    "description": "Email unik per tenant, bukan global."
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string"
                  },
                  "totpCode": {
                    "type": "string",
                    "pattern": "^\\d{6}$",
                    "description": "Wajib bila 2FA aktif. Tanpa itu: `401 \"Kode 2FA diperlukan\"`."
                  }
                },
                "required": [
                  "tenantSlug",
                  "email",
                  "password"
                ],
                "additionalProperties": false
              },
              "example": {
                "tenantSlug": "demo",
                "email": "admin@demo.id",
                "password": "********"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenPair"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": []
      }
    },
    "/auth/refresh": {
      "post": {
        "tags": [
          "Autentikasi"
        ],
        "summary": "Perbarui token",
        "description": "Peran: `PUBLIC`.\n\nBatas 10 kali per menit per IP. Refresh token lama menjadi tidak berlaku.",
        "x-roles": [
          "PUBLIC"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "refreshToken": {
                    "type": "string"
                  }
                },
                "required": [
                  "refreshToken"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenPair"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": []
      }
    },
    "/auth/logout": {
      "post": {
        "tags": [
          "Autentikasi"
        ],
        "summary": "Logout",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`, `USER`.\n\nTanpa body. Semua peran.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "responses": {
          "204": {
            "description": "Tanpa isi."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/auth/register": {
      "post": {
        "tags": [
          "Autentikasi"
        ],
        "summary": "Buat pengguna",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tenantId": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Hanya berarti untuk `SUPER_ADMIN`."
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 12
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "SUPER_ADMIN",
                      "TENANT_ADMIN",
                      "SUPERVISOR",
                      "USER"
                    ]
                  }
                },
                "required": [
                  "email",
                  "password"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/auth/2fa/generate": {
      "post": {
        "tags": [
          "Autentikasi"
        ],
        "summary": "Buat rahasia TOTP",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`, `USER`.\n\nMembuat rahasia TOTP dan data QR untuk pengguna saat ini. Semua peran.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/auth/2fa/verify": {
      "post": {
        "tags": [
          "Autentikasi"
        ],
        "summary": "Aktifkan 2FA",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`, `USER`.\n\nMengaktifkan 2FA. Semua peran.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "totpCode": {
                    "type": "string",
                    "pattern": "^\\d{6}$"
                  }
                },
                "required": [
                  "totpCode"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions": {
      "post": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Buat ekstensi",
        "description": "Peran: `TENANT_ADMIN`.\n\nRespons memuat `sipPassword` plaintext **hanya di respons ini**. `asteriskSynced: false` berarti panggil `POST /extensions/{id}/resync`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "string",
                    "pattern": "^\\d{2,10}$",
                    "description": "2–10 digit angka."
                  },
                  "displayName": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "number",
                  "displayName"
                ],
                "additionalProperties": false
              },
              "example": {
                "number": "7101",
                "displayName": "POC Agent 7101"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Extension"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`EXTENSION_LIMIT_REACHED` bila batas ekstensi tenant tercapai."
          },
          "409": {
            "description": "Nomor ekstensi sudah dipakai."
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Daftar ekstensi",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`, `USER`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/quota": {
      "get": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Kuota ekstensi",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`, `USER`.\n\n`max` bernilai `null` bila tanpa batas.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "used": {
                      "type": "integer"
                    },
                    "max": {
                      "type": "integer",
                      "nullable": true
                    }
                  },
                  "additionalProperties": false
                },
                "example": {
                  "used": 12,
                  "max": 20
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/states": {
      "get": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Status semua ekstensi",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`, `USER`.\n\nTanpa batas laju.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExtensionState"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}": {
      "get": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Detail ekstensi",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`, `USER`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Extension"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Ubah ekstensi",
        "description": "Peran: `TENANT_ADMIN`.\n\nSemua field opsional. Penelepon mendengar prompt `unavailable` (suara bawaan semua tenant) bila pengalihan mati dan status Away/DND/tidak terdaftar.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string",
                    "minLength": 1
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "nullable": true
                  },
                  "sipAuthId": {
                    "type": "string",
                    "minLength": 4
                  },
                  "sipPassword": {
                    "type": "string",
                    "minLength": 8
                  },
                  "recordingMode": {
                    "type": "string",
                    "enum": [
                      "ALL",
                      "EXTERNAL",
                      "NONE"
                    ],
                    "description": "Bawaan `NONE`; berlaku panggilan berikutnya."
                  },
                  "codecs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "uniqueItems": true,
                    "description": "Urutan = prioritas."
                  },
                  "timezone": {
                    "type": "string",
                    "description": "Salah satu ID zona waktu yang didukung."
                  },
                  "ringtone": {
                    "type": "string",
                    "description": "Salah satu nada dering yang didukung."
                  },
                  "ringTimeoutSec": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 120
                  },
                  "outboundCallerId": {
                    "type": "string",
                    "pattern": "^\\+?\\d{4,20}$",
                    "nullable": true
                  },
                  "presenceStatus": {
                    "type": "string",
                    "enum": [
                      "AVAILABLE",
                      "AWAY",
                      "DND"
                    ]
                  },
                  "doNotDisturb": {
                    "type": "boolean"
                  },
                  "voicemailEnabled": {
                    "type": "boolean"
                  },
                  "hideFromDirectory": {
                    "type": "boolean"
                  },
                  "allowRecordingAccess": {
                    "type": "boolean",
                    "description": "Akses rekaman di aplikasi softphone."
                  },
                  "recordingAccessScope": {
                    "type": "string",
                    "enum": [
                      "OWN",
                      "TENANT"
                    ]
                  },
                  "ringGroupIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "dids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "trunkDidIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "maxItems": 100,
                    "uniqueItems": true
                  },
                  "forwardAlways": {
                    "type": "string",
                    "nullable": true
                  },
                  "forwardBusy": {
                    "type": "string",
                    "nullable": true
                  },
                  "forwardNoAnswer": {
                    "type": "string",
                    "nullable": true
                  },
                  "awayForwardAlways": {
                    "type": "string",
                    "nullable": true
                  },
                  "awayForwardBusy": {
                    "type": "string",
                    "nullable": true
                  },
                  "awayForwardNoAnswer": {
                    "type": "string",
                    "nullable": true
                  },
                  "dndForwardAlways": {
                    "type": "string",
                    "nullable": true
                  },
                  "dndForwardBusy": {
                    "type": "string",
                    "nullable": true
                  },
                  "dndForwardNoAnswer": {
                    "type": "string",
                    "nullable": true
                  },
                  "blfKeys": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "type": "string",
                          "pattern": "^\\d{2,8}$"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 32
                        }
                      },
                      "required": [
                        "number",
                        "label"
                      ],
                      "additionalProperties": false
                    },
                    "description": "Jumlah dibatasi.",
                    "nullable": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Hapus ekstensi",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Tanpa isi."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}/activate": {
      "patch": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Aktifkan ekstensi",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}/deactivate": {
      "patch": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Nonaktifkan ekstensi",
        "description": "Peran: `TENANT_ADMIN`.\n\nMencabut semua perangkat aplikasi dan melepas telepon meja terkait. Ekstensi tidak dapat registrasi atau melakukan panggilan. Perilaku terhadap panggilan yang sedang berlangsung belum diuji; jangan dipakai untuk memutus panggilan.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}/resync": {
      "post": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Sinkron ulang ekstensi",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}/state": {
      "get": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Status satu ekstensi",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`, `USER`.\n\nTanpa batas laju. `online` = ada contact terdaftar.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExtensionState"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}/credentials": {
      "get": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Kredensial SIP",
        "description": "Peran: `TENANT_ADMIN`.\n\n**Sensitif**: membuka password plaintext. Jangan di-log.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "number": {
                      "type": "string"
                    },
                    "sipAuthId": {
                      "type": "string"
                    },
                    "sipPassword": {
                      "type": "string"
                    },
                    "transport": {
                      "type": "string"
                    },
                    "server": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}/app-devices": {
      "get": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Daftar perangkat aplikasi",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}/app-devices/{deviceId}": {
      "delete": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Cabut perangkat aplikasi",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deviceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/extensions/{id}/softphone-link": {
      "post": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Tautan login softphone",
        "description": "Peran: `TENANT_ADMIN`.\n\nTautan HTTPS berumur 15 menit. Ekstensi nonaktif ditolak `400`. Tautan dibuka lewat `GET /softphone-links/{id}?e=&s=`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/softphone-links/{id}": {
      "get": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Buka tautan softphone",
        "description": "Peran: `PUBLIC`.\n\nTautan bertanda tangan.",
        "x-roles": [
          "PUBLIC"
        ],
        "parameters": [
          {
            "name": "e",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Kedaluwarsa (epoch detik)"
          },
          {
            "name": "s",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Tanda tangan"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "number": {
                      "type": "string"
                    },
                    "authId": {
                      "type": "string"
                    },
                    "password": {
                      "type": "string"
                    },
                    "displayName": {
                      "type": "string"
                    },
                    "server": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": []
      }
    },
    "/extensions/import": {
      "post": {
        "tags": [
          "Ekstensi"
        ],
        "summary": "Impor ekstensi (CSV)",
        "description": "Peran: `TENANT_ADMIN`.\n\nCSV maks 100 KB.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "CSV"
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-logs": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Daftar CDR",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.\n\nCDR hanya dibuat saat panggilan selesai. Jangan polling lebih cepat dari sekali per 3 detik; gunakan webhook.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "direction",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "INBOUND_TRUNK",
                "OUTBOUND_TRUNK",
                "EXTENSION_TO_EXTENSION"
              ]
            }
          },
          {
            "name": "disposition",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ANSWERED",
                "NO_ANSWER",
                "BUSY",
                "FAILED",
                "CANCELED"
              ]
            }
          },
          {
            "name": "callerNumber",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 40
            },
            "description": "Cocok **persis**, tanpa normalisasi (`0812…` ≠ `62812…`)."
          },
          {
            "name": "calleeNumber",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 40
            },
            "description": "Cocok **persis**, tanpa normalisasi."
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Awal rentang `startedAt`"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Akhir rentang `startedAt`"
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CallLog"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "page": {
                      "type": "integer"
                    },
                    "pageSize": {
                      "type": "integer"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-logs/{id}": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Detail CDR",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallLog"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-logs/{id}/recording": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Unduh rekaman",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.\n\nBerkas `audio/wav`. Setiap unduhan dicatat di audit log. Panggilan yang tidak tersambung tidak punya rekaman.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-logs/statistics/extensions": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Statistik per ekstensi",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/dashboard/summary": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Ringkasan dashboard",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/dashboard/active-calls": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Panggilan aktif",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.\n\nTerkena batas laju. Dua kaki panggilan dalam satu sesi dihitung satu panggilan.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ActiveCall"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/dashboard/active-calls/{rootChannelId}/hangup": {
      "post": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Putus panggilan aktif",
        "description": "Peran: `TENANT_ADMIN` saja.\n\n`rootChannelId` hanya karakter `A-Z a-z 0-9 . _ : @ -`, maks 128. Untuk panggilan yang masih berdering, pakai baris penelepon. Dicatat di audit log (`call.hangup`).",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "rootChannelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:@-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "hungUp": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "additionalProperties": false
                },
                "example": {
                  "ok": true,
                  "hungUp": [
                    "1795076943.1214",
                    "1795076943.1215"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "description": "Tidak ada, sudah selesai, atau milik tenant lain (sengaja dijawab sama)."
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          },
          "502": {
            "description": "Panggilan tidak dapat diakhiri. Coba lagi atau hubungi support."
          },
          "503": {
            "description": "Layanan sementara tidak tersedia. Coba lagi beberapa saat."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/calls/originate": {
      "post": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Click-to-call (agen-dulu)",
        "description": "Peran: `TENANT_ADMIN`.\n\nPBX menelepon agen, lalu setelah diangkat menghubungi pelanggan. Bila agen tidak mengangkat, `call.originate_failed` dikirim lewat webhook dan tidak ada CDR.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentExtension": {
                    "type": "string",
                    "pattern": "^\\d{2,10}$"
                  },
                  "customerNumber": {
                    "type": "string",
                    "pattern": "^\\+?\\d{3,20}$"
                  },
                  "agentRingTimeoutSec": {
                    "type": "integer",
                    "minimum": 10,
                    "maximum": 60
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 64,
                    "pattern": "^[A-Za-z0-9._:-]+$"
                  }
                },
                "required": [
                  "agentExtension",
                  "customerNumber"
                ],
                "additionalProperties": false
              },
              "example": {
                "agentExtension": "7101",
                "customerNumber": "6281234567890",
                "reference": "crm-42"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "callId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                },
                "example": {
                  "callId": "c2c-…",
                  "status": "agent_ringing"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/calls/originate/{callId}": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Status originate",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-capture/start": {
      "post": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Mulai sesi capture",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-capture/{id}/stop": {
      "post": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Hentikan capture",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-capture/current": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Sesi capture berjalan",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`.\n\nSesi yang sedang berjalan (bila ada).",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-capture/{id}": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Detail capture",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-capture/{id}/download": {
      "get": {
        "tags": [
          "Panggilan"
        ],
        "summary": "Unduh capture",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/supervisor-dashboard/kpis": {
      "get": {
        "tags": [
          "Supervisor"
        ],
        "summary": "KPI",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/supervisor-dashboard/queue-stats": {
      "get": {
        "tags": [
          "Supervisor"
        ],
        "summary": "Statistik antrean",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/supervisor-dashboard/call-volume": {
      "get": {
        "tags": [
          "Supervisor"
        ],
        "summary": "Volume panggilan",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/agent-presence": {
      "get": {
        "tags": [
          "Supervisor"
        ],
        "summary": "Status semua agen",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "teamId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/agent-presence/{extensionId}/status": {
      "patch": {
        "tags": [
          "Supervisor"
        ],
        "summary": "Ubah status agen",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "extensionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "AVAILABLE",
                      "ON_BREAK"
                    ]
                  }
                },
                "required": [
                  "status"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/users": {
      "get": {
        "tags": [
          "Pengguna"
        ],
        "summary": "Daftar pengguna",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/users/{id}": {
      "get": {
        "tags": [
          "Pengguna"
        ],
        "summary": "Detail pengguna",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/users/{id}/deactivate": {
      "patch": {
        "tags": [
          "Pengguna"
        ],
        "summary": "Nonaktifkan pengguna",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks": {
      "post": {
        "tags": [
          "Trunk"
        ],
        "summary": "Buat trunk SIP",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "host": {
                    "type": "string",
                    "maxLength": 253
                  },
                  "port": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "username": {
                    "type": "string"
                  },
                  "secret": {
                    "type": "string",
                    "minLength": 8
                  },
                  "maxChannels": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "transport": {
                    "type": "string",
                    "enum": [
                      "TLS",
                      "UDP",
                      "TCP"
                    ]
                  },
                  "registrationMode": {
                    "type": "string",
                    "enum": [
                      "REGISTER",
                      "PEER",
                      "SERVER"
                    ]
                  },
                  "costPerMinute": {
                    "type": "number",
                    "minimum": 0
                  },
                  "billingIncrementSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 60,
                    "default": 60,
                    "description": "Bawaan 60 (per menit); isi 1 untuk penagihan per detik."
                  },
                  "dids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 100
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "TRUNK",
                      "BRIDGE"
                    ],
                    "description": "Hanya saat buat."
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contoh respons hanya memuat field yang tercantum di dokumen (field request + `id`) dengan nilai fiktif; field lain dan bentuk final mengikuti respons API yang sebenarnya. `secret` tidak ditampilkan di contoh.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "host": {
                      "type": "string",
                      "maxLength": 253
                    },
                    "port": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 65535
                    },
                    "username": {
                      "type": "string"
                    },
                    "maxChannels": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "transport": {
                      "type": "string",
                      "enum": [
                        "TLS",
                        "UDP",
                        "TCP"
                      ]
                    },
                    "registrationMode": {
                      "type": "string",
                      "enum": [
                        "REGISTER",
                        "PEER",
                        "SERVER"
                      ]
                    },
                    "costPerMinute": {
                      "type": "number",
                      "minimum": 0
                    },
                    "billingIncrementSeconds": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 60,
                      "default": 60,
                      "description": "Bawaan 60 (per menit); isi 1 untuk penagihan per detik."
                    },
                    "dids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "maxItems": 100
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "TRUNK",
                        "BRIDGE"
                      ]
                    }
                  }
                },
                "example": {
                  "id": "3f6c1b9a-52d7-4e0a-8a41-9c1d2e7b6a10",
                  "name": "Trunk Utama",
                  "kind": "TRUNK",
                  "host": "sip.provider.example",
                  "port": 5061,
                  "username": "voipcall01",
                  "maxChannels": 30,
                  "transport": "TLS",
                  "registrationMode": "REGISTER",
                  "costPerMinute": 250,
                  "billingIncrementSeconds": 1,
                  "dids": [
                    "6221555000"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Trunk"
        ],
        "summary": "Daftar trunk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks/whatsapp": {
      "post": {
        "tags": [
          "Trunk"
        ],
        "summary": "Buat trunk WhatsApp Business",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "phoneNumber": {
                    "type": "string",
                    "description": "E.164, mis. `+6281234567890`."
                  },
                  "sipDomain": {
                    "type": "string",
                    "description": "Hostname yang sama dengan pengaturan Meta."
                  },
                  "secret": {
                    "type": "string",
                    "minLength": 8
                  },
                  "maxChannels": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "costPerMinute": {
                    "type": "number",
                    "minimum": 0
                  },
                  "billingIncrementSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 60,
                    "default": 60,
                    "description": "Bawaan 60 (per menit); isi 1 untuk penagihan per detik."
                  },
                  "dids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 100
                  }
                },
                "required": [
                  "name",
                  "phoneNumber",
                  "sipDomain",
                  "secret"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contoh respons hanya memuat field yang tercantum di dokumen (field request + `id`) dengan nilai fiktif; field lain dan bentuk final mengikuti respons API yang sebenarnya. `secret` tidak ditampilkan di contoh.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "host": {
                      "type": "string",
                      "maxLength": 253
                    },
                    "port": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 65535
                    },
                    "username": {
                      "type": "string"
                    },
                    "maxChannels": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "transport": {
                      "type": "string",
                      "enum": [
                        "TLS",
                        "UDP",
                        "TCP"
                      ]
                    },
                    "registrationMode": {
                      "type": "string",
                      "enum": [
                        "REGISTER",
                        "PEER",
                        "SERVER"
                      ]
                    },
                    "costPerMinute": {
                      "type": "number",
                      "minimum": 0
                    },
                    "billingIncrementSeconds": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 60,
                      "default": 60,
                      "description": "Bawaan 60 (per menit); isi 1 untuk penagihan per detik."
                    },
                    "dids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "maxItems": 100
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "TRUNK",
                        "BRIDGE"
                      ]
                    }
                  }
                },
                "example": {
                  "id": "8b2e4d10-7a3c-4f55-b0e1-6d9a1c2f3e44",
                  "name": "WhatsApp Business",
                  "phoneNumber": "+6281234567890",
                  "sipDomain": "wa.example.co.id",
                  "maxChannels": 10,
                  "costPerMinute": 300,
                  "billingIncrementSeconds": 60,
                  "dids": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks/available-dids": {
      "get": {
        "tags": [
          "Trunk"
        ],
        "summary": "DID yang tersedia",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks/sip-server": {
      "get": {
        "tags": [
          "Trunk"
        ],
        "summary": "Info server SIP PBX",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks/sbcs": {
      "get": {
        "tags": [
          "Trunk"
        ],
        "summary": "Daftar SBC",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "post": {
        "tags": [
          "Trunk"
        ],
        "summary": "Buat SBC",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contoh respons hanya memuat field yang tercantum di dokumen (field request + `id`) dengan nilai fiktif; field lain dan bentuk final mengikuti respons API yang sebenarnya. `secret` tidak ditampilkan di contoh.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "5d0b7c2e-91a4-4b6f-8c3d-2e7f1a9b4c60",
                  "name": "SBC Jakarta"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks/sbcs/{sbcId}": {
      "patch": {
        "tags": [
          "Trunk"
        ],
        "summary": "Ubah SBC",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "sbcId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Trunk"
        ],
        "summary": "Hapus SBC",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "sbcId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Tanpa isi."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks/sbcs/{sbcId}/credentials": {
      "get": {
        "tags": [
          "Trunk"
        ],
        "summary": "Kredensial SBC",
        "description": "Peran: `TENANT_ADMIN`.\n\n**Sensitif.**",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "sbcId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks/{id}": {
      "get": {
        "tags": [
          "Trunk"
        ],
        "summary": "Detail trunk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Contoh respons hanya memuat field yang tercantum di dokumen (field request + `id`) dengan nilai fiktif; field lain dan bentuk final mengikuti respons API yang sebenarnya. `secret` tidak ditampilkan di contoh.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "host": {
                      "type": "string",
                      "maxLength": 253
                    },
                    "port": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 65535
                    },
                    "username": {
                      "type": "string"
                    },
                    "maxChannels": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "transport": {
                      "type": "string",
                      "enum": [
                        "TLS",
                        "UDP",
                        "TCP"
                      ]
                    },
                    "registrationMode": {
                      "type": "string",
                      "enum": [
                        "REGISTER",
                        "PEER",
                        "SERVER"
                      ]
                    },
                    "costPerMinute": {
                      "type": "number",
                      "minimum": 0
                    },
                    "billingIncrementSeconds": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 60,
                      "default": 60,
                      "description": "Bawaan 60 (per menit); isi 1 untuk penagihan per detik."
                    },
                    "dids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "maxItems": 100
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "TRUNK",
                        "BRIDGE"
                      ]
                    }
                  }
                },
                "example": {
                  "id": "3f6c1b9a-52d7-4e0a-8a41-9c1d2e7b6a10",
                  "name": "Trunk Utama",
                  "kind": "TRUNK",
                  "host": "sip.provider.example",
                  "port": 5061,
                  "username": "voipcall01",
                  "maxChannels": 30,
                  "transport": "TLS",
                  "registrationMode": "REGISTER",
                  "costPerMinute": 250,
                  "billingIncrementSeconds": 1,
                  "dids": [
                    "6221555000"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Trunk"
        ],
        "summary": "Ubah trunk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "host": {
                    "type": "string",
                    "maxLength": 253
                  },
                  "port": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "username": {
                    "type": "string"
                  },
                  "secret": {
                    "type": "string",
                    "minLength": 8
                  },
                  "maxChannels": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "transport": {
                    "type": "string",
                    "enum": [
                      "TLS",
                      "UDP",
                      "TCP"
                    ]
                  },
                  "registrationMode": {
                    "type": "string",
                    "enum": [
                      "REGISTER",
                      "PEER",
                      "SERVER"
                    ]
                  },
                  "costPerMinute": {
                    "type": "number",
                    "minimum": 0
                  },
                  "billingIncrementSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 60,
                    "default": 60,
                    "description": "Bawaan 60 (per menit); isi 1 untuk penagihan per detik."
                  },
                  "dids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 100
                  },
                  "sipDomain": {
                    "type": "string",
                    "maxLength": 253
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contoh respons hanya memuat field yang tercantum di dokumen (field request + `id`) dengan nilai fiktif; field lain dan bentuk final mengikuti respons API yang sebenarnya. `secret` tidak ditampilkan di contoh.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "name": {
                      "type": "string"
                    },
                    "host": {
                      "type": "string",
                      "maxLength": 253
                    },
                    "port": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 65535
                    },
                    "username": {
                      "type": "string"
                    },
                    "maxChannels": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "transport": {
                      "type": "string",
                      "enum": [
                        "TLS",
                        "UDP",
                        "TCP"
                      ]
                    },
                    "registrationMode": {
                      "type": "string",
                      "enum": [
                        "REGISTER",
                        "PEER",
                        "SERVER"
                      ]
                    },
                    "costPerMinute": {
                      "type": "number",
                      "minimum": 0
                    },
                    "billingIncrementSeconds": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 60,
                      "default": 60,
                      "description": "Bawaan 60 (per menit); isi 1 untuk penagihan per detik."
                    },
                    "dids": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "maxItems": 100
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "TRUNK",
                        "BRIDGE"
                      ]
                    }
                  }
                },
                "example": {
                  "id": "3f6c1b9a-52d7-4e0a-8a41-9c1d2e7b6a10",
                  "name": "Trunk Utama",
                  "kind": "TRUNK",
                  "host": "sip.provider.example",
                  "port": 5061,
                  "username": "voipcall01",
                  "maxChannels": 50,
                  "transport": "TLS",
                  "registrationMode": "REGISTER",
                  "costPerMinute": 250,
                  "billingIncrementSeconds": 1,
                  "dids": [
                    "6221555000"
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Trunk"
        ],
        "summary": "Hapus trunk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Tanpa isi."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/trunks/{id}/registration-status": {
      "get": {
        "tags": [
          "Trunk"
        ],
        "summary": "Status registrasi trunk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/inbound-routes": {
      "post": {
        "tags": [
          "Routing"
        ],
        "summary": "Buat rute masuk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "trunkId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "didPattern": {
                    "type": "string",
                    "description": "Pola nomor tujuan.",
                    "nullable": true
                  },
                  "priority": {
                    "type": "integer"
                  },
                  "destinationType": {
                    "type": "string",
                    "enum": [
                      "CALL_FLOW",
                      "QUEUE",
                      "IVR",
                      "EXTENSION",
                      "RING_GROUP"
                    ]
                  },
                  "callFlowId": {
                    "type": "string"
                  },
                  "queueId": {
                    "type": "string"
                  },
                  "ivrId": {
                    "type": "string"
                  },
                  "extensionId": {
                    "type": "string"
                  },
                  "ringGroupId": {
                    "type": "string"
                  },
                  "isActive": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "trunkId",
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Routing"
        ],
        "summary": "Daftar rute masuk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/inbound-routes/{id}": {
      "get": {
        "tags": [
          "Routing"
        ],
        "summary": "Detail rute masuk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Routing"
        ],
        "summary": "Ubah rute masuk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "trunkId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "didPattern": {
                    "type": "string",
                    "description": "Pola nomor tujuan.",
                    "nullable": true
                  },
                  "priority": {
                    "type": "integer"
                  },
                  "destinationType": {
                    "type": "string",
                    "enum": [
                      "CALL_FLOW",
                      "QUEUE",
                      "IVR",
                      "EXTENSION",
                      "RING_GROUP"
                    ]
                  },
                  "callFlowId": {
                    "type": "string"
                  },
                  "queueId": {
                    "type": "string"
                  },
                  "ivrId": {
                    "type": "string"
                  },
                  "extensionId": {
                    "type": "string"
                  },
                  "ringGroupId": {
                    "type": "string"
                  },
                  "isActive": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "trunkId",
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Routing"
        ],
        "summary": "Hapus rute masuk",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/outbound-routes": {
      "post": {
        "tags": [
          "Routing"
        ],
        "summary": "Buat rute keluar",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "prefixes": {
                    "type": "string",
                    "description": "Awalan nomor yang cocok."
                  },
                  "priority": {
                    "type": "integer"
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "trunks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "trunkId": {
                          "type": "string"
                        },
                        "stripDigits": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 30
                        },
                        "prependDigits": {
                          "type": "string",
                          "pattern": "^\\+?\\d{1,20}$"
                        },
                        "outboundCallerId": {
                          "type": "string",
                          "pattern": "^\\d{4,20}$"
                        }
                      },
                      "required": [
                        "trunkId"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 20
                  },
                  "extensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 500,
                    "uniqueItems": true
                  },
                  "ranges": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string",
                          "pattern": "^\\d{2,10}$"
                        },
                        "to": {
                          "type": "string",
                          "pattern": "^\\d{2,10}$"
                        }
                      },
                      "required": [
                        "from",
                        "to"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 50
                  },
                  "teamIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 100,
                    "uniqueItems": true
                  }
                },
                "required": [
                  "name",
                  "trunks"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Routing"
        ],
        "summary": "Daftar rute keluar",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/outbound-routes/{id}": {
      "get": {
        "tags": [
          "Routing"
        ],
        "summary": "Detail rute keluar",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Routing"
        ],
        "summary": "Ubah rute keluar",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "prefixes": {
                    "type": "string",
                    "description": "Awalan nomor yang cocok."
                  },
                  "priority": {
                    "type": "integer"
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "trunks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "trunkId": {
                          "type": "string"
                        },
                        "stripDigits": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 30
                        },
                        "prependDigits": {
                          "type": "string",
                          "pattern": "^\\+?\\d{1,20}$"
                        },
                        "outboundCallerId": {
                          "type": "string",
                          "pattern": "^\\d{4,20}$"
                        }
                      },
                      "required": [
                        "trunkId"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 20
                  },
                  "extensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 500,
                    "uniqueItems": true
                  },
                  "ranges": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string",
                          "pattern": "^\\d{2,10}$"
                        },
                        "to": {
                          "type": "string",
                          "pattern": "^\\d{2,10}$"
                        }
                      },
                      "required": [
                        "from",
                        "to"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 50
                  },
                  "teamIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 100,
                    "uniqueItems": true
                  }
                },
                "required": [
                  "name",
                  "trunks"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Routing"
        ],
        "summary": "Hapus rute keluar",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/ivrs": {
      "post": {
        "tags": [
          "IVR"
        ],
        "summary": "Buat IVR",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "greetingMedia": {
                    "type": "string",
                    "description": "Nama berkas sapaan."
                  },
                  "timeoutSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 60
                  },
                  "maxRetries": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 5
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "virtualNumber": {
                    "type": "string",
                    "pattern": "^\\d{2,10}$"
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "DIGIT",
                            "TIMEOUT",
                            "INVALID"
                          ]
                        },
                        "digit": {
                          "type": "string"
                        },
                        "destinationType": {
                          "type": "string",
                          "enum": [
                            "EXTENSION",
                            "QUEUE",
                            "VOICEMAIL",
                            "HANGUP"
                          ]
                        },
                        "extensionId": {
                          "type": "string"
                        },
                        "queueId": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "minItems": 1
                  },
                  "sequence": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "AUDIO",
                            "TTS",
                            "SILENCE"
                          ]
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "file": {
                          "type": "string",
                          "maxLength": 255
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "format": {
                          "type": "string",
                          "enum": [
                            "WAV",
                            "WAV16",
                            "ALAW",
                            "ULAW",
                            "SLN"
                          ]
                        },
                        "voice": {
                          "type": "string"
                        },
                        "speed": {
                          "type": "number",
                          "minimum": 0.5,
                          "maximum": 2
                        },
                        "fallback": {
                          "type": "string"
                        },
                        "ms": {
                          "type": "integer",
                          "minimum": 100,
                          "maximum": 5000
                        }
                      },
                      "additionalProperties": false
                    },
                    "maxItems": 50
                  },
                  "seqInterruptible": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "options"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "IVR"
        ],
        "summary": "Daftar IVR",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/ivrs/{id}": {
      "get": {
        "tags": [
          "IVR"
        ],
        "summary": "Detail IVR",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "IVR"
        ],
        "summary": "Ubah IVR",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "greetingMedia": {
                    "type": "string",
                    "description": "Nama berkas sapaan."
                  },
                  "timeoutSeconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 60
                  },
                  "maxRetries": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 5
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "virtualNumber": {
                    "type": "string",
                    "pattern": "^\\d{2,10}$"
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "DIGIT",
                            "TIMEOUT",
                            "INVALID"
                          ]
                        },
                        "digit": {
                          "type": "string"
                        },
                        "destinationType": {
                          "type": "string",
                          "enum": [
                            "EXTENSION",
                            "QUEUE",
                            "VOICEMAIL",
                            "HANGUP"
                          ]
                        },
                        "extensionId": {
                          "type": "string"
                        },
                        "queueId": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "minItems": 1
                  },
                  "sequence": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "AUDIO",
                            "TTS",
                            "SILENCE"
                          ]
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "file": {
                          "type": "string",
                          "maxLength": 255
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 1000
                        },
                        "format": {
                          "type": "string",
                          "enum": [
                            "WAV",
                            "WAV16",
                            "ALAW",
                            "ULAW",
                            "SLN"
                          ]
                        },
                        "voice": {
                          "type": "string"
                        },
                        "speed": {
                          "type": "number",
                          "minimum": 0.5,
                          "maximum": 2
                        },
                        "fallback": {
                          "type": "string"
                        },
                        "ms": {
                          "type": "integer",
                          "minimum": 100,
                          "maximum": 5000
                        }
                      },
                      "additionalProperties": false
                    },
                    "maxItems": 50
                  },
                  "seqInterruptible": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "options"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "IVR"
        ],
        "summary": "Hapus IVR",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/queues": {
      "post": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Buat antrean",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "strategy": {
                    "type": "string",
                    "enum": [
                      "ROUND_ROBIN",
                      "FEWEST_CALLS",
                      "RANDOM"
                    ]
                  },
                  "maxWaitSeconds": {
                    "type": "integer",
                    "minimum": 10,
                    "maximum": 600
                  },
                  "wrapUpSeconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 600
                  },
                  "virtualNumber": {
                    "type": "string",
                    "pattern": "^\\d{2,10}$"
                  },
                  "memberExtensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "teamIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "name",
                  "memberExtensionIds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Daftar antrean",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/queues/{id}": {
      "get": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Detail antrean",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Ubah antrean",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "strategy": {
                    "type": "string",
                    "enum": [
                      "ROUND_ROBIN",
                      "FEWEST_CALLS",
                      "RANDOM"
                    ]
                  },
                  "maxWaitSeconds": {
                    "type": "integer",
                    "minimum": 10,
                    "maximum": 600
                  },
                  "wrapUpSeconds": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 600
                  },
                  "virtualNumber": {
                    "type": "string",
                    "pattern": "^\\d{2,10}$"
                  },
                  "memberExtensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "teamIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "name",
                  "memberExtensionIds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Hapus antrean",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/ring-groups": {
      "post": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Buat ring group",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "strategy": {
                    "type": "string",
                    "enum": [
                      "SIMULTANEOUS",
                      "SEQUENTIAL"
                    ]
                  },
                  "ringTimeoutSeconds": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 120
                  },
                  "virtualNumber": {
                    "type": "string",
                    "pattern": "^\\d{2,10}$"
                  },
                  "memberExtensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1
                  }
                },
                "required": [
                  "name",
                  "memberExtensionIds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Daftar ring group",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/ring-groups/{id}": {
      "get": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Detail ring group",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Ubah ring group",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "strategy": {
                    "type": "string",
                    "enum": [
                      "SIMULTANEOUS",
                      "SEQUENTIAL"
                    ]
                  },
                  "ringTimeoutSeconds": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 120
                  },
                  "virtualNumber": {
                    "type": "string",
                    "pattern": "^\\d{2,10}$"
                  },
                  "memberExtensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1
                  }
                },
                "required": [
                  "name",
                  "memberExtensionIds"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Hapus ring group",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/teams": {
      "post": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Buat tim",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "memberExtensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Daftar tim",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/teams/{id}": {
      "get": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Detail tim",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Ubah tim",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "memberExtensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Antrean & Ring Group"
        ],
        "summary": "Hapus tim",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-flows": {
      "post": {
        "tags": [
          "Call Flow"
        ],
        "summary": "Buat call flow",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "definition": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Objek bebas (diagram alur), divalidasi di sisi server."
                  }
                },
                "required": [
                  "name",
                  "definition"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Call Flow"
        ],
        "summary": "Daftar call flow",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-flows/{id}": {
      "get": {
        "tags": [
          "Call Flow"
        ],
        "summary": "Detail call flow",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Call Flow"
        ],
        "summary": "Simpan versi baru",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "definition": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Objek bebas (diagram alur)."
                  }
                },
                "required": [
                  "definition"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Call Flow"
        ],
        "summary": "Hapus call flow",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-flows/{id}/versions": {
      "get": {
        "tags": [
          "Call Flow"
        ],
        "summary": "Riwayat versi",
        "description": "Peran: `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-flows/{id}/rollback/{version}": {
      "post": {
        "tags": [
          "Call Flow"
        ],
        "summary": "Kembali ke versi tertentu",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/phones": {
      "post": {
        "tags": [
          "Telepon Meja"
        ],
        "summary": "Daftarkan telepon",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "macAddress": {
                    "type": "string",
                    "description": "12 heksadesimal (`:`, `-`, `.` opsional)."
                  },
                  "brand": {
                    "type": "string",
                    "enum": [
                      "GRANDSTREAM",
                      "YEALINK",
                      "FANVIL",
                      "SNOM",
                      "CISCO",
                      "POLY",
                      "HTEK",
                      "FLYINGVOICE",
                      "PANASONIC",
                      "GIGASET",
                      "AKUVOX",
                      "SANGOMA",
                      "MITEL",
                      "AVAYA",
                      "AUDIOCODES",
                      "ESCENE",
                      "ALE",
                      "NEC",
                      "VTECH",
                      "DINSTAR",
                      "ATCOM",
                      "ZYCOO",
                      "TIPTEL",
                      "KAREL",
                      "GENERIC"
                    ]
                  },
                  "model": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "extensionId": {
                    "type": "string",
                    "description": "Ekstensi yang dipasangkan."
                  },
                  "connectionMode": {
                    "type": "string",
                    "enum": [
                      "STUN",
                      "SBC"
                    ]
                  },
                  "sbcId": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "required": [
                  "macAddress",
                  "brand"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "get": {
        "tags": [
          "Telepon Meja"
        ],
        "summary": "Daftar telepon",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/phones/{id}": {
      "get": {
        "tags": [
          "Telepon Meja"
        ],
        "summary": "Detail telepon",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Telepon Meja"
        ],
        "summary": "Ubah telepon",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "macAddress": {
                    "type": "string",
                    "description": "12 heksadesimal (`:`, `-`, `.` opsional)."
                  },
                  "brand": {
                    "type": "string",
                    "enum": [
                      "GRANDSTREAM",
                      "YEALINK",
                      "FANVIL",
                      "SNOM",
                      "CISCO",
                      "POLY",
                      "HTEK",
                      "FLYINGVOICE",
                      "PANASONIC",
                      "GIGASET",
                      "AKUVOX",
                      "SANGOMA",
                      "MITEL",
                      "AVAYA",
                      "AUDIOCODES",
                      "ESCENE",
                      "ALE",
                      "NEC",
                      "VTECH",
                      "DINSTAR",
                      "ATCOM",
                      "ZYCOO",
                      "TIPTEL",
                      "KAREL",
                      "GENERIC"
                    ]
                  },
                  "model": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "extensionId": {
                    "type": "string",
                    "description": "Ekstensi yang dipasangkan."
                  },
                  "connectionMode": {
                    "type": "string",
                    "enum": [
                      "STUN",
                      "SBC"
                    ]
                  },
                  "sbcId": {
                    "type": "string",
                    "maxLength": 64
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Telepon Meja"
        ],
        "summary": "Hapus telepon",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/phones/{id}/reprovision": {
      "post": {
        "tags": [
          "Telepon Meja"
        ],
        "summary": "Paksa provisioning ulang",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/phones/{id}/firmware": {
      "post": {
        "tags": [
          "Telepon Meja"
        ],
        "summary": "Unggah firmware",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Firmware"
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/media/sounds": {
      "post": {
        "tags": [
          "Media & TTS"
        ],
        "summary": "Unggah suara",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Berkas suara"
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/media/sounds/{name}": {
      "get": {
        "tags": [
          "Media & TTS"
        ],
        "summary": "Putar/unduh suara",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/tts/settings": {
      "get": {
        "tags": [
          "Media & TTS"
        ],
        "summary": "Baca pengaturan TTS",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Media & TTS"
        ],
        "summary": "Ubah pengaturan TTS",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "url": {
                    "type": "string",
                    "description": "Wajib `https://`, tanpa `/` di akhir."
                  },
                  "token": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "defaultFormat": {
                    "type": "string",
                    "enum": [
                      "WAV",
                      "WAV16",
                      "ALAW",
                      "ULAW",
                      "SLN"
                    ]
                  },
                  "defaultVoice": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "defaultSpeed": {
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 2
                  },
                  "timeoutSeconds": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 30
                  },
                  "maxParallel": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 8
                  },
                  "cacheDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/tts/test": {
      "post": {
        "tags": [
          "Media & TTS"
        ],
        "summary": "Tes koneksi ke server TTS",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/tts/voices": {
      "get": {
        "tags": [
          "Media & TTS"
        ],
        "summary": "Daftar suara",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/tts/normalize": {
      "post": {
        "tags": [
          "Media & TTS"
        ],
        "summary": "Normalisasi teks",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  }
                },
                "required": [
                  "text"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/tts/preview": {
      "post": {
        "tags": [
          "Media & TTS"
        ],
        "summary": "Pratinjau audio",
        "description": "Peran: `TENANT_ADMIN`.\n\nRespons biner.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "WAV",
                      "WAV16",
                      "ALAW",
                      "ULAW",
                      "SLN"
                    ]
                  },
                  "voice": {
                    "type": "string"
                  },
                  "speed": {
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 2
                  },
                  "sampleVars": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "required": [
                  "text"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/event-logs": {
      "get": {
        "tags": [
          "Log & Monitoring"
        ],
        "summary": "Log kejadian",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "TRUNK_REGISTRATION",
                "ARI_CONNECTION",
                "CHANNEL_HANGUP",
                "CAPTURE",
                "SECURITY_UNAUTHORIZED",
                "SECURITY_BLACKLIST",
                "SECURITY_WHITELIST",
                "FIREWALL_TRUNK_SYNC",
                "FIREWALL_SBC_SYNC"
              ]
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "INFO",
                "WARNING",
                "ERROR"
              ]
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/app-downloads": {
      "get": {
        "tags": [
          "Unduhan Aplikasi"
        ],
        "summary": "Rilis terbaru per platform",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`, `USER`.\n\nSemua yang login.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/app-downloads/{platform}/link": {
      "get": {
        "tags": [
          "Unduhan Aplikasi"
        ],
        "summary": "Tautan unduhan",
        "description": "Peran: `SUPER_ADMIN`, `TENANT_ADMIN`, `SUPERVISOR`, `USER`.\n\nTautan bertanda tangan, berlaku 5 menit.",
        "x-roles": [
          "SUPER_ADMIN",
          "TENANT_ADMIN",
          "SUPERVISOR",
          "USER"
        ],
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "android",
                "windows"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/app-downloads/file/{platform}": {
      "get": {
        "tags": [
          "Unduhan Aplikasi"
        ],
        "summary": "Unduh berkas aplikasi",
        "description": "Peran: `PUBLIC`.",
        "x-roles": [
          "PUBLIC"
        ],
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "android",
                "windows"
              ]
            }
          },
          {
            "name": "e",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Kedaluwarsa (epoch detik)"
          },
          {
            "name": "s",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Tanda tangan"
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": []
      }
    },
    "/app/recordings/{file}": {
      "get": {
        "tags": [
          "Unduhan Aplikasi"
        ],
        "summary": "Putar rekaman",
        "description": "Peran: `PUBLIC`.\n\nTautan berlaku 1 jam.",
        "x-roles": [
          "PUBLIC"
        ],
        "parameters": [
          {
            "name": "e",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Kedaluwarsa (epoch detik)"
          },
          {
            "name": "s",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Tanda tangan"
          },
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": []
      }
    },
    "/app/voicemail/{id}": {
      "get": {
        "tags": [
          "Unduhan Aplikasi"
        ],
        "summary": "Putar voicemail",
        "description": "Peran: `PUBLIC`.",
        "x-roles": [
          "PUBLIC"
        ],
        "parameters": [
          {
            "name": "t",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Token"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": []
      }
    },
    "/call-webhooks/settings": {
      "get": {
        "tags": [
          "Webhook Panggilan"
        ],
        "summary": "Baca pengaturan",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Webhook Panggilan"
        ],
        "summary": "Ubah pengaturan",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Wajib `https://`, alamat publik."
                  },
                  "secret": {
                    "type": "string",
                    "minLength": 16,
                    "maxLength": 200
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "call.started",
                        "call.ringing",
                        "call.answered",
                        "call.ended",
                        "call.originate_failed",
                        "call.dtmf",
                        "call.hold",
                        "call.unhold",
                        "call.transfer"
                      ]
                    },
                    "uniqueItems": true
                  },
                  "includeDtmfDigits": {
                    "type": "boolean",
                    "description": "`false` = digit DTMF dikirim `null`."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-webhooks/secret/rotate": {
      "post": {
        "tags": [
          "Webhook Panggilan"
        ],
        "summary": "Buat secret baru",
        "description": "Peran: `TENANT_ADMIN`.\n\nSecret tampil **sekali**.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-webhooks/test": {
      "post": {
        "tags": [
          "Webhook Panggilan"
        ],
        "summary": "Kirim webhook.test",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-webhooks/deliveries": {
      "get": {
        "tags": [
          "Webhook Panggilan"
        ],
        "summary": "Riwayat pengiriman",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "callId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/call-webhooks/deliveries/{id}/retry": {
      "post": {
        "tags": [
          "Webhook Panggilan"
        ],
        "summary": "Kirim ulang",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/blast/settings": {
      "get": {
        "tags": [
          "Blast"
        ],
        "summary": "Baca pengaturan Blast",
        "description": "Peran: `TENANT_ADMIN`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "tags": [
          "Blast"
        ],
        "summary": "Ubah pengaturan Blast",
        "description": "Peran: `TENANT_ADMIN`.\n\nAPI key salah dan Blast tidak aktif sama-sama dijawab `401`.",
        "x-roles": [
          "TENANT_ADMIN"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "apiKey": {
                    "type": "string",
                    "minLength": 16,
                    "maxLength": 200
                  },
                  "webhookUrl": {
                    "type": "string",
                    "description": "Wajib `https://`, **tanpa `/` di akhir**."
                  },
                  "webhookSecret": {
                    "type": "string",
                    "minLength": 16,
                    "maxLength": 200
                  },
                  "maxChannels": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 500
                  },
                  "maxCps": {
                    "type": "number",
                    "minimum": 0.1,
                    "maximum": 50
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/blast/calls": {
      "post": {
        "tags": [
          "Blast"
        ],
        "summary": "Buat panggilan Blast",
        "description": "Autentikasi: `API_KEY` (header `X-API-Key`).\n\n`202` antre; `200` bila `callId` sama dikirim ulang (idempoten); `429` kapasitas penuh dengan `Retry-After`.",
        "x-roles": [
          "API_KEY"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "callId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "number": {
                    "type": "string",
                    "pattern": "^[0-9+]{3,40}$"
                  },
                  "callerId": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "ringTimeoutSec": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 120
                  },
                  "maxDurationSec": {
                    "type": "integer",
                    "minimum": 10,
                    "maximum": 3600
                  },
                  "allowInterrupt": {
                    "type": "boolean"
                  },
                  "prompts": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "audio"
                              ]
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "tts"
                              ]
                            },
                            "text": {
                              "type": "string",
                              "maxLength": 1000
                            },
                            "speed": {
                              "type": "number",
                              "minimum": 0.5,
                              "maximum": 2
                            },
                            "volume": {
                              "type": "number",
                              "minimum": 0.1,
                              "maximum": 3
                            },
                            "padStart": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5000
                            },
                            "padEnd": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 5000
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "silence"
                              ]
                            },
                            "ms": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 30000
                            }
                          },
                          "required": [
                            "type",
                            "ms"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "minItems": 1
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "timeoutSec": {
                        "type": "integer"
                      },
                      "maxRetries": {
                        "type": "integer"
                      },
                      "onTimeout": {
                        "type": "string",
                        "enum": [
                          "repeat",
                          "hangup",
                          "transfer"
                        ]
                      },
                      "onInvalid": {
                        "type": "string",
                        "enum": [
                          "repeat",
                          "hangup",
                          "transfer"
                        ]
                      },
                      "keys": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "digit": {
                              "type": "string",
                              "pattern": "^[0-9*#]$"
                            },
                            "action": {
                              "type": "string",
                              "enum": [
                                "transfer",
                                "hangup",
                                "repeat",
                                "record_response",
                                "none"
                              ]
                            },
                            "label": {
                              "type": "string"
                            },
                            "target": {
                              "type": "string",
                              "description": "Untuk `transfer`."
                            }
                          },
                          "required": [
                            "digit",
                            "action"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "additionalProperties": false
                  },
                  "meta": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Objek bebas, dikembalikan apa adanya di setiap event."
                  }
                },
                "required": [
                  "callId",
                  "number",
                  "prompts"
                ],
                "additionalProperties": false
              },
              "example": {
                "callId": "poc-0001",
                "number": "6281234567890",
                "callerId": "6281234500000",
                "ringTimeoutSec": 30,
                "maxDurationSec": 120,
                "allowInterrupt": true,
                "prompts": [
                  {
                    "type": "tts",
                    "text": "Ini panggilan uji dari VoipCall",
                    "speed": 1
                  },
                  {
                    "type": "silence",
                    "ms": 500
                  }
                ],
                "options": {
                  "timeoutSec": 6,
                  "maxRetries": 1,
                  "onTimeout": "hangup",
                  "onInvalid": "repeat",
                  "keys": [
                    {
                      "digit": "1",
                      "action": "transfer",
                      "label": "Agen",
                      "target": "7101"
                    },
                    {
                      "digit": "2",
                      "action": "hangup"
                    }
                  ]
                },
                "meta": {
                  "campaign": "promo-nov"
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "callId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false
                },
                "example": {
                  "callId": "poc-0001",
                  "status": "queued"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/blast/calls/{callId}/hangup": {
      "post": {
        "tags": [
          "Blast"
        ],
        "summary": "Putus panggilan Blast",
        "description": "Autentikasi: `API_KEY` (header `X-API-Key`).\n\nIdempoten; `404` bila `callId` tidak dikenal.",
        "x-roles": [
          "API_KEY"
        ],
        "parameters": [
          {
            "name": "callId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/blast/capacity": {
      "get": {
        "tags": [
          "Blast"
        ],
        "summary": "Kapasitas Blast",
        "description": "Autentikasi: `API_KEY` (header `X-API-Key`).",
        "x-roles": [
          "API_KEY"
        ],
        "responses": {
          "200": {
            "description": "Berhasil.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "maxChannels": {
                      "type": "integer"
                    },
                    "inUse": {
                      "type": "integer"
                    },
                    "maxCps": {
                      "type": "number"
                    },
                    "queued": {
                      "type": "integer"
                    }
                  },
                  "additionalProperties": false
                },
                "example": {
                  "maxChannels": 20,
                  "inUse": 7,
                  "maxCps": 2,
                  "queued": 0
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/blast/audio": {
      "get": {
        "tags": [
          "Blast"
        ],
        "summary": "Daftar audio prompt",
        "description": "Autentikasi: `API_KEY` (header `X-API-Key`).",
        "x-roles": [
          "API_KEY"
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/blast/audio/{name}": {
      "put": {
        "tags": [
          "Blast"
        ],
        "summary": "Unggah audio prompt",
        "description": "Autentikasi: `API_KEY` (header `X-API-Key`).\n\nMaks 10 MB; WAV PCM **8 kHz, mono, 16-bit**, format lain `400`.",
        "x-roles": [
          "API_KEY"
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "WAV PCM 8 kHz mono 16-bit"
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "400": {
            "$ref": "#/components/responses/Validation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Blast"
        ],
        "summary": "Hapus audio prompt",
        "description": "Autentikasi: `API_KEY` (header `X-API-Key`).",
        "x-roles": [
          "API_KEY"
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Berhasil."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Access token dari `POST /auth/login` (berlaku 15 menit)."
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Hanya untuk `/blast/calls`, `/blast/capacity`, dan `/blast/audio`."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "message": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ],
            "description": "String; larik pada kegagalan validasi (`400`)."
          },
          "error": {
            "type": "string"
          },
          "statusCode": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "Paged": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {}
          },
          "total": {
            "type": "integer"
          },
          "page": {
            "type": "integer"
          },
          "pageSize": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "TokenPair": {
        "type": "object",
        "properties": {
          "accessToken": {
            "type": "string"
          },
          "refreshToken": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CallLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "rootChannelId": {
            "type": "string",
            "example": "1795076943.1214",
            "description": "ID panggilan; sama dengan `callId` pada webhook dan `rootChannelId` pada panggilan aktif."
          },
          "direction": {
            "type": "string",
            "enum": [
              "INBOUND_TRUNK",
              "OUTBOUND_TRUNK",
              "EXTENSION_TO_EXTENSION"
            ]
          },
          "disposition": {
            "type": "string",
            "enum": [
              "ANSWERED",
              "NO_ANSWER",
              "BUSY",
              "FAILED",
              "CANCELED"
            ]
          },
          "callerNumber": {
            "type": "string"
          },
          "callerName": {
            "type": "string"
          },
          "calleeNumber": {
            "type": "string"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "answeredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endedAt": {
            "type": "string",
            "format": "date-time"
          },
          "durationSeconds": {
            "type": "integer"
          },
          "talkTimeSeconds": {
            "type": "integer",
            "minimum": {
              "description": "`endedAt − answeredAt`; `null` bila tidak diangkat; dasar penagihan."
            },
            "nullable": true
          },
          "hangupCause": {
            "type": "string"
          },
          "billedSeconds": {
            "type": "integer",
            "minimum": {
              "description": "`talkTimeSeconds` dibulatkan ke atas ke kelipatan `billingIncrementSeconds` trunk."
            },
            "nullable": true
          },
          "costAmount": {
            "type": "number",
            "description": "`billedSeconds / 60 × costPerMinute`; `null` bila tidak ada waktu bicara/trunk/tarif.",
            "nullable": true
          },
          "recordingPath": {
            "type": "string",
            "description": "Hanya penanda rekaman ada. Nilai internal, jangan dipakai.",
            "nullable": true
          }
        },
        "additionalProperties": true
      },
      "ActiveCall": {
        "type": "object",
        "properties": {
          "rootChannelId": {
            "type": "string"
          },
          "direction": {
            "type": "string",
            "description": "Hanya perkiraan; arah pasti ada di CDR."
          },
          "callerNumber": {
            "type": "string"
          },
          "callerName": {
            "type": "string"
          },
          "calleeNumber": {
            "type": "string"
          },
          "sourceLabel": {
            "type": "string"
          },
          "destLabel": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "durationSeconds": {
            "type": "integer"
          },
          "bridgeId": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "ExtensionState": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "online",
              "offline"
            ]
          },
          "ipAddress": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Extension": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "sipAuthId": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          },
          "asteriskSynced": {
            "type": "boolean",
            "description": "`false` berarti panggil `POST /extensions/{id}/resync`."
          },
          "recordingMode": {
            "type": "string",
            "enum": [
              "ALL",
              "EXTERNAL",
              "NONE"
            ]
          },
          "sipPassword": {
            "type": "string",
            "description": "Password plaintext, **hanya ada di respons `POST /extensions`** (24 karakter acak)."
          }
        },
        "additionalProperties": true
      },
      "WebhookEnvelope": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID unik event. Sama di setiap percobaan ulang: pakai sebagai kunci idempotensi."
          },
          "callId": {
            "type": "string",
            "description": "`rootChannelId` panggilan."
          },
          "seq": {
            "type": "integer",
            "minimum": 1,
            "description": "Mulai 1, naik per `callId`."
          },
          "event": {
            "type": "string",
            "enum": [
              "call.started",
              "call.ringing",
              "call.answered",
              "call.ended",
              "call.originate_failed",
              "call.dtmf",
              "call.hold",
              "call.unhold",
              "call.transfer",
              "webhook.test"
            ]
          },
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Token/API key tidak ada atau salah.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Peran tidak cukup.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Tidak ditemukan (juga untuk data milik tenant lain).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Validation": {
        "description": "Validasi gagal. Field yang tidak dikenal ditolak.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooMany": {
        "description": "Batas laju terlampaui. Hormati `Retry-After`.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}