环境
负载均衡+数据库服务器
Centos-5.4 + kamailio-3.1.4 + mysql-5.0.77-4.el5_6.6
IP:192.168.1.30
asterisk服务器1
Centos-5.4 + asterisk-1.8
IP:192.168.1.31
asterisk服务器2
Centos-5.4 + asterisk-1.8
IP:192.168.1.32
目的
1:假设一个简易的asterisk 集群,通过realtime 技术,在集中的一个数据库中管理所有集群节点的分机号和拨号规则
2:asterisk服务器1上分机号段为 8100-8199
asterisk服务器2上分机号段为 8200-8299
3: 实现同一台asteisk服务器上分机互打
4:实现同一号段分机互打
5:实现不同号段分机互打(由kamailio服务器转发)
配置
1:asterisk服务器1
[root@localhost asterisk]# cat /etc/asterisk/res_config_mysql.conf
[general]
dbhost = 192.168.1.30
dbname = asterisk
dbuser = root
dbpass = luckytuo@gmail.com
dbport = 3306
[root@localhost asterisk]# cat /etc/asterisk/extconfig.conf
[settings]
sipusers => mysql,general,ast_sipfriends ; edit by tolooney
sippeers => mysql,general,ast_sipfriends ; edit by tolooney
extensions => mysql,general,ast_extensions_01 ; edit by tolooney
[root@localhost asterisk]# cat /etc/asterisk/extensions.conf
[internal]
switch => Realtime/internal@extensions ; edit by tolooney
[root@localhost asterisk]# cat /etc/asterisk/sip.conf
[general]
context=internal
rtcachefriends=yes
disallow=all
allow=ulaw
allow=ilbc
2:asterisk服务器2
[root@localhost asterisk]# cat /etc/asterisk/res_config_mysql.conf
[general]
dbhost = 192.168.1.30
dbname = asterisk
dbuser = root
dbpass = luckytuo@gmail.com
dbport = 3306
[root@localhost asterisk]# cat /etc/asterisk/extconfig.conf
[settings]
sipusers => mysql,general,ast_sipfriends ; edit by tolooney
sippeers => mysql,general,ast_sipfriends ; edit by tolooney
extensions => mysql,general,ast_extensions_02 ; edit by tolooney
[root@localhost asterisk]# cat /etc/asterisk/extensions.conf
[internal]
switch => Realtime/internal@extensions ; edit by tolooney
[root@localhost asterisk]# cat /etc/asterisk/sip.conf
[general]
context=internal
rtcachefriends=yes
disallow=all
allow=ulaw
allow=ilbc
备注:分机号存放在ast_sipfriends表中,拨号规则分别存在ast_extensions_01,ast_extensions_02..表中