2010-12-07 2 views
3

나는 KRL/Twilio 앱을 편집 중이며 사용자로부터 입력을 수집하는 이벤트가 있습니다. "gather_start "이 발생하는 이벤트에 변수를 전달할 수 있습니까? 작동하지 않는 지금까지 시도한 방법은 다음과 같습니다 (이 경우 var"color "를"red "로 전달하려고합니다). ? 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의 쿠키 항아리에서 작동하여 kynetx 앱에서 엔티티 변수를 유지하는 세션을 만듭니다.

각 전화는 자신의 세션을 가져 오므로 여러 개의 동시 통화가 서로 스테핑하는 것에 대해 걱정할 필요가 없습니다.

영구 변수 (ent:myvar 대신 app: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