https://tools.ietf.org/html/rfc3261


http://lukiji.egloos.com/v/3208737


개인 정리용이므로

아래의 내용보다는 위의 출처의 글을 보는것이 

더 도움이 될 수 있다.

Method에 대해 결정이 되면

그 다음에는 Header 필드에 필요한 정보를 채워서 

호를 처리하게 된다. 

이하 호 처리에 사용되는 Header에 대해서 정리한다.


한줄은 최대 998글자를 사용할 수 있고 78자 사용하는 것을 권고한다. (RFC 2822 2.1.1)

길면 멀티라인으로 표현할 수 있다. (RFC 2822 2.2.3)

멀티라인으로 표현되는 Header는 연속되어 있어야 하고, 한개만 사용할 수 있는 Header들도 있어서 주의해야함


2.1.1. Line Length Limits


   There are two limits that this standard places on the number of

   characters in a line. Each line of characters MUST be no more than

   998 characters, and SHOULD be no more than 78 characters, excluding

   the CRLF.


...

2.2.3. Long Header Fields


   Each header field is logically a single line of characters comprising

   the field name, the colon, and the field body.  For convenience

   however, and to deal with the 998/78 character limitations per line,

   the field body portion of a header field can be split into a multiple

   line representation; this is called "folding".  The general rule is

   that wherever this standard allows for folding white space (not

   simply WSP characters), a CRLF may be inserted before any WSP.  For

   example, the header field:


           Subject: This is a test


   can be represented as:


           Subject: This

            is a test

...



사용하는 해더 필드에서 각 열에 있는 정보에 대한 설명 "where", "proxy", "각 method" 3가지 영역

 

where 열

- R : Request만 사용

- r : Response만 사용

- 2xx, 4xx, etc : 지정된 Response Code만 사용

- c : Request Message 값을 COPY해서 Response에 사용

- 표시 없음: Request, Response 모두 사용


proxy 열

- a : Proxy에서 해더필드 정보를 ADD, CONCATENATE 할수 있음

- m : Proxy에서 해더필드 정보를 MODIFY 할 수 있음

- d : Proxy에서 헤더필드 정보를 DELETE 할 수 있음

- r : Proxy에서 헤더필드 정보를 READ 할 수 있음 (cannot be encrypted)


각 method 열

- c : Conditional 하게 메시지에 따라 조절

- m : Mandatory 필수

- m* : SHOULD be sent, Client, Server 모두 Message에 이 Header가 없어도 처리함

- o : Optional 있어도되고 없어도되고

- t : TCP같은 Stream-based Protocol을 사용하면 MUST 사용

* : SIP Message Body가 있으면 필요함

- : 적용 불가 해더 (사용하지 말라)




해더 정보

Example:


      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Accept                  R            -   o   -   o   m*  o

      Accept                 2xx           -   -   -   o   m*  o

      Accept                 415           -   c   -   c   c   c

      Accept-Encoding         R            -   o   -   o   o   o

      Accept-Encoding        2xx           -   -   -   o   m*  o

      Accept-Encoding        415           -   c   -   c   c   c

      Accept-Language         R            -   o   -   o   o   o

      Accept-Language        2xx           -   -   -   o   m*  o

      Accept-Language        415           -   c   -   c   c   c

      Alert-Info              R      ar    -   -   -   o   -   -

      Alert-Info             180     ar    -   -   -   o   -   -

      Allow                   R            -   o   -   o   o   o

      Allow                  2xx           -   o   -   m*  m*  o

      Allow                   r            -   o   -   o   o   o

      Allow                  405           -   m   -   m   m   m

      Authentication-Info    2xx           -   o   -   o   o   o

      Authorization           R            o   o   o   o   o   o

      Call-ID                 c       r    m   m   m   m   m   m

      Call-Info                      ar    -   -   -   o   o   o

      Contact                 R            o   -   -   m   o   o

      Contact                1xx           -   -   -   o   -   -

      Contact                2xx           -   -   -   m   o   o

      Contact                3xx      d    -   o   -   o   o   o

      Contact                485           -   o   -   o   o   o

      Content-Disposition                  o   o   -   o   o   o

      Content-Encoding                     o   o   -   o   o   o

      Content-Language                     o   o   -   o   o   o

      Content-Length                 ar    t   t   t   t   t   t

      Content-Type                         *   *   -   *   *   *

      CSeq                    c       r    m   m   m   m   m   m

      Date                            a    o   o   o   o   o   o

      Error-Info           300-699    a    -   o   o   o   o   o

      Expires                              -   -   -   o   -   o

      From                    c       r    m   m   m   m   m   m

      In-Reply-To             R            -   -   -   o   -   -

      Max-Forwards            R      amr   m   m   m   m   m   m

      Min-Expires            423           -   -   -   -   -   m

      MIME-Version                         o   o   -   o   o   o

      Organization                   ar    -   -   -   o   o   o


             Table 2: Summary of header fields, A--O




   Header field              where       proxy ACK BYE CAN INV OPT REG

   ___________________________________________________________________

   Priority                    R          ar    -   -   -   o   -   -

   Proxy-Authenticate         407         ar    -   m   -   m   m   m

   Proxy-Authenticate         401         ar    -   o   o   o   o   o

   Proxy-Authorization         R          dr    o   o   -   o   o   o

   Proxy-Require               R          ar    -   o   -   o   o   o

   Record-Route                R          ar    o   o   o   o   o   -

   Record-Route             2xx,18x       mr    -   o   o   o   o   -

   Reply-To                                     -   -   -   o   -   -

   Require                                ar    -   c   -   c   c   c

   Retry-After          404,413,480,486         -   o   o   o   o   o

                            500,503             -   o   o   o   o   o

                            600,603             -   o   o   o   o   o

   Route                       R          adr   c   c   c   c   c   c

   Server                      r                -   o   o   o   o   o

   Subject                     R                -   -   -   o   -   -

   Supported                   R                -   o   o   m*  o   o

   Supported                  2xx               -   o   o   m*  m*  o

   Timestamp                                    o   o   o   o   o   o

   To                        c(1)          r    m   m   m   m   m   m

   Unsupported                420               -   m   -   m   m   m

   User-Agent                                   o   o   o   o   o   o

   Via                         R          amr   m   m   m   m   m   m

   Via                        rc          dr    m   m   m   m   m   m

   Warning                     r                -   o   o   o   o   o

   WWW-Authenticate           401         ar    -   m   -   m   m   m

   WWW-Authenticate           407         ar    -   o   -   o   o   o


   Table 3: Summary of header fields, P--Z; (1): copied with possible

   addition of tag




상세 정보는 여기부터 시작함

다시한번 출처는 : http://lukiji.egloos.com/v/3208737

아래는 그분의 도움을 이어받아서 작성함


== Accept == 

Accept 할 수 있는 Body Type 정보

Accept Header가 존재 하지 않는다면 UAS는 Default값인 "application/sdp"를 Accept한다고 판단

Accept 해더 필드가 empty라면 수락할 수있는 format이 없음

(An empty Accept header field means that no formats are acceptable.)


      Header field          where   proxy ACK BYE CAN INV OPT REG

      ____________________________________________________________________________

      Accept                  R                          -     o      -     o     m*  o

      Accept                 2xx                        -     -      -     o     m*  o

      Accept                 415                        -     c      -    c     c     c


ex = "Accept : application/sdp, text/plain"


