2016-07-06 12 views
1

私の記事を読む時間を取ってくれてありがとう。私はIVRを設定してクライアントアカウントの1つをテストし、営業時間外などの着信呼を処理するようにしていました。私はTwilioとPHPの方が一般的です。ここでTwilio IVRユーザー入力処理の問題

は、正常に実行するようで、XMLコードです:

<?xml version="1.0" encoding="UTF-8"?> 
<Response> 
    <Gather action="handle-user-input.php" numDigits="1"> 
    <Say voice="woman">Welcome to COMPANY.</Say> 
    <Say voice="woman">In order to further assist you. Please listen to the following:</Say> 
    <Say voice="woman">For an option, please press 1.</Say> 
    <Say voice="woman">For a different option, please press 2.</Say> 
    <Say voice="woman">To speak with another person, please press 3.</Say> 
    <Say voice="woman">For all other inquiries, please press 4.</Say> 
    </Gather> 
    <!-- If they didnt put an input say this then retry --> 
    <Say voice="woman">Sorry, I didn't get your response.</Say> 
    <Redirect>http://www.exampleforstackoverflow.com/handle-incoming-call.xml</Redirect> 
</Response> 

ですから、このxmlファイルで指摘されたtwilio番号をコールした場合、音声オプションは、再生すると、動作しているようです正しく。入力を押すと、アプリケーションエラーが発生します。私のPHPファイルにエラーがある場合

<?php 
    $dayofweek=date('D'); 
    $hour=date('H'); 

    if(($dayofweek!='Sat')&&($dayofweek!='Sun')){ 
    if(($hour>17)&&($hour<23)){ 

    //ok time to call 

     $ok='1'; 
    } 
    } 

    header('Content-type: text/xml'); 
    echo '<?xml version="1.0" encoding="UTF-8"?>'; 
    echo '<Response>'; 
    $user_pushed = (int) $_REQUEST['Digits']; 
    if ($user_pushed == 1) { 
    echo '<Say voice="woman">Connecting you to, sales.</Say>'; 
    if($ok!='1'){ 
     echo '<Redirect>http://twimlets.com/[email protected]&Message=http://www.example.com/ftZLg.mp3</Redirect>'; 
    } else { 
     echo '<Dial>+12345678901</Dial>'; 
    } 
    } else if ($user_pushed == 2) { 
     echo '<Say voice="woman">Connecting you to some person.</Say>'; 
     if($ok!='1') { 
     echo '<Redirect>http://twimlets.com/[email protected]&Message=http://www.example.com/ftZLg.mp3</Redirect>'; 
     } else { 
      echo '<Dial>+12345678901</Dial>'; 
     } 
    } else if ($user_pushed == 3) { 
     echo '<Say voice="woman">Connecting you to a person.</Say>'; 
     if($ok!='1') { 
     echo '<Redirect>http://twimlets.com/[email protected]&Message=http://www.example.com/ftZLg.mp3</Redirect>'; 
     } else { 
      echo '<Dial>+12345678901</Dial>'; 
     } 
    } else if ($user_pushed == 4) { 
     echo '<Say voice="woman">Connecting you to, operator.</Say>'; 
     if($ok!='1') { 
     echo '<Redirect>http://twimlets.com/[email protected]&Message=http://www.example.com/ftZLg.mp3</Redirect>'; 
     } else { 
      echo '<Dial>+12345678901</Dial>'; 
     } 
    } else { 
     echo "<Say voice="woman">Sorry, You dialed an invalid number.</Say>"; 
     echo '<Redirect>http://www.exampleforstackoverflow.com/handle-incoming-call.xml</Redirect>'; 

    } 
    echo '</Response>'; 
?> 

私はわからないんだけど、多分そこにある次のようにハンドルのユーザinput.phpあるPHPファイルです。しかし、私はTwilioのエラーログで、ファイルにアクセスするためにリクエストがタイムアウトしたことに気付きました。つまり、Twilioがアクセスしようとしたときにhttp://example.com/handle-user-input.phpにエラー500が発生しました。

とにかく、私の投稿を読む時間をとってくれてありがとう。誰かが私の間違いに対するいくつかの洞察力を持っているなら、それは素晴らしいだろう!

答えて

2

エコーに二重引用符があります。 echo "申し訳ありません、無効な番号をダイヤルしました。あなたがPHPを初めて使用する場合は、に見

<?xml version="1.0" encoding="UTF-8"?> <Response> <Say voice="woman">Sorry, You dialed an invalid number.</Say> <Redirect>http://www.exampleforstackoverflow.com/handle-incoming-call.xml</Redirect> </Response>

echo '<Say voice="woman">Sorry, You dialed an invalid number.</Say>'; 

そして私に、これは、PHP(など、数字を投稿していなかった)から返されますことを更新

構文チェックを行うIDE、または1つのチェックをオフにするためにhttp://phpcodechecker.com/のようなコード検証を行うことができます。 How do I get PHP errors to display?

:あなたがアクセス権を持っている場合は、このようなものに従うことによって、あなたのPHPサーバー上のエラー報告に

回すことができます