sip-trunk

n8n custom node for SIP client functionality with Asterisk/Starface PBX integration

Package Information

Downloads: 1 weekly / 78 monthly
Latest Version: 1.0.0
Author: Alf-David Heermann

Documentation

n8n-nodes-sip-client

n8n.io - Workflow Automation

An n8n community node for SIP client functionality, enabling integration with Asterisk/Starface PBX systems and other SIP-based telephony solutions.

Features

  • SIP Registration: Register/unregister with SIP servers
  • Call Management: Make calls, answer calls, hang up, and get call status
  • Messaging: Send SIP messages with custom content types
  • Asterisk/Starface Compatible: Tested with Asterisk-based PBX systems
  • Multiple Transport Protocols: UDP, TCP, TLS, WSS support
  • Secure Connections: TLS encryption support
  • Custom Headers: Add custom SIP headers for advanced scenarios
  • JSON Workflow Integration: Full n8n JSON workflow support

Installation

Community Nodes (Recommended)

  1. Go to Settings > Community Nodes in your n8n instance
  2. Enter n8n-nodes-sip-client in the npm package name field
  3. Click Install

Manual Installation

# Install in your n8n installation directory
npm install n8n-nodes-sip-client

# For Docker installations
docker build --build-arg N8N_VERSION=<version> --build-arg ADDITIONAL_PACKAGES=n8n-nodes-sip-client .

Configuration

Credentials Setup

  1. Add new credentials of type "SIP Client API"

  2. Configure the following required fields:

    • Server Address: Your PBX server domain or IP address
    • Port: SIP server port (default: 5060)
    • Username: Your SIP account username
    • Password: Your SIP account password
  3. Optional configuration:

    • Domain: SIP domain (if different from server address)
    • Transport Protocol: UDP, TCP, TLS, or WSS
    • Secure Connection: Enable TLS encryption
    • Display Name: Display name for outgoing calls

Example Starface Configuration

Server Address: your-starface-server.com
Port: 5060
Username: your_extension
Password: your_password
Domain: your-starface-server.com
Transport Protocol: UDP

Usage Examples

Register with SIP Server

{
  "resource": "registration",
  "operation": "register"
}

Make a Call

{
  "resource": "call",
  "operation": "makeCall",
  "targetUri": "sip:1234@pbx.company.com"
}

Send SIP Message

{
  "resource": "message",
  "operation": "sendMessage",
  "targetUri": "sip:user@domain.com",
  "messageContent": "Hello from n8n!",
  "contentType": "text/plain"
}

Get Registration Status

{
  "resource": "registration",
  "operation": "getRegistrationStatus"
}

Operations

Registration Operations

  • Register: Register with the SIP server
  • Unregister: Unregister from the SIP server
  • Get Registration Status: Check current registration status

Call Operations

  • Make Call: Initiate an outbound call
  • Answer Call: Answer an incoming call (requires call ID)
  • Hang Up: Terminate an active call
  • Get Call Status: Get the status of a specific call

Message Operations

  • Send Message: Send SIP MESSAGE with custom content

Advanced Options

  • Timeout: Set operation timeout in seconds
  • Auto Answer: Automatically answer incoming calls
  • Record Call: Enable call recording (PBX dependent)
  • Custom Headers: Add custom SIP headers for advanced scenarios

Compatibility

Tested PBX Systems

  • ✅ Asterisk (all recent versions)
  • ✅ Starface (Asterisk-based)
  • ✅ FreePBX
  • ✅ 3CX (SIP mode)
  • ✅ Generic SIP servers

Transport Protocols

  • ✅ UDP (default)
  • ✅ TCP
  • ✅ TLS (secure)
  • ✅ WSS (WebSocket Secure)

Troubleshooting

Common Issues

  1. Registration Failed

    • Verify server address, port, username, and password
    • Check firewall settings for SIP ports
    • Ensure the PBX allows registration from your IP
  2. Calls Not Connecting

    • Verify target URI format: sip:extension@domain
    • Check if the target extension exists
    • Ensure proper codec support
  3. Network Issues

    • SIP typically uses port 5060 (UDP/TCP) or 5061 (TLS)
    • RTP ports (audio) typically range 10000-20000
    • Configure NAT/firewall accordingly

Debug Mode

Enable debug logging in your n8n instance to see detailed SIP protocol messages.

Development

Building from Source

git clone https://github.com/ADH-GH/n8n-nodes-sip-client.git
cd n8n-nodes-sip-client
npm install
npm run build

Testing

npm run lint
npm run format

Dependencies

  • sip.js: Modern SIP library for JavaScript/TypeScript
  • n8n-workflow: n8n workflow engine

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Support

Changelog

v1.0.0

  • Initial release
  • Full SIP.js integration with comprehensive error handling
  • SIP registration with auto-renewal and timeout management
  • Complete call management (make, answer, hangup, status)
  • SIP messaging with validation and timeout handling
  • Asterisk/Starface PBX compatibility
  • Multiple transport protocol support (UDP, TCP, TLS, WSS)
  • Enhanced error messages and connection monitoring
  • Real-time call state tracking
  • Custom headers support
  • Comprehensive test configuration examples

Discussion