Fixed deadlock when replicating dialog which has pinging enabled.
Remove pinging entirely for replicated dialogs, since it might cause issues when running in active-backup mode
Properly set the dialog timeout for update bin requests
Do not replicate dialog termination if dialog creation was not done ( failed calls )
(cherry picked from commit 0705a29de1fdf865f7fa11cd3b68c43ccb9e9671)
Do not crash on replicated update if replicated create has failed
Free dlg memory in case replicated create fails
(cherry picked from commit c9b39731c4669bc2d91182bb6130cc1e88286b8a)
dialog: fix possible hash id conflict on restart

When restarting the proxy, the auto-generated next_id of each
hash entry is not properly incremented if a loaded dialog happens to
have this same next_id as hash id. This will soon lead to duplicate hash ids.

Reported by miko95 on GitHub.
(cherry picked from commit b7c3686c176e7c15b806e50f9743ab91656a8da3)
dialplan: fix shm leak when parsing invalid regex

Upon (re)load, if the subst or repl columns contain expressions which
fail to compile, OpenSIPS will leak shared memory.

Reported by miko95 on GitHub
Closes issue #307
(cherry picked from commit 72028d26bef361b6c99f6ad3653f0e1dbb07c767)
(cherry picked from commit f57025fa90431ae080a91d54ae92564b919da52f)
dialog: fix primary key when updating dialogs in REALTIME db mode

When updating rows in the dialog table in REALTIME db mode, the dlg_id
update key is not properly initialized (actually contains random data).

Reported by miko95 on GitHub
Closes issue #306
(cherry picked from commit 0ad3e4f949e1d669d53cd584e48b7d2eff740a22)
core: fix mem statistics when DBG_QM_MALLOC is on
(cherry picked from commit ffb0cb6d2c3a224ce37b575a7f956cfa881bf63b)

Conflicts:

	mem/q_malloc.c
Fixed simplified callid parser
(cherry picked from commit 3316a2a518a2ac27401408369e4bd3adc70b4e48)
db_text: fix issues when database file is missing an ending newline

* do not crash if file contains columns only and is missing the ending newline
* do not skip the last row of a database file if it lacks an ending newline

Reported by gergelypeli on GitHub
Closes issue #308
(cherry picked from commit a2172b256fd19aa56b352665a9d598d6a91b36a3)
Fix sending PRACK for multiple provisional replies.

Reported by Giuseppe Cardone.

(cherry picked from commit 3cd6db2be3728e14343697b886cdcfabd4353d51)
Avoid useless from header parsing in case the dr group was passed from script
Backported from trunk
(cherry picked from commit 79a97ad3efb9fb19fcba91b34fffb5a53c0b5902)
Fixed CDR writing for replicated dialogs
(cherry picked from commit 128d3777f4a11a21eabb3e94a720c223bf0cf654)
Fixed the dialog timeout that gets replicated via BIN for updates
(cherry picked from commit 4c08b62cdabb3549ac99c4dc9cae8485d1f40e68)
Removed useless "ping_interval" parameter.

Closes  #320, reported by @hydrosine .

(cherry picked from commit c529bb142b455a0db87c9661208e9271f912a4ec)
cachedb_memcached: extend the host+port printing buffer
(cherry picked from commit 32f2c2434e99802e90e6166de18ad7523f19a603)
cachedb_sql: fix pkg memory leak

When fetching a key, the db_res_t structure would not be properly freed.
(cherry picked from commit e5ccde131eb72debd9aa400ced2e1e31bd61612d)

Conflicts:

	modules/cachedb_sql/cachedb_sql.c
(cherry picked from commit f7d30b6e6ec8a6bea58bccc99b6b107a8dd0c340)
cachedb_sql: properly fix git conflict (from f7d30b6e)
(cherry picked from commit b0deb69be94633472681eb91dddb3b63f0be8bd5)
exec: reduce impact of the Shellshock bash exploit

Improve documentation awareness for Shellshock
(cherry picked from commit 2456295ffb23ddbe219c14571ec2e9d34969f5d9)
exec: disable 'setvars' on all OpenSIPS versions

We break backwards-compatibility while improving security
on the larger proportion of existing OpenSIPS installations.
(cherry picked from commit 100ecaf8de390582eab0d6110b6a0f813d7e28a1)