diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 52a49f1..abbf8a1 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -28,7 +28,8 @@ module.exports = { { text: '首页', link: '/' }, { text: 'FreeSWITCH', link: '/freeswitch/' }, { text: 'PHP', link: '/php/' }, - { text: 'Docker', link: '/docker/' } + { text: 'Docker', link: '/docker/' }, + { text: 'Go', link: '/go/' } ], sidebar: { '/freeswitch/': [ @@ -39,7 +40,8 @@ module.exports = { collapsable: true, // 可选的, 默认值是 true, sidebarDepth: 1, // 可选的, 默认值是 1 children: [ - '/freeswitch/debian11', + '/freeswitch/docker', + '/freeswitch/debian12', '/freeswitch/mod_unimrcp', '/freeswitch/debian-service', '/freeswitch/ubuntu1604' @@ -72,14 +74,20 @@ module.exports = { 'rabbitmq-stomp', 'elasticsearch-ik', ], + '/go/': [ + '../', + '', + 'proxy', + ], '/': [ '', { - title: 'FreeSWITCH精选', // 必要的 + title: 'FreeSWITCH', // 必要的 collapsable: false, // 可选的, 默认值是 true, sidebarDepth: 1, // 可选的, 默认值是 1 children: [ - '/freeswitch/debian11', + '/freeswitch/docker', + '/freeswitch/debian12', '/freeswitch/mod_unimrcp', '/freeswitch/debian-service', '/freeswitch/ubuntu1604', @@ -87,7 +95,7 @@ module.exports = { ] }, { - title: 'PHP精选', // 必要的 + title: 'PHP', // 必要的 collapsable: false, // 可选的, 默认值是 true, sidebarDepth: 1, // 可选的, 默认值是 1 children: [ @@ -100,7 +108,7 @@ module.exports = { ] }, { - title: 'Docker精选', // 必要的 + title: 'Docker', // 必要的 collapsable: false, // 可选的, 默认值是 true, sidebarDepth: 1, // 可选的, 默认值是 1 children: [ @@ -109,6 +117,14 @@ module.exports = { '/docker/rabbitmq-stomp', '/docker/elasticsearch-ik', ] + }, + { + title: 'Go', // 必要的 + collapsable: false, // 可选的, 默认值是 true, + sidebarDepth: 1, // 可选的, 默认值是 1 + children: [ + '/go/proxy', + ] } ] }, diff --git a/docs/freeswitch/debian11.md b/docs/freeswitch/debian12.md similarity index 84% rename from docs/freeswitch/debian11.md rename to docs/freeswitch/debian12.md index e15df30..5ac60b5 100644 --- a/docs/freeswitch/debian11.md +++ b/docs/freeswitch/debian12.md @@ -1,8 +1,8 @@ -# Debian11编译安装FreeSWITCH1.10.10 +# Debian12编译安装FreeSWITCH1.10 -> wandoubaba / 2023-01-15 +> wandoubaba / 2024-08-19 -本文以Debian11和FreeSWITCH1.10.10为例,介绍一步一步编译安装FreeSWITCH的方法。 +本文以Debian12和FreeSWITCH1.10.12为例,介绍一步一步编译安装FreeSWITCH的方法。 ## 先下载/克隆各种资源 @@ -10,13 +10,13 @@ # 假设所有资源都下载到/opt/目录下 cd /opt # 下载FreeSWITCH源码 -git clone -b v1.10.10 https://github.com/signalwire/freeswitch freeswitch +git clone -b v1.10 https://github.com/signalwire/freeswitch freeswitch # 下载libks源码 git clone https://github.com/signalwire/libks # 下载sofia-sip源码 git clone https://github.com/freeswitch/sofia-sip # 下载spandsp源码 -git clone https://github.com/freeswitch/spandsp +git clone -b fs https://github.com/freeswitch/spandsp # 下载signalwire-c源码 git clone https://github.com/signalwire/signalwire-c ``` @@ -32,18 +32,21 @@ git clone https://github.com/signalwire/signalwire-c ```shell # 安装FreeSWITCH需要的依赖 sudo apt-get install -y \ - build-essential cmake automake autoconf libtool libtool-bin pkg-config \ - libssl-dev zlib1g-dev libdb-dev unixodbc-dev libncurses5-dev libexpat1-dev libgdbm-dev bison erlang-dev libtpl-dev libtiff5-dev uuid-dev \ + build-essential cmake automake autoconf 'libtool-bin|libtool' pkg-config \ + libssl-dev zlib1g-dev libdb-dev unixodbc-dev libncurses5-dev \ + libexpat1-dev libgdbm-dev bison erlang-dev libtpl-dev libtiff5-dev uuid-dev \ libpcre3-dev libedit-dev libsqlite3-dev libcurl4-openssl-dev nasm \ libogg-dev libspeex-dev libspeexdsp-dev \ libldns-dev \ python3-dev \ - libavformat-dev libswscale-dev libavresample-dev \ - liblua5.1-dev \ + libavformat-dev libswscale-dev 'libswresample-dev|libavresample-dev' \ + liblua5.3-dev \ libopus-dev \ libpq-dev \ + libsndfile1-dev libflac-dev libogg-dev libvorbis-dev \ libshout3-dev libmpg123-dev libmp3lame-dev \ - libsndfile1-dev libflac-dev libogg-dev libvorbis-dev + lsb-release + # 安装libks cd libks cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1 @@ -75,6 +78,7 @@ cd .. ```shell # 编译安装FreeSWITCH cd freeswitch +sed -i 's|#formats/mod_shout|formats/mod_shout|' build/modules.conf.in ./bootstrap.sh -j ./configure make -j`nproc` diff --git a/docs/freeswitch/docker.md b/docs/freeswitch/docker.md new file mode 100644 index 0000000..5d2ccf3 --- /dev/null +++ b/docs/freeswitch/docker.md @@ -0,0 +1,95 @@ +# 制作FreeSWITCH镜像的Dockerfile + +> wandoubaba / 2024-08-19 + +下面是基于`debian:bookworm`镜像制作FreeSWITCH1.10.12版服务镜像,同时安装`mod_unimrcp`模块并开启`mod_shout`模块。 + +```dockerfile +FROM debian:bookworm + +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y wget tar git \ + build-essential cmake automake autoconf 'libtool-bin|libtool' pkg-config \ + libssl-dev zlib1g-dev libdb-dev \ + unixodbc-dev libncurses5-dev \ + libexpat1-dev libgdbm-dev bison erlang-dev \ + libtpl-dev libtiff5-dev uuid-dev \ + libpcre3-dev libedit-dev libsqlite3-dev \ + libcurl4-openssl-dev nasm \ + libogg-dev libspeex-dev libspeexdsp-dev \ + libldns-dev \ + python3-dev \ + libavformat-dev libswscale-dev 'libswresample-dev|libavresample-dev' \ + liblua5.3-dev \ + libopus-dev \ + libpq-dev \ + libsndfile1-dev libflac-dev libogg-dev libvorbis-dev \ + libshout3-dev libmpg123-dev libmp3lame-dev \ + lsb-release + +RUN mkdir /install && cd /install && \ + git clone -b v1.10 https://github.com/signalwire/freeswitch freeswitch && \ + git clone https://github.com/signalwire/libks && \ + git clone https://github.com/freeswitch/sofia-sip && \ + git clone -b fs https://github.com/freeswitch/spandsp && \ + git clone https://github.com/signalwire/signalwire-c && \ + git clone https://github.com/unispeech/unimrcp.git && \ + git clone https://github.com/freeswitch/mod_unimrcp.git && \ + wget https://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download -O unimrcp-deps-1.6.0.tar.gz && \ + tar xvzf unimrcp-deps-1.6.0.tar.gz + +RUN cd /install/libks && \ + cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1 && \ + make install + +RUN cd /install/sofia-sip && \ + ./bootstrap.sh && \ + ./configure CFLAGS="-g -ggdb" --with-pic --with-glib=no --without-doxygen --disable-stun --prefix=/usr && \ + make -j`nproc --all` && \ + make install + +RUN cd /install/spandsp && \ + ./bootstrap.sh && \ + ./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr && \ + make -j`nproc --all` && \ + make install + +RUN cd /install/signalwire-c && \ + PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && \ + make install + +RUN cd /install/freeswitch && \ + sed -i 's|#formats/mod_shout|formats/mod_shout|' build/modules.conf.in && \ + ./bootstrap.sh -j && \ + ./configure && \ + make -j`nproc` && \ + make install && \ + make cd-sounds-install && \ + make cd-moh-install && \ + make uhd-sounds-install && \ + make uhd-moh-install && \ + make hd-sounds-install && \ + make hd-moh-install && \ + make sounds-install && \ + make moh-install && \ + ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/ && \ + ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/ + +RUN cd /install/unimrcp-deps-1.6.0/libs/apr && \ + ./configure --prefix=/usr/local/apr && \ + make && make install && \ + cd ../apr-util && \ + ./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr && \ + make && make install && \ + cd ../../../unimrcp && \ + ./bootstrap && \ + ./configure --with-sofia-sip=/usr && \ + make && make install && \ + cd ../mod_unimrcp && \ + export PKG_CONFIG_PATH=/usr/local/freeswitch/lib/pkgconfig:/usr/local/unimrcp/lib/pkgconfig && \ + ./bootstrap.sh && \ + ./configure && \ + make && make install + +RUN apt-get clean +``` diff --git a/docs/freeswitch/mod_unimrcp.md b/docs/freeswitch/mod_unimrcp.md index 193d6ed..239b2c4 100644 --- a/docs/freeswitch/mod_unimrcp.md +++ b/docs/freeswitch/mod_unimrcp.md @@ -1,14 +1,14 @@ -## FreeSWITCH安装mod_unimrcp模块 +# FreeSWITCH安装mod_unimrcp模块 > wandoubaba / 2023-01-18 本文操作过程基于Debian11操作系统。自FreeSWITCH1.10.8开始,mod_unimrcp已经从FreeSWITCH主库分离,成为独立项目,因此不能再用`make mod_unimrcp-install`命令安装模块了。 -### 确保FreeSWITCH已经安装成功 +## 确保FreeSWITCH已经安装成功 安装过程请参见[Debian编译安装FreeSWITCH](debian.html)。 -### 安装unimrcp和依赖 +## 安装unimrcp和依赖 下面的操作如果在root账号下,请省略`sudo`前缀。 @@ -39,7 +39,7 @@ sudo make install cd .. ``` -### 安装mod_unimrcp +## 安装mod_unimrcp 按照下面的程序清单执行完毕后,在FreeSWITCH的安装目录下的mod目录中会出现`mod_unimrcp.so`文件,如`/usr/local/freeswitch/mod/mod_unimrcp.so`。 @@ -61,7 +61,7 @@ libtoolize --version libtoolize --automake --copy --debug --force ``` -### 在FreeSWITCH配置中启用mod_unimrcp +## 在FreeSWITCH配置中启用mod_unimrcp 编辑配置文件`/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml`,在`configuration->modules`节点下,追加下面一行配置: diff --git a/docs/go/README.md b/docs/go/README.md new file mode 100644 index 0000000..81f0371 --- /dev/null +++ b/docs/go/README.md @@ -0,0 +1 @@ +# go相关 diff --git a/docs/go/proxy.md b/docs/go/proxy.md new file mode 100644 index 0000000..7cb3db1 --- /dev/null +++ b/docs/go/proxy.md @@ -0,0 +1,13 @@ +# 解决`go mod tidy`加载模块超时的问题 + +## 查看go环境相关信息 + +```sh +go env +``` + +## 修改`GOPROXY`配置 + +```sh +go env -w GOPROXY=https://goproxy.cn +```