Hi,
I am trying to test AES DMCC JAVA SDK 8.1 on lower API version, currently our lab is 8.1, and dmcc sdk we use is 8.1
and I want to test if the code support lower protocol eg Protocol 8.0.1 or 7 , however when I switch the API protocol to use a lower
version protocol, it will fail to connect,
AES Server Version 8.1
JAVA DMCC SDK Version 8.1
JDK: openjdk1.8.0_20_AV_b26
if I run the code with testLowerProtocol=false, then it works fine, and output below and a call is made to 5551670202 successfully
getNegotiatedAPIVersion protocal version:http://www.ecma-international.org/standards/ecma-323/csta/ed3/privD
deviceId is:[5551670201:cxcm8lab:172.16.5.92:0]
getThirdPartyDeviceID returnning :[6473903122:CXCM8LAB::0]
MakeCallResponse response is:true
if I run the code with testLowerProtocol=true, the code will try to use lower version protocol 8.0.1, but it will fail to connect and
output below
getNegotiatedAPIVersion protocal version:http://www.ecma-international.org/standards/ecma-323/csta/ed3/privC
Exception in thread "main" ch.ecma.csta.errors.CstaException: Request: session[null] com.avaya.csta.binding.GetDeviceId@1792e7 timed out
at com.avaya.mvap.svcproxy.ServiceProxy.marshallRequest(ServiceProxy.java:136)
at com.avaya.mvap.svcproxy.DeviceServicesProxy.getDeviceID(DeviceServicesProxy.java:146)
at SimpleMakeCall.main(SimpleMakeCall.java:68)
Caused by: com.avaya.mvcs.proxy.XmlGatewayClient$TimeoutException: Request: session[null] com.avaya.csta.binding.GetDeviceId@1792e7 timed out
at com.avaya.mvcs.proxy.XmlGatewayClient$TimeoutTask.run(XmlGatewayClient.java:583)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
below is the code
import java.net.URL;
import java.util.Properties;
import com.avaya.cmapi.APIProtocolVersion;
import com.avaya.cmapi.ServiceProvider;
import com.avaya.csta.binding.GetDeviceId;
import com.avaya.csta.binding.GetDeviceIdResponse;
import com.avaya.csta.binding.GetThirdPartyDeviceId;
import com.avaya.csta.binding.GetThirdPartyDeviceIdResponse;
import com.avaya.csta.binding.types.DeviceInstance;
import com.avaya.csta.device.DeviceServices;
import com.avaya.mvcs.framework.CmapiKeys;
import ch.ecma.csta.binding.DeviceID;
import ch.ecma.csta.binding.MakeCall;
import ch.ecma.csta.binding.MakeCallResponse;
import ch.ecma.csta.callcontrol.CallControlServices;
public class SimpleMakeCall {
public static final String cmapiServerIp = "api_ip";
public static final String cmapiUsername = "api_user";
public static final String cmapiPassword = "api_password";
public static final String cmapiServerPort = "4721";
public static final String cmapiSecure = "false";
public static final String switchName = "CXCM8LAB";
public static final String switchAddress = "switch_ip";
public static final String extension = "5551670201";
public static void main(String[] args) throws Exception {
String phoneToCall = "5551670202";
boolean testLowerProtocol = true;
String[] lowerProtocalList = { APIProtocolVersion.VERSION_8_0_1};
Properties spProp = new Properties();
spProp.setProperty(CmapiKeys.SERVICE_PROVIDER_ADDRESS, cmapiServerIp);
spProp.setProperty(CmapiKeys.CMAPI_USERNAME, cmapiUsername);
spProp.setProperty(CmapiKeys.CMAPI_PASSWORD, cmapiPassword);
spProp.setProperty(CmapiKeys.SERVICE_PROVIDER_PORT, cmapiServerPort);
spProp.setProperty(CmapiKeys.SECURE_SERVICE_PROVIDER, cmapiSecure);
if (testLowerProtocol) {
// try with lower protocol
spProp.put(CmapiKeys.SESSION_PROTOCOL_VERSION_LIST, lowerProtocalList);
} else {
// try all supported protocol
spProp.put(CmapiKeys.SESSION_PROTOCOL_VERSION_LIST, APIProtocolVersion.VERSION_LIST);
}
ServiceProvider provider = ServiceProvider.getServiceProvider(spProp);
System.out.println("getNegotiatedAPIVersion protocal version:" + provider.getNegotiatedAPIVersion());
CallControlServices callControlSvcs = (CallControlServices) provider
.getService(ch.ecma.csta.callcontrol.CallControlServices.class.getName());
DeviceServices devSvcs = (DeviceServices) provider
.getService(com.avaya.csta.device.DeviceServices.class.getName());
GetDeviceId devRequest = new GetDeviceId();
devRequest.setSwitchName(switchName);
devRequest.setSwitchIPInterface(switchAddress);
devRequest.setExtension(extension);
devRequest.setDeviceInstance(DeviceInstance.VALUE_0);
// try get device id
GetDeviceIdResponse devResponse = devSvcs.getDeviceID(devRequest);
DeviceID deviceID = devResponse.getDevice();
System.out.println("deviceId is:" + deviceID);
MakeCall callRequest = new MakeCall();
callRequest.setCallingDevice(deviceID);
callRequest.setCalledDirectoryNumber(getThirdPartyDeviceID(phoneToCall, provider));
MakeCallResponse mkrsp = callControlSvcs.makeCall(callRequest);
System.out.println("MakeCallResponse response is:"+mkrsp.isValid());
}
private static DeviceID getThirdPartyDeviceID(String extension, ServiceProvider provider) throws Exception {
DeviceServices devSvcs = (DeviceServices) provider
.getService(com.avaya.csta.device.DeviceServices.class.getName());
GetThirdPartyDeviceId devRequest = new GetThirdPartyDeviceId();
devRequest.setExtension(extension);
devRequest.setSwitchName(switchName);
GetThirdPartyDeviceIdResponse devResponse = devSvcs.getThirdPartyDeviceID(devRequest);
DeviceID deviceID = devResponse.getDevice();
System.out.println("getThirdPartyDeviceID returnning :" + deviceID);
return deviceID;
}
}