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

会有一股神秘感。 提交于 2019-12-11 02:47:12

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/29903765/is-there-a-way-we-can-dial-two-numbers-and-make-them-join-a-conference

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!