2013-01-10 49 views
3

可以將IVR與PHP集成嗎? 有沒有相同的教程或鏈接?使用php進行IVR集成

我想要, 當用戶撥打某個電話號碼並輸入他們的預訂登記號碼和預訂日期時,IVR應該通過自動語音響應預約訂單和狀態給用戶。

是否可以使用PHP(CodeIgniter)實現?

謝謝。

回答

0

是的,這是絕對有可能的。開發VoiceXML是使用標準的HTTP協議完成的,就像普通的Web開發一樣,除了你的PHP腳本生成的是VoiceXML而不是HTML。您需要編寫一個包含所有代碼的初始VoiceXML文檔,以收集其註冊號和預訂日期(使用標籤),然後可以通過HTTP POST(使用標籤)將用戶輸入發送到PHP腳本。 PHP腳本訪問POST變量,執行搜索預訂訂單並將結果輸出到新的VoiceXML文檔中。這裏是PHP構建一個非常精簡例如:

start.xml: 
<?xml version="1.0"?> 
<vxml version="2.1"> 
<form> 
<field name="registration_number" type="digits"> 
    <prompt>Please say or enter your booking registration number.</prompt> 
</field> 
<field name="date" type="date"> 
    <prompt>Please say or enter your booking date.</prompt> 
</field> 
<filled> 
    <submit next="search.php" method="post" namelist="registration_number date"/> 
</filled> 
</form> 
</vxml> 

search.php: 
<?php 
header("Content-type: text/xml"); 
echo("<?xml version=\"1.0\"?>\n"); 
$booking_details = lookup_booking_order($_POST['registration_number'], $_POST['date']); 
?> 
<vxml version="2.1"> 
<form> 
<block> 
    <prompt><?=htmlspecialchars($booking_details)?></prompt> 
</block> 
</form> 
</vxml> 

使用像CodeIgniter的一個MVC框架略多的工作,它需要你對這些腳本闖入了一個控制器來處理GET/POST請求了兩種意見(一個用於搜索結果頁面的起始頁面)。