0% found this document useful (0 votes)
13 views58 pages

Aacc Training Course Code

The document outlines various components and use cases related to the Avaya Aura Contact Center, including real-time data monitoring, open queue web services, and SDKs for communication control. It provides detailed code examples for implementing functionalities such as logging in, creating contacts, and managing data streams. Additionally, it includes sections on networking services and transferring contacts within the system.

Uploaded by

flsibiya
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views58 pages

Aacc Training Course Code

The document outlines various components and use cases related to the Avaya Aura Contact Center, including real-time data monitoring, open queue web services, and SDKs for communication control. It provides detailed code examples for implementing functionalities such as logging in, creating contacts, and managing data streams. Additionally, it includes sections on networking services and transferring contacts within the system.

Uploaded by

flsibiya
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Avaya Aura Contact Center

CODE

1
Table of Contents
Chapter 5 - Use Case – Monitor Real Time Statistical Data with RTD API ..................3
Chapter 6 - CCMS Open Queue Web Service ...............................................................8
Chapter 7 - CCMS Open Queue SDK ..........................................................................10
Chapter 8 - CCMS Open Networking Web Service .....................................................13
Chapter 9 - CCMS Transfer to Landing Pad Use Case ................................................15
Chapter 10 - CCMS Host Data Exchange ....................................................................18
Chapter 11 - Communication Control Toolkit Open Interface SDK ............................22
Chapter 12 - Communication Control Toolkit Open Interface Event Handling ..........23
Chapter 13 - Exploring the Communications Control Toolkit Open Interfaces ...........30
Chapter 14 - Communication Control Toolkit .NET SDK ...........................................34
Chapter 15 - CCT Hot Desking ....................................................................................40
Chapter 16 - Use Case – Communications Control Toolkit Reference Clients ...........43
Chapter 20 - CCMM Agent Web Services Use Case ...................................................50
Chapter 21 - CCMM Web Communications SDK .......................................................52
Chapter 22 - CCMM Outbound SDK ..........................................................................56

2
Chapter 5 - Use Case – Monitor Real Time Statistical Data with RTD
API

#include <nirtdtyp.h>
#include <nirtdapi.h>

ULONG rc = NIrtd_eOK;

// authorization structure used by login and


// name cache
NIrtd_tAPIauth authInfo = Nirtd_NullAuth;;

// Perform login to the server


rc = NIrtd_login(&authInfo, ipAddress,
username, password);

if (rc != NIrtd_eOK)
{
_tprintf(_T("\nNIrtd_login - failed to login: return code = %d"),
rc);
return;
}
else
{
_tprintf(_T("\nNIrtd_login - success : return code = %d"), rc);
};

// setup name cache for SkillsetID to SkillsetName translation


rc = NIrtd_getNameCacheforDataColumn(&authInfo,
NIrtd_SKLST_SKILLSET_ID);
if (rc != NIrtd_eOK)
{
_tprintf(_T("\nNIrtd_getNameCacheforDataColumn failed : rc = %d"),
rc);
rc = NIrtd_logout(&authInfo);
return;
}
else
{
_tprintf(_T("\nNIrtd_getNameCacheforDataColumn succeeded."));
}

// allocate and initialize the query structure


rc = NIrtd_allocateQuery(&query, NIrtd_INTRVL_SKLST);
if (rc != NIrtd_eOK)
{
_tprintf(_T("\nNIrtd_allocateQuery failed : rc = %d"), rc);
rc = NIrtd_logout(&authInfo);
return;

3
}
else
{
_tprintf(_T("\nNIrtd_allocateQuery succeeded."));
};

// select skillset ID as the first column


rc = NIrtd_selectColumn(&query, NIrtd_SKLST_SKILLSET_ID);
if (rc != NIrtd_eOK)
{
_tprintf(_T("\nNIrtd_selectColumn failed : rc = %d"), rc);
rc = NIrtd_freeQuery(&query);
rc = NIrtd_logout(&authInfo);
return;
}
else
{
_tprintf(_T("\nNIrtd_SKLST_SKILLSET_ID Column selected."));
}

// select number of agent available as the second column


rc = NIrtd_selectColumn(&query, NIrtd_SKLST_AGENT_AVAIL);
if (rc != NIrtd_eOK)
{
_tprintf(_T("\nNIrtd_selectColumn failed : rc = %d"), rc);
rc = NIrtd_freeQuery(&query);
rc = NIrtd_logout(&authInfo);
return;
}
else
{
_tprintf(_T("\nNIrtd_SKLST_AGENT_AVAIL Column selected."));
}

// start data stream


rc = NIrtd_startDataStream(&authInfo, &query, refresh_rate * 1000,
callback_function, (void *)NULL, &requestId);
if (rc != NIrtd_eOK)
{
_tprintf(_T("\nNIrtd_startDataStream failed : rc = %d"), rc);
rc = NIrtd_freeQuery(&query);
rc = NIrtd_logout(&authInfo);
return;
}
else
{
_tprintf(_T("\nNIrtd_startDataStream succeeded."));
}

4
// one-time data propagation
rc = NIrtd_singleDataRequest(&tableGrpPtr, &authInfo, &query);
if (rc != NIrtd_eOK)
{
_tprintf(_T("\nNIrtd_singleDataRequest failed : rc = %d"), rc);
rc = NIrtd_freeQuery(&query);
rc = NIrtd_logout(&authInfo);
return;
}
else
{
_tprintf(_T("\nNIrtd_singleDataRequest succeeded."));
}

// call back function


ULONG callback_function(ULONG return_code, NIrtd_tRequestId requestId,
NIrtd_stTableGroup *tableGroup, void *yourPointer)
{
_tprintf(_T("\nEnter Callback function()"));
if (return_code == NIrtd_eOK)
{
// handle the data

//free the internally allocated space for data.
NIrtd_freeTableGroup(tableGroup);
}
else
{
_tprintf(_T("Callback rc = %d"), return_code);
}
return NIrtd_eOK;
}

typedef struct _NIrtd_stTableGroup


{
NIrtd_stTable deletedValues;
NIrtd_stTable newValues;
NIrtd_stTable deltaValues;
} NIrtd_stTableGroup;
typedef struct _NIrtd_stTable
{
ULONG numberofrows;
ULONG numberofcols;
NIrtd_tTable table;
} NIrtd_stTable;

// copy the update row content to temp row


rc = NIrtd_allocateRow(&tempRow, updateTable, i);
// Check return value and deal with errors.

5
// Allocate a value structure used to store a column value
NIrtd_stValue columnValue;
rc = NIrtd_allocateValue(&columnValue);
// Check return value and deal with errors.

// Get the data from the table.


rc = NIrtd_getCol(&columnValue, &tempRow, 0);
// Check return value and deal with errors.

// release the value structure
NIrtd_freeValue(&columnValue);

// release the tempRow for next round


NIrtd_freeRow(&tempRow);

// temporary structure used to hold skillset name


NIrtd_stName tempSkillsetName;
// allocate the name structure
rc = NIrtd_allocateName(&tempSkillsetName);
// check for error code and handle as require

rc = NIrtd_getName(&authInfo, NIrtd_SKLST_SKILLSET_ID, &skillsetId,
&tempSkillsetName);
if ( rc == NIrtd_eOK )
// Name is in tempSkillsetName.last_name
}
// cannot find the name in name cache
else if (rc == NIrtd_eNOT_FOUND)
{
// go to the server directly to retrieve the name
rc = NIrtd_getFailedName(&authInfo, NIrtd_SKLST_SKILLSET_ID,
&skillsetId, &tempSkillsetName);
if (rc != NIrtd_eOK)
{
_tprintf(_T("\nCannot find the skillset name in server"));
return;
}

// Name is in tempSkillsetName.last_name
}
else
{
_tprintf(_T("\nOther error in getting name cache : %d"), rc);
return;
}

NIrtd_freeName(&tempSkillsetName);

6
// free name cache
rc = NIrtd_removeNameCacheforDataColumn(&authInfo,
NIrtd_SKLST_SKILLSET_ID);
// stop data stream before exit
rc = NIrtd_stopDataStream(&authInfo, requestId);

// deallocate all structures allocated


rc = NIrtd_freeQuery(&query);
// perform logout
rc = NIrtd_logout(&authInfo);

rc = NIrtd_setRecovery(90000,10000);

7
Chapter 6 - CCMS Open Queue Web Service

public String queueContact(String name, String phoneNumber, String


comments) throws LogInFailedFault, CreateOQContactFailedFault,
LogOffFailedFault, LogOffSessionFailedFault {
[Link]("Queueing a contact");
instantiateProxy();
SsoToken ssoToken = logon();
IntrinsicArray intrinsics = createIntrinsics(name, phoneNumber,
comments);
String contactId=createContactId();
[Link](contactId, "OutsideSalesAgentWeb",
intrinsics, ssoToken);
logoff(ssoToken);
return "";
}

private void instantiateProxy() {


proxy=new SOAOIOpenQ().getPort([Link]);
}

private SsoToken logon() throws LogInFailedFault,


LogOffSessionFailedFault {
SsoToken ssoToken=null;
AuthenticationLevel authLevel=new AuthenticationLevel();
[Link]("open_queue");
[Link]("OpenWsUser");
[Link]("Password123");
try {
ssoToken=[Link](authLevel);
} catch(Exception ex) {
// Try to logoff and then log back in again.
LogOffSessionRequestType parms=new
LogOffSessionRequestType();
[Link](authLevel);
[Link](parms);
ssoToken=[Link](authLevel);
}
return ssoToken;
}

8
private IntrinsicArray createIntrinsics(String name, String
phoneNumber, String comments) {

IntrinsicArray intrinsics=new IntrinsicArray();


[Link]().add(createIntrinsic("NAME", name));
[Link]().add(createIntrinsic("PHONE_NUMER",
phoneNumber));
[Link]().add(createIntrinsic("COMMENTS", comments));
return intrinsics;
}

private Intrinsic createIntrinsic(String name, String value) {


Intrinsic intrinsic=new Intrinsic();
[Link](name);
[Link](value);
return intrinsic;
}

private String createContactId() {


int timeAsInt=(int) [Link]() & 0xffff;
return [Link](timeAsInt);
}

private void logoff(SsoToken ssoToken) throws LogOffFailedFault {


[Link](ssoToken);
}

9
Chapter 7 - CCMS Open Queue SDK

private OpenQ setupConnection( String wsdlLocation ) {


OpenQ port = null;
URL wsdlURL = null;
File wsdlFile = null;
try {
wsdlFile = new File(wsdlLocation);
if ([Link]()) {
wsdlURL = [Link]();
} else {
wsdlURL = new URL(wsdlLocation);
}
} catch (MalformedURLException e) {
[Link]();
}
[Link]("OIOpenQ connecting to : " + [Link]());
try {
SOAOIOpenQ ss = new SOAOIOpenQ(wsdlURL, OPENQ_SERVICE_QNAME);
port = [Link]();
[Link]("OIOpenQ connected to : " + [Link]());
} catch ( Exception ex ) {
[Link]();
}
return port;
}

private static SsoToken issueLogOnRequest( OpenQ port,


AuthenticationLevel auth ) {
SsoToken sso = null;
if ( auth != null ) {
if ( [Link]() == null ) {
[Link]("Username not specified");
} else if ( [Link]() == null ) {
[Link]("Password not specified");
} else {
try {
sso = [Link](auth);
} catch (LogInFailedFault ex) {
[Link]("Cause : " + ([Link]() != null ?
[Link]() : "unknown"));
[Link]("Message : " + ([Link]() != null ?
[Link]() : "unknown"));
[Link]();
sso = null;
}
}
} else {
[Link]("No authentication details specified");

10
}
return sso;
}

4Create a Contact
private static Contact issueCreateContactRequest(
OpenQ port,
String externalContactId,
String outOfProviderAddressName,
HashMap<String, String> intrinsicsMap,
SsoToken sso)
throws CreateOQContactFailedFault {
IntrinsicArray intrinsics = new IntrinsicArray();
if ( intrinsicsMap != null ) {
Iterator<String> specifiedIntrinsicKeysIter =
[Link]().iterator();
while ( [Link]() ) {
String intrinsicKeyStr = [Link]();
String intrinsicValueStr = [Link](intrinsicKeyStr);

Intrinsic intrinsic = [Link]().createIntrinsic();


[Link](intrinsicKeyStr);
[Link](intrinsicValueStr);
[Link](true);

[Link]().add(intrinsic);
}
}
Holder<Contact> contactHolder = new Holder<Contact>();
[Link] = [Link]().createContact();
return [Link](
externalContactId,
outOfProviderAddressName,
intrinsics,
sso);
}

private static Contact issueGetContactRequest(


OpenQ port,
String externalContactId,
SsoToken sso)
throws GetOQContactFailedFault {
return [Link](externalContactId, sso);
}

11
private static boolean issueDropContactRequest(
OpenQ port,
String contactId,
SsoToken sso) throws DropOQContactFailedFault {
return [Link](contactId, sso );
}

private static boolean issueLogOffRequest( OpenQ port, SsoToken sso ) {


boolean isLogOffSuccessful = false;
if ( sso != null ) {
try {
isLogOffSuccessful = [Link](sso);
} catch (LogOffFailedFault ex) {
[Link]();
sso = null;
}
} else {
[Link]("No SSO specified");
}
return isLogOffSuccessful;
}

12
Chapter 8 - CCMS Open Networking Web Service

public String reserveLandingPad(String destinationCDN, String


contactData)
throws Exception {
SOAOIOpenNetworking service = new SOAOIOpenNetworking();
OpenNetworking proxy = [Link]([Link]);
ReserveCDNLandingPadRequestType parameters =
new ReserveCDNLandingPadRequestType();
Authentication authentication = buildAuthentication();
[Link](authentication);
[Link](contactData);
[Link](createNewContactId());
[Link](destinationCDN);
[Link](new IntrinsicArray());
[Link](OpenNetReason.TRANSFER_OPEN_NET_INIT);
ReserveLandingPadResponseType resp =
[Link](parameters);
//User interface should tell user to do the transfer after we
return.
return [Link]().getName();
}

public void completeTransfer(String landingPadCDN)


throws LandingPadCancellationFault {
SOAOIOpenNetworking service = new SOAOIOpenNetworking();
OpenNetworking proxy = [Link]([Link]);
Authentication authentication=buildAuthentication();
// Release the landing pad
CancelCDNLandingPadRequestType cancelParameters =
new CancelCDNLandingPadRequestType();
[Link](authentication);
[Link](landingPadCDN);
[Link](cancelParameters);
}

private Authentication buildAuthentication() {


Authentication authentication = new Authentication();
[Link]("OpenWsUser");
[Link]("Password123");
[Link]("open_networking");
return authentication;
}

13
private ContactGUID createNewContactId() {
ContactGUID contactGUID = new ContactGUID();
[Link]([Link]((int)
([Link]() & 0xffff)));
return contactGUID;
}

14
Chapter 9 - CCMS Transfer to Landing Pad Use Case

