AGI PHP Question

Hi! I’m trying to generate a call and at the same time change a global variable, so that it would fit somewhere else. This is my code:

This code Originates a call from 1001 to 950. 950 will handle the call in the dialplan.

<?php
#!/usr/bin/php -q

require_once('../../../lib/asterisk/agi-bin/phpagi-asmanager.php');
require_once	('../../../lib/asterisk/agi-bin/phpagi.php');

  $number = '1001';
  $number2= '950';

  $agix = new AGI();	
  $asm = new AGI_AsteriskManager();
  
  if($asm->connect())
  {

	$agix->set_variable('variable','asterisk-friend');
       $asm->Originate("SIP/".$number,$number2,"from-internal",1,"",'',4000,$number,'','','','');


    $asm->disconnect();
  }
?>

Later, on the Dialplan, I would like to do this:

[test] exten => 950,1,Answer exten => 950,n,Wait(2) exten => 950,n,Playback(${variable}) exten => 950,n,Hangup()

The problem is that nothing happens when I inster the command:

The program won’t even originate the call. Is it because I made both Asterisk Manager and AGI classes at the same time? If I erase that line, the program works fine and originates the call (though no “asterisk is your friend” is played)

Am I doing something wrong here?

Thanks for your kind help