# OpalContext Class Reference

`#include <opal.h>`

## Public Member Functions

| OpalContext ()
| Construct an unintialised OPAL context.
virtual | ~OpalContext ()
| Destroy the OPAL context, calls ShutDown().
unsigned | Initialise (const char *options, unsigned version=OPAL_C_API_VERSION)
bool | IsInitialised () const
| Indicate if the OPAL context has been initialised.
void | ShutDown ()
| Calls OpalShutDown() to dispose of the OPAL context.
bool | GetMessage (OpalMessagePtr &message, unsigned timeout=0)
| Calls OpalGetMessage() to get next message from the OPAL context.
bool | SendMessage (const OpalMessagePtr &message, OpalMessagePtr &response)
| Calls OpalSendMessage() to send a message to the OPAL context.
bool | SetUpCall (OpalMessagePtr &response, const char *partyB, const char *partyA=NULL, const char *alertingType=NULL)
| Execute OpalSendMessage() using OpalCmdSetUpCall.
bool | AnswerCall (const char *callToken)
| Answer a call using OpalCmdAnswerCall via OpalSendMessage().
bool | ClearCall (const char *callToken, OpalCallEndReason reason=OpalCallEndedByLocalUser)
| Clear a call using OpalCmdClearCall via OpalSendMessage().
bool | SendUserInput (const char *callToken, const char *userInput, unsigned duration=0)
| Send user input using OpalCmdUserInput via OpalSendMessage().

## Protected Attributes

OpalHandle | m_handle

## Detailed Description

This class is a wrapper around the "C" API.

It may seem odd to have a C++ wrapper around a "C" API which is itself a wrapper around a C++ API, but sometimes a C++ programmer may wish to access the OPAL system via this simplified API instead of the quite complex one in the base OPAL library.

## Constructor & Destructor Documentation

OpalContext::OpalContext | ( |  | ) |

Construct an unintialised OPAL context.

virtual OpalContext::~OpalContext | ( |  | ) | `[virtual]`

Destroy the OPAL context, calls ShutDown().

## Member Function Documentation

bool OpalContext::AnswerCall | ( | const char * | callToken | ) |

Answer a call using OpalCmdAnswerCall via OpalSendMessage().

Parameters:

  callToken | Call token for call being answered.

bool OpalContext::ClearCall | ( | const char * | callToken,
|  | OpalCallEndReason | reason = `OpalCallEndedByLocalUser` |
| ) |  |  |

Clear a call using OpalCmdClearCall via OpalSendMessage().

Parameters:

  callToken | Call token for call being cleared.
  reason | Code for the call termination, see OpalCmdClearCall.

bool OpalContext::GetMessage | ( | OpalMessagePtr & | message,
|  | unsigned | timeout = `0` |
| ) |  |  |

Calls OpalGetMessage() to get next message from the OPAL context.

unsigned OpalContext::Initialise | ( | const char * | options,
|  | unsigned | version = `OPAL_C_API_VERSION` |
| ) |  |  |

Calls OpalIntialise() to initialise the OPAL context. Returns version of API supported by library, zero if error.

Parameters:

  options | List of options to pass to OpalIntialise()
  version | Version expected by application

bool OpalContext::IsInitialised | ( |  | ) | const`[inline]`

Indicate if the OPAL context has been initialised.

bool OpalContext::SendMessage | ( | const OpalMessagePtr & | message,
|  | OpalMessagePtr & | response |
| ) |  |  |

Calls OpalSendMessage() to send a message to the OPAL context.

Parameters:

  message | Message to send to OPAL.
  response | Response from OPAL.

bool OpalContext::SendUserInput | ( | const char * | callToken,
|  | const char * | userInput,
|  | unsigned | duration = `0` |
| ) |  |  |

Send user input using OpalCmdUserInput via OpalSendMessage().

Parameters:

  callToken | Call token for the call, see OpalCmdUserInput.
  userInput | User input string, e.g. "#", see OpalCmdUserInput.
  duration | Duration in milliseconds for tone, see OpalCmdUserInput.

bool OpalContext::SetUpCall | ( | OpalMessagePtr & | response,
|  | const char * | partyB,
|  | const char * | partyA = `NULL`,
|  | const char * | alertingType = `NULL` |
| ) |  |  |

Execute OpalSendMessage() using OpalCmdSetUpCall.

Parameters:

  response | Response from OPAL context on initiating call.
  partyB | Destination address, see OpalCmdSetUpCall.
  partyA | Calling sub-system, see OpalCmdSetUpCall.
  alertingType | Alerting type code, see OpalCmdSetUpCall.

void OpalContext::ShutDown | ( |  | ) |

Calls OpalShutDown() to dispose of the OPAL context.

## Field Documentation

OpalHandle OpalContext::m_handle `[protected]`

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

- opal.h