在twilio action url中查询参数
我正在尝试通过twilio的Record动作动作url传递数据。 当有两个或多个查询string参数时,它会失败,但是只有一个成功。
成功:
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.
有没有一种方法,我可以传递数据通过查询string,或者我不得不诉诸使用URL参数? "/service/training/call/recording/test/test
Twilio支持回到我身边。 这是他们的回应。
修正是用你的代码中的'&'replace为有效的XMLreplace – '&'。 所以你的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&test2=test"> </Record> </Response>