我正在尝试将Twilio集成到我的AngularJS和spring MVC应用程序中。在遵循Twilio文档后,我在前端设备设置和调用等设置。在Java类中,我生成一个令牌,并在进行调用时传递该令牌。在java中代码是:
@RequestMapping(value = "/phoneCalling", method {
RequestMethod.GET, RequestMethod.POST
})
public @ResponseBody Phone phoneCalling(HttpServletRequest request, HttpServletResponse response, @RequestParam String leadPhone) {
try {
Number number = new Number.Builder(leadPhone).build();
Dial dial = new Dial.Builder().number(number).build();
VoiceResponse responseVR = new VoiceResponse.Builder().dial(dial).build();
System.out.println(responseVR.toXml());
} catch (TwiMLException e) {
e.printStackTrace();
}
return null;
}
在twilio TwiML中,我将请求URL设置为:
https://865c048b.ngrok.io/ZingyCRM/phoneCalling/
当我在本地测试时,所以使用了ngrok。但是在点击拨打电话后,它会在发生应用程序错误时给出语音消息。我相信TwiML请求URL我可能设置错误,有人可以帮忙吗?