When traced_avp is defined within script, disabling of trace through MI commands does not work, and module still traces messages.
I applied a patch slightly modify from the one you provided. Please test it and confirm that everything work properly. See revision 6195 on trunk.
Thanks and regards,