SIP (Session Initiation Protocol)
2007.11
KT BcN 본부 U-Comm담당
선임연구원 최영우 (choiyw@kt.co.kr)
Contents
Introduction
■ VoIP/MoIP
■ SIP overview
■ IETF WGs
SIP
■ Terminoloy
■ Messages / Headers
■ SDP
■ Transaction / Timer
■ Routing
■ Basic Call Flows
■ RFCs
VoIP Issues
BcN 본부 2
VoIP/MoIP
Evolution of Network and Service Environments NGN/BcN
■ Broadband Core Network
■ Various Access Networks
■ All IP-based Networking and Interworking
■ IP-based Converged Multimedia Services
What is the Killer Application in Broadband Converged Network Environments ?
■ Fundamental requirements: IP-based Voice Communication VoIP
■ Additionally, Multimedia Converged Services MoIP
• 영상전화, 멀티미디어 메세징, 컨퍼런스, VoD, IPTV, etc.
BcN 본부 3
SIP overview
RFC 3261
응용계층 신호 프로토콜
멀티미디어 세션 설정, 수정, 종료를 위해 사용
하위 계층 전송 프로토콜과 독립적
응용계층 시그날링 프로토콜
■ UDP, TCP, SCTP
■ Secure Transport: TLS over TCP, IPSec
HTTP 기반
■ 텍스트 기반 프로토콜
■ URIs (Uniform Resource Indicators) 사용
• Email like SIP-URI 사용 sip:unit2@octave.com
Personal (Session) Mobility 제공
■ 동일한 SIP 주소, 다른 위치 (단말)
■ 현재 사용자의 위치 등록,수정,삭제,검색 기능
메시지 포킹(Forking) 기능 제공
다양한 응용에 활용 가능
■ Voice, video, gaming, instant messaging, presence, call control, etc.
BcN 본부 4
IETF WGs related to SIP
BcN 본부 5
SIP basic architecture
BcN 본부 6
SIP Uniform Resource Indicators (URIs)
E-mail 주소와 동일: user@domain
Two URI scheme:
■ SIP URI
• sip:unit2@octave.com
■ Secure SIP URI
• sips:unit2@octave.com
• TLS over TCP
Two types of SIP URIs:
■ Address of Record (AOR) (identifies an user)
• sip:unit2@octave.com
• octave.com 도메인의 SIP 서버를 알아내기 위해 DNS SRV record 필요
■ Contact (Identifies a device, FQDN)
• sip:unit2@147.6.60.8 or sip:unit2@cscf3.octave.com
SIP URI Addressing Example
■ sip:unit2@cscf3.octave.com:5060;transport=tcp
BcN 본부 7
Terminology
Call
■ created with sending INVITE message
■ Identified by a globally unique call-id
Dialog
■ Peer-to-peer relationship between two Uas
■ Call-ID, TO tag, FROM tag의 조합으로 구분
Transaction
■ Client와 Server간에 요청에 대한 최종응답을 받기까지의 상호 통신 과정
■ Call-ID, CSeq, TO tag, FROM tag의 조합으로 구분
Outbound proxy
■ Request-URI와 무관하게 UAC로부터의 모든 request를 수신하는 proxy
■ Manual configuration or using auto-configuration protocol
BcN 본부 8
Components
User Agent (user application, UAC+UAS)
■ User agent client (UAC)
• SIP 요청 메시지를 생성하는 논리적 구성요소
• SIP transaction을 개시하며, 해당 transaction 존속기간 동안 UAC로 동작
■ User agent server(UAS)
• 수신한 SIP 요청 메시지에 대한 응답 메시지를 생성하는 논리적 구성요소
• 요청 메시지 수용, 거절, redirect
Server
■ Proxy server
• UAC와 UAS 사이에서 SIP 메시지 라우팅을 담당하는 서버
• 메시지 처리를 위해 UAC와 UAS로써 동작하며, 경우에 따라 수신 메시지 수정
• Stateful Proxy/Stateless Proxy
■ Redirect server
• 요청 메시지에 대한 3xx 응답을 생성하는 UAS
• 3xx 응답을 통해 클라이언트 접속주소를 가리키는 대체 URIs 전송
■ Registrar (Location Server)
• REGISTER 메시지를 통해 사용자가 등록시킨 사용자 접속주소 저당
• 특정 사용자로의 접속주소에 대한 정보 제공
■ Back-to-Back User Agent (B2BUA)
• 수신한 SIP 요청 메시지에 대한 응답 메시지를 생성하는 논리적 구성요소
• 응답메시지 생성을 위해 경우에 따라 UAC로도 동작
• Proxy 서버와는 달리, 다이얼로그 상태까지 관리
BcN 본부 9
Message
Request : Client Server
■ INVITE : 세션 설정 요청 메시지
■ ACK :INVITE 트랜잭션 종료 메시지(성공, 실패의 경우 모두 해당)
■ BYE : (confirmed) dialog를 종료하고자 할 경우
■ CANCEL : Request 를 취소하고자 할 경우 (일반적으로 INVITE 를 취소하고자 할 경우)
■ REGISTER : 현재 위치를 등록하고자 할 경우 (SIP 인증 병행)
■ OPTIONS : 상대 UA의 capability(지원하는 헤더, 파라메터 등) 를 알고자 할 경우
■ INFO : dialog 중(통화중) 부가적인 정보를 전달하고자 할 경우
■ MESSAGE : short message를 보내고자 할 때
■ PUBLISH : UA의 presence 및 기타 정보를 서버로 전달할 경우
■ REFER : 상대방 UA를 제어하고자 할 경우
■ UPDATE : 현재 설정된 세션을 수정하고자 할 경우 (re-INVITE와 유사)
■ PRACK : Provisional Response (1xx) 에 대한 ACK 을 요청하고자 할 경우
■ SUBSCRIBE, NOTIFY : 특정 이벤트 정보를 전달 받고자 할 경우
Response : Server Client
■ 1xx : Informational. 요청 메시지를 수신하여 처리가 진행되고 있음을 알림.
■ 2xx : Success. 그 동작이 성공적으로 수신되고, 이해되어 수용되었음을 알림.
■ 3xx : Redirection. 요청 메시지를 완성하기 위해 취할 동작이 더 있음을 알림.
■ 4xx : Client Error. 요청 메시지에 에러가 포함되어 있음을 알림.
■ 5xx : Server Error. 요청 메시지는 유효하나 서버가 수행할 수 없음을 알림.
■ 6xx : Global Failure. 요청 메시지가 어떤 다른 서버에서도 수행할 수 없음을 알림.
BcN 본부 10
Message: Response Code
100 Trying 415 Unsupported Media Type
180 Ringing 416 Unsupported URI Scheme
181 Call Is Being Forwarded 420 Bad Extension
182 Queued 480 Temporarily Unavailable
183 Session Progress 481 Call/Transaction Does Not Exist
200 OK 482 Loop Detected
201 Accepted 483 Too Many Hops
301 Moved Permanently 486 Busy Here
302 Moved Temporarily 487 Request Terminated
400 Bad Request 500 Server Internal Error
401 Unauthorized 503 Service Unavailable
403 Forbidden 504 Server Time-out
404 Not Found 600 Busy Everywhere
405 Method Not Allowed 603 Decline
406 Not Acceptable
407 Proxy Authentication
408 Request Timeout
BcN 본부 11
Message Header
Mandatory Header
■ From, To, CSeq, Call-ID, Max-Forwards, Via
■ Contents-Length: TCP 전송시 MUST, UDP 전송시 SHOULD
Request-URI
■ Initial Request-URI: SHOULD be set value of To Header
From
■ Request 메시지 생성자의 SIP-URI(AOR)
■ 최초 request 메시지에서는 request-URI와 To 헤더 값이 동일하여야 함 (예외: REGISTER)
■ ‘tag’ parameter: 반드시 포함. Globally unique value & 32bit 암호화
To
■ Request 메시지 수신자의 SIP-URI(AOR)
■ 반드시 tag 값을 포함하여야 함
Call-ID
■ Globally unique identifier
■ 동일 dialog 내에서는 모든 request, response 메시지에서 동일하여야 함
CSeq
■ sequence number와 method(request메시지)로 구성, CSeq : 1 INVITE
■ Dialog 내에서 Transaction의 식별 및 순서를 판단할때 사용
■ Request 당 +1씩 증가, 재전송의 경우에는 같은 값을 사용
Max-Forwards
■ 가능한 최대 hop 수를 나타냄 (70을 권장)
Via
■ Transport 정보를 포함(TCP/UCP, default port는 5060)
■ Response 메시지를 받아야 할 주소정보를 포함
■ 한 hop 거칠 때마다 추가
Contact
■ appears in INVITE / OPTIONS / ACK / REGISTER requests and in responses. It indicates direct response address
to which subsequent transactions are sent.
■ UA 주소, SIP URI/SIPS URI 로 표현됨
Context-Type/Content-Length
■ SIP Message Body에 들어가는 컨텐츠의 타입과 길이.
■ Application/sdp, application/xcap-diff+xml
BcN 본부 12
Message Header
Authorization
Expires
Record-Route
Require
Route
Supported
WWW-Authenticate
Accept
Alert-Info
Allow
Call-Info
Date
Priority
Proxy-Authenticate
Proxy-Authorization
Proxy-Require
Reply-To
…
BcN 본부 13
SIP Message Syntax - Request
BcN 본부 14
SIP Message Syntax - Response
BcN 본부 15
SDP (Session Description Protocol)
Session Description Protocol (RFC2327)
■ IETF MMUSIC(Multimedia Session Control) WG
■ Intended to describe session information of multimedia conference
■ Purely a format for session descroption
• Not intended to support negitiation of session
• Content or media encodings
■ Consists of a session-level description and optionally several media-level description
Offer/Answer Model (RFC3264)
■ Two Entity
■ Multimedia session negotiation
• Offer/Answer
• Using SDP
■ Two Model of SIP Offer/Answer
• INVITE (SDP Offer)200 OK(SDP Answer) ACK
• INVITE 200 OK (SDP Offer) ACK (SDP Answer)
BcN 본부 16
SDP (Session Description Protocol)
Session-Level Description
Media-Level Description
BcN 본부 17
SDP (Session Description Protocol)
BcN 본부 18
SIP Functional Layer
BcN 본부 19
Transactions
A SIP transaction consists of a single request and any responses to that request
Client Transaction (CT)
■ receiving a request from the Transaction User (TU) and deliver it to a ST
■ receiving responses and delivering them to the TU
Server Transaction (ST)
■ receiving requests from the transport layer and deliver them to the TU
■ accepting responses from the TU and delivering them to the transport layer for transmission
Request Request Request
CT ST CT ST CT ST
Response Response Response
UAC Outbound Inbound UAS
Proxy Proxy
transaction
BcN 본부 20
INVITE Client Transaction
State Machine
■ Calling, Proceeding, Completed, Terminated 로 구성
Timer A, B, D
■ timer A (T1) :
• estimated round-trip time, default 500ms
• Unreliable transport 시 2*T1, 4*T1, 8*T1, 16*T1, 32*T1, 64*T1 간격으로 재전송
■ timer B (64*T1)
• Reliable transport 시 timer B 적용 (timer A 적용하지 않음)
■ timer D : 32s (reliable transport), 0s (reliable transport)
Timer C (3분)
■ Proxy에서 INVITE에 대한 응답을 기다리는 총 시간, 초과되면 해당 트랜잭션 삭제
300-699
controls request ACK sent
retransmissions resp. to TU unreliable transports :
at least 32sec
Timer A fires 1xx reliable transports : 0
1xx to TU 300-699
Reset A,
ACK sent
INVITE sent
300-699
INVITE from TU 1xx ACK sent,
Timer D fires
INVITE sent 1xx to TU resp. to TU
Calling Proceeding Completed - Terminated
2xx 2xx Transport Err.
Timer B fires
2xx to TU 2xx to TU Inform TU
or Transport Err..
inform TU
controls transaction
timeouts
BcN 본부 21
Non-INVITE Client Transaction
State Machine
■ Trying, Proceeding, Completed, Terminate 로 구성
Timer E, F, K
■ Timer E
• unreliable transport 시 T1(500ms) 으로 설정
• 응답을 받지 못한 경우 처음에는 MIN(2*T1, T2), 그 다음부터는 MIN(4*T1, T2)로 설정
• T1이 500ms, T2가 4s 인 경우, 1s,2s,4s,4s, … 간격으로 재전송
■ Timer F
• 64*T1
controls request 200-699
retransmissions resp. to TU unreliable transports : T4
reliable transports : 0
Timer E Timer E
send request send req
Request from TU 1xx 200-699 Timer K
send request 1xx to TU resp. to TU -
Trying Proceeding Completed Terminated
Timer F 1xx
or Transport Err. resp to TU
inform TU
controls transaction Timer F
timeout or Transport Err.
inform TU
BcN 본부 22
INVITE Server Transaction
State Machine
■ Proceeding, Completed, Confirmed, Terminated 로 구성
Timer G, H, I
■ Timer G : unreliable transport(T1), reliable transport(0)
■ Timer H : all transport(64*T1)
■ Timer I : unreliable transport(T4), reliable transport(0)
unreliable transports: T4
INVITE INVITE
reliable transports : 0
send response send response
INVITE
pass INV to TU 300-699 from TU ACK Timer I fires
send 100 if TU send response - -
Proceeding Completed Confirmed Terminated
won’t in 200ms
2xx from TU Timer H fires
101-199 from TU send response or Transport Err.
Timer G fires
send response send response Inform TU
Transport Err.
Inform TU
determines retransmitting
controls response
timeout
retransmissions
BcN 본부 23
Non-INVITE Server Transaction
State Machine
■ Trying, Proceeding, Completed, Terminated 로 구성
Timer
■ Timer J : unreliable transport(64*T1), reliable transport(0)
200-699 from TU
send response
unreliable transports:
Request 64*T1
send response reliable transports : 0
Request received 1xx from TU 200-699 from TU Timer J
pass to TU send response send response fires
Trying Proceeding Completed Terminated
-
Request
1xx from TU Transport Err.
send response
send response Inform TU
Transport Err.
Inform TU
BcN 본부 24
Routing – Request 1
Destination 결정 우선 순위
1. Route 헤더 값 : route set 이용 (존재할 경우)
2. Request-URI
DNS query를 통해 IP주소, port, transport정보 획득
Route Set 결정 방식
■ Proxy를 거칠 때마다 해당 proxy가 자신의 URI를 Record-Route 헤더에 기록
■ Route Set은 dialog성립 시 결정 (또는 초기 default 값으로 결정)
UA1 P1 P2 P3 UA2
INVITE ua2@kt.com INVITE ua2@kt.com INVITE ua2@kt.com INVITE ua2@kt.com
From: ua1@kt.com From: ua1@kt.com From: ua1@kt.com From: ua1@kt.com
UA2 R oute S et
To: ua2@kt.com To: ua2@kt.com To: ua2@kt.com To: ua2@kt.com
(,
Contact: Record-Route: Record-Route: Record-Route:
,
, ,
}
Contact: ,
Contact:
Contact: r e mote Target URI
sip:ua1@11.0.0.1
BcN 본부 25
Routing – Request 2
UA1 P1 P2 P3 UA2
180 Ringing 180 Ringing 180 Ringing 180 Ringing
From: ua1@kt.com From: ua1@kt.com From: ua1@kt.com From: ua1@kt.com
UA1 R oute S et To: ua2@kt.com To: ua2@kt.com To: ua2@kt.com To: ua2@kt.com
(, Record-Route: Record-Route: Record-Route: Record-Route:
, , , , ,
} , , , ,
Contact: Contact: Contact: Contact:
r e mote Target URI
sip:ua2@11.0.0.1
UA1 P1 P2 P3 UA2
BYE ua1@11.0.0.1 BYE ua1@11.0.0.1 BYE ua1@11.0.0.1 BYE ua1@11.0.0.1
From: ua2@kt.com From: ua2@kt.com From: ua2@kt.com From: ua2@kt.com
UA2 R oute S et
To: ua1@kt.com To: ua1@kt.com To: ua1@kt.com To: ua1@kt.com
(,
Contact: Route: Route: Route:
,
, ,
}
Contact: ,
Contact:
Contact: r e mote Target URI
sip:ua1@11.0.0.1
BcN 본부 26
SIP Registration
BcN 본부 27
SIP Registration
BcN 본부 28
SIP Registration
BcN 본부 29
SIP Registration
BcN 본부 30
SIP Registration
BcN 본부 31
SIP Registration
BcN 본부 32
SIP Registration
BcN 본부 33
SIP Registration
BcN 본부 34
SIP Registration
BcN 본부 35
SIP Registration
BcN 본부 36
Session Establishment
BcN 본부 37
Session Establishment
BcN 본부 38
Session Establishment
BcN 본부 39
Session Establishment
BcN 본부 40
Session Establishment
BcN 본부 41
Session Establishment
BcN 본부 42
Session Establishment
BcN 본부 43
Session Establishment
BcN 본부 44
Session Establishment
BcN 본부 45
Session Establishment
BcN 본부 46
Session Establishment
BcN 본부 47
VoIP Issues
NAT Traversal
■ NAT: Full/Restricted/Port Restricted/Symmetric Cone
■ STUN, TURN, ICE
Emergence Call
■ Location acquisition
VoIP Spam
■ Low cost, easy implementation
■ Video call
SIP Transaction Timeout Problems
Security Problem
■ 도청(공유된 회선, 원격 PC해킹)
■ 서비스거부(자원고갈, SIP-CANCEL, SIP-BYE)
■ 서비스오용공격(Contact 등록주소 변조, Authorization Header SQL Injection)
■ 세션가로채기(Invite가로채기)
Non-Standard Skype
BcN 본부 48
Skype P2P Overlay Network
A peer-to-peer VoIP client developed by KaZaa in 2003.
Skype can:
■ Work almost seamlessly across NATs and Firewalls.
■ Has better voice quality than the MSN and Yahoo IM applications.
■ Encrypts calls ent-to-end, and stores user information in a decentralized fashion.
About 250 million
BcN 본부 49
주요 RFCs
R FC 2976 S IP INFO Method
R FC 3087 Control of Service Context using SIP Request-URI
R FC 3261 S IP: Session Initiation Protocol
R FC 3262 R eliability of Provisional Responses in the Session Initiation Protocol (SIP)
R FC 3263 Session Initiation Protocol (SIP): Locating SIP Servers
R FC 3264 A n Offer/Answer Model with the Session Description Protocol (SDP)
R FC 3265 Session Initiation Protocol (SIP)-Specific Event Notification
R FC 3311 T he Session Initiation Protocol (SIP) UPDATE Method
RFC 3312 Integration of Resource Management and Session Initiation Protocol (SIP)
RFC 3313 Private Session Initiation Protocol (SIP) Extensions for Media Authorization
RFC 3320 Signaling Compression (SigComp)
RFC 3321 Signaling Compression (SigComp) - Extended Operations
R FC 3323 A Privacy Mechanism for the Session Initiation Protocol (SIP)
R FC 3325 P rivate Extensions to the Session Initiation Protocol (SIP) for Asserted Identity within Trusted Networks
R FC 3326 T he Reason Header Field for the Session Initiation Protocol (SIP)
RFC 3327 Session Initiation Protocol (SIP) Extension Header Field for Registering Non-Adjacent Contacts
RFC 3329 Security Mechanism Agreement for the Session Initiation Protocol (SIP)
RFC 3351 Us er Requirements for the Session Initiation Protocol (SIP) in Support of Deaf, Hard of Hearing and Speech-impaired Individuals
R FC 3372 Session Initiation Protocol for Telephones (SIP-T): Context and Architectures
R FC 3398 I ntegrated Services Digital Network (ISDN) User Part (ISUP) to Session Initiation Protocol (SIP) Mapping
RFC 3420 Internet Media Type message/sipfrag
R FC 3428 Session Initiation Protocol (SIP) Extension for Instant Messaging
R FC 3455 P rivate Header (P-Header) Extensions to the Session Initiation Protocol (SIP) for the 3rd-Generation Partnership Project (3GPP)
RFC 3485 The Session Initiation Protocol (SIP) and Session Description Protocol (SDP) Static Dictionary for Signaling Compression (SigComp)
RFC 3486 Compressing the Session Initiation Protocol (SIP)
RFC 3487 Requirements for Resource Priority Mechanisms for the Session Initiation Protocol (SIP)
R FC 3515 T he Session Initiation Protocol (SIP) Refer Method
R FC 3578 Mapping of Integrated Services Digital Network (ISDN) User Part (ISUP) Overlap Signalling to the Session Initiation Protocol (SIP)
RFC 3581 An Extension to the Session Initiation Protocol (SIP) for Symmetric Response Routing
BcN 본부 50
주요 RFCs
R FC 3608 Session Initiation Protocol (SIP) Extension Header Field for Service Route Discovery During Registration
R FC 3665 Session Initiation Protocol (SIP) Basic Call Flow Examples
R FC 3666 Session Initiation Protocol (SIP) Public Switched Telephone Network (PSTN) Call Flows
R FC 3680 A Session Initiation Protocol (SIP) Event Package for Registrations
RFC 3702 Authentication, Authorization, and Accounting Requirements for the Session Initiation Protocol (SIP)
R FC 3725 Best Current Practices for Third Party Call Control (3pcc) in the Session Initiation Protocol (SIP)
RFC 3764 enum s ervice registration for Session Initiation Protocol (SIP) Addresses-of-Record
R FC 3824 Us ing E.164 numbers with the Session Initiation Protocol (SIP)
RFC 3840 Indicating User Agent Capabilities in the Session Initiation Protocol (SIP)
RFC 3841 Caller Preferences for the Session Initiation Protocol (SIP)
RFC 3842 A Message Summary and Message Waiting Indication Event Package for the Session Initiation Protocol (SIP)
RFC 3853 S/MIME Advanced Encryption Standard (AES) Requirement for the Session Initiation Protocol (SIP)
R FC 3856 A Presence Event Package for the Session Initiation Protocol (SIP)
RFC 3857 A W atcher Information Event Template-Package for the Session Initiation Protocol (SIP)
RFC 3862 Common Presence and Instant Messaging (CPIM): Message Format
RFC 3863 Presence Information Data Format (PIDF)
RFC 3891 The Session Initiation Protocol (SIP) "Replaces" Header
RFC 3892 The Session Initiation Protocol (SIP) Referred-By Mechanism
RFC 3903 Session Initiation Protocol (SIP) Extension for Event State Publication
RFC 3911 The Session Initiation Protocol (SIP) "Join" Header
R FC 3959 T he Early Session Disposition Type for the Session Initiation Protocol (SIP)
R FC 3960 Early Media and Ringing Tone Generation in the Session Initiation Protocol (SIP)
RFC 3968 The Internet Assigned Number Authority (IANA) Header Field Parameter Registry for the Session Initiation Protocol (SIP)
RFC 3969 The Internet Assigned Number Authority (IANA) Uniform Resource Identifier (URI) Parameter Registry for the Session Initiation Protocol (SIP)
RFC 3976 Interworking SIP and Intelligent Network (IN) Applications
R FC 3966 T he tel URI for Telephone Numbers
R FC 4028 Session Timers in the Session Initiation Protocol (SIP)
RFC 4032 Update to the Session Initiation Protocol (SIP) Preconditions Framework
RFC 4083 Input 3rd-Generation Partnership Project (3GPP) Release 5 Requirements on the Session Initiation Protocol (SIP)
BcN 본부 51
주요 RFCs
RFC 4092 Us age of the Session Description Protocol (SDP) Alternative Network Address Types (ANAT) Semantics in the Session Initiation Protocol (SIP)
RFC 4117 Transcoding Services Invocation in the Session Initiation Protocol (SIP) Using Third Party Call Control (3pcc)
RFC 4123 Session Initiation Protocol (SIP)-H.323 Interworking Requirements
RFC 4186 The Stream Control Transmission Protocol (SCTP) as a Transport for the Session Initiation Protocol (SIP)
R FC 4235 A n INV ITE-Initiated Dialog Event Package for the Session Initiation Protocol (SIP)
RFC 4244 An Extension to the Session Initiation Protocol (SIP) for Request History Information
R FC 4353 A Framework for Conferencing with the Session Initiation Protocol (SIP)
RFC 4354 A Session Initiation Protocol (SIP) Event Package and Data Format for Various Settings in Support for the Push-to-Talk over Cellular (PoC) Service
RFC 4457 The Session Initiation Protocol (SIP) P-User-Database Private-Header (P-Header)
RFC 4458 Session Initiation Protocol (SIP) URIs for Applications such as Voicemail and Interactive Voice Response (IV R)
BcN 본부 52