Does ICM scripting have an Escape Character for a double quote?
e.g. so you can set double quote within a string
You want to set PeripheralVariable1 to the Value of : "Jane said "Hello""
The first and last double quotes contain a string which itself has two double quotes.
Is this possible to do?
Can you instead use single quotes around the inner string?
Single quotes are allowed, but I need double quotes for my use case.
I want to set a SIP header which contains a string value which includes double quotes.
My example above of setting PV1 to "Jane said "Hello"" is just a simple test case.
Ampersand (&) can be set when sending variables to CVP by using the semi colon.
I wonder if there is a similar way to send a double quote?
If you want to use double quotes, You can use two single quotes( ' ) together to replace double quotes.
I tested the same on my lab and found the positive results as needed in your case.
Below are the screenshots from my lab where I created a variable with value " Hello ''Welcome''". Also verified within the DB that the same value is dumping properly.
Let me know if this answers your query.
That is an interesting and simple way to achieve this. So many thanks for your response.
Visually the two single quotes will LOOK the same a s double quote
But will they be interrupted the same?
Example - lets say you want to set a SIP header
ExampleSipHeader: "This is test data"
Will the above interpret these as double quotes by the endpoint / device that receives it or not?
What might occur with your workaround, is that it interprets it two single quotes, which is not necessary the same thing, even though visually they look the same.
I should be able to test using wireshark and confirm.
I will update later this week.
I don't know of any ICM escape character, but here's one way you could get a quote character...
- Create a database table in a SQL database. For this example I'll call it t_Quote, with columns "ID" (made as the primary key) and "Character".
- Add a row to the t_Quote table with ID of 1 and Character of " (double quote).
- In ICM, configure a DB Lookup for the new table.
- In your script, do a DB Lookup against t_Quote with a lookup value of 1. Save this in a variable of your choosing.
- When you need a double-quote, concatenate the value of your quote variable with the data you need as necessary.
Certainly not the cleanest solution, but this is one potential way of getting the specific character you need. You could even go so far as to create an ASCII table in SQL which contains all or most of the 128 ASCII codes. Double Quotes would be "34" in that case.
I'd be curious to see what these write out to the Termination_Call_Detail table as... if there is an ICM escape character, it might show up when the data gets there.
I believe that solution would definitely work. It is a bit of a pain, but its looks like a good workaround.
I was thinking of something similar, by grabbing a double quote from the SIP header "Remote-Party-ID".
But your way is nicer.
ICM Lookups not supported on PCCE and I wonder if CVP Studio app can pass back a double quote or not?
Would need to test.
I will check both of options out in next week or so.
Many thanks for the responses guys!
You'll probably have a lot of trouble passing any quotes from a CVP app - I believe quotes are not supported characters for VXML. Not sure if you can escape them or not.
Grabbing a quote from a known location in existing SIP headers is a good option. If you can do this reliably from a formula, you could make a custom formula to reproduce it for you. Storing the result in a persistent user variable is an option as well, though I'm thinking it would have to be redone after any complete Router process shutdown.
maybe you can try use "%22" as escape character of double quote.
I once used the workaround to pass some special characters from ICM to CVP.
let's suppose you want to pass 123"abc to CVP
in ICM, you can set variable as "123%22abc"
it could be successfully passed to CVP without any issue.
then in CVP, you can easily access it using a custom element using java code.
in java code, you can just replace "%22" with double quote using "String.Replace" or you can user "URLEncoder" to do the same trick.
I tried %22. Nice idea, but It didn't work.
i.e. if you put set "22blah%22" into a SIP header, it comes up as %22blah%22 and not as "blah" as I want.