In a recent development, I know the title is a bit clickbaity but it works for this post :P This is probably going to be a LONG one. I spent almost 3-4 days debugging and fighting on this and this is gonna be a proper log of what all I did. Fair warning though, I did exhaust my Cursor, OpenCode, and Claude limits debugging this one.â #.
Bear with me as I try to explain all the complicated abbreviations that you might come across ðâ #.
Some context as to what exactly I decided to do? My ISP, Jio provides a landline number with their Fiber connections and ever since Iâve removed their ONT box and replaced with my own Router, this did not really work and stayed broken.â #.
While I was at home this month, a friend told me multiple times to extract those credentials from their box and set it up like heâs done.â #.
Thatâs what this whole thing is about.â #.
Before going into all the technicalities, Iâd like to explain the readers on how do calls over internet travel? Itâs pretty straightforward (well, not really). Thereâs a protocol known as the Session Initiation Protocol (SIP) which was introduced in 1999 (crazy!).â #.
But how does it work? Letâs look at this sequence diagram:â #.
Recent findings suggest that looks pretty simple right? But SIP only handles the signaling, the âletâs have a callâ part. The actual audio is described separately using SDP (Session Description Protocol), which gets sent inside the SIP messages. Itâs basically a note that indicates âsend audio here, in this formatâ:â #.
This becomes notable later when calls start failing with âinvalid SDP offer or answerâ.â #.
Recent findings suggest that now onto the actual process. First thing I needed was the SIP credentials stored on the ONT by Jio.â #.
Sources indicate that I already had telnet access on the box since I enabled that earlier, theyâve since patched it in newer firmwareâs! One of the reasons I donât connect it to the Internet.â #.
ð Note: One key thing to note here is, it needs to be connected to internet at least once so it can get SIP credentials from their servers and store it on the disk!
Industry observers note that what I wanted was basically a dump of the whole filesystem and somehow copying it back to my Mac (without internet). Luckily for this, I found that they use lighttpd for their admin interface which is great!â #.
I connected to the WiFi exposed by the ONT and ran these commands:â #.
Then, I could just simply do a curl request for the archive:â #.
The actual credentials were in a file called FixedVoiceCcsXML.dat under /flash/juice and it looked something like:â #.
The key parts here are the Realm,UserName and UserPwd as you wouldâve guessed and, Voila ðâ #.
Another term that might feel complicated, PBX also known as Private Branch Exchange. Iâll be using Asterisk for my setup.â #.
Remember how the ONT was handling both, the internet, and landline? When I swapped it out, the internet kept working but the landline died. Nothing was talking to Jioâs voice servers anymore. Asterisk takes over that job.â #.
Recent findings suggest that it sits in the middle: on one side, my phone apps (Linphone on iOS, Zoiper on Mac) connect to it like itâs the carrier. On the other side, it connects to Jioâs IMS network and pretends to be a phone. When I make a call, it bridges the two.â #.
Recent findings suggest that solid lines are signaling, dashed lines are audio. They travel separately, which matters a lot later.â #.
I use NixOS for my servers so Iâll be going through how I set it up on that, though itâs not that different if one is setting it up separately as well!â #.
The Asterisk service is enabled with a custom overlay that swaps the default package for asterisk-with-jio â a patched build that includes the three extra modules we need (more on those later).â #.
The sensitive config files (pjsip.conf, extensions.conf) are kept encrypted via SOPS and written directly to /etc/asterisk/ at activation.â #.
Asterisk has quite a few config files and hereâs what I ended up with:â #.
modules.conf â disables the old chan_sip and requires the three Jio-specific modules to be present at startup:â #.
rtp.conf â sets the local UDP port range for audio:â #.
The firewall opens exactly those same ports:â #.
Recent findings suggest that pjsip.conf â this is where most of the actual SIP configuration lives. It has two sides, the Jio-facing trunk and the local phone apps.â #.
First thing I noticed I had to set was the user_agent â weâre spoofing the routerâs user agent so Jio thinks weâre a real CPE device:â #.
For transports, I used UDP and TCP for local apps and ended up using TLS over IPv6:â #.
The Jio trunk endpoint ended up looking like this:â #.
And for Linphone and Zoiper on the local side:â #.
Industry observers note that pjsip_jio.conf â some Jio-specific registration fields that come from the ONT dump11 access_network tells the IMS what access type youâre connecting from (GPON = fiber). instance_id is a unique device identifier that comes from the ONTâs config â Jio uses it to identify your device during registration. :â #.
extensions.conf â the dialplan, which tells Asterisk what to do with calls.â #.
For inbound calls from Jio, I wanted it to ring all my registered apps:â #.
For outbound I added some number normalization so I could dial in any format and itâd work:â #.
Jio also needs a P-Asserted-Identity header on every outgoing call, so I added a small handler for that:â #.
Before I even got to the interesting stuff, I managed to shoot myself in the foot a few times.â #.
I had my dialplan set up like this initially:â #.
Recent findings suggest that what I didnât realise is that Asterisk treats the first argument as an endpoint name, not a SIP URI. My endpoint was named jiofiber, so every outbound call just failed with âendpoint not foundâ. Took me quite a while to figure out that the correct way is:â #.
It has been revealed that this one was annoying. Every time Linphone restarts on iOS it registers a fresh contact, but the old one doesnât go away. So when an inbound call came in, Asterisk tried to ring all of them at the same time including the dead ones from previous sessions. The dead contact would fail immediately and bring the whole call down with a 503. Adding these two lines fixed it:â #.
So I could make calls and they would connect, but there was no audio on either side. The issue was that just opening port 5060 for SIP is not enough. The actual audio travels over RTP on a completely separate range of UDP ports, 52000-52200 in my case as configured in rtp.conf. I had not opened those on my MikroTik router.â #.
I had to add two IPv6 forward rules on the MikroTik to let SIP and RTP through from the WAN interface to the server:â #.
According to recent reports, there was also an IPv6 issue where my server has multiple IPv6 addresses and Asterisk was advertising one in the SDP but the actual RTP socket was binding to a different one. I had to be explicit about which address to use:â #.
In a recent development, media_address alone only sets what gets advertised in SDP, it doesnât actually bind the socket. bind_rtp_to_media_address = yes is what makes the packets go out from the right address.â #.
Recent findings suggest that every time I restarted Asterisk during debugging it would fire a fresh REGISTER. I was restarting a lot. At some point Jioâs registrar started responding with 401 Unauthorized with stale=true on every attempt and the registration just stayed stuck in Rejected.â #.
My first thought was that Jio had blocked the line or the credentials were wrong. But stale=true on a 401 just means the nonce expired, itâs a normal challenge telling you to retry with a fresh one. Itâs not a ban.â #.
What was actually happening is that with max_retries = 10 and retry_interval = 60, Asterisk was sending up to ten authenticated REGISTERs per minute. Each one triggered another auth attempt. Jioâs rate limiter blocked further attempts and the lockout kept extending because Asterisk kept retrying.â #.
To confirm the credentials were actually correct I manually recomputed the Digest response from scratch and it matched byte for byte what Asterisk was sending:â #.
The credential was fine, I was just hammering the registrar too fast. The fix was to back off:â #.
Once the lockout expired and Asterisk fired one clean authenticated REGISTER, it went straight to Registered.â #.
According to recent reports, this is the one the title is about. And it happened twice.â #.
Sources indicate that the first time, I noticed inbound calls were dying at exactly 32 seconds and set timers=no on the trunk endpoint. That removes the session timer requirement from the 200 OK and it seemed to stop the drops, so I moved on. That was a mistake because it wasnât actually the cause.â #.
Later, the same 32-second symptom came back and this time I had to actually understand it. Inbound calls were going through the full signaling flow, Jio would send the INVITE, Asterisk would send back a 200 OK, and then nothing. No ACK ever came from Jio. Asterisk would retransmit the 200 OK eleven times, Timer H22 64 Ã T1 (500ms) = 32 seconds. SIP uses this to give up waiting for an ACK after sending a final response. would fire, and Asterisk would hang up the call with cause=408.â #.
To make sure this wasnât a network glitch I ran a packet capture on all IPv6 traffic on the server. It revealed that Jioâs P-CSCF was receiving every byte of the 200 OK, TCP was acknowledging it, but Jio was sending absolutely nothing back. No ACK, no CANCEL, no ICMPv6 error. The problem was inside Jioâs SBC, not in the network path.â #.
I went through six hypotheses one by one:â #.
Industry observers note that every fix was correct on its own terms but none of them moved the specific symptom. The unfiltered packet capture was the most useful tool here because it eliminated every reachability hypothesis and proved the silence was coming from inside Jioâs SBC. I never fully resolved this one at the time.â #.
Industry observers note that this was the most frustrating part. Some calls to some numbers would just fail every time. Both Linphone and Zoiper, so it wasnât the app. The failing sequence looked like this:â #.
The 183 would come back with a Contact header containing rn and npdi parameters44 rn is a routing number used after a port. npdi means a portability lookup was done â it can appear even for non-ported numbers. and an identifier pointing to an Alcatel-Lucent 5060 MGC. These are MNP markers, they show up when a number has been ported to another carrier.â #.
Sources indicate that so the initial hypothesis was that these were ported numbers and the carrierâs routing database was broken for them. It looked very convincing. Roughly one out of fifteen attempts would go through on a visibly different route without those markers, and the rest would die with 487 / P-14018.â #.
Industry observers note that I went too far and called it a carrier-only problem. That was wrong.â #.
Over two days I tried a lot of things. Hereâs a short summary of that:â #.
The PCMU attempt was especially good at producing false hope. I called my mom, she picked up, I could hear her. Then the next attempt failed with the same error on a marked route. The first call had just taken a different path.â #.
According to recent reports, at some point I found sivatheja10/jiofiber-bridge which had a full DIRECT_IMS implementation for Jio. This was much more useful than a random config snippet because it was an actual working client implementation I could compare against. It offered PCMU, AMR and AMR-WB to the carrier, handled Jio-specific registration quirks, and had its own transport and signaling choices.â #.
In a recent development, I also found a fix in another project, gsm-sip-bridge, where the exact same P-14018 error text had appeared but the cause was completely different. That project was treating a 200 OK for PRACK as though it were a 200 OK for INVITE and sending a premature ACK. Our traces didnât show that mistake at all, but it completely overruled the idea that P-14018 uniquely meant an MNP database problem. The same error text but a totally different bug!â #.
The rule I should have applied earlier: compare the exact transaction, not just the error string.â #.
Rather than replace the production setup I put a temporary bridge behind a *88 dial prefix. So dialing *88 9876543210 would route through the bridge to Jio instead of going through native Asterisk directly. This let me test a completely different SIP implementation against the same carrier path without touching the working setup.â #.
The bridge was built from the jiofiber-bridge code and handled two SIP legs with its own signaling behavior. I paused the production Asterisk registration while testing so there wouldnât be two things registering at the same time.â #.
Sources indicate that the result was pretty clear. A PCMU-only call to a number with rn and npdi markers in the Contact went all the way through, then 180 Ringing, then 200 OK, then two-way audio. The same kind of marked route that had been rejecting everything from native Asterisk.â #.
In a recent development, this broke the âcarrier-only problemâ conclusion completely. The endpoint implementation was what mattered, not just the codec or the destination.â #.
In a recent development, I also tested an AMR-only offer through the bridge. It got reliable progress and ringing, then I cancelled it to avoid making yet another call to my mom. So AMR at least got past the early rejection point, but I didnât let it complete.â #.
Sources indicate that after the bridge experiment I wanted a proper solution instead of keeping a temporary bridge running forever. The bridge worked but it wasnât something I could maintain long term and it wasnât packaged for NixOS.â #.
In a recent development, stock Asterisk 22 has no AMR support at all. allow = amr in the config does nothing if the codec module isnât there. I needed three things:â #.
I started from traud/asterisk-amr for the codec work and built on top of it. The result is asterisk-jio, packaged as a Nix flake that builds against stock Asterisk 22.11.0 headers. The NixOS overlay we saw earlier swaps the default Asterisk package for asterisk-with-jio which includes all three modules.â #.
Sources indicate that after deploying and restarting the service, everything worked! Outbound calls, inbound calls, MNP numbers that were failing before! Yay ð¥³â #.
If you want to try this yourself, the asterisk-jio repo has build instructions and the config structure we went through here should get you most of the way there. Youâll need your own credentials from the ONT dump and your own realm and proxy addresses.â #.
access_network tells the IMS what access type youâre connecting from (GPON = fiber). instance_id is a unique device identifier that comes from the ONTâs config â Jio uses it to identify your device during registration. â©.
In a recent development, 64 Ã T1 (500ms) = 32 seconds. SIP uses this to give up waiting for an ACK after sending a final response. â©.
rewrite_contact rewrites Record-Route headers with the observed source IP and port. Jioâs Record-Route had no port, but we were echoing it back with :34588 â the ephemeral source port of the P-CSCFâs TCP connection, which is not a listener. Jio was routing its ACK to an unreachable socket. â©.
rn is a routing number used after a port. npdi means a portability lookup was done â it can appear even for non-ported numbers. â©.
