Presentation is loading. Please wait.

Presentation is loading. Please wait.

SIP(Session Initiation Protocol) - SIP Messages

Similar presentations


Presentation on theme: "SIP(Session Initiation Protocol) - SIP Messages"— Presentation transcript:

1 SIP(Session Initiation Protocol) - SIP Messages

2 Contents A Simple SIP Example SIP Message - Request Message
RFC2543 (INVITE, REGISTER, BYE, ACK, CANCEL,OPTION) INTERNET-DRAFTS (INFO, PRACK) - Response Message - 목차 간단한 SIP 예를 통해서 SIP message의 구성을 알아본다. RFC2543에 나와있는 Request Message의 6가지 Method와 Draft에 추가된 2가지 Method들의 기능을 알아보고 Response Message 의미와 동작을 알아본다.

3 A Simple SIP Example(1) Tesla Marconi INVITE 180 Ringing 200 OK ACK
Media Session 간단한 예제를 통해서 SIP device들 간의 동작이 어떻게 이루어지고 그러한 동작을 하기위해 어떠한 메세지들을 주고 받는지 알아본다. 이 예제에서는 두 end-device들 간에 IP 네트웍으로 이뤄져있고 서로간의 IP 주소를 알고 있다고 가정한다. Marconi가 세션에 참가하도록 INVITE 메시지를 보낸다 Marconi는 INVITE 메시지를 받았음을 알리는 180 Ringing 메시지를 보낸다. Marconi가 Telsa의 요청을 수락했음을 200 OK 메시지로 알린다. Telsa는 ACK를 보냄으로서 실제 상호간에 교신할 미디어 세션을 연다. 세션을 종료하기 위해서는 BYE 메시지를 보내게 된다. BYE 200 OK

4 A Simple SIP Example(2) Start line minimum required header set
INVITE SIP/2.0 Start line Via: SIP/2.0/UDP lab.high-voltage.org:5060 To: G. Marconi From: Nikola Tesla Call-ID: CSeq: 1 INVITE Subject: About That Power Outage… Contact: Content-type: application/sdp Content-Length: 158 minimum required header set Message Header CRLF - Header와 Header는 CRLF로 구분 Header와 Body 사이는 CRLF로 구분. Header는 “Header: Value” 의 형식이고 Value와 그 다음 Value는 space로 구분. - Request-URI : 요청이 전달되어질 자원을 지칭 - Via: request를 생성한 device나 request를 forward한 device는 그 자신의 주소나 호스트 이름을 Via헤더에 기록한다. SIP Well-Known port# 5060 (->즉 SIP 라우팅 정보를 기록하기 위해 사용) - To: request destination, From: request originator - Call-ID: [램덤하게 뽑아진 local에서 유일한 string name 이나 주소]  글로벌하게 Call을 구분지을 수 있게 된다.->하나의 call내에서 동일한 값이 사용된다. - Call leg: To + From + Call-ID  Call을 구분하는데 사용(파티간에 multiple call 이 이뤄질 수 있으므로) - Cseq : 초기값은 1이 아니라도 되지만 Interger값을 사용. re_INVITE시 증가 ->세션 파라미터를 수정시, retransmitted INVITE와 구분짓는 역할 - Subject: SIP이 아니라 사용자가 이용하는 부분, 주제를 디바이스에 디스플레이한다던지 메시지 Sorting을 한다던지. - Content-type, Content-Length: Message Body의 타입과 크기를 지정  TCP의 경우 스트림을 통해 메시지를 전달하기 때문에 정확한 Boy의 크기 기술이 있어야 한다. UDP 전송의 경우 패킷 단위로 전송이 이뤄지기 때문에 기본적으로 하나의 패킷에 SIP 메시지가 들어가져야 한다. v=0 o=Tesla IN IP4 lab.high-voltage.org s=Phone Call c=IN IP t=0 0 m=audio RTP/AVP 0 a=rtpmap:0 PCMU/8000 Message Body

5 A Simple SIP Example(3) SIP/ Ringing Via: SIP/2.0/UDP lab.high-voltage.org:5060 To: G. Marconi From: Nikola Tesla Call-ID: CSeq: 1 INVITE Content-Length: 0 - Copying many of the Headers from the INVITE message, including the Via, To, From, Call-ID, and CSeq - To and From headers are not reversed(To and From headers are Defined to indicate the direction of the request) To 와 From헤더는 메시지의 방향을 나타내기 때문에 response에서는 변화하지 않는다 대신 UA는 이것을 역으로 해석할 수 있다. 하나의 call에 대해서는 동일한 Call-ID가 UAS와 UAC 사이에 사용된다. 180 Ringing response는 UAS에게 Call이 왔음을 알리고 있다는 의미로서 옵션으로 쓰인다.