Accept       = "Accept" ":" #( media-range [ accept-params ] )

media-range      = ( "*/*" | ( type "/" "*" ) | ( type "/" subtype ) )

                        *( ";" parameter )

parameter     = attribute "=" value

attribute     = token

value         = token | quoted-string

accept-params    = ";" "q" "=" qvalue *( accept-extension )

accept-extension = ";" token [ "=" ( token | quoted-string ) ]

qvalue         = ( "0" [ "." 0*3DIGIT ] ) | ( "1" [ "." 0*3("0") ] )





== Accept-Encoding Header == 

받아 들일 수 있는 Body의 Encoding Type



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Accept-Encoding         R               -       o      -    o      o     o

      Accept-Encoding        2xx             -       -      -    o      m*   o

      Accept-Encoding        415              -       c     -    c      c      c


ex = "Accept-Encoding : gzip"


Accept-Encoding  = "Accept-Encoding" ":" #( content-coding )

content-coding   = token





== Accept-Language Header ==

받아들일 수 있는 Reason phrases, Session Descriptions(SDP), Response의 Body등의 Language.

Header가 없다면 UAS는 UAC에서 모든 Language들을 받아 들일 수 있는 것으로 판단



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Accept-Language        R               -       o      -    o      o     o

      Accept-Language       2xx             -       -      -    o      m*   o

      Accept-Language       415              -       c     -    c      c      c


ex = "Accept-Language : da, en-gb;q-0.8"


Accept-Language = "Accept-Language" ":" 1#( language-range [ ";" "q" "=" qvalue ] )

language-range  = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )




== Alert-Info Header ==

INVITE에 있으면 UAS에서 Ring에, 180 Response에 있으면 UAC에서 Ring back tone에 사용할 음원정보를 표현



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Alert-Info              R           ar         -      -      -     o     -     -

      Alert-Info             180        ar         -       -     -      o     -     -


ex = "Alert-Info : <http://www.example.com/sounds/moo.wav>"


Alert-Info     =  "Alert-Info" ":" # ( "<" URI ">" *( ";" generic-param ))

generic-param  =  token [ "=" ( token | host | quoted-string ) ]




== Allow Header ==

UA가 받아 들일 수 있고, 처리할 수 있는 Method의 List를 표현

다른 SIP Element들과 통신 할 경우 처리가 불가능한 Method는 보내지 않도록 하는 예외처리 할 때 사용

예를 들어 Session-Timer를 사용하려고 할 때, UPDATE가 Allow Header에 없다면 Re-INVITE를 사용하고, UPDATE가 있다면, UPDATE를 사용하여 Session Refresh를 할 수 있도록 한다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Allow                    R                       -      o      -    o     o      o

      Allow                   2xx                     -      o      -    m*   m*   o

      Allow                    r                       -      o      -    o     o      o

      Allow                   405                   -      m     -    m    m    m


ex = "Allow : INVITE, ACK, CANCEL, BYE"


Allow  =  "Allow" ":" 1#Method

Method            =  "INVITE" | "ACK" | "OPTIONS" | "BYE"

                          | "CANCEL" | "REGISTER" | extension-method




== Authentication-Info Header ==

HTTP Digest로 상호인증을 할 때 사용된다. 

UAS에서 Request의 Authorization Header field 값을 기본으로 

Digest 인증에 성공한다면 2xx Response때 이 Header Field를 넣어야 한다. 



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

 Authentication-Info      2xx                 -      o      -     o     o     o


ex = "Authentication-Info : nextnonce="468761df3s4df54sd51f351"


Authentication-Info = "Authentication-Info" HCOLON ainfo *(COMMA ainfo) 

ainfo = nextnonce / message-qop / response-auth / cnonce / nonce-count  

nextnonce = "nextnonce" EQUAL nonce-value  

response-auth = "rspauth" EQUAL response-digest  

response-digest = LDQUOT *LHEX RDQUOT 





== Authorization Header ==


UA의 인증처리를 위한 정보를 가진다.

멀티라인 규칙을 지키지 않는다. 한줄로 합치지 않는다.


----------------------------  Header  사용 정보 -------------------------

      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

     Authorization           R                   o      o      o     o     o    o


ex = Authorization: Digest username="Alice", realm="atlanta.com",

       nonce="84a4cc6f3082121f32b42a2187831a9e",

       response="7587245234b3434cc3412213e5f113a5432


Authorization    =  "Authorization" ":" "pgp" # pgp-response

pgp-response     =  realm | pgp-version | pgp-signature | signed-by | nonce

realm        =  "realm" "=" realm-value

realm-value      =  quoted-string

pgp-signature    =  "signature" "=" quoted-string

signed-by        =  "signed-by" "=" <"> URI <">




== Call-ID Header ==

Call 식별자

이 값으로 Dialog구분, Unique한 값 사용

하지만 이값이 항상 Unique하다는 것은 아니다. 

그래서 Dialog나 Transaction을 찾을 때는, 이 값 이외에 

Via branch, To/From Value와 Tag, CSeq 등도 같이 사용하여 찾는다.


      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

     Call-ID                     c          r      m      m    m    m    m    m


ex = "Call-ID: f81d4fae-7dec-11d0-a765-00a0c91e6bf6@biloxi.com

      i:f81d4fae-7dec-11d0-a765-00a0c91e6bf6@192.0.2.4"


Call-ID = ( "Call-ID" / "i" ) HCOLON callid

callid = word [ "@" word ]





== Call-Info Header ==

Call-Info Header는 Caller나 Callee에 대한 추가적인 정보를 제공하기 위해 사용


      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

    Call-Info                               ar       -      -       -    o     o     o


ex = "Call-Info: <http://example.com/alice/photo.jpg>;purpose=icon,<http://example.com/alice/>;purpose=info"


Call-Info   =  "Call-Info" ":" # ( "<" URI ">" *( ";" info-param) )

info-param  =  "purpose" "=" ( "icon" | "info" | "card" | token ) |   generic-param




== Contact Header ==

Contact Header는 호를 위한 여러가지 정보를 가진다.

 - 호가 성립된 이후 자신이 받아 들일 수 있는 접속정보 (INVITE 등)

 - 레지 상태가 만료 되기까지 유지되는 시간 정보 (REGISTER)

 - 자신이 지원하는 미디어 정보 (REGISTER, INVITE 등)


호가 성립될 때 각각의 UA는 자신의 접속정보를 Contact Header에 보내야 하며, 

성립된 이후에는 각각의 UA는 상대방의 접속정보인 Contact Header Field값의 정보를 기억해야 한다.

하지만 망마다, 또는 단말 마다 아래 Header사용정보대로 지키지 않는 곳들이 있기 때문에(Contact Header가 없으면 Fail을 주는 곳이 있다.) 망에 맞추어 사용해야 된다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Contact                 R                     o     -      -     m     o    o

      Contact                 1xx                   -     -      -     o      -    -

      Contact                 2xx                  -     -      -     m     o    o

      Contact                 3xx        d        -     o      -     o      o    o

      Contact                 485                 -     o      -     o      o    o


ex = "Contact: "Mr. Watson" <sip:watson@worcester.bell-telephone.com>

         ;q=0.7; expires=3600,

         "Mr. Watson" <mailto:watson@bell-telephone.com> ;q=0.1

      m: <sips:bob@192.0.2.4>;expires=60"


