Author Topic: Want to do more with php need connection with phpapi  (Read 2812 times)


  • Newbie
  • *
  • Posts: 19
  • Karma: 1
    • View Profile
    • Engineering and solutions
Want to do more with php need connection with phpapi
« on: March 18, 2011, 03:19:43 PM »

In askozia their is a directory #etc/asterisk/agi-bin
This is the standard directory for the files phpagi-asmanager.php and phpagi.php

You need these files if you want to communicate with the asterisk system.
I want to monitor the connected phones, and found the very small php app (see listing)
What will be the best place to place the file .. so that I can go with the browser to:
http://[url askozia bpx]/extcheck.php


Is that NOT possible on the askozia platform ?

   #!/usr/bin/php -q
   * Filename:      extcheck.php
   * Auther:       Zeeshan A Zakaria

   require_once "phpagi-asmanager.php"; // Note that phpagi-asmanager.php in itself includes phpagi.php
   $AGI = new AGI();
   $astman = new AGI_AsteriskManager();
   if (!$astman->connect("", "sadmin", "sadmin")) {
     exit (1);
   $callee = $AGI->request['agi_extension'];
   $extstatus = is_ext_avail($callee);
   $AGI->verbose("Status for extension $callee is $extstatus");
   if ($extstatus>0) {
      $AGI->goto('cancel'); // Note that 'cancle' is the name of a context in our dialplan

   function is_ext_avail($extnum) {
      global $astman;
       $status = $astman->ExtensionState( $extnum, 'my-extensions' ); // my-extensions is a context in our dialplan
       $status = $status['Status'];
    return $status;



See more technical info:
Binnenkort meer informatie ook te vinden op