简体   繁体   中英

Calling PHP function from AGI not working

I'm using PHPAGI script telling the user to dial a number and then pass the number to the function to dial out, but it isn't working. I'm trying to call the function from my script but it isn't working.

Here is my code:

$agi->text2wav("please enter number to dial");
$num = $agi->exec("Read","pin,,,3,120");
$temp = $agi->get_variable("pin");
$pin = trim($temp["data"]);
dialout("$pin");

function dialout($pin)
{
    $agi=new AGI();
    $agi->exec_dial("SIP/$pin");
    $Answeredtime = $agi->get_variable("ANSWEREDTIME");
    $agi->hangup ();
}

1) stop asterisk

asterisk -rx " core stop now"

2) start asterisk at current console

asterisk -vvvvgc

NOT stop it.

3) issue

 agi set debug on

After that you will have much more info and php errors from your script

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM