3CX WEB API Debian installation guide (manual mode)

Created by Oleg Agapov, Modified on Sun, 2 Aug at 2:03 PM by Oleg Agapov

Make sure that the 3CX server is installed and activated

1. Upload files


Create /var/www/webapi/


Download link https://download.creomate.com/webapi_debian_en.zip


Place files in a folder:

  • TCXWebAPI
  • TCXWebAPI.ini
  • AuthKeys.csv
  • AllowedIP.txt


Create /var/www/webapi/mp3 (for MP3 records) 


Don't forget grant write permissions to mp3 and log folders and make chmod +x TCXWebAPI for execute permission.


2. Install Nano for edit

sudo apt install nano


3. Create daemon

sudo nano /etc/systemd/system/webapi.service

Insert and save (ctrl+x -> y -> enter):

[Unit]
Description=webapi
After=nginx.service
After=3CXAudioProvider01.service
After=3CXCallFlow01.service
After=3CXCfgServ01.service
After=3CXEventNotificationManager.service
After=3CXIVR01.service
After=3CXMediaServer.service
After=3CXPhoneSystem01.service
After=3CXPhoneSystemMC01.service
After=3CXQueueManager01.service
After=3CXSystemService01.service
After=3CXTunnel01.service
[Service]
Environment=DOTNET_BUNDLE_EXTRACT_BASE_DIR=/var/tmp
WorkingDirectory=/var/www/webapi/
ExecStart=/var/www/webapi/TCXWebAPI --urls=http://127.0.0.1:8081
Restart=always
RestartSec=10
SyslogIdentifier=webapi

[Install]
WantedBy=multi-user.target


4. Enable and start daemon

sudo systemctl enable webapi
sudo systemctl start webapi



5. Configuring NGINX


Create the file:

sudo nano /var/lib/3cxpbx/Bin/nginx/conf/snippets/webapi.conf


Paste this content:

location ~ ^/webapi/?(.*) 
{
#   allow 89.216.58.242;    # uncomment to allow access only from specific IP addresses
#   deny all;        # uncomment to allow access only from specific IP addresses
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $connection_upgrade;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_pass http://127.0.0.1:8081/webapi/$1$is_args$args;
  proxy_buffering off;
}


Save and exit: Ctrl+O, Enter, Ctrl+X.


Restart NGNIX

sudo systemctl restart nginx


6. Check

Local http - http://127.0.0.1:8081/webapi/tcx

curl http://127.0.0.1:8081/webapi/tcx

Public https - https://{fqdn and port 3СХ}/webapi/tcx

You'll receive: {"product":"3CX REST API","version":"2.2.0","release":"Webhooks","licenseExpire":"01.01.0001 00:00:00","clientLicensesNum":"forbidden","concurrentCalls":0,"callRecords":false,"api":false,"quality":false}


7. License activation

https://{FQDN and port 3СХ}:5001/webapi/admin/

login - TCXWebAPI
password- Activate (after activation will be license XXXX-XXXX)

For trial activation use NHQE-QRND-TRIAL (only once)


8. Install Lame for wav into mp3 conversion

3CX overrides the standard Debian repositories with its own, so apt install lame fails since lame isn't available there. To install it, add the official Debian repository (without modifying the existing 3CX sources) using the command below:

echo "deb http://deb.debian.org/debian bookworm main" > /etc/apt/sources.list.d/debian-official.list && apt-get -o Dir::Etc::sourcelist="sources.list.d/debian-official.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" update && apt-get install -y lame && rm /etc/apt/sources.list.d/debian-official.list


For restart WebAPI

service webapi stop
service webapi start

or

systemctl restart webapi


For test daemon status

systemctl status 'webapi'


For getting a debug journal

journalctl -fu webapi


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article