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.
Philipp Kempgen
2007-Dec-06 04:11 UTC
[asterisk-users] Running AGI script if condition met?
Vincent wrote:> exten => 777,n,ExecIf($[${LEN(${CALLERIDNUM})} > 10],AGI(/root/dummy.php),${CALLERIDNUM})The line break is not a good idea.> 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?Wrong syntax. ExecIf(<expr>|<app>|<data>) So: ExecIf($[${LEN(${CALLERIDNUM})} = 10],AGI,/root/dummy.php) Not sure about more than one argument. Maybe ExecIf($[${LEN(${CALLERIDNUM})} = 10],AGI,/root/dummy.php,${CALLERIDNUM}) or ExecIf($[${LEN(${CALLERIDNUM})} = 10],AGI,/root/dummy.php|${CALLERIDNUM}) Asterisk's syntax is strange sometimes ... Regards, Philipp Kempgen -- amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de Let's use IT to solve problems and not to create new ones. Asterisk? -> http://www.das-asterisk-buch.de Gesch?ftsf?hrer: Stefan Wintermeyer Handelsregister: Neuwied B 14998