presence_dialoginfo: Fix bounds checking by using a helper function.

Reported by: dsandras
> About the bound checking error, the code was cut&pasted from another
> place in the same file where the same error is still present:
> ...

Also I replaced a heap str with a stack one in build_dialoginfo. This
one wasn't freed either unless an error condition was hit.
Fixed detection of the module functions used in script - we need to look also into the logical expressions (like IF and WHILE conditions)
Credits for reportind and helping with the troubleshooting go to Justin Zondagh
Merge pull request #177 from wdoekes/wjd-fix_dialogaggr_bounds

presence_dialoginfo: Fix bounds checking by using a helper function.
dispatcher init: initialize the old_data pointer

	* otherwise, the code will dereference a random pointer
hp malloc: fix shm statistics

	* processes now update fragment statistics for each bucket
	* the MI workers iterate and aggregate all memory information
	* the built-in maximum sampling rate is 200ms
		- repeating a fetch in < 200ms will return the same results
	* this patch also corrects a rare deadlock in hp_realloc
		- hp_realloc "growth" may deadlock with hp_malloc "shrink"
		- the best solution is to drop the "growth" realloc operation
		- this also merges well with the allocator fragmentation requirements
hp malloc: reorder some initializing operations

	* hp_mem_warming() fails if anything is allocated before
		(it cannot access the big fragment anymore)
call_center: fix some db schema errors

	* reduce the cc_agents skills column size
	* fix some primary key issues in cc_flows and cc_agents
	* fix a couple of bad column names in cc_cdrs
Fix recalculation of sending socket after local route

Take into consideration the "force_send_socket" setting in local route.
Partitioning support for TCP data structures

In order to scale up with the number of connections (and operations per TCP conn), we need more hash tables and more locks.
(part of TCP partitioning commit 0497150)
tcp: prevent tcp connections from overflowing the partitions vector