----------------------------------------------
----------------------------------------------
我的安装环境是centos6.5版本
首先要做的工作是:
配置好各项环境..
具体网上搜一下,这边不具体讲了.
1下载源码:
切换目录到用户主目录
cd~
在IE浏览器搜索窗口上打开官网下载链接查看最新的版本:
http://www.kamailio.org/pub/kamailio/latest/src/
然后
wget http://www.kamailio.org/pub/kamailio/latest/src/(刚才所得到的版本)
如图:
目前最新的版本:http://www.kamailio.org/pub/kamailio/latest/src/kamailio-4.3.2_src.tar.gz
解压至当前目录:
#tar zxvf kamailio-4.3.2_src.tar.gz
#cd kamailio-4.3.2
#make FLAVOUR=kamailio cfg
#vim modules.lst 打开modules.lst找到"exclude_modules"变量,并删除其中的db_mysql字段。
2编译
#make all
#make install
kamailio可执行文件默认是安装在/usr/local/sbin的路径下的,而配置文件是安装在/usr/local/etc/kamailio下。
3配置
配置环境变量
Kamailio的环境变量存储在/usr/local/etc/kamailio/kamctlrc文件中。
#vi /usr/local/etc/kamailio/kamctlrc
以下是我在这个文件中的配置可能有点长,我把需要修改的选项用红色字体标注出来,供参考。
------------------------------------------------------------------------------------
1 # $Id$
2 #
3 # The Kamailio configuration file for the control tools.
4 #
5 # Here you can set variables used in the kamctl and kamdbctl setup
6 # scripts. Per default all variables here are commented out, the control tools
7 # will use their internal default values.
8
9 ## your SIP domain
10 SIP_DOMAIN=192.168.0.193 (这个本来是域名,如果在局域网内做测试,可用Linux本机的IP地址,我的IP地址是这个)
11
12 ## chrooted directory
13 # $CHROOT_DIR="/path/to/chrooted/directory"
14
15 ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE
16 # by default none is loaded
17 #
18 # If you want to setup a database with kamdbctl, you must at least specify
19 # this parameter.
20 DBENGINE=MYSQL (取消"#"注释,下面相同的不在做解释)
21
22 ## database host
23 DBHOST=localhost
24
25 ## database name (for ORACLE this is TNS name)
26 DBNAME=kamailio
27
28 # database path used by dbtext, db_berkeley or sqlite
29 # DB_PATH="/usr/local/etc/kamailio/dbtext"
30
31 ## database read/write user
32 DBRWUSER="kamailio"
33
34 ## password for database read/write user
35 DBRWPW="kamailiorw"
36
37 ## database read only user
38 DBROUSER="kamailioro"
39
40 ## password for database read only user
41 DBROPW="kamailioro"
42
43 ## database access host (from where is kamctl used)
44 DBACCESSHOST=192.168.0.193
45
46 ## database super user (for ORACLE this is ‘scheme-creator‘ user)
47 DBROOTUSER="root"
48
49 # user name column
50 USERCOL="username"
51
52
53 # SQL definitions
54 # If you change this definitions here, then you must change them
55 # in db/schema/entities.xml too.
56 # FIXME
57
58 # FOREVER="2030-05-28 21:32:15"
59 # DEFAULT_Q="1.0"
60
61
62 # Program to calculate a message-digest fingerprint
63 # MD5="md5sum"
64
65 # awk tool
66 # AWK="awk"
67
68 # gdb tool
69 # GDB="gdb"
70
71 # If you use a system with a grep and egrep that is not 100% gnu grep compatible,
72 # e.g. solaris, install the gnu grep (ggrep) and specify this below.
73 #
74 # grep tool
75 # GREP="grep"
76
77 # egrep tool
78 # EGREP="egrep"
79
80 # sed tool
81 # SED="sed"
82
83 # tail tool
84 # LAST_LINE="tail -n 1"
85
86 # expr tool
87 # EXPR="expr"
88
89
90 # Describe what additional tables to install. Valid values for the variables
91 # below are yes/no/ask. With ask (default) it will interactively ask the user
92 # for an answer, while yes/no allow for automated, unassisted installs.
93 #
94
95 # If to install tables for the modules in the EXTRA_MODULES variable.
96 # INSTALL_EXTRA_TABLES=ask
97
98 # If to install presence related tables.
99 # INSTALL_PRESENCE_TABLES=ask
100
101 # If to install uid modules related tables.
102 # INSTALL_DBUID_TABLES=ask
103
104 # Define what module tables should be installed.
105 # If you use the postgres database and want to change the installed tables, then you
106 # must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the
107 # kamdbctl.base script.
108
109 # Kamailio standard modules
110 # STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo
111 # alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher
112 # dialplan"
113
114 # Kamailio extra modules
115 # EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca"
116
117
118 ## type of aliases used: DB - database aliases; UL - usrloc aliases
119 ## - default: none
120 # ALIASES_TYPE="DB"
121
122 ## control engine: FIFO or UNIXSOCK
123 ## - default FIFO
124 # CTLENGINE="FIFO"
125
126 ## path to FIFO file
127 # FIFOPATH="/var/run/kamailio/kamailio_fifo"
128
129 ## check ACL names; default on (1); off (0)
130 # VERIFY_ACL=1
131
132 ## ACL names - if VERIFY_ACL is set, only the ACL names from below list
133 ## are accepted
134 # ACL_GROUPS="local ld int voicemail free-pstn"
135
136 ## verbose - debug purposes - default ‘0‘
137 VERBOSE=1
138
139 ## do (1) or don‘t (0) store plaintext passwords
140 ## in the subscriber table - default ‘1‘
141 # STORE_PLAINTEXT_PW=0
142
143 ## Kamailio START Options
144 ## PID file path - default is: /var/run/kamailio.pid
145 PID_FILE=/var/run/kamailio/kamailio.pid
146
147 ## Extra start options - default is: not set
148 # example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64"
149 # STARTOPTIONS=
----------------------------------------------------------------------------------
然后
#vi /usr/local/etc/kamailio/kamailio.cfg
在"####### Defined Values #########"这行之前添加下面这几行:
...
#!define WITH_MYSQL
#!define WITH_AUTH
#!define WITH_USRLOCDB
...
保存退出!
4创建数据库&添加账号
执行命令创建支持的数据库:
# /usr/local/sbin/kamdbctl create
启动kamailio服务
# /usr/local/sbin/kamctl start
开启kamailio监视模式(可略过..)
# /usr/local/sbin/kamctl moni
添加用户账号和密码(注册)
# kamctl add 10001 10001
# kamctl add 10002 10002
添加了两个账户,前一个数字是账号,后一个是密码。
服务器端配置基本完成了..
接下来网上找些基于安卓的sip客户端软件,安装配置并测试。
我使用的是CSipSimple这款app。
手机客户端测试APP链接(由于附件大于2M不能上传,所以贴出我的网盘链接)
http://yunpan.cn/cHgIvYYPnJ6gx 访问密码 e096
或者自己网上找相同的或者类似的。
可能会遇到的问题:
-------------------------------------------------
测试的时候如果注册不成功,请检查手机和PC是否位于同一个局域网内。
linux kamailio服务器中有没有添加将要注册的账户
命令:
# kamctl add 账户 密码
成功添加账户后
请检查linux防火墙有没有关闭,手机安全设置有没有问题...
--------------------------------------------------
附件和截图:
---------------------------