cURL Based IVR


I am starting a IVR, following is the code I have written up till now, the problem is it accepts but it doest send any thing.

This is the PHP page…

    #!/usr/bin/php -q
   $agi = new AGI();

  //required parameters and create variables
 $systoken = "3pvUYhSgf/x0Wc+CDAI=";
 $texts = "";
 $transferTos = "100";

    //update variables
    $data = array(
    "systemToken" => "$systoken", 
    "uniqueCallId" => "$unique", 
    "callerNumber" => "$caller", 
    "incomingNumber" => "$incoming", 
    "text" => "$texts");
     $data_string = json_encode($data);

     //CRM endpoint
     $ch = curl_init('');

    //create a new cURL resource
   curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
   curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array(
   'Content-Type: application/json',
   'Content-Length: ' . strlen($data_string))
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);

   //execute post
   $result = curl_exec($ch);

   $audio = json_decode($result, true);

     //get variables
    $audioPrompt = $audio["audioPrompt"]["text"];
    $nextAction = $audio['nextAction'];

      //play response recording


And this is the fiddler of the CRM…

When i given this command to it…

{“errorCode”:0,“nextAction”:“WaitForKeyPress”,“audioPrompt”:{“text”:“Thank you for calling HollywoodCars. Press 1 for immediate pickup at tesco kirkdale 151 kirkdale london. Press 2 for sainsburys supermarkets ltd22-24 market street huddersfield. Press 3 for 15 cross church street huddersfield. And for pick up at 8 chapel hill huddersfield please Press 4. or dial 0 for an operator”,“interruptible”:true},“maxDigits”:“1”,“wait”:“10000”}

Any heads up would be appreciated…


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.