package [Link];
//..import statements not shown for brevity…
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.4-b01
* Generated source version: 2.2
*
*/
@WebService(name = "OpenNetworking", targetNamespace =
"[Link]
@SOAPBinding(parameterStyle = [Link])
@XmlSeeAlso({
[Link],
[Link],

org.oasis_open.[Link]._2004._06.wsrf_ws_basefaults_1_2_draft_01.Obje
[Link],
[Link]._2003._03.[Link]
})

public interface OpenNetworking {


/**
*
* @param parameters
* @return
* returns
[Link]
* @throws LandingPadReservationFault
*/
@WebMethod(operationName = "ReserveCDNLandingPad", action =
"[Link]
@WebResult(name = "ReserveLandingPadResponse", targetNamespace =
"[Link] partName =
"parameters")
public ReserveLandingPadResponseType reserveCDNLandingPad(
@WebParam(name = "ReserveCDNLandingPadRequest", targetNamespace
= "[Link] partName =
"parameters")
ReserveCDNLandingPadRequestType parameters)
throws LandingPadReservationFault
;
// Other methods not shown for brevity.
}

15
public class ReserveLandingPadTest {
private static final String
OI_WSDL="[Link]
private static final String
BAD_OI_WSDL="[Link]
wsdl";

@Test
public void testGetProxy() throws Exception {
URL wsdlUrl=new URL(OI_WSDL);

SOAOIOpenNetworking service=new SOAOIOpenNetworking(wsdlUrl);


OpenNetworking proxy=[Link]([Link]);

@Test(expected=[Link])
public void testBadGetProxy() throws Exception {
URL wsdlUrl=new URL(BAD_OI_WSDL);

SOAOIOpenNetworking service=new SOAOIOpenNetworking(wsdlUrl);


OpenNetworking proxy=[Link]([Link]);

}
}

@Test
public void testReserveLandingPad() throws Exception {
URL wsdlUrl=new URL(OI_WSDL);

SOAOIOpenNetworking service=new SOAOIOpenNetworking(wsdlUrl);


OpenNetworking proxy=[Link]([Link]);

ReserveCDNLandingPadRequestType parameters=new
ReserveCDNLandingPadRequestType();
Authentication authentication=new Authentication();
[Link]("OpenWsUser");
[Link]("Password123");
[Link]("open_networking");
[Link](authentication);

[Link]("landingPadAttachedData");

ContactGUID contactGUID=new ContactGUID();


[Link]("12667");
[Link](contactGUID);

[Link]("1501");
[Link](new IntrinsicArray());
[Link](OpenNetReason.TRANSFER_OPEN_NET_INIT);

16
[Link](parameters);
ReserveLandingPadResponseType
response=[Link](parameters);
[Link](response);
[Link]([Link]());
}

package [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class PropertyPrinter {


public static void printDetails(Object o) {
try {
BeanInfo info = [Link]([Link]());
for (PropertyDescriptor pd: [Link]()) {
Method readMethod=[Link]();
if (readMethod != null) {
Object value=[Link](o, new Object[0]);
[Link](" %s=%s\n", [Link](), value);
}
}
} catch (Exception e) {
[Link]();
}
}
}

//In real life, we'd execute the transfer here.

// Release the landing pad


CancelCDNLandingPadRequestType cancelParameters=new
CancelCDNLandingPadRequestType();
[Link](authentication);

[Link]([Link]().getName()
);
[Link]("Cancel parameters...");
[Link](cancelParameters);
CancelLandingPadResponseType
cancelResponse=[Link](cancelParameters);
[Link]("response...");
[Link](cancelResponse);

17
Chapter 10 - CCMS Host Data Exchange

interface NIDXProvider
{
// Some definitions omitted for clarity
NIDXProviderMessaging DX_RegisterProvider(
in NTUINT32 providerId,
in UserId userIdp,
in Version versionp)
raises(OperationFailed );
void DX_DeRegisterProvider(
in NIDXProviderMessaging providerMsgObj)
raises (OperationFailed);
void DX_KeepAliveProvider(
in NTUINT32 providerId)
raises(OperationFailed );
};

interface NIDXProviderMessaging
{
// Some definitions omitted for clarity
void DX_GetMessage(
in DxOperationMode opMode,
out HDXMessage message)
raises (OperationFailed);
void DX_MessageResponse(
in HDXMessage message)
raises (OperationFailed);
};

struct HDXMessage
{
NTUINT32 MsgReferenceId;
NTUINT32 MsgProviderId;
NTUINT32 MsgApplicationId;
NTUINT32 MsgType;
DxCallId HdxCallId;
NTUINT32 Time;
InfoList Info;
NTUINT32 Reserved[10];
};

typedef unsigned short NTCHAR;


typedef unsigned short NTUINT16;
typedef unsigned long NTUINT32;
const NTUINT32 NI_ELEMENT_SEQ = 10;
const NTUINT32 NI_INFO_SIZE = 80;
typedef sequence<NTCHAR, NI_INFO_SIZE> InfoCell;
typedef sequence<InfoCell, NI_ELEMENT_SEQ> InfoList;

18
idlj –td src [Link]
idlj –td src [Link]

private NIDXProvider findProviderInterface()


throws InvalidName, CannotProceed, NotFound, InvalidName {
String[] orbArgs = {"-ORBInitRef",
"NameService=corbaloc:iiop:" +
nameServiceHost + ":" + nameServicePort
+ "/NameService"};
ORB orb = [Link](orbArgs, null);
[Link] obj =
orb.resolve_initial_references("NameService");
NamingContextExt ctx =
[Link](obj);
NIDXProvider providerInterface =

[Link](ctx.resolve_str("NortelNetworks/SymposiumCall
CenterServer/HDX"));
return providerInterface;
}

@Test
public void testReceiveSyncMessage() throws Exception {
NIDXProvider providerInterface = findProviderInterface();
UserId uid = new
UserId(CORBATools.string2short("nortel",
[Link]),
CORBATools.string2short("nortel",
[Link]));
Version version = new Version(HDX_MajVersion.value,
HDX_KeepAliveMinVersion.value);
NIDXProviderMessaging messaging =
providerInterface.DX_RegisterProvider(2106,
uid, version);
HDXMessageHolder messageHolder = new HDXMessageHolder();
// cont’d …

// See code on previous page…


[Link]("Waiting for message from AACC...");
try {
messaging.DX_GetMessage(DxOperationMode.DXOM_SYNC,
messageHolder);
} catch (OperationFailed ex) {
String reason = reasonToString([Link]);
[Link]([Link],
"Operation failed: reason="
+ reason, ex);
throw ex;
}

19
// cont’d…

// See code above…


logMessage([Link], [Link]);
if ([Link] ==
DxMessageType._DXMT_ReqRespMsg) {
/*
* We'll go ahead and use the same message,
* so as to preserve the
* header info.
*/
[Link]("Replying to message.");
HDXMessage message = [Link];
[Link] = DxMessageType._DXMT_RespMsg;
[Link] =
[Link](new String[]{"Sample output"},
10, 80);
messaging.DX_MessageResponse(message);
}
}

String reasonToString(short reason) {


if (reason == ExceptionReason._CannotCreateMessage) {
return "Cannot create message";
}
if (reason == ExceptionReason._InvalidObject) {
return "Invalid Object";
}
if (reason == ExceptionReason._InvalidOperationMode) {
return "Invalid operation mode";
}
if (reason == ExceptionReason._InvalidResponseMessage) {
return "Invalid response message";
}
if (reason == ExceptionReason._InvalidTargetId) {
return "Invalid target ID";
}
if (reason == ExceptionReason._NoMessage) {
return "No message";
}
return "Unknown reason " + reason;
}

private void logMessage(Level level, HDXMessage message) {


String output = "Received message:"
+ "\n MessageReferenceId:" + [Link]
+ "\n MessageProviderId:" + [Link]
+ "\n MessageApplicationId:" + [Link]
+ "\n MessageType:" + [Link]
+ "\n Time:" + [Link];

20
List<String> parameters = [Link]([Link]);
output = output + "\n" + "Parameters: " + parameters;
[Link](level, output);
}

public static List<String> toStrings(short[][] input) {


List<String> strings = new ArrayList<String>();
for (short[] item : input) {
makeAndAppendString(item, strings);
}
return strings;
}

private static void makeAndAppendString(short[] item, List<String>


strings) {
StringBuilder sb = new StringBuilder();
int i = 0;
while (i < [Link] && item[i] != 0) {
[Link]((char) item[i]);
i++;
}
[Link]([Link]());
}
static short[][] toInfo(String[] input, int n, int len) {
short[][] info = new short[n][len];
for (int i = 0; i < [Link]; i++) {
writeStringToShortArray(info[i], input[i]);
}
return info;
}
private static void writeStringToShortArray(short[] item, String
input) {
for (int j = 0; j < [Link]; j++) {
item[j] = (j < [Link]())
? (short) [Link](j) : 0;
}
}
}

21
Chapter 11 - Communication Control Toolkit Open Interface SDK

SsoToken ssoToken = null;


SOAOICCTUserService userService = null;
UserService userServiceProxy = null;

public void logon(String userID, String password)


throws LogInToCCTServerException {
/* Login. */
userService = new SOAOICCTUserService();
userServiceProxy = [Link]([Link]);
LogInToCCTServerRequest req = new LogInToCCTServerRequest();
AuthenticationLevel authLevel = new AuthenticationLevel();
[Link]("edsremote");
[Link](password);
[Link](userID);
[Link](authLevel);
ssoToken = [Link](req).getSsoToken();
[Link]("ssoToken is " + [Link]());
}

public void logoff()


throws LogOffFromCCTServerException, SessionNotCreatedException
{
/* Logoff. */
[Link]("Attempting logoff with ssoToken='%s' \n",
[Link]());
LogOffFromCCTServerRequest req = new
LogOffFromCCTServerRequest();
[Link](ssoToken);
[Link](req);
}

22
Chapter 12 - Communication Control Toolkit Open Interface Event
Handling

@WebService(name = "NotificationConsumer", targetNamespace =


"[Link]

public interface NotificationConsumer {


/**
*
* @param notificationMessage
*/
@WebMethod(operationName = "Notify", action =
"[Link]
@Oneway
@RequestWrapper(localName = "Notify", targetNamespace =
"[Link]
className = "[Link]")
public void notify(
@WebParam(name = "NotificationMessage", targetNamespace =
"[Link]
List<NotificationMessageHolderType> notificationMessage);
}

@WebService(

endpointInterface="[Link]
ionConsumer")
public class MyPrivateListener implements NotificationConsumer {
@Override
public void notify(List<NotificationMessageHolderType>
notificationMessage) {
for(NotificationMessageHolderType note: notificationMessage) {
[Link](5, " ", note);
}
}
}

NotificationConsumer listener = new MyListener();


try {
/* Publish the endpoint. */
listenerEndpoint = [Link](listener);
/* Get the ip address. */
String ipAddress = [Link]();
String url = [Link]("http://
%s/NotificationListener", ipAddress);
[Link](url);
[Link]("Published at " + url);
// More follows…

23
// See code on previous page…
/* Login. */
userService = new SOAOICCTUserService();
userServiceProxy = [Link]([Link]);
req = new LogInToCCTServerRequest();
authLevel = new AuthenticationLevel();
[Link](“yourdomain");
[Link](“yourpassword");
[Link](“yourusername");
[Link](authLevel);
ssoToken =
[Link](req).getSsoToken();
[Link]("ssoToken is " + [Link]());

/* Register for events. */


[Link]("Subscribing...");
String subscribeResp = [Link](url,
ssoToken);
[Link]("Subscription Response:" +
subscribeResp);
[Link]("ssoToken is " + [Link]());

/* Unsubscribe */
[Link]("Unsubscribing...");
[Link](subscribeResp, ssoToken);
/* Unpublish */
[Link]("stopping endpoint...");
[Link]();
} catch (Exception ex) {

[Link]([Link]()).log([Link], null,
ex);
}
/* Exit */
[Link]("Exiting...");
[Link](0);

<h:body>
<h:form>
<ace:panel header="PizzaParadise and BurritoVille">
<h:messages globalOnly="true"/>
<h:panelGrid columns="3">
<h:panelGroup>
UserId:<h:inputText value="#{[Link]}"
disabled="#{[Link]}"/>
</h:panelGroup>
<h:panelGroup>
Password:<h:inputSecret

24
value="#{[Link]}"
disabled="#{[Link]}"/>
</h:panelGroup>
<h:panelGroup><ace:pushButton
disabled="#{[Link]}"
value="Logon" action="#{[Link]()}"/>
<ace:pushButton disabled="#{!
[Link]}"
value="Logoff" action="#{[Link]()}"/>
</h:panelGroup>
</h:panelGrid>
Primary terminal #{[Link]}<br/>
State: #{[Link]}<br/>
Brand:#{[Link]}<br/>
</ace:panel>
</h:form>
</h:body>

@Inject
CCTLiaison cctLiaison;
public String logon() {
try {
[Link](userID, password);
/* Find our voice address. */
terminalName = findVoiceTerminalName();
loggedOn = true;
} catch (Throwable ex) {
[Link]();
FacesMessage message = new FacesMessage([Link]());
[Link]().addMessage(null, message);
}
return "";
}

private String findVoiceTerminalName() throws GetAddressesException,


SessionNotCreatedException, GetTerminalsException,
GetTerminalsException {
for (Terminal term : [Link]()) {
if (![Link]().contains("CCMM")) {
return [Link]();
}
}
return "U/K";
}

25
private PortableRenderer renderer = null;
@PostConstruct
public void init() {
[Link](PUSH_GROUP);
renderer = [Link]();
[Link](this);
}

public void logon(String userID, String password) throws


LogInToCCTServerException,
SessionNotCreatedException, SubscribeFailedFault {
/* Login. */
LogInToCCTServerRequest req = new LogInToCCTServerRequest();
AuthenticationLevel authLevel = new AuthenticationLevel();
[Link]("edsremote");
[Link](password);
[Link](userID);
[Link]("Attempting logon with userid='%s' and
password='%s'\n", userID, password);
[Link](authLevel);
ssoToken =
getUserServiceProxy().logInToCCTServer(req).getSsoToken();
[Link]("ssoToken is " + [Link]());
subscribeToEvents();
}

transient UserService userServiceProxy = null;


public UserService getUserServiceProxy() {
if (userServiceProxy == null) {
SOAOICCTUserService userService = null;
userService = new SOAOICCTUserService();
userServiceProxy = [Link]([Link]);
}
return userServiceProxy;
}

public void subscribeToEvents() throws


SessionNotCreatedException, SubscribeFailedFault {
/* Endpoint is published as part of the web application */
String url = LISTENER_URL;
[Link]("Notification consumer's url is " + url);
/* Register for events. */
[Link]("Subscribing...");
subscriptionRef = getUserServiceProxy().subscribe(url,
ssoToken);
/* Plug into dispatcher */
String subscriptionId =
[Link](subscriptionRef);
[Link](subscriptionId, this);

26
[Link]("Subscription Response:" + subscriptionRef);
}

public static String extractSubscriptionID(String subscriptionRef) {


/* Subscription ref looks like:
*

[Link]
3a7b0e-5fa2-4164-bd5c-6a4630f6b3c
* Subscription id that comes with the events is the part after
the last ':'
*/
return [Link](
[Link](":") +1);
}

@WebService(serviceName = "SOAOICCT_NotificationConsumer", portName =


"NotificationConsumer", endpointInterface =
"[Link]",
targetNamespace =
"[Link] wsdlLocation =
"WEB-
INF/wsdl/NotificationConsumerImpl/aaccedsremote_9090/NotificationConsum
[Link]")
public class NotificationConsumerImpl {
@Inject
private NotificationDispatcher dispatcher;
public void notify([Link]<NotificationMessageHolderType>
notificationMessage) {
[Link](notificationMessage);
}
}

public class NotificationDispatcher implements NotificationConsumer {


@Override
public synchronized void notify(List<NotificationMessageHolderType>
notificationMessage) {
for (NotificationMessageHolderType holder :
notificationMessage) {
String subscriptionId = [Link]();
NotificationConsumer listener =
[Link](subscriptionId);
if (listener != null) {
List<NotificationMessageHolderType> dispatchedMessages
=
new ArrayList<NotificationMessageHolderType>();
[Link](holder);
/* Old listeners might hang around. Can't let them
disrupt the

27
* current listeners, so notify in a 'try-catch' block.
*/
try {
[Link](dispatchedMessages);
} catch (Throwable t) {
[Link]("Caught exception " + t + " in
notify(...)");
}
}
}
}

@Override
public void notify(List<NotificationMessageHolderType>
notificationMessage) {
for (NotificationListener l : listeners) {
[Link](this, notificationMessage);
}
}

@Override
public void notify(CCTLiaison liaison,
List<NotificationMessageHolderType> notificationMessage) {
for (NotificationMessageHolderType holder :
notificationMessage) {
if ([Link]().getEventType() ==
EventType.TERMINAL_CONNECTION_STATE) {
TerminalConnectionStateEventType ev =

[Link]().getTerminalConnectionStateEvent();
if
([Link]().getTerminalName().equals(terminalName)) {
connectionState = [Link]().toString();
currentContact = [Link]();
if ([Link]() ==
[Link]) {
updateBrand(liaison);
}
if ([Link]() ==
[Link]) {
brand="Unknown";
}
[Link](PUSH_GROUP);
}
}
}
}

28
private void updateBrand(CCTLiaison liaison) {
try {
String calledAddress =
[Link](currentContact);
if ([Link](PIZZA_PARADISE_ADDRESS)) {
brand = "PizzaParadise";
} else if ([Link](BURRITOVILLE_ADDRESS)) {
brand = "BurritoVille";
} else {
brand = "Unknown";
}
} catch (Exception ex) {
[Link]();
}
}

public String findCalledAddress(Contact contact)


throws GetCalledAddressException,
SessionNotCreatedException {
ContactRequest req = new ContactRequest();
[Link](contact);
[Link](ssoToken);

AddressResponse resp =
getContactServiceProxy().getCalledAddress(req);
Address address = [Link]();
String addressName = [Link]();
return addressName;
}

29
Chapter 13 - Exploring the Communications Control Toolkit Open
Interfaces

package [Link];
import [Link];

/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.4-b01
* Generated source version: 2.2
*
*/
@WebService(name = "UserService", targetNamespace =
"[Link]

public interface UserService {

/**
*
* @param parameters
* @return
* returns
[Link]
* @throws LogInToCCTServerException
*/
@WebMethod(operationName = "LogInToCCTServer", action =
"[Link]
@WebResult(name = "LogInToCCTServerResponse", targetNamespace =
"[Link] partName =
"result")
@SOAPBinding(parameterStyle = [Link])
public LogInToCCTServerResponse logInToCCTServer(
@WebParam(name = "LogInToCCTServerRequest", targetNamespace =
"[Link] partName =
"parameters")
LogInToCCTServerRequest parameters)
throws LogInToCCTServerException
;
}

30
public class CCTLoginTest {
@Test
public void testGetProxy() throws Exception {
URL wsdlURL=new
URL("[Link]
SOAOICCTUserService serviceLocator=
new SOAOICCTUserService(wsdlURL);
UserService userService=[Link]([Link]);
}
}

@WebMethod(operationName = "LogInToCCTServer", action =


"[Link]
@WebResult(name = "LogInToCCTServerResponse", targetNamespace =
"[Link] partName =
"result")
@SOAPBinding(parameterStyle = [Link])
public LogInToCCTServerResponse logInToCCTServer(
@WebParam(name = "LogInToCCTServerRequest", targetNamespace =
"[Link] partName =
"parameters")
LogInToCCTServerRequest parameters)
throws LogInToCCTServerException
;

@Test
public void testLogin() throws Exception {
URL wsdlURL=new
URL("[Link]
SOAOICCTUserService serviceLocator=
new SOAOICCTUserService(wsdlURL);
UserService userService=[Link]([Link]);
LogInToCCTServerRequest req=new LogInToCCTServerRequest();
AuthenticationLevel authLevel=new AuthenticationLevel();
[Link]("edsremote");
[Link]("1116");
[Link](“pw!");

[Link](authLevel);
LogInToCCTServerResponse resp=[Link](req);
[Link]("ssoToken is:" + [Link]().getToken());

31
@WebMethod(operationName = "GetAddresses", action =
"[Link]
@WebResult(name = "GetAddressesResponse", targetNamespace =
"[Link] partName =
"result")
@SOAPBinding(parameterStyle = [Link])
public AddressList getAddresses(
@WebParam(name = "GetAddressesRequest", targetNamespace =
"[Link] partName =
"parameters")
GetAddressesRequest parameters)
throws GetAddressesException, SessionNotCreatedException
;

@Test
public void listAddresses() throws Exception {
LogInToCCTServerResponse loginResponse=login();
GetAddressesRequest req=new GetAddressesRequest();
[Link]([Link]());
AddressList resp=[Link](req);
[Link]([Link]());
}

package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class PropertyPrinter {
public static void printDetails(Object o) {
try {
BeanInfo info = [Link]([Link]());
for (PropertyDescriptor pd: [Link]()) {
Method readMethod=[Link]();
if (readMethod != null) {
Object value=[Link](o, new Object[0]);
[Link](" %s=%s\n", [Link](), value);
}
}
[Link]();
} catch (Exception e) {
[Link]();
}
}
}

@Test
public void listAddresses() throws Exception {
LogInToCCTServerResponse loginResponse=login();
GetAddressesRequest req=new GetAddressesRequest();

32
[Link]([Link]());
AddressList resp=[Link](req);
for (Address addr : [Link]()) {
[Link](addr);
}
}

33
Chapter 14 - Communication Control Toolkit .NET SDK

Toolkit toolkit = new Toolkit();


[Link] =
new CCTCredentials("1116", "edsremote", “pw");
[Link] = "aaccedsremote";
ISession session=[Link]();

[TestMethod]
public void TestTerminals()
{
Login();
ITerminal[] terminals = [Link];
[Link]("Printing terminals ("
+ [Link] + " found)");
foreach (ITerminal terminal in terminals)
{
[Link]("Terminal "
+ [Link] + ", type=" + [Link]());
[Link](“..addresses are " +
Format([Link]));
}
[Link]();
Logout();
}

Printing terminals (2 found)


Terminal DefaultNode_CCMM_1116,
type=[Link]
..addresses are [DefaultNode_CCMM_1116]
Terminal Line [Link], type=[Link]
..addresses are [4506, 4006]

Toolkit toolkit = new Toolkit();


ISession session = null;
private void Login()
{
[Link] = new CCTCredentials("1116",
"edsremote", “pw");
[Link] = "aaccedsremote";
session = [Link]();
}
private void Logout()
{
[Link]();
}

34
private String Format(IAddress[] addresses)
{
StringBuilder sb = new StringBuilder();
[Link]("[");
Boolean first = true;
foreach (IAddress address in addresses)
{
if (first)
{
first = false;
}
else
{
[Link](", ");
}
[Link]([Link]);
}
[Link]("]");
return [Link]();
}

[TestMethod]
public void TestContactEvent()
{
Login();
ContactScopeEventHandler handler =
[Link](new
ContactScopeEventHandler(ContactScopeEnter));
[Link] += handler;
// Delay for 60s to catch some events
[Link](60000);
Logout();
}
private void ContactScopeEnter(ContactScopeEventArgs args)
{
[Link]("Contact {0} has entered scope.",
[Link]);
}

SessionManager sessionManager = null;


private void Login()
{
sessionManager = new SessionManager();
[Link] = "aaccedsremote";
[Link] = "edsremote";
[Link] = "1116";
[Link] = “pw!";
[Link] =
[Link];
sessionManager

35
.LogonToCCTServer([Link]);
}
private void Logout()
{
[Link]();
}

[TestMethod]
public void TestAddresses()
{
Login();
LiteAddress[] addresses =
[Link]();
[Link]("Printing addresses ("
+ [Link] + " found)");
foreach( LiteAddress address in addresses) {
[Link]("Address "
+ [Link]);
[Link](" terminals: "
+ Format([Link]));
}
[Link]();
Logout();
}

string userID = "";


string password = "";
private void btnLogon_Click(object sender, EventArgs e)
{
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = "Logging on...";
userID = [Link];
password = [Link];
BackgroundWorker loginWorker = new BackgroundWorker();
[Link] += new DoWorkEventHandler(logon);
[Link] +=new
RunWorkerCompletedEventHandler(logonComplete);
[Link]();
}

36
Toolkit toolkit = new Toolkit();
ISession session = null;
void logon(Object sender, DoWorkEventArgs args)
{
[Link] =
new CCTCredentials(userID, "edsremote", password);
[Link] = "aaccedsremote";
try
{
session = null;
session = [Link]();
SetupEvents();
[Link] = "";
}
catch (Exception ex)
{
[Link] = [Link];
}
}

void logonComplete(Object sender, RunWorkerCompletedEventArgs args)


{
if (session == null)
{
[Link] = (string)[Link];
[Link] = true;
[Link] = true;
[Link] = true;
}
else
{
[Link] = "Logged on.";
[Link] = true;
}
}

private void SetupEvents()


{
ITerminal terminal = FindVoiceTerminal();
SetupTerminalEvents(terminal);
}
private ITerminal FindVoiceTerminal()
{
// Pick the one that doesn't include CCMM in its name
foreach (ITerminal terminal in [Link])
{
if (![Link]("CCMM"))
{
return terminal;
}

37
}
return null;
}

private void SetupTerminalEvents(ITerminal terminal)


{

TermConnStateEventHandler handler =
[Link](
new TermConnStateEventHandler(TerminalStateChange),
this);
[Link] += handler;
}

public void TerminalStateChange(TermConnStateEventArgs args)


{
if ([Link] == [Link])
{
IContact contact = [Link];
if ([Link] == PIZZA_PARADISE_ADDRESS)
{
[Link] = "Call for PizzaParadise";
// Load menus, etc for PizzaParadise
}
else if ([Link] == BURRITOVILLE_ADDRESS)
{
[Link] = "Call for BurritoVille";
// Load menus, etc for BurritoVille
}
else
{
[Link] = "Call for unknown address";
// Take appropriate action…
}
}
else if ([Link] == [Link])
{
[Link] = "Waiting for call..." +
[Link]();
}
}

38
private void btnPlaceOrder_Click(object sender, EventArgs e)
{
// Not shown - Interact with fulfillment system to place
the order...
// Drop the contact.
BackgroundWorker worker = new BackgroundWorker();
[Link]+=new DoWorkEventHandler(DropContact);
[Link]();
}
private void DropContact(object sender, EventArgs e)
{
FindVoiceTerminal()
.TerminalConnections[0].[Link]();
}
}

39
Chapter 15 - CCT Hot Desking

Toolkit toolkit = new Toolkit();


[Link] =
new CCTCredentials("1116", "edsremote", “pw");
[Link] = "aaccedsremote";
ISession session=[Link]();

Toolkit toolkit = new Toolkit();


[Link] =
new CCTCredentials("1116", "edsremote", “pw");
[Link] = "aaccedsremote";
[Link] = [Link];
ISession session=[Link]();

SsoToken ssoToken=login();

TerminalList resp = listTerminals(ssoToken);


Terminal terminalOfInterest=
chooseTerminalFromList([Link]());
/* Now login to the terminal of interest. */
AgentTerminalLoginRequest req=new
AgentTerminalLoginRequest();
[Link](terminalOfInterest);
[Link]("1116");
[Link](ssoToken);
[Link]("1116");
[Link]([Link]);
try {
[Link](req);
} catch(Throwable t) {
[Link]();
throw t;
}

URL userServiceWsdlURL=new
URL("[Link]
SOAOICCTUserService serviceLocator=
new SOAOICCTUserService(userServiceWsdlURL);
userService = [Link]([Link]);

URL agentTerminalServiceWsdlURL=new
URL("[Link]
?wsdl");
SOAOICCTAgentTerminalService agentTerminalServiceLocator=
new SOAOICCTAgentTerminalService(agentTerminalServiceWsdlURL);
agentTerminalService =
[Link]([Link]);

40
private SsoToken login() throws MalformedURLException,
LogInToCCTServerException {
LogInToCCTServerRequest req=new LogInToCCTServerRequest();
AuthenticationLevel authLevel=new AuthenticationLevel();
[Link]("edsremote");
[Link]("1116");
[Link](“pw”);

[Link](authLevel);
LogInToCCTServerResponse resp=[Link](req);
return [Link]();
}

private TerminalList listTerminals(SsoToken ssoToken)


throws GetTerminalsException, SessionNotCreatedException {
GetTerminalsRequest req=new GetTerminalsRequest();
[Link](ssoToken);
TerminalList resp=[Link](req);
return resp;
}

private Terminal chooseTerminalFromList(List<Terminal> list) {


Terminal terminalOfInterest=null;

for (Terminal term : list) {


if("Line [Link]".equals([Link]())) {
terminalOfInterest=term;
break;
}
}
return terminalOfInterest;
}

private TerminalList listTerminals(SsoToken ssoToken)


throws GetTerminalsException, SessionNotCreatedException {
GetTerminalsRequest req=new GetTerminalsRequest();
[Link](ssoToken);
TerminalList resp=[Link](req);
return resp;
}

41
/* Now login to the terminal of interest. */
AgentTerminalLoginRequest req=new
AgentTerminalLoginRequest();
[Link](terminalOfInterest);
[Link](agentId);
[Link](ssoToken);
[Link](agentPassword);
[Link]([Link]);
try {
[Link](req);
} catch(Throwable t) {
[Link]();
throw t;
}

42
Chapter 16 - Use Case – Communications Control Toolkit Reference
Clients

public static void main(String args[]) {


[Link](new Runnable() {
public void run() {
ClassPathResource res = new ClassPathResource("spring-
[Link]");
XmlBeanFactory beanFactory = new XmlBeanFactory(res);
((SOARefClient)
[Link]("refClient")).setVisible(true);
}
});
}

<bean id="refClient" class="[Link]">


<property name="requestHandler">
<ref bean="requestHandler" />
</property>
</bean>
<bean id="requestHandler"
class="[Link]">
<constructor-arg index="0">
<value>[Link]</value>
</constructor-arg>
<property name="notificationHandler">
<ref bean="notificationHandler" />
</property>
<property name="commands">
<map>
<entry value-ref="createContactCommand">
<key>
<value>CreateContact</value>
</key>
</entry>

<bean id="command" class="[Link]">


<property name="refClient">
<ref bean="refClient" />
</property>
</bean>
<bean id="createContactCommand"
class="[Link]"
parent="command">
<property name="contactDAO">
<ref bean="contactDAO" />

43
</property>
</bean>

<bean id="contactDAO"
class="[Link]">
<property name="proxyInterfaces">
<value>[Link]</value>
</property>
<property name="target">
<ref local="contactDAOBeanTarget" />
</property>
<property name="interceptorNames">
<list>
<value>loggingThrowsAdvisor</value>
<value>traceLoggingInterceptor</value>
</list>
</property>
</bean>

<bean id="contactDAOBeanTarget"
class="[Link]">
<property name="serviceQName">
<ref bean="cmfOiServiceQName" />
</property>
<property name="serviceUrl">
<value>/SOAOICCT/services/SessionService?wsdl</value>
</property>
</bean>

public CallResult cctLogin(String uname, String pwd, String domain)


throws DAOException {
LogInToCCTServerRequest request = new LogInToCCTServerRequest();
AuthenticationLevel authenticationLevel = new
AuthenticationLevel();
[Link](uname);
[Link](pwd);
[Link](domain);
[Link](authenticationLevel);
LogInToCCTServerResponse response = null;
try {
response = getPort().logInToCCTServer(request);
} catch (Exception e) {
throw new DAOException(e);
}
CallResult result = new CallResult();
[Link]([Link]().getToken());
return result;
}

44
private void jButton8ActionPerformed([Link] evt) {
getRequestHandler().handle("AnswerContact", getContactParams());
}

private void jButton8ActionPerformed([Link] evt) {


getRequestHandler().handle("AnswerContact", getContactParams());
}

<bean id="requestHandler"
class="[Link]">

<property name="commands">
<map>

<entry value-ref="answerContactCommand">
<key>
<value>AnswerContact</value>
</key>
</entry>

<bean id="answerContactCommand"
class="[Link]"
parent="command">
<property name="contactDAO">
<ref bean="contactDAO" />
</property>
</bean>

public void execute(Map<String, Object> params) throws Exception {


TerminalTO terminal = (TerminalTO) [Link]("terminal");
getContactDAO().answerContact((String) [Link]("contactId"),
terminal,
ssoToken);
}

<bean id="contactDAOBeanTarget"
class="[Link]">
<property name="serviceQName">
<ref bean="cmfOiServiceQName" />
</property>
<property name="serviceUrl">
<value>/SOAOICCT/services/SessionService?wsdl</value>
</property>
</bean>

45
public CallResult answerContact(String contactId, TerminalTO term,
String sso)
throws DAOException {
TerminalContactRequest contactRequest = new
TerminalContactRequest();
Terminal terminal = new Terminal();
SsoToken ssoToken = new SsoToken();
Contact contact = new Contact();

[Link]([Link]([Link]()));
[Link]([Link]());
[Link](contactId);
[Link](sso);
[Link](terminal);
[Link](ssoToken);
[Link](contact);
try {
getPort().answerContact(contactRequest);
} catch (Exception e) {
throw new DAOException(e);
}
CallResult result = new CallResult();
return result;
}

private void MainForm_Load(object sender, [Link] e)


{
// Hide all panels (agent, desktop and route point) until
connected to the server.
[Link] = false;
EnablePanels(false, false, false);
[Link] = true;
_sessMgr.Server = [Link];
_sessMgr.Credentials = [Link];
if (_sessMgr.Server == null)
{
[Link]();
_sessMgr.Server = new ServerSettings();
prefsMenu_Server_Click(this, [Link]);
prefsMenu_Credentials_Click(this, [Link]);
}
UpdateOnlineStatus();
if ([Link])
{
[Link]();
ConnectToServer();
}
}

46
private void ConnectToServer()
{
_callsRcvd = 0;
ConnectionStatusForm csf = new ConnectionStatusForm(_sessMgr,
[Link]);
DialogResult result = [Link](this);
[Link]();
ClearStatusMessage();
}

public void Connect()


{
_myToolkit.Server = _curServer.PrimaryServer;
_myToolkit.CampusAlternateServer =
_curServer.CampusAlternateServer;
_myToolkit.GeographicAlternateServer =
_curServer.GeographicAlternateServer;
_myToolkit.Port = _curServer.Port;
if (_curServer.Hotdesking)
{
if (_curServer.Workstation == null)
_myToolkit.Workstation = [Link];
else
_myToolkit.Workstation = _curServer.Workstation;
}
else
_myToolkit.Workstation = null;
_mySession = _myToolkit.Connect();

private void OnSessionConnectedEvent(SessionConnectedEventArgs e)


{
// Ignore the event if the session manager has been disposed
// or the session has already been torn down.
if (!_disposed)
{
_mySession = [Link];
// Handle the connected event on a background thread so we don't
// hold up the toolkit thread.
[Link](new
WaitCallback(HandleConnectEvent), new EventArgs());
}
}

47
private void OnSessionConnectedEvent(SessionConnectedEventArgs e)
{
// Ignore the event if the session manager has been disposed
// or the session has already been torn down.
if (!_disposed)
{
_mySession = [Link];
// Handle the connected event on a background thread so we don't
// hold up the toolkit thread.
[Link](new
WaitCallback(HandleConnectEvent), new EventArgs());
}
}

private void OnSessionConnected(object sender, EventArgs e)


{
[Link](_sessionConnectedDelegate, sender, e);
}

private void SessionConnected(object sender, EventArgs e)


{
try
{
InitUserInterface();
}
catch (OperationFailureException ofe)
{
if ([Link] == [Link])
{
LogMessage("The connection to the server dropped while
setting up the user-interface.", [Link]);
}
else
{
string message = [Link]("A CCT operation failed while
setting up the user interface: Error={0}, Operation={1}, Text={2}",
[Link], [Link], [Link]);
LogMessage(message, [Link]);
}
}
catch (Exception ex)
{
LogException(ex);
}
}

48
public class AcceptButton : ConnectionButtonWrapper
{
public AcceptButton(Button button, ConnectionSelector selector) :
base(button, selector)
{
}
protected override void Execute(params object[] parms)
{
GiveStatusMessage("Accepting call...");
[Link]();
}
protected override bool EvaluateCCTState()
{
if ([Link] == null)
return false;
else
return [Link];
}
}

49
Chapter 20 - CCMM Agent Web Services Use Case

sessionKey = [Link]([Link],
[Link]);
[Link] = "Logoff";
loggedIn = true;
[Link] = false;
[Link] = false;
[Link] = true;
[Link] = true;
[Link] = true;

[Link]();
foreach (AWClosedReasonCode code in
[Link](sessionKey))
{
[Link](code);
}
if ([Link] > 0)
[Link] = true;
[Link] = "name";
[Link] = "numericvalue";

// Now call the web method - either with or without attachments


if ([Link] != "")
contactsCreated =
[Link]([Link](),
[Link](), [Link](), [Link](),
[Link](), [Link](),
[Link](), [Link](), skillsetID,
CRCid, sessionKey, AttachmentsList);
else
contactsCreated = [Link]([Link](),
[Link](), [Link](), [Link](),
[Link](), [Link](),
[Link](), [Link](), skillsetID,
CRCid, sessionKey);

[Link]([Link]);
ClearText();
[Link]();
sessionKey = "";
contact = null;
contactID = "0";
loggedIn = false;
[Link] = "Login";

50
[Link] = true;
[Link] = true;
ButtonsEnabled(false);
[Link] = false;
[Link]();

51
Chapter 21 - CCMM Web Communications SDK

String sessionKey = "";


long contactId = -1;
AnonymousLoginResult anonLoginRes = null;
try {
/* Hypothesis. */
/* Get anon session key. */
anonLoginRes = [Link]();
sessionKey = [Link]();
/* Get anon customer id. */
long customerId =
[Link](anonLoginRes,
“somebody@[Link]", “555-5555");

/* Get the skillset id. */


long skillsetId =
[Link]("WC_Default_Skillset",
sessionKey).getId();

/* Fill in contact information in a WriteContact structure. */


CIContactWriteType newContact = new CIContactWriteType();
[Link](skillsetId);
/* go to CustomerWs and request text chat. */
contactId = [Link](customerId,
newContact, false, sessionKey);
/* Returned value is the new contact. */

boolean inSession = awaitSessionStart(contactId,


sessionKey, 60.0);
if (inSession) {
[Link]("Contact was accepted.");
} else {
[Link]("Session was not picked up");
}

private boolean awaitSessionStart(long contactId, String sessionKey,
double seconds) throws InterruptedException {
/* Call CIWebCommsWsSoap updateAliveTimer(). If exception, no
session.*/
long startTime = [Link]();
boolean inSession = false;
while ([Link]() - startTime < seconds * 1000l
& !inSession) {
try {
[Link](contactId, sessionKey);

52
inSession=true;
} catch (Exception e) {
if (! [Link]().contains("8756")) {
throw e;
}
}
[Link](5000);
}

long startTime = [Link]();


CIDateTime lastReadTime = new CIDateTime();
[Link](0);
while ([Link]() - startTime < 60000) {
/* See if there's a message available. */
CIMultipleChatMessageReadType response =
[Link](contactId, lastReadTime, false,
sessionKey);
lastReadTime = [Link]();
ArrayOfCIChatMessageReadType messagesHolder =
[Link]();
if (messagesHolder != null) {
for (CIChatMessageReadType message :
[Link]()) {
if ([Link]() ==
CIChatMessageType.CHAT_MESSAGE_FROM_AGENT) {

[Link]([Link]());
}
}
}
/* Wait for a while before looping again. */
[Link](5000);
}

try {
sessionKey =
[Link]("[Link]@[Link]",
"password");
} catch (Exception e) {
if ([Link]().contains("Already")) {

[Link]("[Link]@[Link]");
sessionKey =
[Link]("[Link]@[Link]",
"password");
} else {
throw e;
}
}
[Link]("Received session key:" + sessionKey);

53
/* Get anon customer id. */
long customerId =
[Link]("[Link]@[Link]"
, sessionKey).getId();

[Link](contactId, message, "",


CIChatMessageType.CHAT_MESSAGE_FROM_CUSTOMER, sessionKey);

function RequestCallBackNow($CallerName, $CallerNumber, $HomeDir)


{
$firstName = "ContactCenter";
// similarly setup $lastname, $Username, $password, $number, $HomeDir
require_once($HomeDir.'functions/Soap
Functions/reqister_new_customer.php');
register( $firstName,
$lastName,
$Username,
$password,
"",
"",
$number,
$HomeDir);
require_once($HomeDir.'functions/Soap Functions/[Link]');
$session_key = login($Username, $password, $HomeDir);
… continued…

function RequestCallBackNow($CallerName, $CallerNumber, $HomeDir)


{
…continued from previous slide…
require_once($HomeDir.'functions/Soap Functions/[Link]');
$cust_id = GetCustomerID($session_key , $Username, $HomeDir);
require_once($HomeDir.'functions/Soap
Functions/get_default_outbound_skillset.php');
$skillset_id = get_default_outbound_skillset($session_key, $HomeDir);

require_once($HomeDir."functions/Soap
Functions/request_callback_now.php");
request_call_now($session_key, $cust_id, $skillset_id, $CallerName,
"WebSite CallBack", "");

return $Username;
}
$ajax->export("RequestCallBackNow", "page-
>RequestCallBackNow");//export function

function request_call_now($sessionkey, $cust_id, $skillset_id,


$details, $subject, $HomeDir)
{

54
//require nesessary saop files
require_once($HomeDir.'library/[Link]');

//include config settings needed for this function


include($HomeDir.'include/[Link]');
// define the soapaction as found in the wsdl
$soapaction =
"[Link]
lback";

// endpoint address
$wsdl = $HTTP_REQUEST_TYPE.$CCMM_MACHINE_NAME.":".
$HTTP_RESQUEST_PORT."/ccmmwebservices/[Link]";
//create client object
$client = new nusoap_client($wsdl, 'true');

(cont’d)
//set decoding option
$client->soap_defencoding = 'utf-8';
//create soap message
$mysoapmsg = $client->serializeEnvelope(
'<?xml version="1.0" encoding="utf-8"?>
…details ommitted
</soap:Envelope>','',array(),'document', 'literal');

// Send the SOAP message and specify the soapaction


$response = $client->send($mysoapmsg, $soapaction);
// Debugging output omitted…
return;
}

55
Chapter 22 - CCMM Outbound SDK

[Link]
private void Login_Button_Click(object sender, EventArgs e)
{
//get user typed info
username = Username_Field.Text;
password = Password_Field.Text;
Error_Message_Label.Text = "";
//create link to our webservice
[Link] UtilInvoke = new
[Link]();
//invoke our webservice
try
{
sessionkey = [Link](username, password);
}
catch(SoapException ex)
{
Error_Message_Label.Text = [Link];
Error_Message_Label.Refresh();
if([Link]("19021"))
{
//user is already logged in
PromtLogout();
}
}
if([Link]("__"))
{
//then this is a valid session key
[Link]().IsAccessGranted = true;
[Link]().MySessionKey = sessionkey;
[Link]().MyUserName = username;
[Link]();
Main MainPage = new Main();
[Link]();
[Link]();
}
}

56
private void Refresh_Campaign_Button_Click(object sender, EventArgs e)
{
LoadCamapaigns();
}
private void LoadCamapaigns()
{
//create a link to the web service
[Link] campInvoke = new
[Link]();

//empty the array so that we dont re-add campaigns


Campaign_Listbox.[Link]();
//invoke the webservice
MyActiveCampaigns =
[Link]([Link]().MySessionKey);
//add each active campaign name to the list
if ([Link] != null)
{
if ([Link] > 0)
{
for (int i = 0; i <
[Link]; i++)
{

Campaign_Listbox.[Link]([Link][i].Name);
}
}
}
}

protected override void Dispose(bool disposing)


{
// logoff agent
Logoff();
if(disposing && (components != null))
{
[Link]();
}
[Link](disposing);
}
/// <summary>
/// when the apps is exiitng, this is called to log the user off
/// </summary>
private void Logoff()
{
[Link] UtilInvoke = new
[Link]();
//invoke our log out webservice
try
{
[Link]([Link]().MyUserName);

57
}
catch(SoapException ex)
{
//error message here
}
}

58

You might also like