The API logic between CPU board and Gateway Board on UCP
The API logic between CPU board and Gateway board on UCP
OpenVox UCP platform provides All-in-one solution for Unified Communication system, it integrates multiple CPU boards and Gateway boards in one chassis.
As shown in the following figure, all the slots in the chassis are connected to the network switch module CSU via the network bus, forming a dedicated internal local area network(LAN).
All the boards installed in the slots, whether they are CPU boards or gateway interface boards, can communicate with each other. They all have their own internal IP addresses and communicate with each other through Ethernet.
In this way, we can accomplish many amazing things through any protocol based on TCP/IP.
If we install a CPU board and a FXS gateway board inside the UCP4131 chassis, then how does the CPU board work with Gateway board via API?
As you can see in the picture above, the CPU board and FXS/FXO board are connected by Ethernet bus, so they can communicate each other with individual IP address.
We installed a PBX system on the CPU board and the FXS/FXO board has its own gateway system with built-in API. The PBX and the gateway will use the SIP trunk to send and receive calls and we can use the web interface on PBX server to manage both the PBX and gateway via API.
For example, there are 4 FXS ports on the gateway board, and I want them to act as 4 fxs extensions of the PBX, how can we do that?
We have a PBX and a FXS board, 2 analog phones, and the Postman (We use postman to call API).
Here are the steps manually:
- On PBX, we Create 2 SIP extensions in PBX (here we use openvox PBX 172.16.6.99)
- Create extension 1006
- Create extension 1008
- We have the FXS board (172.16.6.124) and we use Postman to call the API:
API:
172.16.6.124/controller/auth/login
Raw: {“username”:”admin”,”password”:”21232f297a57a5a743894a0e4a801fc3″}
Note: password need to be md5 (tool: https://www.miraclesalad.com/webtools/md5.php )
You will get token here and it will be used in next API call.
- Register FXS to PBX
API:
172.16.6.124/controller/analog_profile/sip_server_set
Raw: {“primary_ipaddr”:”172.16.6.99″,”profile”:0,”token”:”e2963168d5ed51ba36183d0260d8d6e6″}
- Bind sip extensions to FXS
- Bind extension 1006 to FXS-6
API:
172.16.6.124/controller/analog_port/fxs_set
Raw:
{“slotnum”:0,”channel”:6,”enable”:”yes”,”callerid_name”:”1006″,”callerid_num”:”1006″,”auth_username”:”1006″,”auth_password”:”1006″,
“token”:”e2963168d5ed51ba36183d0260d8d6e6″}
- Bind sip 1008 to FXS-8
API:
172.16.6.124/controller/analog_port/fxs_set
Raw:
{“slotnum”:0,”channel”:8,”enable”:”yes”,”callerid_name”:”1008″,”callerid_num”:”1008″,”auth_username”:”1008″,”auth_password”:”1008″,
“token”:”e2963168d5ed51ba36183d0260d8d6e6″}
- Apply all changes
API:
172.16.6.124/controller/general/apply_do
Raw:
{ “token”: “e2963168d5ed51ba36183d0260d8d6e6”}
All configuration will take effect after this command.
- Query status
API:
http://172.16.6.124/controller/sys_info/interface
Raw:
{“slotnum”:0,”token”:”e2963168d5ed51ba36183d0260d8d6e6″}
6reg is FXS-6, you can see fxs-6 (1006) and fxs-8 (1008) are all registered, now you can try to use two analog phones to call each other with number 1006 and 1008.
- Check status on PBX
You can login the PBX web portal, you will see the SIP user 1006 and 1008 are registered and online, and you can also monitor the call status realtime.
Notice:
In the end, with the gateway API, you can not only setup the all configs related to FXS/FXO, but also you have the ability to fully control the gateway board, including the status of fxs/fxo ports and all parameters related to fxs/fxo, just like you handle the fxs/fxo pcm cards, the only difference might be the method, thru the direct driver/ioctl or the tcp/ip API calls.