1.下載 source code from website
http://www.iptel.org/,進入Downloads頁面(http://www.iptel.org/download), Download一個release版本的SER source,這裏 Download了ser-0.9.6_src.tar.gz (most recent released version)。
2.解開這個壓縮包
cp /root/Download/ser-0.9.6_src.tar.gz /home/
tar -xvzf ser-0.9.6_src.tar.gz, 這會產生出文件夾:ser-0.9.6
3.安裝SER Server
cd /home/ser-0.9.6/(本人是將壓縮包解到/home/路徑下的)
make all
make install
cd /home/ser-0.9.6/modules/mysql/
注意:編譯mysql相關文件,需要mysql development package,本人用fedora 9,使用yum install mysql-devel即可安裝該開發包. 否則會編譯錯誤(找不到mysql.h,errmsg.h,struct my_con).
make(產生出mysql.so以供後用)
cp mysql.so /usr/local/lib/ser/modules/
make clean(清除安裝過程中產生的臨時和無用的文件)
4.運行SER
/usr/local/sbin/ser start(此時的SER支持簡單的callfeature, 但是對用戶不進行任何認證)
你可以通過命令:ps -A|grep ser 來查看SER是否起來了
到這裏,就可以在客戶端進行註冊。
注意:在進行客戶端操作之前需要進行Firewall configurations,具體操作如下:
System-->Administration-->Firewall-->Other ports-->Add(user defined,5060/udp)
*****建立資料庫對用戶進行認證和管理*****
service mysqld start
5.對用戶的認證和管理
(1)添加domain
vi /etc/hosts
172.21.99.242abc.com
vi ~/.bash_profile
SIP_DOMAIN=abc.com
export SIP_DOMAIN
(2)建立資料庫:
首先確保你的pc已經安裝過了mysql
建立資料庫表格:/usr/local/sbin/ser_mysql.sh create
系統提示輸入密碼,初始密碼是空,直接回車即可
[如果是升級舊的資料庫用:/usr/local/sbin/ser_mysql.sh reinstall
如果想刪除舊的資料庫:/usr/local/sbin/ser_mysql.sh drop ]
如果你想查看資料庫表格是否產生出來了,使用命令:
mysql -u root -p(登入mysql數據庫,此時需要你的mysql數據庫密碼,初始是空, 直接回車即可)
connect ser
show tables;(注意需要分號)
用戶添加在uri表中,可使用相應的sql語句進行操作。
這裏需要先指定SIP_DOMAIN,然後纔可以添加用戶, 否則要在每個用戶名中指定domain, 很麻煩。
(3)添加用戶到資料庫中:
/usr/local/sbin/serctl add username password email(example,serctl add 62358974 123456 [email protected])
此時系統會提示你輸入密碼,初始密碼是:heslo
刪除用戶使用命令 serctl rm username
如果你想查看用戶是否被添加了出來,使用命令:
serctl rpid show
如果想查看註冊用戶,使用命令:
serctl showdb
6.修改SER配置文件(/usr/local/etc/ser/ser.cfg)
反註解掉下行,載入mysql以啓動資料庫
loadmodule "/usr/lib/ser/modules/mysql.so"(將行首的#號去掉即可)
反註解掉以下兩行以啓動身份驗證
loadmodule "/usr/lib/ser/modules/auth.so"
loadmodule "/usr/lib/ser/modules/auth_db.so"
啓用寫入資料庫功能:
註解掉:modparam("usrloc", "db_mode", 0)(此行是關閉寫入資料庫行爲,故需註解掉,在行首加#號即爲註解掉)
反註解掉:modparam("usrloc", "db_mode", 2)(此行是週期性的將資料寫入資料庫)
啓用將密碼以未加密的形式存儲功能,以便於管理,需反註解掉以下兩行
modparam ("auth_db", "calculate_ha1", yes)
modparam ("auth_db", "password_column", "password")
最後反註解掉以下幾行
if (!www_authorize("iptel.org", "subscriber"))
{
www_challenge("iptel.org", "0");
break;
};
7.restart SER 以使以上設置生效
注意,啓動SER之前須先啓動mysql:service mysqld start