Privacy Tools Guide

Traditional building intercom systems operate over analog lines or unencrypted digital protocols, making them vulnerable to eavesdropping and unauthorized access. For developers and power users seeking better privacy, setting up a secure intercom system using encrypted VoIP technology provides end-to-end encryption, flexible deployment options, and integration with existing network infrastructure.

This guide covers the architectural components, protocol choices, and implementation steps for building a secure VoIP-based intercom system.

Understanding the Security Requirements

A secure intercom system for residential or commercial buildings must address several core security properties:

Traditional VoIP protocols like SIP can be encrypted using TLS for signaling and SRTP (Secure Real-time Transport Protocol) for media streams. This combination provides protection against eavesdropping and man-in-the-middle attacks.

Architectural Components

A self-hosted intercom system consists of four main components:

  1. VoIP Server: Handles call routing, authentication, and registration (e.g., Asterisk, FreeSWITCH, or a lightweight SIP proxy)
  2. Client Devices: IP phones, softphones, or dedicated intercom hardware at each entry point
  3. Network Infrastructure: Local network with VLAN segmentation for security isolation
  4. Encryption Layer: TLS for SIP signaling and SRTP for audio streams

For building applications, the most practical approach uses a lightweight SIP proxy combined with encrypted softphones running on low-cost hardware like Raspberry Pi devices equipped with USB microphones and speakers.

Choosing VoIP Protocols and Encryption Standards

SIP with TLS Transport

The Session Initiation Protocol (SIP) handles call setup, teardown, and negotiation. By default, SIP traffic travels in plaintext. Enabling TLS transport encrypts the signaling layer:

# Example Asterisk configuration for TLS-enabled SIP
[general]
tlsenable=yes
tlsbindaddr=0.0.0.0:5061
tlscertfile=/etc/asterisk/asterisk.pem
tlscafile=/etc/asterisk/ca.crt
tlscipher=ALL
tlsclientmethod=tlsv1.2

[intercom-user]
type=peer
secret=secure_password_here
host=dynamic
transport=tls
context=intercom-incoming

SRTP for Media Encryption

Secure Real-time Transport Protocol encrypts the actual audio stream. Both endpoints must support SRTP and negotiate the encryption keys during call establishment:

# Enable SRTP in Asterisk
[general]
rtpdebug=yes

[intercom-user]
type=peer
secret=secure_password_here
host=dynamic
transport=tls
encryption=yes

When configuring client devices, ensure SRTP is set to mandatory rather than optional. This prevents fallback to unencrypted RTP if negotiation fails.

Setting Up a Lightweight SIP Proxy

For building intercom applications where full telephony features are unnecessary, a lightweight SIP proxy like SIP.js or Kamailio provides sufficient functionality with lower resource requirements.

Using a Minimal Docker-based Setup

A minimal self-hosted intercom server can run in Docker containers:

# Dockerfile for minimal SIP proxy
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y \
    opensips \
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /etc/opensips && \
    echo "listen=tls:0.0.0.0:5061" >> /etc/opensips/opensips.cfg && \
    echo "modparam(\"auth\", \"username_spec\", \"intercom\")" >> /etc/opensips/opensips.cfg

EXPOSE 5061

CMD ["/usr/sbin/opensips", "-F"]
# Docker Compose configuration
version: '3.8'
services:
  opensips:
    build: .
    ports:
      - "5061:5061/tls"
    volumes:
      - ./opensips.cfg:/etc/opensips/opensips.cfg
    networks:
      - intercom-net

  asterisk:
    image: asterisk:latest
    volumes:
      - ./asterisk:/etc/asterisk
    network_mode: host
    depends_on:
      - opensips

networks:
  intercom-net:
    driver: bridge

Client Implementation Patterns

Hardware Intercom Devices

For physical entry points (building doors, lobby), use IP phones or SIP-enabled intercom hardware. Many VoIP door phones support PoE (Power over Ethernet) and can be provisioned via configuration files:

<!-- Example SIP device configuration -->
<sip>
  <server>192.168.1.10:5061</server>
  <transport>TLS</transport>
  <username>door_unit_1</username>
  <password>encrypted_password_here</password>
  <srtp>mandatory</srtp>
  <codecs>opus,g722,pcmu</codecs>
</sip>

Softphone Clients for Residents

Residents can use softphones on smartphones or computers. Linphone, CSipSimple, and MicroSIP all support TLS and SRTP. Configure profiles for your building’s SIP server:

# Linphone configuration for secure intercom
linphonecsh init
linphonecsh register --host 192.168.1.10 --port 5061 --username resident_101 --transport tls

Network Security Considerations

Deploying a secure intercom system requires proper network segmentation:

  1. Create a dedicated VLAN for intercom devices, isolating them from general network traffic
  2. Configure firewall rules to allow only necessary traffic between the intercom VLAN and the server
  3. Disable unnecessary services on intercom devices
  4. Use certificate-based authentication rather than shared secrets where possible
# Example iptables rules for intercom VLAN
# Allow SIP traffic only from intercom VLAN to server
iptables -A INPUT -p tcp --dport 5061 -s 192.168.50.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 5061 -j DROP

# Allow RTP traffic from intercom devices
iptables -A INPUT -p udp --dport 10000:20000 -s 192.168.50.0/24 -j ACCEPT

Testing Encryption

After deployment, verify that encryption is properly configured. Use tools like sngrep to capture SIP traffic and confirm TLS is active:

# Install and run sngrep to verify TLS
sudo apt-get install sngrep
sudo sngrep -l

Look for SIP messages traveling over port 5061 with TLS indicator. For SRTP verification, examine the SDP (Session Description Protocol) offers to confirm RTP/SAVPF profile usage, which indicates SRTP is negotiated.

Maintenance and Monitoring

Regular maintenance ensures continued security:

# Check Asterisk TLS certificate expiration
openssl x509 -in /etc/asterisk/asterisk.pem -noout -dates

Built by theluckystrike — More at zovo.one