Skip to main content
WaGo call audio is not only for testing. A production app can let a real user speak and listen through a browser, desktop app, or mobile app by bridging that app’s audio to an active WhatsApp call. Use WebRTC between your frontend and WaGo:
User browser or app
  microphone -> Opus RTP -> WaGo /call/webrtc/offer -> WhatsApp call
  speaker    <- Opus RTP <- WaGo call receive path
WebRTC is the right default because browsers already support microphone capture, echo cancellation, jitter buffering, packet timing, and audio output.

Browser requirements

Your browser app needs:
  • HTTPS origin in production.
  • Microphone permission from the user.
  • An active WaGo call ID.
  • RTCPeerConnection configured with /call/webrtc/config.
  • A visible or hidden <audio autoplay> element for remote call audio.
Browsers block microphone access on insecure origins. localhost works for local development, but production must be HTTPS.

Server requirements

WaGo needs:
  • A connected and scanned token.
  • A tracked call from /call/make or an incoming call event.
  • UDP/network access for WebRTC ICE.
  • Reverse proxy support for normal HTTPS API traffic.
Current ICE config:
{
  "iceServers": [
    {
      "urls": ["stun:stun.l.google.com:19302"]
    }
  ],
  "turn": {
    "enabled": false,
    "status": "coming_soon"
  }
}

TURN status

TURN is not configured yet. WaGo hard-codes STUN for now and returns TURN as coming_soon. This means production audio can work for many networks, but it is not guaranteed for all users. Strict NAT, office firewalls, and some mobile networks may need TURN relay before live audio is reliable everywhere.

Browser implementation checklist

  1. Call GET /call/webrtc/config.
  2. Create RTCPeerConnection with the returned iceServers.
  3. Call navigator.mediaDevices.getUserMedia({ audio: true }).
  4. Add the microphone audio track to the peer connection.
  5. Listen for pc.ontrack and attach the remote stream to an audio element.
  6. Create an SDP offer.
  7. Wait for ICE gathering to complete.
  8. Send { callID, type: "offer", sdp } to POST /call/webrtc/offer.
  9. Set WaGo’s answer as the remote description.
  10. On call end, close the peer connection and call POST /call/webrtc/close.

Desktop and mobile apps

If you build a desktop or mobile application, you have two options:
OptionUse when
WebRTC libraryYou want the same behavior as browser live audio.
Native RTP/Opus bridgeYou control audio capture and want a custom real-time pipeline.
For most apps, use a WebRTC library. Native RTP means you must handle microphone capture, resampling, Opus encode/decode, packet timing, jitter, and audio playback yourself.

Server-side audio files

If the user does not need to speak live, use /call/play instead of WebRTC. It plays a file already present on the WaGo server. Supported file extensions:
  • .mp3
  • .wav
  • .opus
  • .ogg

Recording

Use /call/record to save received call audio to a WAV file:
{
  "CallID": "CALL_ID",
  "Path": "files/calls/CALL_ID.wav"
}
If Path is empty, WaGo defaults to files/calls/{callID}.wav.
Call recording laws vary by country and state. Your product should obtain consent and follow local requirements before recording users.