Archive for July, 2008

PyCon UK 2008

July 31st, 2008

PyConUK is just around the corner and the early bird tickets are only on sale until August 4th so be sure to get your tickets soon.

You can get the latest on the talks here: PyCon Talks

The Friday schedule of tutorials is available here: Tutorials.

This year Jacob Caplan Moss will be doing the Django tutorial!

The UK Python Conference is based in Birmingham UK and the website is here: PyCon 2008

Google App Engine Frustrations

July 20th, 2008

Google App Engine LogoI’ve tried more than once to jump onto the Google App Engine bandwagon to no avail. Unfortunately it’s preview nature is acting to frustrate any attempt I make build something I’m happy with. Just some thoughts so far:

No Direction – It’s been dumped into the ether with no solid direction. No recommended method or path to building your web app is given or hinted at. I’m all for choice and its great Google allow you to use Django, CherryPy, WebPy, etc. but it’d be helpful if a consistent and solid method was given. Unfortunately you’re left with the feeling that the GAE has been thrown together with no real thought of making a web app out of it.

Disorganised Documentation – This doesn’t help the problem mentioned above as the docs provide 3 or 4 ways of producing a web app from the start. It first tells you how to do it using basic CGI and printing directly to the browser. Then it shows you using the RequestHandler and WSGI app. At which point it doesn’t say URLs are now handled by the WSGIApp instead of the app.yaml. Then it brings Django templates into the mix. How about pretty URLs? Oh well we can do that in app.yaml, or using matched groups in the WSGI app. For the love of all thats holy can’t we just have a single nice solution? A recommended method? An idea? A guide?

Restrictions – So it gives you all that wonderful choice as mentioned above so you think you’re going to make the best of it but oh no. Now you have to put up with the restrictions. No MySQL, no Django admin, restricted URL retrival, restricted security, no file uploading.

So you have to ask the question: Why?

What, ultimately, is the point in it when there’s far better out there – Django, Merb, etc.  It has no purpose other than to faff with and so I shall be avoiding it for the forseeable.

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.

Programmer Competency Matrix

July 2nd, 2008

Where are you on this matrix?