This patch fixes the entity URI in XML documents to contain the sip: part.

Without it, Polycom phones do not reset the state correctly
when receiving full state notifications.

Polycom phones indeed require the entity to be formatted exactly the same
way for all notifications it receives. From their point of view, sip:a@b
and a@b are different URIs.
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)
Fixes bug where a refreshed PUBLISH request triggers an error message.

A missing callback argument should be turned into a debug message
because it only happens when refreshing a PUBLISH and executing
a callback does not make sense in that specific case for mi module.
fix compilation error in ratelimit module

get_counter() function is not exported in 1.8
Thanks go to Nick Altmann for reporting
Mask compile-time shift/reduce conflict due to if statement ambiguity
(cherry picked from commit c4b8be1cb86ba6d169ae97b221d4986f8ecad9a4)
Use proper locking function (via the generic locking API)
Reported by Max E. Reyes Vera Juarez.
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)

Conflicts:
	modules/dialog/dlg_db_handler.c
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:".