const 发布的文章

“const”

第一步,安装系统依赖

sudo apt install curl wget git subversion build-essential autoconf automake libtool libncurses5 libncurses5-dev make libjpeg-dev libtool libtool-bin libsqlite3-dev libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev yasm liblua5.2-dev libopus-dev cmake libtiff-dev  libcodec2-dev libcodec2-dev portaudio19-dev libmagickcore-dev libmp3lame-dev libmpg123-dev libshout3-dev libvlc-dev libpq-dev libmariadb-dev libldap2-dev erlang librabbitmq-dev libsmpp34-dev libyaml-dev libmongoc-dev libopencv-dev  libmemcached-dev libavformat-dev  libh2o-dev libsoundtouch-dev libhiredis-dev libopus-dev  autoconf automake devscripts gawk gettext libcurl4-openssl-dev libdb-dev libedit-dev libgdbm-dev libldns-dev libncurses5-dev libopus-dev libopus-ocaml libpcre3-dev libperl-dev libpq-dev libspeex-dev libspeexdsp-dev libssl-dev libtiff5-dev libtool libtool-bin libvorbis0a libogg0 libsqlite3-dev libogg-dev libvorbis-dev portaudio19-dev libshout3-dev libmpg123-dev libmp3lame-dev yasm libbsd-dev flite flite1-dev libflite1 liblua5.2-0 liblua5.2-dev lua5.2 luarocks libsndfile-dev -y

第二步,把gcc g++ 降级到gcc 10

sudo apt install gcc-10 g++-10 cpp-10 -y 
sudo ln -s /usr/bin/gcc-10 /usr/bin/gcc 
sudo ln -s /usr/bin/g++-10 /usr/bin/g++

第三步,安装openssl1.1.1

mkdir -p ~/opt/openssl 
wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz --no-check-certificate -P ~/opt/openssl/
tar -xzvf ~/opt/openssl/openssl-1.1.1q.tar.gz -C ~/opt/openssl/ 
cd ~/opt/openssl/openssl-1.1.1q
./config
make 
sudo make install
sudo cp /usr/local/bin/openssl /usr/bin/openssl

第四步,安装Spandsp

cd ~/opt
git clone https://github.com/freeswitch/spandsp ~/opt/spandsp
git reset --hard 67d2455efe02e7ff0d897f3fd5636fed4d54549e 

这个是解决常量未定义问题的.error: ‘V18_MODE_5BIT_4545’ undeclared

cd ~/opt/spandsp
./bootstrap.sh
./configure
make
sudo make install 

第五步,安装Sofia-sip (SIP User-Agent library)

cd ~/opt
git clone https://github.com/freeswitch/sofia-sip.git ~/opt/sofia-sip
cd ~/opt/sofia-sip
./bootstrap.sh
./configure
make
sudo make install 

第六步,安装freeswitch

cd ~/opt
git clone https://github.com/signalwire/freeswitch.git -b v1.10 /opt/freeswitch

这个源码也可以在官网下载
https://files.freeswitch.org/releases/freeswitch/
https://files.freeswitch.org/releases/freeswitch/freeswitch-1.10.10.-release.tar.xz

cd ~/opt/freeswitch

禁用二个模块

vi ~/opt/freeswitch/modules.conf

注释掉mod_verto和mod_signalwire,在上面的文件中,找到对应行,在行首加上#号即可.如果需要安装这二个模块,也可以编译安装,见后面.

./bootstrap.sh -j
CFLAGS=-Wno-error ./configure --prefix=/usr/local/freeswitch --enable-core-pgsql-support --enable-zrtp
make
sudo make install

然后运行

sudo /usr/local/freeswitch/bin/freeswitch -nc

也可以建立符号连接,

sudo ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin/freeswitch
sudo ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin/fs_cli

   
启动FreeSwitch服务器,

sudo freeswitch -nc

启动FreeSwitch客户端,

fs_cli

补充:
安装libks

cd ~/opt
git clone https://github.com/signalwire/libks.git
cd libks
cmake .
make
sudo make install

安装signalwire

cd ~/opt
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c
cmake .
make
sudo make install

将上述补充模块安装完成后,再编译freeswitch功能.

参考:
https://soufianebouchaa.medium.com/freeswitch-ci-cd-on-ubuntu-22-04-debian-11-part-1-75fb1be97316
https://blog.csdn.net/weixin_43805407/article/details/130692942
https://blog.csdn.net/szkbsgy/article/details/126431526
https://github.com/signalwire/freeswitch/issues/2158
https://blog.csdn.net/qq_36369267/article/details/131564019
https://files.freeswitch.org/releases/freeswitch/

在使用scp命令传输文件的时候,碰到了服务器上目录中包含空格的情况,对于这种情况,需要将地址加上双引号,并且空格前加入,这样才能够正确识别。

scp -r root@192.168.0.51:"/home/xxj/Documents/files/xx\ xx\ jj.tar.gz" ./

Referenced from:https://www.jianshu.com/p/11e3beb6d766

在 Ubuntu 中,我们可以找到一个诊断工具来控制错误报告,只需在应用程序启动器中搜索“诊断”,它就会出现。

然后取消选中该选项:向 Canonical 发送错误报告

从终端禁用 Appport
要禁用 apport 错误报告功能,只需打开终端并使用 nano 编辑 /etc/default/apport :

nano /etc/default/apport

将启用值更改为 0:

enabled=0

Referenced from:https://www.onitroad.com/jc/faq/disable-error-reporting-ubuntu.html

golang 获取指定uid 的用户目录

package main

import (
    "fmt"
    "os/user"
)

func main() {
    u, err := user.Current()
    if err != nil {
        fmt.Println("error")
    }
    fmt.Printf("u.Uid: %s, u.Gid: %s, u.Name: %s, u.HomeDir: %s, u.Username: %s\n",
        u.Uid, u.Gid, u.Name, u.HomeDir, u.Username)

    lu, err := user.Lookup("wohu")
    if err != nil {
        fmt.Println("error")
    }
    fmt.Printf("lu.Uid: %s, lu.Gid: %s, lu.Name: %s, lu.HomeDir: %s, lu.Username: %s\n",
        lu.Uid, lu.Gid, lu.Name, lu.HomeDir, lu.Username)

    li, err := user.LookupId("1000")
    if err != nil {
        fmt.Println("error")
    }
    fmt.Printf("li.Uid: %s, li.Gid: %s, li.Name: %s, li.HomeDir: %s, li.Username: %s\n",
        li.Uid, li.Gid, li.Name, li.HomeDir, li.Username)

    lg, err := user.LookupGroup("wohu")
    if err != nil {
        fmt.Println("error")
    }
    fmt.Printf("lg.Gid: %s, lg.Name: %s\n",
        lg.Gid, lg.Name)

    lgi, err := user.LookupGroupId("1000")
    if err != nil {
        fmt.Println("error")
    }
    fmt.Printf("lgi.Gid: %s, lgi.Name: %s\n",
        lgi.Gid, lgi.Name)

}

Referenced from:https://blog.csdn.net/wohu1104/article/details/106433469