I've got an ODBC function that's pulling multiple values from my database and storing them in an array of variables. Later in the dialplan I'm using that variable, but all the double quote marks are getting removed – single quotes are untouched. If I store the value directly into a variable (as opposed to an array) quotes are maintained, but of course a comma-delimited string is not very usable.
Dialplan:
exten => 123,1,Set(ARRAY(FOO,BAR)=${MY_FUNC()})
exten => 123,2,NoOp(The value is now '${FOO}')
exten => 123,3,Set(FOO=${MY_FUNC()})
exten => 123,4,NoOp(The value is now '${FOO}')
Output:
Executing [123@mycontext:1] Set("SIP/7040-0000105b", "ARRAY(FOO,BAR)=I am "testing" it,23") in new stack
Executing [123@mycontext:2] NoOp("SIP/7040-0000105b", "The value is now 'I am testing it'") in new stack
Executing [123@mycontext:3] Set("SIP/7040-0000105b", "FOO=I am "testing" it,23") in new stack
Executing [123@mycontext:4] NoOp("SIP/7040-0000105b", "The value is now 'I am "testing" it,23'") in new stack
I've tried wrapping the function call in quotes, I have tried prefixing a backslash at the database level. Nothing seems to work, they are always removed.
Using HASH
as suggested below does not change anything:
exten => 123,1,Set(HASH(FOO)=${MY_FUNC()})
exten => 123,2,NoOp(The value is now '${HASH(FOO,data1)}')
Output:
Executing [123@mycontext:1] Set("SIP/7040-00002bf9", "HASH(FOO)=I am "testing" it,23") in new stack
Executing [123@mycontext:2] NoOp("SIP/7040-00002bf9", "The value is now 'I am testing it'") in new stack
Storing data in an array is not a requirement, but I am pulling multiple values from the database and need to access them without corrupting the values, and without resorting to multiple functions each pulling a single value.
Try escaping the double quotes, it will work.