최근에 집 유선 번호를 Twilio로 이전했습니다. 지금은 매우 기본적인 착신 전환 TwiML Bin을 만들어 이전 유선 번호로 들어오는 모든 전화를 내 휴대 전화로 전달했습니다.
<Response>
<Dial>mycellnumber</Dial>
</Response>
내가하고 싶은 것은 수신 전화를 연락처 목록의 번호와 일치하는 수신 발신자를 기반으로 다른 셀로 착신 전환하는 로직과 수신 번호가 연락처 목록에 없으면 기본 착신 전환하는 것입니다.
예를 들어, 수신 전화는의 연락처 목록에있는 번호에서 인 경우 Cell-X
전화로 다음 앞으로 Cell-X
다른 사람의 연락처 목록에있는 경우, Cell-Y
기대에 Cell-Y
다른 아마도 클라우드 음성 메일 또는 다른 번호로 이동합니다.
TwiML Bin 또는 Studio에서 이와 같은 작업을 수행하는 방법이 있습니까? 아니면 너무 복잡합니까? 아마도 TaskRouter? 이것은 주거용이므로 발신자가 연락하려는 사람의 번호를 누르라는 메시지를 표시하는 IVR 솔루션과는 반대로 발신자에게 보이지 않기를 바랍니다.
Twilio 문서를 살펴 보거나 예제를 검색하여 이와 같은 논리로 착신 전환 솔루션을 찾지 못했습니다. 도와주세요!
Twilio 기능으로이를 수행 할 수 있습니다.
Cell-X 목록이 다음과 같다고 가정 해 보겠습니다.
const cellXContactList = ["+17782001001", "+17782001002", "+17782001003"];
Cell-Y 목록은 다음과 같습니다.
const cellYContactList = ["+17782001004", "+17782001005", "+17782001006"];
그런 다음 다음과 같이 수신 전화를 분배 할 수 있습니다.
if (cellXContactList.length && cellXContactList.indexOf(event.From) !== -1) {
// caller number found in Cell-X contact list
destinationPhoneNumber = "+17781001001";
} else if (cellYContactList.length && cellYContactList.indexOf(event.From) !== -1) {
// caller number found in Cell-Y contact list
destinationPhoneNumber = "+17781001002";
}
다음은 함수의 전체 코드입니다 (전화 번호로 대체).
// forward calls based on the incoming phone number
exports.handler = function (context, event, callback) {
// reference the Twilio helper library
const twiml = new Twilio.twiml.VoiceResponse();
// contacts lists
const cellXContactList = ["+17782001001", "+17782001002", "+17782001003"];
const cellYContactList = ["+17782001004", "+17782001005", "+17782001006"];
// if not in any contact list forward to this number
let destinationPhoneNumber = "+17781001000";
if (cellXContactList.length && cellXContactList.indexOf(event.From) !== -1) {
// caller number found in Cell-X contact list
destinationPhoneNumber = "+17781001001";
} else if (cellYContactList.length && cellYContactList.indexOf(event.From) !== -1) {
// caller number found in Cell-Y contact list
destinationPhoneNumber = "+17781001002";
}
twiml.dial({}, destinationPhoneNumber);
// return the TwiML
callback(null, twiml);
};
함수를 만들고 게시 한 후에는 "전화 수신"( https://www.twilio.com/console/phone-numbers/incoming ) 시 실행할 Twilio 번호를 구성 할 수 있습니다 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다