0

Automatic call disconnects in Twilio, and I think this is the reason:

controller

var lng="en-US";
var code="123456"
var twiml="<Say voice='alice' language='"+lng+"'>";
twiml+=Messages("callData", "","</Say><Pause length='1'/><Say voice='alice'>"+code.toList.mkString("</Say><Pause length='1'/><Say voice='alice'>"))(Lang(lng))+"</Say>"
Ok(views.xml.twilio(twiml))

twilio.scala.xml

@(twiml:String)
<Response>@twiml</Response>

But this is not working properly.
It shows the content but not as like xml, where Response tag shown in purple color and the string that I entered is in black.

When I check the Body of request in Request Inspector in my Twilio account, it shows me something like this.

&lt;Say voice=&apos;alice&apos;&gt;4&lt;/Say&gt;

I know its not a proper way to deal with xml.
Can anyone help me?

Govind Singh
  • 15,282
  • 14
  • 72
  • 106

1 Answers1

0

The problem is it takes the xml as string. if you can define the content type it should work. like

httppost.setHeader("Content-Type","application/xml;charset=UTF-8");
NIRANJAN S.
  • 317
  • 4
  • 16