prefixkit Ask an engineerAsk Support RU

SIP provider settings

Twilio Elastic SIP Trunking SIP trunk setup

How to connect Twilio to your PBX: SIP server, port, login, codecs, number format and a ready pjsip.conf for Asterisk, a FreeSWITCH gateway and the fields for 3CX. The generator fills in your details.

SIP serverYour trunk’s Termination SIP URI, e.g. mytrunk.pstn.twilio.com; for a specific edge mytrunk.pstn.ashburn.twilio.com
AuthenticationNo registration: IP access control list and/or credential list (digest)
Number formatE.164 with + for destination and caller ID; the caller ID must be a Twilio number or a verified one
CodecsG.711 µ-law, A-law
Inbound callsOrigination: Twilio sends calls to the SIP URI you set on the trunk (your PBX address)
LimitsKeep under 30 calls per second from one IP to one Twilio IP
Provider guidewww.twilio.com

Twilio identifies your trunk by the domain in the Request-URI, so the host must be your own termination URI, not a bare IP.

Choose “Password, no registration” in the generator for a credential list, or “By IP address” if you only use an IP ACL.

Generator with Twilio settings

Provider fields are filled in: add your login, password and number.

Provider

Numbers and routing

Media and NAT

The config is built in your browser; the password is not sent anywhere.

Example pjsip.conf for Twilio

; pjsip.conf — trunk "twilio" generated by prefixkit.com
; Reload: asterisk -rx "pjsip reload"   Check: pjsip show registrations / pjsip show endpoint twilio

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060

[twilio-auth]
type=auth
auth_type=userpass
username=username
password=PASSWORD

[twilio]
type=aor
contact=sip:mytrunk.pstn.twilio.com:5060
qualify_frequency=60

[twilio]
type=endpoint
transport=transport-udp
context=from-twilio
disallow=all
allow=ulaw,alaw
aors=twilio
outbound_auth=twilio-auth
from_user=username
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
dtmf_mode=rfc4733

[twilio]
type=identify
endpoint=twilio
match=mytrunk.pstn.twilio.com

FreeSWITCH gateway

<!-- conf/sip_profiles/external/twilio.xml — reload: fs_cli -x "sofia profile external rescan" -->
<include>
  <gateway name="twilio">
    <param name="username" value="username"/>
    <param name="password" value="PASSWORD"/>
    <param name="realm" value="mytrunk.pstn.twilio.com"/>
    <param name="proxy" value="mytrunk.pstn.twilio.com:5060"/>
    <param name="register" value="false"/>
    <param name="from-user" value="username"/>
    <param name="caller-id-in-from" value="true"/>
    <param name="ping" value="60"/>
  </gateway>
</include>

Twilio in 3CX, FreePBX, Yeastar and other web-managed PBXs

Trunk typeGeneric SIP trunk, authentication without registration
Registrar / SIP server / Hostmytrunk.pstn.twilio.com
Port5060 UDP
Auth ID / Usernamethe login from your account (credential list user)
CodecsG.711 µ-law, G.711 A-law
DTMFRFC 2833 / 4733

If it does not work

Check whether the provider server answers: SIP check. Read a registration or call log: SIP log analyzer. No audio: NAT test.

Other providers

Zadarma · MTT Business · Telphin · SIPNET · Mango Office · Telnyx · DIDWW · VoIP.ms · Flowroute · Plivo · sipgate

Settings come from the provider’s guides and may change; check your account. If something is out of date, tell us through the feedback form.

Idea?