I traced the source of the problem back to smsnotify. The daemon shell script runs through a tight loop repeatedly checking the voicemail and sms sqlite databases using the sqlite3 command. I edited the script and put some bigger time delays between queries to the databases and a growing delay between vibrating alerts. The smsnotify default time delays can be a little disconcerting when you get a voicemail or SMS while on a call. It also creates a problem when you put down your phone and leave it for an hour. A single voicemail or sms will run down your battery and wake you from your sleep with incessant vibration alerts every 10 seconds.
Here is my version of the smsnotify.sh script. The original post follows it.:
while test 1
if [ `echo 'select count(*) from message where \
flags=0;' | sqlite3 \
/var/mobile/Library/SMS/sms.db` -gt 0 ]
if [ $SMSNOTIFY_COUNT -lt 2 ]
elif [ $SMSNOTIFY_COUNT -lt 4 ]
elif [ $SMSNOTIFY_COUNT -lt 5 ]
elif [ $SMSNOTIFY_COUNT -lt 6 ]
#Each parameter to vibrate is 1 more
#vibration, so vibrate 3 times
$SMSNOTIFY_PATH/vibrate 1 1
if [ `echo 'select count(*) from voicemail \
where flags & 1 == 0;' | sqlite3 \
/var/mobile/Library/Voicemail/voicemail.db` -gt 0 ]
if [ $VMNOTIFY_COUNT -lt 2 ]
elif [ $VMNOTIFY_COUNT -lt 4 ]
elif [ $VMNOTIFY_COUNT -lt 5 ]
elif [ $VMNOTIFY_COUNT -lt 6 ]
#vibrate 2 times
#This program sleeps for 5 seconds then checks
#how long it's been sleeping. If it's been more
#than 10 seconds the phone has slept and it exits,
#allowing the loop to continue
I've been having all kinds of iPhone trouble acquiring signal, dropping calls, and the signal going in and out. My voice sounded incoherent and was always accompanied by the gurgling sound of electronic water.
The problem was of my own creation. I had jail broken my phone and installed all kinds of apps that had launched many server processes. Most of the server processes failed to stop with a simple:
su -c 'launchctl stop com.sourceforge.netatalk.afpd'
I ended up having to do a:
su -c 'for i in /Library/LaunchDaemons/*;
do launchctl unload $i;done'
I did the same for the ones installed in /System/Library/LaunchDaemons. I just limited the file glob expression to the services I wanted to unload as a plain * would probably force me to have to restore my iPhone. i.e. I used com.apple.mDNS* and other more specific file globbing expressions.
Since all of my calls had garbled audio quality my first phone call verified that I had fixed the problem. Also the fact that I had a crystal clear conversation with only one bar was the proof I needed. As I hadn't been able to get my iPhone to dial most of the time with 3 bars.
The only caveat is that inorder to renable these services you have to load the profiles again rather than doing a simple stop and then start. I'll have to look into how those .plist files should be written so that the start and stop work properly and maybe even have launchd do the listening for some of the services rather than having all of those services running unnecessarily.
Hope this helps. It saved me from carrying a separate phone just for conversations.