ASTProvider Class Reference

Encapsulates Asterisk 1.x manager API. More...

#include <astprovider.h>

List of all members.

Public Member Functions

 ~ASTProvider (void)
AC_RESULT Connect (std::string sHost, int nPort, std::string user, std::string pwd, AUTH_TYPE eAuthType)
 connect to an asterisk box
bool Disconnect ()
 disconnects from asterisk box
AC_RESULT Bridge (std::string channel1, std::string channel2, bool tone)
 bridge two active channels
AC_RESULT Originate (std::string channel, std::string callerId, std::string callerIdName, std::string calledExtension, DWORD callid, std::string context, DWORD timeout, std::string variable, bool bLockReaderAfterResponse=false)
 originates a call
AC_RESULT Hangup (std::string channel)
 hangup a given channel
AC_RESULT QueueAdd (std::string queue, std::string channelInterface, int penalty, bool paused)
 adds an extension interface to a queue
AC_RESULT QueueRemove (std::string queue, std::string channelInterface)
 removes an extension interface to a queue
AC_RESULT QueuePause (std::string channelInterface, bool bPaused)
 pauses/upauses an already logged-in agent
AC_RESULT OriginateApplication (std::string channel, std::string application, std::string data, std::string variable, DWORD timeout)
 executes an application via originate AMI
AC_RESULT Redirect (std::string channel, std::string extraChannel, std::string extension, std::string context)
 Redirect (transfer) a call.
AC_RESULT SetVar (std::string channel, std::string variable, std::string value)
 Set a global or local channel variable.
AC_RESULT GetVar (std::string channel, std::string variable, std::string &value)
 Get a global or local channel variable.
AC_RESULT Monitor (std::string channel, std::string file, std::string format, std::string mix)
 Monitor a call (Recording).
AC_RESULT StopMonitor (std::string channel)
 StopMonitor a call (stop Recording).
AC_RESULT PauseMonitor (std::string channel)
 PauseMonitor a call (pause Recording).
AC_RESULT UnpauseMonitor (std::string channel)
 UnpauseMonitor a call (continue Recording after pause).
AC_RESULT ChangeMonitor (std::string channel, std::string file)
 ChangeMonitor a call ( change filename of the Recording after start).
void UnLockReader ()
 UnLocks Reader Thread.

Static Public Member Functions

static ASTProviderCreate (ASTListener *listener, ASTLogListener *logger)
 ASTProvider factory method.

Protected Member Functions

 ASTProvider (void)


Detailed Description

Encapsulates Asterisk 1.x manager API.

Constructor & Destructor Documentation

ASTProvider::ASTProvider ( void   )  [protected]

Constructor

ASTProvider::~ASTProvider ( void   ) 

Destructor


Member Function Documentation

AC_RESULT ASTProvider::Bridge ( std::string  channel1,
std::string  channel2,
bool  tone 
)

bridge two active channels

connects two active channels

Parameters:
channel1 
channel2 
tone 
Returns:
time_out, ok, generic_failure

Todo:
: more error handling

AC_RESULT ASTProvider::ChangeMonitor ( std::string  channel,
std::string  file 
)

ChangeMonitor a call ( change filename of the Recording after start).

ChangeMonitor given channel

See also:
http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Monitor
Parameters:
channel 
file 
Returns:
ok, no_such_channel, generic_failure, time_out Example:
        ACTION: ChangeMonitor
        Channel: SIP/x7062618529-643d
        File: channelsavefile

AC_RESULT ASTProvider::Connect ( std::string  sHost,
int  nPort,
std::string  user,
std::string  pwd,
AUTH_TYPE  eAuthType 
)

connect to an asterisk box

Connects to asterisk AMI port

Parameters:
sHost ip host address of asterisk box
nPort ip port asterisk manager api is listening to.
user ie: admin
pwd ie: amp111 authentification type 0-plaintext 1-md5
Returns:
fails_already_connected, ok, rc, socket_error

ASTProvider * ASTProvider::Create ( ASTListener listener,
ASTLogListener logger 
) [static]

ASTProvider factory method.

Factory method allows for initialization. Returns an initialized ASTProvider* instance or returns NULL in case of init failure.

Parameters:
listener 
logger 
Returns:
ASTProvider

bool ASTProvider::Disconnect (  ) 

disconnects from asterisk box

disconnects tcp/ip from asterisk ami port

Returns:
true if the socket was closed correctly, otherwise false

AC_RESULT ASTProvider::GetVar ( std::string  channel,
std::string  variable,
std::string &  value 
)

Get a global or local channel variable.

Get a global or local channel variable.

See also:
http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+GetVar
Parameters:
channel 
variable 
&value 
Returns:
time_out, ok, generic_failure Example:
        ACTION: GetVar
        Channel: SIP/5060-44d225d0
        Variable: extension 

AC_RESULT ASTProvider::Hangup ( std::string  channel  ) 

hangup a given channel

Hangup call in given channel

See also:
http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+Hangup
Parameters:
channel 
Returns:
ok, generic_failure, time_out Example:
        ACTION: Hangup
        Channel: SIP/x7065558529-99a0 

AC_RESULT ASTProvider::Monitor ( std::string  channel,
std::string  file,
std::string  format,
std::string  mix 
)

Monitor a call (Recording).

