BlasCrocheSolana | 2017-06-21 12:10:12 UTC | #1
Hello everyone, I'm trying to answer an inbound call using java SDK. I receive the inbound call event, a then try to answer using patchConversationParticipant, but it's not working. The parameters seems to be ok, because if I use another conversationId or participantId, I get an exception.
This is the code I'm using:
{ ConversationNotification eventBody = (ConversationNotification) event.getEventBody(); String conversationId = eventBody.getId(); //Getparticipants is below ConversationNotificationParticipants participante = getParticipants(sUserId, eventBody.getParticipants()); String sParticipantId = participante.getId();
MediaParticipantRequest body = new MediaParticipantRequest(); body.setState(MediaParticipantRequest.StateEnum.CONNECTED); try { apiInstance.patchConversationParticipant(conversationId, sParticipantId, body); } catch (ApiException aex) { Print("[ApiException] " +aex.getMessage()); Print("[ApiException text] " + aex.toString()); } } ////////////////// Get Participants private ConversationNotificationParticipants getParticipantes (String id, List<ConversationNotificationParticipants> participantList){ if(participantList == null) { Print("participantList null"); } else { for(int i=0; i<participantList.size(); i++) { Print(participantList.get(i).getUserId() + "," + id); try{ if (participantList.get(i).getUserId() == null) { Print("UserId null"); } else { if (participantList.get(i).getUserId().equals(id)) { try { return participantList.get(i); } catch (Exception ex) { Print("[ERROR] " + ex.getMessage()); Print("[CAUSE] " + ex.getCause()); ex.printStackTrace(); } } } } catch (Exception ex) { Print("[ERROR] " + ex.getMessage()); Print("[CAUSE] " + ex.getCause()); ex.printStackTrace(); } } } return null; }
Any ideas on what the problem could be?
Regards, Blas.
tim.smith | 2017-06-21 14:04:22 UTC | #2
Can you provide the correlation ID from the response header? (use patchConversationParticipantWithHttpInfo to get additional info).
BlasCrocheSolana | 2017-06-21 15:52:00 UTC | #3
Thanks Tim, now it's working! Tomorrow I'll post the modified code
Regards, Blas.
system | 2017-08-28 19:35:18 UTC | #4
This post was migrated from the old Developer Forum.
ref: 1447