6 A Simple SIP Example(4) UAS Media Capability
SIP/ OK .. Contact: Content-type: application/sdp Content-Length: 155 v=0 o=heisenberg IN IP s=Phone Call c=IN IP t=0 0 m=audio RTP/AVP 0 a=rtpmap:0 PCMU/8000 UAS Media Capability 200 OK : Request를 수락한다는 의미. -> 전화로 본다면 벨이 울려서 전화기를 받는 동작. Contact 에는 response를 받고 그 다음번 UAC에 의해 메시지가 바로 보내질 수 있는 SIP-URL Message Body에는 UAS의 media Capability가 포함된다. - When the called party decides to accept the call, a 200 OK response is sent

7 A Simple SIP Example(5) ACK SIP/2.0 Via: SIP/2.0/UDP lab.high-voltage.org:5060 To: G. Marconi From: Nikola Tesla Call-ID: CSeq: 1 ACK Content-Length: 0 - ACK Method means that UAC can support the media session proposed by UAS - At this point , the media session begins using the media information carried in the SIP messages. - In TCP , connection is safely closed after sending ACK Method Success repose에 대한 Ack를 보낸다.(단지 INVITE request에 대해서만 ACK 메소드가 사용될 수 있다) Cseq(Command sequence) 의 번호는 바뀌지 않고 이름만 ACK로 바뀐다 Ack 가 보내진 이후에 Media session을 통해 UA간의 통신이 이뤄지며 Media session은 SIP이 아닌 RTP와 같은 프로토콜에 의해 이뤄진다. TCP 연결시 INVITE부터 ACK를 보내는 과정까지 연결상태가 이뤄진후 안전하게 SIP연결을 종료한다. 그후 BYE메시지에 의해 세션을 종료할때 다시 connection이 이뤄진후 세션을 닫게된다. 여기서 안전한 종료의 의미는 UA가 Call 상태정보를 보관하기때문..

8 A Simple SIP Example(6) - SIP-enabled device must contain
BYE SIP/2.0 - SIP-enabled device must contain both SIP server and SIP client software Via: SIP/2.0/UDP tower.radio.org:5060 To: Nikola Tesla From: Marconi Call-ID: CSeq: 1 BYE Content-Length: 0 - To and From headers are reversed but Tesla is able to identify the call leg and tear down the correct media session SIP/ OK .. - BYE method : 세션을 종료할때. To와 From의 위치가 원래 INVITE 메시지의 부분과 바뀐다. - UAS와 UAC의 기능이 바뀌는 경우가 예를 통해서 볼 수 있다. 때문에 SIP구현된 UA는 서버와 클라이언트 구현이 모두 되있어야되는 점이 다른 Client-Server기반의 HTTP나 FTP와는 다르다고 할 수 있다.

9 SIP Messages Method(RFC2543) Internet-Drafts Method Response Messages
- INVITE, REGISTER, BYE, ACK, CANCEL, OPTIONS Internet-Drafts Method - INFO, PRACK Response Messages - SIP message를 구성하는 Request 메소드와 response Message 그리고 header에 대해서 알아본다. - Proxy Server는 단지 request를 forward만 한다면 request method를 이해할 필요가 없다. - Request Method에 대한 응답이 지원되지 않는다면 “ 501 Not Implemented “응답을 보낸다.

10 INVITE method Establish media sessions between user agents
It usually has a message body containing the media information - If it dose not have, the ACK contains the media information re-INVITE - An INVITE sent for an existing call leg references the same Call-ID as the original INVITE - Changing the session characteristics. - CSeq is incremented Request-URI is able to contain a phone number INVITE는 UA간에 media session을 열어주는데 목적이 있다 INIVITE가 주로 Message body에 media session 정보를 포함하지만 그렇지 않다면 ACK에서 포함될 수 있다. 만약 UAS가 ACK에 포함된 Media session으로 연결될 수 없다면 세션이 열린 이후에 BYE request message에 의해 세션을 바로 종료한다. 존재하는 call leg에 대한 INVITE는 존재하는 INVITE와 동일한 Call-ID를 가진다. re-INVITE는 세션 특성을 변경시킬때 사용된다 re-INVITE는 CSeq를 변경시킨다. 이렇게 함으로써 retransmission과 구별되게 한다. Request-URI에 전화번호가 포함될 수 있다. - PSTN Gateway에서 해석될 전화번호를 username에 적용하기 위해 파라미터를 붙일 수 있다. - #70w ;isub=1000;posted=pp ex) INVITE SIP/2.0

