AsterNet Class Library (Sandcastle documentation)

| AsterNET.FastAGI.Command Namespace

AsterNet FastAGI Command
Classes

| Class | Description
--- | --- | ---
| AGICommand |
| AnswerCommand |

ChannelStatusCommand

Returns the status of the specified channel. If no channel name is given the returns the status of the current channel.
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

ControlStreamFileCommand

Plays the given file, allowing playback to be interrupted by the given digits, if any, and allows the listner to control the stream.
If offset is provided then the audio will seek to sample offset before play starts.
Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or -1 on error or if the channel was disconnected.
Remember, the file extension must not be included in the filename.
Available since Asterisk 1.2

| DatabaseDelCommand | Deletes a family or specific keytree within a family in the Asterisk database. Returns 1 if successful, 0 otherwise.
| DatabaseDelTreeCommand | Deletes an entry in the Asterisk database for a given family and key. Returns 1 if successful, 0 otherwise.
| DatabaseGetCommand | Retrieves an entry in the Asterisk database for a given family and key. Returns 0 if is not set. Returns 1 if the variable is set and returns the value in parenthesis. Example return code: 200 result=1 (testvariable)
| DatabasePutCommand | Adds or updates an entry in the Asterisk database for a given family, key, and value. Returns 1 if successful, 0 otherwise.
| ExecCommand | Executes an application with the given options. Returns whatever the application returns, or -2 if the application was not found.
| GetDataCommand | Stream the given file, and recieve DTMF data. The user may interrupt the streaming by starting to enter digits. Returns the digits recieved from the channel at the other end. Input ends when the timeout is reached, the maximum number of digits is read or the user presses #.

GetFullVariableCommand

Returns the value of the given channel varible and understands complex variable names and builtin variables, unlike the GetVariableCommand.
You can also use this command to use custom Asterisk functions. Syntax is "func(args)".
Returns 0 if the variable is not set or channel does not exist. Returns 1 if the variable is set and returns the variable in parenthesis.
Example return code: 200 result=1 (testvariable) Available since Asterisk 1.2

GetOptionCommand

Plays the given file, and waits for the user to press one of the given digits. If none of the esacpe digits is pressed while streaming the file this command waits for the specified timeout still waiting for the user to press a digit. Streaming always begins at the beginning.
Returns 0 if no digit being pressed, or the ASCII numerical value of the digit if one was pressed, or -1 on error or if the channel was disconnected.
Remember, the file extension must not be included in the filename.

| GetVariableCommand | Returns the value of the given channel varible. Since Asterisk 1.2 you can also use this command to use custom Asterisk functions. Syntax is "func(args)". Returns 0 if the variable is not set. Returns 1 if the variable is set and returns the variable in parenthesis. Example return code: 200 result=1 (testvariable)
| HangupCommand | Hangs up the specified channel. If no channel name is given, hangs up the current channel.
| NoopCommand | Does nothing.
| ReceiveCharCommand | Receives a character of text on a channel. Specify timeout to be the maximum time to wait for input in milliseconds, or 0 for infinite. Most channels do not support the reception of text. Returns the decimal value of the character if one is received, or 0 if the channel does not support text reception. Returns -1 only on error/hangup.
| ReceiveTextCommand | Receives a string of text on a channel. Specify timeout to be the maximum time to wait for input in milliseconds, or 0 for infinite. Most channels do not support the reception of text. Returns -1 for failure or 1 for success, and the string in parentheses. Available since Asterisk 1.2.

RecordFileCommand

Record to a file until a given dtmf digit in the sequence is received.
Returns -1 on hangup or error.
The format will specify what kind of file will be recorded. The timeout is the maximum record time in milliseconds, or -1 for no timeout. Offset samples is optional, and if provided will seek to the offset without exceeding the end of the file. "maxSilence" is the number of seconds of maxSilence allowed before the function returns despite the lack of dtmf digits or reaching timeout.

| SayAlphaCommand | Say a given character string, returning early if any of the given DTMF digits are received on the channel. Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or -1 on error/hangup.
| SayDateTimeCommand | Say a given time, returning early if any of the given DTMF digits are pressed. Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or -1 on error/hangup. Available since Asterisk 1.2.
| SayDigitsCommand | Say a given digit string, returning early if any of the given DTMF digits are received on the channel. Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or -1 on error/hangup.
| SayNumberCommand | Say a given number, returning early if any of the given DTMF number are received on the channel. Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or -1 on error/hangup.
| SayPhoneticCommand | Say a given character string with phonetics, returning early if any of the given DTMF digits are received on the channel. Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or -1 on error/hangup.
| SayTimeCommand | Say a given time, returning early if any of the given DTMF digits are received on the channel. Time is the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC). Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed or -1 on error/hangup.
| SendImageCommand | Sends the given image on a channel. Most channels do not support the transmission of images. Returns 0 if image is sent, or if the channel does not support image transmission. Returns -1 only on error/hangup. Image names should not include extensions.
| SendTextCommand | Sends the given text on a channel. Most channels do not support the transmission of text. Returns 0 if text is sent, or if the channel does not support text transmission. Returns -1 only on error/hangup.
| SetAutoHangupCommand | Cause the channel to automatically hangup at the given number of seconds in the future. Of course it can be hungup before then as well. Setting to 0 will cause the autohangup feature to be disabled on this channel.
| SetCallerIdCommand | Changes the CallerID of the current channel.
| SetContextCommand | Sets the context for continuation upon exiting the application.
| SetExtensionCommand | Sets the extension for continuation upon exiting the application.
| SetMusicOffCommand | Turns off music on hold on the current channel. Always returns 0.
| SetMusicOnCommand | Turns on music on hold on the current channel. Always returns 0.
| SetPriorityCommand | Sets the priority for continuation upon exiting the application. Since Asterisk 1.2 SetPriorityCommand also supports labels.
| SetVariableCommand | Sets the given channel variable to the given value.

StreamFileCommand

Plays the given file, allowing playback to be interrupted by the given digits, if any.
If offset is provided then the audio will seek to sample offset before play starts.
Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if one was pressed, or -1 on error or if the channel was disconnected.
Remember, the file extension must not be included in the filename.

| TDDModeCommand | Enable/Disable TDD transmission/reception on a channel. Returns 1 if successful, or 0 if channel is not TDD-capable.
| VerboseCommand | Sends a message to the console via the verbose message system. Always returns 1.
| WaitForDigitCommand | Waits up to 'timeout' milliseconds for channel to receive a DTMF digit. Returns -1 on channel failure, 0 if no digit is received in the timeout, or the numerical value of the ascii of the digit if one is received. Use -1 for the timeout value if you desire the call to block indefinitely.