【问题标题】:Twilio outbound call to conferenceTwilio 出站电话会议
【发布时间】:2016-09-26 07:27:16
【问题描述】:

我需要帮助。我有代理和客户的情况。如果代理拨打外线电话并且客户接听,我的系统上有一个按钮应该将代理和客户都重定向到会议。下面的代码是我拨打座席输入的号码的功能。

function dialCall(num)
{
   params = {"phoneNumber": num, "record":"record-from-answer", "callStatus":"call", "callerId": callerId, "caller":agent_id};
   conn = Twilio.Device.connect(params);
   initializeStatus('Busy');
   isDialCall = true;
   return conn;
}

那么问题是是否可以让呼叫者和被呼叫者同时加入会议?

【问题讨论】:

    标签: twilio twilio-php twilio-api


    【解决方案1】:

    绝对有可能做到这一点。 在您上面提到的代码中,Twilio.Device.connect(params) 调用与您帐户中的 TwiML App 关联的语音 URL。

    这个Voice URL可以通过做以下两件事来实现在同一个会议中同时拨打主叫和被叫的功能

    1. 通过返回 TwiML 响应 <Dial><Conference> 在会议中拨打呼叫者
    2. 向目标发起 REST API 调用,并将 URL 设置为将他拨入同一会议的端点。

    下面列出了示例代码(nodejs)

    app.get("/handleOutgoingAsConference",function(i_Req,o_Res)
    {
      var ivrTwilRes = new twilio.TwimlResponse();
      var agentNum=i_Req.query.phoneNumber;
      /*read other params here */ 
      ivrTwilRes.dial(
        function(node) {
          node.conference('Conference_Caller_Callee', { beep:'false' , endConferenceOnExit:'true'})
        }
      );
      var restClient = new twilio.RestClient(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN);
      restClient.calls.create(
        {
          url: "/justDialIntoConference",
          to: agentNum,
          from: "+yourCallerId",
          method: "GET",
        }, 
        function(err, call) 
        {
          if(err)
            {
              console.log(err.message);
            }
        }
      ); 
      o_Res.set('Content-Type','text/xml');
      o_Res.send(ivrTwilRes.toString());
    });
    
    app.get("/justDialIntoConference",function(i_Req,o_Res)
    {
      var ivrTwilRes = new twilio.TwimlResponse();
      ivrTwilRes.dial(
        function(node) {
          node.conference('Conference_Caller_Callee', { beep:'false' , endConferenceOnExit:'true'})
        }
      );
      o_Res.set('Content-Type','text/xml');
      o_Res.send(ivrTwilRes.toString());
    });
    

    您可以将以上两个功能结合起来,为了简单起见,我将其分开。

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-25
      • 2018-05-01
      • 2015-05-19
      相关资源
      最近更新 更多