您需要在后端添加逻辑,也可以说相同的服务器代码。
在节点中链接服务器代码
https://github.com/twilio/voice-quickstart-server-node
需要修改以下功能
function makeCall(request,response) {
// The recipient of the call,a phone number or a client
var to = null;
if (request.method == 'POST') {
to = request.body.to;
callerId = request.body.from; //--> new added line for caller name
} else {
to = request.query.to;
callerId = request.body.from; //--> new added line for caller name
}
const voiceResponse = new VoiceResponse();
if (!to) {
voiceResponse.say("Congratulations! You have made your first call! Good bye.");
} else if (isNumber(to)) {
const dial = voiceResponse.dial({callerId : callerNumber});
dial.number(to);
} else {
const dial = voiceResponse.dial({callerId : callerId});
dial.client(to);
}
console.log('Response:' + voiceResponse.toString());
return response.send(voiceResponse.toString());
}
对于callerId
变量,还需要使用make var而不是const,并且如果要传递调用者名称,则节点代码格式应将值保存为这种格式
'client:callername'
即client:
,并从iOS应用程序
传递该值之后
,
实际上放弃了这个主意...紧跟instruction,以便该应用报告对CallKit的呼叫,然后在此之后更新呼叫者名称。
本文链接:https://www.f2er.com/3154790.html