`
bingtears
  • 浏览: 184986 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

VoIP Protocols > SIP

UP 
阅读更多
SIP is a text-based protocol that uses a similar semantic to HTTP. The UAC make requests and the UAS return answers to client requests. SIP defines the communication through two types of messages. The requests (methods) and the answers (state codes) use the generic format of the RFC 2822. They have an initial line followed by one or more header fields, an empty line that shows the end of the head, and finally, the body of the message (optional).


- SIP Methods

The most important thing of SIP Requests is the initial line of the message, called Request-Line. It contains the method name, the request address identifier (Request-URI) and the SIP protocol version. There are six basic methods (defined in RFC 254) for the client requests:

- INVITE: Let invite a user or a service to a new session or to modify parameters of a established session.
- ACK: Confirm the session establishment
- OPTION: Request information about the capabilities of a server
- BYE: End of a session
- CANCEL: Cancel a pending request.
- REGISTER: Register the user agent.

However there are additional methods that can be used. For example INFO, SUBSCRIBER, etc. (published in other RFCs)

For example you can see here a real example of a register method:

Via: SIP/2.0/UDP 192.168.0.100:5060;rport;branch=z9hG4bK646464100000000b43c52d6c00000d1200000f03
Content-Length: 0
Contact: <sip:20000@192.168.0.100:5060>
Call-ID: ED9A8038-A29D-40AB-95B1-0F5F5E905574@192.168.0.100
CSeq: 36 REGISTER
From: <sip:20000@192.168.0.101>;tag=910033437093
Max-Forwards: 70
To: <sip:20000@192.168.0.101>
User-Agent: SJphone/1.60.289a (SJ Labs)
Authorization: Digest username="20000",realm="192.168.0.101",nonce="43c52e9d29317c0bf1f885b9aaff1522d93c7692"
,uri="192.168.0.101",response="f69463b8d3efdb87c388efa9be1a1e63"


- SIP Answers (State Codes) .

After a SIP request message, the receiver answers with a message. This message, is similar to the previous one, but the first line, called Status-Line, that contains the SIP version , the answer code (Status-Code) and a small description (Reason-Phrase). The code of the answer is made up of three digits that allow classify the different types. The first digit defines the answer class

Class Code
1xx - Provisional Messages.
2xx - Success Answers.
3xx - Redirection Answers.
4xx - Method Failures.
5xx - Server Failures.
6xx - Global Failures.

This is a 200 sucess answer example:

Internet Protocol, Src Addr: 192.168.0.101 (192.168.0.101), Dst Addr:
192.168.0.100 (192.168.0.100)
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5060 (5060)
Session Initiation Protocol
Status-Line: SIP/2.0 200 OK
Status-Code: 200
Resent Packet: False
Via: SIP/2.0/UDP 192.168.0.100:5060;rport;branch=z9hG4bK646464100000000b43c52d6c00000d1200000f03
Content-Length: 0
Contact: <sip:20100@192.168.0.100:5060>
Call-ID: ED9A8038-A29D-40AB-95B1-0F5F5E905574@100.100.100.16
CSeq: 36 REGISTER
From: <sip:20000@192.168.0.101>;tag=910033437093
Max-Forwards: 70
To: <sip:20000@192.168.0.101:5060>
Authorization: Digest username="20100",realm="192.168.0.101",nonce="43c52e9d29317c0bf1f885b9aaff1522d93c7692",uri="sip:192.168.0.101",
response="f69463b8d3efdb87c388efa9be1a1e63"


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics