Share From: http://www.ucunleashed.com/?p=129
Forking diagram looks like a fork. Hence it is called forking
A user can get registered from multiple IP addresses. So for a proxy, it becomes difficult to identify the correct contact where user will be reachable. Proxy will try to attempt all the available contact addresses either sequentially or in parallel depending its administrative settings. This process of trying out different contact addresses of the destination party in parallel is called ‘Forking’. Forking requires keeping track of transaction states so it is not going to work with stateless proxies. It can be performed by call stateful proxy or transaction stateful proxy.
Consider this call flow (as in image above) wherein an INVITE has reached a proxy (stateful one), proxy consults location service for list of contact addresses for the destination party. Location service returns two contact addresses. Stateful proxy has been set to perform forking. So it will create two transactions, towards each contact address. For n contact addresses, there will be n transactions on the client side will be created.
There will some positive responses and some negative ones from various contact addresses being tried. The negative ones had been because destination not reachable, user busy i.e. any 4xx,5xx,6xx response. Negative response transactions will be terminated automatically. Proxy will have to choose one of the transaction out of several positive ones. Proxy will choose the one based on first come first serve basis.
Basically, After receiving the first 200 OK from any of destinations, the proxy will immediately issue CANCEL request towards all the pending transactions. By pending transactions I mean, the ones that have only received provisional responses. Calling party will be connected to the chosen called party by the proxy