When I try to delete a contact from a contact list, this error appears:
{"status":400,"code":"contact.in.use","message":"The contact cannot be deleted because it is currently in use","messageWithParams":"The contact cannot be deleted because it is currently in use","messageParams":{},"contextId":"02b68f77-2da8-4f6d-84f0-774cc50e292e","details":[],"errors":[]}
I use Java SDK 7.0.4 and the method used is new OutboundApi().deleteOutboundContactlistContact(contactListId, contactId).
Do you know if exists any way to know if a contact is in use at that moment in a campaign?
If you get that error, Dialer is in some stage of interacting with the contact record. The most straightforward approach to figuring out if you can delete the contact would be to go ahead and attempt to delete it, but be prepared to handle this specific error (inspect the status and code properties).
If you are just wanting to know if a contact is currently in use without trying to delete it, you'd need to use a conversation detail analytics query and see if any of the conversations have the contact ID you're looking for.