DEV Community

Tarun Kumar
Tarun Kumar

Posted on

How I Built a Cloud VoIP System from Scratch on AWS (Kamailio, Asterisk & RTPengine)

๐Ÿง  Why I Built This

I wanted to understand how real-world VoIP systems work beyond theory โ€” especially SIP signaling, call routing, and media handling.

Instead of using managed services, I built a complete VoIP system from scratch using open-source tools on AWS EC2.


๐Ÿ—๏ธ Architecture Overview

I designed a layered VoIP architecture:

  • Client Layer: Linphone (mobile), MicroSIP (desktop)
  • SIP Layer: Kamailio (handles registration & signaling)
  • PBX Layer: Asterisk (handles routing & IVR)
  • Media Layer: RTPengine (handles audio flow)
  • Database: MySQL (stores users)


โš™๏ธ Tech Stack

  • Kamailio (SIP Proxy)
  • Asterisk (PBX)
  • RTPengine (Media Proxy)
  • MySQL (Database)
  • AWS EC2 (Cloud)
  • SIP Protocol

๐Ÿ“ž How Call Flow Works

Example call:

3001 (Linphone) โ†’ Kamailio โ†’ Asterisk โ†’ 3003 (MicroSIP)
Enter fullscreen mode Exit fullscreen mode
  • Kamailio handles SIP signaling
  • Asterisk processes dialplan & routing
  • RTPengine handles RTP audio between endpoints


โœ… What I Implemented

  • SIP user registration & authentication
  • Call routing between users
  • IVR system (extension 1000)
  • Two-way audio with RTP handling
  • NAT traversal using RTPengine

๐Ÿงช Challenges I Solved

๐Ÿ”ง One-way Audio

Problem: Audio only worked in one direction
Fix: Integrated RTPengine for proper RTP handling


๐Ÿ”ง SIP 401 Unauthorized

Problem: Users couldn't register
Fix: Corrected MySQL subscriber configuration


๐Ÿ”ง Port Conflicts

Problem: Kamailio & Asterisk both using 5060
Fix: Moved Asterisk to port 5062


๐Ÿ”ง NAT Issues

Problem: Calls connected but no audio
Fix: Fixed SDP and contact handling


๐Ÿ“‚ Project Repository

๐Ÿ‘‰ https://github.com/Itztarunk51/voip-sip-platform

Includes:

  • Full configs
  • Troubleshooting guide
  • Command reference
  • Screenshots

๐Ÿ“š What I Learned

  • SIP protocol (INVITE, ACK, BYE, REGISTER)
  • Kamailioโ€“Asterisk integration
  • RTP vs SIP and NAT traversal
  • Debugging using sngrep, tcpdump
  • Cloud deployment on AWS

๐Ÿ”ฎ Future Enhancements

  • WebRTC (browser-based calling)
  • Call queues & contact center features
  • Monitoring dashboard (CDR + logs)
  • TLS (SIPS) and SRTP security

๐ŸŽฏ Final Thoughts

This project helped me understand how real VoIP systems work in production environments.

If you're interested in networking, VoIP, or cloud โ€” building something like this is incredibly valuable.


๐Ÿ’ฌ Feel free to connect or share feedback!
linkedin : https://www.linkedin.com/in/tarun-morry-03a278225/

voip #aws #networking #sip #asterisk #kamailio #devops

Top comments (0)