为twilio屏蔽的呼叫创建代理服务时未设置回调Webhooks

时间:2019-10-20 19:06:10

标签: service twilio call

我能够使用$twilio->proxy->v1->services->create()使用PHP API创建代理服务。该调用使用给定的唯一名称创建服务,但是忽略了其他参数,例如defaultTtl和回调参数,我看不到这些参数是在控制台上设置的。

我在下面尝试了以下代码:

  $service = $twilio->proxy->v1->services->create(array(
    "uniqueName" => "proxy_".date("m-d-Y h:i",time()),
    "defaultTtl" => "1234",
    "callbackUrl" => "https://x.com/twilio/log/hook.html?type=normal",
    "interceptCallbackUrl" => "https://x.com/twilio/log/hook.html?type=intercept",
    "outOfSessionCallbackUrl" => "https://x.com/twilio/log/hook.html?type=other"
    ));

这是Beta代码限制吗?上面的代码我在做什么错了?

2 个答案:

答案 0 :(得分:0)

这里是Twilio开发人员的传播者。

create takes two argumentsuniqueName和一系列其他选项。因此您的代码应如下所示:

$service = $twilio->proxy->v1->services->create(
  "proxy_".date("m-d-Y h:i",time()),
  array(
    "defaultTtl" => "1234",
    "callbackUrl" => "https://x.com/twilio/log/hook.html?type=normal",
    "interceptCallbackUrl" => "https://x.com/twilio/log/hook.html?type=intercept",
    "outOfSessionCallbackUrl" => "https://x.com/twilio/log/hook.html?type=other"
  )
);

让我知道是否有帮助。

答案 1 :(得分:0)

问题是,uniqueName应该是第一个参数。 create函数将其他选项用作第二个参数。如此有效:

$service = $twilio->proxy->v1->services->create(array(
  "uniqueName" => "proxy_".date("m-d-Y h:i",time()),
  "defaultTtl" => "1234",
  "callbackUrl" => "https://x.com/twilio/log/hook.html?type=normal",
  "interceptCallbackUrl" => "https://x.com/twilio/log/hook.html? 
type=intercept",
"outOfSessionCallbackUrl" => "https://x.com/twilio/log/hook.html?type=other"
));

不容易找到service-> create()的API文档。