---
title: "Carry a Voice Call over WebSocket, WebRTC or a Phone Line | Micdrop"
description: "Carry a Micdrop call over a WebSocket, over WebRTC, or over a phone line from Twilio, Vonage, Telnyx or Plivo, with the same server and the same agent."
url: "https://micdrop.dev/docs/transports"
---

# Carry a Voice Call over WebSocket, WebRTC or a Phone Line

A transport carries a call between `MicdropServer` and whatever is at the other end: a browser, a mobile app, or a phone. The server only talks to its transport, so the agent, the speech to text and the text to speech stay the same whichever one you pick.

Transport

Far end

Package

Turns detected by

WebSocket

Browser, React Native app

`@micdrop/server`, the default

The client, or the server

[WebRTC](/docs/transports/webrtc)

Browser, React Native app

`@micdrop/webrtc`

The client, or the server

[Twilio](/docs/transports/twilio), [Vonage](/docs/transports/vonage), [Telnyx](/docs/transports/telnyx), [Plivo](/docs/transports/plivo)

Phone

`@micdrop/telephony`

The server

## WebSocket, the default

Handing a socket to `MicdropServer` uses the WebSocket transport, which is how every Micdrop server has always worked:

```typescript
wss.on('connection', (socket) => {
  new MicdropServer(socket, config)
})
```

It needs nothing beyond the server you already run, and its frames are readable in the network tab of the browser. The [protocol page](/docs/server/protocol) lists every one of them. Passing the transport yourself does the same thing:

```typescript
import { MicdropServer, WebSocketTransport } from '@micdrop/server'

new MicdropServer(new WebSocketTransport(socket), config)
```

## WebRTC, for weak networks

[WebRTC](/docs/transports/webrtc) sends the audio over UDP, where a lost packet is skipped rather than resent. A user on a train or on a crowded wifi hears a voice that keeps its pace instead of one that stutters, and the browser cancels the echo of a WebRTC track better than that of audio it plays itself. It costs a signaling route and open UDP ports on the server, and a TURN server for the users behind strict firewalls.

## Phone lines

A [telephony transport](/docs/transports/telephony) answers calls to a phone number through the media stream WebSocket of the provider. The caller speaks into a phone, so there is no client to install, and no client to detect the turns either: the server [detects them itself](/docs/server/vad).

## Who detects the turns

Over a WebSocket or WebRTC, the client runs its [voice activity detection](/docs/client/vad) by default and tells the server when the user starts and stops speaking. It sends audio only while the user speaks, and a turn detector in the browser can close the turn sooner.

The server can take that role, with `vad` in its config. It then finds the turns in the audio it receives, the client streams its whole microphone and follows. That is the only choice on a phone line, and an option elsewhere for a client that cannot run a VAD, or to keep every decision on the server.

```typescript
import { MicdropServer } from '@micdrop/server'
import '@micdrop/vad/node'

new MicdropServer(transport, {
  ...config,
  vad: 'silero',
})
```

[Detect the turns on the server](/docs/server/vad) covers the options.

## Writing a transport

A transport is a class that turns what it receives into user audio at 16 kHz and turn commands, and turns the messages and the voice of the server into whatever its far end reads. [Write a custom transport](/docs/transports/custom) shows the contract, with an in-memory transport as an example.
