2010-12-07 50 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

相關問題