asp.net mvc - TwiML App unexpected end of call: Cannot find the declaration of element 'response' -


i created twiml application , set voice request url web deployed asp.net-mvc aplication action method: http://voiceapp-001-site1.myasp.net/voice

this action method invoked when goes url posted above:

 public actionresult voice() {              response.contenttype = "text/xml";              // put phone number you've verified twilio use caller id number             string callerid = settings.twilionumber;              // put default twilio client name here, when phone number isn't given             string number = "jenny";              // phone number page request parameters, if given             if (request["phonenumber"] != null) {                 number = request["phonenumber"];             }              // wrap phone number or client name in appropriate twiml verb             // checking if number given has digits , format symbols             string numberorclient;             var m = regex.match(number, @"^[\d\+\-\(\) ]+$");             if (m.success) {                 numberorclient = string.format("<number>{0}</number>", number);             } else {                 numberorclient = string.format("<client>{0}</client>", number);             }             viewbag.callerid = callerid;             viewbag.numberofclient = numberorclient;             return view();         } 

the voice view looks like:

<?xml version="1.0" encoding="utf-8" ?> <response>     <dial callerid="@viewbag.callerid">         @html.raw(viewbag.numberofclient)     </dial> </response> 

then try make test call:

enter image description here

but after 13 seconds call automatically terminated , in error log get:

notification sid noe85ffe80dfc52e81f942a7414c9f7c9c warning 12200 schema validation warning description cannot find declaration of element 'response'. 

but below in body section can see element response:

enter image description here

hi twilio developer evangelist here.

can try modifying view instead?

<?xml version="1.0" encoding="utf-8" ?> <response>     <dial callerid="@viewbag.callerid">         @html.raw(viewbag.numberofclient)     </dial> </response> 

remember xml case-sensitive, casing in xml tags matter. also, suggest using twilio.twiml helper library. that, can xml generated right casing, , avoiding typos altogether.

here's how you'd it:

var twiml = new twilioresponse(); var dialattributes = new {callerid = "48326304351"};  var dial = twiml.dial("+15555555555", dialattributes); return twiml(dial); 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -