Connect a SIP Trunk (BYOT)

Route calls from your own carrier straight to your Dialgem voice agent — your number, your trunk, Dialgem's AI.

Route calls from your own carrier straight to your Dialgem voice agent — over your number, on your trunk. You keep the carrier relationship; Dialgem provides the AI.

code
Your number → Your SIP trunk → Dialgem edge → Your agent

Dialgem never sees your carrier API keys. We authenticate the SIP trunk, route the call to your agent, and run the conversation. Nothing else.

BYOT vs managed numbers

BYOT connects via SIP trunking (e.g. Twilio Elastic SIP Trunking) — not the Media Streams webhook path used for Dialgem-managed Twilio numbers. This guide is for bringing your own carrier/trunk. Everything below happens on the Phone Numbers page; there is no separate trunk-management screen.

What you'll need

RequirementDetail
A number on a SIP trunkA DID on Twilio Elastic SIP Trunking (or any SIP-compatible carrier).
Carrier admin accessPermission to set your trunk's origination URI and credentials.
Admin role in DialgemOwner or admin in the organization the number belongs to.

Setup takes about five minutes.

Set it up

Two systems to touch: configure the number in Dialgem, then point your carrier at it.

Configure the number for SIP trunking (in Dialgem)

Open Phone Numbers. To bring a new DID, use Connect via SIP trunking; to switch an existing custom number over, open it and use its SIP outbound trunk block. Either way, one dialog holds everything:

  • Phone Number — your DID in E.164 (e.g. +14155550123).
  • Termination URI — not the Dialgem SIP server. This is your own carrier's endpoint that Dialgem dials into for outbound calls (e.g. acme.pstn.twilio.com).
  • SIP Trunk User Name / SIP Trunk Password — encouraged. This one credential pair does double duty: it's the identity FreeSWITCH authenticates a digest-capable carrier's inbound INVITE against, and what Dialgem presents when dialing out to your termination URI. (Twilio does not send credentials on origination; see step 3.)
  • Nickname — optional, for your own reference.
  • Outbound Transport — TCP, UDP, or TLS; must match what you configure on the carrier side.

The password is encrypted at rest and never shown again — store it somewhere safe.

Construct your origination URI (for your carrier)

Dialgem doesn't display a per-number origination panel — you build the URI yourself from a fixed pattern, using the same DID and transport you just entered:

code
sip:+14155550123@sip.dialgem.com;transport=tcp

Put your DID in the user part — that's how we know which call belongs to which agent. Replace +14155550123 with your DID in E.164, and transport=tcp with the outbound transport you chose in step 1.

Point your trunk at Dialgem (in your carrier)

In your Twilio Elastic SIP Trunk (Origination settings):

  • Set the Origination URI to sip:sip.dialgem.com;transport=tcp
  • Attach your DID to this trunk

Twilio does not authenticate on origination (its credential lists apply only to termination), so there is nothing to enter there. Dialgem recognises Twilio's signalling addresses and routes the call by the dialed number. A carrier that does answer a digest challenge uses the SIP Trunk User Name / Password you entered on the Phone Numbers page.

Assign the answering agent (in Dialgem)

Still on Phone Numbers, select your DID and set its Inbound call agent to the agent you want to answer. This mapping is what turns an incoming number into a live conversation.

Place a test call

Dial your number from any phone. Your agent should pick up within a second or two. Watch the call appear under Calls with its live transcript.

Routing multiple DIDs through one trunk

Give each DID its own origination entry — sip:+1DID@sip.dialgem.com — so every call matches the right agent. The DID must be in the user part; a host-only URI has no number to match, so the call is refused. Each DID is still configured independently on the Phone Numbers page.

What happens on a call

Once configured, every inbound call runs this path automatically. The sequence, from caller to agent:

code
Caller          Your carrier      Dialgem edge (SIP)     Media bridge      Your agent
  │                  │                     │                    │                 │
  │ dials +1 415…    │                     │                    │                 │
  │ ────────────────▶│                     │                    │                 │
  │                  │ SIP INVITE to       │                    │                 │
  │                  │ sip:+14155550123@…  │                    │                 │
  │                  │ ───────────────────▶│                    │                 │
  │                  │        Authenticate: look up trunk by    │                 │
  │                  │        username, decrypt password,       │                 │
  │                  │        verify SIP digest                 │                 │
  │                  │        Route: dialed # → org → inbound   │                 │
  │                  │        agent, answer                     │                 │
  │                  │                     │ fork audio         │                 │
  │                  │                     │ (raw 16kHz PCM/WS) │                 │
  │                  │                     │ ──────────────────▶│                 │
  │                  │                     │                    │ bridge to agent │
  │                  │                     │                    │ STT → LLM → TTS │
  │                  │                     │                    │ ───────────────▶│
  │◀───────────────── stream speech back (barge-in handled live) ────────────────│

Step by step:

  1. Dial. A customer calls your DID; your carrier receives it on the trunk.
  2. INVITE. The trunk sends a SIP INVITE to sip:+14155550123@sip.dialgem.com, hitting the Dialgem SIP edge (FreeSWITCH).
  3. Authenticate. For a carrier that answers a digest challenge, we look up your trunk by its username, decrypt the stored password, and verify the challenge; wrong or unknown credentials are rejected here. A carrier that authenticates by source address, such as Twilio, is recognised by that address instead.
  4. Route. We read the dialed number, match it to your organization and its assigned inbound agent, and answer the call.
  5. Audio handoff. Call audio streams to the media bridge as raw 16 kHz PCM over a WebSocket — no transcoding, so latency stays low.
  6. The brain runs. The bridge connects to your agent; the real-time pipeline turns — speech-to-text, your LLM, then text-to-speech.
  7. The agent speaks. Generated speech streams back down the same path. If the caller interrupts, the agent stops and listens — barge-in is handled live.

Your platform Twilio account is not involved in a BYOT call — the number, the carrier, and the trunk are all yours.

Outbound calls

Outbound works off the same fields you filled in on the Phone Numbers page — there's no separate trunk object to configure. As long as the number has a Termination URI and Outbound Transport set, Dialgem dials out through it whenever an agent places a call. The SIP Trunk User Name / Password you entered are presented to your carrier at that termination URI — so the call bills to your carrier account and shows your caller ID, not ours.

If a call doesn't connect

SymptomLikely causeFix
Call rejected immediately (403)On a carrier that uses digest authentication: wrong SIP username or password.Re-enter the SIP Trunk User Name / Password from step 1; reset the password on the number's Phone Numbers entry if unsure.
Call refused or never answeredThe DID isn't in the origination URI's user part, the number isn't registered, or it has no inbound agent assigned.Use sip:+1DID@sip.dialgem.com, register the number and set its inbound agent.
Rings but silence, then dropsMedia (RTP) can't reach us — firewall or transport mismatch.Confirm transport=tcp matches your trunk and that media ports aren't blocked.