next up previous contents
Next: SIP Client Up: SIP 網路電話伺服器 Kamailio Previous: SIP 簡介   Contents

Kamailio 套件安裝與啟動

  1. Kamailio 相套件 已納入 DYW Linux,可用 yum 直接安裝。
  2. 安裝 kamailio 套件
    [root@kvm6 ~]# yum install -y kamailio kamailio-mysql \
    kamailio-debuginfo kamailio-unixodbc kamailio-utils
    
  3. 安裝 mysql 套件
    [root@kvm6 ~]# yum install -y mysql-server mysql
    [root@kvm6 ~]# /etc/init.d/mysqld restart
    Stopping mysqld:                                           [  OK  ]
    Starting mysqld:                                           [  OK  ]
    
  4. 第一次使用,進行安全設定。
    [root@kvm6 ~]# mysql_secure_installation
    
  5. 設定 kamctlrc,指定 SIP_DOMAIN 及使用 MYSQL。
    [root@kvm6 ~]# vim /etc/kamailio/kamctlrc 
    [root@kvm6 ~]# egrep '(SIP_DOMAIN|DBENGINE)' /etc/kamailio/kamctlrc 
     SIP_DOMAIN=kvm6.deyu.wang
     DBENGINE=MYSQL
    
  6. 產生 Kamailio 資料庫用戶及所需資料表,過程中因本系統預設 utf-8 編碼 kamailio 無法使用,故必須自行輸入。其他都回答 y,讓其產生。
    [root@kvm6 ~]# kamdbctl create
    MySQL password for root: 
    INFO: test server charset
    WARNING: Your current default mysql characters set cannot be used to create DB. Please choice another one from the following list:
    big5
    dec8
    cp850
    hp8
    koi8r
    latin1
    latin2
    swe7
    ascii
    ujis
    sjis
    hebrew
    tis620
    euckr
    koi8u
    gb2312
    greek
    cp1250
    gbk
    latin5
    armscii8
    cp866
    keybcs2
    macce
    macroman
    cp852
    latin7
    cp1251
    utf16
    cp1256
    cp1257
    utf32
    binary
    geostd8
    cp932
    eucjpms
    Enter character set name: 
    latin1
    INFO: creating database kamailio ...
    INFO: granting privileges to database kamailio ...
    INFO: creating standard tables into kamailio ...
    INFO: Core Kamailio tables succesfully created.
    Install presence related tables? (y/n): y
    INFO: creating presence tables into kamailio ...
    INFO: Presence tables succesfully created.
    Install tables for imc cpl siptrace domainpolicy carrierroute
    		userblacklist htable purple uac pipelimit mtree sca? (y/n): y
    INFO: creating extra tables into kamailio ...
    INFO: Extra tables succesfully created.
    Install tables for uid_auth_db uid_avp_db uid_domain uid_gflags
    		uid_uri_db? (y/n): y
    INFO: creating uid tables into kamailio ...
    INFO: UID tables succesfully created.
    
  7. 啟動 kamailio 服務。
    [root@kvm6 ~]# /etc/init.d/kamailio start
    Starting kamailio:                          [OK]
    
  8. 增加兩個測試帳號,kamailio 用戶的預設密碼為 kamailiorw。
    [root@kvm6 ~]# kamctl add deyu1@deyu.wang 123qwe
    MySQL password for user 'kamailio@localhost': 
    new user 'deyu1@deyu.wang' added
    [root@kvm6 ~]# kamctl add deyu2@deyu.wang 123qwe
    MySQL password for user 'kamailio@localhost': 
    new user 'deyu2@deyu.wang' added
    
  9. 防火牆必須開啟 5060 port。
    [root@kvm6 ~]# iptables -I INPUT -p tcp -m state --state NEW \
    -m tcp --dport 5060 -j ACCEPT 
    [root@kvm6 ~]# iptables -I INPUT -p udp -m state --state NEW \
    -m udp --dport 5060 -j ACCEPT
    



2018-03-16