---
title: "Start/Stop Call | Micdrop"
description: "Manage voice conversations by starting and stopping the Micdrop client connection and microphone."
url: "https://micdrop.dev/docs/client/start-stop-call"
---

*   [Getting Started](/docs/getting-started)
*   [Client (Browser)](/docs/client)
    
    *   [Installation](/docs/client/installation)
    *   [React Hooks](/docs/client/react-hooks)
    *   [Start/Stop Call](/docs/client/start-stop-call)
    *   [Pause/Resume Call](/docs/client/pause-resume-call)
    *   [Mute/Unmute Call](/docs/client/mute-unmute-call)
    *   [Call State](/docs/client/call-state)
    *   [Display Conversation Messages](/docs/client/display-conversation-messages)
    *   [Handling Tool Calls](/docs/client/handling-tool-calls)
    *   [Device Management](/docs/client/devices-management)
    *   [Voice Activity Detection (VAD)](/docs/client/vad)
    *   [Error Handling](/docs/client/error-handling)
    *   Utility Classes
        
        *   [Mic](/docs/client/utility-classes/mic)
        *   [MicdropClient](/docs/client/utility-classes/micdrop-client)
        *   [MicRecorder](/docs/client/utility-classes/mic-recorder)
        *   [Speaker](/docs/client/utility-classes/speaker)
        
    
*   [Server (Node.js)](/docs/server)
    
    *   [Installation](/docs/server/installation)
    *   [With Fastify](/docs/server/with-fastify)
    *   [With NestJS](/docs/server/with-nestjs)
    *   [Auth and Parameters](/docs/server/auth-and-parameters)
    *   [First Message](/docs/server/first-message)
    *   [Save Messages](/docs/server/save-messages)
    *   [Resume a Conversation](/docs/server/resume-conversation)
    *   [Recording Audio](/docs/server/recording-audio)
    *   [Error Handling](/docs/server/error-handling)
    *   [Tools](/docs/server/tools)
    *   [Extract Value from Answer](/docs/server/extract)
    *   [Auto End Call](/docs/server/auto-end-call)
    *   [Semantic Turn Detection](/docs/server/semantic-turn-detection)
    *   [Noise Filtering](/docs/server/noise-filtering)
    *   [Micdrop Protocol](/docs/server/protocol)
    
*   [AI Integrations](/docs/ai-integration)
    
    *   Provided Integrations
        
        *   [AI SDK](/docs/ai-integration/provided-integrations/ai-sdk)
        *   [Cartesia](/docs/ai-integration/provided-integrations/cartesia)
        *   [ElevenLabs](/docs/ai-integration/provided-integrations/elevenlabs)
        *   [Gladia](/docs/ai-integration/provided-integrations/gladia)
        *   [Gradium](/docs/ai-integration/provided-integrations/gradium)
        *   [Mistral](/docs/ai-integration/provided-integrations/mistral)
        *   [OpenAI](/docs/ai-integration/provided-integrations/openai)
        
    *   Custom Integrations
        
        *   [Agent (LLM)](/docs/ai-integration/custom-integrations/custom-agent)
        *   [Speech-to-Text (STT)](/docs/ai-integration/custom-integrations/custom-stt)
        *   [Text-to-Speech (TTS)](/docs/ai-integration/custom-integrations/custom-tts)
        
    *   Fallback Strategies
        
        *   [FallbackAgent](/docs/ai-integration/fallback-strategies/agent-fallback)
        *   [FallbackSTT](/docs/ai-integration/fallback-strategies/stt-fallback)
        *   [FallbackTTS](/docs/ai-integration/fallback-strategies/tts-fallback)
        
    *   [IA Vocale Souveraine 🇫🇷🇪🇺](/docs/ai-integration/sovereign-voice-ai)
    

[Micdrop](/) › [Documentation](/docs/getting-started)

# Start/Stop Call

Manage voice conversations by starting and stopping the Micdrop client connection and microphone.

## Starting a Call

Begin a voice conversation by starting the Micdrop client connection and microphone.

### Basic Usage

Start a call with minimal configuration:

```
import { Micdrop } from '@micdrop/client'
await Micdrop.start({  url: 'ws://localhost:8081',})
```

### Start Options

Configure the call with various options:

```
await Micdrop.start({  // Required: WebSocket server URL  url: 'ws://localhost:8081/',
  // Optional: Authentication and parameters  params: {    // You can put anything you want here and validate it on the server side    language: 'en-US',    userId: '123',  },
  // Optional: Voice Activity Detection configuration  vad: ['volume', 'silero'],
  // Optional: Disable interruption when assistant speaks  disableInterruption: false,
  // Optional: Enable debug logging  debugLog: true,
  // Optional: Automatic reconnection configuration  reconnect: {    maxAttempts: 10, // Maximum reconnection attempts (default: Infinity)    delayMs: 500, // Delay between reconnection attempts in ms (default: 1000)    connectionTimeout: 5000, // Timeout for WebSocket connection in ms (default: 5000)  },})
```

### Starting Microphone First

You can start the microphone before the call to ensure permissions and test audio:

