https://blog.csdn.net/shizidushu/article/details/141127680
https://www.opensourcelisting.com/how-to-install-freeswitch-on-ubuntu-22-04/#google_vignette
1.conf/vars.xml 修改external_rtp_ip 、external_sip_ip 为本机IP
<X-PRE-PROCESS cmd="stun-set" data="external_rtp_ip=10.161. "/>
<X-PRE-PROCESS cmd="stun-set" data="external_sip_ip=10.161. "/>
--------------------
2.修改: 默认密码<X-PRE-PROCESS cmd="set" data="default_password=0212"/>
------------------------------------------
3.autoload_configs/modules.conf 注释掉的 module
<!-- <load module="mod_signalwire"/> -->
mod_signalwire
mod_verto
4.conf\sip_profiles\internal.xml,external.xml,internal-ipv6.xml,external-ipv6.xml
<param name="rtp-timeout-sec" value="300"/>
<param name="rtp-hold-timeout-sec" value="1800"/>
参数名称过期了换成 rtp-timeout-sec-》media_timeout ,rtp-hold-timeout-sec-》media_hold_timeout
<param name="media_timeout" value="300"/>
<param name="media_hold_timeout" value="1800"/>
------------------------------------
5.播号计划放在dialplan\default目录下,因为在default.xml定义了这个引用,按f6重启生效
ivr_menus目录只定义菜单
-----------------
6.配置postgresql
6.1、switch.conf.xml
<param name="core-db-dsn" value="pgsql://hostaddr=10.161.83.24 dbname=freeswitch user=freeswitch password='12345' options='-c client_min_messages=NOTICE' application_name='freeswtich'"/>
!!!!!!!!-----<param name="auto-create-schemas" value="false"/> ------- !!!!!!!!--------这个一定要配置为FALSE ,否则清库
6.2、cdr_pg_csv.conf.xml
<!-- See parameters for PQconnectdb() at http://www.postgresql.org/docs/8.4/static/libpq-connect.html -->
<param name="db-info" value="host=10.161.83.24 dbname=freeswitch user=freeswitch password='12345' connect_timeout=10" />
<!-- Log a-leg (a), b-leg (b) or both (ab) -->
<param name="legs" value="ab"/> ---使用ab
<!-- CDR table name -->
<param name="db-table" value="cdr"/> ---启用
6.3、db.conf.xml、voicemail.conf.xml、internal.xml、internal-ipv6.xml、external.xml、external-ipv6.xml、fifo.conf.xml、callcenter.conf.xml
<param name="odbc-dsn" value="pgsql://hostaddr=10.161.83.24 dbname=freeswitch user=freeswitch password='12345' options='-c client_min_messages=NOTICE' application_name='freeswtich'"/>
db.conf.xml:第3行
voicemail.conf.xml:第69行
internal.xml:第238行
internal-ipv6.xml:第66行
external.xml:第54行
external-ipv6.xml:第56行
fifo.conf.xml:第4行
callcenter.conf.xml :第4行
-------------------------------以上都是新增-----
6.4、vars.xml
<X-PRE-PROCESS cmd="set" data="json_db_handle=pgsql://hostaddr=10.161.83.24 dbname=freeswitch user=freeswitch password='12345' options='-c client_min_messages=NOTICE'"/>
第440行
-------------------------------以上都是新增-----
6.5、modules.conf.xml
reload mod_cdr_pg_csv
<!-- 配置posggresql启用 -->
<load module="mod_cdr_pg_csv"/> -------------------------------是新增-----
<!-- 配置posggresql启用 -->
modules.conf.xml 关闭csv 启用数据库方式
<!-- <load module="mod_cdr_csv"/>-->
6.6 建表
create table cdr (
id serial primary key,
local_ip_v4 inet not null,
caller_id_name varchar,
caller_id_number varchar,
destination_number varchar not null,
context varchar not null,
start_stamp timestamp with time zone not null,
answer_stamp timestamp with time zone,
end_stamp timestamp with time zone not null,
duration int not null,
billsec int not null,
hangup_cause varchar not null,
uuid uuid not null,
bleg_uuid uuid,
accountcode varchar,
read_codec varchar,
write_codec varchar,
sip_hangup_disposition varchar,
ani varchar
);
---------------
7. 配置网关: 在conf\dialplan\public 目录下增加文件my_did.xml ,内容如下
<include>
<extension name="public_did">
<condition field="destination_number" expression="^(8234x)$">
<action application="sleep" data="1000"/>
<action application="set" data="domain_name=$${domain}"/>
<action application="transfer" data="5000 XML default"/>
</condition>
</extension>
</include>
------------------------------------------
8. 在vars.xml 中修改对接的端口
<!-- Internal SIP Profile -->
<X-PRE-PROCESS cmd="set" data="internal_sip_port=5060"/>
<X-PRE-PROCESS cmd="set" data="internal_tls_port=5061"/>
<!-- External SIP Profile -->
<X-PRE-PROCESS cmd="set" data="external_sip_port=5560"/>
<X-PRE-PROCESS cmd="set" data="external_tls_port=5081"/>
-------------------------------
9.配置网关: 在C:\Program Files\FreeSWITCH\conf\sip_profiles\external 目录下增加文件my_gate.xml ,内容如下
<include>
<gateway name="mygate">
<param name="realm" value="192.168 :5060"/>
<param name="username" value="0108234x"/>
<param name="register" value="false"/>
</gateway>
</include>
10.配置打电话调用网关: 在C:\Program Files\FreeSWITCH\conf\dialplan\default 目录下增加文件mycall.xml ,内容如下
<include>
<extension name="mygatex">
<condition field="destination_number" expression="^mygatex(\d+)$">
<action application="bridge" data="{sip_invite_call_id=${sip_call_id}}sofia/gateway/mygatex/$1"/>
</condition>
</extension>
</include>
10.开启ESL
event_socket.conf 启用并配置
<param name="apply-inbound-acl" value="socket"/>
acl.conf 增加
<list name="socket" default="allow">
<node type="allow" cidr="110.161.22.117"/>
</list>
11. 监听以挂断为判断,如多个未挂断,则以最新的一个,进行监听编码如下设置:
vars.xml放开注释:
/// PCMA 提前
//<X-PRE-PROCESS cmd = "set" data="global_codec_prefs= "/>
//<X-PRE-PROCESS cmd = "set" data="outbound_codec_prefs= "/>
//<X-PRE-PROCESS cmd = "set" data="inbound_codec_prefs= "/>
<X-PRE-PROCESS cmd="set" data="global_codec_prefs= "/>
<X-PRE-PROCESS cmd="set" data="outbound_codec_prefs= "/>
<X-PRE-PROCESS cmd="set" data="inbound_codec_prefs= "/>
12.配置分机分叉
conf/sip_profiles/internal.xml
<!-- Can be 'true' or 'contact' -->
<param name="multiple-registrations" value="true"/>
cd /usr/local/src/
git clone https://github.com/signalwire/libks.git
cd libks
cmake .
make && make install
cd /usr/local/src/
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c/
cmake .
make && make install
ln -sf /usr/local/lib/pkgconfig/signalwire_client2.pc /usr/lib/pkgconfig/signalwire_client2.pc
cd /usr/local/src/
git clone http://git.videolan.org/git/x264.git
cd x264
## 若不安装 mod_av 采用此命令: ./configure --prefix=/usr/x264/ --includedir=/usr/local/include --libdir=/usr/local/lib --enable-shared --disable-asm
./configure --disable-asm
make && make install
./configure --prefix=/usr/local --enable-shared CFLAGS=-fPIC
make && make install
find / -name libpython3
ln -s /usr/local/lib/libpython3.12.so.1.0 /usr/lib/libpython3.12.so.1.0
./configure -enable-core-odbc-support --enable-core-pgsql-support --enable-core-mysql-support --with-python3=/usr/local/bin/python3 --with-python=no
make -j 32
sudo make install
sudo ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
sudo ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin
sudo ln -s /usr/local/freeswitch/conf /etc/freeswitch
groupadd freeswitch
adduser --quiet --system --home /usr/local/freeswitch --ingroup freeswitch freeswitch --disabled-password
chown -R freeswitch:freeswitch /usr/local/freeswitch/
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*
systemctl daemon-reload
systemctl enable freeswitch.service
-------------------------- FreeSWITCH configuration --------------------------
Locations:
prefix: /usr/local/freeswitch
exec_prefix: /usr/local/freeswitch
bindir: ${exec_prefix}/bin
confdir: /usr/local/freeswitch/conf
libdir: ${exec_prefix}/lib
datadir: /usr/local/freeswitch
localstatedir: /usr/local/freeswitch
includedir: /usr/local/freeswitch/include/freeswitch
certsdir: /usr/local/freeswitch/certs
dbdir: /usr/local/freeswitch/db
grammardir: /usr/local/freeswitch/grammar
htdocsdir: /usr/local/freeswitch/htdocs
fontsdir: /usr/local/freeswitch/fonts
logfiledir: /usr/local/freeswitch/log
modulesdir: /usr/local/freeswitch/mod
pkgconfigdir: ${exec_prefix}/lib/pkgconfig
recordingsdir: /usr/local/freeswitch/recordings
imagesdir: /usr/local/freeswitch/images
runtimedir: /usr/local/freeswitch/run
scriptdir: /usr/local/freeswitch/scripts
soundsdir: /usr/local/freeswitch/sounds
storagedir: /usr/local/freeswitch/storage
cachedir: /usr/local/freeswitch/cache
转载请注明:SuperIT » freeswitch编译安装