cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1700
Views
6
Helpful
9
Replies

ICM Escape Character? e.g. to set double quote within a string

Gerry O'Rourke
Spotlight
Spotlight

Does ICM scripting have an Escape Character for a double quote?

e.g. so you can set double quote within a string

Example:

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?

Gerry

9 Replies 9

janinegraves
Spotlight
Spotlight

Can you instead use single quotes around the inner string?

Janine,

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?

Gerry

hemajosh
Level 4
Level 4

Hi Gerry,

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.

Varible_doublequotes.pngDB_var_doublequotes.png

Let me know if this answers your query.

Regards

Hemant

Hemant,

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.

Gerry

Gerry,

I don't know of any ICM escape character, but here's one way you could get a quote character...

  1. 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".
  2. Add a row to the t_Quote table with ID of 1 and Character of " (double quote).
  3. In ICM, configure a DB Lookup for the new table.
  4. In your script, do a DB Lookup against t_Quote with a lookup value of 1. Save this in a variable of your choosing.
  5. 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.

-Jameson

-Jameson

Jameson,

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!

Gerry

Gerry,

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.

-Jameson

-Jameson

Hi Gerry,

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.

Bing.

Bing,

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.

Gerry

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: