Ashfaq Ahmed
Ashfaq Ahmed

Reputation: 53

Is there a way we can dial two numbers and make them join a conference

I am new to Twilio. Is it possible to make calls to two phone numbers and join them into a conference using Twilio-PHP? I know we can join two received calls into a conference, I'm wondering if we can do the same with two dialed calls. If yes , I would be grateful if someone refers me to that part of documentation.
Thanks in Advance.

Upvotes: 2

Views: 1904

Answers (1)

philnash
philnash

Reputation: 73027

Twilio developer evangelist here.

You absolutely can do that. When you initiate a call from within Twilio you pass three arguments, the number you're calling from, the number you're calling and a URL. That URL should point to some TwiML and you can use it much in the same way you would when you receive a call. When the outbound call is answered that's when Twilio looks at the URL to find out what to do with the call.

So, here's an example, assuming you've required the Twilio PHP library and set up the relevant variables:

// Make an API client
$client = new Services_Twilio($sid, $token, $version);

// Use the API client to create an outbound call
$call = $client->account->calls->create(
  $to,
  $from,
  'http://example.com/conference.php'
);

Then, at your URL, in this case example.com/conference, you just need to return some TwiML to enter the people being called into the conference. So, you'd need a conference.php file that looked a bit like this:

<?php
    header("content-type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
  <Dial>
    <Conference>YOUR_CONFERENCE_ID</Conference>
  </Dial>
</Response>

Let me know if that helps at all.

Upvotes: 3

Related Questions