safe_asterisk: Cleanup and debian compatibility.

Cleans up the safe_asterisk script and adds the ASTSAFE_FOREGROUND
option that allows the debian asterisk init script to capture the
right pid.

* Drop the vim #modeline which wasn't used. Use test consistently
  without the odd configure xno syntax. Double quote all paths.
  General cleanup.
* Don't output message()s to the console but only to TTY if set.
* Allow TTY to be "no" as well as empty (debian compatibility with
  debian/patches/safe_asterisk-config).
* Add option to export ASTSAFE_FOREGROUND=1 from the init script
  that calls this to disable backgrounding. Debian uses a similar
  method in debian/patches/safe_asterisk-nobg).

ASTERISK-23492 #close
Review: https://reviewboard.asterisk.org/r/3574/
........

Merged revisions 415132 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 415171 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/12@415172 f38db490-d61c-443f-a65b-d21fe96a405b