doucan8246326 2014-06-18 19:00
浏览 39

在Twilio中创建出站电话会议,致命错误:调用未定义的方法Services_Twilio :: request()

I am trying to code some PHP for an outbound call conference room. The point of the conference room is to make a temporary solution for our customers calling one of our call centers, who need to be transferred, and automatically placed in a call with the other call center. This is exactly what we need, but having this error.

I already tried SMS and standard calls and those work fine. When I run the code below for conference calls, I get this error.

Fatal error: Call to undefined method Services_Twilio::request()

I have my conference.xml file already, like so.

    <?xml version="1.0" encoding="UTF-8" ?>
      <Response>
        <Dial>
      <Conference>i2c</Conference>
        </Dial>
      </Response>   

And my conference.php file looks like this:

 <?php
  // The PHP Twilio helper library. Get it here http://www.twilio.com/docs/libraries/

  require('twilio-php/Services/Twilio.php');

  $API_VERSION = '2010-04-01';
  $ACCOUNT_SID = 'my sid #';
  $AUTH_TOKEN = 'my auth_token';

  $client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN);

  // The phone numbers of the people to be called
  $participants = array('customer#', 'call-center#');

  // Go through the participants array and call each person.
  foreach ($participants as $participant)
  {
     $vars = array(
      'From' => 'my #',
      'To' => $participant,
      'Url' => 'conference.xml');

$response = $client->request("/$API_VERSION/Accounts/$ACCOUNT_SID/Calls", "POST", $vars);
}
?>  

It's getting an error on line 23, which is the line with the $response on it. Can you tell what's going wrong? I'm working off this code that Twilio provided. The part that says "Reach Out and Call Somebody". I changed TwilioRestClient to Services_Twilio because that is the newer version.

https://www.twilio.com/blog/2011/07/easy-conference-calling-twilio.html

Anyone see where I'm messing up?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题