How to Connect FreePBX to Yeastar TE Gateway (Via chan_sip Trunk)

1. Introduction

We already had the interconnection guide for TE and FreePBX (chan_pjsip) How-to-Connect-FreePBX-to-Yeastar-TE-Gateway. While there is no reference about the chan_sip, therefore in this guide, we provide the complete steps about how to connect the FreePBX and Yeastar TE Gateway by chan_sip.

With this integration, the significant needs there can meet:

  • Make outbound calls from FreePBX via the E1 trunks of TE gateway directly.

  • Receive calls through E1 trunks of TE gateway at FreePBX.


1.1. Integration Mode

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

Note: FreePBX provides the chan_sip Trunk for this connection.

1.2. Firmware Version


FreePBX: 13.0.70

1.3Description Example

IP address of FreePBX:

IP address of TE200:

E1 main line number: 5503300


Figure-1 FreePBX and TE200 connect with SPS trunk


2. Connect FreePBX to Yeastar TE200

2.1 Check the SIP Settings on FreePBX

Path: Settings > Chan_sip Settings> Bind Port: 5061


 Figure-2 FreePBX SIP Settings



Figure-3 Chan_sip Trunk Bind Port 


2.2 Create a VoIP Trunk on FreePBX

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


Figure-4 Add VOIP Provider on FreePBX



Figure-5  Add VoIP trunk on FreePBX

Trunk name: To_TE200

Outbound CallerID: 5503301 (This is the Caller ID of Chan_sip trunk)

Trunk Name: To_TE200

PEER Details: host= (The IP Address of TE200)






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

Path: Admin> Asterisk CLI> execute command “sip show peers”


Figure-6 The status of the SIP trunk on FreePBX


2.3 Create a VoIP Trunk on TE200

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


                                           Figure-7 Add SIP Trunk on TE200

Provider Name: To_FreePBX

Hostname/IP: 5061 (The IP address of FreePBX, and the SIP port of Chan_sip trunk)


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

Path: Status> System Status> Trunk Status.


Figure-8 Trunk Status on TE200


2.4 Create an Chan_SIP extension on FreePBX

Path: Applications> Extensions> Add Extension> Add New Chan_SIP Extension.


Figure-9 the SIP extension on FreePBX


Note: When user register the Chan_SIP extension, the corresponding SIP port should be 5061.


Figure-10 Register the Chan_SIP extension via IP phone


Click “save” and “Apply change”, please check the status of the extension and this extension will be displayed.

Path: Admin> Asterisk CLI> execute command “sip show users” or "sip show inuse".


Figure-11 Extension status on FreePBX



Figure-12 Extension status on FreePBX


3. Incoming Calls from E1 to FreePBX

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

3.1 Create a route on TE200

Path: Gateway> Route Settings > Route List


                                    Figure-13 Create Route from TE200 to FreePBX

Simple Mode: Yes

Route Name:  E1_to_SIP

Call comes in From: Trunk – E1Trunk1 (You can select E1Trunk1 or E1Trunk2).

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


3.2 Create an inbound route on FreePBX

Path: Connectivity> Inbound Routes> Add Inbound Route


Figure-14 Create Route from FreePBX to TE200

Description: To_TE200

DID Number: 5503300 ( The DOD number of TE200‘s E1 line)

Set Destination: Extensions-1002


3.3 Test a call

Now the external users can use their cell phone to FreePBX system by dialing number 5503300. 5503300 is the line number of the E1 trunk on TE200 which is the same as DID number in the FreePBX inbound route. The call will reach the extension 1002 directly.


4. Outbound Calls from FreePBX extension through E1

In this section, we will configure outbound call from FreePBX extensions to external users through the E1 line.

4.1 Create an outbound route on TE200

Path: Gateway> Route Settings > Route List


                                  Figure-15 Create Route from FreePBX to TE200

Simple Mode: Yes

Route Name:  SIP_to_E1

Call comes in From: ServiceProvider--To_FreePBX

Send Call Through: Trunk – E1Trunk1


4.2. Set DOD for FreePBX extension

Set the Global DOD of this E1 line as 5503300 on TE200, that should be the same with the DID Number of inbound route on FreePBX.


Figure-16 E1 line DOD settings on TE200


4.3 Configure Outbound route on FreePBX.

Path: Connectivity> Outbound routes> Add Outbound Route


Figure-17 Create Outbound Route on FreePBX



Figure-18 Dial Patterns settings on FreePBX

Route Name: To_TE200

Match pattern: X.

Trunk Sequence for Matched Routes: To_TE200


4.4 Test a call.

The FreePBX extension 1002 can call the external user through the TE200's E1 line directly.



Have more questions? Submit a request


Article is closed for comments.