agi Commands


Functions

agiastxx::agi::answer ()
 Answer the channel.
int astxx::agi::channel_status (const std::string &channel="") const
 Get the status of a channel.
char astxx::agi::control_stream_file (const std::string &filename, const std::string &escape_digits="", int skip_time=control_stream_file_skip_time, char fastforward=0, char rewind=0, char pause=0) const
 Play a file on the channel with the option to control playback.
agiastxx::agi::database_del (const std::string &family, const std::string &key)
 Delete a database key.
agiastxx::agi::database_deltree (const std::string &family, const std::string &keytree="")
 Delete a database family or keytree.
std::string astxx::agi::database_get (const std::string &family, const std::string &key) const
 Get a value out of the Asterisk database.
agiastxx::agi::database_put (const std::string &family, const std::string &key, const std::string &value)
 Put a value in the database.
int astxx::agi::exec (const std::string &app, const std::string &options="") const
 Execute a given application.
std::string astxx::agi::get_data (const std::string &file, int timeout=0, int max_digits=get_data_max_digits) const
 Stream a file and receive DTMF data.
std::string astxx::agi::get_full_variable (const std::string &variable, const std::string &channel="") const
 More robust version of astxx::agi::get_variable.
char astxx::agi::get_option (const std::string &file, const std::string &escape_digits="", int timeout=0) const
 Stream a file and read a digit.
std::string astxx::agi::get_variable (const std::string &variable) const
 Get the value of a channel variable.
agiastxx::agi::hangup (const std::string &channel="")
 Hangup a channel.
agiastxx::agi::noop ()
 Does nothing.
char astxx::agi::receive_char (int timeout=0) const
 Receive a character from channels that support it.
std::string astxx::agi::receive_text (int timeout=0) const
 Receive text from channels that support it.
char astxx::agi::record_file (const std::string &filename, const std::string &format, const std::string &escape_digits="", int timeout=-1, int silence=0, bool beep=true, long offset=0) const
 Record audio and store it in the given location.
char astxx::agi::say_alpha (int number, const std::string &escape_digits="") const
 Say a given character string.
char astxx::agi::say_alpha (const std::string &alphanum, const std::string &escape_digits="") const
 Say a given character string.
char astxx::agi::say_date (time_t date, const std::string &escape_digits="") const
 Say a given date.
char astxx::agi::say_datetime (time_t date, const std::string &escape_digits="", const std::string &format="", const std::string &timezone="") const
 Say a given date in the format specfied.
char astxx::agi::say_digits (int digits, const std::string &escape_digits="") const
 Say a given digit string as indiviual digits.
char astxx::agi::say_number (int number, const std::string &escape_digits="") const
 Say a given number.