Contact           = ( "Contact" | "m" ) ":"

                    ("*" | (1# (( name-addr | addr-spec )

                    *( ";" contact-params ) )))


name-addr         = [ display-name ] "<" addr-spec ">"

addr-spec         = SIP-URL | URI

display-name      = *token | quoted-string

contact-params    = "q" "=" qvalue | "action" "=" "proxy" | "redirect" | "expires" "=" delta-seconds | <"> SIP-date <"> |  contact-extension


qvalue            = ( "0" [ "." 0*3DIGIT ] ) | ( "1" [ "." 0*3("0") ] )

contact-extension = generic-param

generic-param     = token [ "=" ( token | host | quoted-string ) ]




== Content-Disposition Header ==

Message Body를 UA, US가 어떻게 해석할지에 대한 방법을 설명한 필드

예를 들어 "session"이라는 Type값이 있다면, Body가 Session용 이다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Content-Disposition                      o     o     -       o    o     o


ex = "Content-Disposition : session"


Content-Disposition   =  "Content-Disposition" ":" disposition-type *( ";" disposition-param )

disposition-type      =  "render" | "session" | "icon" | "alert" | disp-extension-token

disposition-param     =  "handling" "=" ( "optional" | "required" | other-handling ) |   generic-param

other-handling        =  token

disp-extension-token  =  token




== Content-Encoding Header ==

Content-Encoding Header는 Body의 압축 인코딩 방식 설명

일반적인 호의 Body는 망에서는 최대 500~600 Byte를 넘지 않고, 비압축 하여 사용되기 때문에 미사용

MMS나 이미지같이 큰 데이터를 압축해서 전송할 때 사용



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Content-Encoding                        o      o     -     o     o     o


ex = "Content-Encoding : gzip"

Content-Encoding  =  ( "Content-Encoding" | "e" ) ":" 1#content-coding

content-coding   = token




== Content-Language Header ==

권고안에서는 H14.12절을 보라고만 되어있는데

body의 content를 구성하는 언어에 대한 설명으로 보인다.


----------------------------  Header  사용 정보 -------------------------

      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Content-Language                       o     o       -     o     o     o


ex = "Content-Language : fr"


Content-Language  = "Content-Language" ":" 1#language-tag

language-tag  = primary-tag *( "-" subtag )

primary-tag   = 1*8ALPHA

subtag        = 1*8ALPHA



== Content-Length Header ==

Content-Length Header는 Message Body의 길이

주의점은 이 Header는 TCP같은 Stream-base Protocol 에서는 반드시 필요

UDP같은 Protocol에서는 Body가 없을 때는 이 Header가 메시지에 없어도 됨



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Content-Length                  ar       t       t      t      t      t      t


ex = "Content-Length : 341"

Content-Length  =  ( "Content-Length" | "l" ) ":" 1*DIGIT




== Content-Type Header ==

Content-Type Header는 Body Type

Body가 있으면 반드시 Message 안에 있어야하고, Body가 없다면 없어도 무방



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Content-Type                               *     *     -     *      *     *


ex = "Content-Type: application/sdp"


Content-Type  =  ( "Content-Type" | "c" ) ":" media-type

media-type    = type "/" subtype *( ";" parameter )

type          = token

subtype       = token

parameter     = attribute "=" value

attribute     = token

value         = token | quoted-string



== CSeq Header ==

현재 메시지의 Sequence Number와 Method의 정보

이 값을 이용하여 Transaction과 Dialog를 판별하며, 

루핑같이 뒤늦게 들어오는 Message를 Discard하는 등의 용도로 사용



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      CSeq                       c         r      m     m     m     m   m   m


ex = "CSeq: 1290481 INVITE"


CSeq     =  "CSeq" ":" 1*DIGIT Method




== Date Header ==

Date Header는 가장 처음 request or response 전송한 시간 

그래서 retransimssions(재전송) 할 때 Date 해더 필드를 보면 original 메시지와 값이 같다.


      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Date                                   a      o       o     o     o     o     o


ex = "Date: Sat, 13 Nov 2010 23:29:00 GMT" 

Date      =  "Date" ":" SIP-date

SIP-date  =  rfc1123-date

* RFC 1123 

5.2.14  RFC-822 Date and Time Specification: RFC-822 Section 5

              The syntax for the date is hereby changed to:

               date = 1*2DIGIT month 2*4DIGIT


* RFC 822

date-time   =  [ day "," ] date time 

day         =  "Mon"  / "Tue" /  "Wed"  / "Thu" /  "Fri"  / "Sat" /  "Sun"

date        =  1*2DIGIT month 2DIGIT

month       =  "Jan"  /  "Feb" /  "Mar"  /  "Apr"

                                /  "May"  /  "Jun" /  "Jul"  /  "Aug"

                 /  "Sep"  /  "Oct" /  "Nov"  /  "Dec"

time        =  hour zone                    ; ANSI and Military

hour        =  2DIGIT ":" 2DIGIT [":" 2DIGIT]   ; 00:00:00 - 23:59:59

zone        =  "UT"  / "GMT" / "EST"/ "EDT" / "CST"/"CDT" /"MST"/ "MDT" / "PST"/ "PDT"/ 1ALPHA 

                           / ( ("+" / "-") 4DIGIT ) 




== Error-Info Header ==

Error-Info Header는 error status response의 추가적인 정보를 표현하기 위하여 정의

하지만, 망에서는 Reason 해더를 주로 사용



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Error-Info           300-699      a       -      o      o    o      o     o


ex = "Error-Info: <sip:not-in-service-recording@atlanta.com"


Error-Info  =  "Error-Info" ":" # ( "<" URI ">" *( ";" generic-param ))

generic-param     = token [ "=" ( token | host | quoted-string ) ]\




== Expires Header ==

Message가 Expires 되는 시간이고 단위는 sec

범위는 0 ~ 4294967295 (2^32 -1) 

최대 136.19년



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Expires                                       -      -     -     o      -     o


ex = "Expires : 60"


Expires  =  "Expires" ":" ( SIP-date | delta-seconds )


 


== From Header ==

Message의 발송자

Caller, Callee를 의미 하는 것이 아닌 

현재 메시지의 Request를 생성 및 발송한 UA를 표현 

호의 Initial 메시지와 그 이후 Subsequent 메시지에서 From의 값이 다를 수 있다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      From                      c           r       m     m    m    m    m    m


ex="From: "A. G. Bell" <sip:agb@bell-telephone.com> ;tag=a48s

      From: sip:+12125551212@server.phone2net.com;tag=887s

      f: Anonymous <sip:c8oqz84zk7z@privacy.org>;tag=hyh8"


From        =  ( "From" | "f" ) ":" ( name-addr | addr-spec ) * ( ";" from-param )

from-param  =  tag-param | generic-param

tag-param   =  "tag" "=" token



== In-Reply-To Header ==

이 Header를 이용하여 여러 개의 Call-ID값을 Cache하고, 이 값으로 Call을 Filtering한다고는 한다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

     In-Reply-To              R                  -     -      -     o     -     -


ex = "In-Reply-To: 70710@saturn.bell-tel.com, 17320@saturn.bell-tel.com"

In-Reply-To  =  "In-Reply-To" ":" 1# callid




== Max-Forwards Header ==

SIP Message가 최대 Forward되는 횟수

이 값을 이용하여 Looping을 방지하는데 사용되는데 

각 Server는 Forward 할 때 마다 값을 확인하고, 1씩 감소한 값으로 변경

