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


Manual Reference Pages  -  ASTERISK::FASTAGI (3)

.ds Aq ’

NAME

Asterisk::FastAGI - Module for FastAGI handling.

CONTENTS

SYNOPSIS



  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);
  }



DESCRIPTION

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.

USAGE EXAMPLE

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.

METHODS

    param

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);



    input

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);



    agi

Will return the Asterisk::AGI object.

    process_request

This will process the agi request from asterisk.

    dispatch_request

Method used to dispatch the FastAGI request.

    child_init_hook

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();
  }



SEE ALSO

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

AUTHOR

Jason Yates <jaywhy@gmail.com>

COPYRIGHT AND LICENSE

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.

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


perl v5.20.3 ASTERISK::FASTAGI (3) 2007-07-26

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