1 project iii sip mobility date: 2008/12/02. 2 sip mobility pre-call mobility (project 2) mid-call...

28
1 Project III Project III SIP Mobility SIP Mobility Date: 2008/12/02 Date: 2008/12/02

Post on 20-Dec-2015

221 views

Category:

Documents


4 download

TRANSCRIPT

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

1

Project IIIProject IIISIP MobilitySIP Mobility

Date: 2008/12/02Date: 2008/12/02

Page 2: 1 Project III SIP Mobility Date: 2008/12/02. 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: 2008/12/02. 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: 2008/12/02. 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: 2008/12/02. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent

5

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

實作出 SIP Mobility 的功能

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

6

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

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

7

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 8: 1 Project III SIP Mobility Date: 2008/12/02. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent

8

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

– JAVA JDK 5.0– Eclipse IDE

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

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

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

9

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

(2) 點選 “ Existing Projects into Workspace”

(1) 點選 “ File” “Import”

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

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

10

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

(1) 點選專案的 “ Properties”

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

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

11

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

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

(1) 點選專案的 “ Properties”

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

12

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 13: 1 Project III SIP Mobility Date: 2008/12/02. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent

13

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 14: 1 Project III SIP Mobility Date: 2008/12/02. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent

14

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

– ResourceGUI• UA 專案

– PCSButton

• Handoff_UA 專案– MainClass

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

15

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

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

16

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 17: 1 Project III SIP Mobility Date: 2008/12/02. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent

17

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 18: 1 Project III SIP Mobility Date: 2008/12/02. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent

18

HeaderFactoryHeaderFactory• 建立 HeaderFactory

– HeaderFactory hf = sipFactory.createHeaderFactory();

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

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

19

MessageFactoryMessageFactory• Create new MessageFactory

– MessageFactory mf =sipFactory.createMessageFactory();

• Frequently use function– createRequest

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

• TRYING, RINGING, 200OK

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

20

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

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

21

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 22: 1 Project III SIP Mobility Date: 2008/12/02. 2 SIP Mobility Pre-call mobility (Project 2) Mid-call mobility – 假設 Mobile Node (MN) 已經利用 SIP 跟遠方某 Correspondent

22

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 23: 1 Project III SIP Mobility Date: 2008/12/02. 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: 2008/12/02. 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", ??);– (Hint: 可以參考 Video 部分的設定方法 )

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

25

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

INVITE封包內容

• Demo 時請攜帶完整的 source code

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

26

補充說明補充說明•真正會需要修改到的檔案 :

– UA: PCSButton.java– Handoff-UA: MainClass.java

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

27

補充說明補充說明• 完整 DEMO 流程 :

1. 執行 ResourceServer( 選定 IP Start)2. 執行 Handoff-UA(HandoffNewIP 所指定的 IP 要先

在網卡設定那邊設定好 ,否則 bind 會出錯 )3. 執行 UA, 按下 Play鍵 等待影片播出4. 影片播放中 ,打好 NewIP 後按下 move鍵 會發現畫

面中斷一下下 ,然後繼續播映 ( 有可能按第一下不會有反應 , 此時可再多按幾下 ), 此時實際上是由 Handoff-UA 播放影片 ( 在 ResourceServer 的 console 中可以看見目前服務的 IP 已經從 UA 的 IP變成 Handoff-UA 的 IP)

Done.

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

28

補充說明補充說明• Demo完後 ,基本上 UA 跟 ResourceServe

r只要按視窗右上角的” X”即可關閉 . 至於 Handoff-UA由於沒有 GUI, 所以請用Eclipse 的 console關閉 : (1)

(2)

(3)