FREEPBX-8064 - fix issue with calling $db object