如何學習opensips/kamailio/openser

爲什麼把這三者放一起,不知道的朋友必然有疑問,先簡單解釋下這三者之間的關係。openser是其他兩位的父親;opensips算是二兒子,長大了就出去單幹了;而kamailio繼承了正統,直接是openser的延續,所以現在從openser延續下來的就是kamailio和opensips,但他們兩個都是同一個父親,所以他們流着同樣的血液,對程序而言就是相同的內核、接口、配置方式。
他們能做什麼?以下是他們各自的宣傳:
OpenSIPS is a multi-functional, multi-purpose signaling SIP server - it can act as SIP Router/Switch, SIP Registrar, Application Server, Redirect Server, Load Balancer / Dispatcher, Back-to-Back User Agent, Presence Server, IM Server, Session Border Controller, SIP Front-End, NAT traversal Server, IP Gateway (SMS, XMPP) and others - see the full Set of Features.
Kamailio™ (former OpenSER) is an Open Source SIP Server released under GPL, able to handle thousands of call setups per second. Among features: asynchronous TCP, UDP and SCTP, secure communication via TLS for VoIP (voice, video); WebSocket support for WebRTC; IPv4 and IPv6; SIMPLE instant messaging and presence with embedded XCAP server and MSRP relay; IMS extensions; ENUM; DID and least cost routing; load balancing; routing fail-over; accounting, authentication and authorization; support for many backend systems such as MySQL, Postgres, Oracle, Radius, LDAP, Redis, Cassandra; XMLRPC control interface, SNMP monitoring. It can be used to build large VoIP servicing platforms or to scale up SIP-to-PSTN gateways, PBX systems or media servers like Asterisk™, FreeSWITCH™ or SEMS. Kamailio and the SIP Express Router (SER) teamed up for the integration of the two applications and new development.
重點就是:高性能sip proxy、支持衆多擴展協議、配置靈活。
進行以下內容需要對Linux操作系統有基本的認識,熟悉基本管理命令。
使用SIPP實際測試,SIP/UDP協議會話外消息轉發可達到1.6W CPS, TCP可以達到6K;單臺SIP/TCP連接可以支持到20-25W。但正是因爲他們配置靈活,所以比較複雜難懂,剛一接觸不知如何下手。他們的文檔是非常豐富的,主要是他們官網上的英文文檔,所以想要學好英文這關必須要過。

1.先學習SIP協議
why:他們的配置主要都是對SIP協議進行操作,如果對SIP協議不清楚,就不知道如何改,更不知道改了會產生哪些後果。
what:包括但不限於呼叫流程、事務、會話、無狀態、有狀態、Via、Route、Record-Route等概念,清楚這些概念跟哪些header有關以及與sip proxy的關係。
how:這個只有網上搜了,也有講SIP的書。

2.基本安裝和基本命令

opensips kamailio 備註
安裝教程 http://www.opensips.org/Documentation/Install-CompileAndInstall-1-9 http://www.kamailio.org/wiki/install/4.0.x/git
主程序 opensips kamailio 都可能過-h參數查看可支持的所有啓動參數
動態管理配置 opensipsctl kamctl 可直接進行配置,比如賬號,domain等等信息
管理控制檯 忘記了 kamcmd 進入CLI,輸入問號顯示幫助列表
在這部分內容裏面,具體要熟悉通過修改Makefile進行編譯內容的調整,還需要熟悉幾個常用的MAKE 參數:http://sip-router.org/wiki/tutorials/makefile-system

3.opensips/kamailio系統參數、模塊參數、腳本、僞變量等

kamailio opensips
系統參數以及系統內置函數、腳本流程等 http://www.kamailio.org/wiki/cookbooks/4.0.x/core http://www.opensips.org/Documentation/Script-CoreParameters-1-10
http://www.opensips.org/Documentation/Script-CoreFunctions-1-10
http://www.opensips.org/Documentation/Script-Routes-1-10
僞變量:分系統內置的和腳本及模塊輸出的
這些僞變量可直接在配置文件中使用,非常方便
http://www.kamailio.org/wiki/cookbooks/4.0.x/pseudovariables http://www.opensips.org/Documentation/Script-CoreVar-1-10
變量操作及轉換 http://www.kamailio.org/wiki/cookbooks/4.0.x/transformations http://www.opensips.org/Documentation/Script-Tran-1-10
模塊列表及每個模塊輸出函數、參數、avp、mi等 http://kamailio.org/docs/modules/4.0.x/ http://www.opensips.org/Documentation/Modules-1-10
開發文檔 kamailio提供的是文檔教程
opensips提供的是視頻錄像及代碼。
http://www.asipto.com/pub/kamailio-devel-guide/ http://www.opensips.org/Documentation/Development-Tutorials




用他們來配合asterisk/freeswitch能夠構建超大容量的VOIP平臺,下次再分享架構。
推薦網友老黑翻譯的《使用OpenSER構建電話通信系統》http://blog.chinaunix.net/uid-2555411-id-68025.html,適合入門閱讀。


新浪微博:@安靜的發狂者
QQ:229675152 歡迎交流
本文爲原創,轉載請聯繫作者
kamailio/opensips 技術交流QQ羣:118791050


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章