<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Callmacy Blog]]></title><description><![CDATA[Guides on business phone numbers in 62 countries, cloud phone systems, AI receptionists, VoIP and call routing. Get a virtual number from $3.99/mo at callmacy.com.]]></description><link>https://callmacy.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6b09ff76612acb2b33159211/a4fe9911-9279-492d-a0b2-2d17680678ed.png</url><title>Callmacy Blog</title><link>https://callmacy.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 01:49:24 GMT</lastBuildDate><atom:link href="https://callmacy.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[What Actually Happens When Someone Calls Your VoIP Number: SIP, SDP and RTP Explained]]></title><description><![CDATA[A developer's walkthrough of an inbound call, from the caller's carrier to your app, and how to debug one-way audio.]]></description><link>https://callmacy.hashnode.dev/what-actually-happens-when-someone-calls-your-voip-number-sip-sdp-and-rtp-explained</link><guid isPermaLink="true">https://callmacy.hashnode.dev/what-actually-happens-when-someone-calls-your-voip-number-sip-sdp-and-rtp-explained</guid><category><![CDATA[voip]]></category><category><![CDATA[WebRTC]]></category><category><![CDATA[networking]]></category><category><![CDATA[Telephony]]></category><category><![CDATA[debugging]]></category><dc:creator><![CDATA[Callmacy]]></dc:creator><pubDate>Fri, 27 Nov 2026 22:42:40 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b09ff76612acb2b33159211/608c623e-8b95-4c54-bd07-e1ec690d70b7.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When a customer dials a virtual number and your browser softphone starts ringing a second later, a surprising amount of infrastructure has just cooperated. If you build anything on top of voice (a contact-center tool, an AI agent that answers calls, a CRM click-to-call) you will eventually debug this path. This post walks through it hop by hop.</p>
<h2>1. The number: what a DID really is</h2>
<p>A DID (Direct Inward Dialing) number is an ordinary phone number that a carrier routes to an IP endpoint instead of a copper line or a SIM. The carrier owns or leases the number range, publishes routing for it on the public telephone network (PSTN), and maps each number to a destination you configure: a SIP URI, a SIP trunk or a programmable-voice webhook.</p>
<p>From the caller's side nothing is different. They dial +44 20 7946 0958 and their carrier simply routes the call toward whichever carrier holds that number.</p>
<h2>2. PSTN to SIP: the gateway hop</h2>
<p>Between traditional carriers, calls are still largely set up with SS7/ISUP signaling or carrier-to-carrier SIP interconnects. When the call reaches the carrier that holds the DID, a session border controller (SBC) or media gateway converts it into a SIP dialog toward you.</p>
<p>That is the first point where your configuration matters. The carrier needs to know:</p>
<ul>
<li><strong>where</strong> to send the call (your SIP domain, IP allowlist or credentials)</li>
<li><strong>which transport</strong> to use (UDP/TCP on 5060 or TLS on 5061)</li>
<li><strong>which codecs</strong> you accept</li>
</ul>
<h2>3. The INVITE and the SDP offer</h2>
<p>The call arrives as a SIP INVITE. Trimmed down, it looks like this:</p>
<pre><code class="language-text">INVITE sip:+442079460958@sip.example.com SIP/2.0
Via: SIP/2.0/TLS 198.51.100.10:5061;branch=z9hG4bK776asdhds
From: &lt;sip:+15550100123@carrier.example.net&gt;;tag=1928301774
To: &lt;sip:+442079460958@sip.example.com&gt;
Call-ID: a84b4c76e66710@carrier.example.net
CSeq: 314159 INVITE
Content-Type: application/sdp

v=0
o=- 2890844526 2890844526 IN IP4 198.51.100.20
s=-
c=IN IP4 198.51.100.20
t=0 0
m=audio 49170 RTP/SAVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
</code></pre>
<p>The SIP headers set up the dialog. The body is SDP (Session Description Protocol), and it is the part people misread most often:</p>
<ul>
<li><strong>c=</strong> is the IP address where the sender wants to <em>receive</em> audio.</li>
<li><strong>m=audio 49170</strong> is the port for that audio, and the numbers after the profile are the payload types offered.</li>
<li><strong>a=rtpmap</strong> lines map those payload types to codecs. Here: G.711 mu-law (PCMU), G.711 A-law (PCMA) and RFC 4733 DTMF events.</li>
</ul>
<p>Your side replies with an SDP <em>answer</em> in its 200 OK, choosing one codec and stating its own c= address and port. This is the offer/answer model from RFC 3264.</p>
<h2>4. The dialog: ringing, answer, ACK</h2>
<p>A normal inbound call looks like this:</p>
<pre><code class="language-text">Carrier                      Your endpoint
   | --- INVITE (SDP offer) ---&gt; |
   | &lt;--- 100 Trying ----------- |
   | &lt;--- 180 Ringing ---------- |
   | &lt;--- 200 OK (SDP answer) -- |
   | --- ACK -------------------&gt; |
   | &lt;====== RTP audio =======&gt; |
   | --- BYE -------------------&gt; |
   | &lt;--- 200 OK --------------- |
