[asterisk-users] Running AGI script if condition met?

Vincent vincent.delporte at bigfoot.com
Wed Dec 5 21:47:43 CST 2007


Hello

	Some of our customers call with CID blocked. I'd like to save
those numbers into a SQLite database using a command-line PHP script,
so that I can...
1. Edit the CID name through a PHP web script which will just list all
the customers in the database who have a phone number but no  CID name
set
2. Look up those customers' e-mail address from this database, and
send them an e-mail telling them that, if they're tired of having to
input their CID number every time they call, they should contact
whoever handles their PBX, so that it no longer blocks their number in
outgoing calls.

====== Here's the command-line PHP script:
#!/usr/bin/php
<?php
$fh = fopen('/root/output.txt', 'w');
fwrite($fh, "Received " . $argv[0]);
fclose($fh);
?>

====== Here's extensions.conf:
exten => 777,1,Set(CALLERIDNUM=1234567890)
exten => 777,n,ExecIf($[${LEN(${CALLERIDNUM})} =
10],AGI(/root/dummy.php),${CALLERIDNUM})

======... and here's the console :-/
    -- Executing [777 at my-phones:1] Set("SIP/9001-088aa918",
"CALLERIDNUM=1234567890") in new stack

    -- Executing [777 at my-phones:2] ExecIf("SIP/9001-088aa918",
"1|AGI(/root/dummy.php)|1234567890") in new stack

[Dec  6 04:40:46] WARNING[12293]: app_exec.c:186 execif_exec: Count
not find application! (AGI(/root/dummy.php))
=====

It doesn't look like ExecIf() is the right way to have Asterisk run an
AGI script conditionnally. What would be the right way to do this?

Thank you.




More information about the asterisk-users mailing list