Php AGI not work property

I make a AGI php script that I want to do, that the phone that call, send a good day and the text of the user.


1.-Call xxxx
2.-Retrive callerid
3.-Found callerid
4.-send text to softphone “hello john” (john is the callidname)

I try this but not work.

#!/usr/bin/php -q

<?php set_time_limit(30); include("phpagi.php"); $agi=new AGI(); $agi->answer(); //$cid=$agi->exec("SetVar\(callid={$CALLERIDNAME}\)"); $nameid=$agi[callerid]; //$agi->get_variable("$CALLERID(name)"); $name=$nameid; $agi->send_text("Hi, $name"); $agi->text2wav("hi $namet"); $agi->stream_file("goodbye"); ?>

$agi->send_text(“Hi, $name”);
$agi->text2wav(“hi $namet”);

you have a mistake here

$agi->text2wav(“hi $namet”);

should be

$agi->text2wav(“hi $name”);

because your variable is $name

thaks, but is a typographic error to transcribe here.

I have the name of var good. But not work.

Or How can I do change de $CALLERIDNAME global var in the php AGI script ?


There’s no ${CALLERIDNAME} since 1.0 I think. There’s a CALLERID() function instead, but I’m not sure if you can access functions from the AGI interface. Try “show function CALLERID” or “core show function CALLERID” (if you’re running 1.4) in the CLI.