| Both sides previous revision Previous revision Next revision | Previous revision |
| vendors:cisco:uc:ucce:cvp:java [2021/06/30 11:44] – [Convert a Number to a String type with an intger value] gerardorourke | vendors:cisco:uc:ucce:cvp:java [2025/02/06 12:52] (current) – [Convert a Number to a String type with an intger value] gerardorourke |
|---|
| Reference: https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cust_contact/contact_center/customer_voice_portal/cvp11_6/programming/guide/ccvp_b_programming-guide-for-cisco-unified-11-6/ccvp_b_programming-guide-for-cisco-unified_chapter_01.html#CCVP_TP_C5C1E0C4_00 | Reference: https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cust_contact/contact_center/customer_voice_portal/cvp11_6/programming/guide/ccvp_b_programming-guide-for-cisco-unified-11-6/ccvp_b_programming-guide-for-cisco-unified_chapter_01.html#CCVP_TP_C5C1E0C4_00 |
| |
| ==== Create custom Java Code for CVP==== | ===== Create custom Java Code for CVP===== |
| Add the below two “external Jar” to the Library | Add the below two “external Jar” to the Library |
| *C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.library.framework\lib\framework.jar | *C:\Cisco\CallStudio\eclipse\plugins\com.audiumcorp.studio.library.framework\lib\framework.jar |
| |
| |
| ==== Convert a Number to a String type with an intger value ==== | ===== Convert a Number to a String type with an integer value ===== |
| | Note - you don't need to do this - you can use Set value as follows: |
| | |
| | === JavaScript in Set Value node - can also do this ==== |
| | as you can see from below - do NOT use "eval" |
| | <code> |
| | var pollDurationInt; |
| | pollDurationInt = {Data.Session.pollDuration}; |
| | pollDurationInt = parseInt(pollDurationInt,10); |
| | pollDurationInt = pollDurationInt .toString(); |
| | pollDurationInt; |
| | </code> |
| |
| * Set a session variable myInt to be your number, such as the string "12.0" which gets returned from Set value | * Set a session variable myInt to be your number, such as the string "12.0" which gets returned from Set value |
| </code> | </code> |
| |
| ==== Simulate a delay ==== | ===== Simulate a delay ===== |
| <code java> | <code java> |
| // Simple Action Element to Simulate a Delay | // Simple Action Element to Simulate a Delay |
| } | } |
| </code> | </code> |
| | |
| | |
| | ===== XML Element Extract Value ===== |
| | <code java> |
| | /** |
| | * Author: Gerry O'Rourke |
| | * Date: 01 July 2021 |
| | * |
| | * This Java Class extract a value of a specific XML element. |
| | * In my use case I extract from the below SOAP XML response from LCM the value of the <strContactDetail> Element. |
| | * |
| | <?xml version="1.0"?> |
| | <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| | <soap:Header/> |
| | <soap:Body> |
| | <GetContactDetailResponse xmlns="http://tempuri.org/"> |
| | <GetContactDetailResult>1</GetContactDetailResult> |
| | <strContactDetail><DATA><BussFlds><FieldName>FirstName</FieldName><Value><![CDATA[Bob]]></Value><DataType>String</DataType><Format></Format></BussFlds><BussFlds><FieldName>LastName</FieldName><Value><![CDATA[SCA]]></Value><DataType>String</DataType><Format></Format></BussFlds><BussFlds><FieldName>RegNum</FieldName><Value><![CDATA[]]></Value><DataType>String</DataType><Format></Format></BussFlds><BussFlds><FieldName>SpeakerID</FieldName><Value><![CDATA[1872730M5BS]]></Value><DataType>String</DataType><Format></Format></BussFlds><BussFlds><FieldName>Merchant</FieldName><Value><![CDATA[Amazon]]></Value><DataType>String</DataType><Format></Format></BussFlds><BussFlds><FieldName>Amt</FieldName><Value><![CDATA[150.00]]></Value><DataType>Number</DataType><Format></Format></BussFlds><BussFlds><FieldName>CardNum</FieldName><Value><![CDATA[1234]]></Value><DataType>Number</DataType><Format>& |