AGI PHP help

aztroboy

Joined
Jun 7, 2009
Messages
3
Likes
0
Points
0
#1
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.



Code:
<?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:


Code:
[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:


Code:
$agix = new AGI();

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
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,915
Messages
130,920
Members
17,594
Latest member
knethardsolutions
Top