Skip to content
Bartek Kois edited this page Apr 6, 2018 · 2 revisions

What is Adescom CTM Billings

Adescom CTM Billings is an ASP.NET Core Razor Pages web application intended for downloading billings through SOAP interface from Adescom CTM IP PBX.

Adescom CTM Billings home page

System requirements:

Adescom CTM Billings requires:

Installation and configuration (for Linux Debian 8.0)

Install .NET Core enviroment

Install the latest version of .NET Core (https://www.microsoft.com/net/core#linuxdebian):

sudo apt-get update
sudo apt-get install curl libunwind8 gettext apt-transport-https
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-jessie-prod jessie main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
sudo apt-get install dotnet-sdk-2.0.0

Install supervisor and nginx:

sudo apt-get install supervisor nginx

Install Adescom CTM Billings binaries

Download and unpack the latest version of Adescom CTM Billings form https://github.com/bartekkois/Adescom-CTM-Billings/releases and restore dependencies

sudo mkdir -p /var/www_aspnetcore/AdescomCTMBillings
cd /var/www_aspnetcore
curl -sSL -o Adescom.CTM.Billings-1.0.0.zip https://github.com/bartekkois/Adescom-CTM-Billings/releases/download/1.0.0/Adescom.CTM.Billings-1.0.0.zip
sudo unzip Adescom.CTM.Billings-1.0.0.zip  -d /var/www_aspnetcore/AdescomCTMBillings

Download and unpack the latest version of wkhtmltopdf library form https://wkhtmltopdf.org/downloads.html to the /var/www_aspnetcore/AdescomCTMBillings directory.

Configure web service connection

Configure web service connection to your IP PBX in the AdescomCTMBillings/appsettings.json file

{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "WebServiceConnectionSettings": {
    "Url": "YourWebserviceUrl",
    "ResellerLogin": "YourLogin",
    "ResellerPassword": "YourPassword",
    "SessionTimeout": 3600,
    "RequestTimeout": 300
  },

  "ApplicationSettings": {
    "CountryCode": "48",
    "NumberOfDigitsForAreaAndShortCLID": 9
  }
} 

Configure and restart supervisor:

Change the default configuration in /etc/supervisor/conf.d/AdescomCTMBillings.conf to:

[program:AtmanCTMBillings]
command=/usr/bin/dotnet "/var/www_aspnetcore/AtmanCTMBillings/Adescom CTM Billings.dll"
directory=/var/www_aspnetcore/AtmanCTMBillings
autostart=true
autorestart=true
stderr_logfile=/var/log/AtmanCTMBillings.err.log
stdout_logfile=/var/log/AtmanCTMBillings.out.log
environment=ASPNETCORE_ENVIRONMENT=Production,ASPNETCORE_URLS="http://*:5011",HOME="/var/www_aspnetcore/AtmanCTMBillings"
user=www-data
stopsignal=INT

Restart supervisor:

service supervisor restart

Configure and restart nginx:

Change the default configuration in /etc/nginx/sites-available/default to:

server {
        listen 5001 default_server;
        listen [::]:5001 default_server;
        root /var/www_aspnetcore/AdescomCTMBillings;
        server_name _;

        location / {
                    proxy_pass http://localhost:5000;
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection keep-alive;
                    proxy_set_header Host $host;
                    proxy_cache_bypass $http_upgrade;
                    proxy_read_timeout 300s;
        }
}

Setting proxy_read_timeout to higher value than default is extreamly important for long running tasks like download billings for all the clients. Not setting this properly can cause "Connection timeout" errors form nginx.

Restart nginx:

service nginx restart

Usage

Access Adescom CTM Billings through your web browser at http://your_server_ip:5001

Upgrade

To upgrade application simply stop the supervisor, change Adescom CTM Billings binaries while preserving appsettings.json and libwkhtmltox library files and start supervisor.

Security considerations

For security reasons we highly encourage NOT to expose this application to the public internet and to use it ONLY in your intranet or through the VPN.