您的位置:首页 > 其它

一个对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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: