SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from openSUSE Leap 15 asterisk-perl-0.08-lp155.3.3.noarch.rpm

Asterisk::AGI

Section: User Contributed Perl Documentation (3)
Updated: 2003-08-07
Index 

NAME

Asterisk::AGI - Simple Asterisk Gateway Interface Class 

SYNOPSIS

use Asterisk::AGI;

$AGI = new Asterisk::AGI;

# pull AGI variables into %input

        %input = $AGI->ReadParse();

# say the number 1984

        $AGI->say_number(1984);
 

DESCRIPTION

This module should make it easier to write scripts that interact with theasterisk open source pbx via AGI (asterisk gateway interface) 

AGI COMMANDS

$AGI->stream_file($filename, $digits)
Executes AGI Command ``STREAM FILE $filename $digits''

This command instructs Asterisk to play the given sound file and listen for the given dtmf digits. Thefileextension must not be used in the filename because Asterisk will find the most appropriate filetype.

Example: $AGI->stream_file('demo-echotest', '0123');

Returns: -1 on error or hangup,0 if playback completes without a digit being pressed,or the ASCII numerical value of the digit if a digit was pressed

$AGI->send_text($text)
Executes AGI Command ``SEND TEXT ''$text"

Sends the given text on a channel. Most channels do not support the transmission of text.

Example: $AGI->send_text('You've got mail!');

Returns: -1 on error or hangup,0 if the text was sent or if the channel does not support text transmission.

$AGI->send_image($image)
Executes AGI Command "SEND IMAGE $image

Sends the given image on a channel. Most channels do not support the transmission of images.

Example: $AGI->send_image('image.png');

Returns: -1 on error or hangup,0 if the image was sent or if the channel does not support image transmission.

$AGI->say_number($number, $digits)
Executes AGI Command ``SAY NUMBER $number $digits''

Says the given $number, returning early if any of the $digits are received.

Example: $AGI->say_number('98765');

Returns: -1 on error or hangup,0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit of one was pressed.

$AGI->say_digits($number, $digits)
Executes AGI Command ``SAY DIGITS $number $digits''

Says the given digit string $number, returning early if any of the $digits are received.

Example: $AGI->say_digits('8675309');

Returns: -1 on error or hangup,0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit of one was pressed.

$AGI->answer()
Executes AGI Command ``ANSWER''

Answers channel if not already in answer state

Example: $AGI->answer();

Returns: -1 on channel failure, or0 if successful

$AGI->get_data($filename, $timeout, $maxdigits)
Executes AGI Command ``GET DATA $filename $timeout $maxdigits''

Streams $filename and returns when $maxdigits have been received orwhen $timeout has been reached. Timeout is specified in ms

Example: $AGI->get_data('demo-welcome', 15000, 5);

$AGI->set_callerid($number)
Executes AGI Command ``SET CALLERID $number''

Changes the callerid of the current channel to <number>

Example: $AGI->set_callerid('9995551212');

Returns: Always returns 1

$AGI->set_context($context)
Executes AGI Command ``SET CONTEXT $context''

Changes the context for continuation upon exiting the agi application

Example: $AGI->set_context('dialout');

Returns: Always returns 0

$AGI->set_extension($extension)
Executes AGI Command ``SET EXTENSION $extension''

Changes the extension for continuation upon exiting the agi application

Example: $AGI->set_extension('7');

Returns: Always returns 0

$AGI->set_priority($priority)
Executes AGI Command ``SET PRIORITY $priority''

Changes the priority for continuation upon exiting the agi application

Example: $AGI->set_priority(1);

Returns: Always returns 0

$AGI->hangup($channel)
Executes AGI Command ``HANGUP $channel''

Hangs up the passed $channel, or the current channel if $channel is not passed.It is left to the AGI script to exit properly, otherwise you could end up with zombies.

Example: $AGI->hangup();

Returns: Always returns 1

$AGI->exec($app, $options)
Executes AGI Command ``EXEC $app $options''

The most powerful AGI command. Executes the given application passing the given options.

Example: $AGI->exec('Dial', 'Zap/g2/8005551212');

Returns: -2 on failure to find application, orwhatever the given application returns

$AGI->set_variable($variable, $value)
Executes AGI Command ``SET VARIABLE $variable $value''

Sets the channel variable <variablename> to <value>

Example: $AGI->set_variable('status', 'authorized');

Returns: Always returns 1

$AGI->get_variable($variable)
Executes AGI Command ``GET VARIABLE $variablename''

Gets the channel variable <variablename>

Example: $AGI->get_variable('status');

Returns: The value of the variable, or undef if variable does not exist

$AGI->verbose($message, $level)
Executes AGI Command ``VERBOSE $message $level''

Logs $message with verboselevel $level

Example: $AGI->verbose(``System Crashed\n'', 1);

Returns: Always returns 1

$AGI->database_get($family, $key)
Executes AGI Command ``DATABASE GET $family $key''

Example: $var = $AGI->database_get('test', 'status');

Returns: The value of the variable, or undef if variable does not exist

$AGI->database_put($family, $key, $value)
Executes AGI Command ``DATABASE PUT $family $key $value''

Set/modifes database entry <family>/<key> to <value>

Example: $AGI->database_put('test', 'status', 'authorized');

Returns: 1 on success, 0 otherwise

$AGI->database_del($family, $key)
Executes AGI Command ``DATABASE DEL $family $key''

Removes database entry <family>/<key>

Example: $AGI->database_del('test', 'status');

Returns: 1 on success, 0 otherwise

$AGI->database_deltree($family, $key)
Executes AGI Command ``DATABASE DELTREE $family $key''

Deletes a family or specific keytree within a family in the Asterisk database

Example: $AGI->database_deltree('test', 'status'); Example: $AGI->database_deltree('test');

Returns: 1 on success, 0 otherwise


 

Index

NAME
SYNOPSIS
DESCRIPTION
AGI COMMANDS

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector