I found these instructions on this site.
How can set the number of rings on my iPhone before voicemail picks up The iPhone FAQ
You can set the iPhone to wait longer or shorter than the default 20 seconds before it goes to voicemail when receiving an incoming call. This will result in a different number of rings before the voice messaging system picks up the line and plays your outgoing message. To change the amount of time the iPhone will ring follow these steps:
1. Open the phone app and dial *#61# on the Keypad. Press the Call button.
2. Locate this text on the screen: "Setting Interrogation Succeeded, Voice Call Forwarding, When Unanswered, Forwards to +" and record the 11-digit number after the + symbol.
3. Touch the Dismiss button. Now enter this code on the Keypad: *61*+ followed by the 11-digit Forwards to number recorded in step 2, followed by *11 and *ringtime#. Ringtime is the number of seconds you want your iPhone to ring before voicemail picks up. Your finished code should look something like this:
*61*+18555513466*11*30#
In the example above the ring time is set to 30 seconds. Press the Call button.
4. You should receive the message: Setting Activation Succeeded. Press Dismiss and next time you receive a call it will ring for the new amount of time before going to voicemail.
I've not tried this myself and can't guarantee it'll work as described.