在Twilio中拨打电话时录制用户呼叫之前检索键输入

时间:2017-03-22 11:46:14

标签: twilio

我们目前使用Twilio为我们的呼叫中心开发了一个电话系统(主要是c#,angular2和打字稿)。我们公司目前在英国,但我们现在已经开始扩展到美国,并且由于美国的法律,我们看起来需要能够选择何时开启通话记录。在美国,人们必须同意录制通话才能开始录制。我正在尝试 - 当我们通过twilio进行出站呼叫时,首先播放消息并让用户在拨号器上输入密钥以同意在继续呼叫之前录制呼叫。在我们拨出之后,我试图使用聚集和说动词,但这似乎不起作用。代码如下:

`

public override void ApplyAction(TwilioResponse response)
        {
                 var attributes = this.GetAttributes<DialAttributes>("attribute-");
            attributes.callerId = this.PhoneNumber;
            response.Dial(new Number(this.ReceiverPhoneNumber), attributes);
            response.Gather(
              new
              {
                  timeout = 10,
                  finishOnKey = '*'
              });
            response.Say("We record all calls - please press the star key to consent to call recording");

        }`

1 个答案:

答案 0 :(得分:0)

Twilio开发者传道者在这里。

问题是您在<Dial><Gather> 之前执行了<Say>。如果您希望用户首先批准该呼叫,则需要将<Say>嵌套在<Gather>中,并为action提供<Gather>网址。当用户按下按钮作为<Gather>的一部分时,Twilio将向操作URL发出HTTP请求,其结果为Digits参数。然后,如果用户表示同意,则应返回<Dial>作为对该请求的响应。这样你首先问他们然后连接电话。

如果有帮助,请告诉我。