"<Redirect>
"을 사용해보세요. 하지만 조심스럽게 사용하여 무한 루프에 빠지지 않도록하십시오 (모든 루프의 경우처럼 항상 그렇습니다)
아직이 코드를 NodeJS에서 테스트하지 않았지만 방법 <Redirect>
의 생각은 잠재적으로 당신이
const maxRetries = 10;
app.get('/loopOnThisTwiml',
function(i_Req,o_Res)
{
var counter = i_Req.query.loopCounter ;
if(!counter)
{
counter = 0 ;
}
else
{
counter = counter+1;
}
var ivrTwimlResp = new twilio.TwimlResponse();
var thisTwimlUrl = "/loopOnThisTwiml?loopCounter=" + counter ;
ivrTwilRes.dial({callerId:'+1xxxxxxxxx',action:"hangup.php",method:"GET",timeout:"5"},
function()
{
this.number('+11234567890',{url:"/greet.php",method:"GET"});
}
)
.dial({callerId:'+1xxxxxxxxx',action:"hangup.php",method:"GET",timeout:"5"},
function()
{
this.number('+12234567890',{url:"/greet.php",method:"GET"});
}
);
if(counter < maxRetries)
{
ivrTwilRes.redirect({ method : 'GET' } , thisTwimlUrl);
}
o_Res.set('Content-Type','text/xml');
o_Res.send(ivrTwimlResp.toString());
}
);
을 필요로 무엇을 달성하는 데 사용할 수 위의 코드 TwiML 귀하의 질문에 언급하고 카운터 (maxRetries)에 도달 할 때까지 같은 TwiML에을 "<Redirect>"
를 추가 생성; maxRetries는 전역 상수로 정의됩니다.
귀하의 질문에있는 TwiML은 연속적으로 전화를 걸고 다른 번호보다 한 번호를 선호 할 때 유용합니다. 동시에 여러 번호로 전화를 걸고 다른 사람이 전화를 받도록하려는 경우 Simulring을 볼 수도 있습니다.
흥미로운 접근법. 이 새로운 단점은 각 HTTP 요청이 만들어지기 때문에 각주기 사이에 약간의 대기 시간이 있다는 것입니다. – levi