這是完全可能的。 在上面提到的代碼中,Twilio.Device.connect(params)會調用與您帳戶中的TwiML App關聯的語音URL。
這個聲音URL能做做在同一個會議上撥打這兩個主叫方和Calle的功能,下面兩件事
- 通過回饋的TwiML響應
<Dial><Conference>
- 啓動撥入會議呼叫者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());
});
你可以結合上述兩種功能列出的,我使其分離爲簡單起見。
希望它有幫助