OpenSIPS 一键安装脚本-及 OpenSIPs+N个FreeSWITCH 实战技巧(2)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenSIPS 一键安装脚本-及 OpenSIPs+N个FreeSWITCH 实战技巧(2)相关的知识,希望对你有一定的参考价值。

参考技术A SIP账号登陆前 先确保

vi /usr/local/freeswitch/conf/vars.xml

修改了vars.xml中的domain 参数

<X-PRE-PROCESS cmd="set"data="domain=2224local_ip_v4"/>

改为<X-PRE-PROCESS cmd="set"data="domain=h5.wdjbp.com"/>

FS节点需要在ACL里面把 opensips 所在IP 加入白名单

测试验证:

更多了解:qizhikefu2

freeswitch gui

脚本一键安装redis实现主从复制

  1. 安装脚本及配置文件上传至家目录即可,sh执行脚本即可选择主从
    #!/bin/bash
    #Description:atuo install redis
    #Date:2018.4.11

Download_redis=http://download.redis.io/releases/redis-3.2.1.tar.gz
dir1=/opt
redis=redis-3.2.1
redis_conf1=/usr/local/redis-6379/redis.conf
redis_conf2=/usr/local/redis-6380/redis.conf
FILE1=$HOME/6379.conf
FILE2=$HOME/6380.conf
dir2=/server/scripts/redis
count=ps -ef|grep redis|grep -v grep| wc -l

install_yum () {
echo -e "\033[41;37m <===开始安装redis依赖 软件,请稍等...===> \033[0m"
sleep 2
yum install -y gcc wget
}

install_dir () {
cd $dir1
wget -q $Download_redis
echo -e "\033[41;37m <===redis下载中,请稍后...===> \033[0m"
tar xf redis-3.2.1.tar.gz -C /usr/local
cd /usr/local/$redis
make
make PREFIX=${redis_setup_dir} install
if [ echo $? -eq 0 ];then
echo -e "\e[1;32m redis安装成功. \e[0m"
elif [ echo $? -ne 0 ];then
echo -e "\e[1;31m redis安装失败,请检查环境. \e[0m"
exit
fi
sleep 1
}

select_or () {
echo "---------------------------------------------------------------
select Master Slave
1 Master
2 Slave
----------------------------------------------------------------"

read input

case "$input" in 
     1)
      mv /usr/local/$redis /usr/local/redis-6379
      sleep 1
      cd /usr/local/redis-6379
      cp -f redis.conf redis.conf.bak
      cat "$HOME/6379.conf" >$redis_conf1
      /usr/local/redis-6379/src/redis-server /usr/local/redis-6379/redis.conf &
      sleep 3
      ;;
     2)
      mv /usr/local/$redis /usr/local/redis-6380
      sleep 1
      cd /usr/local/redis-6380
      cp -f redis.conf redis.conf.bak
      cat "$HOME/6380.conf" >$redis_conf2
      /usr/local/redis-6380/src/redis-server /usr/local/redi

s-6380/redis.conf &
sleep 3
;;
*)
echo "---------------------------------------------------------------
select Master Slave
1 Master
2 Slave
----------------------------------------------------------------"
esac
}

count_conf () {
if [ $count -gt 1 ];then
echo -e "\e[1;32m redis is running \e[0m"
elif [ $count -le 1 ];then
echo -e "\e[1;31m redis is not running \e[0m"
fi
}

install_yum
install_dir
select_or
count_conf


2.主配置文件
daemonize yes
pidfile /usr/local/redis-6379/run/redis.pid
bind 0.0.0.0
port 6379
timeout 300
tcp-keepalive 0
loglevel notice
#logfile stdout
databases 16
unixsocketperm 0
maxmemory 2000000000
maxmemory-policy volatile-lru
maxmemory-samples 3
maxclients 10000
#save 900 1
#save 300 10
#save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
slave-serve-stale-data yes
slave-read-only yes
repl-ping-slave-period 10
repl-timeout 60
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 1024
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10


3.从配置文件
daemonize yes
pidfile /usr/local/redis-6380/run/redis.pid
port 6380
timeout 300
tcp-keepalive 0
loglevel notice
#logfile stdout
databases 16
unixsocketperm 0
maxmemory 2000000000
maxmemory-policy volatile-lru
maxmemory-samples 3
maxclients 10000
#save 900 1
#save 300 10
#save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
slaveof 192.168.1.42 6379 (根据你实际的本地环境配置为主的ip 及端口)
slave-serve-stale-data yes
slave-read-only yes
repl-ping-slave-period 10
repl-timeout 60
repl-disable-tcp-nodelay no
slave-priority 100
appendonly yes
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 1024
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10

以上是关于OpenSIPS 一键安装脚本-及 OpenSIPs+N个FreeSWITCH 实战技巧(2)的主要内容,如果未能解决你的问题,请参考以下文章

vos3000+opensips+jssip实现网页通话

Debian 10 编译安装 OpenSIPS 2.4.11

OpenSIPS 安装配置

linux-qcow2格式安装虚拟机及脚本一键克隆qcow2虚拟机

LAMP一键安装脚本

centos怎么样编写一键安装脚本