값의 범위는 0 ~ 255이고, 추천하는 시작 값은 70


      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

     Max-Forwards            R      amr    m    m     m    m   m     m

 

ex = "Max-Forwards : 70"


Max-Forwards : "Max-Forwards" HCOLON 1*DIGIT




== Min-Expires Header ==

Refresh Interval의 최소 값

423 응답 코드는 (Interval Too Brief)


      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

     Min-Expires            423                 -      -     -      -     -    m



ex = "Min-Expires : 70"

Min-Expires : "Min-Expires" HCOLON 1*DIGIT




== MIME-Version Header ==

권고안에서는 H19.4.1절을 보라

MIME-Version Header는 Message의 MIME-formatted를 표현



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

     MIME-Version                              o      o      -    o     o     o


ex = "MIME-Version : 1.0"


MIME-Version = "MIME-Version" HCOLON 1*DIGIT "." 1*DIGIT



== Organization Header ==

일반적으로 개발한 사람/조직의 정보 사용



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Organization                      ar       -      -      -     o     o    o


ex = "Organization: Boxes by Bob"

Organization : "Organization" HCOLON [TEXT-UTF8-TRIM]




== Priority Header ==

SIP Message의 우선순위를 두어 긴급한 메시지 처리에 사용



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

      Priority                    R          ar     -      -      -     o     -    -


ex 

      Subject: A tornado is heading our way!

      Priority: emergency

   or

      Subject: Weekend plans

      Priority: non-urgent


Priority = "Priority" HCOLON priority-value

priority-value = "emergency" / "urgent" / "nomal" / "non-urgent" / other-priority

other-pritority = token




== Proxy-Authenticate Header ==

인증처리를 하는 Proxy를 위하여 사용

Proxy-Authorization Header와 같이 사용



      Header field          where   proxy ACK BYE CAN INV OPT REG

      ___________________________________________________________

     Proxy-Authenticate    407      ar      -     m     -      m   m    m

     Proxy-Authenticate    401      ar      -      o     o      o    o     o


ex = "Proxy-Authenticate: Digest realm="atlanta.com",

       domain="sip:ss1.carrier.com", qop="auth",

       nonce="f84f1cec41e6cbe5aea9c8e88d359",

       opaque="", stale=FALSE, algorithm=MD5"


Proxy-Authenticate = "Proxy-Authenticate" HCOLON challenge   

challenge = ("Digest" LWS digest-cln *(COMMA digest-cln)) / other-challenge  

other-challenge = auth-scheme / auth-param *(COMMA auth-param)  

digest-cln = realm / domain / nonce / opaque / stale / algorithm  / qop-options / auth-param  

realm = "realm" EQUAL realm-value  

realm-value = quoted-string  

domain = "domain" EQUAL LDQUOT URI *( 1*SP URI ) RDQUOT  

URI = absoluteURI / abs-path  

opaque = "opaque" EQUAL quoted-string  

stale = "stale" EQUAL ( "true" / "false" )  

qop-options = "qop" EQUAL LDQUOT qop-value *("," qop-value) RDQUOT  

qop-value = "auth" / "auth-int" / token 





== Proxy-Authorization Header ==

Proxy에서 인증을 요구 하는경우 Client에서 생성하여 전달

인증에 관련된 정보가 이 Header에 값으로 사용된다.


      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

    Proxy-Authorization    R        dr       o      o      -    o     o    o



ex = "Proxy-Authorization: Digest username="Alice", realm="atlanta.com",

        nonce="c60f3082ee1212b402a21831ae",

        response="245f23415f11432b3434341c022"


Proxy-Authorization  =  "Proxy-Authorization" HCOLON credentials

credentials       =  ("Digest" LWS digest-response)  / other-response

digest-response   =  dig-resp *(COMMA dig-resp)

dig-resp          =  username / realm / nonce / digest-uri  / dresponse / algorithm / cnonce

                                                  / opaque / message-qop  / nonce-count / auth-param


username          =  "username" EQUAL username-value

username-value    =  quoted-string

digest-uri        =  "uri" EQUAL LDQUOT digest-uri-value RDQUOT

digest-uri-value  =  rquest-uri ; Equal to request-uri as specified by HTTP/1.1

message-qop       =  "qop" EQUAL qop-value

cnonce            =  "cnonce" EQUAL cnonce-value

cnonce-value      =  nonce-value

nonce-count       =  "nc" EQUAL nc-value

nc-value          =  8LHEX

dresponse         =  "response" EQUAL request-digest

request-digest    =  LDQUOT 32LHEX RDQUOT

auth-param        =  auth-param-name EQUAL  ( token / quoted-string )

auth-param-name   =  token

other-response    =  auth-scheme LWS auth-param *(COMMA auth-param)

auth-scheme       =  token





== Proxy-Require Header ==

Proxy가 지원하고 사용하고자 하는 기능


      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

    Proxy-Require            R         ar      -     o     -      o     o    o


ex = "Proxy-Require : foo"


Proxy-Require = "Proxy-Require" HCOLON option-tag * (COMMA option-tag)





== Record-Route Header ==

Record-Route Header는 Routing 정보를 UA에게 알려주기 위하여 사용


Bob                       A (Proxy)                  B (Proxy)                  Allice


         ---- INVITE --->

                                    ----- INVITE  ---->

                                    (Record-Route :  A )

                                                                   ----- INVITE  ---->

                                                                  (Record-Route :  A, B )

                                                                   <---- 200 Ok  -----

                                                                  (Record-Route :  A, B )

                                    <---- 200 Ok  -----

                                    (Record-Route :  A, B )

          <---- 200 Ok  -----

          (Record-Route :  A, B )


이 때 주의 할 점은 

UAS(Allice)는 Recored-Route의 값의 순서대로 이 Header값을 기억

UAC(Bob)은 역순으로 이 Header값을 기억해야 함

그리고, ACK나 CANCEL Request Message는 

Proxy에서 이 값과 관계없이 Down Stream을 기억하고 같은 곳으로 전달 해야 한다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

   Record-Route            R          ar       o      o     o      o    o     -

   Record-Route         2xx,18x    mr      -      o     o     o     o     -


ex = "Record-Route: <sip:server10.biloxi.com;lr>,<sip:bigbox3.site3.atlanta.com;lr>"


Record-Route = "Record-Route" HCOLON rec-route * (COMMA rec-route)

rec-route = name-addr * (SEMI rr-param)

rr-param = generic-param


 


== Reply-To Header ==

From Header와 다른 URI값을 가지고

이 Header의 값을 이용하여 다른 URI정보를 넘기는데 사용

망에서 가끔 발신자 정보를 변경하기 위하여 사용



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

   Reply-To                                        -     -      -     o     -     -


ex = "Reply-To: Bob <sip:bob@biloxi.com>"


Reply-To = "Reply-To" HCOLON rplyto-spec

rplyto-sepc = (name-addr / addr-spec) * (SEMI rplyto-param)

rplyto-param = generic-param

 



== Require Header ==

Require Header는 UAC와 UAS간에 사용하고자 하는 기능을 option-tag를 이용하여 사용

이 때, 지원하지 않는 기능을 요구하면 Fail Response를 수신

따라서 Supported로 지원되는 기능을 UAC에서 UAS에게 전달하여, 기능을 사용하거나 

OPTIONS 메쏘드를 이용하여 미리 지원되는 기능을 판단후에 Request Header에 사용


