TwiML Bin - 无论如何要访问参数? [英] TwiML Bin - Anyway to access parameters?

查看:33
本文介绍了TwiML Bin - 无论如何要访问参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为产品设置演示,我们正在使用 Twilio 将两个人连接在一起.为了托管 XML 响应,我设置了 Twilio 提供的新 TwiML bin 文件.我正在使用 调用来提示第一个呼叫者按 1 接受或按 2 拒绝.

I am setting up a demo for a product, and we are using Twilio two connect two people together. To host the XML response, I set up new TwiML bin files that Twilio offers. I am using the <Gather> call to prompt the first caller to hit 1 to accept or 2 to decline.

无论如何要检查 TwiML bin 文件中 Gather 中的 Digits 参数?

Is there anyway to check the Digits parameter from the Gather in a TwiML bin file?

推荐答案

Twilio 开发人员布道者在这里.不幸的是,要从 ,您将需要一个后端服务器,因为 Twilio 将使用该数字向您的页面发出 HTTP POST 或 GET 请求.

Twilio developer evangelist here. Unfortunately, to get the value from the <Gather>, you will need a backend server as Twilio will make and HTTP POST or GET request to your page with that digit.

幸运的是,这样做非常简单,只需将其部署到您的一台服务器,甚至是免费的 Heroku 实例,您就可以相当快地将其部署到位.

Luckily doing that is pretty simple, and you could put something in place fairly quickly by just deploying it to one of your servers, or even a free Heroku instance.

从您的问题来看,我无法确定您使用的是哪种编程语言,但是如果您想在 PHP 中执行此操作,您可以执行以下操作:

From your question, I can't quite tell what programming language you're using, but if you wanted to do this in say PHP, you could do something like this:

<?php
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<Response><Say>You entered " . $_REQUEST['Digits'] . "</Say></Response>";
?>

另一种方法是使用 twimlets 网站.

Another way you could do this is by using the twimlets website.

看看这个例子.然后,您可以使用 TwiMLBin 创建逻辑以重定向用户.

Have a look at this example. You could then create your logic with TwiMLBin to redirect the user.

希望能帮到你.

这篇关于TwiML Bin - 无论如何要访问参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