Php twilio仅在按下特定键后才说出动词

Php twilio仅在按下特定键后才说出动词,php,twilio,Php,Twilio,如何在twilio中使用替代动作?我要做的是捕获一个特定的键(*)。如果按下此键,它将执行其他操作,而不是默认操作。以下是我目前拥有的: <?xml version="1.0" encoding="UTF-8"?> <Response> <Gather finishOnKey="*" action="/another_thing" method="POST"> <Say>Hi this is the initial messag

如何在twilio中使用替代动作?我要做的是捕获一个特定的键(*)。如果按下此键,它将执行其他操作,而不是默认操作。以下是我目前拥有的:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Gather finishOnKey="*" action="/another_thing" method="POST">
      <Say>Hi this is the initial message</Say>
    </Gather>

    <Say>Hi this is the default message. Please enter a 3 digit number</Say>
    <Gather numDigits="3" action="/save_number" method="POST" />
</Response>

这里是Twilio福音传道者

所以,你走对了方向。您需要为默认消息使用单独的TwiML路由,然后一切都应该正常。我还建议您使用
numDigits
而不是
finishOnKey
。如果使用
finishOnKey
,则实际上不会发送该字符。有关的文档中有更多信息

按了
*
键后,它们的状态如下:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>Hey whats up!</Say>
</Response>

嘿,怎么了!
希望这有帮助

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Gather numDigits="1" action="/another_thing" method="POST">
    <Say>Hi this is the initial message</Say>
  </Gather>
</Response>
<Response>
  <Say>Hi this is the default message. Please enter a 3 digit number</Say>
  <Gather numDigits="3" action="/save_number" method="POST" />
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>Hey whats up!</Say>
</Response>