The only API currently available for 3CX is the Call Control API, and you need to develop your own program and call the 3CX wrapped methods to achieve the functionality you want.
We found someone on GitHub who has wrapped the 3CX Call Control API as a Web API for external use. The project address is: https://github.com/Montesuma80/3cx-web-API.
Download Web API
3CX V16 use .net core 3.1, and 3CX V18 use .NET5. So you need to download the corresponding version according to your needs. The project is using V16 version by default. Download the V18 version to switch to the V18 branch and download it.
Press green button Code download zip.
If 3cx run in a Linux Server you can use git clone
to download these things to the server. First you need to install git on your Linux server.
$ sudo apt install git
V16 3CX command:
$ git clone -b 3CX-V18-Final https://github.com/Montesuma80/3cx-web-API.git
V18 3CX command:
git clone -b 3CX-V18-Final https://github.com/Montesuma80/3cx-web-API.git
Installation Environment
Please Follow Mircrosoft guide to install .NET environment: https://dotnet.microsoft.com/download/dotnet.
Download .net core 3.1 for V16, .NET 5 for V18.
Linux Server please follow this guide: https://docs.microsoft.com/zh-cn/dotnet/core/install/linux-debian.
Check installation status run this command:
$ dotnet --info
Deploy Web API
Here we demonstrate how to deploy it for Linux, for Windows please refer to the documentation on the project homepage.
First of all, move to 3cx-web-API directory:
cd 3cx-web-API
Modify WebAPICore.csproj file:
- remove
<Private>false</Private>
in for 3cxpscomcpp2 - edit path:
<HintPath>..\..\..\Program Files\3CX Phone System\Bin\3cxpscomcpp2.dll</HintPath>
to<HintPath>/usr/lib/3cxpbx/3cxpscomcpp2.dll</HintPath>
Before edit:
After edit:
After modify, run command:
$ dotnet build WebAPICore.csproj
Change directory to bin/Debug/net5.0
:
$ cd bin/Debug/net5.0
Also we need copy 3CXPhoneSystem.ini file to this directory:
cp /var/lib/3cxpbx/Bin/3CXPhoneSystem.ini .
Now we need to disable Debian buster’s firewall:
$ sudo systemctl disable nftables
Run Web API Server in port 8888(default port is 8889):
$ dotnet WebAPICore.dll 8888
If we want to check extension 805 status, we can access below link in browser:
http://192.168.1.201:8888/showstatus/805
We can see current status is available: