twiliotwilio-apitwilio-conference

Is there a way to start a Twilio phone conference via an api call


I played around a lot now and still can't figure out if there is a way of starting a conference via the API.

What do I want to achieve: I would like to set up a conference, keep all participants still listening to music and than start that conference on a button press.

After reading the documentation about the conference API, I saw you can update the conference object status: https://www.twilio.com/docs/voice/api/conference-resource?code-sample=code-update-a-conference-to-end-it&code-language=Ruby&code-sdk-version=5.x

The update to end the conference works fine (the example):

conference = @client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
                    .update(status: 'completed')

But as soon as I try to use .update(status: 'in-progress') to start the conference i get:

in-progress is not a valid choice
https://www.twilio.com/docs/errors/20001

The documentation sounds like you are able to do it:

The new status of the resource. Can be: Can be: init, in-progress, or completed. Specifying completed will end the conference and hang up all participants

Do I miss something?

Yes there are more than 2 calls connected, both of them with 'startConferenceOnEnter' set to false.


Solution

  • Twilio developer evangelist here.

    You can use the REST API to generate a call to your client.

    The URL you pass to this call should point to an endpoint on your server that will return the TwiML to start the conference:

    <Response>
      <Dial><Conference>{insert Conference room name}</Conference></Dial>
    <Response>
    

    During this request where you return the conference call TwiML, you can also kick off a new request to start a call to the phone number you want to dial using Twilio's REST API as mentioned here using curl.

    Alternatively, you could maybe do it with Twilio Studio like this.

    Let me know if this helps at all!