【问题标题】:Repeat the Custom Content in Voice using IVR type flow使用 IVR 类型流在语音中重复自定义内容
【发布时间】:2015-01-12 21:52:12
【问题描述】:

我正在使用 twilio 进行调用。我正在使用 ASP.NET MVC 创建响应并收集输入

Q1:如何为动词指定语言、语音、循环、暂停属性等属性

 public ActionResult Welcome(string msg) {
  var response = new TwilioResponse();
  response.Say("This is a Sample Message");
  return TwiML(response);
 }

Q2:我正在使用 Gather 输入作为选项,例如 a) 按 1 重复该消息。 b) 按 2 确认。 c)按 3 重复菜单选项 我无法找到将消息参数 (msg) 转发到 Gather 操作的方法。

 public ActionResult WelcomeCall(string msg)      
 {
     var response = new TwilioResponse();
     response.BeginGather(new
        {
            action = "http://testurl.azurewebsites.net/Gather",
            Digits = "1"
        });
     response.Say(msg);
     response.Say("To repeat the message, press one");
     response.Say("To confirm, press two");
     response.Say("To repeat the menu options, press three");
     response.EndGather();
     return TwiML(response);
  }

  public ActionResult Gather(string Digits) 
  {
      var response = new TwilioResponse();
      if(Digits==1) 
      {
         response.Say(msg);
      }
      return TwiML(response);
   }

能否请您提供一种处理这种情况的方法。

【问题讨论】:

    标签: twilio twilio-click-to-call


    【解决方案1】:

    Twilio 布道者在这里。

    Say 方法(以及大多数 TwiML 方法)具有第二个参数,该参数采用匿名类型,允许您指定动词属性:

    response.Say("This is a Sample Message", new { voice="alice", loop="2" } );
    

    要将消息传递给 Gather 处理程序,您只需将其附加到操作 URL:

    response.BeginGather(new
    {
        action = "http://testurl.azurewebsites.net/Gather?msg=" + msg,
        Digits = "1"
    });
    response.EndGather();
    

    希望对您有所帮助。

    【讨论】:

    • 感谢您的回复。将消息传递给您所说的收集处理程序 /Gather?msg="+msg 然后在公共 ActionResult Gather(string msg, string Digits) 作为参数。请确认。我无法在 Gather Action 中接收 msg 数据
    • 当我像上面一样通过时。我收到“我们很抱歉发生应用程序错误”或“Gather End”错误发生。你能帮我解决这个问题吗?
    猜你喜欢
    • 2010-09-08
    • 2012-09-03
    • 1970-01-01
    • 1970-01-01
    • 2012-02-19
    • 1970-01-01
    • 2020-04-03
    • 1970-01-01
    • 2014-01-24
    相关资源
    最近更新 更多