----- Original Message -----
> Trying to pass ${EXTEN} to a php file for processing. Not sure how to.
> The php file takes $did_numb as defined:
> 
> 
> <?php
> 
> $did_numb = $_GET['did_numb'];
> ?>

There are two ways to do this. If you insist on using a system() call you could 
pass the variable as an aguement. I don't recall how to use the system() 
function to pass an argument so I'll guess here:

exten => s,n,system(php file.php "${EXTEN}")

Then in PHP use:

#!/usr/bin/php
<?php
        $did_numb = $_GLOBALS['argv'][1]
?>

> 
> I know that http://serverIP/file.php?did_numb=416-444-5555 works fine
> but when calling php file by system() from dialplan how can this be
> done?
> 
> 
> exten => s,n,system(php file.php?did_numb=${EXTEN}) |||| This method
> doesn't work as "php file.php?did_numb=416-444-555" simply doesn't
> work from the CentOS prompt.
> 
> 
> What is the proper syntax here?
> 
> 
> I also want whatever that file.php returns to be saved in $var for
> later usage in dial-plan afterwards.

Okay so what you really want is to use AGI. Get an AGI library for PHP. I 
recall using one called phpagi.php (http://sourceforge.net/projects/phpagi/)

You will want to use the get_variable() and set_variable() functions.

Again from memory:

exten => s,n,agi(file.php)

Then the PHP code

#!/usr/bin/php
<?php

// Use the phpagi library
require "phpagi.php';

// It's an object so let's instantiate it
$agi = new AGI();

// Get a variable from dial plan
$agi->get_variable($EXTEN);

// do something, like assign a value to $var
$var = "something";

// Set a dial plan variable
$agi->set_variable("var", $var);

exit(0);
?>

-- 
John Van Ostrand 
CTO, co-CEO 
Net Direct Inc. 
564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6 
Ph: 866-883-1172 x5102 
Fx: 519-883-8533 

Linux Solutions / IBM Hardware 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to