zoukankan      html  css  js  c++  java
  • Ubuntu 安装 kamailio

    首先安装前,你已经对kamailio的基本用法了解。可根据情况选择安装方式,本次安装基于Ubuntu18.04系统安装,对于16.04及一下会遇到版本问题,请自己查阅文档解决

    安装第三方库

    sudo apt-get install gcc flex bison libmysqlclient-dev make libcurl4-openssl-dev libxml2-dev libpcre3-dev libncurses5-dev libreadline6  libreadline-dev  e2fsprogs-dev  uuid-dev  libuuid-dev

    确保数据库安装成功

    第一种

    可直接通过sudo apt-get install kamailio安装

    配置

    修改/etc/kamailio/kamctlrc,配置mysql
    kamdbctl create创建mysql数据库
    

     指定log

    修改/etc/rsyslog.d/50-default.conf
    #*.*;auth,authpriv.none    -/var/log/syslog #注释掉这一行
    *.*;auth,authpriv.none,local0.none    -/var/log/syslog #新加行
    if $syslogfacility-text=='local0' then -/var/log/kamailio.log #新加行
    重启 systemctl restart rsyslog 
    

     修改/etc/kamailio/kamailio.cfg 配置路由

    启动kamactl start

    第二种下载源码安装

    下载源码包

    http://www.kamailio.org/pub/kamailio/latest/src/
    

     解压

    tar  xvf   kamailio-*_src.tar.gz
    

    cd kamailio-*

    执行下面指令生成modules.list文件

    make  FLAVOUR=kamailio  cfg
    

     进入modules.list找到"exclude_modules",将等号后面的db_mysql删除(这里可以根据自己的需要调整编译的模块)。然后执行如下指令编译

    执行指令安装

    make all

    sudo make install

    执行过程中如果报错根据提示慢慢解决

    启动文件在 /etc/local/sbin下
    配置文件在 /usr/local/etc/kmailio下

    配置

    打开/usr/local/etc/kamailio/kamailio.cfg,添加下面几行(添加在最顶端即可):

    #!define WITH_MYSQL
    #!define WITH_AUTH
    #!define WITH_USRLOCDB
    #!define WITH_NAT
    #!define WITH_DEBUG
    

    修改 /usr/local/etc/kamailio/kamctlrc  

    掉SIP_DOMAIN前的注释,并且修改成自己的服务器地址192.168.1.111(根据自己服务器的实际情况来写),我的是SIP_DOMAIN=192.168.1.111。然后去掉DBENGINE=MYSQL前的注释语句,选定mysql数据库,其他的按照如下内容来修改: 

    # cat /usr/local/etc/Kamailio/kamctlrc
    # $Id$
    # The Kamailio configuration file for the control tools.
    # Here you can set variables used in the kamctl and kamdbctl setup
    # scripts. Per default all variables here are commented out, the control tools
    # will use their internal default values.
    ## your SIP domain
    SIP_DOMAIN=192.168.1.111
    ## chrooted directory
    # $CHROOT_DIR="/path/to/chrooted/directory"
    ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT, by default none is loaded
    # If you want to setup a database with kamdbctl, you must at least specify
    # this parameter.
    DBENGINE=MYSQL
    ## database host
    DBHOST=localhost
    ## database name (for ORACLE this is TNS name)
    DBNAME=kamailio
    # database path used by dbtext or db_berkeley
    # DB_PATH="/usr/local/etc/kamailio/dbtext"
    ## database read/write user
    DBRWUSER=kamailio
    ## password for database read/write user
    DBRWPW="kamailiorw"
       
    ## database read only user
    # DBROUSER=kamailioro
    DBROUSER=kamailioro
    ## password for database read only user
    DBROPW=kamailioro
    ## database super user (for ORACLE this is 'scheme-creator' user)
    DBROOTUSER="root"
    # user name column
    USERCOL="username"
    # SQL definitions
    # If you change this definitions here, then you must change them
    # in db/schema/entities.xml too.
    # FIXME
    # FOREVER="2020-05-28 21:32:15"
    # DEFAULT_ALIASES_EXPIRES=$FOREVER
    # DEFAULT_Q="1.0"
    # DEFAULT_CALLID="Default-Call-ID"
    # DEFAULT_CSEQ="13"
    # DEFAULT_LOCATION_EXPIRES=$FOREVER
    # Program to calculate a message-digest fingerprint
    # MD5="md5sum"
    # awk tool
    # AWK="awk"
    # If you use a system with a grep and egrep that is not 100% gnu grep compatible,
    # e.g. solaris, install the gnu grep (ggrep) and specify this below.
    #
    # grep tool
    # GREP="grep"
    # egrep tool
    # EGREP="egrep"
    # sed tool
    # SED="sed"
    # tail tool
    # LAST_LINE="tail -n 1"
    # expr tool
    # EXPR="expr"
    # Describe what additional tables to install. Valid values for the variables
    # below are yes/no/ask. With ask (default) it will interactively ask the user
    # for an answer, while yes/no allow for automated, unassisted installs.
    #
    # If to install tables for the modules in the EXTRA_MODULES variable.
    # INSTALL_EXTRA_TABLES=ask
    # If to install presence related tables.
     
    # INSTALL_PRESENCE_TABLES=ask
    # Define what module tables should be installed.
    # If you use the postgres database and want to change the installed tables, then you
    # must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the
    # kamdbctl.base script.
    # kamailio standard modules
    # STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo
    # alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher
    # dialplan"
    # Kamailio extra modules
    # EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple"
    ## type of aliases used: DB - database aliases; UL - usrloc aliases
    ## - default: none
    # ALIASES_TYPE="DB"
    ## control engine: FIFO or UNIXSOCK
    ## - default FIFO
    # CTLENGINE="FIFO"
    ## path to FIFO file
    # OSER_FIFO="FIFO"
    ## check ACL names; default on (1); off (0)
    # VERIFY_ACL=1
    ## ACL names - if VERIFY_ACL is set, only the ACL names from below list
    ## are accepted
    # ACL_GROUPS="local ld int voicemail free-pstn"
    ## verbose - debug purposes - default '0'
    VERBOSE=1
    ## do (1) or don't (0) store plaintext passwords
    ## in the subscriber table - default '1'
    # STORE_PLAINTEXT_PW=0
    ## OPENSER START Options
    ## PID file path - default is: /var/run/Kamailio.pid
    # PID_FILE=/var/run/kamailio/kamailio.pid
    PID_FILE=/var/run/kamailio/kamailio.pid
    ## Extra start options - default is: not set
    # example: start kamailio with 64MB share memory: STARTOPTIONS="-m 64"
    # STARTOPTIONS=
     
    

    生成kamailio的mysql数据库

    # /usr/local/sbin/kamdbctl  create
    

    启动kamilio服务 

    # /usr/local/sbin/kamctl  start
    

    可能会出现“ERROR:PID file /var/run/kamailio/kamaillio.pid does not exist---Kamailio  start failed"

     这种种错误出现的原因是/var/run/路径下没有kamailio目录,手动创建一个即可,但不要生成kamailio.pid文件。 

    然后再开启服务试一下能否成功,如果还是不行,请按顺序检查如下内容:

    (1)kamdbctlrc这个配置文件中的DBHOST处是否是127.0.0.1或者localhost,如果不是请将其修改成127.0.0.1或者localhost试试。

    (2)执行“kamailio  -c”来检测配置文件是否有错误,如果有报错,请根据具体报错信息解决问题。如果出现“config file ok,exiting......”,说明配置文件没有问题了。

    (3)执行“kamailio  -dddd”,看是否有ERROR输出,若有,请依据错误提示进行修改。

    注册sip账号

    #kamctl  add  user1  123456
    #kamctl  add  user2  123456  

      测试kamailio服务

      

  • 相关阅读:
    Using Repository and Unit of Work patterns with Entity Framework 4.0
    Accessing Your Model's Data from a Controller
    ASP.NET MVC 3 Internationalization
    Test your ASP.NET MVC or WebForms Application on IIS 7 in 30 seconds
    定时执行Web测试
    对包含HttpContext.Current.Cache的代码进行单元测试
    ASP.NET MVC判断基于Cookie的Session过期
    Selenium testing Iframe
    [Tips]: ASP.NET MVC得到controller的名字
    [Tips]:"RemoteOperationException: ERROR: wrong password for user" with Oracle 10g
  • 原文地址:https://www.cnblogs.com/flash55/p/10224561.html
Copyright © 2011-2022 走看看