Fix lock errors on startup.

In messages.c, there are several places in the code where we create a
tmp_tech_holder and pass that into an ao2_find call. Unfortunately, we
weren't initializing the rwlock on the tmp_tech_holder, which the hash
function was locking. It's apparently harmless, but still not the best
code.

This patch extracts all that copy/pasted code into two functions,
msg_find_by_tech and msg_find_by_tech_name, which properly initialize
and destroy the rwlock on the tmp_tech_holder.

Review: https://reviewboard.asterisk.org/r/2454/



git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/11@386006 f38db490-d61c-443f-a65b-d21fe96a405b