- BYE requests received in confirmed state should terminate the dialog only if they match the TO-tag from 200 OK INVITE.
  This affects parallel forking scenarios where rejected branches are terminated via BYE by caller.
  Thanks for reporting and testing to Marco Hierl.
- code beautification - tabs versus spaces / identation
- removed unused variable
 - normalize some debug logs
- partial porting of merge 50117f (adapted to 1.8)
Fix memleak in nathelper natping when "failed to fetch contacts".

Re-ordered some code around in nh_timer() so buf is always freed. Even
in rare cases when ul.get_all_ucontacts() returns false (because someone
broke the database).
Merge pull request #68 from wdoekes/wjd-fix_nathelper_memleak

Fix memleak in nathelper natping when "failed to fetch contacts".
- fixed NULL sockets in external scenarios (this leads to crashing when building the contact hdr)
  Reported by dexteruk on IRC .
 Fixed bug introduced by previous commit :

	- downstream BYEs should go to 200OK leg in order to trigger dialog termination
	- upstream BYEs have no such limitation ( there's only one caller leg :) )
(cherry picked from commit e1ae01b41a6c1db4ccfcf4d378d4a8365f3004e9)
We now rely on libxml api instead of cut/paste.