pbx: Fix lack of cleanup on macrolock and context_table

(closes issue ASTERISK-21723)
Reported by: Corey Farrell
Patches:
    core-pbx-cleanup.patch uploaded by Correy Farrell (license 5909)
........

Merged revisions 388532 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 388578 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: http://svn.asterisk.org/svn/asterisk/trunk@388579 f38db490-d61c-443f-a65b-d21fe96a405b