一个对SIP协议栈封装的Demo
2015-07-22 09:37
260 查看
SipWrapper
========================================
SipWrapper is wrapper codes for reSIProcate stack, follows Apache2 license.
#### Why need SipWrapper?
ReSIProcate stack is an cpp style SIP stack implementation. But reSIProcate does not work well as bellow. So we add an wrapper for this stack to overcome these disadvantages.
<ul>
<li>SIP API is not unified.</li>
<li>ReSIProcate does not have higher SIP element abstract.</li>
</ul>
#### How we design?
We use old style network stack design pattern, first is layer design. Basically, there are three layers here. First is service provider layer, aimed for explore APIs to user. Second is call management layer, aimed for manage calls we hold, the defination of
the call is the same as RFC3261. Third is adapter layer, aimed for porting SipWrapper to kinds of SIP stacks.
Bisically, the center of second layer is "call", which is represent for SIP session. For the call, we support call management, call state machine, call life management and so on. We add some usefull utils like log, timer.
What files contains in each folder?
-----------------------------------
/sipSDK
|
|--./doc sip sdk documents
|--./lib libraries
|--./Make.defines build file
|--./Makefile build file
|--./sipstack sip stack dependences
|--./h sip sdk interface code
|--./src sip sdk source code
|--./test sip sdk test source code
How does SipWrapper works in network?
-------------------------------------
As other network protocol stacks and SIP protocol said, SipWrapper works in UA on network elements.
Application Application
UAC UAS
|| ||
request response request response
|| ||
SipWrapper SipWrapper
|| ||
SIP stack --------------------- SIP stack
Component Overview
------------------
---------------- SIP message --------------------
| Sip Provider | -----------------------> | Sip Call Manager |
---------------<- --------------------
| | \ | |
send recv \ create call back
| | \ | |
--------------------- \ ------------ |
| Sip Stack Adapter | send response -- | Sip Call | |
--------------------- ------------ |
| |
Sip Stack ------------------
| User Call Sink |
------------------
Basic Work Flow
---------------
-----------------
| Process Start |
-----------------
|
| Is SIP request?
|
Y ------------------------ N ---------------------- |
| |
| Is INVITE? |
| |
Y --------------- N ------------- | |
| | |
| Call Exists? | |
| --------------- | |
Y ---- N ---- | create call | | |
| --------------- | |
| | | |
------------------------ | ---------- ----------
| Mark it as re-INVITE | | | Notify | | Notify |
------------------------ | ---------- ----------
| | | |
| | | |
--------------------------------- | | |
| Notify user that INVITE comes | - | |
--------------------------------- | |
| | |
| | |
------- | |
| END | -------------------------------------------------
-------
#### Unit Test Example
The "uriTest.cpp" is an example of unit test to test ISipUri in ISipMessage.
#### Function Test Example
The "testApp.cpp" is an example of how to use SipWrapper. Also this could be
used to test SipWrapper.
========================================
SipWrapper is wrapper codes for reSIProcate stack, follows Apache2 license.
#### Why need SipWrapper?
ReSIProcate stack is an cpp style SIP stack implementation. But reSIProcate does not work well as bellow. So we add an wrapper for this stack to overcome these disadvantages.
<ul>
<li>SIP API is not unified.</li>
<li>ReSIProcate does not have higher SIP element abstract.</li>
</ul>
#### How we design?
We use old style network stack design pattern, first is layer design. Basically, there are three layers here. First is service provider layer, aimed for explore APIs to user. Second is call management layer, aimed for manage calls we hold, the defination of
the call is the same as RFC3261. Third is adapter layer, aimed for porting SipWrapper to kinds of SIP stacks.
Bisically, the center of second layer is "call", which is represent for SIP session. For the call, we support call management, call state machine, call life management and so on. We add some usefull utils like log, timer.
What files contains in each folder?
-----------------------------------
/sipSDK
|
|--./doc sip sdk documents
|--./lib libraries
|--./Make.defines build file
|--./Makefile build file
|--./sipstack sip stack dependences
|--./h sip sdk interface code
|--./src sip sdk source code
|--./test sip sdk test source code
How does SipWrapper works in network?
-------------------------------------
As other network protocol stacks and SIP protocol said, SipWrapper works in UA on network elements.
Application Application
UAC UAS
|| ||
request response request response
|| ||
SipWrapper SipWrapper
|| ||
SIP stack --------------------- SIP stack
Component Overview
------------------
---------------- SIP message --------------------
| Sip Provider | -----------------------> | Sip Call Manager |
---------------<- --------------------
| | \ | |
send recv \ create call back
| | \ | |
--------------------- \ ------------ |
| Sip Stack Adapter | send response -- | Sip Call | |
--------------------- ------------ |
| |
Sip Stack ------------------
| User Call Sink |
------------------
Basic Work Flow
---------------
-----------------
| Process Start |
-----------------
|
| Is SIP request?
|
Y ------------------------ N ---------------------- |
| |
| Is INVITE? |
| |
Y --------------- N ------------- | |
| | |
| Call Exists? | |
| --------------- | |
Y ---- N ---- | create call | | |
| --------------- | |
| | | |
------------------------ | ---------- ----------
| Mark it as re-INVITE | | | Notify | | Notify |
------------------------ | ---------- ----------
| | | |
| | | |
--------------------------------- | | |
| Notify user that INVITE comes | - | |
--------------------------------- | |
| | |
| | |
------- | |
| END | -------------------------------------------------
-------
#### Unit Test Example
The "uriTest.cpp" is an example of unit test to test ISipUri in ISipMessage.
#### Function Test Example
The "testApp.cpp" is an example of how to use SipWrapper. Also this could be
used to test SipWrapper.
相关文章推荐
- find_shape_model_max_deformation.hdev相关例程学学习
- 详解js跨域问题
- 黑马程序员——Java学习总结:转换流和流的操作总结
- 在Python的Django框架中编写错误提示页面
- STM32f103的数电采集电路的USART的使用与蓝牙的连接的程序
- 'cocos2d::LabelTTF::getContentSize': 被声明为已否决
- Android内部优化(二)
- 启动Linux上Weblogic Server报错: <BEA-141281> <unable to get file lock, will retry ...>
- LeetCode 之 Valid Palindrome(字符串)
- FTP文件的上传和下载---org.apache.commons.net.ftp.FTPClient
- 取消谷歌默认显示360导航的办法
- (转)19个必须知道的Visual Studio快捷键
- git Clone 某个分支或所有分支
- sql基本语句
- 第6章 服务模式
- 图表中如何实现动态变更分类轴与系列值
- Kafka性能测试与详解
- Qt中的验证器
- 深入理解 Neutron -- OpenStack 网络实现(1):GRE 模式
- eclipse配置javap命令的方法