Generally, this is because you're calling the function when alias has already been set.
You may wish to consider a current version of kamailio (5.8/5.7) and use the [trim](https://www.kamailio.org/docs/modules/stable/modules/nathelper.html#nathelpe...) option.
This being said, this is not a bug and help should be obtained via the mailing list with issues utilized for software bugs.
Thank you.