n8n node for SIP trunk integration (Twilio, Sipgate, Deutsche Telekom, Gamma, Ecotel) with audio streaming
npm install n8n-nodes-sip-trunkThis is an n8n community node that enables SIP trunk integration for voice calling with support for multiple providers including Twilio, Sipgate, Deutsche Telekom, Gamma, and Ecotel. It provides audio streaming capabilities for integration with services like ElevenLabs.
- Server-Side Implementation: Fully Node.js compatible - works in any n8n installation (Docker, VPS, Cloud, Desktop)
- SIP Digest Authentication: RFC 3261 compliant authentication with automatic challenge-response for all major providers
- NAT Traversal: Built-in STUN support for automatic public IP discovery and NAT traversal
- Multiple SIP Providers: Pre-configured support for Twilio, Sipgate, Deutsche Telekom, Gamma, Ecotel, and custom SIP servers
- Trigger & Action Modes:
- Trigger mode to receive incoming calls
- Action mode to make calls and control existing calls
- Call Operations: Make calls, hangup, get audio recordings
- Real Audio Capture: Direct RTP audio capture and processing on the server
- Audio Streaming: Output audio in base64 format (for ElevenLabs STT) or WebSocket stream for real-time processing
- Built-in Transcription: Direct integration with ElevenLabs, OpenAI Whisper, AssemblyAI, and Deepgram
- Flexible Transport: Support for UDP, TCP, TLS
- WAV Audio Export: Automatic conversion to WAV format (8kHz, 16-bit, mono)
1. Go to Settings > Community Nodes in your n8n instance
2. Select Install a community node
3. Enter n8n-nodes-sip-trunk and install
``bash`
npm install n8n-nodes-sip-trunk
This node is built with pure Node.js components, making it compatible with any n8n installation:
- SIP Protocol: Custom UDP-based SIP client for signaling (REGISTER, INVITE, BYE)
- RTP Audio: Direct UDP socket handling for real-time audio packet capture
- Audio Processing: Server-side WAV encoding using the wav library
- WebSocket Server: Built-in WebSocket server for real-time audio streaming
- Session Management: In-memory session tracking across multiple concurrent calls
Unlike browser-based WebRTC implementations, this node:
- ✅ Works in Docker containers
- ✅ Works on VPS/Cloud servers
- ✅ Works in n8n Desktop
- ✅ No browser environment required
- ✅ Direct RTP packet processing
- ✅ Lower latency and overhead
SIP Digest Authentication (RFC 3261):
- Automatic challenge-response authentication
- Supports MD5 and SHA-256 algorithms
- Handles 401/407 authentication challenges
- Works with all major SIP providers
STUN for NAT Traversal (RFC 5389):
- Automatic public IP/port discovery
- Works behind home/office NAT
- Works in Docker containers
- Multiple public STUN servers configured
- Optional custom STUN server support
How NAT Traversal Works:
``
1. Node starts behind NAT (private IP: 192.168.1.100)
2. STUN request to stun.l.google.com
3. STUN response: public IP 203.0.113.45:52891
4. SIP messages use public IP in headers
5. RTP audio flows directly using discovered address
6. ✅ Calls work from anywhere!
For the node to work properly, ensure:
- UDP ports: Open for SIP signaling (default 5060) and RTP audio (dynamic range 10000-20000)
- Firewall rules: Allow incoming/outgoing UDP traffic
- NAT traversal: STUN enabled by default (configurable)
- Provider compatibility: All major providers supported with proper authentication
All providers use SIP Digest Authentication (RFC 3261). The node automatically handles authentication challenges.
1. Log in to your Twilio Console
2. Navigate to Elastic SIP Trunking → Select or create your SIP Trunk
3. Note your Termination SIP URI (e.g., yourtrunk.pstn.twilio.com)mytrunk.pstn.twilio.com
4. Go to Authentication tab and note your credentials
5. In n8n, configure:
- Provider: Twilio
- SIP Server: Your Termination SIP URI (e.g., or mytrunk.pstn.ashburn.twilio.com)
- Username: Your SIP trunk username
- Password: Your SIP trunk password
- Port: 5060
- Transport: UDP
Important: Each Twilio account has a unique SIP trunk domain. You must enter YOUR specific trunk URI from the Twilio console.
1. Log in to Sipgate
2. Go to Settings > SIP Credentials
3. Create or view existing SIP credentials
4. In n8n, configure:
- Provider: Sipgate
- Username: Your Sipgate SIP ID (e.g., 1234567e0)sipgate.de
- Password: Your SIP password
- SIP Server: (auto-configured)
- Transport: WebSocket Secure (wss)
1. Log in to your Telekom account
2. Navigate to IP-based telephony settings
3. Get your SIP credentials
4. In n8n, configure:
- Provider: Deutsche Telekom
- Username: Your registration ID
- Password: Your SIP password
- SIP Server: tel.t-online.de (auto-configured)
- Transport: TLS or WebSocket Secure
1. Access your Gamma portal
2. Navigate to SIP Trunk settings
3. Get your authentication credentials
4. In n8n, configure:
- Provider: Gamma
- Username: Your SIP username
- Password: Your SIP password
- SIP Server: sip.gamma.co.uk (auto-configured)
- Transport: WebSocket Secure (wss)
1. Access your Ecotel nBSS portal
2. Get your contract number and SIP credentials
3. Note your assigned realm (format: nbss-xxxxxx.sip-ecotel.de)BSS123456
4. In n8n, configure:
- Provider: Ecotel
- Username: BSS + your contract number (e.g., )trunkf.sip-ecotel.de
- Password: Your SIP password
- SIP Server: or trunkd.sip-ecotel.de (auto-configured)
- Port: 5083
- Transport: UDP
- NAT Traversal Options:
- Enable STUN: false (⚠️ Important: Ecotel does not use STUN servers)
Important Notes:
- Ecotel uses specific media ports: UDP 10000-59999 (ensure these are open in your firewall)
- STUN must be disabled for Ecotel connections
- Authentication realm is contract-specific (nbss-xxxxxx.sip-ecotel.de)
- Uses standard SIP Digest Authentication (MD5)
For any other SIP provider:
1. Get your SIP credentials from your provider
2. In n8n, configure:
- Provider: Custom
- SIP Server: Your provider's SIP server hostname
- Username: Your SIP username/URI
- Password: Your SIP password
- Port: Default 5060 (UDP/TCP) or 5061 (TLS)
- Transport: Choose appropriate protocol
1. Add the SIP Trunk node to your workflow
2. Set Mode to "Trigger (Receive Calls)"
3. Configure:
- Audio Output Format: Choose between Base64, WebSocket, or Both
- Auto Answer: Enable to automatically answer incoming calls
- Recording Duration: Set maximum recording time (0 for unlimited)
4. The node will output call data including:
- from: Caller's numberto
- : Destination numbercallId
- : Unique call identifiersessionId
- : Session ID for call controlaudioBase64
- : Audio data in base64 (if selected)webSocketUrl
- : WebSocket URL for audio stream (if selected)
1. Add the SIP Trunk node to your workflow
2. Set Mode to "Action"
3. Set Operation to "Make Call"
4. Configure:
- Phone Number: Destination number in E.164 format (e.g., +1234567890)
- Audio Output Format: Choose output format
- Recording Duration: Set recording time
5. The node will initiate the call and return session information
To end an active call:
1. Set Mode to "Action"
2. Set Operation to "Hangup"
3. Provide the Session ID from the call you want to end
4. The node will terminate the call and return duration information
To retrieve recorded audio from an active or completed call:
1. Set Mode to "Action"
2. Set Operation to "Get Audio"
3. Provide the Session ID of the call
4. Choose Audio Output Format (base64 or WebSocket)
5. The node will return:
- audioBase64: WAV audio encoded as base64 (if base64 format selected)audioFormat
- : "audio/wav"sampleRate
- : 8000 Hzchannels
- : 1 (mono)audioSize
- : Size in bytesduration
- : Call duration in seconds
To use the audio output with ElevenLabs STT:
`json`
{
"workflow": {
"nodes": [
{
"name": "SIP Trunk Trigger",
"type": "n8n-nodes-sip-trunk.sipTrunk",
"parameters": {
"mode": "trigger",
"audioFormat": "base64",
"autoAnswer": true
}
},
{
"name": "ElevenLabs STT",
"type": "n8n-nodes-elevenlabs",
"parameters": {
"operation": "speechToText",
"audioData": "={{$node['SIP Trunk Trigger'].json.audioBase64}}"
}
}
]
}
}
``
[SIP Trunk Trigger] → [ElevenLabs STT] → [Process Text]
``
[Schedule/Webhook] → [SIP Trunk Make Call] → [Save Audio] → [ElevenLabs TTS Response]
``
[SIP Trunk Trigger] → [Switch Node] → [Route Based on Caller] → [Custom Action]
``
[SIP Trunk Make Call] → [Wait/Delay] → [Get Audio Operation] → [ElevenLabs STT]
Example output:
`json`
{
"audioBase64": "UklGRiQAAABXQVZFZm10...",
"audioFormat": "audio/wav",
"sampleRate": 8000,
"channels": 1,
"audioSize": 128000
}
Example WebSocket message:
`json`
{
"sessionId": "abc123",
"audio": "base64_chunk_here",
"timestamp": 1234567890
}
- UDP-based: Requires open UDP ports for SIP signaling and RTP audio
- NAT traversal: May need STUN/TURN configuration for complex network setups
- Memory usage: Audio is stored in memory during recording
- Concurrent calls: Limited by available memory and network bandwidth
- Authentication: Currently supports basic username/password authentication (SIP authentication challenges not yet implemented)
- Codecs: Supports PCMU (G.711 μ-law) and PCMA (G.711 A-law) - most common telephony codecs
`bash`
npm install
npm run build
`bash`
npm run lint
npm test
1. WebSocket connection fails: Ensure your SIP provider supports WebSocket transport
2. Authentication errors: Verify credentials and username format (some providers require full SIP URI)
3. No audio: Check that WebRTC is supported in your environment
#### Twilio
- Use WebSocket Secure (wss) transport
- Ensure you're using the correct regional WebSocket URL
- Account SID as username, Auth Token as password
#### Sipgate
- SIP ID format is usually numeric followed by 'e' (e.g., 1234567e0`)
- Use WebSocket transport for best compatibility
#### Deutsche Telekom
- May require TLS transport
- Check that IP-based telephony is enabled on your account
For issues, questions, or contributions:
- GitHub Issues: [Create an issue]
- Documentation: n8n Community Nodes Docs
MIT
Built with:
- SIP.js - JavaScript SIP library
- n8n - Workflow automation platform