Maybe I missed something, but you wrote "$chr(127)" then used character 1 in your examples.

So, to avoid confusion: $chr(1) is correct and is used to distinguish CTCP messages from normal PRIVMSGs/NOTICEs.