Monitor given channel

See also:
http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Monitor
Parameters:
channel 
file 
format 
mix 
Returns:
ok, no_such_channel, generic_failure, time_out Example:
        ACTION: Monitor
        Channel: SIP/x7062618529-643d
        File: channelsavefile
        Format: gsm
        Mix: true 

AC_RESULT ASTProvider::Originate ( std::string  channel,
std::string  callerId,
std::string  callerIdName,
std::string  calledExtension,
DWORD  callid,
std::string  context,
DWORD  timeout,
std::string  variable,
bool  bLockReaderAfterResponse = false 
)

originates a call

Originates a call via Asterisk API

See also:
http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+Originate
Parameters:
channel 
callerId 
callerIdName 
calledExtension 
callid Remarks: this version returns zero
context used to originate call
timeout 
Returns:
ok, generic_failure, time_out
        Action: Originate 
        Channel: channel 
        Exten: calledextension 
        Priority: 1 
        Callerid: "callerIdName" <callerId> 
        Context: context 
        ActionID: 2 
        Async: 1 

Todo:
: more error handling

AC_RESULT ASTProvider::OriginateApplication ( std::string  channel,
std::string  application,
std::string  data,
std::string  variable,
DWORD  timeout 
)

executes an application via originate AMI

Originates an application via AMI originate

Parameters:
channel 
application 
data 
variable 
timeout in ms
Returns:
ok, generic_failure, time_out
        Action: Originate 
        Channel: channel 
        Application: app-name 
        Data: app-data 
        Variable:       variable_0 
        ActionID: 2 
        Async: 1 

Todo:
: more error handling

AC_RESULT ASTProvider::PauseMonitor ( std::string  channel  ) 

PauseMonitor a call (pause Recording).

PauseMonitor given channel

Parameters:
channel 
Returns:
ok, no_such_channel, generic_failure, time_out Example:
        ACTION: PauseMonitor
        Channel: SIP/x7062618529-643d

AC_RESULT ASTProvider::QueueAdd ( std::string  queue,
std::string  channelInterface,
int  penalty,
bool  bPaused 
)

adds an extension interface to a queue

Adds an extension interface to a queue

See also:
http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+QueueAdd
Parameters:
queue 
channelInterface 
penalty 
bPaused 
Returns:
ok, already_logged_in, queue_not_specified, interface_not_specified, no_such_queue, time_out, generic_failure;
Example:
        Action: QueueAdd 
        Queue: 555 
        Interface: local/201 
        Penalty: 1 
        Paused: true 

AC_RESULT ASTProvider::QueuePause ( std::string  channelInterface,
bool  bPaused 
)

pauses/upauses an already logged-in agent

pauses/unpauses an extension logged into any queue

Parameters:
channelInterface 
bPaused true/false
Returns:
ok, not_logged_in, no_such_queue, time_out, generic_failure;
Example:
        Action: QueuePause 
        Interface: local/2600
        Paused: true

AC_RESULT ASTProvider::QueueRemove ( std::string  queue,
std::string  channelInterface 
)

removes an extension interface to a queue

removes an extension interface to a queue

See also:
http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+QueueRemove
Parameters:
queue 
channelInterface 
Returns:
ok, not_logged_in, no_such_queue, time_out, generic_failure;
Example:
        Action: QueueRemove 
        Queue: queue1 
        Interface: sip/2600 

AC_RESULT ASTProvider::Redirect ( std::string  channel,
std::string  extraChannel,
std::string  extension,
std::string  context 
)

Redirect (transfer) a call.

Redirect (or transfer) a call

Parameters:
channel 
extraChannel 
extension 
context 
Returns:
ok, generic_failure, time_out
        Action: Redirect 
        Channel: channel
        Exten: 70 
        Priority: 1 
        Context: from-internal 
        ActionID: 2 
        Async: 1 
See also:
http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+Redirect

Todo:
: more error handling

AC_RESULT ASTProvider::SetVar ( std::string  channel,
std::string  variable,
std::string  value 
)

Set a global or local channel variable.

Set a global or local channel variable.

See also:
http://www.voip-info.org/wiki/index.php?page=Asterisk+Manager+API+Action+SetVar
Parameters:
channel 
variable 
value 
Returns:
time_out, ok, generic_failure Example:
        Action: Setvar
        Channel: Zap/1-1
        Variable: AtestVariable
        Value: This is now set

Todo:
: more error handling

AC_RESULT ASTProvider::StopMonitor ( std::string  channel  ) 

StopMonitor a call (stop Recording).

StopMonitor given channel

See also:
http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+StopMonitor
Parameters:
channel 
Returns:
ok, no_such_channel, generic_failure, time_out Example:
        ACTION: StopMonitor
        Channel: SIP/x7062618529-643d

AC_RESULT ASTProvider::UnpauseMonitor ( std::string  channel  ) 

UnpauseMonitor a call (continue Recording after pause).

UnpauseMonitor given channel

Parameters:
channel 
Returns:
ok, no_such_channel, generic_failure, time_out Example:
        ACTION: PauseMonitor
        Channel: SIP/x7062618529-643d


The documentation for this class was generated from the following files:

Generated on Mon Jul 25 09:08:52 2011 for Activa Framework by  doxygen 1.5.9