Hello, We are trying to cancel a record from java third party application, but it doesn’t work. The record is ready after the execution and we can’t see in the ocs log any event with the cancellation
Can you send us a code example?
public static boolean cancelRecord(long tsid, String clientName, Integer appId, String callingList, String campaign, String phone) {
boolean result = false;
if (LOG.isDebugEnabled()) {
LOG.debug(tsid + " Cancelling record: ");
LOG.debug(tsid + " clientName: " + clientName);
LOG.debug(tsid + " appId: " + appId);
LOG.debug(tsid + " callingList: " + callingList);
LOG.debug(tsid + " campaign: " + campaign);
LOG.debug(tsid + " phone: " + phone);
}
try {
URI uri = new URI("tcp://" + PropertiesConf.getHostOCSGen() + ":" + PropertiesConf.getPortOCSGen());
// ExternalServiceProtocol protocol = new
// ExternalServiceProtocol(new Endpoint(uri));
TServerProtocol protocol = new TServerProtocol(new Endpoint("es1_des_SIPServer_8.1.101.38", "ES1AIOODES02", 3000));
LOG.debug(tsid + " Abriendo protocolo..." + uri);
protocol.setClientName(clientName);
protocol.open();
LOG.debug(tsid + " Protocolo abierto");
OutboundDesktopFactory factory = new OutboundDesktopFactory();
RequestRecordCancel requestRecordCancel = new RequestRecordCancel();
requestRecordCancel.setApplicationId(appId);
requestRecordCancel.setCallingList(callingList);
requestRecordCancel.setCampaignName(campaign);
requestRecordCancel.setPhone(phone);
CommonProperties userEvent = CommonProperties.create();
userEvent.setUserData(factory.marshal(requestRecordCancel));
RequestDistributeUserEvent request = RequestDistributeUserEvent.create();
request.setUserEvent(userEvent);
try {
protocol.send(request);
Thread.sleep(2000);
protocol.close();
LOG.debug(tsid + " Protocolo cerrado");
result = true;
} catch (ProtocolException e) {
LOG.error(tsid + " " + WSResponse.CONNECTION_LOST + " - " + e.getMessage(), e);
} catch (IllegalStateException ex) {
LOG.error(tsid + " " + WSResponse.CONNECTION_LOST + " - " + ex.getMessage(), ex);
} finally {
if (!protocol.getState().equals(com.genesyslab.platform.commons.protocol.ChannelState.Closed)) {
protocol.close();
}
}
} catch (Exception e) {
LOG.error(tsid + " " + WSResponse.CONNECTION_LOST + " - " + e.getMessage(), e);
}
return result;
}
Regards.