|
OPAL
Version 3.10.10
|
#include <connection.h>
Data Structures | |
| struct | AutoStartInfo |
| class | AutoStartMap |
| struct | CallEndReason |
| class | StringOptions |
| class | ZeroTime |
Public Member Functions | |
| virtual bool | GarbageCollection () |
| const StringOptions & | GetStringOptions () const |
| Get the string options associated with this connection. More... | |
| void | SetStringOptions (const StringOptions &options, bool overwrite) |
| Set the string options associated with this connection. More... | |
| virtual void | OnApplyStringOptions () |
| Call back for connection to act on changed string options. More... | |
| virtual void | EnableRecording () |
| virtual void | DisableRecording () |
Construction | |
| OpalConnection (OpalCall &call, OpalEndPoint &endpoint, const PString &token, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL) | |
| ~OpalConnection () | |
Overrides from PObject | |
| void | PrintOn (ostream &strm) const |
Call progress functions | |
| virtual PBoolean | OnIncomingConnection (unsigned int options, OpalConnection::StringOptions *stringOptions) |
| virtual PBoolean | SetUpConnection ()=0 |
| virtual PBoolean | OnSetUpConnection () |
| virtual void | OnProceeding () |
| virtual void | OnAlerting () |
| virtual PBoolean | SetAlerting (const PString &calleeName, PBoolean withMedia)=0 |
| virtual AnswerCallResponse | OnAnswerCall (const PString &callerName) |
| virtual void | AnsweringCall (AnswerCallResponse response) |
| virtual void | OnConnected () |
| virtual PBoolean | SetConnected () |
| virtual void | OnEstablished () |
| virtual bool | OnTransferNotify (const PStringToString &info, const OpalConnection *transferringConnection) |
| virtual void | Release (CallEndReason reason=EndedByLocalUser, bool synchronous=false) |
| virtual void | OnReleased () |
Additional signalling functions | |
| virtual PString | GetDestinationAddress () |
| virtual PBoolean | ForwardCall (const PString &forwardParty) |
| PSafePtr< OpalConnection > | GetOtherPartyConnection () const |
| template<class cls > | |
| PSafePtr< cls > | GetOtherPartyConnectionAs () const |
Media Stream Management | |
| virtual OpalMediaFormatList | GetMediaFormats () const |
| virtual OpalMediaFormatList | GetLocalMediaFormats () |
| virtual void | AdjustMediaFormats (bool local, const OpalConnection *otherConnection, OpalMediaFormatList &mediaFormats) const |
| virtual unsigned | GetNextSessionID (const OpalMediaType &mediaType, bool isSource) |
| virtual OpalMediaType::AutoStartMode | GetAutoStart (const OpalMediaType &mediaType) const |
| virtual void | AutoStartMediaStreams (bool force=false) |
| virtual bool | SwitchFaxMediaStreams (bool toT38) |
| virtual void | OnSwitchedFaxMediaStreams (bool toT38, bool success) |
| virtual bool | OnSwitchingFaxMediaStreams (bool toT38) |
| virtual OpalMediaStreamPtr | OpenMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, bool isSource) |
| virtual bool | CloseMediaStream (unsigned sessionId, bool source) |
| virtual bool | CloseMediaStream (OpalMediaStream &stream) |
| bool | RemoveMediaStream (OpalMediaStream &strm) |
| virtual void | StartMediaStreams () |
| virtual void | CloseMediaStreams () |
| virtual void | PauseMediaStreams (bool paused) |
| virtual void | OnPauseMediaStream (OpalMediaStream &strm, bool paused) |
| virtual OpalMediaStream * | CreateMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource) |
| OpalMediaStreamPtr | GetMediaStream (const PString &streamID, bool source) const |
| OpalMediaStreamPtr | GetMediaStream (unsigned sessionId, bool source) const |
| OpalMediaStreamPtr | GetMediaStream (const OpalMediaType &mediaType, bool source, OpalMediaStreamPtr previous=NULL) const |
| virtual PBoolean | OnOpenMediaStream (OpalMediaStream &stream) |
| virtual void | OnClosedMediaStream (const OpalMediaStream &stream) |
| virtual void | OnPatchMediaStream (PBoolean isSource, OpalMediaPatch &patch) |
| virtual void | OnStartMediaPatch (OpalMediaPatch &patch) |
| virtual void | OnStopMediaPatch (OpalMediaPatch &patch) |
| virtual bool | OnMediaCommand (OpalMediaStream &stream, const OpalMediaCommand &command) |
| virtual void | AttachRFC2833HandlerToPatch (PBoolean isSource, OpalMediaPatch &patch) |
| virtual PBoolean | IsMediaBypassPossible (unsigned sessionID) const |
| virtual PBoolean | CreateVideoInputDevice (const OpalMediaFormat &mediaFormat, PVideoInputDevice *&device, PBoolean &autoDelete) |
| virtual PBoolean | CreateVideoOutputDevice (const OpalMediaFormat &mediaFormat, PBoolean preview, PVideoOutputDevice *&device, PBoolean &autoDelete) |
| virtual bool | SendVideoUpdatePicture (unsigned sessionID=0, bool force=false) const |
| virtual PBoolean | SetAudioVolume (PBoolean source, unsigned percentage) |
| virtual PBoolean | GetAudioVolume (PBoolean source, unsigned &percentage) |
| virtual bool | SetAudioMute (bool source, bool mute) |
| virtual bool | GetAudioMute (bool source, bool &mute) |
| virtual unsigned | GetAudioSignalLevel (PBoolean source) |
Bandwidth Management | |
| unsigned | GetBandwidthAvailable () const |
| virtual PBoolean | SetBandwidthAvailable (unsigned newBandwidth, PBoolean force=false) |
| virtual unsigned | GetBandwidthUsed () const |
| virtual PBoolean | SetBandwidthUsed (unsigned releasedBandwidth, unsigned requiredBandwidth) |
Member variable access | |
| OpalEndPoint & | GetEndPoint () const |
| OpalCall & | GetCall () const |
| const PString & | GetToken () const |
| PBoolean | IsOriginating () const |
| const PTime & | GetPhaseTime (Phases phase) const |
| const PTime & | GetSetupUpTime () const |
| const PTime & | GetAlertingTime () const |
| const PTime & | GetConnectionStartTime () const |
| const PTime & | GetConnectionEndTime () const |
| const OpalProductInfo & | GetProductInfo () const |
| void | SetProductInfo (const OpalProductInfo &info) |
| virtual PString | GetPrefixName () const |
| const PString & | GetLocalPartyName () const |
| virtual void | SetLocalPartyName (const PString &name) |
| virtual PString | GetLocalPartyURL () const |
| const PString & | GetDisplayName () const |
| void | SetDisplayName (const PString &name) |
| virtual bool | IsPresentationBlocked () const |
| const PString & | GetRemotePartyName () const |
| void | SetRemotePartyName (const PString &name) |
| const PString & | GetRemotePartyNumber () const |
| const PString & | GetRemotePartyAddress () const |
| void | SetRemotePartyAddress (const PString &addr) |
| virtual PString | GetRemotePartyURL () const |
| const PString & | GetRedirectingParty () const |
| void | SetRedirectingParty (const PString &party) |
| const PString | GetRemotePartyCallbackURL () const |
| PCaselessString | GetRemoteApplication () const |
| const OpalProductInfo & | GetRemoteProductInfo () const |
| const PString & | GetCalledPartyName () const |
| const PString & | GetCalledPartyNumber () const |
| virtual PString | GetCalledPartyURL () |
| void | CopyPartyNames (const OpalConnection &other) |
| virtual PString | GetAlertingType () const |
| virtual bool | SetAlertingType (const PString &info) |
| virtual PString | GetCallInfo () const |
| unsigned | GetMinAudioJitterDelay () const |
| unsigned | GetMaxAudioJitterDelay () const |
| void | SetAudioJitterDelay (unsigned minDelay, unsigned maxDelay) |
| OpalSilenceDetector * | GetSilenceDetector () const |
| virtual PString | GetIdentifier () const |
| virtual PINDEX | GetMaxRtpPayloadSize () const |
| virtual OpalTransport & | GetTransport () const |
| PDICTIONARY (MediaAddressesDict, POrdinalKey, OpalTransportAddress) | |
| MediaAddressesDict & | GetMediaTransportAddresses () |
| unsigned | GetVideoUpdateRequestsSent () const |
Protected Types | |
| enum | { e_NotSwitchingFaxMediaStreams, e_SwitchingToFaxMediaStreams, e_SwitchingFromFaxMediaStreams } |
Protected Member Functions | |
| void | OnConnectedInternal () |
| PDECLARE_NOTIFIER (PThread, OpalConnection, OnReleaseThreadMain) | |
| PDECLARE_NOTIFIER (RTP_DataFrame, OpalConnection, OnRecordAudio) | |
| PDECLARE_NOTIFIER (RTP_DataFrame, OpalConnection, OnRecordVideo) | |
| void | OnStartRecording (OpalMediaPatch *patch) |
| void | OnStopRecording (OpalMediaPatch *patch) |
Basic operations | |
| enum | Phases { UninitialisedPhase, SetUpPhase, ProceedingPhase, AlertingPhase, ConnectedPhase, EstablishedPhase, ForwardingPhase, ReleasingPhase, ReleasedPhase, NumPhases } |
| virtual bool | IsNetworkConnection () const =0 |
| __inline Phases | GetPhase () const |
| __inline bool | IsEstablished () const |
| Return true if connection is in the established phase. More... | |
| __inline bool | IsReleased () const |
| Return true if connection is in the established phase. More... | |
| void | SetPhase (Phases phaseToSet) |
| CallEndReason | GetCallEndReason () const |
| PString | GetCallEndReasonText () const |
| virtual void | SetCallEndReason (CallEndReason reason) |
| void | ClearCall (CallEndReason reason=EndedByLocalUser, PSyncPoint *sync=NULL) |
| virtual void | ClearCallSynchronous (PSyncPoint *sync, CallEndReason reason=EndedByLocalUser) |
| unsigned | GetQ931Cause () const |
| void | SetQ931Cause (unsigned v) |
| virtual bool | TransferConnection (const PString &remoteParty) |
| virtual bool | Hold (bool fromRemote, bool placeOnHold) |
| virtual bool | IsOnHold (bool fromRemote) |
| virtual void | OnHold (bool fromRemote, bool onHold) |
| static PString | GetCallEndReasonText (CallEndReason reason) |
| static void | SetCallEndReasonText (CallEndReasonCodes reasonCode, const PString &newText) |
User input | |
| enum | SendUserInputModes { SendUserInputAsQ931, SendUserInputAsString, SendUserInputAsTone, SendUserInputAsRFC2833, SendUserInputInBand, SendUserInputAsProtocolDefault, NumSendUserInputModes, SendUserInputAsInlineRFC2833 = SendUserInputAsRFC2833 } |
| virtual void | SetSendUserInputMode (SendUserInputModes mode) |
| virtual SendUserInputModes | GetSendUserInputMode () const |
| virtual SendUserInputModes | GetRealSendUserInputMode () const |
| virtual PBoolean | SendUserInputString (const PString &value) |
| virtual PBoolean | SendUserInputTone (char tone, unsigned duration=0) |
| virtual void | OnUserInputString (const PString &value) |
| virtual void | OnUserInputTone (char tone, unsigned duration) |
| void | SendUserInputHookFlash (unsigned duration=500) |
| virtual PString | GetUserInput (unsigned timeout=30) |
| virtual void | SetUserInput (const PString &input) |
| virtual PString | ReadUserInput (const char *terminators="#\r\n", unsigned lastDigitTimeout=4, unsigned firstDigitTimeout=30) |
| virtual PBoolean | PromptUserInput (PBoolean play) |
This is the base class for connections to an endpoint. A particular protocol will have a descendant class from this to implement the specific semantics of that protocols connection.
A connection is part of a call, and will be "owned" by an OpalCall object. It is also attached to the creator endpoint to do any protocol specific management of the connection. However the deletion of the connection is done by a special thread in the OpalManager class. A connnection should never be deleted directly.
The connection is also in charge of creating media streams. It may do this in respose to an explicit call to OpenMediaStream or implicitly due to requests in the underlying protocol.
When media streams are created they must make requests for bandwidth which is managed by the connection.
|
protected |
| Enumerator | |
|---|---|
| AnswerCallNow | |
| AnswerCallDenied |
Answer the call continuing with the connection. |
| AnswerCallPending |
Refuse the call sending a release complete. |
| AnswerCallDeferred |
Send an Alerting PDU and wait for AnsweringCall() |
| AnswerCallAlertWithMedia |
As for AnswerCallPending but does not send Alerting PDU. |
| AnswerCallDeferredWithMedia |
As for AnswerCallPending but starts media channels. |
| AnswerCallProgress |
As for AnswerCallDeferred but starts media channels. |
| AnswerCallNowAndReleaseCurrent |
Answer the call with a h323 progress, or sip 183 session in progress, or ... |
| NumAnswerCallResponses |
Answer the call and destroy the current call. |
Call/Connection ending reasons. NOTE: if anything is added to this, you also need to add the field to the tables in connection.cxx and h323pdu.cxx.
Connection options
Different phases of a call, which are used in all OpalConnection instances. These phases are fully described in the documentation page Connection handling in the OPAL library.
| Enumerator | |
|---|---|
| UninitialisedPhase |
Indicates the OpalConnection instance has just been constructed. |
| SetUpPhase |
Has just sent/received the initial SETUP/INVITE packet. |
| ProceedingPhase |
The receipt of SETUP/INVITE has been acknowledged. |
| AlertingPhase |
The remote says there is a phone ringing, somewhere. |
| ConnectedPhase |
There is agreement on having a call, usually means billing will apply. |
| EstablishedPhase |
Media is established, streams are all operational. |
| ForwardingPhase |
Connection is in the process of being forwarded. |
| ReleasingPhase |
Hangup packet has been sent/received, media and control not yet stopped. |
| ReleasedPhase |
Media and control streams have been terminated. |
| NumPhases |
Number of available phases. Can be used to indicate an unknown phase. |
| OpalConnection::OpalConnection | ( | OpalCall & | call, |
| OpalEndPoint & | endpoint, | ||
| const PString & | token, | ||
| unsigned | options = 0, |
||
| OpalConnection::StringOptions * | stringOptions = NULL |
||
| ) |
Create a new connection.
| call | Owner calll for connection |
| endpoint | Owner endpoint for connection |
| token | Token to identify the connection |
| options | Option bit map to be passed to connection |
| stringOptions | Options to be passed to connection |
| OpalConnection::~OpalConnection | ( | ) |
Destroy connection.
|
virtual |
Adjust media formats available on a connection. This is called by a connection after it has called OpalCall::GetMediaFormats() to get all media formats that it can use so that an application may remove or reorder the media formats before they are used to open media streams.
This function may also be executed by other connections in the call. If this happens then the "otherConnection" parameter will be non-NULL. The "local" parameter sense is relative to the "otherConnection" parameter, if NULL then it is relative to "this".
The default behaviour calls the OpalEndPoint function of the same name.
| local | Media formats a local ones to be presented to remote |
| otherConnection | Other connection we are adjusting media for |
| mediaFormats | Media formats to use |
Reimplemented in OpalRTPConnection, and OpalFaxConnection.
|
virtual |
Indicate the result of answering an incoming call. This should only be called if the OnAnswerCall() callback function has returned a AnswerCallPending or AnswerCallDeferred response.
Note sending further AnswerCallPending responses via this function will have the result of notification PDUs being sent to the remote endpoint (if possible). In this way multiple notification PDUs may be sent.
Sending a AnswerCallDeferred response would have no effect.
| response | Answer response to incoming call |
Reimplemented in H323Connection, and IAX2Connection.
|
virtual |
Attaches the RFC 2833 handler to the media patch This method may be called from subclasses, e.g. within OnPatchMediaStream()
Reimplemented in OpalRTPConnection.
|
virtual |
Open source media streams, if needed.
| force | Force re-open even if already open |
| void OpalConnection::ClearCall | ( | CallEndReason | reason = EndedByLocalUser, |
| PSyncPoint * | sync = NULL |
||
| ) |
Clear a current call. This hangs up the current call. This will release all connections currently in the call by calling the OpalCall::Clear() function.
Note that this function will return quickly as the release and disposal of the connections is done by another thread.
If sync is not NULL then it is signalled when the calls are cleared.
| reason | Reason for call clearing |
|
virtual |
Clear a current connection, synchronously. This hangs up the connection to a remote endpoint. Note that this function is always synchronous. If sync is NULL then a local PSyncPoint is used.
| sync | Synchronisation object to signal |
| reason | Reason for call clearing |
|
virtual |
Close of a media stream by session.
| sessionId | Session ID to search for. |
| source | Indicates the direction of stream. |
|
virtual |
Close of a specific media stream.
| stream | Stream to close |
Reimplemented in SIPConnection, and H323Connection.
|
virtual |
Request close all media streams on connection.