# OpalLineConnection Class Reference

`#include <lidep.h>`

Inheritance diagram for OpalLineConnection:

[legend]
Collaboration diagram for OpalLineConnection:
[legend]

## Public Member Functions

Construction
| OpalLineConnection (OpalCall &call, OpalLineEndPoint &endpoint, OpalLine &line, const PString &number)
Overrides from OpalConnection
virtual PString | GetPrefixName () const
virtual bool | IsNetworkConnection () const
virtual PBoolean | SetUpConnection ()
virtual PBoolean | SetAlerting (const PString &calleeName, PBoolean withMedia)
virtual PBoolean | SetConnected ()
virtual void | OnReleased ()
virtual PString | GetDestinationAddress ()
virtual OpalMediaFormatList | GetMediaFormats () const
virtual OpalMediaStream * | CreateMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
virtual PBoolean | OnOpenMediaStream (OpalMediaStream &stream)
virtual void | OnClosedMediaStream (const OpalMediaStream &stream)
virtual PBoolean | SetAudioVolume (PBoolean source, unsigned percentage)
virtual unsigned | GetAudioSignalLevel (PBoolean source)
virtual PBoolean | SendUserInputString (const PString &value)
virtual PBoolean | SendUserInputTone (char tone, int duration)
virtual PBoolean | PromptUserInput (PBoolean play)
Call handling functions
void | StartIncoming ()
virtual void | Monitor ()
Member variable access
OpalLine & | GetLine ()
OpalLineInterfaceDevice::CallProgressTones | GetPromptTone () const
void | SetPromptTone (OpalLineInterfaceDevice::CallProgressTones tone)
void | setDialDelay (unsigned int uiDialDelay)
unsigned int | getDialDelay () const

## Protected Member Functions

| PDECLARE_NOTIFIER (PThread, OpalLineConnection, HandleIncoming)

## Protected Attributes

OpalLineEndPoint & | endpoint
OpalLine & | line
bool | wasOffHook
unsigned | minimumRingCount
PString | m_dialedNumber
OpalLineInterfaceDevice::DialParams | m_dialParams
OpalLineInterfaceDevice::CallProgressTones | m_promptTone
PThread * | handlerThread

## Detailed Description

This class describes the LID based codec capability.

## Constructor & Destructor Documentation

OpalLineConnection::OpalLineConnection | ( | OpalCall & | call,
|  | OpalLineEndPoint & | endpoint,
|  | OpalLine & | line,
|  | const PString & | number |
| ) |  |  |

Create a new connection.

Parameters:

  call | Owner calll for connection
  endpoint | Endpoint for LID connection
  line | Line to make connection on
  number | Number to call on line

## Member Function Documentation

virtual OpalMediaStream* OpalLineConnection::CreateMediaStream | ( | const OpalMediaFormat & | mediaFormat,
|  | unsigned | sessionID,
|  | PBoolean | isSource |
| ) |  |  | `[virtual]`

Open a new media stream. This will create a media stream of an appropriate subclass as required by the underlying connection protocol. For instance H.323 would create an OpalRTPStream.

The sessionID parameter may not be needed by a particular media stream and may be ignored. In the case of an OpalRTPStream it us used.

Note that media streams may be created internally to the underlying protocol. This function is not the only way a stream can come into existance.

The default behaviour is pure.

Parameters:

  mediaFormat | Media format for stream
  sessionID | Session number for stream
  isSource | Is a source stream

Reimplemented from OpalConnection.

virtual unsigned OpalLineConnection::GetAudioSignalLevel | ( | PBoolean | source | ) | `[virtual]`

Get the average signal level (0..32767) for the audio media channel. A return value of UINT_MAX indicates no valid signal, eg no audio channel opened.

Parameters:

  source | true for source (microphone), false for sink (speaker)

Reimplemented from OpalConnection.

virtual PString OpalLineConnection::GetDestinationAddress | ( |  | ) | `[virtual]`

Get the destination address of an incoming connection. The default behaviour collects a DTMF number terminated with a '#' or if no digits were entered for a time (default 3 seconds). If no digits are entered within a longer time time (default 30 seconds), then an empty string is returned.

Reimplemented from OpalConnection.

unsigned int OpalLineConnection::getDialDelay | ( |  | ) | const`[inline]`

Delay in msec to wait between the dial tone detection and dialing the dtmf

Returns:
  uiDialDelay the dial delay to get

OpalLine& OpalLineConnection::GetLine | ( |  | ) | `[inline]`

Get the line being used by this media stream.

virtual OpalMediaFormatList OpalLineConnection::GetMediaFormats | ( |  | ) | const`[virtual]`

Get the data formats this connection is capable of operating. This provides a list of media data format names that a OpalMediaStream may be created in within this connection.

The default behaviour returns the capabilities of the LID line.

Reimplemented from OpalConnection.

virtual PString OpalLineConnection::GetPrefixName | ( |  | ) | const`[virtual]`

Get this connections protocol prefix for URLs.

Reimplemented from OpalConnection.

OpalLineInterfaceDevice::CallProgressTones OpalLineConnection::GetPromptTone | ( |  | ) | const`[inline]`

Get the prompt tone used on POTS lines. Defaults to OpalLineInterfaceDevice::DialTone.

virtual bool OpalLineConnection::IsNetworkConnection | ( |  | ) | const`[inline, virtual]`

Get indication of connection being to a "network". This indicates the if the connection may be regarded as a "network" connection. The distinction is about if there is a concept of a "remote" party being connected to and is best described by example: sip, h323, iax and pstn are all "network" connections as they connect to something "remote". While pc, pots and ivr are not as the entity being connected to is intrinsically local.

Implements OpalConnection.

virtual void OpalLineConnection::Monitor | ( |  | ) | `[virtual]`

