Home > Back-end >  Twilio status callback url is not called
Twilio status callback url is not called

Time:11-20

I am currently working on a server-side application using spring boot, I have created an endpoint as a Twilio status callback URL as following

@PostMapping
    public ResponseEntity<Response> callback(@RequestParam("RoomName") String RoomName,
                                             @RequestParam("ParticipantIdentity") String ParticipantIdentity,
                                             @RequestParam("StatusCallbackEvent") String StatusCallbackEvent,
                                             @RequestParam("AccountSid") String AccountSid,
                                             @RequestParam("RoomSid") String RoomSid,
                                             @RequestParam("RoomStatus") String RoomStatus,
                                             @RequestParam("RoomType") String RoomType,
                                             @RequestParam("Timestamp") String Timestamp,
                                             @RequestParam("ParticipantStatus") String ParticipantStatus,
                                             @RequestParam("ParticipantSid") String ParticipantSid,
                                             @RequestParam("ParticipantDuration") int ParticipantDuration,
                                             @RequestParam("RoomDuration") int RoomDuration,
                                             @RequestParam("SequenceNumber") String SequenceNumber,
                                             @RequestParam("ParticipantTrackSidStatus") String ParticipantTrackSidStatus,
                                             @RequestParam("TrackKind") String TrackKind) {
        log.info("Handling twilio callback ...");

        String roomName = RoomName;
        int userId = Integer.parseInt(ParticipantIdentity);
        User user = userService.getUserById(userId);
        int familyId = Integer.parseInt(roomName.split("_")[1]);
        Family family = familyService.findById(familyId);
        Helper helper = Helper.getInstance();
        String langCode = helper.getLangCode(family);

        if (StatusCallbackEvent.equals("participant-connected")) {
            UserInCallRoom userInCallRoom = new UserInCallRoom(roomName, user);
            userInCallRoomService.saveUserInCallRoom(userInCallRoom);
        } else if (StatusCallbackEvent.equals("participant-disconnected")) {
            userInCallRoomService.deleteUserFromRoom(roomName, userId);
        } else if (StatusCallbackEvent.equals("room-ended")) {
            ArrayList<Integer> userIds = userInCallRoomService.findAllUserIdInRoomCall(roomName);
            List<User> users = userIds.stream().map(id -> userService.getUserById(id)).collect(Collectors.toList());

            firebaseMessageHelper.notifyUsers(
                    users,
                    helper.getMessageInLanguage("videoCallHasEndedTitle", langCode),
                    String.format(helper.getMessageInLanguage("videoCallHasEndedBody", langCode)),
                    new HashMap<>() {{
                        put("navigate", "END_VIDEO_CALL");
                        put("id", roomName);
                    }}
            );
        }

        return ResponseEntity.ok(new Response(null, new ArrayList<>()));
    }

But I can't receive any requests to this URL. I have already checked the HTTP method setting in Twilio room settings. What am I missing? Am I misunderstanding anything here?

One more thing is that the call room is created on client-side application using ad-hoc instead of rest api

Please let me know. Thank you for your priceless time.

CodePudding user response:

I found out that I can check error logs on Twilio for more information on the reason why Twilio couldn't request to my endpoint and found out that Twilio didn't pass in some parameters.

For those who run into the similar issues. Take a look at error logs in monitor section on the Twilio console and you may find the answer you need.

CodePudding user response:

I'm also facing this issue in Twilio Twilio status callback url is not called Error Code: 11200 RestAPI (Node.Js) RoomType: Small-group

Related Issues with Android & IOS Also (Black Screen, Video freezes)

Please help me if you find any workaround for these issues

Thanks

  • Related