rework ratelimit distributed queries

instead of adding -1 to the counter, use the cachedb_sub function exported by
the cachedb module. This prevents ratelimit counters from adding extremely
large values for some backends (ex: memcached).
Thanks go to Brett Nemeroff for reporting and testing.

(cherry picked from commit c06183325e408f47ba4e0a1e1be274fe23581e25)
Mask compile-time shift/reduce conflict due to if statement ambiguity
(cherry picked from commit c4b8be1cb86ba6d169ae97b221d4986f8ecad9a4)
Fixed restoring SOCKET info from AVP during failover
(cherry picked from commit cc657ffc81e13e66dfba9ffba3e5e9f380e22c1d)
Reset the lump cond flags when the condition evaluates to false.

In case there are multiple branches, the conditions can evaluate
differently on each branch - which might lead to bad counting of the
added lumps ( used by the dialog module for dlg validation )
(cherry picked from commit 24f9366858d0568a2eaa231f37d349efd2d70d96)
Fixed keeping turns on handling PUBLISHes for the same presentity - when presentity is deleted (due a unPUBLISH) do not do any turn related ops anymore
Reported by Damien Sanders
Do not free the header string as it is part of the lumps (and freed together with the lumps).
Reported by Jeff Pyle.
Fixing bug #126
revert commit ec0d05a

dialog variables might be binary, therefore strlen should not be used

(cherry picked from commit 7401a7a4a4820706aa05d96d5bebdc93c6db6b40)
Fix the DB representation of message flags in the acc module

* storing flags as strings rather than bitmasks prevents flag conflicts
  when doing flag modifications in the script, then restarting the proxy
* similar usrloc issue was fixed in commit 98b6b0437
uac_registrant: re-register with expires value imposed by the registrar
(cherry picked from commit f9a8d985829ed1cce3a2f0985a8c72368d0b3325)
Fixed bogus warning because of variables not being reset.
Reported by Jeff Pyle, part of fixing issue #126.
Merge pull request #131 from dsandras/ds-pua-mi-warning-fix

Fixes bug where a refreshed PUBLISH request triggers an error message.
Merge pull request #122 from dsandras/ds-fix-dialog-info-entity

This patch fixes the entity URI in XML documents to contain "sip:".(cherry picked from commit 377e7574d411aa974cf469d6df18b6213b43a31f)
Fixed residential example when using presence
Load xcap module, presence_xml depends on it
fixed README typo
(cherry picked from commit 144e112db1f785875a671f57a727393c2a3b7764)