The Do Not Disturb feature introduced in iOS 6 is a very handy way of essentially silencing your iOS device entirely. However, it doesn’t really provide an option for only preventing incoming calls while still receiving notifications for things like text messages and e-mail.
If you’re in a situation where you don’t want to be disturbed by incoming phone calls but want to keep the rest of your notifications enabled and you’re on a GSM network, you can actually use call forwarding to simply send all of your calls straight to your carrier’s voicemail access number.
To enable this feature, you first need to find out which number is being used for your voicemail forwarding by going into the Phone app and dialing *#67# and pressing the “Call” button.
Write the number down that appears here and then simply go into Settings, Phone, Call Forwarding and enable it using this number. All of your incoming calls will be sent directly to your voicemail as long as Call Forwarding is enabled, and when you want to go back to receiving incoming calls normally,simply go back into your Settings app and toggle Call Forwarding back OFF. As an added bonus, the iPhone will retain the last number used for Call Forwarding, so when you want to send all of your calls to voicemail again, you can simply go back in and toggle the Call Forwarding setting back ON without needing to re-enter the number again.