The script that you posted didn't work correctly, but I did get it working correctly (there is some sort of bug where the iface variable is not set correctly).
I did get the script that automatically connect to the vpn when a gprs connection is initialized to work correctly, but I haven't had any success with disabling the sip account. I don't see any options on this page to do so: http://wiki.maemo.org/Phone_control#...nnection_UI.29