Comment out dbh:release(); for now.
Change external_sip_ip and external_rtp_ip from auto-nat to $${local_ip_v4}. This will work better when the system is outside of nat and better for systems that is completely inside the network. 'auto-nat' only works for those using firewalls with UPnP and PMP enabled on their firewall. The number of firewalls that have this enabled doesn't seem to be a large enough to justify using it as the default.