• 沒有找到結果。

Platform and Tools

在文檔中 應用層多播線上即時串流 (頁 38-42)

Chapter 3 System implementation

3.1 Platform and Tools

■ Hardware and Software

We use Microsoft Visual C++ 6.0 integrated development environment (IDE) tools to implement on CCL SIP User Agent (UA). The CCL SIP UA [18,19] was implemented by the Computer & Communication Research Laboratories (CCL) of the Industrial Technology Research Institute (ITRI). Execution file and simulation tool run on Microsoft Windows XP operation system.

■ Protocol stack of SIP UA

CallManager MediaManager UAProfile

UI

UACore cclRTP Codec

WaveIO sipTx

RTP SIP

SDP

Transport Peer List

Figure 3-1 CCL SIP User Agent Structure

The “User Interface” (UI) layer is on top of the protocol stack, used to read the

user’s command, settings and invoke the “CallManager” layer. The “UAProfile” layer is used to save all user configurations including local address, proxy, registrar, SIP user name, and host name…etc. The “PeerList” layer keeps the remote selectable serving nodes’ information such as IP address, Port number, user name, RTT to the media source, and numbers of hops to the media source…etc. The “CallManager”

layer implements the SIP dialog behavior and core call control models by providing the “UACore” callback functions, and it also refer to the “MediaManager” layer to control and process media session objects. The “UACore” layer is designed for UA kernel, used to create SIP message objects, SDP object contained in SIP message and control the creation and deletion of SIP dialog objects. The “SipTx” layer is a single thread event-callback programming model, and serves as the finite state machine (FSM) of SIP UA by implementing the four types of SIP transactions defined in RFC 3261. The “SIP” layer implements all functions of SIP such as create SIP request and response messages and modify header contents. The “Transport” layer is responsible for low-layer network APIs, including socket management, network initiation…etc.

The “MediaManager” layer refers to the “WaveIO” layer for media playback, recording and refers to the “cclRTP” layer for RTP handling.

3.2 System implementation

We implement first on SIP UA for accepting multiple calls by modifying RTP member list receiver. Using the cclRTPAddReceiver() routine in the “MediaManager”

layer to open a new RTP session and add a new client to the RTP member list in the

“RTP” layer, all actions are accomplished in the “MediaManager” layer. The cclRTPSetEventHandler() routine in the “cclRTP” layer creates a new thread for reading received RTP packets and callbacks to the routine RTPEventHandler() for

writing the received RTP packet to a “Read Buffer”. Another thread triggers the corresponding callback routine CMediaManager::RTP2Wav() to read data from the

“Read Buffer” and then calls the WavInOut::wavOutOpen() routine for playing the streaming data.

Then we implement the function of redirect server for supporting creation and processing of the SIP 302 Moved_Temporarily response. When the UAS receive a SIP INVITE request, if its serving degrees are not full, accepts this call and opens RTP session directly; otherwise, creates a SIP 302 Moved_Temporarily response with the

“Contact:” header filled in its children peer information, and waits for the SIP ACK message for deleting this dialog session. On the other hand, when the new coming node receives the SIP 302 Moved_Temporarily response on the “Transport” layer, the peer information in the “Contact:” header will be handled in the upper two layer:

“UACore” and “CallManager”. In the “UACore” first parses the information of the

“Contact:” header and passes it to the “CallManager” layer for parsing and recording peer information to peer list data structure, then uses ChooseSN() routine to select an appropriate SN and return to the “UACore” layer.

The “UACore” layer uses the original SIP request message and the selected SN to create a new SIP INVITE request, transaction, adds to the original dialog, deletes the original transaction from the dialog, sets the dialog state to “Dialing”, and passes to the “SipTx” layer to send this new SIP request to the new serving node. At the same time, the client also sends a SIP ACK message to the previous serving node to response the receiving of SIP 302 Moved_Temporarily redirect message.

Every SIP UA also needs to implement the function of relay servers. Media streaming packets on the “Transport” layer will pass to the “RTP” layer thread in terms of the packet port number (this is accomplished within the event-driven call back programming model in one Dispatch thread). When the “RTP” layer receiving

these streaming packets, it will lookup the member list of the same RTP session, and relay these packets it has received from its serving node to all children in terms of the information on RTP member list.

The “Peer List” layer implements the Internet Control Message Protocol (ICMP) functions, which is used to help the IP layer for error control, for example, when a datagram cannot reach its destination, the ICMP messages can typically report errors in the processing of datagram. In this thesis we use the echo function of ICMP to obtain the TTL and RTT. In fact, ICMP can detect many error functions with different message format. Table 3-1 shows the data structure of ICMP header used for Echo functions defined in RFC 792.

Field Descriptions Type Define the type of this message, such as ECHO request(8) or reply(0)

Code Harmony with Type to specify the reason of the error CheckSum Verify the correctness of the request data

ID If Code=0, an ID to aid in matching echoes and replies, may be zero Sequence Same with ID in currently define

Table 3-1 ICMP headers

Our ECHOREQUEST data structure hence include an ICMP header and dwTime, used to record the time of when this request is sent, a serious of data. When receiving the ECHO reply message corresponding to the sequence number of packet we have just sent, calculate the received time and minus the sending time (dwTime in the ECHO reply message), that is round-trip time (RTT).

We fill the packets with largest data (1480 bytes, because maximum IP packet is

1500 bytes, and IP header is 20 bytes) to reduce the transfer number of packets.

在文檔中 應用層多播線上即時串流 (頁 38-42)

相關文件