androidtwilioconference

Number of Participants in Twilio Client Conference Call Android


I am using Twilio Client for Android and I want to display the number of participants who are currently connected to the conference call.
I am trying this for almost 2 days but can't come out with a result.
Please help.


Solution

  • Twilio developer evangelist here.

    To do that you'll need to use the REST API. You should already be using a server based application to generate tokens for your Twilio Client application, so in there you'll want another endpoint that can take the Conference SID and look up the participants using the REST API. Once you have done that, you'll need to call your server from your Android application to get the current number of participants.

    Using Python (as that is what the example Twilio Client server is implemented in), it might look a little like this:

    from twilio.rest import TwilioRestClient
    
    # Your Account Sid and Auth Token from twilio.com/user/account
    account_sid = "your_account_sid"
    auth_token  = "your_auth_token"
    client = TwilioRestClient(account_sid, auth_token)
    
    # A list of participant objects with the properties described above
    participants = client.participants('CFbbe4632a3c49700934481addd5ce1659').list()
    len(participants)
    

    You could also connect to your web server application with a websocket connection or similar and look up and broadcast the participants when you receive a conference event.

    Let me know if that helps at all.