Types of SIP Request
INVITE : We will send INVITE request to invite a user to a call.
ACK : Acknowledgment (ACK) message is sent in response to INVITE request.
BYE : It is used to terminate a SIP session.
CANCEL : Terminates an INVITE request.
OPTIONS : Used to query about server’s capabilities.
REGISTER : Used to REGISTER user’s current location.
INFO : Send mid-session signaling, that will not modify the current session.
Typical SIP Request Message:
INVITE sip:user2@server2.com SIP/2.0 Via: SIP/2.0/UDP pc44.server1.com;branch=eyuis7ewSGDH3 Max-Forwards: 70 To: user2 <sip:user2@server2.com> From: user1 <sip:user1@server1.com>;tag=123654678 Call-ID: iysf76sdf12@pc33.server1.com CSeq: 67354 INVITE Contact: <sip:user1@pc33.server1.com> Content-Type: application/sdp Content-Length: 142
1. First line is the request line of the format “Method SP Request-URI SP SIP-Version CRLF”
SP = Single Space CRLF = Inserts New line
2. “via” header field: It contains local address, it is where response is expected to receive.
3. “Max-Forward” header filed: It is used indicate the maximum number of HOPS. This number will be decremented at each HOP.
4. “To” header field: Logical address of To user. It will have SIP URI or SIPS URI
5. “From” header field: Logical address of From user. It will have SIP URI or SIPS URI
6. “Call-ID” header field: It is globally unique identifier.
7. “cseq” header field: C Sequence Number. It will be incremented at every new request message.
8. “contact”header field: It has SIP or SIPS URI directly to “From” user.
SIP type of response
The response type is divided into 5 types;
1xx: Provisional
2xx: Success
3xx: Redirection
4xx: Client Error
5xx: Server Error
6xx: Global Failure
Some of the important response codes are as below:
1xx Provisional Responses
100 Trying
180 Ringing
181 Call is Being Forwarded
183 Session Progress
2xx Successful Response
200 OK
202 Accepted
3xx Redirection Response
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
4xx Client Failure Response
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
407 Proxy Authentication Required
408 Request Timeout
5xx Server Failure Response
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
6xx Global Failure Response
600 Busy Everywhere
603 Decline
Typical SIP response:
SIP/2.0 200 OK Via: SIP/2.0/UDP pc33.server1.com;branch=eyuis7ewSGDH3;received=192.0.2.1 To: user2 <sip:user2@server2.com>;tag=3hry6sd From: user1 <sip:user1@server1.com>;tag=123654678 Call-ID: iysf76sdf12@pc33.server1.com CSeq: 67354 INVITE Contact: <sip:user2@192.0.2.4> Content-Type: application/sdp Content-Length: 94