FreeSWITCH is a robust telephony platform designed to route and interconnect communication protocols. When working with SIP trunks, you may need to register or unregister trunks for troubleshooting or configuration purposes. In this guide, we’ll walk you through how to register and unregister a SIP trunk on FreeSWITCH and the steps required to ensure the trunk is operational.
Step 1: Logging into FreeSWITCH CLI
To manage your trunks in FreeSWITCH, you’ll first need to access the FreeSWITCH CLI (Command Line Interface). Here’s how to log in:
Open your terminal and type the following command to access FreeSWITCH’s CLI:
Âfs_cli
This will log you into FreeSWITCH’s CLI using the default settings.
If your FreeSWITCH instance requires a specific username and password, use the command below, where
-p
is followed by your password:Âfs_cli -nr -p <username>
Step 2: Checking the Gateway Registration Status
Once logged into the FreeSWITCH CLI, you can check the current registration status of your gateways (SIP trunks) using the following command:
sofia profile external gwlist
This command will return a list of all SIP gateways configured on the external profile and show their registration status (registered/unregistered). You can use this to identify if a specific gateway is currently registered or not.
Step 3: Unregistering a Gateway
If you need to unregister a specific gateway, you can do so by running the following command:
sofia profile external killgw <gateway_name>
Here, replace <gateway_name>
with the actual name of the gateway you want to unregister. This command will unregister the specified SIP trunk.
Step 4: Rescanning the Profile
Once you’ve unregistered the gateway, you’ll want FreeSWITCH to recheck its configuration. To do this, you can run:
sofia profile external rescan
This will force FreeSWITCH to rescan the external profile, including any updated configurations, such as re-registering or detecting changes to gateways.
Step 5: Verifying Gateway Registration Again
After rescanning the profile, it’s important to verify whether the gateway has been successfully registered or unregistered. To check the status again, run:
sofia profile external gwlist
If the gateway shows up in the list and is marked as registered, your configuration changes were successful, and you can proceed with testing.
Step 6: Testing the Gateway with a Call
If your gateway is successfully registered, you can proceed to test a call. This will help you verify that the trunk is functioning properly.