How to Deploy Dot Net API on Debian 12

STEP 1: Install .NET Runtime

wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

install SDK

sudo apt-get update
sudo apt-get install -y dotnet-sdk-8.0

Cehck this link for further information. Check dotnet version

dotnet -version

STEP 2: Download Code

Doenload API code on Server. In my case I have my code in /opt/dotnetAPI/

STEP 3: Create Service file

cat /etc/systemd/system/callhome-bill-api.service

unit file to start .net code

[Unit]
Description=API
Wants=network.target
After=network.target

[Service]
Environment="ASPNETCORE_URLS=http://*:5000"
Environment="ASPNETCORE_WEBROOT=/opt/dotnetAPI/"
Environment="ASPNETCORE_CONTENTROOT=/opt/dotnetAPI/"
ExecStart=/usr/bin/dotnet /opt/dotnetAPI/API.dll
ExecStop=/bin/kill ${MAINPID}
Restart=on-failure
RestartSec=5s
Type=simple

[Install]
WantedBy=multi-user.target

Dot Net Envoirnmnet Variables

Check this link for compiling dotnet code on linux

Enjoy ;)

How to Install Freeswitch from Source on Debian 12

Step 1: Install dependencies

Please execute the following commands to resolve the package/library dependencies for package installation in further steps


apt install aptitude build-essential
aptitude install autoconf libtool libtool-bin pkg-config libpq-dev lua5.4 liblua5.4-dev libmariadb-dev git libtiff-dev libsqlite3-dev libcurl4-openssl-dev libcurl4-nss-dev libcurl4-gnutls-dev libpcre3 libpcre3-dev libspeex-dev libspeexdsp-dev libldns-dev yasm uuid-dev uuid libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev libopencore-amrwb0 libvo-amrwbenc-dev libvo-amrwbenc0 libswscale-dev libavformat-dev libopus-dev libshout3-dev libmpg123-dev libmp3lame-dev libsndfile-dev libapr1 libapr1-dev libncurses5 libncurses5-dev libsctp-dev libsctp1 libtinfo5 sqlite3 unzip zip libedit-dev cmake


For Rockey Linux follow this

Step 2: Install spandsp

git clone https://github.com/freeswitch/spandsp.git
cd spandsp
./bootstrap.sh
./configure
make 
make install

Step 3: Install Sofia SIP

wget https://github.com/freeswitch/sofia-sip/archive/refs/tags/v1.13.17.tar.gz
tar -zxvf v1.13.17.tar.gz
cd sofia-sip-1.13.17
./bootstrap.sh
./configure
make
make install

Step 4: Install libks

build and install libks2 - needed for mod_verto and signalwire


git clone https://github.com/signalwire/libks.git
cd libks
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX
make
sudo make install

Step 5: Install Freeswitch

Download the latest version from the Freeswitch Github repo.


wget https://github.com/signalwire/freeswitch/archive/refs/tags/v1.10.12.tar.gz
tar -zxvf v1.10.12.tar.gz
cd freeswitch
./bootstrap.sh -j


Edit Module files as per your requirements

vim modules.conf
  • enable mod_xml_curl
  • enable mod_curl
  • enable mod_shout
  • disable mod_signalwire

./configure --prefix=/opt/freeswitch


Faced this issue while compiling the code


vim ./src/mod/applications/mod_spandsp/mod_spandsp_dsp.c


Edit file as per the above-mentioned GitHub Issue.


make
make install
ln -s /opt/freeswitch/etc/freeswitch /etc/freeswitch
ln -s /opt/freeswitch/bin/freeswitch /usr/bin/freeswitch
ln -s /opt/freeswitch/bin/fs_cli /usr/bin/fs_cli
useradd -M freeswitch
mkdir -p /opt/freeswitch/run/freeswitch/
chown -R freeswitch:freeswitch /opt/freeswitch


Now create a Service file


vim /etc/systemd/system/freeswitch.service


copy the following content in the file


[Unit]
Description=freeswitch
Wants=network-online.target
Requires=network.target local-fs.target
After=network.target network-online.target

[Service]
; service
Type=forking
#PIDFile=/run/freeswitch.pid
PIDFile=/opt/freeswitch/run/freeswitch/freeswitch.pid
Environment="DAEMON_OPTS=-nonat"
Environment="USER=freeswitch"
Environment="GROUP=freeswitch"
EnvironmentFile=-/etc/default/freeswitch
ExecStartPre=/bin/chown -R ${USER}:${GROUP} /opt/freeswitch
ExecStart=/usr/bin/freeswitch -u ${USER} -g ${GROUP} -run /opt/freeswitch/run/freeswitch -ncwait ${DAEMON_OPTS}
TimeoutSec=45s
Restart=always
; exec
;User=${USER}
;Group=${GROUP}
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
LimitSTACK=250000
LimitRTPRIO=infinity
LimitRTTIME=infinity
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007
NoNewPrivileges=false


Start FreeSWITCH


systemctl daemon-reload
systemctl restart freeswitch


Enjoy 😉

How to compile and run a next application ?

Install nodejs Use  this  link for further reading curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash nvm inst...