2010-12-07 51 views
3

我正在编辑KRL/Twilio应用程序,并收集用户输入的事件。是否有可能将一个变量传递给"gather_start“触发的事件?以下是我尝试过的方法,但不起作用(在这种情况下,它试图将var”color“传递为”红色“):将变量传递给KRL中“twilio:gather_start”命令的事件

twilio:gather_start("choice") with action="choice?color=red" and numDigits = "1" and timeout = "5" and color = "red" and parameters = {"color":"red"}; 

好像持续瓦尔可能是最好的(设置类似“ENT:颜色”到“红”),但它听起来像是应用持续增值经销商尚未公布TIA

回答

3

的吧?方法是持久变量,应用变量是一种选择,但你可能想要的是实体变量,Kynetx Webhooks使用Twilio的cookie jar,导致会话在kynetx应用中维护实体变量。

每个电话都会接收一个会话,所以您不必担心多个同时呼叫彼此通话。

应用程序持久变量(使用app:myvar而不是ent:myvar)可以工作,但对于应用程序来说是全局变量,所以只能在变量被限制到应用程序时使用它们。

下面是证明这几个规则:

rule firstquestion { 
    select when twilio firstquestion 
    { 
     twilio:gather_start("firstanswer"); 
     twilio:say("Question One"); 
     twilio:gather_stop(); 
    } 
    } 

    rule firstanswer { 
    select when twilio firstanswer 
    pre { 
     firstchoice = event:param("Digits"); 
    } 
    { 
     twilio:gather_start("secondanswer"); 
     twilio:say("Question Two"); 
     twilio:gather_stop(); 
    } 
    fired { 
     set ent:firstchoice firstchoice; 
    } 
    } 

    rule secondanswer { 
    select when twilio secondanswer 
    pre { 
     firstchoice = ent:firstchoice; 
     secondchoice = event:param("Digits"); 
    } 
    noop(); 
    } 
+1

YES!它的工作,你统治山姆! – tiegz 2010-12-08 21:32:58

相关问题