How to Connect FreePBX to Yeastar TB Gateway

1. Introduction

The guide provides step-by-step configuration instructions of how to connect TB gateway and FreePBX. The BRI trunk on TB gateway will be extended on FreePBX phone system. With the connection you can achieve:

  1. Make outbound calls from FreePBX via the BRI trunks of TB gateway directly.
  2. Receive calls through BRI trunks of TB gateway at FreePBX.


Integration Modes

FreePBX and TB gateway use the Service provider mode to connect with each other.

Firmware version:

In the guide, we tested TB200 and FreePBX.


FreePBX: 10.13.66 


IP address of FreePBX:

IP address of TB200:

BRI1 main line number: 5503300

Figure 1 FreePBX and TB200 connect with SPS trunk



2. Connect FreePBX to Yeastar TB200

2.1 Create a VoIP Trunk on TB200

Path: Gateway> VoIP Settings> VoIP trunk> Add VoIP Trunk.

Choose “Service Provider” mode, and fill in FreePBX IP address.

Figure 2 Add SIP Trunking in TB200


Provider Name: To_FreePBX

Hostname/IP: The IP of the FreePBX,


After creating SIP Trunking, we can check the status of this trunk, it should be OK(green).

Path: Status> System Status> Trunk Status

Figure 3 Trunks Status on TB200


2.2 Create a VoIP Trunk on FreePBX to TB200

Path: Connectivity> Trunks> Add Trunks> Add SIP (chan_pjsip) Trunk

Figure 4 Add VOIP Provider on FreePBX

Firgure 5 VoIP trunk on FreePBX

Trunk name: TB_200

SIP Server: the IP of the TB200,

SIP Server Port: the default port 5060, if you want to change the port, it means the FreePBX provide the port for other devices to register to it.

From Domain: the IP of the TB200,


Click “save” and “Apply change”, please check the status of the trunk, it shows “Avail” and “Not in use”

Path: Admin> Asterisk CLI> execute command “pjsip show endpoints”

Figure 6 The status of the SIP trunk on FreePBX


2.3 Create an extension in FreePBX

Path: Applications> Extensions> Add Extension> Add New Chan_PJSIP Extension


Figure 7 the PJSIP extension on FreePBX

Click “save” and “Apply change”, please check the status of the extension and it will shows OK.

Path: Admin> Asterisk CLI> execute command “pjsip show endpoints”

Figure 8 Extension status on FreePBX


3. Incoming Calls from BRI to FreePBX

In this section, we will configure incoming call to FreePBX.

Figure 9 BRI to IP


Step1. Create a route from TB200 to FreePBX

Path: Gateway> Route Settings > Route List


Figure 10 Create Route from TB200 to FreePBX

Simple Mode: Yes

Route Name: You can name the route whatever you want, bri_to_freepbx

Call Comes in From: BRI--BriTrunk1. You can select BriTrunk1 or BriTrunk2. Here we select BriTrunk1 as an example

Send Call Through: ServiceProvider--To_FreePBX. All the calls from BriTrunk1 will be sent to FreePBX via this trunk


Step 2. Configure inbound route on FreePBX.

Path: Connectivity> Inbound Routes> Add Inbound Route

Figure 11 Create inbound route on FreePBX

Description: From_TB200

DID Number: 5503300

Set Destination: Extensions-101 Sharon


Step 3. Test a call.

Now the external user can use his cell phone to FreePBX system by dialing number 5503300. 5503300 is the line number of the BRI1 trunk on TB200 which is the same as DID number in the FreePBX inbound route. The call will reach the extension 101


4. Outbound Calls from FreePBX extension via BRI

In this section, we will configure outbound call for FreePBX extensions.

Figure 12 IP to BRI

Step1. Configure Outbound route on FreePBX.

Path: Connectivity> Outbound routes> Add Outbound Route

Figure 13 Create Outbound Route on FreePBX

Route Name: To_TB200

Prefix: 9, if it is configured which means you need to dial the prefix ahead of your number, in the settings you have to call 9+external number

Match pattern: X.

Trunk Sequence for Matched Routes: To_TB200


Step2. Configure route on TB200

Path: Gateway->Route Settings->Route List

Figure 14 Create Route from FreePBX to TB200

Simple Mode: Yes

Route Name: freepbx_to_bri

Call Source: ServiceProvider—To_FreePBX

Call Destination: BRI—BriTrunk1


Step3. Set DOD for FreePBX extension

For example, extension 101 will use BRI1 DOD 5503301 to make outside calls via BRI1 Trunk


Figure 15 Configure DOD for FreePBX extension

Step4. Test the call

Now, all the calls from FreePBX will be routed to TB200. We can use extension on FreePBX to call the external user directly. For example dial 913805044321. 9 is the prefix on FreePBX outbound route.

Have more questions? Submit a request


Please sign in to leave a comment.