Author Message
pioan2
Joined: Mar 5, 2014
Messages: 23
Offline
Hi,

A customer is having and issue with Agent pop ups,
An Avaya ticket has advised to remove the CAD field from the properties file all together , this was done however ContactData still appears as null , they want ContactData to be removed all together from the landing pad request ,
Can you please advise how?


Here is the Java code.


package flow;

import java.net.URL;
import java.util.ArrayList;
import java.util.UUID;

import com.avaya.sce.runtime.tracking.ReportInfo;
import com.avaya.sce.runtimecommon.IReportInfo;
import com.avaya.sce.runtimecommon.ITraceInfo;
import com.avaya.sce.runtimecommon.IVariable;
import com.avaya.sce.runtimecommon.IVariableField;
import com.nortel.www.soa.oi.OpenNetworking.SOAOI_OpenNetworkingSoapBindingStub;
import com.nortel.www.soa.oi.OpenNetworking.types.ReserveCDNLandingPadRequestType;
import com.nortel.www.soa.oi.OpenNetworking.types.ReserveLandingPadResponseType;
import com.nortel.www.soa.oi.cct.types.Authentication;
import com.nortel.www.soa.oi.cct.types.ContactGUID;
import com.nortel.www.soa.oi.cct.types.Intrinsic;
import com.nortel.www.soa.oi.cct.types.OpenNetReason;
import java.util.*;
import java.io.*;

/**
* A basic servlet which allows a user to define their code, generate any
* output, and to select where to transition to next. Last generated by Dialog
* Designer at: 2010-FEB-17 03:57:27 PM
*/
public class s2000_W_ReserveLandingPad extends
com.avaya.sce.runtime.BasicServlet {

// {{START:CLASS:FIELDS
// }}END:CLASS:FIELDS
String url;
String cad;
String dest;
String key1, key2, key3, key4, key5;
String value1, value2, value3, value4, value5;
String xfer;
String uui;
String uuiprefix;

/**
* Default constructor Last generated by Dialog Designer at: 2010-FEB-17
* 03:57:27 PM
*/
public s2000_W_ReserveLandingPad() {
// {{START:CLASS:CONSTRUCTOR
super();
// }}END:CLASS:CONSTRUCTOR
}

/**
* This method allows for custom integration with other Java components. You
* may use Java for sophisticated logic or to integrate with custom
* connectors (i.e. JMS, custom web services, sockets, XML, JAXB, etc.)
*
* Any custom code added here should work as efficiently as possible to
* prevent delays. It's important to design your callflow so that the voice
* browser (Voice Portal/IR) is not waiting too long for a response as this
* can lead to a poor caller experience. Additionally, if the response to
* the client voice browser exceeds the configured timeout, the platform may
* throw an "error.badfetch".
*
* Using this method, you have access to all session variables through the
* SCESession object.
*
* The code generator will *** NOT *** overwrite this method in the future.
* Last generated by Dialog Designer at: 2010-FEB-17 03:57:27 PM
*/
public void servletImplementation(
com.avaya.sce.runtimecommon.SCESession mySession) {

try {
Properties config;
config = new Properties();
InputStream ras = null;
try {
ras = this.getServletContext().getResourceAsStream(
"/config.properties");
config.load(ras);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (ras != null) {
try {
ras.close();
} catch (IOException e) {
}
}
}

// dest = config.getProperty("DestinationCDN"); uncomment for test
// purposes
dest = mySession.getVariableField(
IProjectVariables.APPDATA,
IProjectVariables.APPDATA_FIELD_TRANSFERDEST)
.getStringValue();


String defaultdest = mySession.getVariableField(
IProjectVariables.APPDATA,
IProjectVariables.APPDATA_FIELD_TRANSFERDEST)
.getStringValue();

// String
// transferdest=mySession.getVariableField(IProjectVariables.APPDATA,
// IProjectVariables.ap.APPDATA_FIELD_DEFAULT__CDN).getStringValue();
/*String Transfertypeval;
if (dest.equalsIgnoreCase(defaultdest)) {
Transfertypeval = "0";

System.out.println("Default dest transfer! " + defaultdest
+ " Transfertypeval:" + Transfertypeval);
} else {

char transferdestfirstchar = defaultdest.charAt(0);

// if first char is zero the this is an agent transfer
// destination
if (Character.toString(transferdestfirstchar).equalsIgnoreCase(
"0")) {

Transfertypeval = "1";

System.out.println("Agent transfer! " + defaultdest
+ " starts with 0 Transfertypeval:"
+ Transfertypeval);

} else {
Transfertypeval = "2";
System.out.println("Extension transfer! " + defaultdest
+ " Transfertypeval:" + Transfertypeval);

}
}*/

try {

if (mySession.getVariableField(IProjectVariables.SITE)
.getStringValue() != null)

{
String site = mySession.getVariableField(
IProjectVariables.APPDATA, IProjectVariables.SITE)
.getStringValue();
if (site.equalsIgnoreCase("CARDIFF")) {
url = config.getProperty("URLCARDIFF");
} else if (site.equalsIgnoreCase("SWANSEA")) {
url = config.getProperty("URLSWANSEA");
} else {
url = config.getProperty("URLCARDIFF");
}
} else {
url = config.getProperty("URLCARDIFF");
}
} catch (Exception ex)

{
url = config.getProperty("URLCARDIFF");
}

// url = config.getProperty("URL");
cad = config.getProperty("CAD");
xfer = config.getProperty("XFER");
uui = config.getProperty("UUI");

uuiprefix = config.getProperty("UUIPrefix");


String CALL_ID;

String ucid = mySession.getVariable(IProjectVariables.SESSION)
.getComplexVariable().getField(
IProjectVariables.SESSION_FIELD_UCID).getStringValue();

if (ucid == null || "".equals(ucid) || "undefined".equals(ucid)) {
String avpSessionId = mySession.getVariable(
IProjectVariables.SESSION).getComplexVariable().getField(
IProjectVariables.SESSION_FIELD_SESSIONID).getStringValue();

if (avpSessionId == null || "".equals(avpSessionId)) {
String randomuuid = UUID.randomUUID().toString();
System.out.println("Contact GUID = Random UUID [" + randomuuid + "]");
CALL_ID=randomuuid;
}
else
{
CALL_ID=avpSessionId;
}
}
else
{
CALL_ID=ucid;
}


/*
* uncomment for test purposes key1 = config.getProperty("key1");
*
* value1 = config.getProperty("value1"); key2 =
* config.getProperty("key2"); value2 =
* config.getProperty("value2");
* key3 = config.getProperty("key3");
*value3 = config.getProperty("value3");

*/

key1 = "TransferDestination";
value1 = defaultdest;

//key2 = "TransferDest";
key2 = "agentid";
value2 = defaultdest;

uui = "agentid=" + defaultdest + ";";

key3="UCID";
value3=CALL_ID;
// uui = "TransferDestination=" + defaultdest + ";";


key4 = config.getProperty("key4");
value4 = config.getProperty("value4");
key5 = config.getProperty("key5");
value5 = config.getProperty("value5");

// Currently logging to Tomcat console window. This can be replaced
// with
// other log/tracing mechanism as required.


if(mySession.isAppTraceEnabled())
{
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, "\nIncoming call received for XferToLandingPad.");
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, "Destination CDN: [" + dest + "]");
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, "Transfer type: [" + xfer + "]");
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, "Contact Center CDN and URL:"+ dest + "; " + url);

mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, ("Key/Values 1: [" + key1 + ": " + value1 + "]"));
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, (" 2: [" + key2 + ": " + value2 + "]"));
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, (" 3: [" + key3 + ": " + value3 + "]"));
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, (" 4: [" + key4 + ": " + value4 + "]"));
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, (" 5: [" + key5 + ": " + value5 + "]"));


mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, ("UUI from Config file: [" + uui + "]"));
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, ("UUI prefix: [" + uuiprefix + "]"));


}
System.out
.println("\nIncoming call received for XferToLandingPad.");

System.out.println("Destination CDN: [" + dest + "]");
System.out.println("Transfer type: [" + xfer + "]");

ReportInfo report = new com.avaya.sce.runtime.tracking.ReportInfo(
IReportInfo.REPORT_TYPE_PROGRESS,
IReportInfo.ALARM_LEVEL_INFO, "lpxfer",
"Contact Center CDN and URL:", dest + "; " + url);

report.trackItems(mySession);