</code></pre>
<p>Useful failure codes to recognise in logs:</p>
<table>
<thead>
<tr>
<th>Code</th>
<th>Meaning</th>
<th>Typical cause</th>
</tr>
</thead>
<tbody><tr>
<td>401 / 407</td>
<td>Auth required</td>
<td>Credentials or IP allowlist missing</td>
</tr>
<tr>
<td>404</td>
<td>Not found</td>
<td>Number not mapped to a user or route</td>
</tr>
<tr>
<td>408</td>
<td>Request timeout</td>
<td>Endpoint unreachable, firewall dropping SIP</td>
</tr>
<tr>
<td>480 / 486</td>
<td>Unavailable / busy</td>
<td>Nobody registered, or agent busy</td>
</tr>
<tr>
<td>488</td>
<td>Not acceptable here</td>
<td>No codec in common between offer and answer</td>
</tr>
</tbody></table>
<h2>5. The audio: RTP is a separate stream</h2>
<p>Once the dialog is up, voice travels as RTP packets over UDP, usually 20 ms of audio per packet, on the ports negotiated in SDP. With SRTP the payload is encrypted. In browsers, WebRTC always uses DTLS-SRTP and typically Opus.</p>
<p>The key point: <strong>signaling and media take different paths.</strong> SIP can succeed perfectly while audio fails, which is why “the call connects but nobody can hear anything” is the most common VoIP bug.</p>
<h2>6. Why one-way audio happens (and how to fix it)</h2>
<p>Almost every one-way or no-audio case comes down to NAT:</p>
<ol>
<li>Your endpoint sits behind NAT and advertises its <strong>private</strong> address in the SDP c= line, for example 10.0.0.5.</li>
<li>The carrier sends RTP to 10.0.0.5, which goes nowhere.</li>
<li>Your outbound audio still reaches the carrier, so they hear you but you don't hear them.</li>
</ol>
<p>Fixes, roughly in order of preference:</p>
<ul>
<li>Put an SBC or media relay at your edge that rewrites SDP to public addresses.</li>
<li>Use ICE with STUN/TURN for WebRTC clients (built into browsers).</li>
<li>Enable symmetric RTP / comedia on the carrier side so media is returned to the source address of packets it receives.</li>
<li>Open and pin a fixed RTP port range on your firewall instead of relying on dynamic ports.</li>
</ul>
<h2>7. Forwarding to a mobile means two calls</h2>
<p>When an inbound call is forwarded to a mobile number, the platform does not hand the call over. It creates a second outbound leg to the mobile and bridges the two legs. That has consequences:</p>
<ul>
<li>Both legs are usually billed.</li>
<li>Caller ID on the second leg depends on carrier rules; passing through the original caller's number is not always allowed.</li>
<li>Latency adds up across both legs, so keep media anchored as close to the users as possible.</li>
</ul>
<h2>8. Programmable voice: webhooks instead of a PBX</h2>
<p>Modern carrier APIs let you skip running your own PBX. On an inbound call the carrier sends your application a webhook, and you reply with call-control commands such as answer, play audio, gather digits, bridge to another number, stream media to a speech engine or hang up.</p>
<p>This is how AI receptionists are usually built: the call's audio is streamed in real time to speech-to-text, a language model decides the reply, and text-to-speech audio is played back into the call. The hard part is keeping total response time low. ITU-T G.114 recommends keeping one-way mouth-to-ear delay under about 150 ms for comfortable conversation, and every processing step eats into that budget.</p>
<h2>9. A practical debugging checklist</h2>
<ul>
<li>Capture signaling with <strong>sngrep</strong> on your SIP server, or <strong>tcpdump</strong> plus <strong>Wireshark</strong> (Telephony &gt; VoIP Calls can replay RTP).</li>
<li>Read the SDP in both directions. Check the c= addresses are public and reachable.</li>
<li>Confirm a codec exists in both offer and answer. PCMU/PCMA are the safe common denominator on the PSTN.</li>
<li>Check that RTP actually arrives on the negotiated port, in both directions.</li>
<li>For DTMF problems, confirm both sides agree on RFC 4733 events rather than in-band tones.</li>
<li>For call drops around 30 seconds, look for a missing ACK, a classic sign of NAT or a misrouted Contact header.</li>
</ul>
<h2>Wrapping up</h2>
<p>An inbound VoIP call is three separate systems working together: number routing on the PSTN, a SIP dialog that negotiates the session, and an RTP stream that carries the audio. When something breaks, ask which of the three failed. Most of the time the answer is in the SDP.</p>
<hr />
<p><em>We run</em> <a href="https://callmacy.com"><em>Callmacy</em></a><em>, a virtual phone number and AI receptionist service, so these call flows are part of our daily debugging. Questions or war stories about one-way audio are welcome in the comments.</em></p>
]]></content:encoded></item></channel></rss>