Passing Literals With Commas To Subroutine
Hi,
Let’s say I do:
Set(data=xxx,yyy)
Gosub(my-sub,s,1(${data}))
My subroutine will only receive “xxx” for ARG1. How can I pass a literal with a comma to a single argument in a subroutine?
(The point is: when calling the subroutine I do not know if the variable has a comma or not.)
Thanks, Daniel
2 thoughts on - Passing Literals With Commas To Subroutine
You can escape characters with a backslash, I’ve not tried it in this case but it may help you.
Another idea is you could encode your data with the BASE64_ENCODE or URIENCODE * functions and decode it in your subroutine.
https://wiki.asterisk.org/wiki/display/AST/Function_BASE64_ENCODE
https://wiki.asterisk.org/wiki/display/AST/Function_URIENCODE
* I’m not certain if URIENCODE will escape the comma, it sounds like it should reading the RFC.
What happens if you use speech marks around the variable, like so: “${data}” ?