Support / Voice / SBC / FreeSWITCH
FreeSWITCH SBC trunk to VoiceTel.
FreeSWITCH ships with a usable SBC role out of the box. The configuration below adds VoiceTel as a gateway on the external SIP profile, plus a dialplan rule to bridge inbound calls to your downstream PBX.
1. Define the gateway (Digest authentication)
Drop conf/sip_profiles/external/voicetel.xml:
<include>
<gateway name="voicetel">
<param name="username" value="yourusername"/>
<param name="password" value="yourpassword"/>
<param name="from-user" value="yourusername"/>
<param name="proxy" value="<sip-host-from-portal>"/>
<param name="realm" value="<sip-host-from-portal>"/>
<param name="register" value="true"/>
<param name="expire-seconds" value="360"/>
<param name="retry-seconds" value="600"/>
</gateway>
</include>
The host (<sip-host-from-portal>) is the SIP server host shown in your customer portal under your trunk's settings.
Do NOT set caller-id-in-from="true" — that puts the channel's caller ID in the From: username ($fU) and breaks trunk identification. Caller ID belongs in the dialplan via effective_caller_id_number.
1 (alt). Define the gateway (IP authentication)
For IP-auth trunks, the same rule applies — from-user stays the SIP account username — but registration is disabled and credentials are omitted. VoiceTel authorizes by source IP based on the ACL you've registered with onboarding.
<include>
<gateway name="voicetel">
<param name="from-user" value="yourusername"/>
<param name="proxy" value="<sip-host-from-portal>"/>
<param name="realm" value="<sip-host-from-portal>"/>
<param name="register" value="false"/>
<param name="expire-seconds" value="360"/>
<param name="retry-seconds" value="600"/>
</gateway>
</include>
2. Reload Sofia + verify registration
fs_cli> sofia profile external rescan
fs_cli> sofia status
# Look for: voicetel gateway REGED expsec=360
3. Outbound dialplan — set caller ID here, not on the gateway
Bridge to the gateway from your dialplan, e.g. conf/dialplan/default.xml. The effective_caller_id_* variables become the P-Asserted-Identity number and the From display-name on the outbound INVITE; the From username ($fU) stays the gateway's from-user — this is the desired behavior.
<extension name="voicetel-out">
<condition field="destination_number" expression="^(1?\d{10})$">
<action application="set" data="effective_caller_id_number=+1${caller_id_number}"/>
<action application="set" data="effective_caller_id_name=${caller_id_name}"/>
<action application="set" data="hangup_after_bridge=true"/>
<action application="bridge" data="sofia/gateway/voicetel/$1"/>
</condition>
</extension>
4. Inbound dialplan (from VoiceTel)
Inbound calls land on the public IP. Add a public dialplan in conf/dialplan/public.xml:
<extension name="voicetel-inbound">
<condition field="destination_number" expression="^(\+?1?(\d{10}))$">
<action application="transfer" data="$2 XML default"/>
</condition>
</extension>
Replace the transfer target with whichever extension or context routes calls to your downstream PBX.
5. ACL for IP authentication
If using IP auth, add VoiceTel's source IPs to the external profile's ACL (configured under conf/autoload_configs/acl.conf.xml) so unauthenticated INVITEs from VoiceTel are accepted.
Verify $fU is the SIP username on outbound calls
Capture a SIP trace and confirm the From: header username on outbound INVITEs is the SIP account username, not the caller ID:
fs_cli> sofia loglevel all 9
# Place a test call, watch for outbound INVITE.
# Expected: From: "Caller Name" <sip:yourusername@<sip-host-from-portal>>;tag=...
# Wrong: From: "Caller Name" <sip:+12125551234@<sip-host-from-portal>>;tag=...
# ^^^^^^^^^^^ — caller ID in username, will fail trunk auth
Verify
fs_cli> sofia status gateway voicetel
fs_cli> sofia loglevel all 9 # SIP trace
fs_cli> show channels