Git Product home page Git Product logo

asterisk-php-manager's Introduction

Asterisk PHP Manager

This was originally hosted at Google Project Code hosting but has been moved to GitHub to make it easier or people to do with as they please.

However, it is no longer actively developed by me (the original author).

The Asterisk Manager PHP API enables a developer to control their Asterisk PBX system from a PHP application. Allowing for call origination, monitoring, queue management, etc. Other examples include:

  • Adding handset to a queue.
  • Monitoring a channel.
  • Originating a call.
  • Getting server status.
  • Closing channels.

This was originally developed to help integrate PHP-driven CRM systems in the lending industry into the Asterisk PBX.

Example

require "../../AsteriskManager.php";

$params = array('server' => '127.0.0.1', 'port' => '5038');

/**
 * Instantiate Asterisk object and connect to server
 */
$ast = new Net_AsteriskManager($params);

/**
 * Connect to server
 */
try {
    $ast->connect();
} catch (PEAR_Exception $e) {
    echo $e;
}

/**
 * Login to manager API
 */
try {
    $ast->login('user', 'pass');
} catch(PEAR_Exception $e) {
    echo $e;
}

/**
 * Monitoring
 * Begin monitoring channel to filename "test.gsm"
 * If it fails then echo Asterisk error
 */
$chan = 'SIP/868';

try {
    $ast->startMonitor($chan, 'test', 'gsm', 1);
}  catch (PEAR_Exception $e) {
    echo $e;
}

/**
 * Queues
 * List queues then add and remove a handset from a queue
 */

// Print all the queues on the server
try {
    echo $ast->getQueues();
} catch(PEAR_Exception $e) {
    echo $e;
}

// Add the SIP handset 234 to a the applicants queue
try {
    $ast->queueAdd('applicants', 'SIP/234', 1);
} catch(PEAR_Exception $e) {
    echo $e;
}

// Take it out again
try {
    $ast->queueRemove('applicants', 'SIP/234');
} catch (PEAR_Exception $e) {
    echo $e;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.