대표적은 예로 PRACK 사용하고자 하는 100rel option-tag다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

   Require                                 ar      -      c      -     c     c    c


ex = "Require : 100rel"


Require = "Require" HCOLON option-tag * (COMMMA option-tag)

option-tag = token




== Retry-After Header ==

UAS에 요청한 Message에 대해서 UAS에서 일정시간후 재 시도 하라는 정보를 알려줄 때 사용

SIP Protocol의 주는 호연결 이고, 주체는 사람이므로,  거의 사용 안함



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

       Retry-After      404,413,480,            -     o     o     o    o      o

       Retry-After      486,500,503             -     o     o     o    o      o

       Retry-After      600,603                   -     o     o     o   o      o


ex = "Retry-After: 18000;duration=3600

         Retry-After: 120 (I'm in a meeting)"


Retry-After = "Retry-After" HCOLON delta-seconds [comment] * (SEMI retry-param)

retry-param = ("duration" EQUAL delta-seconds) / generic-param




== Route Header ==

Request Message가 가야할 Routing정보

이 정보와 Request-URI값을 이용하여 Proxy가 Next Hop을 결정하여 Message를 전달

Message를 전달 할때는 자신의 정보를 삭제하고 전달 해야 한다. 

이때 이해해야 할 부분이 Strict-Routing과 Loose-Routing



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

       Route                      R       adr     c      c      c    c     c     c



ex = "Route: <sip:bigbox3.site3.atlanta.com;lr>,

             <sip:server10.biloxi.com;lr>"


Route = "Route" HCOLON route-param * (COMMA route-param)

route-param = naem-addr * (SEMI rr-param)




== Server Header ==

UAS의 software의 정보


      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

      Server                      r                  -      o     o     o     o     o


ex = "Server : HomeServer v2"


Server = "Server" HCOLON server-val * (LWS server-val)

server-val = product / comment

product = token [SLASH product-version]

product-version = token

 


== Subject Header ==

호의 요약 정보를 나타냄

망에서 이 Header를 특별한 의미로 사용하는 것은 아직 본적이 없다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

      Subject                    R                 -      -      -     o     -    -


ex = "Subject: Need more boxes

        s: Tech Support"


Subject = ( "Subject" / "s" ) HCOLON [TEXT-UTF8-TRIM]




== Supported Header ==

UAC, UAS에서 지원하는 추가 기능을 다른 단말에 알려주려고 사용


      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

     Supported                 R                  -     o     o     m*   o     o

     Supported                2xx                -     o     o     m*   m*   o


ex = "Supported : 100rel"


Supported = ("Supported" / "k") HCOLON [option-tag * (COMMA option-tag)]




== Timestamp Header ==

UAC가 UAS에게 Request보낸 시점



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

     Timestamp                                    o     o      o    o     o      o     

 


ex = "Timestamp: 54"


Timestamp = "Timestamp" HCOLON 1*(DIGIT) ["." *(DIGITI)] [LWS delay]

delay = *(DIGIT) ["." *(DIGITI]

 


== To Header ==

UAS 정보를 나타냄

형태는 From Header와 동일 하다. 

다른 점은 From Header는 UAC에서 tag를 생성하여 전달 하지만, To Header의 tag는 UAS에서 추가

이 tag값은 호가 종료되는 시점까지 변경되지 않는다.



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

     To                         c(1)        r       m    m     m    m    m    m


ex: "To: The Operator <sip:operator@cs.columbia.edu>;tag=287447

        t: sip:+12125551212@server.phone2net.com"


To        =  ( "To" | "t" ) ":" ( name-addr | addr-spec ) *( ";" to-param )

to-param  =  tag-param | generic-param




== Unsupported Header ==

지원되지 않는 기능을 UAC에서 요구할 때 UAS에서 이를 알려주기 위해 사용된

지원하지 않는 기능을 Require Header를 이용하여 UAC에서 사용하자고 알려온다면, 

UAS는 Fail Response에 Unsupported Header에 지원하지 않는 기능들을 알려줄 수 있음

420 (Bad Extension)


      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

     Unsupported            420                 -     m    -     m    m    m


ex = "Unsupported: 100rel"


Unsupported = "Unsupported" HCOLON option-tag *(COMMA option-tag)



== User-Agent Header ==

요청을 생성한 UAC의 정보


      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

     User-Agent                                   o     o     o     o     o     o


ex = "User-Agent: Softphone Beta 1.5"


User-Agent = "User-Agent" HCOLN server-val *(LWS server-val)



== Via Header ==

Request 메시지가 거처간 SIP Element의 정보를 가지며, 

이 값을 사용하여 Response가 Routing될 정보로 사용


추가적으로 Transaction을 판단하는데 이 Header의 Branch Tag가 사용되며, 

그 외에도 여러 용도로 사용되는 중요 Header중에 하나이다. 

중요한 점은 Brach의 값이 magic cookie "z9hG4bK"로 시작해야 한다. 



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

      Via                         R        amr    m    m     m    m    m   m

       Via                        rc        dr      m    m     m    m    m   m



ex = "Via: SIP/2.0/UDP JS.SONG.proxy.com;brach=z9hG4bKa7c6a8dlze

   Via: SIP / 2.0 / UDP first.example.com: 4000;ttl=16;maddr=224.2.0.1 ;branch=z9hG4bKa7c6a8dlze.1"


Via          =   ( "Via" | "v" ) ":" 1#( sent-protocol sent-by *( ";" via-params ) [comment] )

sent-protocol    =   protocol-name "/" protocol-version "/" transport

protocol-name    =   "SIP" | token

protocol-version =   token

transport        =   "UDP" | "TCP" | token

sent-by      =   ( host [":" port] ) | ( concealed-host )

concealed-host   =   token

via-params       =   via-hidden | via-ttl | via-maddr | via-received | via-branch | via-extension

via-hidden       =   "hidden"

via-ttl      =   "ttl" "=" ttl

via-maddr        =   "maddr" "=" maddr

via-received     =   "received" "=" host

via-branch       =   "branch" "=" token

via-extension    =   generic-param

generic-param    =   token ["=" ( token | quoted-string )]

comment      =   "(" *( ctext | quoted-pair | comment ) ")"

quoted-pair      =   " \ " CHAR




== Warning Header ==

Response의 추가적인 정보를 제공


      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

     Warning                     r                  -     o      o     o     o     o


ex = Warning : 301 isi.edu "Incompatible network address type 'E.164'"


Warning = "Warning" HCOLON warning-value *(COMMA warning-value)

warning-value = warn-code SP warn-agent SP warn-text  

warn-code = 3DIGIT  

warn-agent = hostport / pseudonym  

warn-text = quoted-string  

pseudonym = token 




== WWW-Authenticate Header ==

인증관련된 정보를 표현



      Header field          where   proxy ACK BYE CAN INV OPT REG

      __________________________________________________________

   WWW-Authenticate      401       ar      -     m     -     m    m    m

   WWW-Authenticate      407       ar      -     o      -     o     o     o


 ex = "WWW-Authenticate: Digest realm="atlanta.example.com", 

                            qop="auth", nonce="84f1c1ae6cbe5ua9c8e88dfa3ecm3459", opaque="", 

                            stale=FALSE, algorithm=MD5 "


WWW-Authenticate = "WWW-Authenticate" HCOLON challenge  



http://lukiji.egloos.com/v/3208737

이분께서 현업을 토대로 작성해주셔서 도움이 많이 되었다.








반응형

조도센서로 값을 잘 받아온다.


https://github.com/pimylifeup/Light_Sensor에서 받아온 코드를 기반으로

내가 필요한 기능들을 추가한다.

참고로 redis에 대한 설정은 구글링하면 금방 찾아볼 수 있다.

서버는 내가 사용하는 노트북이다.


우선 redis key로 사용할 ID가 필요해서 라즈베리파이 cpu의 시리얼 정보를 사용했고,

매일 누적하다보니 년, 월에 대한 정보까지 포함시켰다.

그리고 redis-collections의 List를 이용해서 

redis에 저장되는 정보를 마치 List처럼 사용하였다.

써보니 엄청 편하다.


라즈베리파이에서 구동할 파이썬 코드의 설명이다.

1초 sleep을 주고 계속 루프를 돌면서 체크한다.
동작방식은 0.1초간 라즈베리파이에 전원이 인가되고

이 전원이 LDR(조도센서)를 지나가는데

이때의 조도센서는 어두울수록 저항값이 커지기때문에

GPIO.HIGH가 되기까지 더 오래걸려서 측정 값이 커진다.


라즈베리파이3에서 python2로 구동되는 코드


#!/usr/local/bin/python
from __future__ import print_function
from redislite import StrictRedis
from redis_collections import List

import RPi.GPIO as GPIO
import os
import time
from datetime import datetime

__author__ = 'Byungwoo Jeon'
__license__ = "GPL"
__maintainer__ = "byngwoo"

GPIO.setmode(GPIO.BOARD)

# define the pin that goes to the circuit
pin_to_circuit = 7


def get_rp_serial():
    try:
        f = open('/proc/cpuinfo', 'r')
        for line in f:
            if line[0:6] == 'Serial':
                cpu_serial = line[10:26]
        f.close()
    except:
        cpu_serial = None

    return cpu_serial

def rc_time(pin_to_circuit):
    count = 0

    # Output on the pin for
    GPIO.setup(pin_to_circuit, GPIO.OUT)
    GPIO.output(pin_to_circuit, GPIO.LOW)
    time.sleep(0.1)  # sec

    # Change the pin back to input
    GPIO.setup(pin_to_circuit, GPIO.IN)

    # Light-dependent resistor
    # When light hits the LDR, its resistance is very low,
    # but when it's in the dark its resistance is very high.
    # -> Count until the pin goes high
    while (GPIO.input(pin_to_circuit) == GPIO.LOW):
        count += 1
    return count


def redis_init():
    serial_number = get_rp_serial()  # get cpu serial number
    if serial_number is None:
        serial_number = '00000001'  # temp number

    ip = os.environ.get('RS_HOST')  # RS: raspberry pi
    port = os.environ.get('RS_PORT')
    pw = os.environ.get('RS_PASSWORD')
    now = datetime.now()
    time_str = '%4d%02d%02d' % (now.year, now.month, now.day)

    redis_connection = StrictRedis(host=ip, port=port, db=0, password=pw)
    r = List(redis=redis_connection, key='rp3:'+serial_number+time_str)
    return r


# Catch when script is interupted, cleanup correctly
try:
    r = redis_init()
    # Main loop
    while True:
        current_light = rc_time(pin_to_circuit)
        try:
            r.append(current_light)
            print(current_light)
        except Exception as e:
            print("error: ", e)
            pass
        time.sleep(1)  # sec
except KeyboardInterrupt:
    pass
finally:
    GPIO.cleanup()



이 자체만으로 제대로 측정하려면 라즈베리파이에서 딱 이 스크립트만 돌려야한다.

만약 라즈베리파이에서 웹브라우저 실행과 같이 라즈베리파이의 자원을 많이 필요로 하는 작업을 하면

위의 측정 값은 신뢰할 수 없게 된다.



서버에서 수집한 정보를 조회하는 코드

라즈베리파이가 DB에 List형태로 저장하므로 이를 받아와서 

그래프로 보여주기에 매우 수월하다.


서버는 python3를 사용


#!/usr/local/bin/python3
from redis import StrictRedis
from redis_collections import List

import matplotlib.pyplot as plt
import os


def redis_init():
    ip = os.environ.get('RS_HOST')  # RS: raspberry pi
    port = os.environ.get('RS_PORT')
    pw = os.environ.get('RS_PASSWORD')

    redis_connection = StrictRedis(host=ip, port=port, db=0, password=pw)
    # TODO: support multi keys
    r = List(redis=redis_connection, key='rp3:00000000448f542820170421')
    return r


def main():
    r = redis_init()

    plt.xlabel('Run time(sec)')
    plt.ylabel('LDR resister')
    plt.plot(r)
    plt.show()


if __name__ == '__main__':
    main()


수행한 결과 화면




아직 제대로 조건을 못 찾았지만

아래처럼 조건을 정해서 그래프에 표시할 수도 있다.




def main():
    r = redis_init()
    plt.xlabel('Run time(sec)')
    plt.ylabel('LDR resister')
    for i in range(1, len(r)):
        if r[i-1] - r[i] > 1000 and r[i] < 1000:
            plt.annotate('turn on', xy=(i, 600), xytext=(i, 1200),
                         arrowprops=dict(facecolor='black', shrink=0.05),)
    plt.plot(r)
    plt.show()


아래처럼 형광등이 켜졌다고 판단하는 시점을

아래처럼 알아서 표시해줄수도 있는데

아직 저 값에 대해서는 시험이 좀 더 필요하다.




이것에 대해 최종적으로는

Django를 이용해서 웹에서 보여준다. (개인적으로 Django 공부중)

물론 flask, bottle같이 다른 프레임웍을 사용해도 상관은 없다.


웹쪽은 아는게 너무 없어서 적당히 기본만 구현해뒀는데 

아직 바꿔야 할 곳이 너무 많아서 소스는 못 올리겠다.


이렇게까지 구현하는데 파이썬 라이브러리에서 다 해줘서 내가 한 건 별로 없다.

물론 회의실이 여러개가 되고, 모듈의 개수를 늘리고, 

앞으로 해야할 것과 고려할 것은 훨씬 많이 남아있다.



..








반응형

https://tools.ietf.org/html/rfc3261

www.osia.or.kr/board/include/download.php?no=3&db=data2&fileno=2


개인 정리용이므로

아래의 내용보다는 위의 출처의 글을 보는것이 

더 도움이 될 수 있다.


이 그림은 SIP Architecture이다. 

전체 그림으로 이해하기에 좋다.





하나의 단말이 다른 단말과 멀티미디어 세션을 만들기 위해 SIP를 이용한다.


단말이 통화를 시도한다고 가정하고 위의 그림에 대해 지어낸다. 

이해하기 위해 지어낸 것이므로 틀릴 수 있다.


- 왼쪽 SIP Client: 홍씨 (a.com)

- 오른쪽 SIP Client: 김씨 (b.com)



1. 홍씨가 김씨에게 전화 건다. SIP Proxy(A)에 INVITE 요청한다. (휴대폰에서 통화 버튼 누름)
2. SIP Proxy(A)가 다음 노드에 메시지를 전달하는데 도메인이 달라서(b.com) SIP Redirect Server로 메시지 전송
3. 이후 연결해야되는 SIP Proxy(B) 정보를 응답해준다.

4. SIP Proxy(A)가 Redirect Server에게 받은 SIP Proxy(B)에 요청한다.

5. SIP Proxy(B)는 자기 도메인의(b.com) 김씨의 Location Service 정보를 Registrar에 요청한다.

6. Registrar가 김씨의 정보를 응답해준다.

7. SIP Proxy(B)는 Registar에서 받은 김씨의 정보로 해당 Proxy에 요청을 전달한다.

8. SIP Proxy(C)는 김씨 단말에 요청 INVITE 메시지를 전달한다.

9. 180 Ringing 응답을 SIP Proxy(C)로 전달한다. (김씨 단말에 벨이 울림)

10. SIP Proxy(C)가 SIP Proxy(B)로 응답을 전달

11. SIP Proxy(B)가 SIP Proxy(A)로 응답을 전달

12. SIP Proxy(A)가 홍씨에게 180 Ringing 응답을 전달 (홍씨 수화기에 뚜뚜 통화 시도음이 남)












.

반응형

'기타' 카테고리의 다른 글

라우팅 (Strict route, Loose route)의 Request-URI와 Route 해더필드  (5) 2017.04.21
SIP 주요 해더 설명  (6) 2017.04.21
SIP 응답  (5) 2017.04.21
SIP Method 종류  (5) 2017.04.21
SIP의 구성요소  (6) 2017.04.20

http://www.nexpert.net

https://tools.ietf.org/html/rfc3261



개인 정리용이므로

아래의 내용보다는 위의 출처의 글을 보는것이 

더 도움이 될 수 있다.



1xx Provisional : 처리중

2xx Success : 정상

3xx Redirection : 요청을 다른 주소로 재송신

4xx Client Error : 클라이언트 장애

5xx Server Error : 서버 장애

6xx Global Failure : 사용자 연결은 가능하지만 통화불가, 모든 서버에서 사용 불가


각 코드별 상세 정보는 RFC 문서를 확인하면 됨




      1xx: Provisional -- request received, continuing to process the

           request;


      2xx: Success -- the action was successfully received, understood,

           and accepted;


      3xx: Redirection -- further action needs to be taken in order to

           complete the request;


      4xx: Client Error -- the request contains bad syntax or cannot be

           fulfilled at this server;


      5xx: Server Error -- the server failed to fulfill an apparently

           valid request;


      6xx: Global Failure -- the request cannot be fulfilled at any

           server.




Informational  =  "100"  ;  Trying

              /   "180"  ;  Ringing

              /   "181"  ;  Call Is Being Forwarded

              /   "182"  ;  Queued

              /   "183"  ;  Session Progress


Success  =  "200"  ;  OK


Redirection  =  "300"  ;  Multiple Choices

            /   "301"  ;  Moved Permanently

            /   "302"  ;  Moved Temporarily

            /   "305"  ;  Use Proxy

            /   "380"  ;  Alternative Service


Client-Error  =  "400"  ;  Bad Request

             /   "401"  ;  Unauthorized

             /   "402"  ;  Payment Required

             /   "403"  ;  Forbidden

             /   "404"  ;  Not Found

             /   "405"  ;  Method Not Allowed

             /   "406"  ;  Not Acceptable

             /   "407"  ;  Proxy Authentication Required

             /   "408"  ;  Request Timeout

             /   "410"  ;  Gone

             /   "413"  ;  Request Entity Too Large

             /   "414"  ;  Request-URI Too Large

             /   "415"  ;  Unsupported Media Type

             /   "416"  ;  Unsupported URI Scheme

             /   "420"  ;  Bad Extension

             /   "421"  ;  Extension Required

             /   "423"  ;  Interval Too Brief

             /   "480"  ;  Temporarily not available

             /   "481"  ;  Call Leg/Transaction Does Not Exist

             /   "482"  ;  Loop Detected

             /   "483"  ;  Too Many Hops

             /   "484"  ;  Address Incomplete

             /   "485"  ;  Ambiguous

             /   "486"  ;  Busy Here

             /   "487"  ;  Request Terminated

             /   "488"  ;  Not Acceptable Here

             /   "491"  ;  Request Pending

             /   "493"  ;  Undecipherable


Server-Error  =  "500"  ;  Internal Server Error

             /   "501"  ;  Not Implemented

             /   "502"  ;  Bad Gateway

             /   "503"  ;  Service Unavailable

             /   "504"  ;  Server Time-out

             /   "505"  ;  SIP Version not supported

             /   "513"  ;  Message Too Large


Global-Failure  =  "600"  ;  Busy Everywhere

               /   "603"  ;  Decline

               /   "604"  ;  Does not exist anywhere

               /   "606"  ;  Not Acceptable







반응형

'기타' 카테고리의 다른 글

SIP 주요 해더 설명  (6) 2017.04.21
SIP 구조 (Architecture)  (5) 2017.04.21
SIP Method 종류  (5) 2017.04.21
SIP의 구성요소  (6) 2017.04.20
SIP의 5가지 기능  (6) 2017.04.20

http://www.nexpert.net


개인 정리용이므로

아래의 내용보다는 위의 출처의 글을 보는것이 

더 도움이 될 수 있다.

그림도 거의 위의 출처에서 퍼왔으나, 일부는 어딘지 못 찾겠음


메쏘드는 멀티미디어 세션에 대한 각종 처리를 위해 존재한다.

방법을 정의해주고 이에 따라 서버에서 처리한다.


RFC 3261에 정의된 기본 메쏘드


- INVITE: 서비스 또는 사용자를 초대

- ACK: INVITE 응답으로 200 수신했음을 통보, 별도의 응답 안 받음

- BYE: 기존의 세션을 종료

- CANCEL: 최종 응답 200 받기전에 기존 요청을 취소

- OPTIONS: 서버의 Capability 를 요청, 다른쪽 단말에서 지원하는 옵션을 확인 시에 사용

- REGISTER: UA가 Registrar Server에 등록


Method: This specification defines six methods: 
           REGISTER for registering contact information, 

           INVITE, ACK, and CANCEL for setting up sessions, 

           BYE for terminating sessions, and

           OPTIONS for querying servers about their capabilities.  

           SIP extensions, documented in standards track RFCs, may define

           additional methods.



그 외에 멀티미디어 세션 관리 및 부가 서비스를 위한 메쏘드 


- INFO (RFC 2976): SIP 세션을 유지하면서 다른 단말의 information 요청



- PRACK (RFC 3262): Provisional Response를 받고 200 받기 전 사용할 신뢰할 수 있는 응답



- SUBSCRIBE (RFC 3265): NOTIFY 해달라고, 통보 요청

- NOTIFY (RFC 3265): 특정 이벤트 발생시에 통보

- UPDATE (RFC 3311): Final response 받기 전에 세션 설정 파라미터를 업데이트 



- MESSAGE (RFC 3428): SMS 같은 단문 메시지 전달



- REFEER (RFC 3515): 호전환(Call Transfer)과 같이 UA가 지금 통신 중인 UA말고 다른 UA와 통신



- PUBLISH (RFC 3903): Presence Server에 PUBLISH 하면 거기서 각 UA에 NOTIFY










반응형

'기타' 카테고리의 다른 글

SIP 구조 (Architecture)  (5) 2017.04.21
SIP 응답  (5) 2017.04.21
SIP의 구성요소  (6) 2017.04.20
SIP의 5가지 기능  (6) 2017.04.20
SIP 소개  (6) 2017.04.20

출처:


http://www.nexpert.net

http://blog.acronym.co.kr

http://blog.naver.com/blow1

https://tools.ietf.org/html/rfc3261

https://en.wikipedia.org/wiki/Session_Initiation_Protocol


개인 정리용이므로

아래의 내용보다는 위의 출처의 글을 보는것이 

더 도움이 될 수 있다.

아래 모든 그림의 출처는 위키피디아이다.



SIP Components


UA (User Agent)

- UAC + UAS

- UAC : 세션 연결할 요청 메시지를 전송하는 클라이언트, 고객님의 요청

- UAS : SIP 요청 메시지에 대한 응답 메시지를 생성하는 논리적 구성요소, 서버의 응답

- UA는 다른 UA와 직접 연결하거나, Proxy/Redirect Server를 거쳐서 연결하여 호(call) 상태를 관리


Proxy Server

- SIP 메시지 라우팅 담당하는 서버

- state, stateless 로 구분

- 메시지 처리를 위해 UAC, UAS로 동작

- 필요에 따라 SIP 메시지를 수정할 수 있으나, 실제 다이얼로그에는 영향 안줌

- UA로 부터 요청 메시지를 받아서 다른 도메인의 proxy나 redirect server로 전달하거나, 

같은 도메인 내의 UA로 전달하는 기능 수행


Redirect Server

- 방향 바꿔주는 서버라고 생각해도됨, 현재 단말이 요청한 주소에 문제가 생겨 다른 주소로 우회하게 해줌

- 수신한 접속 요청 메시지를 다른 UA나 Proxy server에 전달하지 않고, 해당 UA나 Proxy server에게 요청 메시지를 재전송해야할 UA나 Proxy server의 주소를 알려주는 역할 수행

- 요청 메시지에 3xx 응답하는 UAS

- 3xx 응답으로 클라이언트가 접속할 주소인 URIs 전송



Registrar

- REGISTER 메시지를 통해서 사용자가 등록시킨 사용자의 접속 주소가 저장되어 있음

- 특정 사용자의 접속 주소에 대한 정보 요청시 그에 대해 응답

- UA로 부터 REGISTER 메시지를 받아서 별도의 프로토콜로 Location Service를 제공하는 시스템에 저장함



B2BUA (Back to back User Agent)

- SIP 요청 메시지에 대한 응답 메시지를 생성하는 논리적 구성요소

- 경우에 따라서는 UAC로도 동작할 수 있는데, proxy와 달리 Dialog 상태와 Call-ID에 영향을 줌

- 구지 이렇게 중간에 있는 이유 (장점)

  * 단말간에 서로 프로토콜이 다르거나 코덱이 달라도 서로 통신할 수 있도록 도와줌

  * 다양한 단말에 대하여 부가서비스를 구현할 수 있음
















/

반응형

'기타' 카테고리의 다른 글

SIP 응답  (5) 2017.04.21
SIP Method 종류  (5) 2017.04.21
SIP의 5가지 기능  (6) 2017.04.20
SIP 소개  (6) 2017.04.20
삼각형 패턴 만들기  (6) 2017.02.03

출처:

http://www.nexpert.net

http://blog.acronym.co.kr

http://blog.naver.com/blow1

https://tools.ietf.org/html/rfc3261


개인 정리용이므로

아래의 내용보다는 위의 출처의 글을 보는것이 

더 도움이 될 수 있다.


SIP는 멀티미디어 통신의 시작과 종료를 위한 5개 요소가 있다.

1. 통신한 단말 결정 

2. 착신측에서 통화에 참여할지 여부 결정

3. 통신에 사용할 미디어와 그 파라메터를 결정

4. 착신측이 수락하면 발신, 착신 단말간에 세션 생성

5. 세션이 유지된 상태에서 파라매터 변경, 세션 전환, 세션 종료, 부가 서비스 연동기능 지원





   SIP supports five facets of establishing and terminating multimedia

   communications:


      User location: determination of the end system to be used for

           communication;


      User availability: determination of the willingness of the called

           party to engage in communications;


      User capabilities: determination of the media and media parameters

           to be used;


      Session setup: "ringing", establishment of session parameters at

           both called and calling party;


      Session management: including transfer and termination of

           sessions, modifying session parameters, and invoking

           services.



반응형

'기타' 카테고리의 다른 글

SIP Method 종류  (5) 2017.04.21
SIP의 구성요소  (6) 2017.04.20
SIP 소개  (6) 2017.04.20
삼각형 패턴 만들기  (6) 2017.02.03
[TS 24.229]Procedures at the S-CSCF  (8) 2017.01.25

출처:

http://www.nexpert.net/85

http://blog.acronym.co.kr/125

http://blog.naver.com/blow1/150003192676

https://tools.ietf.org/html/rfc3261


개인 정리용이므로

아래의 내용보다는 위의 출처의 글을 보는것이 

더 도움이 될 수 있다.


SIP(Session Initiation Protocol) 세션 초기화 프로토콜


많은 인터넷과 연결된 어플리케이션들이 생기면서

이들 간에 데이터 교환을 위한 세션의 관리가 필요해졌다.

음성, 영상, 문자 같은 것에 대한 data를 실시간으로 주고 받을 수 있으니

단말간에 뭐든 주고 받을 수 있다고 봐도 되겠다.

이런 data를 주고 받기 위해서는 RTP 같은 전송 프로토콜을 사용한다.


이 프로토콜의 특징은 양 끝단에서 발신의 호출을 착신에서 수신하여 이를 협상(negotiate)하고

협상이 성공하면 양 끝단에서는 SIP로 협상할때 정의했던 프로토콜을 이용해서

Dialog가 진행된다. 사람으로 치면 마치 대화를 한다고 봐도 될것 같다.

한쪽에서 대화를 종료하면 연결이 해제된 것을 알리기 위해 SIP를 사용한다.


텍스트로 되어있고 각각의 정의된 해더에 

약속된 값을 이용해서 세션을 관리할 수 있는 단순한 프로토콜이다.









1 Introduction


   There are many applications of the Internet that require the creation

   and management of a session, where a session is considered an

   exchange of data between an association of participants.  The

   implementation of these applications is complicated by the practices

   of participants: users may move between endpoints, they may be

   addressable by multiple names, and they may communicate in several

   different media - sometimes simultaneously.  Numerous protocols have

   been authored that carry various forms of real-time multimedia

   session data such as voice, video, or text messages.  The Session

   Initiation Protocol (SIP) works in concert with these protocols by

   enabling Internet endpoints (called user agents) to discover one

   another and to agree on a characterization of a session they would

   like to share.  For locating prospective session participants, and

   for other functions, SIP enables the creation of an infrastructure of

   network hosts (called proxy servers) to which user agents can send

   registrations, invitations to sessions, and other requests.  SIP is

   an agile, general-purpose tool for creating, modifying, and

   terminating sessions that works independently of underlying transport

   protocols and without dependency on the type of session that is being

   established.


[출처] SIP|작성자 서비


반응형

'기타' 카테고리의 다른 글

SIP의 구성요소  (6) 2017.04.20
SIP의 5가지 기능  (6) 2017.04.20
삼각형 패턴 만들기  (6) 2017.02.03
[TS 24.229]Procedures at the S-CSCF  (8) 2017.01.25
Windows10에서 Telnet 기능 켜기  (5) 2016.12.15

+ Recent posts