I have an Asterisk outbound IVR system set up, and I'd like it to talk to my LAMP stack on a different server. I've set up the PHP end to receive data from the IVR server and record it in MySQL, but I can't figure out how to get the Asterisk end to go to the php URL and I haven't figured out yet how to input a variable into the IVR script from the PHP server.
In my current setup, a PHP script authenticates to the asterisk server, and then sends an outbound call command. The outbound call then goes to a call script listed in extensions.conf. My first question is, how do I send a variable through the URL into extensions.conf, such as the name of the person I'm calling? Do I have to create a .call file with the name every time and FTP it into the Asterisk server?
At certain points in the call script, I'd like Asterisk to open up a URL (of the format 192.168.123.123/ivr/record?question=$question&answer=$answer). It doesn't need to process any data from the URL, it's just telling PHP to integrate the IVR call data into the existing LAMP system. Is there a way for me to do that? And if so, how do I do that?
<?php //IVR controller on the PHP server. Our employee clicks a button and IVR makes a call. //... curl_setopt($ch, CURLOPT_URL, $call_url = $asterisk_server ."/rawman" . "?action=originate&channel=". $sip_trunk . $outbound_prefix . $next_call['phone_number'] . "&extension=$extension&context=outgoingIVR&priority=1"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt ($ch, CURLOPT_COOKIEFILE, $auth_cookie); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $urlresult = curl_exec($ch); curl_close($ch); //... ?> ;Extensions.conf on the IVR server [outgoingIVR] exten => 500,1,Wait(0.25) exten => 500,n,Answer() exten => 500,n,Wait(0.75) exten => 500,n,Festival("Hi. This is company name. We are the guys that do the thing.") exten => 500,n, Goto(question1,s,1) [question1] exten => s,1(start),Wait(0.5) ;@TODO: read variable into festival here. exten=> s,n, festival("Are You Jane Doe") same => n,WaitExten() exten => 1,1, Goto(are-you-sure,s,1) ;@TODO: save yes response here exten => 2,1, goto(get-jane,s,1) ;@TODO: save no response here