RFC 3261 specifies the client transaction state machines that SIP uses in its section 17.
Client transaction - Invite State Machine:
This section explains the Client transaction state machine for Invite. State machine has 4 states: Calling Proceeding, Completed, Terminated. This state machine uses 3 way handshake mechanisms.
Timers used
Timer T1:
- Purpose: Round Trip Time
- Default Value: 500 ms
Timer A:
- Controls retransmissions of client transaction.
- Default Value: set to T1
- Uses exponential backoff. 2* T1, 4* T1
Timer B:
- Controls Timeout of client transaction.
- Default Value: set to 64*T1
Timer D:
- Reference to Timer H at client transaction.
- Default Value: 32s
Timer H:
- Amount of time server transaction can remain in ‘COMPLETED’ state
- Default value: 64 * T1 (Server transaction’s Timer T1)
STATE - CALLING:
- This state is entered when UAC core creates a client transaction for sending INVITE outside the dialog.
- On entering CALLING state, TIMER B is set to 64 * T1.
- TIMER A is set to T1 in case the transport to be used is unreliable (UDP). Incase of reliable transport, TIMER A is not used.
- In case TIMER A fires when the client transaction is still in CALLING state, retransmission of INVITE would happen and TIMER A would be resetted to exponential back off (2*T1, 4*T1..)
- In case TIMER B fires when client transaction is in CALLING state, UA should be intimated about the timeout and Client transaction state would be changed to TERMINIATED. No ACK should be generated.
- If response from server transaction is 1xx, the response is sent to Transaction user, then the client transaction enters PROCEEDING STATE.
- If response from server transaction is 2xx, the response is sent to Transaction user, then the client transaction enters TERMINATED STATE.
- If response from server transaction is 3xx to 6xx, the response is sent to Transaction user, then the client transaction enters COMPLETED state and it should generate ACK.
STATE – PROCEEDING:
- Request should not be retransmitted any longer when in PROCEEDING state
- TIMERS have no effect on this state
- If response from server transaction is 1xx, the response is sent to Transaction user and the client transaction remains at PROCEEDING state.
- If response from server transaction is 2xx, the response is sent to Transaction user, then the client transaction enters TERMINATED STATE.
- If response from server transaction is 3xx to 6xx, the response is sent to Transaction user, then the client transaction enters COMPLETED state and it should generate ACK.
STATE – COMPLETED:
- Once client transaction enters COMPLETED state, which happens when server transaction sends any response of 3xx – 6xx, TIMER D should be started.
- For reliable transport it is 0 and for unreliable transport it is equal to TIMER H of server transaction which is 64 * T1. Since we don’t know the T1 of the server transaction, we set it to 32s as absolute minimum.
- Any retransmission of final response should not be passed to Transaction user. Instead, client transaction should generate ACK and send it to Transport layer.
- Once the TIMER D fires, the transaction is moved immediately to TERMINATED state.
STATE – TERMINATED:
- Client transaction enters this state, if 2xx response is received by it in either CALLING or PROCEEDING state or a timeout has occurred.
- Handling a 2xx response depends on the type of UAC. This is the reason the transaction layer does not handle 2xx response. The 2xx response is passed on to Transaction User.
- Client transaction will be destroyed immediately on entering TERMINATED state.
Any response that the client transaction receives that does not matches any ongoing transaction, then the response is directly passed on to the Transaction User. On receipt of first 2xx response, the client transaction is terminated. Hence the subsequent 2xx responses would be directly sent to UAC core.
This comment has been removed by the author.
ReplyDeleteHow does timer / state machine differ in case of UDP and TCP ?
ReplyDelete