在twilio action url中查询参数

时间:2017-03-21 21:39:30

标签: node.js twilio twilio-api

我试图通过twilio的Record动词动作网址传递数据。当有两个或多个查询字符串参数时,它会失败,但是当只有一个查询字符串参数成功时。

成功:

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>';

失败:

  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 on line 1 of document  : The reference to entity "test2" must end with the ';' delimiter. 

有没有办法可以通过查询字符串传递数据,还是必须使用url参数? "/service/training/call/recording/test/test

1 个答案:

答案 0 :(得分:2)

Twilio支持回到了我身边。这是他们的回应。

修复方法是更换&#39;&amp;&#39;在您的代码中使用它的有效XML替换 - &#39;&amp;&#39;。所以你的TwiML看起来像这样:

<?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>