message.comDevelopers

What is a SIP trunk?

A SIP trunk is a software-defined connection between the public switched telephone network (PSTN) and a phone system running on a server. SIP (Session Initiation Protocol) is the signaling protocol that sets up, manages, and tears down calls. The "trunk" metaphor comes from old telephony, where a trunk was a bundle of physical lines between switches.

Definition

Before SIP, connecting an office phone system to the outside world required physical T1 or PRI circuits provisioned by a telco. The circuits had a fixed channel count. Adding capacity meant ordering more copper and waiting weeks. A SIP trunk replaces those physical circuits with a session over IP. Capacity is software-defined. You buy "channels" (concurrent calls) from a SIP carrier and they deliver calls to your server over the public internet or a private peering link.

How it works

A SIP trunk has two halves:

  • Signaling. SIP messages (INVITE, ACK, BYE) negotiate call setup. They travel over UDP or TCP on port 5060, or TLS on 5061.
  • Media. The actual audio travels as RTP (Real-time Transport Protocol) packets on a separate UDP port range negotiated during the SIP handshake.

When a customer dials your DID, the carrier's switch sends a SIP INVITE to your trunk. Your phone system (or in our case, the message.com call router) accepts, opens an RTP stream, and routes the audio to an available agent.

How we choose carriers

message.com runs its own carrier-grade SIP infrastructure. The relevant criteria when selecting upstream connectivity:

  • Wholesale per-minute pricing rather than retail CPaaS markups.
  • Broad codec support (G.711, Opus).
  • STIR/SHAKEN attestation support. See STIR/SHAKEN.
  • Direct PSTN interconnects rather than reselling another carrier's capacity.
  • Reliable webhook contracts for call lifecycle events.

The carrier delivers call events to our inbound webhook: ringing at INVITE, answered at accept, ended at BYE. Each event maps to a channel: "call" conversation in the workspace queue.

DIDs ride on top

A SIP trunk by itself does not have a phone number. DIDs (direct inward dial numbers)are the actual phone numbers, provisioned separately from the carrier's number inventory and routed to your trunk. One trunk can serve thousands of DIDs.

External reading

For protocol-level depth, see RFC 3261, the original SIP specification published by the IETF.