```
// Start microphone firstawait Micdrop.startMic({  vad: ['volume', 'silero'],})
// Then start the call when you wantawait Micdrop.start({  url: 'ws://localhost:8081',})
```

Starting the microphone first is not mandatory - calling `start()` will automatically start the microphone if it’s not already running.

### Authentication

Pass authentication parameters to your server:

```
await Micdrop.start({  url: 'ws://localhost:8081',  params: {    authorization: 'Bearer your-jwt-token',  },})
```

The server receives these parameters and can validate them before accepting the connection.

Learn more about [Auth and parameters](/docs/server/auth-and-parameters) on the server side.

### Start State Monitoring

Listen for state changes during startup:

```
Micdrop.on('StateChange', (state, prevState) => {  if (state.isStarting && !prevState.isStarting) {    console.log('Starting call...')  }
  if (state.isStarted && !prevState.isStarted) {    console.log('Call started! Ready for conversation.')  }
  if (state.isReconnecting && !prevState.isReconnecting) {    console.log('Connection lost. Attempting to reconnect...')  }})
```

### Start Error Handling

Handle connection and startup errors:

```
try {  await Micdrop.start({    url: 'ws://localhost:8081',  })  console.log('Call started successfully!')} catch (error) {  console.error('Failed to start call:', error.code, error.message)
  // Handle specific error types  switch (error.code) {    case 'Unauthorized':      // Show login dialog      break    case 'Mic':      // Show microphone permission help      break    case 'MissingUrl':      // Show help to set the url      break    case 'Connection':      // Show help to check the connection      break    case 'InternalServer':      // Show help to check the server      break    case 'BadRequest':      // Show help to check the request      break    case 'NotFound':      // Show help to check the server      break    case 'Unknown':      // Show help to check the request      break    default:      break  }}
```

Learn more about [Error Handling](/docs/client/error-handling).

## Stopping a Call

End the voice conversation by stopping the microphone, closing the WebSocket connection, and cleaning up resources.

### Basic Usage

Stop the current call and clean up all resources:

```
import { Micdrop } from '@micdrop/client'
// Stop the callawait Micdrop.stop()
console.log('Call stopped:', !Micdrop.isStarted) // true
```

When stopped:

*   🛑 Microphone recording ends
*   🛑 WebSocket connection closes
*   🛑 Audio processing stops
*   🛑 All event listeners are cleaned up
*   🛑 VAD algorithms are stopped

### Graceful Stop

Wait for current operations to complete before stopping:

```
async function gracefulStop() {  if (!Micdrop.isAssistantSpeaking) {    Micdrop.stop()    console.log('Call stopped immediately')  } else {    // Wait for assistant to finish, then stop    const handler = (state: MicdropState) => {      if (!state.isAssistantSpeaking) {        Micdrop.stop()        Micdrop.off('StateChange', handler)        console.log('Call stopped gracefully')      }    }    Micdrop.on('StateChange', handler)  }}
```

### Stop State Monitoring

Monitor the stop process:

```
Micdrop.on('StateChange', (state) => {  if (!state.isStarted && !state.isStarting) {    console.log('✅ Call fully stopped')    // Update UI to show stopped state    updateCallButton('Start Call', 'green')  }})
await Micdrop.stop()
```

### Auto-stop on EndCall event

You may want the assistant to be able to end the call, for example when the user says “Bye bye”.

The [agent](/docs/ai-integration/custom-integrations/custom-agent) can send an `EndCall` that can be listened to by the client.

```
Micdrop.on('EndCall', () => {  console.log('🔚 Call ended by assistant')  Micdrop.stop()})
```

You can gracefully stop the call by waiting for the assistant to finish speaking (see above).

## UI Integration

Create start/stop controls in your interface:

```
// Button handler for start/stop togglefunction toggleStartStop() {  if (Micdrop.isStarted) {    Micdrop.stop()    document.getElementById('startStopBtn').textContent = 'Start'  } else {    Micdrop.start()    document.getElementById('startStopBtn').textContent = 'Stop'  }}
```

React example:

```
import { useMicdropState } from '@micdrop/react'
function CallControls() {  const state = useMicdropState()
  const handleStart = () => Micdrop.start({ url: 'ws://localhost:8081/' })  const handleStop = () => Micdrop.stop()
  return (    <button onClick={state.isStarted ? handleStop : handleStart}>      {state.isStarted ? '⏸️ Stop' : '▶️ Start'}    </button>  )}
```

[Previous← React Hooks](/docs/client/react-hooks)[NextPause/Resume Call →](/docs/client/pause-resume-call)

On this page

*   [Starting a Call](#starting-a-call)
*   [Basic Usage](#basic-usage)
*   [Start Options](#start-options)
*   [Starting Microphone First](#starting-microphone-first)
*   [Authentication](#authentication)
*   [Start State Monitoring](#start-state-monitoring)
*   [Start Error Handling](#start-error-handling)
*   [Stopping a Call](#stopping-a-call)
*   [Basic Usage](#basic-usage-1)
*   [Graceful Stop](#graceful-stop)
*   [Stop State Monitoring](#stop-state-monitoring)
*   [Auto-stop on EndCall event](#auto-stop-on-endcall-event)
*   [UI Integration](#ui-integration)
