Skip to main content

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

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

Redirect an app’s answer_url to a local tunnel so calls stream into your local handler Command:
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
--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.