System.out.println("Key/Values 1: [" + key1 + ": " + value1 + "]");
System.out.println(" 2: [" + key2 + ": " + value2 + "]");
System.out.println(" 3: [" + key3 + ": " + value3 + "]");
System.out.println(" 4: [" + key4 + ": " + value4 + "]");
System.out.println(" 5: [" + key5 + ": " + value5 + "]");

System.out.println("UUI from Config file: [" + uui + "]");
System.out.println("UUI prefix: [" + uuiprefix + "]");

IVariable var = mySession.getVariable(IProjectVariables.XFER__TYPE);
IVariableField field = var.getSimpleVariable();
field.setValue(xfer);

var = mySession.getVariable(IProjectVariables.UUIDATA);
field = var.getSimpleVariable();
field.setValue(uui);

var = mySession.getVariable(IProjectVariables.UUIPREFIX);
field = var.getSimpleVariable();
field.setValue(uuiprefix);

// Begin web service invokation
SOAOI_OpenNetworkingSoapBindingStub ws = new SOAOI_OpenNetworkingSoapBindingStub(
new URL(url), null);

ws.setTimeout(5000);



ReserveCDNLandingPadRequestType reserveCDNLandingPadRequestType = new ReserveCDNLandingPadRequestType();

reserveCDNLandingPadRequestType
.setContactGUID(getContactGUID(mySession));

reserveCDNLandingPadRequestType
.setDestinationCDN(getDestinationCDN(mySession));

reserveCDNLandingPadRequestType
.setIntrinsics(getIntrinsics(mySession));

reserveCDNLandingPadRequestType
.setReasonCode(getReasonCode(mySession));

reserveCDNLandingPadRequestType
.setAuthentication(getAuthentication(mySession));

if (cad != null || cad != "" || cad != "undefined") {
if(mySession.isAppTraceEnabled())
{
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, "\nIncoming call received for XferToLandingPad.");
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, ("Setting CAD: [" + cad + "]"));
}
System.out.println("Setting CAD: [" + cad + "]");
reserveCDNLandingPadRequestType
.setContactData(getContactData(mySession));
}

ReserveLandingPadResponseType reserveLandingPadResponseType = ws
.reserveCDNLandingPad(reserveCDNLandingPadRequestType);

String landingPad = reserveLandingPadResponseType
.getLandingPadCDN().getName();

if(mySession.isAppTraceEnabled())
{
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, ("LandingPad returned from CC: [" + landingPad
+ "]"));

}

System.out.println("LandingPad returned from CC: [" + landingPad
+ "]");

mySession.getVariable(IProjectVariables.LANDING_PAD)
.getSimpleVariable().setValue(landingPad);
} catch (Exception e) {
System.err
.println("Exception caught trying to call the landing pad web service ["
+ e.getClass().getName()
+ "] ["
+ e.getMessage()
+ "]");

if(mySession.isAppTraceEnabled())
{
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, ("Exception caught trying to call the landing pad web service ["
+ e.getClass().getName()
+ "] ["
+ e.getMessage()
+ "]"));

}
e.printStackTrace();

ReportInfo exceptionreport = new com.avaya.sce.runtime.tracking.ReportInfo(
IReportInfo.REPORT_TYPE_PROGRESS,
IReportInfo.ALARM_LEVEL_MAJOR, "lpxfer",
"Landing Pad reservation failed.", e.getClass().getName());

exceptionreport.trackItems(mySession);
}
}

private ContactGUID getContactGUID(
com.avaya.sce.runtimecommon.SCESession mySession) {
ContactGUID contactGUID = new ContactGUID();

String ucid = mySession.getVariable(IProjectVariables.SESSION)
.getComplexVariable()
.getField(IProjectVariables.SESSION_FIELD_UCID)
.getStringValue();

if (ucid == null || "".equals(ucid) || "undefined".equals(ucid)) {
String avpSessionId = mySession
.getVariable(IProjectVariables.SESSION)
.getComplexVariable()
.getField(IProjectVariables.SESSION_FIELD_SESSIONID)
.getStringValue();

if (avpSessionId == null || "".equals(avpSessionId)) {
String uuid = UUID.randomUUID().toString();
if(mySession.isAppTraceEnabled())
{
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, ("Contact GUID = Random UUID [" + uuid + "]"));

}
System.out.println("Contact GUID = Random UUID [" + uuid + "]");
contactGUID.setGuid(uuid);
} else {
if(mySession.isAppTraceEnabled())
{
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO, "Contact GUID = AVP Session ID ["
+ avpSessionId + "]");

}

System.out.println("Contact GUID = AVP Session ID ["
+ avpSessionId + "]");
contactGUID.setGuid(avpSessionId);
}
} else {
if(mySession.isAppTraceEnabled())
{
mySession.getTraceOutput().writeln(ITraceInfo.TRACE_LEVEL_INFO,"Contact GUID = UCID [" + ucid + "]");

}
System.out.println("Contact GUID = UCID [" + ucid + "]");
contactGUID.setGuid(ucid);
}

