> ## Documentation Index
> Fetch the complete documentation index at: https://plivo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Forward live calls to any WebSocket

> Take a real inbound call on a bot that has no public answer URL yet (on your laptop, a staging box or a teammate's tunnel) with one command.

## How it works

One command replaces the usual "deploy an answer URL, write XML, point a number at it" loop while you are still developing. `--to` takes any `ws://` or `wss://` URL: a bot on `localhost`, one on a staging server, or a colleague's tunnel. The tunnel is started on the machine running the CLI, not on the machine where the bot runs. `forward` saves the application's current `answer_url`, starts a tunnel and a local HTTP/WebSocket server, points the application at the tunnel, and bridges the audio of incoming calls to your local WebSocket handler. On Ctrl-C it restores the original `answer_url`.

<Warning>
  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.
</Warning>

## The tunnel

There is nothing to install and no account to create. `forward` defaults to localhost.run over ssh, and ssh already ships on macOS and Linux. 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, `ngrok` and `localhost.run` pin one provider.

<Note>
  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.
</Note>

## Command and flags

Redirect an app's answer\_url to a local tunnel so calls stream into your local handler

**Command:**

```bash theme={null}
plivo voice streams forward [flags]
```

**Flags**

* `--app <string>`: Plivo Application UUID whose answer\_url will be temporarily redirected (required)
* `--bidirectional`: allow bot to send audio back to the caller (default true)
* `--codec <string>`: audio codec advertised to Plivo: mulaw | l16 (default "mulaw")
* `--keep`: do NOT restore the original answer\_url on exit (advanced)
* `--number <string>`: E.164 number attached to --app (required)
* `--print-payload`: dump full webhook bodies to terminal (verbose)
* `--rate <int>`: sample rate in Hz (mulaw: 8000; l16: 8000 or 16000) (default 8000)
* `--to <string>`: local WebSocket URL to forward call audio to, e.g. ws\://localhost:7860/ws (required)
* `--tunnel <string>`: tunnel provider: auto | ngrok | localhost.run (default "auto")
* `-y, --yes`: skip the confirmation prompt

**Examples**

```bash theme={null}
  plivo voice streams forward \
    --number +14155550142 \
    --app abc-uuid-def-456 \
    --to ws://localhost:7860/ws
  # Don't restore answer_url on exit (advanced):
  plivo voice streams forward --number +14155550142 --app abc --to ws://localhost:7860/ws --keep
```

`--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](/docs/cli/voice-agent/test-websocket#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`.
