[asterisk-users] How to pass variable back and forth from dialplan to php file?
Carlos Chavez
cursor at telecomabmex.com
Mon Jun 14 13:15:24 CDT 2010
On Mon, 2010-06-14 at 13:41 -0400, bruce bruce wrote:
> Hi Carlso,
>
>
> Thanks for the input. I have done this in php and am not familiar with
> phpagi.
> So, there is absolutely no way to temporarily solve this problem by
> getting the value back from php file?
>
>
> Wondering if it would require a lot of work to change the php file to
> phpagi?
> Thanks,
> Bruce
>
Here is an example:
exten => _x.,1,AGI(sample.agi)
exten => _x.,n,NoOp(${var})
sample.agi:
#!/usr/bin/php -q
<?php
set_time_limit(30);
require('phpagi/phpagi.php');
$agi = new AGI();
$exten = $agi->request['agi_extension']; //Dialed extension
// the result is stored in $exten
// do something with your data
$agi->set_variable("var", $result);
$agi->verbose("The result was: $result", 3);
?>
You can even send parameters to the AGI via the command line like:
exten => _x.,1,AGI(sample.agi,param1,param2) //Use comma for 1.6 or |
for 1.4 or below
And access them via $argv[1], $argv[2] is there is some extra
information that you cannot get via the AGI variables.
--
Telecomunicaciones Abiertas de México S.A. de C.V.
Carlos Chávez Prats
Director de Tecnología
+52-55-91169161 ext 2001
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20100614/9c39d63c/attachment.pgp
More information about the asterisk-users
mailing list