The guide provides step-by-step configuration instructions of how to connect TG gateway and FreePBX. The GSM trunk on TG gateway will be extended on FreePBX phone system. With the connection you can achieve:
- Make outbound calls from FreePBX via the GSM trunks of TG gateway directly.
- Receive calls through GSM trunks of TG gateway at FreePBX.
FreePBX and TG gateway use the Service provider mode to connect with each other.
In the guide, we tested TG800 and FreePBX.
IP address of FreePBX: 192.168.9.91
IP address of TG800: 192.168.9.95
Figure 1 FreePBX and TG800 connect with SPS trunk
2. Connect FreePBX to Yeastar TG800
2.1 Create a VoIP Trunk on TG800
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 TG800
Trunk Type: Service Provider
Provider Name: FreePBX
Hostname/IP: The IP of the FreePBX, 192.168.9.91
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 TG800
2.2 Create a VoIP Trunk on FreePBX to TG800
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: TG800
SIP Server: the IP of the TG800, 192.168.9.95
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 TG800, 192.168.9.95
Note: it doesn’t matter which type of trunk you need, please feel free to add SIP trunk with other type.
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_SIP Extension
Figure 7 the SIP extension on FreePBX
Display Name: The name of the extension. For example: Sharon
Secret: the password of the extension. For example: Pincode300
Click “save” and “Apply change”, please check the status of the extension and it will shows OK.
Path: Admin> Asterisk CLI> execute command “sip show peers”
Figure 8 Extension status on FreePBX
3. Mobile to IP
In this section, we will configure incoming call to FreePBX.
Figure 9 mobile to IP
Step1. Configure “Mobile to IP” Route Settings in TG800.
Path: Gateway> Route Settings > Mobile to IP
Figure 10 Create Mobile to IP Route
Simple Mode: No
Route Name: You can name the route whatever you want, to_FreePBX
Call Source: Mobile—GSM1. You can select any GSM line or mobile group. Here we select GSM1 as an example.
Call Destination: SPS-FreePBX. All the calls from GSM1 will be sent to FreePBX via this trunk.
Hotline: 999, you can enter the number as 999 in this field, which is same to DID number on FreePBX
Step 2. Configure inbound route on FreePBX.
Path: Connectivity> Inbound Routes> Add Inbound Route
Figure 11 Create inbound route on FreePBX
DID Number: 999
Set Destination: Extensions-300 Sharon
Step 3. Test a call.
now we can test incoming calls for FreePBX. If you dial the GSM1 number on TG800, the call will be routed to the extension 300 in FreePBX.
4. IP to Mobile
In this section, we will configure outbound call for FreePBX extensions.
Figure 12 IP to mobile
Step1. Configure Outbound route on FreePBX.
Path: Connectivity> Outbound routes> Add Outbound Route
Figure 13 Create Outbound Route on FreePBX
Route Name: to_TG800
Match pattern: x.
Trunk Sequence for Matched Routes: TG800
Step2. Create IP to Mobile on TG800
Path: Gateway->Route Settings->IP to Mobile -> Add IP to Mobile Route
Figure 14 Create IP to Mobile Route
Simple Mode: Yes
Route Name: From_FreePBX
Call Source: SPS—FreePBX
Call Destination: Mobile—GSM1
Step3. Test a call
After settings, all the calls from FreePBX will be routed to GSM1. We can use extension on FreePBX to make test calls. For example, call 913850614596. Here 9 is the prefix in the outbound route of FreePBX.