2013-08-01 22 views
2

我覺得這是一個簡單的問題。也許這很簡單,以前從未被問過?我似乎無法找到答案或找出答案。Twilio <Gather>,numDigits =「3」或按0

調用者呈現的第一個TwiML看起來像這樣。

<Response> 
    <Gather action="handle-extension.php" numDigits="3"> 
     <Play>greatings/maingreating.mp3</Play> 
     <!-- Hello, if you know your party's 3 digit extenstion, please dial it at any time or press 0 for the directory. Otherwise, pelase hold while we find someone to take your call. --> 
    </Gather> 
    <!-- If customer doesn't input anything, prompt and try again. --> 
    <Redirect>handle-queue-main.php</Redirect> 
</Response> 

調用者應該能夠撥打3位數的擴展名,並且該信息應該傳遞給「handle-extension.php」。這工作正常,但是...如果主叫方撥打「0」的目錄,收集只是不斷等待額外的2位數。

搜索時,我確實發現,顯然可以在numDigits使用「<」和「>」,例如:

<Gather action="handle-extension.php" numDigits="&lt; 3"> 

但是,這給了我同樣的結果原代碼。

我想到的另一個解決方案是使用:

<Gather action="handle-extension.php" numDigits="3" finishOnKey="0"> 

但是,這並沒有爲擴展名曾在他們工作的零(101發送「1」到下一個腳本,110將「11」,等等)。

也許簡單的解決方案是將目錄擴展名更改爲#,但坦率地說,這不是我正在尋找的。

有什麼建議嗎?我正在努力做甚麼?

謝謝你的時間! :)

回答

2

我不知道一種方法來完成你正在做的事情。

話雖如此,這裏有兩個簡單的事情可以做:

  • 詢問客戶後,他按下#或她完成輸入(帶finishOnKey屬性)
  • 設置超時,而不是數字位數

這些是我會探索的可能性。如果這個人輸入多於或少於3位數字,我只會用php檢查輸入處理它。

希望這會有所幫助。對不起,令人失望的答案。

+0

超時路由是我甚至沒有考慮過的!這是一個很棒的建議,我現在就會實施它。謝謝! –