One of the limitation of the iPhone software is the lack of real call forwarding controls. The iPhone only has one call forwarding option: “forward all calls” and you cannot set call forwarding if busy or if not answered.
Call forwarding commands are standard so you can perform these codes easily. Just dial the following numbers to enable call forwarding:
This occurs when you are in a call and have call waiting disabled or when you are receiving a call or making a call yourself.
Dial the following number: *67*[phone number]# to enable call forwarding if busy. To check the status dial: *#67#. To cancel dial: #67#.
If not answered
It occurs when no one answers the phone for 30 seconds (default value as I remember). It is like forwarding to a voicemail number.
To enable: *61*[phone number]#. To check status: *#61#. To cancel: #61#.
If out of reach
Occurs when the phone is off or not available on the cell network.
To enable this dial: *62*[phone number]#. To check the status: *#62#. To cancel dial: #62#.
Forward all calls
This is the standard call forwarding option available in the iPhone menus. To enable: *21*[phone number]#. To check the status: *#21#. To cancel dial: #21#.
Referenced from Wikipedia.