Fix a bug that affected dialplan entries for ring groups when using MySQL. Add additional exception handling.

git-svn-id: http://fusionpbx.googlecode.com/svn/trunk@3901 e2954ef0-caed-11de-bd98-e341d93cc3cc