I want to change a couple off characters \* # for A and P to have the monitor filename with characters more friendly. The only solution I could find was to do it my self within the dialplan but it generates a lot of verbosity output and is not as efficient(fast) as I would like to. I'll post it here just in case someone wants to use it. But I'm looking for an asterisk function that I can compile something that I can call withing the dialplan like ${REPLACE(${EXTEN},\*,a)} and have the exten \*\*123\*\*456\*\*\* converted to AA123AA456AAA.

```
;
; MACRO REPLACE
;
[macro-replace]
;
;   ${ARG1} - String source
;   ${ARG2} - Chars to replace
;   ${ARG3} - Chars to replace with
;
exten =&gt; s,1,NoOp(Replacing ${ARG2} for ${ARG3} in ${ARG1})
exten =&gt; s,n,Set(str=${ARG1})
exten =&gt; s,n,Set(find=${ARG2})
exten =&gt; s,n,Set(replace=${ARG3})
exten =&gt; s,n,Set(i=0)
exten =&gt; s,n,Set(length=${LEN(${str})})
exten =&gt; s,n,While($[${i} &lt; ${length}])
exten =&gt; s,n,GotoIf($["${str:${i}:1}" != "${find}"]?continue)
exten =&gt; s,n,Set(pre=)
exten =&gt; s,n,GotoIf($["${i}" = "0"]?post)
exten =&gt; s,n,Set(pre=${str:0:${i}})
exten =&gt; s,n(post),Set(post=)
exten =&gt; s,n,GotoIf($["${i}" = $[${length} - 1]]?write)
exten =&gt; s,n,Set(post=${str:$[${i} + 1]})
exten =&gt; s,n(write),Set(str=${pre}${replace}${post})
exten =&gt; s,n(continue),Set(i=$[${i} + 1])
exten =&gt; s,n,EndWhile
exten =&gt; s,n,Set(REPLACERESULT=${str})

```