GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Asterisk::FastAGI(3) User Contributed Perl Documentation Asterisk::FastAGI(3)

Asterisk::FastAGI - Module for FastAGI handling.

  use base 'Asterisk::FastAGI';

  sub fastagi_handler {
    my $self = shift;

    my $param = $self->param('foo');
    my $callerid = $self->input('calleridname');

    $self->agi->say_number(1000);
  }

Asterisk::FastAGI provides a preforking daemon for handling FastAGI requests from Asterisk.

Read the Net::Server for more information about the logging facilities, configuration, etc.

First you need a module containing all of your AGI handlers.

  package MyAGI;

  use base 'Asterisk::FastAGI';
  
  sub agi_handler {
    my $self = shift;
    $self->agi->say_number(8675309);
  }

Then you simply need to have a script that runs the daemon.

  #!/usr/bin/perl
  use MyAGI;

  MyAGI->run();

When it is run it creates a preforking daemon on port '4573'. That is the default port for FastAGI. Read the Net::Server documentation on how to change this and many other options.

Returns parsed parameters sent in from the AGI script.

Inside extensions.conf:

  exten => 1111,1,Agi(agi://${SERVER}/fastagi_handler?foo=bar&blam=blah

You can access those parameters from inside your AGI script. Much like you would if those were URL parameters on a CGI script.

  my $foo = $self->param('foo');

Returns a hash containing the input from the AGI script.

  my %hash = $self->input()

If given a key. It will return that particular value.

  my $uniqueid = $self->input('uniqueid');

Will return the Asterisk::AGI object.

This will process the agi request from asterisk.

Method used to dispatch the FastAGI request.

This is called by Net::Server during child initialization. This is the method to override if you are going to be creating database connections for instance.

  sub child_init_hook {
    my $self = shift;
    $self->{server}{dbi} = DBI->connect();
  }

Net::Server, <http://asterisk.gnuinter.net/>

Jason Yates <jaywhy@gmail.com>

Copyright (C) 2006-2007 by Jason Yates

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

2007-07-26 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.