ReportInfo report = new com.avaya.sce.runtime.tracking.ReportInfo(
IReportInfo.REPORT_TYPE_PROGRESS, IReportInfo.ALARM_LEVEL_INFO,
"lpxfer", "Shared Contact id:", contactGUID.getGuid());

report.trackItems(mySession);

return contactGUID;
}

private String getDestinationCDN(
com.avaya.sce.runtimecommon.SCESession mySession) {
return dest;
}

private String getContactData(
com.avaya.sce.runtimecommon.SCESession mySession) {
StringBuffer contactData = new StringBuffer();
contactData.append(cad);
return contactData.toString();
}

private Intrinsic[] getIntrinsics(
com.avaya.sce.runtimecommon.SCESession mySession) {
ArrayList<Intrinsic> intrinsicArrayList = new ArrayList<Intrinsic>();

// Important that key values are unique, or Landing pad reservation will
// fail
if (key1 != null && key1 != "" && key1 != "undefined") {
intrinsicArrayList.add(getIntrinsic(key1, value1));
}

if (key2 != null && key2 != "" && key2 != "undefined") {
intrinsicArrayList.add(getIntrinsic(key2, value2));
}

if (key3 != null && key3 != "" && key3 != "undefined") {
intrinsicArrayList.add(getIntrinsic(key3, value3));
}

if (key4 != null && key4 != "" && key4 != "undefined") {
intrinsicArrayList.add(getIntrinsic(key4, value4));
}

if (key5 != null && key5 != "" && key5 != "undefined") {
intrinsicArrayList.add(getIntrinsic(key5, value5));
}

Intrinsic[] intrinsic = new Intrinsic[intrinsicArrayList.size()];
return intrinsicArrayList.toArray(intrinsic);
}

private Intrinsic getIntrinsic(String key, String value) {
Intrinsic i = new Intrinsic();
i.setKey(key);
i.setValue(value);
return i;
}

private OpenNetReason getReasonCode(
com.avaya.sce.runtimecommon.SCESession mySession) {
return OpenNetReason.TRANSFER_OPEN_NET_INIT;
}

private Authentication getAuthentication(
com.avaya.sce.runtimecommon.SCESession mySession) {
Authentication authentication = new Authentication();
authentication.setUsername("OpenWsUser");
authentication.setPassword("Password123");
authentication.setDomain("open_networking");
return authentication;
}

/**
* Builds the list of branches that are defined for this servlet object.
* This list is built automatically by defining Goto nodes in the call flow editor.
* It is the programmer's responsibilty to provide at least one enabled Goto.<BR>
*
* The user should override updateBranches() to determine which Goto that the
* framework will activate. If there is not at least one enabled Goto item,
* the framework will throw a runtime exception.<BR>
*
* This method is generated automatically and changes to it may
* be overwritten next time code is generated. To modify the list
* of branches for the flow item, override:
* <code>updateBranches(Collection branches, SCESession mySession)</code>
*
* @return a Collection of <code>com.avaya.sce.runtime.Goto</code>
* objects that will be evaluated at runtime. If there are no gotos
* defined in the Servlet node, then this returns null.
* Last generated by Orchestration Designer at: 2016-NOV-10 12:24:33 AM
*/
public java.util.Collection getBranches(com.avaya.sce.runtimecommon.SCESession mySession) {
java.util.List list = null;
com.avaya.sce.runtime.Goto aGoto = null;
list = new java.util.ArrayList(1);

aGoto = new com.avaya.sce.runtime.Goto("Prepare_UUI", 0, true, "Default");
list.add(aGoto);

return list;
}
}
RossYakulis
Joined: Nov 6, 2013
Messages: 2652
Offline
I can only help with Orchestration Designer Dialog Designer. Perhaps there is another forum for this post? I believe this is an AACC question.
Go to:   
Mobile view