How to pass value from php script back to dialplan

I am trying to figure out who to take a variable that is generated by a php script and using it back in a dialplan.
This is a php script that I am using as an example:

function check_username_pin($username, $pin) { $query="SELECT id FROM table WHERE ( username = '$username' AND pin = '$pin' )"; // dont return pin because of hackers $result=mysql_query($query); if(mysql_num_rows($result)>0) { return(1); } return(2); }

How can I pass the value of 1 or 2 back to the dial plan? Is there any samples I can see?


I would use the set_variable method of the php agi class you find at .


Marco Bruni