Saturday, January 1, 2011
Tuesday, December 28, 2010
UAC General behavior outside the dialog
UAC General behavior outside the dialog:
This excerpt is a method independent rules for initiating request and handling response.
At the least, a valid request should have the following headers. To, From, CSeq, Call-ID, Max forward, Via. These 6 headers form the fundamental building block of SIP.
Formation of request:
What is the format of Request line?
Format of SIP request line: METHOD Space Request_URI Space SIPVersion
How a request URI should be?
Initial Request URI should be set to the value of URI in To field. Exception is REGISTER method.
A preexisting route set could affect the Request URI.
Specifies desired logical recipient or address of record of target.
May contain SIP or SIPS URI.
What is a Route set?
It is an ordered set of URI that identifies a chain of server through which outgoing request outside dialog are sent to.
How a ‘To’ should be?
A request outside a dialog must not and cannot contain a ‘To tag’.
Populating URI is done by any method desirable by user and application. Example URI would be SIP:useridentity@fqdn_domain_or_IPaddress
How ‘From’ should be?
It should be a logical identity of initiator of request.
If initiator wants to remain anonymous, he got to use syntactically correct but meaningless URI.
From should have a From tag.
How ‘Call ID’ should be?
Call ID is a global unique_id for message series.
Cryptographically random ID can be used.
Can use Cryptographically_random_Id@host
Whats a CSeq?
Must be 32 bit unsigned int less than 2 power 31. Ie 2147483648
How Max forward should be?
This field is used to limit the number of hops.
It is going to be decremented by 1 for each hops.
If it reaches ‘0’ then that hop would send ‘483 Too many hops’ error response.
How Via should be?
Identify the transport protocol used.
Identify where response to be sent.
Via added after transport is determined
Must contain branch parameter unique for method and time.
Exception is CANCEL and ACK for non-200 responses.
Implementation in compliance with RFC 3261 should have branch parameter value that begins with ‘z9hG4bk’.
Via header parameters maddr, ttl, sent-by would be set while processing.
How Contact should be?
Should have SIP or SIPS URI which would be used for contacting the specific UA for subsequent response.
Must be present and should have only one SIP / SIPS URI. Exception is REGISTER method.
What about ‘Supported and Require’ headers?
If UAC supports extension to SIP that can be applied to the response, supported header with option tag should be included.
If UAC insist UAS support an extension, Require header is used.
If UAC insists proxy to support and extension, then Proxy-Require header is used.
Sending the request
Destination is determined after applying DNS.
If Request URI has SIPS, all other should be processed as if they are also SIPS.
UAC configured with outbound proxy should attempt to send the request to location indicated in the first Route header. This will ensure that the proxies that does not add record route will be left out subsequently.
Processing of response
A response would first be processed by Transport layer then transaction layer then to Transaction User.
Most of the TU processing is based on the method.
Sometimes instead of response, transaction layer will return an error message to TU.
When a timeout is received from Transaction layer, it should be considered as 408 Request Timeout.
If fatal transport error due to ICMP errors in UDP or connection failure in TCP, the condition must be treated as 503 Service Unavailable.
Any final response that is not recognizable can be deemed equivalent to X00 response code. For ex 431. If not recognizable, should be treated equivalent to 400 Bad request.
UAC should discard message if it has more than one via header field.
Processing 3xx response
On 3xx response, client should use URI in the contact field.
Each contact should be tried only once.
Order of try can be based on the Q parameter of the contact.
Equal Q values can be processed in parallel.
If one address fails, next has to be selected.
If all fails, the request has failed.
For some response codes above 399 can mean retries, which should not be considered as failures.
Entire Request URI can be copied from contact header
UAC can reuse the same To, From, Call-ID used in the original redirected request but UAC may also chose to retain them.
Once the new message is framed it marks new transaction.
Processing 4xx response
Certain 4xx responses require UA processing independent of method.
401 – Unauthorised, 407 – Proxy-Authentication Required UAC should follow authorization procedure.
413 – Request Entity too large, the response has body which is too large for UAC to handle.
415 – Unsupported media type, UAC should send a request containing media type which is listed in Accept header field with encoding listed in Accept-encoding header.
416 – Unsupported URI scheme. UAC should retry with SIP URI.
420 – Bad extension, UAC should retry sending request by omitting unsupported extension listed in Unsupported header in response.
Retry is a new transaction and should have same Call-Id, To, From.
CSeq should have new sequence number.
Saturday, March 6, 2010
Registration Process
Monday, March 1, 2010
Registration Overview
RFC 3261 talks about registration in chapter 10. Registration is one way to populate the location service database. Registration allows SIP to be mobile. Under registration, a person can register more than 1 phone. A person is identified by a unique address called as Address Of Record (AOR). His phones are identified as contacts. An AOR can have multiple contacts binded to it. Lets see what RFC 3261 has to tell about Registration point by point.
1. Registration will use AOR to search for contact and add them.
2. Register can happen through proxy server to a registrar server. Server which handles the REGISTER message and acts to update or query the location service is said to be Registrar.
3. REGISTER request can add, remove, update, query contacts.
4. REGISTER request does not establish a dialog.
5. Record-route header has no meaning with REGISTER message. UAC must ignore this header.
6. A REGISTER message should have the following:
a. Request-URI: Domain for which the registration is done. Difference between the regular SIP Request-URI and REGISTER request-URI is the absence of “userinfo@”.
b. TO: Binding AOR. This AOR is the one for which we query, add, delete, update contact.
c. FROM: AOR of person initiating the contact. SIP supports third party registration.
d. Call-ID: Random unique identified similar to Call-ID used in other methods with a difference. Call-ID should be same between a client to a server all the time. If its different, then registrar would not be able to detect a delayed REGISTER message which arrived out of order.
e. CSEQ: UA must increment CSEQ for subsequent REGISTER messages.
f. Contact (Optional): If no contact header is present its query else, action will be decided on various factor between add, query, refresh etc.
7. UAC must not send any new registration until they have received final response from the registrar for previous one or timed out. Retransmission may happen.
8. Special contact header parameters: expire – specifies how long the binding is valid. If it is not present Expire header will be used.
9. 2xx response from registrar will have all bindings listed in contact header.
10. If neither the Expire header or expire parameter of contact header is present then server is allowed to chose the value.
11. Priority of contact can be set by using the ‘q’ parameter of a contact header.
12. Value is ‘q’ should be less than 1.
13. Higher the ‘q’ value, higher the priority.
14. Binding removal can be done by specifying expire=0.
15. If Contact header field value is *, expire value can only be 0. This means, all bindings to AOR are removed.
16. A successful response for REGISTER message will have all binded contacts listed in the Contact header along with its parameters. In case the REGISTER message does not have Contact header it is a query.
17. Discovery of Registrar can be done in three ways.
a. By configuration
b. By using AOR (only host and domain part of AOR is used)
c. Using multicast (224.0.1.75 sip.mcast.net)
18. Too small expiry time results in 423 – Interval Too Brief response.
19. A registrar must not generate a 6xx response.
20. Accepts only REGISTER message
21. Registrar should know the set of domain for which it maintains binding.
22. REGISTER message should be processed completely and independently.
Monday, February 22, 2010
List of Methods and Response codes
Request name | Description | RFC |
| INVITE | Indicates a client is being invited to participate in a call session. | 3261 |
| ACK | Confirms that the client has received a final response to an INVITE request. | 3261 |
| BYE | Terminates a call and can be sent by either the caller or the callee. | 3261 |
| CANCEL | Cancels any pending request. | 3261 |
| OPTIONS | Queries the capabilities of servers. | 3261 |
| REGISTER | Registers the address listed in the To header field with a SIP server. | 3261 |
| PRACK | Provisional acknowledgement. | 3262 |
| SUBSCRIBE | Subscribes for an Event of Notification from the Notifier. | 3265 |
| NOTIFY | Notify the subscriber of a new Event. | 3265 |
| PUBLISH | publishes an event to the Server. | 3903 |
| INFO | Sends mid-session information that does not modify the session state. | 2976 |
| REFER | Asks recipient to issue SIP request (call transfer.) | 3515 |
| MESSAGE | Transports instant messages using SIP. | 3428 |
| UPDATE | Modifies the state of a session without changing the state of the dialog. | 3311 |
1xx—Informational Responses
- 100 Trying
- 180 Ringing
- 181 Call Is Being Forwarded
- 182 Queued
- 183 Session Progress
2xx—Successful Responses
- 200 OK
- 202 accepted: It Indicates that the request has been understood but actually can't be processed
3xx—Redirection Responses
- 300 Multiple Choices
- 301 Moved Permanently
- 302 Moved Temporarily
- 305 Use Proxy
- 380 Alternative Service
4xx—Client Failure Responses
- 400 Bad Request
- 401 Unauthorized (Used only by registrars or user agents. Proxies should use proxy authorization 407)
- 402 Payment Required (Reserved for future use)
- 403 Forbidden
- 404 Not Found (User not found)
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout (Couldn't find the user in time)
- 409 Conflict
- 410 Gone (The user existed once, but is not available here any more.)
- 412 Conditional Request Failed
- 413 Request Entity Too Large
- 414 Request-URI Too Long
- 415 Unsupported Media Type
- 416 Unsupported URI Scheme
- 417 Unknown Resource-Priority
- 420 Bad Extension (Bad SIP Protocol Extension used, not understood by the server)
- 421 Extension Required
- 422 Session Interval Too Small
- 423 Interval Too Brief
- 424 Bad Location Information
- 428 Use Identity Header
- 429 Provide Referrer Identity
- 433 Anonymity Disallowed
- 436 Bad Identity-Info
- 437 Unsupported Certificate
- 438 Invalid Identity Header
- 480 Temporarily Unavailable
- 481 Call/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
- 489 Bad Event
- 491 Request Pending
- 493 Undecipherable (Could not decrypt S/MIME body part)
- 494 Security Agreement Required
5xx—Server Failure Responses
- 500 Server Internal Error
- 501 Not Implemented: The SIP request method is not implemented here
- 502 Bad Gateway
- 503 Service Unavailable
- 504 Server Time-out
- 505 Version Not Supported: The server does not support this version of the SIP protocol
- 513 Message Too Large
- 580 Precondition Failure
6xx—Global Failure Responses
- 600 Busy Everywhere
- 603 Decline
- 604 Does Not Exist Anywhere
- 606 Not Acceptable

