Trim function in asterisk

is there any way through which i can remove space in asterisk like trim fuction

You can use the FILTER function.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_FILTER

Set (MyVar=${FILTER(A-Za-z0-0,${CALLERID(name)})})