Skip to main content
Route real incoming calls through a tunnel to your voice agent over its WebSocket connection while developing. First log in, start your voice agent, and attach a number to a dedicated test application. Use that number and application ID:
Replace the example values, approve the routing change, then call the number from a phone. Calls use your normal Plivo billing. Keep the command running; Ctrl-C restores the saved answer URL unless you pass --keep.

How it works

--to accepts a ws:// or wss:// URL on your laptop, a staging server or a colleague’s tunnel. The tunnel runs on the CLI’s machine. forward saves the application’s answer_url, starts a tunnel and local HTTP/WebSocket server, and updates the application to use that tunnel. It forwards call audio to your voice agent. On Ctrl-C or a tunnel failure, it restores the saved URL; a tunnel failure exits 3. See the recovery behavior below for a process that is killed outright.
Every phone number attached to the application is redirected for as long as forward runs: the confirmation step tells you how many. Use a dedicated test application.

Signature check and your login

forward checks Plivo’s signature on every request that reaches the tunnel, so only Plivo can drive your handler. The check needs your account key. From v1.4.0, plivo login stores no account key: the profile runs on a 30-day sign-in. On such a profile, forward refuses with RAW_KEY_REQUIRED (exit 1) before it changes anything. You can:
  • run it with --profile for a profile that still holds a key from a login made with v1.3.3 or earlier, or
  • pass --insecure-skip-signature, if you accept that anyone with the tunnel URL can drive your handler while it runs.
plivo auth list shows which profiles hold a key: their credential field reads key.

The tunnel

The localhost.run tunnel needs an SSH client on PATH and no tunnel account. localhost.run now issues *.app.lhr.life addresses; v1.4.0 and earlier fail with localhost.run did not announce a URL within 25s, so use v1.4.1 or later. macOS and Linux commonly include SSH; install it if the CLI reports ssh not found. If ngrok is already on your PATH (or at ~/.plivo/bin/ngrok) the CLI uses that instead, since a warmed-up ngrok is usually faster. --tunnel forces the choice: auto (the default) prefers ngrok when it is present and falls back to localhost.run, also when ngrok can’t start; ngrok and localhost.run pin one provider.
The confirmation prompt and the --dry-run preview print a placeholder answer URL of the form https://<ngrok-tunnel>/answer whichever provider is chosen. The real tunnel URL is printed once the tunnel is up.

Command and flags

Usage
Flags Examples
--codec and --rate follow the same rules here as they do for streams test, and an unsupported pair is rejected before anything is redirected: see The audio contract. Nothing is purchased, created, or deleted: the only change is one field on one application, restored on exit unless you pass --keep. forward saves the original answer URL in ~/.plivo first. If it is killed outright (kill -9), the next forward on that application restores the real answer URL and, on macOS and Linux, stops the tunnel the killed run left behind. A second forward on the same application is refused while one is running. A localhost.run or trycloudflare.com URL is not saved as the original answer URL. An ngrok URL can be saved, with a warning, because ngrok also supports fixed domains.