11 REGISTER method REGISTER sip:registrar.munich.de SIP/2.0 .. Contact: The REGISTER method is used by a user agent to notify a SIP network of its current IP address and the URLs for which it would like to receive calls Request-URI contains only the domain of the registrar Server with no user portion Example(Contact, Expires header & expires parameter) 200 OK call을 받기 위해 자신의 IP나 URL을 SIP network에 알리기 위해 UA에 의해 사용되는 request method Request-URI는 regitrar server의 도메인만이 포함된다. Third-party registration: To 헤더에는 register할 SIP URL이 들어가고 From 헤더에는 REGISTER method를 요청한 URL이 들어가게 되므로 일반적으로 동일한 값을 가지지만 third-party registration에서는 서로 다르다. Contact: * Expires: 0 Contact: expires=30 Contact: Expires: 30

12 BYE method It is used to terminate an established media session
A BYE is send only by user agents participating in the session, never by proxies or other third parties A BYE can be sent by either the caller or the called party in a session. BYE always increments the CSeq 메디아 세션을 종료하는데 사용된다 오직 세션에 참가한 UA를 통해서만 보내질 수 있다 BYE 메시지는 요청자와 응답자 모두 보낼 수 있다 BYE는 항상 CSeq을 증가시킨다. BYE로 CANCEL메서드를 대신할 수 있지만 INVITE처럼 forking 되지 않기 때문에 권장되지 않는다.

13 ACK method The ACK method is used to acknowledge final responses to INVITE requests ACK is never incremented for an ACK - A UAS can match the CSeq number of the ACK with the number of the corresponding INVITE An ACK may contain an message body, but can not be used to modify a media description ACK method는 INVITE 요청의 마지막 응답으로서 사용된다. ACK는 Cseq 번호를 증가시키지 않는다 INVITE 메서드가 Media session 정보를 담은 body를 포함하지 않았을때 ACK를 통해 자신의 미디어 정보를 보낼 수 있지만 세션정보를 수정하는데는 사용할 수 없다.

14 CANCEL method(1) The CANCEL method is used to terminate pending searches or call attempts A forking proxy can use the CANCEL method. The CANCEL method dose not increment the CSeq - UA can match the CSeq of the CANCEL with the CSeq of the pending INVITE Calling user agent Forking proxy server CANCEL은 어떤 call이 시도되고 있는 상황에서 그 call을 취소시킬때..단 세션이 이뤄진 다음에는 CANCEL메서드를 보낼 수 없다. Forking proxy에 의해 CANCEL이 보내질때는 응답을 줘서 tag가 붙은 UA를 제외하고는 call을 시도하는 모든 branch 요청이 취소된다.

15 CANCEL method(2) CANCEL method is a hop-by-hop request
If a final response has already been received, a user agent should not generate a CANCEL UAC Stateful Proxy UAS INVITE CSeq: 1 INVITE INVITE CSeq: 1 INVITE 100 Trying CSeq: 1 INVITE 100 Trying CSeq: 1 INVITE CANCEL CSeq: 1 CANCEL 200 OK CSeq: 1 INVITE 200 OK CSeq: 1 CANCEL CANCEL CSeq: 1 CANCEL CANCEL은 hop-by-hop request이다 마지막 응답을 받은 상황에서는 세션이 열리게 되고 그때는 CANCEL 메소드를 사용할 수 없다. 따라서 BYE 메소드를 보내서 세션을 종료해야한다. 200 OK CSeq: 1 INVITE 200 OK CSeq: 1 CANCEL ACK CSeq: 1 ACK BYE CSeq: 2 BYE 200 OK CSeq: 2BYE

16 OPTIONS method The OPTION method is used to query a user agent or server about its capabilities and discover its current availability OPTIONS sip:proxy.carrier.com SIP/2.0 Via: SIP/2.0/UDP cavendish.kings.cambridge.edu.uk To: sip:proxy.carrier.com From: J.C. Maxwell CSeq: 1 OPTIONS Content-Length: 0 SIP/ OK Via: SIP/2.0/UDP cavendish.kings.cambridge.edu.uk;tag=512A6 To: sip:proxy.carrier.com From: J.C. Maxwell Call-ID: Cseq: 1 OPTIONS Allow: INVITE, OPTION, ACK, BYE, CANCEL, REGISTER Accept-Language: en, de, fr Content-Length: 0 현재 UA나 SERVER의 capability나 사용가능성에 대한 쿼리를 보내는데 사용

