您的位置:首页 > 大数据 > 人工智能

Kamailio安装指南

2015-11-25 22:43 417 查看
Kamailio(前身为OpenSER)是一个开源的SIP服务器项目,基于GPL授权。它以处理性能见长,每秒钟能处理上千个并发呼叫。其官方主页为http://www.kamailio.org。本文描述Kamailio的安装配置过程。安装环境为CentOS6.0。

1.编译安装

下载源码

#cd~

#wgethttp://www.kamailio.org/pub/kamailio/latest/src/kamailio-3.3.2_src.tar.gz

#tarzxvfkamailio-3.3.2_src.tar.gz

#cdkamailio-3.3.2

#makeFLAVOUR=kamailiocfg


用自己熟悉的编辑工具打开"modules.lst"文件,找到"exclude_modules"变量,删除db_mysql字段(这里可以根据自己的需要调整编译的模块)。然后编译:

#makeall

#makeinstall


缺省情况下,Kamailio的可执行文件安装在"/usr/local/sbin"路径下,配置文件安装在"/usr/local/etc/kamailio"路径下。
几个可执行文件功能如下:
kamailio-Kamailio服务器的执行文件
kamdbctl-创建和管理数据库的脚本
kamctl-管理和控制Kamailio服务器的脚本
sercmd-CLI,一个命令行工具,访问提供Kamailio服务器的接口

2.配置
配置环境变量:
Kamailio的环境变量存储在/usr/local/etc/kamailio/kamctlrc文件中,安装时,就已经安装好模板文件了,只需要编辑一些简单的配置项即可。

#cat/usr/local/etc/kamailio/kamctlrc

#$Id$

#

#TheKamailioconfigurationfileforthecontroltools.

#

#Hereyoucansetvariablesusedinthekamctlandkamdbctlsetup

#scripts.Perdefaultallvariablesherearecommentedout,thecontroltools

#willusetheirinternaldefaultvalues.


##yourSIPdomain

SIP_DOMAIN=kamailio.org

##chrooteddirectory

#$CHROOT_DIR="/path/to/chrooted/directory"

##databasetype:MYSQL,PGSQL,ORACLE,DB_BERKELEY,orDBTEXT,bydefaultnoneisloaded

#Ifyouwanttosetupadatabasewithkamdbctl,youmustatleastspecify

#thisparameter.

DBENGINE=MYSQL

##databasehost

DBHOST=localhost

##databasename(forORACLEthisisTNSname)

DBNAME=openser

#databasepathusedbydbtextordb_berkeley

#DB_PATH="/usr/local/etc/kamailio/dbtext"

##databaseread/writeuser

DBRWUSER=openser

##passwordfordatabaseread/writeuser

DBRWPW="openserrw"

##databasereadonlyuser

#DBROUSER=openserro

DBROUSER=openserro

##passwordfordatabasereadonlyuser

DBROPW=openserro

##databasesuperuser(forORACLEthisis'scheme-creator'user)

DBROOTUSER="root"

#usernamecolumn

USERCOL="username"

#SQLdefinitions

#Ifyouchangethisdefinitionshere,thenyoumustchangethem

#indb/schema/entities.xmltoo.

#FIXME

#FOREVER="2020-05-2821:32:15"

#DEFAULT_ALIASES_EXPIRES=$FOREVER

#DEFAULT_Q="1.0"

#DEFAULT_CALLID="Default-Call-ID"

#DEFAULT_CSEQ="13"

#DEFAULT_LOCATION_EXPIRES=$FOREVER

#Programtocalculateamessage-digestfingerprint

#MD5="md5sum"

#awktool

#AWK="awk"

#Ifyouuseasystemwithagrepandegrepthatisnot100%gnugrepcompatible,

#e.g.solaris,installthegnugrep(ggrep)andspecifythisbelow.

#

#greptool

#GREP="grep"

#egreptool

#EGREP="egrep"

#sedtool

#SED="sed"

#tailtool

#LAST_LINE="tail-n1"

#exprtool

#EXPR="expr"

#Describewhatadditionaltablestoinstall.Validvaluesforthevariables

#belowareyes/no/ask.Withask(default)itwillinteractivelyasktheuser

#forananswer,whileyes/noallowforautomated,unassistedinstalls.

#

#IftoinstalltablesforthemodulesintheEXTRA_MODULESvariable.

#INSTALL_EXTRA_TABLES=ask

#Iftoinstallpresencerelatedtables.

#INSTALL_PRESENCE_TABLES=ask

#Definewhatmoduletablesshouldbeinstalled.

#Ifyouusethepostgresdatabaseandwanttochangetheinstalledtables,thenyou

#mustalsoadjusttheSTANDARD_TABLESorEXTRA_TABLESvariableaccordinglyinthe

#kamdbctl.basescript.

#Kamailiostandardmodules

#STANDARD_MODULES="standardacclcrdomaingrouppermissionsregistrarusrlocmsilo

#alias_dburi_dbspeeddialavpopsauth_dbpdtdialogdispatcher

#dialplan"

#Kamailioextramodules

#EXTRA_MODULES="imccplsiptracedomainpolicycarrierrouteuserblacklisthtablepurple"

##typeofaliasesused:DB-databasealiases;UL-usrlocaliases

##-default:none

#ALIASES_TYPE="DB"

##controlengine:FIFOorUNIXSOCK

##-defaultFIFO

#CTLENGINE="FIFO"

##pathtoFIFOfile

#OSER_FIFO="FIFO"

##checkACLnames;defaulton(1);off(0)

#VERIFY_ACL=1

##ACLnames-ifVERIFY_ACLisset,onlytheACLnamesfrombelowlist

##areaccepted

#ACL_GROUPS="localldintvoicemailfree-pstn"

##verbose-debugpurposes-default'0'

VERBOSE=1

##do(1)ordon't(0)storeplaintextpasswords

##inthesubscribertable-default'1'

#STORE_PLAINTEXT_PW=0

##OPENSERSTARTOptions

##PIDfilepath-defaultis:/var/run/kamailio.pid

#PID_FILE=/var/run/kamailio.pid

PID_FILE=/var/run/kamailio.pid

##Extrastartoptions-defaultis:notset

#example:startKamailiowith64MBsharememory:STARTOPTIONS="-m64"

#STARTOPTIONS=


打开/usr/local/etc/kamailio/kamailio.cfg,添加下面几行(应该添加在"#######DefinedValues#########"这一行之前):


......

#!defineWITH_MYSQL

#!defineWITH_AUTH

#!defineWITH_USRLOCDB

#!defineWITH_NAT

......




执行下面命令创建DB:


#/usr/local/sbin/kamdbctlcreate
3.启动Kamailio服务

#/usr/local/sbin/kamctlstart
4.监视Kamailio


#/usr/local/sbin/kamctlmoni
5.添加用户帐号

#kamctladd10001000
其中第一个1000为username;第二个1000为password,添加完毕后,配置你的SIP终端注册上来看看,祝你好运。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: