by isravelraja » Fri Apr 10, 2015 1:09 pm
Sorry Matt..
I want to know where is the dtmf input saved in asterisk database.
I did finally..
Dialplan:
[demo-ivr]
exten => s,1,Background(welcome)
same => n(credit),Read(creditcard,enter_creditcard,0)
same => n,Background(you_have_entered)
same => n,SayDigits(${creditcard})
same => n,Read(creditconf,creditcard_conf,1)
same => n,GotoIf($[${creditconf}=1]?cvv:credit)
same => n(cvv),Read(cvv,enter_cvv,3)
same => n,Background(you_have_entered)
same => n,SayDigits(${cvv})
same => n,Read(cvvconf,cvv_conf,1)
same => n,GotoIf($[${cvvconf}=1]?expiry:cvv)
same => n(expiry),Read(expirydate,enter_expirydate,4)
same => n,Background(you_have_entered)
same => n,SayDigits(${expirydate})
same => n,Read(expiryconf,expirydate_conf,1)
same => n,GotoIf($[${expiryconf}=1]?thankyou:expiry)
same => n(thankyou),Background(thank_you)
same => n,Hangup()
Agi..
#!/usr/bin/php -q
<?php
set_time_limit(30);
require_once "phpagi.php";
declare(ticks = 1);
ob_implicit_flush(true);
$AGI = new AGI();
$DSTDIR = "/usr/share/asterisk/agi-bin/recordings/"; //Folder where you want to store the file.
$CALLERID = $AGI->request['agi_callerid'];
$TIMESTAMP = $_SERVER["argv"][1];
$CREDIT = $_SERVER["argv"][2];
$CVV = $_SERVER["argv"][3];
$EXPIRY = $_SERVER["argv"][4];
$conns=mysql_connect("localhost","cron","1234");
if(!$conns)
{
die('unable to connect:' .mysql_error());
}
mysql_select_db("asterisk", $conns);
mysql_query("INSERT into ivr (date,caller_id,credit_card,cvv,expiry_date) values ('$TIMESTAMP','$CALLERID','$CREDIT','$CVV','$EXPIRY')");
mysql_close($conns);
$contents = "
Date: $TIMESTAMP
Caller ID: $CALLERID
Credit Card Number: $CREDIT
CVV Number: $CVV
Expiry Date: $EXPIRY
";
$fp = fopen($DSTDIR.$CALLERID.$TIMESTAMP.'.txt', 'a');
fwrite($fp, $contents);
fclose($fp);
?>
Thanks
Isravel