0

I am trying to integrate Twilio to my AngularJS and spring MVC application. After following Twilio documentation I set up at front end device setup and calling etc. In Java class I am generating a token, and passing that token while making the call. In java the code is:

@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;
}

At twilio TwiML, I set request URL as:

https://865c048b.ngrok.io/ZingyCRM/phoneCalling/

As I am testing locally, so used ngrok. But after clicking on make a call, it gives me voice message as application error occurred. I believe the TwiML request URL I might be setting wrong, can some one help here?

Omar Einea
  • 2,478
  • 7
  • 23
  • 35
Kesavulu R
  • 19
  • 5
  • Can you reformat your question? Look at the formatting guides, but basically: code needs to be indented, body text should not be. – Tim Dierks Mar 30 '18 at 12:39
  • Call is coming, but says an application error occurred. I sense TwiML voice URL to set, is that can be /phoneCalling? CallCreator callCreator = new CallCreator(ZingyConstants.ACCOUNT_SID,new PhoneNumber("+1xxxxxxx"), new PhoneNumber(ZingyConstants.TWILIO_NUMBER),ZingyConstants.TWILIO_ML_APP_SID);TwilioRestClient restClient = new TwilioRestClient.Builder(ZingyConstants.ACCOUNT_SID, ZingyConstants.AUTH_TOKEN).build();callCreator.create(restClient);Number number = new Number.Builder("+1xxxxxxxxx").build();new VoiceResponse.Builder().dial(new Dial.Builder().number(number).build()).build().toXml(); – Kesavulu R Aug 21 '18 at 17:47

0 Answers0