cosmonot1
cosmonot1

Reputation: 81

Query parameter in twilio action url

I am trying to pass data through twilio's Record verb action url. When there are two or more query string parameters it fails, but when there is only one it succeeds.

Succeeds:

var response = '<Response><Say>STUFF TO SAY</Say><Pause length="1"/><Record maxLength="3600" timeout="30" action="/service/training/call/recording?test1=test&test2=test"></Record></Response>';

Fails:

  var response = '<Response><Say>STUFF TO SAY</Say><Pause length="1"/><Record maxLength="3600" timeout="30" action="/service/training/call/recording?test1=test"></Record></Response>';

error:

Error on line 1 of document  : The reference to entity "test2" must end with the ';' delimiter. 

Is there a way I can pass the data through the query string or do I have to resort to using url parameters? "/service/training/call/recording/test/test

Upvotes: 2

Views: 956

Answers (1)

cosmonot1
cosmonot1

Reputation: 81

Twilio support got back to me. Here is their response.

The fix is to replace the '&' in your code with it's valid-XML replacement - '&'. So your TwiML would look like this:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>STUFF TO SAY</Say>
  <Pause length="1"/>
  <Record maxLength="3600" timeout="30" action="/service/training/call/recording?test1=test&amp;test2=test">
  </Record>
</Response>

Upvotes: 2

Related Questions