17 INFO & PRACK method(1) INFO method
- It is used by UA to send call signaling information to another user agent with which it has an established media session. PRACK - It is used to acknowlegde receipt of reliably transported provisional responses(1XX) INFO : 이미 미디어 세션을 가진 UA에게 추가적인 CALL SIGNALING 정보를 전달할때. PRACK : INFORMATIONAL class response에 대한 신뢰성 있는 전송의 수단으로 사용된다.

18 INFO & PRACK method(2) UAS UAC INVITE T1 Media Session
Supported:100rel CSeq: 1 INVITE 100 Trying CSeq: 1 INVITE 180 Ringing CSeq: 1 INVITE RSeq: 314 T1 180 Ringing CSeq: 1 INVITE RSeq: 314 PRACK CSeq: 2 PRACK RAck: INVITE PRACK는 Rseq(reliable sequence number)와 supported:100rel헤더를 포함한 INFORMATIONAL class response를 받았을때 UAC에 의해 Generate된다.(100 Trying 메시지는 지원하지 않는다) 200 OK Cseq: 2 PRACK -> PRACK에 대한 confirm 200 OK CSeq: 2 PRACK 200 OK CSeq: 1 INVITE ACK CSeq: 1 ACK Media Session

19 Response Messages(1) A SIP response is a message generated by a UAS or a SIP server to reply to a request generated by a UAC The reason phrase is for human consumption only - 200 Call Failed = 200 OK Informational class response(1XX) - It is used to indicate call progress - The first informational response received by the UAC confirms receipt of the INVITE, and stops retransmission of the INVITE ( ex)180 Ringing) SIP response message는 UAC의 요청에 대한 응답으로 UAS에서 generate된 메세지이다 Reason phrase는 sip이 아닌 사용자에게 디스플레이하는데 사용된다. Informational class response는 현재의 call의 진행상태를 보여준다. 100 trying 같은 경우 forking과 같이 많은 시간을 요구할지도 모르는 경우 현재 콜이 진행중에 있음을 나타낸다. Informational class response를 사용할 경우 이미 전달된 INVITE 메시지에 대한 재전송을 막아준다.

20 Response Messages(2) Success 200 OK Redirection class response(3XX)
- When used to accept a session invitation( ex) INVITE ) - Successful completion of the request( ex) PRACK ) Redirection class response(3XX) - It is generally sent by a SIP server acting as a redirect server in response to an INVITE - There is no requirement that a UAC receiving a redirection response must retry the request to the specified address. - UAC could be configured to automatically generate a new INVITE upon receipt of a redirection class response without requiring user intervention

21 Response Messages(3) Client Error(4XX) Server Error(5XX)
- It is used by a server or UAS to indicate that the request cannot be fulfilled as it was submitted - 400 Bad Request , 401 Unauthorized, 404 Not Found .. Server Error(5XX) - The request cannot be processed because of an error with the server - The response may contain a Retry-After header if the server anticipates being available within a specific time period - 501 Not Implemented, 505 Version Not Supported UAC의 요청이 실행될 수 없음을 UAS가 response한다 400 Bad Request -> 요청을 서버가 이해할 수 없음 401 Unauthorized -> 유저의 인증을 필요로함 404 Not Found -> Request-URI 에 있는 SIP URL을 가진 유저가 서버에 존재하지 않음 서버에러로 인해서 요청이 실행될 수 없을때 501 Not Implemented -> 요청에 대한 실행이 서버에서 지원 안함 505 Version Not Supported -> SIP 버전이 맞지 않음(아직 SIP 버전은 2.0 하나 밖에 없어서 정확한 정의는 내려져 있지 않다)

22 Response Messages(4) Global Error(6XX) - 604 Dose Not Exist Anywhere
- The Server knows that the request will fail wherever it is tried. As a result the request should not be sent to other locations - 604 Dose Not Exist Anywhere It is similar to the 404 Not found but indicates that the user in the Request-URI cannot be found anywhere. Client 에러의 경우 다른 Location에 다시 요청을 보낼 수 있지만 Global error일 경우 위치에 상관없이 항상 요청이 실패할 거란걸 알려준다


Download ppt "SIP(Session Initiation Protocol) - SIP Messages"

Similar presentations


Ads by Google