Build a Scalable Cloud Call Center with FreeSWITCH: Step‑by‑Step Guide
This comprehensive tutorial walks you through installing, configuring, and extending FreeSWITCH to create a cloud‑based call center, covering SIP fundamentals, media handling options, Windows setup, client configuration, and EventSocket integration for advanced development.
1. Introduction
In today's fast‑moving digital era, enterprises need efficient, low‑cost, and highly scalable communication solutions. Cloud call centers are emerging as a modern service model, gradually replacing traditional hardware‑based centers. FreeSWITCH, an open‑source communications platform, offers excellent performance and flexibility, making it an ideal choice for building a cloud call center.
This article provides a step‑by‑step guide to creating a simple cloud call center with FreeSWITCH, covering installation, configuration, and core features.
2. FreeSWITCH Overview
FreeSWITCH is a free, open‑source softswitch licensed under the Mozilla Public License. Its core library libfreeswitch can be embedded in other systems or used as a standalone application.
Using FreeSWITCH, you can build a cloud call center that supports SIP‑based voice calls, integrate standard SIP client SDKs on devices such as phones or embedded hardware, and connect to SIP service providers for outbound calls to real phone numbers.
FreeSWITCH offers a rich set of modules for call routing, recording, interception, and more, and allows developers to write custom modules for tailored functionality.
3. Typical FreeSWITCH Features
Online billing and prepaid functions
Call routing server
Voice transcoding server
Multi‑point conference server
IVR and voice notification server
Voicemail server
PBX and softswitch applications
Application‑level gateway
Firewall/NAT traversal
Private server
Third‑party call control applications
Runtime engine for business environments
Session Border Controller
S‑CSCF/P‑SCSCF/I‑SCSCF in IMS
SIP inter‑gateway
SBC and security gateway
Fax server, T.30‑to‑T.38 gateway
4. Call Setup Process
A call consists of two phases: signaling negotiation (using SIP with SDP) and media transmission (using RTP). Signaling establishes the media parameters, after which RTP carries the audio stream.
4.1 Protocol Layer
Both SIP and RTP are application‑layer protocols that typically run over UDP.
4.2 Key Terminology
UAC/UAS : User Agent Client initiates the call; User Agent Server receives and processes it.
Register Server : Handles REGISTER requests from SIP devices.
Location Server : Tracks user locations; often combined with the Register Server.
Proxy Server : Forwards SIP requests without altering session state.
Redirect Server : Redirects requests to a new address without forwarding INVITE.
B2BUA : Back‑to‑Back User Agent; FreeSWITCH acts as a B2BUA.
4.3 Call Establishment
The diagram shows a basic SIP call flow where Bob calls Alice, who later hangs up. After the SIP signaling steps (F1‑F6), media streams begin; media does not pass through FreeSWITCH in this basic mode, so recording is not possible. FreeSWITCH supports three media handling modes:
Default mode : Media passes through FreeSWITCH, which can transcode, record, and perform secondary dialing.
Proxy Media : Media is relayed without processing; no transcoding or recording.
Bypass Media : FreeSWITCH only handles signaling; media bypasses it entirely, offering the highest performance.
5. Installing FreeSWITCH on Windows
5.1 Download
The official Windows MSI installer can be downloaded from https://files.freeswitch.org/windows/installer/x64/ .
5.2 Configuration Files
Key configuration directories (default install path C:\Program Files\FreeSWITCH): conf/vars.xml – basic settings conf/autoload_configs/ – module configuration files conf/autoload_configs/modules.conf.xml – modules to load at startup conf/dialplan/ – dialplan files ( default.xml for internal routing, public.xml for external calls) conf/directory/ – user directory files conf/sip_profiles/ – SIP profile files ( internal.xml, external.xml) conf/freeswitch.xml – includes all other configs
5.3 Modifying Configuration
Edit vars.xml to set the local IPv4 address and update external_sip_ip accordingly.
5.4 Starting FreeSWITCH
Run FreeSwitchConsole.exe from the installation directory or use fs_cli.exe: ./fs_cli.exe -H 127.0.0.1 -P 8021 Common CLI commands: /exit – quit console loglevel 0~7 – set log level sofia global siptrace on/off – toggle SIP tracing sofia status profile internal reg – list registered users show calls – display active calls status – show FreeSWITCH status
6. Client Configuration
6.1 Linphone Installation
Visit https://www.linphone.org/ .
Select the platform icon and download.
Install the application.
6.2 Linphone Setup
Configure two Linphone instances to call each other after FreeSWITCH is running.
Open Linphone.
Click “Assistant”.
Choose “Use a SIP account”.
Configuration details (accounts 1001‑1019 are pre‑created under C:\Program Files\FreeSWITCH\conf\directory\default):
Username: 1001‑1019
SIP domain: 123.456.789.78:5060
Password: 1234 (set in vars.xml)
Transport: UDP
Dial the extension using the on‑screen keypad.
7. Advanced Usage – EventSocket Module
EventSocket allows external programs (Java, Python, etc.) to connect to FreeSWITCH via a socket, receive events, and control the server.
Two modes are supported:
Inline mode : FreeSWITCH acts as a server waiting for client connections.
Outbound mode : FreeSWITCH initiates a connection to an external server.
Java Example
Add the following Maven dependency:
<dependency>
<groupId>org.freeswitch.esl.client</groupId>
<artifactId>org.freeswitch.esl.client</artifactId>
<version>0.9.2</version>
</dependency>Sample code to listen for all events:
package com.jd.cloud.freeswitch.esl.inbound;
import org.freeswitch.esl.client.IEslEventListener;
import org.freeswitch.esl.client.inbound.Client;
import org.freeswitch.esl.client.inbound.InboundConnectionFailure;
import org.freeswitch.esl.client.transport.event.EslEvent;
public class Test {
public static void main(String[] args) throws InterruptedException {
Client client = new Client();
try {
// Connect to FreeSWITCH
client.connect("127.0.0.1", 8021, "ClueCon", 10);
client.addEventListener(new IEslEventListener() {
@Override
public void eventReceived(EslEvent event) {
System.out.println(event.getEventName());
}
@Override
public void backgroundJobResultReceived(EslEvent event) {
System.out.println("Async callback:" + event.getEventHeaders().get("Job-UUID"));
}
});
client.setEventSubscriptions("plain", "all");
if (client.canSend()) {
System.out.println("Connection successful, ready to originate calls...");
String callResult = client.sendAsyncApiCommand("originate", "user/1000 &playback(/tmp/demo.wav)");
System.out.println("api uuid:" + callResult);
}
} catch (InboundConnectionFailure e) {
System.out.println("Connection failed!");
e.printStackTrace();
}
}
}8. SIP SDK Usage
By using a standard SIP SDK (e.g., liblinphone), embedded devices can connect to the platform and make outbound calls.
SDK repository: https://github.com/BelledonneCommunications/liblinphone
Other platform examples: https://github.com/BelledonneCommunications
JD Cloud Developers
JD Cloud Developers (Developer of JD Technology) is a JD Technology Group platform offering technical sharing and communication for AI, cloud computing, IoT and related developers. It publishes JD product technical information, industry content, and tech event news. Embrace technology and partner with developers to envision the future.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
