Based on the output of `(gdb) p vTHX`, it seems that there are different global variables in the perl interpreter, not the same as I found in my system.
If you can reproduce on a test system, then you can try to run kamailio with valgrind or strace to see if it catches any buffer overflows.