Upgrade Notes 23.09-23.12

Before the update:

  1. Perform a system backup!
  2. Updating to Debian 12 Linux requires server reboot.
  3. Updating OpenSIPS to version 3.4 LTS requires manual configuration file update.

Algorithm of update

  1. Stop Webitel services
  2. Update Debian Linux to version 12
  3. Update Webitel applications to v23.12
  4. Transition to OpenSIPS 3.4 LTS
  5. Database migration from Webitel v23.09 to v23.12
  6. Restart all Webitel services

Stopping Webitel services:

systemctl stop webitel-api webitel-app webitel-uac messages-bot messages-srv \
  engine call_center storage flow_manager rabbitmq-server consul \
  freeswitch ngcp-rtpengine-daemon opensips grafana-server nginx

Updating Debian Linux and updating Webitel to v23.12.

sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sed -i 's/23.09-releases/23.12-releases/g;s/bullseye/bookworm/g' /etc/apt/sources.list.d/*
	
echo "deb https://deb.sipwise.com/spce/mr11.5.1 bookworm main" > /etc/apt/sources.list.d/rtpengine.list

apt update
apt upgrade --without-new-pkgs
apt full-upgrade
	
sudo -u postgres psql webitel -qxc "ALTER DATABASE webitel REFRESH COLLATION VERSION;"
sudo -u postgres psql webitel -qxc "ALTER EXTENSION timescaledb UPDATE;"
	
shutdown -r now

systemctl stop webitel-api webitel-app webitel-uac messages-bot messages-srv \
  engine call_center storage flow_manager rabbitmq-server consul \
  freeswitch ngcp-rtpengine-daemon opensips grafana-server nginx
    
apt install --reinstall linux-headers-`uname -r` \
	ngcp-rtpengine-daemon ngcp-rtpengine-iptables ngcp-rtpengine-kernel-dkms

Transition to OpenSIPS 3.4 LTS

echo "deb https://apt.opensips.org bookworm 3.4-releases" > /etc/apt/sources.list.d/opensips.list  
apt update && apt upgrade
apt install opensips-auth-modules opensips-tls-wolfssl-module

After the update, it is necessary to make changes to the configuration file:

curl https://git.webitel.com/projects/WEP/repos/opensips/raw/opensips.cfg \
    -o /etc/opensips/opensips-34.cfg
vimdiff /etc/opensips/opensips.cfg /etc/opensips/opensips-34.cfg

If you use SIP TLS, it is recommended to replace the "tls_openssl.so" module with "tls_wolfssl.so". Other changes can be found in the official documentation:

Database migration from Webitel v23.09 to v23.12

su postgres
cd ~
psql -1 -f /usr/share/postgresql/15/webitel/migration/23.09-23.12.sql webitel
exit

Remove old packages:

apt --purge autoremove

Restart Webitel v23.12

systemctl restart consul
systemctl restart postgresql
systemctl restart rabbitmq-server

systemctl restart webitel-app webitel-uac webitel-api engine \
  messages-srv flow_manager messages-bot call_center storage webitel-logger \
  freeswitch ngcp-rtpengine-daemon opensips grafana-server nginx
After update
with q as (
    select h.id, string_agg(distinct nums.from_number, '|') filter ( where  nums.from_number != '' and nums.from_number notnull ) numbers
    from call_center.cc_calls_history h
        left join call_center.cc_calls_history h2 on h2.parent_id = h.id
        left join lateral (
            select h.from_number
            union distinct
            select h.to_number
            union distinct
            select h.destination
            union distinct
            select h2.from_number
            union distinct
            select h2.to_number
            union distinct
            select h2.destination
        ) nums on true
    where h.created_at between now()::date - interval '30d' and now()
    group by 1
)
update call_center.cc_calls_history h
set search_number = q.numbers
from q
where q.id = h.id;