SIP快速路由器(SER)严格遵守SIP标准。它用C语言编写,采用GPL许可证发行,已被移植到Linux和Solaris上。除了充当SIP服务器外,SER还可以为短消息服务(SMS)、即时通信(IM)、RADIUS记账和授权以及基于Web的用户配置充当网关。基于SER的商用产品可从iptelorg购得。可启动的LiveCD版软件也可以获得,它扩展了SER的功能,添加了用起来方便得多的基于Web的管理工具,并支持思科和Mitel等厂商的通用VoIP硬件。
一、下载openser:
http://www.openser.org/pub/openser/1.1.0/src/openser-1.1.0-tls_src.tar.gz
二、编译(bison,flex,gcc):
#tar zxvf openser-1.1.0-tls_src.tar.gz #cd openser-1.1.0-tls #make all #make install #make include_module="mysql" modules(make all include_modules="mysql") #make include_module="mysql" install(make install include_modules="mysql") |
*****默认安装到/usr/local/
三、设置域名:
1.修改/etc/hosts,加上一条
127.0.0.1 pctcser.com
2.修改/etc/sysconfig/network,加上一条
HOSTNAME=openser
四、创建数据库:
#/usr/local/sbin/openser_mysql.sh create |
五、编辑配置文件:
修改openser.cfg配置文件
#vi /usr/local/etc/openser/openser.cfg # # ----------- global configuration parameters ------------------------ debug=3 # debug level (cmd line: -dddddddddd) /* Uncomment these lines to enter debugging mode check_via=no # (cmd. line: -v) rev_dns=yes # (cmd. line: -R) # # ------------------ module loading ---------------------------------- # Uncomment this if you want to use SQL database ###2006-11-07 Edit loadmodule "/usr/local/.../mysql.so" loadmodule "/usr/local/lib/openser/modules/sl.so" # Uncomment this if you want digest authentication ### 2006-11-07 Edit loadmodule "/usr/local/.../auth.so" And loadmodule "/usr/local/.../auth_db.so" # ----------------- setting module-specific parameters --------------- # -- usrloc params -- # Uncomment this if you want to use SQL database modparam("usrloc", "db_mode", 2) ### 2006-11-07 Edit # -- rr params -- # ------------------------- request routing logic ------------------- # main routing logic route{ # initial sanity checks -- messages with if (msg:len >= 2048 ) { # we record-route all messages -- to make sure that # subsequent messages withing a dialog should take the if (!uri==myself) { # if the request is for other domain use UsrLoc if (method=="REGISTER") { # Uncomment this if you want to use digest authentication ###Liwb 2006-11-07 Edit if (!www_author...) Begin save("location"); lookup("aliases"); # native SIP destinations are handled using our USRLOC DB route(1);
(END) |
修改openserclt.cfg
#vi /usr/local/etc/openser/openserctlrc # $Id: openserctlrc,v 1.2 2006/07/05 19:37:20 miconda Exp $ ## your SIP domain ## database type: MYSQL or PGSQL, by defaulte none is loaded ## database host ## database name ## database read/write user ## database read only user ## password for database read only user ## database super user ## type of aliases used: DB - database aliases; UL - usrloc aliases ## control engine: FIFO or UNIXSOCK ## path to FIFO file ## check ACL names; default on (1); off (0) ## ACL names - if VERIFY_ACL is set, only the ACL names from below list ## verbose - debug purposes - default '0' |
添加用户
#/usr/local/sbin/openserctl add test test test@pctcser.net MySql password for user 'openser@localhost': //输入MySql密码 |
启动OpenSer
#/usr/local/sbin/openserctl start |
--------------2006-12-20 补充--------------
一、建立数据库
/usr/sbin/OpenSer_mysql.sh createl (rpm/deb安装)
或
/usr/local/sbin/OpenSer_mysql.sh create (tar.gz安装)
以上指令会建立新的SER数据库的相关表格。
如果是要升级旧版OpenSer或SER程序的話,请执行:
/usr/sbin/OpenSer_mysql.sh reinstall (rpm/deb安装)
或
/usr/local/sbin/OpenSer_mysql.sh reinstall (tar.gz安装)
OpenSer_mysql.sh 其他相关使用语法:
OpenSer_mysql.sh create 新建立数据库
OpenSer_mysql.sh drop 完全删除SER数据库
OpenSer_mysql.sh reinit 完全删除并重新建立SER数据库表格
OpenSer_mysql.sh backup 备份数据库并输出到stdout
OpenSer_mysql.sh restore <file> 从指定的档案中回存数据库
OpenSer_mysql.sh <new_db> 从已经存在的数据库中产生一个新的数据库
OpenSer_mysql.sh reinstall 更新并产生新的数据库
--------------------
要啟動支援新的mysql資料庫功能,必須載入正確的模組。這功能可藉由反註解(拿掉行首的#號)以下這行來達成:
loadmodule "/usr/lib/ser/modules/mysql.so"
接下來我們要設定SER將變動的資料寫入資料庫中來取代僅存放在記憶體上的快取資料。先註解(在行首加入#號)
掉以下這行:
modparam("usrloc", "db_mode", 0)
然後反註解掉(拿掉行首的#號)以下這行:
modparam("usrloc", "db_mode", 2)
關於db_modes的說明:
* Mode 0 (模式0)
關閉寫入資料庫。聯絡資料等會在系統重開機後流失。
* Mode 1 (模式1)
立刻將所有變更寫入資料庫中,聯絡資料等會立刻寫入資料庫。會使用戶端連線時的反應速度變慢。
* Mode 2 (模式2)
週期性的將聯絡資料等從記體體快取區中寫入到資料庫。
要啟動身份認證功能要將以下兩行反註解掉:
loadmodule "/usr/lib/ser/modules/auth.so"
loadmodule "/usr/lib/ser/modules/auth_db.so"
我們可以選擇將儲存在資料庫中的密碼以未加密模式存放。這樣可以讓密碼的回復以及初始設定與測試工作更容易進行。
要啟動這項功能請反註解掉以下兩行:
modparam ("auth_db", "calculate_ha1", yes)
modparam ("auth_db", "password_column", "password")
這兩行是一起工作的。第一行告訴卅R產生使用者名稱、密碼、及relam的雜湊(hash)。
第二行則告訴SER在資料庫中的那個欄位是放置未加密密碼的位置。
最後,我們需要更新路尤以辨識我們的realm。
變更 (uri=="myself") 為 (uri=~"mydomain.com")
反註解掉以下數行並用mydomain.com代替iptel.org
if (!www_authorize("mydomain.com", "subscriber")) {
www_challenge("mydomain.com", "0");
break;
};
注意!
以上範例中的mydomain.com僅作為範利使用,正式使用時須填入正確的主機名稱。