Skip to main content

Using Bitcall with FreeSWITCH (SIP Trunk Setup)

Step-by-step guide to configure FreeSWITCH with Bitcall as your SIP trunk. Covers both SIP credentialsand IP-auth setups

Alex avatar
Written by Alex
Updated over 6 months ago


“Turn your FreeSWITCH server into a Bitcall-powered telecom powerhouse… but without the headache.”

Let’s walk you through adding Bitcall step-by-step.


🔧 What You’ll Need

  • A running FreeSWITCH server

  • A Bitcall account

  • A SIP account in Bitcall (with credentials or with your IP whitelisted)

  • SSH access (for editing configs, running commands)


⚙️ Step 1: Create Your SIP Gateway

A) Using

SIP Credentials

(user/password)

Create a file:

/usr/local/freeswitch/conf/sip_profiles/external/bitcall.xml

<include>
<gateway name="bitcall">
<param name="username" value="YOUR_USER"/>
<param name="password" value="YOUR_PASS"/>
<param name="proxy" value="gateway.bitcall.io"/>
<param name="register" value="true"/>
<param name="caller-id-in-from" value="true"/>
<param name="expire-seconds" value="3600"/>
<param name="inbound-codec-prefs" value="PCMU,PCMA"/>
<param name="outbound-codec-prefs" value="PCMU,PCMA"/>
</gateway>
</include>

💡 Replace YOUR_USER and YOUR_PASS with your Bitcall SIP credentials.


B) Using

IP Authentication

(Trusted IP)

Create the same file but without user/pass:

<include>
<gateway name="bitcall-ip">
<param name="proxy" value="gateway.bitcall.io"/>
<param name="register" value="false"/>
<param name="caller-id-in-from" value="true"/>
</gateway>
</include>

⚠️ Make sure your server’s public IP is whitelisted in the Bitcall portal.


🔄 Step 2: Reload FreeSWITCH Settings

Run:

fs_cli -x "reloadxml"
fs_cli -x "sofia status gateway bitcall"

You should see REGED if using credentials .


📞 Step 3: Define Outbound Dialplan

Create file:

/usr/local/freeswitch/conf/dialplan/default/30_bitcall_out.xml

<extension name="bitcall_out">
<condition field="destination_number" expression="^(\+33\d{9})$">
<!-- random French CLI from your signed DIDs -->
<action application="set" data="effective_caller_id_number=${caller_id_number}"/>
<action application="bridge" data="sofia/gateway/bitcall/$1"/>
</condition>
</extension>

To randomize French CLI, leverage a script or DID pool — see our PHP/JS snippet below.


🎲 Step 4: Random CLI Setup

If you have multiple DIDs in a database or file, use a small script to pick one per call:

<action application="set" data="effective_caller_id_number=${curl('http://localhost/random_cli.php')}"/>

random_cli.php might contain:

<?php
$lines = file('/etc/freeswitch/french_dids.txt', FILE_IGNORE_NEW_LINES);
echo trim($lines[array_rand($lines)]);

Saves DIDs like:

+33612345678 +33798765432


🔍 Step 5: Reload Dialplan & Test

fs_cli -x "reloadxml"

Test a call:

fs_cli -x "originate sofia/gateway/bitcall/+33123456789 &playback(silence_stream://200)"

If you hear silence, your trunk is working!


🛠️ Troubleshooting Tips

Problem

Quick Fix

Gateway shows NOREG or down

Check credentials or ensure IP-auth is whitelisted

Calls don’t go out

Confirm dialplan syntax and reload XML

One-way audio

Verify ext-sip-ip and ext-rtp-ip are set properly

CLI not working

Ensure script runs and returns correctly formatted DID

Codec mismatch

Adjust inbound-codec-prefs or outbound-codec-prefs


🧠 TL;DR Recap

✅ Add gateway in sip_profiles/external (with creds or IP)  
✅ Reload XML and check gateway status
✅ Create outbound dialplan rule for +33 numbers
✅ (Optional) Add random French CLI using script
✅ Reload and test a call
✅ Bam! Bitcall + FreeSWITCH = 🔥


Did this answer your question?