Replacing dashes and other chars in dialed number

Hi guys,

Users are calling by copy-paste numbers from different sites. So the numbers are coming to asterisk from the voip client (like portgo/xlite) without the dashed stripped, or with ( , ).
I’m trying to rewrite the number in a custom context.
So far I’ve tryed something like:

//this is suppose to remove ‘-’ from number
exten => _.,n,Set(EXTEN=${REPLACE(EXTEN,-,)})
or
exten => _.,n,Set(${EXTEN}=${REPLACE(EXTEN,-,)})

It doesn’t seem to work. I’ve read somewhere that EXTEN variable cannot be set.
Am I doing something wrong in the syntax or indeed EXTEN cannot be set. How can I then rewrite the number.

Please note that some numbers came like (xxx)xx-xxxx
I basically want to remove (, ), - and space.

I’m surprised that no one wants that … I’ve seen only threads for replacing + with 00

Thank you

Never mind, I’ve found the solution I think:

Set(TEST=${REPLACE(EXTEN,-,)
Set(TEST=${REPLACE(TEST,(,)

GoTo(from-internal,${TEST},1)

Why not use the filter command?

Set(test=${FILTER(0-9,${EXTEN})})

Which filters out all characters not being a number…