onToolbarAgentCommand Method
This method registers a listener with Service to give the agent control functionality. The method is only called once during initialization.
Here's the parameters for this method:
Parameter |
Description |
---|---|
channel |
Name of the channel for which the method is called. |
channelType |
The type of channel for which the method is being called. For instance, if the channel is PHONE and the channelType isn't provided, the default value is set to ORA_SVC_PHONE. For more information, see Channel Type Data.. |
executor |
The function implemented by the toolbar which is used by the agentCommandPrototype object. |
The agentCommandPrototype object has these attributes:
Attribute |
Description |
---|---|
eventId |
Represents the status of the method on the server side. Values are success and error. |
command |
Contains error messages. If there is no error, the value is undefined. For more information about error message codes, see Error Messages. The following commands are available:
|
channel |
The channel name. |
channeltype |
The type of channel. |
inData |
The object containing the name value pairs for the command parameters. |
result |
Populated by the toolbar after the command process has completed successfully. If there was a failure, the reason will be displayed. |
resultDisplayString |
Error displayed to the user, and populated by the toolbar. |
outdata |
Populated by the toolbar if the command required output data. |
sendResponse |
Callback function used upon completion of the command processing. The sendResponse method must be passed to the command object with the result populated. Also the outData and resultDisplayString attributes must be populated if required. |
Here's sample code to call the method:
<html>
<head>
<script type="text/javascript" src="http://domain:port/ora_support/js/mcaInteractionV1.js">
</script>
<script type="text/javascript">
function agentCommandExecutor(command) {
var cmd = command.command;
switch(cmd) {
case "getCurrentAgentState":
command.outData = {
'channel':command.channel,
'channelType':command.channelType,
'isAvailable':true,
'isLoggedIn':true,
'state':"AVAILABLE",
'stateDisplayString':"Available",
'reason':null,
'reasonDisplayString':null};
break;
case "getActiveEngagements":
command.outData = {'activeCount':1,'engagements' : [ {eventId:"1234"} ] };
break;
case "makeAvailable":
alert("makeAvailable command invoked");
break;
case "makeUnavailable":
alert("makeUnavailable command invoked");
}
command.result = 'success';
command.sendResponse(command);
}
function registerAgentCommandListener() {
svcMcaTlb.api.onToolbarAgentCommand("PHONE", "ORA_SVC_PHONE", agentCommandExecutor);
}
</script>
<body>
<input type="button" value="Register interaction command listener" onclick="registerAgentCommandListener()"/>
</body>
</html>