1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call...

25
1 Project III Project III SIP Mobility SIP Mobility Date: 2007/12/13 Date: 2007/12/13
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    214
  • download

    0

Transcript of 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call...

Page 1: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

1

Project IIIProject IIISIP MobilitySIP Mobility

Date: 2007/12/13Date: 2007/12/13

Page 2: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

2

SIP MobilitySIP Mobility• Pre-call mobility (Project 2)

• Mid-call mobility– 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Corre

spondent Node (CN) 建立起 RTP 連線– 若 MN 從某一網域移動到另一個網域,則會被重新分

配一個新的 IP ,此時 CN 必須作出適當的 RTP Session 重建才能維持連線,而其過程如下:

• MN 送出 RE-INVITE 訊息告知 CN 進行 RTP Session 重建• MN 送出 RE-REGISTER 訊息告知 home registrar 更新其位置

Page 3: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

3

支援支援 SIP MobilitySIP Mobility 的的Media StreamingMedia Streaming 系統架構系統架構

Media Server

Client

IP NetworkR

TP S

essi

on

NEW

RTP Session

INVITE

200 OK RE-INVITE

200 OK

Page 4: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

4

Media StreamingMedia Streaming 系統運作流程系統運作流程

ClientMedia Server

RTP Session

INVITE

200 OK

ACK

Handoff happenedIP is changed

RE-INVITE

200 OK

ACK

200 OK

New RTP Session with new IP

Page 5: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

5

RE-INVITERE-INVITE 與原與原 INVITEINVITE 的差異的差異• SIP Header 部份

– Contact Header 需要使用新 IP 作為 SIP URI– CSeq number 需要加 1

• SDP 部份– Origin (“o=”)

• 改為 Handoff 後新取得的 IP– Connection ("c=")

• 必須為 0.0.0.0 (e.g. "c=IN IP4 0.0.0.0")

Page 6: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

6

作業目標作業目標• 利用助教提供的 Media Streaming 系統,

實作出 SIP Mobility 的功能

Page 7: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

7

建立建立 Media StreamingMedia Streaming 系統系統使用 使用 Eclipse + JAIP-SIPEclipse + JAIP-SIP

Page 8: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

8

Media StreamingMedia Streaming 系統的網路元件系統的網路元件• Resource Server

– 影片串流服務伺服器– 選擇所使用的 IP 後 , 按下“ S

tart” 開始提供影片串流服務• Client

– UA• Handoff 前所使用的播放器• 按下 “ Play” 開始播放• 當按下 UA 的“ move” 後,會

根據左邊文字盒裏的 IP 當作新的 IP ,觸發 RE-INVITE 的流程

– Handoff_UA• Handoff 後所使用的播放器,必

須搭配 UA 一起執行• 沒有 GUI 界面,在背景運作

UA程式界面

Server程式界面

Page 9: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

9

系統需求系統需求• 程式語言及開發工具

– JAVA JDK 5.0– Eclipse IDE

• 函式庫– JAIN-SIP– JMF (Java Media Framework)

• 需要安裝 jmf-2_1_1e-windows-i586.exe

Page 10: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

10

在在 EclipseEclipse 引入各元件的專案引入各元件的專案

(2) 點選 “ Existing Projects into Workspace”

(1) 點選 “ File” “Import”

(3) 點選專案所在目錄,請分別加入 “ ResourceServer”, “UA” 及“ HANDOFF_UA” 這三個目錄中的專案

Page 11: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

11

加入專案所需要的函式庫加入專案所需要的函式庫-ResourceServer-ResourceServer 及及 UAUA

(1) 點選專案的 “ Properties”

(2) 設定 Java Build Path, 選擇” ./library/” 目錄下的所有函式庫檔案,最後按下 “開啟”

Page 12: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

12

加入專案所需要的函式庫加入專案所需要的函式庫-HANDOFF_UA-HANDOFF_UA

(2) 設定 Java Build Path, 選擇” ./HANDOFF_UA/lib/” 目錄下的“ HandoffUA.jar” ,最後按下 “開啟”

(1) 點選專案的 “ Properties”

Page 13: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

13

UAUA 的的 IPIP 設定 – 設定 – ./UA/src/PCSB./UA/src/PCSButton.javautton.java

• 在 PCSButton 類別的建構子中需要修改 :– super.PCS_LOCAL_IP = “192.168.71.196”;

• 本機 Handoff 前的原始 IP– super.PCS_LOCAL_PORT = 5656;

• 本機的 SIP port– super.PCS_REMOTE_ADDR = "192.168.71.196:432

