kamailio的前身叫openser, 和opensips是兄弟,作为出色的sip proxy,在大并发量使用时经常用于负载均衡 媒体服务器 Asterisk、Freeswitch等实现集群。
1. 安装kamailio
参考上一篇文章安装:Centos 6.4 上源码安装 kamailio 4.1
2. 配置 kamailio
下面为配置好的主配置文件,dispacher模块有一些参数需要注意,默认下一跳地址的配置支持数据库和文本文件,本文测试默认使用文本文件方式,
不用mysql数据库存储,注释掉下面两行。
#modparam("dispatcher", "db_url", DBURL)
#modparam("dispatcher", "table_name", "dispatcher")
设置默认配置下一跳的文本文件位置:
modparam("dispatcher", "list_file", "/usr/local/etc/kamailio/dispatcher.list")
/usr/local/etc/kamailio/dispatcher.list
文件添加freeswitch地址
1 sip:192.168.5.4:5080
1 sip:192.168.5.5:5080
1 sip:192.168.5.6:5080
通过path 支持注册消息下一跳的记录。
定制化的kamailio配置文件如下:
#!KAMAILIO
#
# sample config file for dispatcher module
# - load balancing of VoIP calls with round robin
# - dispatch REGISTER and presence requests
#
#
# Direct your questions about this file to: sr-users@lists.sip-router.org
#
# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
# for an explanation of possible statements, functions and parameters.
#
# Several features can be enabled using '#!define WITH_FEATURE' directives:
#
# *** To run in debug mode:
# - define WITH_DEBUG
#
#!ifndef DBU