{"id":"twilio-sip-outbound-routing-90742","slug":"twilio-sip-outbound-routing-90742","title":"Why Twilio Blocks Your First Outbound Call","description":"Setting up a SIP desk phone to take inbound calls over Twilio takes only a few lines of TwiML, but making the very first outbound call instantly runs into a wall of permissions. Behind the block lies an industry-wide struggle against international toll fraud, destination-based gating, and regulatory compliance. From the mechanics of SIP registration across edge locations to STIR/SHAKEN call signing, this look under the hood traces what actually happens when voice meets code.","excerpt":"International revenue share fraud costs telecoms ten billion dollars a year, turning every new outbound SIP line into an instant financial risk.","pubDate":"2026-11-23T09:48:02.119Z","tags":["telecommunications","internet-infrastructure","digital-privacy","authentication"],"heroImage":"https://files.myweirdprompts.com/covers/twilio-sip-outbound-routing-90742.png","podcastAudioUrl":"https://episodes.myweirdprompts.com/audio/twilio-sip-outbound-routing-90742.m4a","podcastDuration":"28:03","episodeNumber":6748,"transcript":"Corn: Outbound was the hard part. That's the detail in Daniel's message I keep turning over — he set up his own phone line on Twilio, bought a virtual number, pointed it at his SIP phones, and inbound worked before he'd finished his coffee. Then he tried to make a call and nothing happened. Not a broken config, not a syntax error — a permission. Twilio wanted him to approve the destination country first, plus a stack of compliance steps on top. So he's asking two things, really. What is actually happening in the routing stack once the calls connect, both directions? And what does each layer of it cost — because his working assumption is that Twilio sits about as close to the raw cost of telephony as a civilian can get. Wholesale plus a markup, not a hosted PBX with a bundle of stuff he didn't ask for.\n\nHerman: I'm Herman Poppleberry, and I will confess I've been looking forward to this one, because the answer to the second question is half right in a way that's more interesting than being wrong.\n\nCorn: Half right is the most annoying kind of right.\n\nHerman: It is! The routing stack itself is the reason. There's real machinery between his SIP phone and the carrier, and machinery costs money.\n\nCorn: Before we get into the machinery, let me make sure I've got the shape of Daniel's setup right in my head. He's not running a PBX in a closet. He's got SIP handsets — actual physical phones, I assume — registering directly to Twilio.\n\nHerman: That's my reading. No Asterisk box, no FreeSWITCH, no intermediary server. The phones speak SIP straight to Twilio's edge, and the only \"server-side\" logic is TwiML — the little XML documents that tell Twilio what to do with a call. Which is exactly why his experience is such a clean natural experiment: strip away every piece of telephony software a normal person would run, and what's left is Twilio itself, exposed.\n\nCorn: And it's worth saying what that stripped-down setup still gives him. He's got a real phone number that rings a real handset on his shelf. Anyone with an ordinary mobile can call him and it just works. The old way to get that — a PSTN line into a building — meant dealing with an incumbent telco, installation appointments, physical wiring. He replaced all of it with a credit card and a web console.\n\nHerman: And that's the promise the whole CPaaS industry is built on. The phone number, historically the hardest thing in telecoms to get, became a self-service dropdown.\n\nCorn: And what's left failed on the first outbound call. So let's start with why the outbound call failed in the first place, because the answer isn't technical. It's financial. The plumbing for outbound is nearly identical to inbound — what's different is who's on the hook when it goes wrong.\n\nHerman: That's the core of it. An inbound call to Daniel's number — the risk sits with the caller. They paid for that call. But the moment Daniel's line makes an outbound call, the risk moves to Twilio and to the carriers, because the billing flows the other direction. And there's a specific fraud pattern Twilio is terrified of — international revenue share fraud. Criminals hijack accounts, or sign up with stolen cards, and dial special number ranges that pay the account holder a cut of the per-minute charge. Twilio cites something on the order of ten billion dollars a year in industry losses to toll fraud. Ten billion. The entire gate Daniel hit is about not becoming a conduit for that.\n\nCorn: Walk me through the actual attack, because I think people hear \"toll fraud\" and imagine someone making a lot of long-distance calls for free. It's more structured than that, isn't it?\n\nHerman: Much more structured. The classic version: a fraudster gets control of a phone account — stolen credentials, a hijacked session, a card that will charge back in three weeks, doesn't matter. They then dial specific number ranges in certain countries, ranges where the local carrier pays out a revenue share to whoever terminates the traffic. The fraudster has arranged to be on the receiving end of that share — they or an accomplice operate or rent access to the premium range. So every minute the compromised account dials, money flows from the victim's provider to the fraudster's range. Run it for a weekend before anyone notices, across dozens of hijacked accounts, and you're into serious money. And the provider — Twilio, in this story — has already paid the terminating carrier. They eat the loss when the stolen card collapses.\n\nCorn: And the weekend detail isn't decoration, is it. That's a deliberate timing choice.\n\nHerman: It's the oldest trick in the operational-security playbook — attack when the defenders are asleep. Fraud traffic spikes on Friday nights and holiday weekends precisely because the account owner won't look at their bill until Monday, and by then the terminating carrier has been paid and the money is gone.\n\nCorn: So the calls themselves are the crime scene. The fraudster doesn't need the calls to say anything.\n\nHerman: The audio is irrelevant. It's pure arbitrage — minutes converted into payouts. Which is why the defense isn't better call monitoring, it's destination gating. You can't stop someone from stealing an account, but you can make sure a stolen account can't dial a payout range in the middle of the night.\n\nCorn: So the toggle that blocked his first call is a fraud valve, not a feature toggle.\n\nHerman: Right down to the naming. Voice Geographic Permissions — every country Twilio can call is split into low-risk ranges, which is most ordinary mobiles and landlines, and high-risk ranges, the known toll-fraud prefixes plus premium and shared-cost services. Trial accounts can only call low-risk destinations and expire after thirty days; the high-risk ranges need an upgraded account. Twilio updates the high-risk lists several times a month and doesn't publish the prefixes — there's a console tool where you can check a single number, but you can't just download the list.\n\nCorn: Which is also a defensive choice. Publish the list and you've handed fraudsters a map of exactly which prefixes to enable.\n\nHerman: That, and the list is a moving target. Several updates a month means anything published would be stale within weeks. The tool is built for checking a destination you're about to call, not for auditing a country.\n\nCorn: \"Am I about to be defrauded, one number at a time.\"\n\nHerman: On top of the geographic layer there's the compliance stack. Caller ID, for one — the number you present on an outbound call has to be one you own on Twilio or have verified in the console. You can't just present any number you feel like.\n\nCorn: Spoofing as a paid feature would be a bold product roadmap.\n\nHerman: Then in the US there's STIR/SHAKEN — the call-signing framework. Every outbound call gets signed with an attestation level: A means full attestation, Twilio knows the caller is entitled to use that number; B is partial; C is gateway, which is the \"this came through our network but we can't vouch for the origin\" level. Without an approved Trust Hub business profile and the STIR/SHAKEN trust product, Twilio signs everything C. With them, the US local and toll-free numbers you own get A. And as of the seventeenth of this month, the attestation level for Elastic SIP Trunking outbound calls is returned in the SIP responses, so you can actually see what you're being signed as.\n\nCorn: And the attestation level isn't just decoration either, right? It has downstream consequences for whether the call even gets answered.\n\nHerman: It does. The receiving carrier can look at that signature and decide what to do with it. A C-attested call — origin unverified — is exactly the profile of the spam and robocall traffic that American carriers have been cracking down on. So a call signed C is more likely to get filtered, flagged, or shown with a \"spam likely\" warning on the recipient's screen. For anyone calling a friend in the US from a Twilio number, that's the difference between a conversation and a straight-to-voicemail.\n\nCorn: So the compliance paperwork isn't just Twilio protecting itself — it directly affects whether his calls land.\n\nHerman: That's the bit most self-hosters discover the hard way. They get the plumbing working, make a call, and the person on the other end never picks up because the phone said \"potential spam\" in orange letters.\n\nHerman: Then the last layer: numbers in many countries need a regulatory bundle before you can even hold them — proof of address, identity, sometimes a local presence — and the requirements vary by country, by number type, and by whether you're an individual or a business. Twilio rejects PO boxes and virtual addresses as proof of address. They check.\n\nCorn: So outbound sits behind four gates — geography, caller ID, call signing, and regulatory bundles — and none of them are about whether the call could technically connect.\n\nHerman: None. The technical path was fine the whole time. Now, that path — let me walk it, because it's elegant, and it's the piece Daniel's asking about when he says Twilio is \"doing a lot of simplification on your behalf.\"\n\nCorn: Walk the inbound one first, since that's the one that worked out of the box.\n\nHerman: Inbound: someone dials Daniel's Twilio number from an ordinary phone. The call comes off the carrier network and lands at one of Twilio's edge locations — these are the points where traffic enters and leaves Twilio's network, and for voice they also decide where the media, the actual audio, flows. Named edges include Ashburn in Virginia, Umatilla in Oregon, Dublin, Frankfurt, São Paulo, Singapore, Sydney, Tokyo. From the edge, the number is routed to a Twilio processing region, and Twilio fetches the TwiML attached to that number — the \"a call comes in\" handler, which in Daniel's case is TwiML he wrote himself, sitting in a TwiML Bin or a Function or a webhook. That TwiML says Dial, with the SIP address of his phone. The dial rings the registered device. Done.\n\nCorn: And I want to be clear about how little TwiML that actually is, because \"he wrote TwiML\" makes it sound like a project. It's a handful of lines. The entire inbound brain of his phone system is shorter than most email signatures.\n\nHerman: It can be one element. Dial, sip colon, his address, done. Everything else — the carrier handoff, the media relay, the ringback tone the caller hears — is Twilio's problem. That's the division of labour in miniature.\n\nCorn: And if his phone is registered at several edges?\n\nHerman: All of them ring at once. First one to answer wins. If no device is registered at all, the call fails and the Twilio debugger sends him an alert telling him so. That's a nice bit of the design, actually — the failure has a name and a place to look, it's not just silence.\n\nCorn: Compared to traditional telephony, where the failure mode is a busy tone and a shrug.\n\nHerman: Now outbound. The piece that makes the whole thing work is the registrar. Daniel's SIP phone — at home, ordinary residential internet, no fixed IP — sends a REGISTER message to Twilio. That binds the phone's address of record, which is stable, to its current network location, which is not. Every time his home IP changes, the registration updates the binding. No static address needed. Credentials are checked against a credential list mapped to the SIP Domain, and the registration expiry has to be between six hundred and thirty-six hundred seconds.\n\nCorn: So the phone has to keep renewing its forwarding address, roughly every ten minutes to every hour.\n\nHerman: And the registrar runs at each edge location, with the bindings shared across edges. If Daniel doesn't specify an edge, registration defaults to Ashburn, Virginia. His phone, sitting on a shelf in Jerusalem, is telling a data centre in Virginia where it currently lives.\n\nCorn: I want to sit with that for a second. The default path for a Jerusalem phone call runs through Virginia, and back.\n\nHerman: If no edge is specified, yes. You can pin it — Dublin or Frankfurt would be the sensible picks from here — but the default is Ashburn, which tells you where the bulk of Twilio's customer base sits.\n\nCorn: It's the postal equivalent of every letter in Jerusalem being sorted through a depot in Virginia because that's where most of the world's mail happens to start.\n\nHerman: That's not even a stretch of an analogy — it's close to literally what's happening. The letter's address of record is Jerusalem; the sorting depot just needs to know where to forward it today. And the registrar is the forwarding table.\n\nCorn: Then, when Daniel dials out: his phone sends an INVITE, Twilio challenges it with a 407, Proxy Authentication Required, and checks the response against the credential list. Once authenticated, Twilio fetches the SIP Domain's Voice URL — more TwiML, same as inbound — and that TwiML dials the destination, which has to be in E.164 format. Full international format, plus, country code, number.\n\nHerman: And E.164 is worth a beat, because it's the one place where \"simplification on your behalf\" runs out. Daniel's phone might let him dial zero-two-something locally; the TwiML has to say plus-nine-seven-two and the rest, fully qualified. No country inferred, no trunk prefix stripped on his behalf. The format is the customer's job.\n\nCorn: No 407 challenge on inbound, I notice. The network never asks the incoming caller to prove themselves.\n\nHerman: Because the caller's network already billed them. The authentication burden lands exactly where the money does — outbound is where Twilio could be left holding the bill, so outbound is where it demands credentials.\n\nCorn: The 407 is a bouncer who only checks the coat you might steal.\n\nHerman: One more piece, and it's the one I find most interesting: when that TwiML dials out to the PSTN, Twilio's docs say it uses a global routing database with multiple carriers and multiple paths per destination, chosen for availability. How it picks the carrier for any individual call isn't documented. There's a routing brain in there that nobody outside Twilio has seen.\n\nCorn: Which means when Daniel's outbound call sounds worse on Tuesday than it did Monday, there's no way to know whether a carrier swap did it.\n\nHerman: No way at all. That opacity is the price of the resilience — you get redundancy across carriers, and in exchange you give up visibility into which one you got.\n\nCorn: Daniel's phrase was \"a lot of simplification and routing on your behalf,\" and the honest inventory is: the registrar, the shared edge bindings, the credential challenge, the TwiML fetches on both legs, the carrier selection, and the compliance signing. He registers a phone and writes one TwiML response. Twilio does the other six jobs.\n\nHerman: That's the routing stack. So inbound is open by default and outbound is gated behind fraud and compliance, and now we get to what it all costs — because Daniel's assumption that Twilio is close to raw telephony cost deserves to be tested against actual numbers, and the numbers are published.\n\nHilbert: Hilbert's Mid-Show Haiku. Inbound rings before the paperwork. Outbound waits behind a form. The invoice arrives in three parts.\n\nCorn: Three parts is generous. Let's count them properly.\n\nHerman: Let's do the arithmetic. Twilio's US list prices, as of October — outbound to a US local number is fourteen one-thousandths of a dollar per minute. Call it 1.4 cents a minute.\n\nCorn: Spell it the human way. Fourteen dollars buys a thousand minutes of outbound.\n\nHerman: Fourteen dollars, a thousand outbound minutes, on list pricing. Inbound to a local number is under a cent — about 0.85 cents a minute. Toll-free inbound is the expensive direction, 2.2 cents, because toll-free means the number owner pays for the caller. The SIP interface, which is what Daniel's phones use on the internal leg, is 0.4 cents a minute. A local number is a dollar fifteen a month, toll-free is two fifteen. Volume tiers apply automatically — you don't negotiate, the price just drops as usage grows.\n\nCorn: And that SIP leg is billed on top, isn't it? A call from the world to Daniel's shelf is two legs: the carrier leg into Twilio, and the SIP leg out to his handset.\n\nHerman: Two legs, two meters. The SIP leg never touches a carrier — it stays inside Twilio's network from edge to registered device — so its four-tenths of a cent is about as close as Twilio gets to publishing a price for the machinery alone. It's a useful anchor for everything else we're about to say.\n\nCorn: Now run Daniel-shaped usage through it. He's one person, one line.\n\nHerman: Say a hundred outbound minutes and a hundred inbound minutes a month, one local number. Outbound: a hundred times 1.4 cents, a dollar forty. Inbound: a hundred times 0.85, eighty-five cents. The number itself, a dollar fifteen a month. Total — about three dollars forty. Add the SIP leg to his handsets on each of those two hundred minutes and it's closer to four twenty.\n\nCorn: Three forty a month for a real phone line with international reach. My leaf supplier charges more for postage.\n\nHerman: Now the comparison Daniel's actually asking about. The hosted PBX layer — Quo, which used to be called OpenPhone, is fifteen, twenty-three or thirty-five dollars per user per month depending on tier. RingCentral's Core plan is around twenty. Dialpad Standard around fifteen. Same usage, fifteen dollars and up — four to five times the Twilio bill, and the gap only grows if you barely use the phone, because the seat price is the seat price whether you make one call or a thousand.\n\nCorn: So on the hosted-PBX side of the comparison, Daniel's assumption holds comfortably. What about the wholesale side?\n\nHerman: This is where it wobbles. Telnyx — US outbound on its Voice API is about 0.7 cents a minute. Roughly half Twilio's list rate. Their SIP trunk rate starts at half a cent plus a 0.2 cent platform fee. VoIP.ms is about a cent outbound, 0.9 inbound, numbers around eighty-five cents to a dollar ten a month — sources conflict slightly, but the shape is consistent. Run the same hundred-and-hundred usage on either of those and you land around two to three dollars, versus three forty at Twilio.\n\nCorn: Three forty versus two fifty isn't a different market. But it also isn't the same price.\n\nHerman: And here's the cleanest public signal about what's underneath: Twilio's own margins. Third quarter, reported end of October — revenue of one point five six billion dollars, up twenty percent year on year, non-GAAP gross margin forty-nine percent, down a point from a year earlier. About half of every revenue dollar goes to carriers, cloud infrastructure and other cost of revenue.\n\nCorn: Half. So when Daniel pays fourteen dollars for those thousand minutes, roughly seven of them leave the building.\n\nHerman: Roughly, with a large caveat — that forty-nine percent is blended across messaging, voice, email and software. Twilio doesn't disclose a voice-only margin or what it pays individual carriers, so I can't tell you the exact split on Daniel's specific dollar-forty. The margin dip, incidentally, was blamed on fifty-three million dollars of extra US carrier fees for application-to-person messaging, which Twilio says it passes through at cost — messaging, not voice, but it shows the carrier layer flexing hard enough to move a company-level number.\n\nCorn: The carriers squeezed, and the squeeze showed up in a company report. That's the raw layer making itself visible from two abstractions up.\n\nHerman: There's a useful contrast in Bandwidth — they describe themselves as operating their own network across nearly seventy countries. 2025 revenue of seven hundred fifty-four million dollars, thirty-nine percent GAAP gross margin, fifty-eight non-GAAP. Even the company that owns the pipes has forty percent of revenue consumed by cost of revenue. The carrier layer is real money whether you rent it or own it.\n\nCorn: Which reframes what the Twilio markup buys. It's not a retailer's margin on minutes. It's the salary of the routing stack we just walked through — the registrar, the edges, the credential challenge, the carrier selection brain, the compliance signing, the debugger that names your failures. The seven dollars out of fourteen pays for the machinery; the question is whether the machinery is worth two to one versus Telnyx.\n\nHerman: And that's a real question, not a rhetorical one. What would you actually do, Corn? You've got Daniel's usage — one line, one user, a hundred calls each way.\n\nCorn: Honestly? I'd price it, get annoyed, and stay. Three forty a month isn't worth a migration. Telnyx saves me maybe a dollar a month and costs me an afternoon of re-registering phones and rewriting TwiML — the TwiML is Daniel's own work, and I'm not rewriting someone else's routing logic to save twelve dollars a year. Below some usage threshold, the cheapest option is the one already configured.\n\nHerman: That's the trap of the per-minute comparison — it only bites at volume. A call centre doing a hundred thousand outbound minutes a month pays fourteen hundred in list at Twilio versus seven hundred at Telnyx, and now the afternoon of migration costs negative seven hundred dollars.\n\nCorn: The markup is a flat tax that only the busy notice.\n\nHerman: There's also a middle product worth naming, because it's aimed at people who run their own PBX: Elastic SIP Trunking. US list is about a cent outbound, 0.34 cents inbound. Cheaper than the programmable voice rate, because you're buying the pipe without the TwiML brain — you point your own PBX at the trunk and Twilio mostly routes. Daniel would need an Asterisk or FreeSWITCH box in the middle to use it, which is exactly the thing he's avoided.\n\nCorn: The same company sells you the same minute at two prices, and the difference is how much of the software layer comes attached.\n\nHerman: That's the cleanest demonstration of what you're paying for. The minute itself barely varies — a cent, give or take, everywhere you look. Twilio's programmable voice rate is the minute plus the whole routing stack. The trunking rate is the minute plus less of it.\n\nCorn: The API companies won by selling the plumbing to people who wanted to write their own TwiML, not their own registrars. Daniel is exactly that customer. He wanted to write the routing logic and rent everything below it.\n\nHerman: Twilio's pricing is precise about where that line sits. What it's not precise about — and this is my one real hesitation with the \"close to raw cost\" framing — is the carrier selection. Remember, the routing brain isn't documented. When you can't see which carrier you got, you can't tell whether you got the good path or the cheap path on any given call.\n\nCorn: The point about the brain, though — there's an incentive question hiding in that opacity, isn't there. If nobody can see the carrier choice, the cheapest safe carrier wins every tie.\n\nHerman: \"Safe\" is the load-bearing word. Multiple carriers per destination exist for availability, and a routing system optimizing only for cost would consolidate to one carrier per destination, which would be fragile. So the redundancy constrains the cheapness. But yes — within the safety margin, cost optimization with no customer visibility is the natural behavior of a system like that.\n\nCorn: I'd optimize the same way if I ran it. Quietly and in Virginia.\n\nHerman: To be fair to Ashburn, it's only the default — Dublin's a ping away and the edge list is right there in the docs. Though I notice you never changed yours either.\n\nCorn: The default and I have an understanding. It works and I nap.\n\nHerman: On the economics, then, where does this leave Daniel's assumption? Nearer wholesale than hosted PBX — comfortably, provably. Near raw cost — no. Double Telnyx's outbound list rate, a blended gross margin around half, and no voice-only disclosure that would let you check the exact number. He was half right, and the half he got wrong is the interesting half, because the markup isn't padding. It's the routing stack, itemized invisibly.\n\nCorn: The one belief I'd most want to correct, though, isn't about price — it's about the failed first call. Anyone setting this up assumes outbound didn't work because outbound is technically harder. It isn't. The paths are nearly mirror images of each other. Outbound failed because of who bears the risk — the fraud gates, the caller ID verification, the attestation signing, the regulatory bundles. Inbound worked out of the box because the caller pays, not Twilio.\n\nHerman: The difficulty Daniel experienced was never in the plumbing. It was in the paperwork, and the paperwork is load-bearing.\n\nCorn: The open question, and it's a genuine one: if the routing stack is what the markup pays for, what happens as that stack commoditises? Telnyx already sells the same minute for half. If the registrar-and-edges layer becomes table stakes everywhere, Twilio's margin has to compress — unless the compliance side keeps growing, and every sign says it will. STIR/SHAKEN attestation levels showing up in SIP responses as of this month is the tell: the layer nobody wanted to think about is being pushed out where customers can see it, and visible complexity is billable complexity.\n\nHerman: Producer credit where it's owed — Hilbert Flumingtop at the desk, as ever. If you want more of this, try episode ninety-one, The Story Behind the Show; episode forty-six oh nine, The PBX Ledger; and episode five, Fine-Tuning ASR For Maximal Usability. This has been My Weird Prompts. If the episode earned its three dollars forty, tell a friend, or leave us a review at my weird prompts dot com. We'll be back soon.\n\nCorn: Until then, check your geographic permissions. Even the ones inside the flat.","showNotes":"Replacing traditional telecom infrastructure with cloud telephony looks deceptively simple, but the real complexity lies in what happens behind the scenes. While configuring physical SIP handsets to accept inbound calls through Twilio requires minimal TwiML instructions, outbound calling reveals an elaborate defensive architecture. Telcos face massive exposure to international revenue share fraud, an arbitrage scheme that costs the industry billions annually by dialing payout ranges over weekends. Consequently, outbound calls must pass strict non-technical hurdles: Voice Geographic Permissions, caller ID verification, local regulatory documentation, and STIR/SHAKEN call-attestation signing to avoid spam labeling. Behind these gates, the routing stack balances media across global edge locations, maintaining dynamic device registrations through continuous registrar updates.","promptSanitized":"When Daniel set up Twilio, inbound calls to his SIP phones worked out of the box but outbound didn't: Twilio makes you approve countries and clear compliance steps first. Once calls connect, what's actually happening in the routing stack, inbound and outbound? And is Twilio really close to the raw cost of telephony, a markup over the carrier layer but much nearer wholesale than bundled hosted PBX? What does Twilio itself run and pay for to make the routing possible?","transcriptUrl":"https://episodes.myweirdprompts.com/transcripts/twilio-sip-outbound-routing-90742.md","url":"https://myweirdprompts.com/episode/twilio-sip-outbound-routing-90742/","_links":{"self":"https://myweirdprompts.com/api/episodes/twilio-sip-outbound-routing-90742.json","html":"https://myweirdprompts.com/episode/twilio-sip-outbound-routing-90742/","audio":"https://episodes.myweirdprompts.com/audio/twilio-sip-outbound-routing-90742.m4a"}}