Skip to content

Commit

Permalink
Update and rename agi.conf to test.agi
Browse files Browse the repository at this point in the history
  • Loading branch information
aqeelabpro authored Oct 31, 2024
1 parent cacc750 commit 50622d5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Empty file removed agi.conf
Empty file.
26 changes: 26 additions & 0 deletions test.agi
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/php -q
<?php
// Reading AGI environment variables
function readAgiVariables() {
$agiVars = [];
while ($line = fgets(STDIN)) {
if (trim($line) == '') {
break;
}
list($key, $value) = explode(': ', trim($line), 2);
$agiVars[$key] = $value;
}
return $agiVars;
}

// Main logic of the AGI script
$agiVars = readAgiVariables();

// Retrieve the variable MY_VARIABLE
$myVariable = isset($agiVars['MY_VARIABLE']) ? $agiVars['MY_VARIABLE'] : 'Variable not set';

// Output the result
echo "SET VARIABLE my_response \"$myVariable\"\n";
echo "SAY TEXT \"$myVariable\"\n";
echo "HANGUP\n";
?>

0 comments on commit 50622d5

Please sign in to comment.