VoIP Protocols > SIP

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"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值