Twilio会议外呼
我需要帮助。我有一个代理人和客户的情况。如果代理拨打出站电话,而客户机接听,我的系统上会有一个按钮,该按钮会将代理和客户机都重定向到会议。下面的代码是我的功能,它可以拨打代理输入的号码Twilio会议外呼,twilio,twilio-php,twilio-api,Twilio,Twilio Php,Twilio Api,我需要帮助。我有一个代理人和客户的情况。如果代理拨打出站电话,而客户机接听,我的系统上会有一个按钮,该按钮会将代理和客户机都重定向到会议。下面的代码是我的功能,它可以拨打代理输入的号码 function dialCall(num) { params = {"phoneNumber": num, "record":"record-from-answer", "callStatus":"call", "callerId": callerId, "caller":agent_id}; co
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.Device.connect(params)调用与帐户中的关联的语音URL 此语音URL可以通过执行以下两项操作来实现在同一会议中同时拨打呼叫者和被呼叫者的功能
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());
});
您可以将上述两个功能组合在一起,为了简单起见,我将其分开
希望能有帮助