Migrate from TwiML
You can move in two steps: first run your existing TwiML app unchanged, then switch endpoints to JSON commands at your own pace.
Step 1: run existing TwiML apps unchanged
Point a number at your current TwiML URL with the Twilio-compatible adapter:
ts
await vi.numbers.update("pn_123", { voice_config: { mode: "twiml", url: "https://example.com/twiml/voice" } });python
client.numbers.update("pn_123", voice_config={"mode": "twiml", "url": "https://example.com/twiml/voice"})The adapter sends the Twilio-style form parameters your app expects (CallSid, From, To, Digits, SpeechResult, …) and executes the returned TwiML. Port your numbers in with a port request, or buy new ones and switch over gradually.
Step 2: translate verbs to commands
Commands are JSON objects. The same list works as a webhook reply ({ "commands": [...] }), in REST call actions and in saved flows. Full field list: commands & flows.
| TwiML | Kolwire command | Notes |
|---|---|---|
<Say voice language> | say { text, voice?, language? } | |
<Play loop> | play { url, loop? } | |
<Pause length> | pause { seconds } | |
<Gather input numDigits timeout finishOnKey action> | gather { input, max_digits, timeout_sec, terminator, action_url?, prompt? } | Nested <Say>/<Play> becomes prompt. Result arrives as call.gather.completed; in flows use branches. |
<Dial><Number> | dial { targets: ["+1555…"] } | |
<Dial><Sip> | dial { targets: ["sip:alice@pbx.example.com"] } | |
<Dial><Client> | dial { targets: ["client:alice"] } | WebRTC softphone user. Also agent:<team_agent_id>. |
<Dial callerId record timeout> | dial { caller_id, record, timeout_sec, strategy } | Multiple targets ring sequentially or simultaneously. |
<Dial><Conference> | conference { name, start_on_enter, end_on_exit, muted, role } | role adds supervisor monitor / whisper / barge. |
<Enqueue> | enqueue { queue, hold_music_url?, max_wait_sec? } | Queues route to human team agents (ACD). |
<Record> | record { action: "start", channels: "dual" } | Calls are recorded by default; pause / resume for PCI. |
<Redirect> | redirect { url } or { flow_id } | |
<Hangup> | hangup | |
<Reject reason> | reject { reason: "busy" | "rejected" } | |
<Start><Stream> / <Connect><Stream> | stream { url, track, bidirectional } | See BYO voice agent. |
<Sms> | sms { body, to? } | |
| — | connect_agent, assist, transcribe, detect_machine, transfer, send_dtmf, answer | New: AI agent, live sales advisor, live transcription, AMD, warm/blind transfer. |
Example
xml
<Response>
<Gather numDigits="1" action="/menu">
<Say>Press 1 for sales.</Say>
</Gather>
<Say>Goodbye</Say>
</Response>ts
new VoiceResponse()
.gather({ max_digits: 1, action_url: "https://example.com/menu", prompt: say("Press 1 for sales.") })
.say("Goodbye");json
{ "commands": [
{ "command": "gather", "max_digits": 1, "action_url": "https://example.com/menu",
"prompt": { "command": "say", "text": "Press 1 for sales." } },
{ "command": "say", "text": "Goodbye" }
] }Webhook differences
| Twilio | Kolwire | |
|---|---|---|
| Body | application/x-www-form-urlencoded params | JSON event envelope { id, type, workspace_id, created_at, data } |
| What triggers a request | Each TwiML step / status callback | Every call event (call.initiated, call.answered, call.gather.completed, call.ended, …) |
| Reply | TwiML XML | { "commands": [...] } (or empty) |
| Call id | CallSid | data.call_id |
| Your state | query params | client_state echoed on every event |
| Signature header | X-Twilio-Signature (HMAC-SHA1 over URL + sorted params) | Kolwire-Signature: t=…,v1=… (HMAC-SHA256 over t.rawBody, with replay window) — see webhook security |
| Status callbacks | Separate URLs per resource | One event stream: per-call webhook_url and/or workspace webhook endpoints with event filters |
You can also control calls without webhooks at all: vi.calls.actions(callId, { commands }) from anywhere in your code.