Error trying to speak to 'BOTH' participants on consult transfer

I am getting an error on consult transfer while trying to speaking to BOTH participants by calling the postCallsCallIdParticipantsParticipantIdConsult() method.

In my code, I set the the body object (ConsultTransfer), before calling the service. When I set only the speakTo() but nothing for destination object, I get the following error.

16:20:12,697 ERROR [stderr] (GT-X UniversalController_DHK81HwmlTnUiUXPzoKFpHV1.localhost-ekp_1) com.mypurecloud.sdk.ApiException: {"status":400,"code":"bad.request","message":"The destination address was not specified.","details":[],"errors":[]}
16:20:12,698 ERROR [stderr] (GT-X UniversalController_DHK81HwmlTnUiUXPzoKFpHV1.localhost-ekp_1) 	at com.mypurecloud.sdk.ApiClient.invokeAPIVerbose(ApiClient.java:651)
16:20:12,699 ERROR [stderr] (GT-X UniversalController_DHK81HwmlTnUiUXPzoKFpHV1.localhost-ekp_1) 	at com.mypurecloud.sdk.api.ConversationsApi.postCallsCallIdParticipantsParticipantIdConsultWithHttpInfo(ConversationsApi.java:3666)
16:20:12,699 ERROR [stderr] (GT-X UniversalController_DHK81HwmlTnUiUXPzoKFpHV1.localhost-ekp_1) 	at com.verint.interactionManager.providers.inin.purecloud.api.calls.ConversationAPICall.consultTransferOrConference(ConversationAPICall.java:278)

I also get the same error if I try to initialise the Destination object and set it on the body (but not add anything on it e.g. userId, address, name etc).

Any idea how I can fix this?

@tim.smith @KevinGlinski any suggestions on this one please?

Can you post your code and provide a context id from the response?

Just tried it there and got a 400 response.

ININ-Correlation-Id: 1913c7c0-bd3d-41a5-a5ee-ae240ff07a8a

I have stripped out most of my code to show only relevant lines. The createBodyParameter() create the body and consultTransferOrConference() is actually used to call the api.

UserId is passed in as null.

private ConsultTransfer createBodyParameter(String speakTo, String userId){
		ConsultTransfer body = new ConsultTransfer(); // ConsultTransfer | Destination address & initial speak to    	
 
		// Determines to whom the initiating participant is speaking. Defaults to DESTINATION Valid Values: DESTINATION, OBJECT, BOTH
		body.speakTo(SpeakToEnum.valueOf(speakTo));
		
		Destination destination = new Destination();

		ShipsLog.out.asError(MODULE_NAME + "Setting destination on the body");
		if (userId != null) {
			ShipsLog.out.asDebug(MODULE_NAME + "Setting Parameter: userId to " + userId);
			destination.setUserId(userId);
		} else {
			ShipsLog.out.asDebug(MODULE_NAME + "Parameter: userId not found. Ignoring");
		}
		return body;    	
	}	
		
		
private PureCloudResponse consultTransferOrConference(String conversationId, String participantId, ConsultTransfer body) {		
	try {
	    ApiResponse<ConsultTransferResponse> response = apiInstance.postCallsCallIdParticipantsParticipantIdConsultWithHttpInfo(conversationId, participantId, body);
	} catch (ApiException e) {
	    ystem.err.println("Exception when calling ConversationsApi#postCallsCallIdParticipantsParticipantIdConsult");
	    createPureCloudErrorResponse(e, ctResponse);
	}
	return ctResponse;
}

if using postCallsCallIdParticipantsParticipantIdConsult to create the consult, you need destination to specify who to consult in. If you already have a consult and just need to change the speakers then use the patch method patchCallsCallIdParticipantsParticipantIdConsult

Will give that a try. Cheers!