2016-05-12 125 views
0

我有一个用户呼叫我的Twilio号码,然后Twilio尝试连接呼叫者与代理的用例。当代理人#拿起我使用ScreenCall过程,以确保它是一个人,他们必须按数字。问题是,只要进入ScreenCall过程,一切都在代理端工作,但是当他们按下一个数字时,调用者就不会连接到它们。ScreenCall进程不连接呼叫

我错过了什么?只要代理人应答,我一旦删除屏幕呼叫,呼叫者和座席就会立即连接。

public ActionResult CallAgents(string From, string To, string CallSid) 
    { 
     var response = "<Response><Dial action = '" + Url.Action("EndCall", "Call") + "'> 
<Number action = '" + Url.Action("ScreenCall", "Call") + "'>1231231234</Number></Dial></Response>"; 

     return new TwiMLResult(response); 
    } 

public ActionResult ScreenCall(string From, string To, string CallSid) 
    { 
     var response = new TwilioResponse(); 

     response.BeginGather(new { action = "AnswerCall", numDigits = 1 }) 
      .Say("Press any key to accept the call.") 
      .EndGather(); 


     return new TwiMLResult(response); 
    } 

public ActionResult AnswerCall(string From, string To, string CallSid) 
    { 
     var response = new TwilioResponse().Say("Thank you, you are now being connected.").Record(); 

     return new TwiMLResult(response); 
    } 

回答

0

response.BeginGather(新{行动= “AnswerCall” numDigits = 1})

在上述AnswerCall似乎仅仅是一个字符串。 <Gather>action attribute需要绝对或相对URL作为值。当代理完成输入数字时,Twilio将向此URL发出GET或POST请求。提出此请求后,Twilio将使用您在回复中收到的TwiML继续当前的呼叫。

您还可以检查出代码完整的呼叫筛选本教程例如:https://www.twilio.com/docs/tutorials/walkthrough/ivr-screening/csharp/mvc#4

的片段有当代理筛选通话看起来是这样的:

// POST: Agent/ScreenCall 
[HttpPost] 
public ActionResult ScreenCall(string from) 
{ 
    var response = new TwilioResponse(); 
    var incomingCallMessage = "You have an incoming call from: " + 
           SpelledPhoneNumber(from); 
    response.BeginGather(new {numDigits = 1, action = Url.Action("ConnectMessage")}) 
     .Say(incomingCallMessage) 
     .Say("Press any key to accept") 
     .EndGather(); 

    response.Say("Sorry. Did not get your response"); 
    response.Hangup(); 

    return TwiML(response); 
} 

// GET: Agent/ConnectMessage 
public ActionResult ConnectMessage() 
{ 
    return TwiML(new TwilioResponse() 
     .Say("Connecting you now...")); 
} 
+0

我试着开关了这一点,但没有更改。 – ToddB

+0

发现问题。一旦screenCall处理完毕并且有人接受了该呼叫,它就会发出“记录”命令。通过支持样本做的事情来证明我不是。 – ToddB