opensips 安装及基本配置
1 . / 的 download 中下载 opensips 软件包
2 . 编译:
Java代码
1. tar zxvf opensips-1.6.2-tls_
2. cd opensips-1.6.2-tls
tar zxvf opensips-1.6.2-tls_
cd opensips-1.6.2-tls
3 . 安装之前更改 makefile :
删除 Makefile 中的 exclude_modules 的 db-mysql,使opensips使用mysql数据
4. 安装
make all
可能会缺少一下工具,缺少什么装什么就是了。另外可能提示不到mysql.h等文件,只要把文件拷贝到对应的地方就行了。
make install
vimtag默认安装路径 /usr/local 下
5. 配置 vim /usr/local/etc/opensips/opensipsctlrc,把 mysql 的相关的注释去掉
Java代码
1. ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT, by default none is loaded
2. # If you want to setup a database with opensipsdbctl, you must at least specify
3. # this parameter.
4. DBENGINE=MYSQL
5. ## database host
6. DBHOST=localhost
7. ## database name (for ORACLE this is TNS name)
8. DBNAME=opensips
9. # database path used by dbtext or db_berkeley
10. DB_PATH="/usr/local/etc/opensips/dbtext"
11. ## database read/write user
12. DBRWUSER=opensips
13. ## password for database read/write user
14. DBRWPW="opensipsrw"
15. ## database read only user
16. DBROUSER=opensipsro
17. ## password for database read only user
18. DBROPW=opensipsro
19. ## database super user (for ORACLE this is 'scheme-creator' user)
20. DBROOTUSER="root"
21. # user name column
22. USERCOL="username"
## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT, by default none is loaded
# If you want to setup a database with opensipsdbctl, you must at least specify
# this parameter.
DBENGINE=MYSQL
## database host
DBHOST=localhost
## database name (for ORACLE this is TNS name)
DBNAME=opensips
# database path used by dbtext or db_berkeley
DB_PATH="/usr/local/etc/opensips/dbtext"
## database read/write user
DBRWUSER=opensips
## password for database read/write user
DBRWPW="opensipsrw"
## database read only user
DBROUSER=opensipsro
## password for database read only user
DBROPW=opensipsro
## database super user (for ORACLE this is 'scheme-creator' user)
DBROOTUSER="root"
# user name column
USERCOL="username"
6. 执行 opensips/sbin/ 下的 opensipsdbctl
Java代码
1. ./opensipsdbctl create ( 生成 opensips 数据库 )
./opensipsdbctl create ( 生成 opensips 数据库 )
7. 这个时候如果重新登录phpmyadmin,会看到已经新建了opensips数据库
8. opensips的运行
Java代码
1. /usr/local/sbin/下的opensipsctl start来启动opensips
2. ps aux | grep opensips 检查应该已经运行了。
3. opensip
s/sbin/下的opensipsctl stop来停止opensips
/usr/local/sbin/下的opensipsctl start来启动opensips
ps aux | grep opensips 检查应该已经运行了。
opensips/sbin/下的opensipsctl stop来停止opensips
至此基本的opensips配置已经完成了,可以用软件software phone来连接到这个sip server上面并注册成功,不需要先在mysql数据库中添加对应的记录。
9. opensips 认证功能的实现
Java代码
1. labuser@cnta02:/etc/init.d$ cat /usr/local/etc/opensips/opensips.cfg
2. #
3. # $Id: opensips.cfg 6464 2009-12-24 08:00:54Z bogdan_iancu $
4. #
5. # OpenSIPS basic configuration script
6. # by Anca Vamanu <>
7. #
8. # Please refer to the Core CookBook at:
9. # /index.php?n=Resources.DocsCookbooks
10. # for a explanation of possible statements, functions and parameters.
11. #
12.
13.
14. >## Global Parameters >####
15.
16. debug=3
17. log_stderror=no
18. log_facility=LOG_LOCAL0
19.
20. fork=yes
21. children=4
22.
23. /* uncomment the following lines to enable debugging */
24. debug=6
25. #fork=no
26. log_stderror=yes
27.
28. /* uncomment the next line to disable TCP (default on) */
29. #disable_tcp=yes
30.
31. /* uncomment the next line to enable the auto temporary blacklisting of
32. not available destinations (default disabled) */
33. #disable_dns_blacklist=no
34.
35. /* uncomment the next line to enable IPv6 lookup after IPv4 dns
36. lookup failures (default disabled) */
37. #dns_try_ipv6=yes
38.
39. /* uncomment the next line to disable the auto discovery of local aliases
40. based on revers DNS on IPs (default on) */
41. #auto_aliases=no
42.
43. /* uncomment the following lines to enable TLS support (default off) */
44. #disable_tls = no
45. #listen = tls:your_IP:5061
46. #tls_verify_server = 1
47. #tls_verify_client = 1
48. #tls_require_client_certificate = 0
49. #tls_method = TLSv1
50. #tls_certificate = "/usr/local/etc/opensips/tls/user/user-cert.pem"
51. #tls_private_key = "/usr/local/etc/opensips/tls/user/user-privkey.pem"
52. #tls_ca_list = "/usr/local/etc/opensips/tls/user/user-calist.pem"
53.
54.
55. port=5060
56.
57. /* uncomment and configure the following line if you want opensips to
58. bind on a specific interface/port/proto (default bind on all available) */
59. #listen=udp:192.168.1.2:5060
60.
61.
62. >## Modules Section >###
63.
64. #set module path
65. mpath="/usr/local/lib/opensips/modules/"
66.
67. /* uncomment next line for MySQL DB support */
68. loadmodule "db_mysql.so"
69. loadmodule "signaling.so"
70. loadmo
dule "sl.so"
71. loadmodule "tm.so"
72. loadmodule "rr.so"
73. loadmodule "maxfwd.so"
74. loadmodule "usrloc.so"
75. loadmodule "registrar.so"
76. loadmodule "textops.so"
77. loadmodule "mi_fifo.so"
78. loadmodule "uri.so"
79. loadmodule "xlog.so"
80. loadmodule "acc.so"
81. /* uncomment next lines for MySQL based authentication support
82. NOTE: a DB (like db_mysql) module must be also loaded */
83. loadmodule "auth.so"
84. loadmodule "auth_db.so"
85. /* uncomment next line for aliases support
86. NOTE: a DB (like db_mysql) module must be also loaded */
87. loadmodule "alias_db.so"
88. /* uncomment next line for multi-domain support
89. NOTE: a DB (like db_mysql) module must be also loaded
90. NOTE: be sure and enable multi-domain support in all used modules
91. (see "multi-module params" section ) */
92. #loadmodule "domain.so"
93. /* uncomment the next two lines for presence server support
94. NOTE: a DB (like db_mysql) module must be also loaded */
95. #loadmodule "presence.so"
96. #loadmodule "presence_xml.so"
97.
98.
99. # ----------------- setting module-specific parameters ---------------
100.
101.
102. # ----- mi_fifo params -----
103. modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
104. modparam("mi_fifo", "fifo_mode", 0666)
105.
106. # ----- rr params -----
107. # add value to ;lr param to cope with most of the UAs
108. modparam("rr", "enable_full_lr", 1)
109. # do not append from tag to the RR (no need for this script)
110. modparam("rr", "append_fromtag", 0)
111.
112.
113. # ----- registrar params -----
114. /* uncomment the next line not to allow more than 10 contacts per AOR */
115. #modparam("registrar", "max_contacts", 10)
116.
117.
118. # ----- usrloc params -----
119. modparam("usrloc", "db_mode", 0)
120. /* uncomment the following lines if you want to enable DB persistency
121. for location entries */
122. modparam("usrloc", "db_mode", 2)
123. #modparam("usrloc", "db_url",
124. # "mysql://opensips:opensipsrw@localhost/opensips")
125.
126.
127. # ----- uri params -----
128. modparam("uri", "use_uri_table", 0)
129.
130.
131. # ----- acc params -----
132. /* what sepcial events should be accounted ? */
133. modparam("acc", "early_media", 1)
134. modparam("acc", "report_ack", 1)
135. modparam("acc", "report_cancels", 1)
136. /* by default ww do not adjust the direct of the sequential requests.
137. if you enable this parameter, be sure the enable "append_fromtag"
138. in "rr" module */
139. modparam("acc", "detect_direction", 0)
140. /* account triggers (flags) */
141. modparam("acc", "failed_transaction_flag", 3)
142. modparam("acc", "log_flag", 1)
143. modparam("a
cc", "log_missed_flag", 2)
144. /* uncomment the following lines to enable DB accounting also */
145. modparam("acc", "db_flag", 1)
146. modparam("acc", "db_missed_flag", 2)
147.
148.
149. # ----- auth_db params -----
150. /* uncomment the following lines if you want to enable the DB based
151. authentication */
152. modparam("auth_db", "calculate_ha1", yes)
153. modparam("auth_db", "password_column", "password")
154. #modparam("auth_db", "db_url",
155. # "mysql://opensips:opensipsrw@localhost/opensips")
156. #modparam("auth_db", "load_credentials", "")
157.
158.
159. # ----- alias_db params -----
160. /* uncomment the following lines if you want to enable the DB based
161. aliases */
162. #modparam("alias_db", "db_url",
163. # "mysql://opensips:opensipsrw@localhost/opensips")
164.
165.
166. # ----- domain params -----
167. /* uncomment the following lines to enable multi-domain detection
168. support */
169. #modparam("domain", "db_url",
170. # "mysql://opensips:opensipsrw@localhost/opensips")
171. #modparam("domain", "db_mode", 1) # Use caching
172.
173.
174. # ----- multi-module params -----
175. /* uncomment the following line if you want to enable multi-domain support
176. in the modules (dafault off) */
177. #modparam("alias_db|auth_db|usrloc|uri", "use_domain", 1)
178.
179.
180. # ----- presence params -----
181. /* uncomment the following lines if you want to enable presence */
182. #modparam("presence|presence_xml", "db_url",
183. # "mysql://opensips:opensipsrw@localhost/opensips")
184. #modparam("presence_xml", "force_active", 1)
185. #modparam("presence", "server_address", "sip:192.168.1.2:5060")
186.
187.
188. >## Routing Logic >###
189.
190.
191. # main request routing logic
192.
193. route{
194.
195. if (!mf_process_maxfwd_header("10")) {
196. sl_send_reply("483","Too Many Hops");
197. exit;
198. }
199.
200. if (has_totag()) {
201. # sequential request withing a dialog should
202. # take the path determined by record-routing
203. if (loose_route()) {
204. if (is_method("BYE")) {
205. setflag(1); # do accounting ...
206. setflag(3); # ... even if the transaction fails
207. } else if (is_method("INVITE")) {
208. # even if in most of the cases is useless, do RR for
209. # re-INVITEs alos, as some buggy clients do change route set
210. # during the dialog.
211. record_route();
212. }
213. # route it out to whatever destination was set by loose_route()
214. # in $du (destination URI).
215. route(1
);
216. } else {
217. /* uncomment the following lines if you want to enable presence */
218. ##if (is_method("SUBSCRIBE") && $rd == "your.server.ip.address") {
219. ## # in-dialog subscribe requests
220. ## route(2);
221. ## exit;
222. ##}
223. if ( is_method("ACK") ) {
224. if ( t_check_trans() ) {
225. # non loose-route, but stateful ACK; must be an ACK after
226. # a 487 404 from upstream server
227. t_relay();
228. exit;
229. } else {
230. # ACK without matching transaction ->
231. # ignore and discard
232. exit;
233. }
234. }
235. sl_send_reply("404","Not here");
236. }
237. exit;
238. }
239.
240. #initial requests
241.
242. # CANCEL processing
243. if (is_method("CANCEL"))
244. {
245. if (t_check_trans())
246. t_relay();
247. exit;
248. }
249.
250. t_check_trans();
251.
252. # authenticate if from local subscriber (uncomment to enable auth)
253. # authenticate all initial non-REGISTER request that pretend to be
254. # generated by local subscriber (domain from FROM URI is local)
255. if (!(method=="REGISTER") && from_uri==myself) /*no multidomain version*/
256. ##if (!(method=="REGISTER") && is_from_local()) /*multidomain version*/
257. {
258. if (!proxy_authorize("", "subscriber")) {
259. proxy_challenge("", "0");
260. exit;
261. }
262. if (!db_check_from()) {
263. sl_send_reply("403","Forbidden auth ID");
264. exit;
265. }
266.
267. consume_credentials();
268. # caller authenticated
269. }
270.
271. # preloaded route checking
272. if (loose_route()) {
273. xlog("L_ERR",
274. "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
275. if (!is_method("ACK"))
276. sl_send_reply("403","Preload Route denied");
277. exit;
278. }
279.
280. # record routing
281. if (!is_method("REGISTER|MESSAGE"))
282. record_route();
283.
284. # account only INVITEs
285. if (is_method("INVITE")) {
286. setflag(1); # do accounting
287. }
288. if (!uri==myself)
289. ## replace with following line if multi-domain support is used
290. ##if (!is_uri_host_local())
291. {
292. append_hf("P-hint: outbound\r\n");
293. #
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
白细胞分化抗原的分类
« 上一篇
[Vim使用]vim自动括号补全配置
下一篇 »
推荐文章
热门文章
-
随机森林算法的改进方法
2024-10-02 -
基于随机森林算法的风险预警模型研究
2024-10-02 -
Python中的随机森林算法详解
2024-10-02 -
随机森林发展历史
2024-10-02 -
如何使用随机森林进行时间序列数据模式识别(八)
2024-10-02 -
随机森林回归模型原理
2024-10-02 -
如何使用随机森林进行时间序列数据模式识别(六)
2024-10-02 -
如何使用随机森林进行时间序列数据预测(四)
2024-10-02 -
如何使用随机森林进行异常检测(六)
2024-10-02 -
随机森林算法和grandientboosting算法 -回复
2024-10-02 -
随机森林方法总结全面
2024-10-02 -
随机森林算法原理和步骤
2024-10-02 -
随机森林的原理
2024-10-02 -
随机森林 重要性
2024-10-02 -
随机森林算法
2024-10-02 -
机器学习中随机森林的原理
2024-10-02 -
随机森林算法原理
2024-10-02 -
使用计算机视觉技术进行动物识别的技巧
2024-10-02 -
基于crf命名实体识别实验总结
2024-10-02 -
transformer预测模型训练方法
2024-10-02
最新文章
-
随机森林算法介绍及R语言实现
2024-10-02 -
基于随机森林优化的神经网络算法在冬小麦产量预测中的应用研究_百度文 ...
2024-10-02 -
基于正则化贪心森林算法的情感分析方法研究
2024-10-02 -
随机森林算法和grandientboosting算法
2024-10-02 -
基于随机森林的图像分类算法研究
2024-10-02 -
随机森林结合直接正交信号校正的模型传递方法
2024-10-02
发表评论