Prevent delayed astdb syncs.

The syncing thread sleeps for a second before waiting to be
told to attempt to sync again. If a signal were sent during this
sleeping period, we would end up having to wait until the next
sync signal occurred in order to sync up the astdb.

This code rearrangement also ensures that any pending transactions
will be synced prior to Asterisk shutting down.

Patches: db_sync.patch by John Hardin (License #6512)
........

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


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/12@410559 f38db490-d61c-443f-a65b-d21fe96a405b
PJSIP: TOS values should be represented as decimals in sorcery objects

(closes issue ASTERISK-23235)
Reported by: George Joseph
Review: https://reviewboard.asterisk.org/r/3324/


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