plivo voice streams test: your WebSocket endpoint, with Plivo-shaped audio frames.plivo voice streams simulate: your answer URL and its XML, as Plivo requests them, then the WebSocket in its<Stream>. It still requests your own webhook, so your server runs its normal handler.plivo voice streams readiness: a number, or a caller ID for an outbound call, is ready for a streamed call. Then it simulates the call.
Test a WebSocket endpoint
plivo voice streams test [flags] opens a WebSocket to your server and sends synthetic frames in Plivo’s format: one start frame, a media frame every 20 ms for --duration seconds, then one stop frame. It reports connection latency, frames sent and, with --bidirectional, whether your server sent audio back and how fast. Plivo’s backend is not involved, so you can run it in continuous integration (CI).
- The input is a 1 kHz tone, not speech. If no
playAudioreturns, an agent that waits for speech may stay silent even when it works on real calls. - A
wss://URL that reaches a server without TLS fails with a hint to usews://for a local server. - On normal completion the test sends
stopbefore closing. A failed write ends it with exit code3, and so does an endpoint that closes the stream beforestop; the error gives the frame it closed at and the close code and reason.
Signed like a real stream
When you are logged in, the test signs the WebSocket upgrade as Plivo signs a stream, withX-Plivo-Signature-V3 keyed with your profile’s auth token, so an endpoint that checks Plivo’s signature lets it in. --profile signs for another account; logged out, the upgrade is unsigned. An endpoint that refuses the upgrade with 401 or 403 fails the test with AUTH_FORBIDDEN and exit code 2.
Read the result in a script or CI
With-o json, the test prints one result on stdout and its progress on stderr. --expect-audio makes it exit 1 when no playAudio comes back, so it can gate a CI job.
Simulate a call to your answer URL
voice streams simulate does what Plivo does when a call reaches your answer URL, without placing a call. Requires Plivo CLI v1.3.2 or later.
- It requests
--answer-urlwith the fields Plivo sends (CallUUID,From,To,Direction,CallStatus), signed withX-Plivo-Signature-V3when you are logged in. - It checks the reply: a 2xx within Plivo’s 15 seconds, its content type, and Plivo XML with a
<Stream>. - It opens the WebSocket in the
<Stream>and streams a tone in itscontentType, asvoice streams testdoes.
- Only the answer document is read: no
<Redirect>or action URL is followed. A Plivo-hosted answer URL, such as a flow built in the console, is refused with nothing sent, because a request there would run it for real. - A pass means your server answers your machine as Plivo needs. It doesn’t prove that Plivo can reach your server, or that a caller hears the audio.
- Exit codes:
0on a pass,1when a check fails,2when the WebSocket refuses the upgrade,3when a host can’t be reached or the WebSocket closes before thestopframe. - With
-o jsonit printschecks[]and the stream summary understream, with the same fields asvoice streams test. When a check fails it prints only the error, withchecks[]inerror.context.
Check a number is ready for a call
voice streams readiness checks what a streamed call needs on your account, then simulates the call as voice streams simulate does. It places no call and changes nothing. Requires Plivo CLI v1.3.2 or later.
Inbound: give the number.
result: ready follow.
Outbound: give the caller ID, the number to call and the answer URL.
- A Plivo-hosted answer URL, such as a flow built in the console, is not requested in either direction: the result is
unknown.--dry-runmakes the account reads but sends nothing to the answer URL. - With
-o jsonit printschecks[]and the simulation. When a check fails it prints only the error, with both inerror.context.
The audio contract
The XML attribute and the WebSocket frame spell the audio format differently, which is easy to get wrong.<Stream> has one combined contentType attribute holding the codec and sample rate. There is no sampleRate attribute on <Stream>.
start frame spells them out separately, under mediaFormat:
audio/x-l16, not audio/l16. Exactly three combinations are supported:
There is no mu-law 16 kHz stream. Any other pair is rejected before the connection opens, with
BAD_FLAG and exit code 1, so a bad combination fails on your laptop instead of as a dropped stream mid-call. --codec l16 sends real little-endian 16-bit pulse-code modulation (PCM) audio, so an agent that decodes the payload sees a genuine waveform.