使用 Twilio 进行调用时是否可以传递自定义参数? [英] Is there a way to pass a custom parameter when make a call with Twilio?

查看:24
本文介绍了使用 Twilio 进行调用时是否可以传递自定义参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Twilio PHP 库,但问题实际上与语言无关.我尝试执行以下操作:

I'm using Twilio PHP library but the question is actually language agnostic. I tried to do something like following:

$client = new Services_Twilio('MyAccountSID', 'My auth token');
$client->account->calls->create($from_number, $to_number, $url_or_AppSID, array(
    'TwilioParam1' => 'value1',
    'TwilioParam2' => 'value2',
    'MyCustomParameter1' => 'CustomValue1',
    'MyCustomParamete2' => 'CustomValue2'
));

然后我希望在 Twilio 请求我的 $url_or_AppSID(我的 TwiML 应用程序)时收到这些参数,但它没有发生.我知道一种可能的方法是构建一个 URL,在查询字符串中添加这些参数并将我的自定义 URL 传入$url_or_AppSID 参数,但这迫使我设置 GET 方法,我想通过 POST 请求而不是 GET 传递我的自定义参数.也可能是我必须使用已经通过 POST 注册的请求 URL 的 AppSID.

Then I expected to receive those parameters when Twilio requested my $url_or_AppSID (my TwiML App) but it did not happen. I know that a possible way to do that is building an URL adding those parameters in query string and passing my custom URL in $url_or_AppSID parameter but this force me to set GET method and I wanna pass my custom parameters through a POST request, not GET. Also it's probably that I have to use an AppSID which has already a request URL registered via POST.

有没有办法使用 POST 方法传递自定义参数?

Is there a way to pass custom parameters using POST method?

推荐答案

最后,我收到了来自 Twilio 支持的回复:

Finally, I received a response from Twilio Support:

很遗憾,您无法添加如下自定义参数.您是正确的,您能够做到这一点的唯一方法是将参数添加到查询字符串中,我们只会将这些参数传递给您的应用程序.

然后我向他们发送了一个功能请求:

Then I sent them a feature request:

我认为在未来的版本中应该考虑到这一点.

他们回复我:

如果此功能请求尚不存在.我会添加它.

敬请期待未来的发布.

这篇关于使用 Twilio 进行调用时是否可以传递自定义参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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