char astxx::agi::say_phonetic (const std::string &characters, const std::string &escape_digits="") const
 Say a given character string with phonetics (alpha, bravo, charile.
char astxx::agi::say_time (time_t time, const std::string &escape_digits="") const
 Says a given time.
agiastxx::agi::send_image (const std::string &image)
 Send an image to channels that support it.
agiastxx::agi::send_text (const std::string &text)
 Send text to channels that support it.
agiastxx::agi::set_autohangup (int delay)
 Hangup a channel after the specified time has passed.
agiastxx::agi::set_callerid (const std::string &cid)
 Set the callerid for the current channel.
agiastxx::agi::set_callerid (int number)
 Set the callerid for the current channel.
agiastxx::agi::set_context (const std::string &context)
 Set the channel context.
agiastxx::agi::set_extension (const std::string &extension)
 Set the channel extension.
agiastxx::agi::set_extension (int extension)
 Set the channel extension.
agiastxx::agi::set_music (bool enable, const std::string &music_class="")
 Enable/Disable music on hold generator.
agiastxx::agi::set_priority (const std::string &priority)
 Set the priority of the channel.
agiastxx::agi::set_priority (int priority)
 Set the priority of the channel.
agiastxx::agi::set_variable (const std::string &variable, const std::string &value)
 Set a given variable.
char astxx::agi::stream_file (const std::string &filename, const std::string &escape_digits="", long offset=0) const
 Plays a given file on the audio channel.
agiastxx::agi::tdd_mode (const std::string &mode)
 Change the TDD mode of the channel.
agiastxx::agi::tdd_mode (bool enable)
 Toggles TDD mode on or off (for the deaf).
agiastxx::agi::verbose (const std::string &text, int level=1)
 Log a message to the Asterisk verbose log.
char astxx::agi::wait_for_digit (long timeout=-1) const
 Wait for a digit to be pressed.


Function Documentation

agi & agi::answer (  )  [inherited]

Answer the channel.

Answers the channel if not already in answer state. Throws an exception on error.

Returns:
a reference to this astxx::agi instance

Definition at line 312 of file agi.cc.

References astxx::agi::execute().

int agi::channel_status ( const std::string &  channel = ""  )  const [inherited]

Get the status of a channel.

Returns the status of the specified channel. If no channel is given then the status of the current channel is used.

Return values:

  • 0 - Channel is down and available
  • 1 - Channel is down but reserved
  • 2 - Channel is off hook
  • 3 - Digits (or equivalent) have been dialed
  • 4 - Line is ringing
  • 5 - Remote end is ringing
  • 6 - Line is up
  • 7 - Line is busy

Parameters:
channel the channel to get the status of
Returns:
the status of the given channel
Todo:
Possibly return status values as values from an enum

Definition at line 338 of file agi.cc.

References astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

char agi::control_stream_file ( const std::string &  filename,
const std::string &  escape_digits = "",
int  skip_time = control_stream_file_skip_time,
char  fastforward = 0,
char  rewind = 0,
char  pause = 0 
) const [inherited]

Play a file on the channel with the option to control playback.

Parameters:
filename the file to stream (no extension should be specfied)
escape_digits digits to break on
skip_time the number of milliseconds to skip in a fastforward or rewind operation
fastforward the character to use for fastforwarding the stream
rewind the character to use for rewinding the stream
pause the character to use to pause the stream
Returns:
the digit pressed if any (0 for no digit)

Definition at line 354 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::database_del ( const std::string &  family,
const std::string &  key 
) [inherited]

Delete a database key.

Parameters:
family the family to delete from
key the key to delete
Exceptions:
agi::database_error thown when there is a error deleting a key/value
Returns:
a reference to this astxx::agi instance

Definition at line 385 of file agi.cc.

References astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

agi & agi::database_deltree ( const std::string &  family,
const std::string &  keytree = "" 
) [inherited]

Delete a database family or keytree.

Parameters:
family the family to delete or delete from
keytree the key tree to delete
Exceptions:
agi::Database thown when there is a error deleting a family/value
Returns:
a reference to this astxx::agi instance

Definition at line 403 of file agi.cc.

References astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

string agi::database_get ( const std::string &  family,
const std::string &  key 
) const [inherited]

Get a value out of the Asterisk database.

This function may throw an exception in the future. Currently it returns an empty string if the value does not exist in the database.

Parameters:
family the family the key is in
key the key to look up

Definition at line 420 of file agi.cc.

References astxx::agi::result::data, astxx::agi::execute(), and astxx::agi::quote().

agi & agi::database_put ( const std::string &  family,
const std::string &  key,
const std::string &  value 
) [inherited]

Put a value in the database.

Parameters:
family the database family to use
key the database key to use
value the value to put in the database
Exceptions:
agi::database_error thrown if there are any problems inserting the value into the database
Returns:
a reference to this astxx::agi instance

Definition at line 435 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

int agi::exec ( const std::string &  app,
const std::string &  options = "" 
) const [inherited]

Execute a given application.

Todo:
This function may throw an exception if the application is not found in the future.
Parameters:
app the application to execute
options options for the application (these should be seperated with pipes (|))
Returns:
the return value from the application or -2 if the application was not found

Definition at line 453 of file agi.cc.

References astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

string agi::get_data ( const std::string &  file,
int  timeout = 0,
int  max_digits = get_data_max_digits 
) const [inherited]

Stream a file and receive DTMF data.

Parameters:
file the file to be streamed
timeout a timeout to wait for digits in seconds
max_digits the maximum number of digits to receive
Returns:
the DTMF digits recieved, or '' an empty string on timeout

Definition at line 465 of file agi.cc.

References astxx::agi::execute().

string agi::get_full_variable ( const std::string &  variable,
const std::string &  channel = "" 
) const [inherited]

More robust version of astxx::agi::get_variable.

This function returns the specfied variable name. It differs from astxx::agi::get_variable in that it handles complex variable names and builtin variables.

Variable names should take the same format they do in the dialplan (ie. ${VARIABLE_NAME}). This is different from agi::get_variable in that get_variable accepts a plain variable name and will not parse complex names.

Parameters:
variable the variable to retrieve
channel the channel to look in
Todo:
Possibly throw an exception if the variable is not found.
Returns:
the value of the specfied variable

Definition at line 495 of file agi.cc.

References astxx::agi::result::data, astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

char agi::get_option ( const std::string &  file,
const std::string &  escape_digits = "",
int  timeout = 0 
) const [inherited]

Stream a file and read a digit.

Parameters:
file the file to stream
escape_digits digits to return on
timeout a timeout in seconds
Returns:
the digit pressed if any (0 for no digit)

Definition at line 523 of file agi.cc.

References astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

string agi::get_variable ( const std::string &  variable  )  const [inherited]

Get the value of a channel variable.

Parameters:
variable the variable to retrieve
Returns:
the value of the variable
Todo:
Possibly throw exception if the variable does not exist

Definition at line 543 of file agi.cc.

References astxx::agi::result::data, astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

agi & agi::hangup ( const std::string &  channel = ""  )  [inherited]

Hangup a channel.

Parameters:
channel hangup the channel to hang up, if omitted, use the current channel.
Returns:
a reference to this astxx::agi instance

Definition at line 564 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::noop (  )  [inherited]

Does nothing.

Returns:
a reference to this astxx::agi instance

Definition at line 572 of file agi.cc.

References astxx::agi::execute().

char agi::receive_char ( int  timeout = 0  )  const [inherited]

Receive a character from channels that support it.

Parameters:
timeout the timeout to wait in milliseconds
Returns:
the character recieved

Definition at line 583 of file agi.cc.

References astxx::agi::execute().

std::string agi::receive_text ( int  timeout = 0  )  const [inherited]

Receive text from channels that support it.

Parameters:
timeout the timeout to wait in milliseconds
Todo:
Maybe we should catch the application_error and just return an empty string. We could also repackage the exception as an agi::timeout exception.
Exceptions:
agi::application_error when a timeout occurs
Returns:
the text recieved

Definition at line 596 of file agi.cc.

References astxx::agi::execute().

char agi::record_file ( const std::string &  filename,
const std::string &  format,
const std::string &  escape_digits = "",
int  timeout = -1,
int  silence = 0,
bool  beep = true,
long  offset = 0 
) const [inherited]

Record audio and store it in the given location.

Record an audio stream to a file until a given dtmf digit is pressed or a timeout is reached.

Parameters:
filename the name of the file to record to
format the format of the file
escape_digits a string of digits to return on
timeout a timeout in milliseconds (use -1 for no timeout)
silence the maximum amount of silence to accept at the end of the (use 0 for no silence timeout) recording in seconds
beep whether to beep or not before begining the recording
offset the offset to begin writing at
Returns:
any digits pressed or 0 on timeout

Definition at line 619 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

char agi::say_alpha ( int  number,
const std::string &  escape_digits = "" 
) const [inherited]

Say a given character string.

Parameters:
number the number to say
escape_digits digits to break on
Returns:
the digit pressed if any (0 for no digit)

Definition at line 653 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

char agi::say_alpha ( const std::string &  alphanum,
const std::string &  escape_digits = "" 
) const [inherited]

Say a given character string.

Parameters:
alphanum the string to say
escape_digits digits to break on
Returns:
the digit pressed if any (0 for no digit)

Definition at line 642 of file agi.cc.

References astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

char agi::say_date ( time_t  date,
const std::string &  escape_digits = "" 
) const [inherited]

Say a given date.

Parameters:
date the date in seconds since the epoch
escape_digits digits to break on
Returns:
the digit pressed if any (0 for no digit)

Definition at line 666 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

char agi::say_datetime ( time_t  date,
const std::string &  escape_digits = "",
const std::string &  format = "",
const std::string &  timezone = "" 
) const [inherited]

Say a given date in the format specfied.

Say a given date and/or time in the format specfied. Return early if any of the given DTMF digits are pressed. See voicemail.conf for formatting options. The format defaults to "ABdY 'digits/at' IMp".

Parameters:
date the date/time to say in seconds since the epoch
escape_digits digits to break on
format the format to use (see voicemail.conf)
timezone the timezone the time is in (acceptable values can be found in /usr/share/zoneinfo)
Returns:
the digit pressed if any (0 for no digit)

Definition at line 686 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

char agi::say_digits ( int  digits,
const std::string &  escape_digits = "" 
) const [inherited]

Say a given digit string as indiviual digits.

Parameters:
digits the digits to say
escape_digits digits to break on
Returns:
the digit pressed if any (0 for no digit)

Definition at line 706 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

char agi::say_number ( int  number,
const std::string &  escape_digits = "" 
) const [inherited]

Say a given number.

Parameters:
number the number to say
escape_digits digits to break on
Returns:
the digit pressed if any (0 for no digit)

Definition at line 719 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

char agi::say_phonetic ( const std::string &  characters,
const std::string &  escape_digits = "" 
) const [inherited]

Say a given character string with phonetics (alpha, bravo, charile.

..).

Parameters:
characters the string to say
escape_digits digits to break on
Returns:
the digit pressed if any (0 for no digit)

Definition at line 732 of file agi.cc.

References astxx::agi::execute(), astxx::agi::quote(), and astxx::agi::result::result.

char agi::say_time ( time_t  time,
const std::string &  escape_digits = "" 
) const [inherited]

Says a given time.

Parameters:
time the time to say in seconds since the epoch
escape_digits digits to break on
Returns:
the digit pressed if any (0 for no digit)

Definition at line 743 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::send_image ( const std::string &  image  )  [inherited]

Send an image to channels that support it.

Most channels do not support the transmission of images.

Parameters:
image the name of the image, should not include an extension
Returns:
a reference to this astxx::agi instance

Definition at line 757 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::send_text ( const std::string &  text  )  [inherited]

Send text to channels that support it.

Most channels do not support the transmission of text.

Parameters:
text the text to send
Returns:
a reference to this astxx::agi instance

Definition at line 770 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::set_autohangup ( int  delay  )  [inherited]

Hangup a channel after the specified time has passed.

Parameters:
delay the number of seconds to wait before hanging up, 0 will disable any pending auto hangups
Returns:
a reference to this astxx::agi instance

Definition at line 782 of file agi.cc.

References astxx::agi::execute().

agi & agi::set_callerid ( const std::string &  cid  )  [inherited]

Set the callerid for the current channel.

Parameters:
cid the callerid to set, should be a number or in the form "name" <number> or name <number>
Returns:
a reference to this astxx::agi instance

Definition at line 809 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::set_callerid ( int  number  )  [inherited]

Set the callerid for the current channel.

Parameters:
number the callerid to set
Returns:
a reference to this astxx::agi instance

Definition at line 795 of file agi.cc.

References astxx::agi::execute().

agi & agi::set_context ( const std::string &  context  )  [inherited]

Set the channel context.

Sets the context for continuation upon exiting the application.

Parameters:
context the context to use
Returns:
a reference to this astxx::agi instance

Definition at line 822 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::set_extension ( const std::string &  extension  )  [inherited]

Set the channel extension.

Sets the extension for continuation upon exiting the application.

Parameters:
extension the extension to use
Returns:
a reference to this astxx::agi instance

Definition at line 850 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::set_extension ( int  extension  )  [inherited]

Set the channel extension.

Sets the extension for continuation upon exiting the application.

Parameters:
extension the extension to use
Returns:
a reference to this astxx::agi instance

Definition at line 835 of file agi.cc.

References astxx::agi::execute().

agi & agi::set_music ( bool  enable,
const std::string &  music_class = "" 
) [inherited]

Enable/Disable music on hold generator.

Parameters:
enable enable or disable music on hold.
music_class the music on hold class to use
Returns:
a reference to this astxx::agi instance

Definition at line 862 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::set_priority ( const std::string &  priority  )  [inherited]

Set the priority of the channel.

Sets the priority for continuation upon exiting the application.

Parameters:
priority the priority to use
Returns:
a reference to this astxx::agi instance

Definition at line 901 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::set_priority ( int  priority  )  [inherited]

Set the priority of the channel.

Sets the priority for continuation upon exiting the application.

Parameters:
priority the priority to use
Returns:
a reference to this astxx::agi instance

Definition at line 886 of file agi.cc.

References astxx::agi::execute().

agi & agi::set_variable ( const std::string &  variable,
const std::string &  value 
) [inherited]

Set a given variable.

Parameters:
variable the variable to set
value the value to use
Returns:
a reference to this astxx::agi instance

Definition at line 913 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

char agi::stream_file ( const std::string &  filename,
const std::string &  escape_digits = "",
long  offset = 0 
) const [inherited]

Plays a given file on the audio channel.

Parameters:
filename the file to stream (no extension should be specfied)
escape_digits digits to break on
offset the offset to begin playback at
Returns:
the digit pressed if any (0 for no digit)

Definition at line 926 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::tdd_mode ( const std::string &  mode  )  [inherited]

Change the TDD mode of the channel.

Parameters:
mode the mode to set (on, off, tdd, mate)
Todo:
maybe use enum for modes
Returns:
a reference to this astxx::agi instance

Definition at line 958 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

agi & agi::tdd_mode ( bool  enable  )  [inherited]

Toggles TDD mode on or off (for the deaf).

Parameters:
enable wheather to enable or disable TDD on the channel
Returns:
a reference to this astxx::agi instance

Definition at line 942 of file agi.cc.

References astxx::agi::execute().

agi & agi::verbose ( const std::string &  text,
int  level = 1 
) [inherited]

Log a message to the Asterisk verbose log.

Feel free to pass newlines (\n) in your text string as this function handles parsing them out into multiple verbose commands.

Parameters:
text the message to log
level the level to log at
Returns:
a reference to this astxx::agi instance

Definition at line 973 of file agi.cc.

References astxx::agi::execute(), and astxx::agi::quote().

char agi::wait_for_digit ( long  timeout = -1  )  const [inherited]

Wait for a digit to be pressed.

Parameters:
timeout timeout to wait in miliseconds, use -1 (the default) for no timeout
Returns:
the digit pressed if any (0 for no digit)

Definition at line 998 of file agi.cc.

References astxx::agi::execute().


Generated on Thu Jul 3 01:32:46 2008 for Astxx by  doxygen 1.5.6