Posts Tagged ‘api’

Using the Asterisk Manager PHP API

July 19th, 2008

Well it’s been a while since the PHP Asterisk Manager API was released and I’ve yet to produce a clear and definitive example of its use.  So here goes.

Prerequisites

Your Asterisk server must be set up correctly before this API can ’speak’ to the server.

  • First you’ll need to ensure the Manager interface is active and you’ve set the correct permissions (If you’d like this explaining please leave a comment).
  • Secondly make sure you are setup with the ability for two endpoints to call each other.  This won’t work if you have one phone on the server.

Install

Firstly you’ll need to get hold of the library and there’s two routes to take.  You can either install via PEAR or simply checkout the source from the Google Project:

svn checkout http://asterisk-php-api.googlecode.com/svn/trunk/ asterisk-php-api

Originating a Call

Once you’ve got it all ready you need to start your new file thats going to make use of it.  In this example I’m creating a simple dialler called: “call.php” which will take two GET variables, with one being the callee and one the caller.

 '192.168.1.5',
  'port' => '5038',
  'auto_connect' => true
);

//Initialise
$am = new Net_AsteriskManager($params);

//Login to the Asterisk Manager interface
$am->login('user', 'pass');

//Originate Call is one of the commands available and it causes a call to be made and connected between two endpoints.
$am->originateCall($number, $from, $context, $cid, 1, 30000);
?>

By looking at the comments above you should see how this works and the steps required. If not then leave any comments and I’ll build on the above. It’s sometimes difficult to know what people already know so apologies if this is too simple or complex. :)

Later on I’ll show how to work with queues – adding, removing, listing, etc.

Ruby Asterisk: 2 Libraries & 2 Docs

March 31st, 2008

AsteriskJust so the Asterisk-Ruby’ists don’t feel left out after my PHP Asterisk post here’s a useful list if you’re wanting to integrate Asterisk with your Ruby (on Rails) app:

  • Adhearsion – Its a full framework on top of Asterisk built in Ruby. Think ‘RAGI-on-steroids’.
  • RAGI – Ruby Asterisk Gateway Interface provides a Ruby interface to Asterisks manager. Similar to my PHP library.
  • RAGI Tutorial – Quick intro at O’Reilly on getitng started with RAGI.
  • Adhearsion Tutorial – Aaaand another one for Adhearsion.

Facebook API Wins API of the Year

December 29th, 2007

Facebook LogoIf you’ve never heard of Programmable Web then I suggest you take a look. Its a huge directory of all the major APIs on the web open for development. They’ve decided to award the Best API of the Year to the Facebook site. It won based on its openness, audience, money-making potential, viral features, modularity and metrics.

This got me thinking of ideas to put into a new Facebook app but before I jump in at the deep end I’m going to start small with a few quizzes that can plu gin to my existing sites then build from there.

Interesting side note for Ruby/Rails developers: There is an API interface for you to with rFacebook.

Failing that you could just get someone else to do it for you by getting one of the many Facebook Developers to do it for you.

Ruby + PayPal

June 30th, 2006

RubyI don’t normally like throwing up a basic link or copying another blog but this, THIS, really is good news – certainly for me anyway.PayPal

There’s been a number of libraries released for using Ruby with Paypal providing full integration with the online paytment service.

vPayPal

RoR::PayPal

Ruby PayPal

Google Adwords PHP APIlity

October 10th, 2005

Its been around for a few weeks now but I thought I’d point it out to those who hadn’t noticed its release. Google have unleashed a PHP API to their Google Adwords system called APIlity.

The APIlity PHP Library provides an object-oriented way to easily access and manage the Google AdWords API from within PHP. This comes along with an abstraction from the SOAP and WSDL details.

I’ll likely be producing some form of implementation example of this and posting it at a later date as it ties in quite well with my paid job.