`
raojl
  • 浏览: 204821 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

linux M4 配置管理

 
阅读更多


摘自http://www.opensips.org/Resources/DocsTools,opensips学习。

m4

Included on most Linuxes. This is a simple way to set up and use separate parameter files or even a good way of accomplishing INCLUDE's in your configs. Example of usage is provided by Iñaki Baz Castillo;

I strongly recommend you to use M4 to compile your opensips.cfg file:

file /etc/opensips/opensips.cfg.m4:
---------------------------------------------
debug=3
log_stderror=no
log_facility=LOG_LOCAL7
fork=yes
...
listen=MY_IP:MY_PORT
...
    rewritehost("MEDIA_SERVER_IP:MEDIA_SERVER_PORT");
...
---------------------------------------------

file /etc/opensips/defines.m4 (at your home):
---------------------------------------------
divert(-1)
define(`MY_IP',		`192.168.10.23')
define(`MY_PORT',		`5060')
define(`MEDIA_SERVER_IP',   `192.168.10.23')
define(`MEDIA_SERVER_PORT', `5065')
divert(0)dnl
---------------------------------------------

file /etc/opensips/defines.m4 (at your office):
---------------------------------------------
divert(-1)
define(`MY_IP',		`123.123.123.123')
define(`MY_PORT',		`5060')
define(`MEDIA_SERVER_IP',	`22.22.22.22')
define(`MEDIA_SERVER_PORT',	`5065')
divert(0)dnl
---------------------------------------------

Create a bash script:
/usr/local/bin/op-restart.sh:
----------------------------------------------
#!/bin/bash
DIR="/etc/opensips"
m4 $DIR/defines.m4 $DIR/opensips.cfg.m4 > $DIR/opensips.cfg
/etc/init.d/opensips restart
----------------------------------------------

So you just must change the /etc/opensips/opensips.cfg.m4 file and the
defines.m4 (this last file will be different depending on your location).

1
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics