API Reference
VueSip provides a comprehensive API for building SIP/VoIP applications with Vue 3. This section covers all composables, types, events, providers, plugins, and utilities available in the library.
Quick Navigation
Core APIs
- Composables - Vue 3 Composition API based functions for SIP functionality
- Types - TypeScript type definitions and interfaces
- Events - Event system for real-time notifications
Extension APIs
- Providers - Vue provide/inject based providers for global state
- Plugins - Plugin system for extending VueSip functionality
- Utilities - Helper functions and utilities
API Overview
Composables
VueSip's primary API surface consists of composable functions that provide reactive state and methods for SIP/VoIP functionality:
| Composable | Purpose | Key Features |
|---|---|---|
useSipClient | SIP client management | Registration, connection state, authentication |
useCallSession | Call session management | Making/receiving calls, call state, media streams |
useMediaDevices | Media device management | Device enumeration, selection, permissions |
useDTMF | DTMF tone generation | Send tones, tone queue management |
useCallHistory | Call history tracking | History storage, filtering, export |
useCallControls | Call control operations | Hold, mute, transfer, merge |
usePresence | Presence tracking | Status updates, buddy list management |
useMessaging | Instant messaging | Send/receive messages, typing indicators |
useConference | Conference calling | Multi-party calls, participant management |
useCallRecording | Call recording | Record calls, manage recordings |
View Composables Documentation →
Types
Complete TypeScript type definitions for all VueSip APIs:
- SIP Types - SIP URIs, headers, responses, authentication
- Call Types - Call states, options, events, statistics
- Media Types - Device info, constraints, stream configuration
- Configuration Types - Client config, transport, ICE/STUN/TURN
- Event Types - All event payloads and handlers
- History Types - Call records, filters, storage
- Transfer Types - Transfer options and states
- Conference Types - Conference configuration and participants
- Presence Types - Presence states and buddy information
Events
VueSip uses an event-driven architecture for real-time notifications:
- Connection Events -
connected,disconnected,connecting,disconnecting - Registration Events -
registered,unregistered,registrationFailed - Call Events -
callStarted,callEnded,callAnswered,callFailed,incomingCall - Media Events -
localStreamAdded,remoteStreamAdded,mediaDeviceChanged - Transfer Events -
transferRequested,transferAccepted,transferCompleted - Conference Events -
participantJoined,participantLeft,conferenceStarted - Presence Events -
presenceUpdated,buddyStatusChanged - Message Events -
messageReceived,messageSent,typingIndicator
Providers
Provider components for global configuration and state management:
- ConfigProvider - Global SIP client configuration
- MediaProvider - Shared media device management
- EventProvider - Centralized event bus
- StorageProvider - Persistence configuration
View Providers Documentation →
Plugins
Extend VueSip functionality with the plugin system:
- Plugin interface and lifecycle hooks
- Built-in plugins for common functionality
- Custom plugin development guide
- Plugin configuration options
Utilities
Helper functions for common tasks:
- Validation - SIP URI validation, configuration validation
- Formatting - Phone number formatting, duration formatting
- Encryption - Credential encryption, secure storage
- Logging - Debug logging, log levels, log filtering
- Storage - localStorage/sessionStorage/IndexedDB helpers
- Constants - SIP status codes, error codes, event names
View Utilities Documentation →
Usage Patterns
Basic Setup
import { useSipClient, useCallSession } from 'vuesip'
const sipClient = useSipClient({
uri: 'sip:user@example.com',
password: 'password',
server: 'wss://sip.example.com:7443'
})
const callSession = useCallSession()With Providers
<template>
<ConfigProvider :config="sipConfig">
<MediaProvider>
<YourApp />
</MediaProvider>
</ConfigProvider>
</template>With TypeScript
import type {
SipClientConfig,
CallOptions,
CallState
} from 'vuesip'
const config: SipClientConfig = {
uri: 'sip:user@example.com',
password: 'password',
server: 'wss://sip.example.com:7443'
}
const options: CallOptions = {
mediaConstraints: {
audio: true,
video: false
}
}Event Handling
import { useEventBus } from 'vuesip'
const eventBus = useEventBus()
eventBus.on('callStarted', (event) => {
console.log('Call started:', event.callId)
})
eventBus.on('incomingCall', (event) => {
console.log('Incoming call from:', event.remoteUri)
})API Design Principles
Composable-First
All functionality is exposed through Vue 3 composables, providing reactive state and methods that integrate seamlessly with your Vue components.
Type Safety
Complete TypeScript definitions ensure type safety throughout your application with full IntelliSense support.
Event-Driven
Real-time events keep your UI synchronized with SIP/VoIP state changes automatically.
Flexible Configuration
Multiple configuration approaches (inline, providers, plugins) to fit different application architectures.
Tree-Shakeable
Import only what you need - unused code is eliminated from your production bundle.
Common Workflows
Making a Call
- Initialize SIP client with
useSipClient - Register with SIP server
- Use
useCallSessionto initiate call - Monitor call events for state changes
- Handle media streams with
useMediaDevices
Receiving Calls
- Set up event listener for
incomingCall - Handle incoming call notification
- Answer or reject using
useCallSession - Manage call state and media
Device Management
- Use
useMediaDevicesto enumerate devices - Request permissions if needed
- Select audio/video devices
- Test devices with preview
- Apply device selection to calls
View Device Management Guide →
Version Compatibility
All APIs in this reference are for VueSip v1.0.0 and later.
For migration guides and changelog, see the GitHub Releases.
Need Help?
- Getting Started - New to VueSip? Start with the Getting Started Guide
- Examples - See working code in the Examples
- FAQ - Check the FAQ for common questions
- Issues - Report bugs or request features on GitHub