Check for line hook state, DTMF tone for user indication etc.

virtual void OpalLineConnection::OnClosedMediaStream | ( | const OpalMediaStream & | stream | ) | `[virtual]`

Call back for closed a media stream.

Note that this is called while the OpalMediaStream is locked. Care needs to be taken to avoid deadlocks.

The default behaviour calls the OpalEndPoint function of the same name.

Parameters:

  stream | Media stream being closed

Reimplemented from OpalConnection.

virtual PBoolean OpalLineConnection::OnOpenMediaStream | ( | OpalMediaStream & | stream | ) | `[virtual]`

Call back when opening a media stream. This function is called when a connection has created a new media stream according to the logic of its underlying protocol.

The usual requirement is that media streams are created on all other connections participating in the call and all of the media streams are attached to an instance of an OpalMediaPatch object that will read from one of the media streams passing data to the other media streams.

The default behaviour calls the ancestor and adds a LID silence detector filter.

Parameters:

  stream | New media stream being opened

Reimplemented from OpalConnection.

virtual void OpalLineConnection::OnReleased | ( |  | ) | `[virtual]`

Clean up the termination of the connection. This function can do any internal cleaning up and waiting on background threads that may be using the connection object.

Note that there is not a one to one relationship with the OnEstablishedConnection() function. This function may be called without that function being called. For example if SetUpConnection() was used but the call never completed.

Classes that override this function should make sure they call the ancestor version for correct operation.

An application will not typically call this function as it is used by the OpalManager during a release of the connection.

The default behaviour calls starts playing the busy tone and calls the ancestor function.

Reimplemented from OpalConnection.

OpalLineConnection::PDECLARE_NOTIFIER | ( | PThread | ,
|  | OpalLineConnection | ,
|  | HandleIncoming |  |
| ) |  |  | `[protected]`

virtual PBoolean OpalLineConnection::PromptUserInput | ( | PBoolean | play | ) | `[virtual]`

Play a prompt to the connection before rading user indication string.

For example the LID connection would play a dial tone.

The default behaviour does nothing.

Parameters:

  play | Flag to start or stop playing the prompt

Reimplemented from OpalConnection.

virtual PBoolean OpalLineConnection::SendUserInputString | ( | const PString & | value | ) | `[virtual]`

Send a user input indication to the remote endpoint. This sends an arbitrary string as a user indication. If DTMF tones in particular are required to be sent then the SendIndicationTone() function should be used.

The default behaviour plays the DTMF tones on the line.

Parameters:

  value | String value of indication

Reimplemented from OpalConnection.

virtual PBoolean OpalLineConnection::SendUserInputTone | ( | char | tone,
|  | int | duration |
| ) |  |  | `[virtual]`

Send a user input indication to the remote endpoint. This sends DTMF emulation user input. If something other than the standard tones need be sent use the SendUserInputString() function.

The default behaviour plays the DTMF tone on the line.

Parameters:

  tone | DTMF tone code
  duration | Duration of tone in milliseconds

virtual PBoolean OpalLineConnection::SetAlerting | ( | const PString & | calleeName,
|  | PBoolean | withMedia |
| ) |  |  | `[virtual]`

Indicate to remote endpoint an alert is in progress. If this is an incoming connection and the AnswerCallResponse is in a AnswerCallDeferred or AnswerCallPending state, then this function is used to indicate to that endpoint that an alert is in progress. This is usually due to another connection which is in the call (the B party) has received an OnAlerting() indicating that its remoteendpoint is "ringing".

The default behaviour starts the ring back tone.

Parameters:

  calleeName | Name of endpoint being alerted.
  withMedia | Open media with alerting

Reimplemented from OpalConnection.

virtual PBoolean OpalLineConnection::SetAudioVolume | ( | PBoolean | source,
|  | unsigned | percentage |
| ) |  |  | `[virtual]`

Set the volume (gain) for the audio media channel to the specified percentage.

Parameters:

  source | true for source (microphone), false for sink (speaker)
  percentage | Gain, 0=silent, 100=maximun

Reimplemented from OpalConnection.

virtual PBoolean OpalLineConnection::SetConnected | ( |  | ) | `[virtual]`

Indicate to remote endpoint we are connected.

The default behaviour stops the ring back tone.

Reimplemented from OpalConnection.

void OpalLineConnection::setDialDelay | ( | unsigned int | uiDialDelay | ) | `[inline]`

Delay in msec to wait between the dial tone detection and dialing the dtmf

Parameters:

  uiDialDelay | Dialing delay

void OpalLineConnection::SetPromptTone | ( | OpalLineInterfaceDevice::CallProgressTones | tone | ) | `[inline]`

Set the prompt tone used on POTS lines.

virtual PBoolean OpalLineConnection::SetUpConnection | ( |  | ) | `[virtual]`

Start an outgoing connection. This function will initiate the connection to the remote entity, for example in H.323 it sends a SETUP, in SIP it sends an INVITE etc.

The default behaviour does.

Reimplemented from OpalConnection.

void OpalLineConnection::StartIncoming | ( |  | ) |

Handle a new connection from the LID line.

## Field Documentation

OpalLineEndPoint& OpalLineConnection::endpoint `[protected]`

Reimplemented from OpalConnection.

PThread* OpalLineConnection::handlerThread `[protected]`

OpalLine& OpalLineConnection::line `[protected]`

PString OpalLineConnection::m_dialedNumber `[protected]`

OpalLineInterfaceDevice::DialParams OpalLineConnection::m_dialParams `[protected]`

OpalLineInterfaceDevice::CallProgressTones OpalLineConnection::m_promptTone `[protected]`

unsigned OpalLineConnection::minimumRingCount `[protected]`

bool OpalLineConnection::wasOffHook `[protected]`

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

- lidep.h