1";• Media Server 的 IP 及 Port

– super.PCS_REMOTE_FILENAME = "smoking.mpeg";• 要播放的影片檔名

Page 14: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

14

Handoff_UAHandoff_UA 的的 IPIP 設定– 設定– ././HANDOFF_UAHANDOFF_UA/src//src/MainClass.javaMainClass.java

• 在 MainClass 類別的 main 中需要修改 :– String ServerIP = "192.168.71.196";

• Media Server 的 IP– String HandoffNewIP = "192.168.71.166";

• 本機 Handoff 後的新 IP

Page 15: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

15

各專案的各專案的 main classmain class• Resource Server 專案

– ResourceGUI• UA 專案

– PCSButton

• Handoff_UA 專案– MainClass

Page 16: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

16

JAIN-SIPJAIN-SIP 函式庫之使用函式庫之使用

Page 17: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

17

FactoriesFactories• JAIN SIP defines four different factories each with respec

tive responsibilities, namely:• SipFactory

– This interface defines methods to create new Stack objects and other factory objects.

• AddressFactory– This interface defines methods to create SipURI’s and

TelURL’s.• HeaderFactory

– This interface defines methods to create new Headers objects.

• MessageFactory– This interface defines methods to create new Request a

nd Response objects.

Page 18: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

18

AddressFactoryAddressFactory• 建立 AddressFactory

– AddressFactory af = sipFactory.createAddressFactory();

• 常用的函式– createSipURI

• 假設要建立一個 SIP URI: sip:[email protected]• JAIN-SIP 語法是 :

SipURI tmpURI = af.createSipURI(“vincent”, “wmnet.com”);

– createAddress• 假設要建立一個 SIP address: “WH”<sip:vincent@wmnet.

com>• JAIN-SIP 語法是 :

Address tmpAddr = af.createAddress(tmpURI);tmpAddr.setDisplayName(“WH”);

Page 19: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

19

HeaderFactoryHeaderFactory• 建立 HeaderFactory

– HeaderFactory hf = sipFactory.createHeaderFactory();

• 常用的函式– createFromHeader– createToHeader– createViaHeader– createContentTypeHeader– createCseqHeader– createMaxForwardsHeader– createContactHeader– createHeader

Page 20: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

20

MessageFactoryMessageFactory• Create new MessageFactory

– MessageFactory mf =sipFactory.createMessageFactory();

• Frequently use function– createRequest

• REGISTER, INVITE, ACK, CANCEL, BYE– createResponse

• TRYING, RINGING, 200OK

Page 21: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

21

SIP MobilitySIP Mobility 程式實作程式實作修改修改 ./UA/src/PCSButton.java./UA/src/PCSButton.java

Page 22: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

22

PCSParameterPCSParameter 所提供的參數所提供的參數• 為了簡化程式架構,我們先把需要用到的資訊放

在名為 pcsParam 的物件裏,其中可用的資訊有 :– AddressFactory addressFactory;– MessageFactory messageFactory;– HeaderFactory headerFactory;– String NewIP

• Handoff 後新取得的 IP– int ContactPort;

• Handoff 後的 SIP port– int audioRTPPort;

• 聲音的 RTP port– int audioRTCPPort;

• 聲音的 RTCP port– …( 略 )

Page 23: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

23

實作部份 實作部份 Part I – SIP HeaderPart I – SIP Header• (1) 產生 CSeq Header 物件

– pcsParam.headerFactory.createCSeqHeader(??, Request.INVITE);

• (2) 產生 Contact URI– pcsParam.addressFactory.createSipURI("N

ewRtpDest", ??);– contactURI.setPort(??);

Page 24: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

24

實作部份 實作部份 Part II – SDP ContentPart II – SDP Content• (3) 產生 Origin 物件

– sdpFactory.createOrigin("UA", ??);• (4) 產生 Connection 物件

– sdpFactory.createConnection("IN","IP4", ??);• (5) 產生 Audio RTP port 物件

– sdpFactory.createMediaDescription("audio", ??, 1, "RTP/AVP", format);

• (6) 產生 Audio RTCP port 物件– sdpFactory.createAttribute("rtcp", ??);

Page 25: 1 Project III SIP Mobility Date: 2007/12/13. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent.

25

作業要求作業要求• Media Playing (60%)• SIP Mobility (20%)•報告 (20%) :請說明你的實作心得、 RE-

INVITE封包內容及 PCSButton.java 程式碼

• Demo日期: 2008/01/09 ( 三 ) 14:00-17:00 綜合二館 741室