Two-Way IoT Audio Communication with WebRTC and SIP – Sub-300ms Latency

Ivan, owner of a smart intercom, complained: the app transmitted sound with a delay of about 900 ms. Conversations turned into chaos. We migrated him to WebRTC — RTT dropped to 200 ms, reducing latency by 78%. Our 5+ years of proven experience shows that choosing the right stack solves 80% of echo a

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Two-Way IoT Audio Communication with WebRTC and SIP – Sub-300ms Latency
Complex
~1-2 weeks

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    897
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    784
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1219
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1081
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1004
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    600

Ivan, owner of a smart intercom, complained: the app transmitted sound with a delay of about 900 ms. Conversations turned into chaos. We migrated him to WebRTC — RTT dropped to 200 ms, reducing latency by 78%. Our 5+ years of proven experience shows that choosing the right stack solves 80% of echo and latency issues.

Intercoms, baby monitors, walkie-talkies — common denominator: the phone hears the device and simultaneously speaks into it. Unlike a regular VoIP call between two phones, here one side is an embedded Linux microcomputer (ESP32, Raspberry Pi, NXP i.MX) that does not support SIP or WebRTC without additional software. This fundamentally changes the choice of architecture. For intelligible speech, RTT must not exceed 300–400 ms, otherwise dialogue becomes impossible. We have helped 30+ clients solve this problem.

How to Ensure Minimal Latency

Round-trip time (RTT) for intelligible speech should be no more than 300–400 ms. HLS and RTMP are not suitable. SIP is possible but has protocol overhead. WebRTC was designed specifically for this scenario. WebRTC establishes connections 3 times faster than SIP due to ICE + STUN. A typical WebRTC project starts at $2,000, saving up to 40% on infrastructure compared to SIP servers.

IoT device side: libwebrtc on Linux or specialized solutions: aiortc (Python), Pion (Go), GStreamer with webrtcbin plugin. Pion is minimal and easy to deploy on Raspberry Pi. GStreamer webrtcbin — if the device already uses GStreamer.

Mobile app side:

iOS: GoogleWebRTC (pod 'WebRTC-SDK') or native WebRTCFramework. Create RTCPeerConnection with audio track:

let audioConstraints = RTCMediaConstraints(mandatoryConstraints: nil, optionalConstraints: nil) let audioSource = factory.audioSource(with: audioConstraints) let audioTrack = factory.audioTrack(with: audioSource, trackId: "audio0") peerConnection.add(audioTrack, streamIds: ["stream0"]) 

Configure RTCAudioSession with .voiceChat category — automatically enables echo suppression and noise suppression (AEC/NS) built into WebRTC.

Android: io.getstream:stream-webrtc-android or org.webrtc:google-webrtc. AudioManager.MODE_IN_COMMUNICATION is mandatory for correct audio routing (earpiece/speakerphone).

Flutter: flutter_webrtc. Configure mediaConstraints for audio:

final Map<String, dynamic> mediaConstraints = { 'audio': { 'echoCancellation': true, 'noiseSuppression': true, 'autoGainControl': true, } }; 

Echo Cancellation: The Main Pain of Two-Way Audio

Without AEC (Acoustic Echo Cancellation): the phone's microphone picks up sound from the speaker (or vice versa — the device hears itself) — the user hears echo with 200 ms delay. Unusable.

WebRTC includes built-in AEC3 (third generation). It works automatically when the audio session category is set correctly. Problems arise when:

  1. The IoT device does not support an echo reference path — then AEC on the device side is ineffective. Solution: offload AEC to the server side (media server with processing enabled).
  2. Bluetooth headset + WebRTC — on Android AudioManager in COMMUNICATION mode switches BT profile to HFP (narrowband 8 kHz). For wideband audio, A2DP is needed, but it does not support recording. Compromise: either low quality with BT, or AirPods/wired headphones.

Why WebRTC is Better than SIP for IoT

Parameter WebRTC SIP
Connection setup time <500 ms 1–3 s
Server requirements STUN/TURN SIP server (Asterisk)
Echo cancellation Built-in AEC3 Depends on implementation
NAT Traversal ICE (automatic) Requires configuration

WebRTC does not require server registration and establishes connections faster. SIP is indispensable when integrating with existing telephony (e.g., Grandstream IP intercoms). According to RFC 7874, WebRTC with Opus codec provides speech quality comparable to PSTN.

SIP as an Alternative

If the IoT device supports SIP (many IP intercoms: Grandstream, Panasonic, Commax), use a SIP client on mobile.

iOS: PJSIP (C library) with Swift wrapper or Linphone SDK. Android: MjSip or PJSIP via JNI, or the ready-made Linphone SDK for Android. Flutter: sip_ua (Dart SIP, works over WebSocket transport).

SIP on mobile requires registration on an Asterisk/FreeSWITCH server. Call from intercom → SIP INVITE → server → push notification to phone (via CallKit on iOS, ConnectionService/IncomingCallNotification on Android). Without push, the notification does not arrive when the app is closed.

CallKit (iOS): incoming call appears as a regular phone call — full-screen interface with the intercom name. CXProvider, CXCallUpdate — standard integration. Requires voip Background Mode in Info.plist + APNs VoIP certificate.

Android ConnectionService: analogous to CallKit. TelecomManager.addNewIncomingCall() — shows system incoming call interface. Works from Android 6+.

Environmental Noise and Aggressive Noise Suppression

Outside wind, construction nearby — the IoT device sends a noisy stream. Additional noise suppression: RTCRtpSender with RTCDefaultVideoEncoderFactory — audio only. WebRTC RNNoise is integrated into native WebRTC and enabled via AudioProcessing::Config::NoiseSuppression.

For heavy server-side processing: Janus with janus_audiobridge plugin applies noise suppression before mixing.

Step-by-Step WebRTC Setup on IoT Device

  1. Install Pion library on the device (Go): go get github.com/pion/webrtc/v3.
  2. Configure ICE using a public STUN server (e.g., stun:stun.l.google.com:19302).
  3. Create an audio track with Opus 48000 Hz parameters.
  4. On the mobile app side, create RTCPeerConnection and add an audio track.
  5. Exchange SDP offer and answer via a signaling server (WebSocket or MQTT).
  6. Test the connection: use Coturn for testing the TURN server.

Testing

The main challenge: simulating NAT traversal in a test environment. Use Coturn in Docker for local TURN testing. Test on symmetric NAT (corporate network with strict rules) — mandatory. Without a TURN server, approximately 15–20% of connections will not establish.

Timeline: two-way WebRTC audio with IoT device (Linux/Pion) + iOS or Android client — 5–7 business days. With SIP integration and CallKit — 8–12 days.

What's Included

  • Documentation for WebRTC/SIP integration into your app.
  • Source code repositories (iOS/Android/Flutter + IoT).
  • Deployment instructions for the device.
  • Support for 2 weeks after delivery.

With over 5 years of proven expertise in IoT audio communication, we guarantee reliable, low-latency connections. We have completed 30+ projects with two-way audio, from intercoms to industrial talkback devices. Infrastructure savings up to 40% compared to SIP servers. Get a consultation on your project — contact us.