OPAL  Version 3.18.8
IAX2Connection Class Reference

#include <iax2con.h>

Inheritance diagram for IAX2Connection:
Collaboration diagram for IAX2Connection:

Public Member Functions

void StartOperation ()
 
virtual bool IsNetworkConnection () const
 
virtual bool TransferConnection (const PString &remoteParty)
 
virtual void OnReleased ()
 
OpalMediaFormatList GetMediaFormats () const
 
void EndCallNow (CallEndReason reason=EndedByLocalUser)
 
void SendDtmf (const PString &dtmf)
 
virtual PBoolean SendUserInputString (const PString &value)
 
virtual PBoolean SendUserInputTone (char tone, unsigned duration)
 
PBoolean IsCallTerminating ()
 
virtual void AnsweringCall (AnswerCallResponse response)
 
void OnConnected ()
 
virtual PBoolean SetConnected ()
 
void OnEstablished ()
 
PBoolean SetAlerting (const PString &calleeName, PBoolean withMedia)
 
virtual OpalMediaStreamCreateMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
 
void SetCallToken (PString newToken)
 
PString GetCallToken ()
 
void TransmitFrameToRemoteEndpoint (IAX2Frame *src)
 
void PutSoundPacketToNetwork (PBYTEArray *sund)
 
void ReceivedSoundPacketFromNetwork (IAX2Frame *soundFrame)
 
PBoolean ReadSoundPacket (RTP_DataFrame &packet)
 
IAX2RemoteGetRemoteInfo ()
 
IAX2SequenceNumbersGetSequenceInfo ()
 
const PTimeInterval & GetCallStartTick ()
 
void OnSetUp ()
 
PBoolean SetUpConnection ()
 
PINDEX GetSupportedCodecs ()
 
PINDEX GetPreferredCodec ()
 
void BuildRemoteCapabilityTable (unsigned int remoteCapability, unsigned int format)
 
unsigned int ChooseCodec ()
 
virtual bool HoldRemote (bool placeOnHold)
 
virtual bool IsOnHold (bool fromRemote) const
 
void RemoteHoldConnection ()
 
void RemoteRetrieveConnection ()
 
void SetUserName (const PString &inUserName)
 
PString GetUserName () const
 
void SetPassword (const PString &inPassword)
 
PString GetPassword () const
 
virtual PBoolean ForwardCall (const PString &forwardParty)
 
void IncomingEthernetFrame (IAX2Frame *frame)
 
IAX2EndPointGetEndPoint ()
 
void ReportStatistics ()
 
Construction/Destruction functions
 IAX2Connection (OpalCall &call, IAX2EndPoint &endpoint, const PString &token, void *userData, const PString &remoteParty, const PString &remotePartyName=PString::Empty())
 
 ~IAX2Connection ()
 
- Public Member Functions inherited from OpalConnection
 P_DECLARE_TRACED_ENUM_EX (CallEndReasonCodes, NumCallEndReasons, EndedByLocalUser, 0, EndedByNoAccept, EndedByAnswerDenied, EndedByRemoteUser, EndedByRefusal, EndedByNoAnswer, EndedByCallerAbort, EndedByTransportFail, EndedByConnectFail, EndedByGatekeeper, EndedByNoUser, EndedByNoBandwidth, EndedByCapabilityExchange, EndedByCallForwarded, EndedBySecurityDenial, EndedByLocalBusy, EndedByLocalCongestion, EndedByRemoteBusy, EndedByRemoteCongestion, EndedByUnreachable, EndedByNoEndPoint, EndedByHostOffline, EndedByTemporaryFailure, EndedByQ931Cause, EndedByDurationLimit, EndedByInvalidConferenceID, EndedByNoDialTone, EndedByNoRingBackTone, EndedByOutOfService, EndedByAcceptingCallWaiting, EndedByGkAdmissionFailed, EndedByMediaFailed, EndedByCallCompletedElsewhere, EndedByCertificateAuthority, EndedByIllegalAddress, EndedByCustomCode)
 
 P_DECLARE_TRACED_ENUM (AnswerCallResponse, AnswerCallNow, AnswerCallDenied, AnswerCallPending, AnswerCallDeferred, AnswerCallAlertWithMedia, AnswerCallDeferredWithMedia, AnswerCallProgress, AnswerCallNowAndReleaseCurrent)
 
const StringOptionsGetStringOptions () 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 ()
 
 PDECLARE_NOTIFIER (RTP_DataFrame, OpalConnection, OnRecordAudio)
 
void InternalOnRecordAudio (PString key, PAutoPtr< RTP_DataFrame > frame)
 
 PDECLARE_NOTIFIER (RTP_DataFrame, OpalConnection, OnRecordVideo)
 
void InternalOnRecordVideo (PString key, PAutoPtr< RTP_DataFrame > frame)
 
virtual void OnStartRecording (OpalMediaPatch *patch)
 
virtual void OnStopRecording (OpalMediaPatch *patch)
 
bool InternalOnConnected ()
 
bool InternalOnEstablished ()
 
void InternalSetAsOriginating ()
 
bool InternalRelease (CallEndReason reason)
 
void InternalOnReleased ()
 
void InternalExecuteMediaCommand (OpalMediaCommand *command)
 
void InternalCreatedMediaTransport (const OpalMediaTransportPtr &transport)
 
 OpalConnection (OpalCall &call, OpalEndPoint &endpoint, const PString &token, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL)
 
 ~OpalConnection ()
 
void PrintOn (ostream &strm) const
 
virtual PBoolean OnIncomingConnection (unsigned int options, OpalConnection::StringOptions *stringOptions)
 
virtual PBoolean OnSetUpConnection ()
 
virtual void OnProceeding ()
 
virtual void OnAlerting (bool withMedia)
 
virtual void OnAlerting ()
 
virtual AnswerCallResponse OnAnswerCall (const PString &callerName)
 
virtual bool OnTransferNotify (const PStringToString &info, const OpalConnection *transferringConnection)
 
virtual void Release (CallEndReason reason=EndedByLocalUser, bool synchronous=false)
 
virtual PString GetDestinationAddress ()
 
PSafePtr< OpalConnectionGetOtherPartyConnection () const
 
template<class cls >
PSafePtr< cls > GetOtherPartyConnectionAs () const
 
virtual OpalMediaFormatList GetLocalMediaFormats ()
 
virtual void AdjustMediaFormats (bool local, const OpalConnection *otherConnection, OpalMediaFormatList &mediaFormats) const
 
virtual PStringArray GetMediaCryptoSuites () const
 
virtual unsigned GetNextSessionID (const OpalMediaType &mediaType, bool isSource)
 
virtual bool RequireSymmetricMediaStreams () const
 
virtual
OpalMediaType::AutoStartMode 
GetAutoStart (const OpalMediaType &mediaType) const
 
virtual void AutoStartMediaStreams (bool transfer=false)
 
virtual OpalMediaStreamPtr OpenMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, bool isSource)
 
bool CloseMediaStream (unsigned sessionId, bool source)
 
bool CloseMediaStream (OpalMediaStreamPtr stream)
 
bool RemoveMediaStream (OpalMediaStream &strm)
 
virtual void StartMediaStreams ()
 
virtual void CloseMediaStreams ()
 
virtual void PauseMediaStreams (bool paused)
 
virtual void OnPauseMediaStream (OpalMediaStream &strm, bool paused)
 
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
 
bool GetStatistics (const OpalMediaType &mediaType, bool source, OpalMediaStatistics &statistics) const
 Get media statistics of the type, and of the specifed direction. More...
 
virtual PBoolean OnOpenMediaStream (OpalMediaStream &stream)
 
virtual void OnClosedMediaStream (const OpalMediaStream &stream)
 
virtual void OnFailedMediaStream (bool fromRemote, const PString &reason)
 
virtual void OnPatchMediaStream (PBoolean isSource, OpalMediaPatch &patch)
 
virtual void OnStartMediaPatch (OpalMediaPatch &patch)
 
virtual void OnStopMediaPatch (OpalMediaPatch &patch)
 
virtual bool OnMediaFailed (unsigned sessionId)
 
bool AllMediaFailed () const
 
virtual bool OnMediaCommand (OpalMediaStream &stream, const OpalMediaCommand &command)
 
virtual bool ExecuteMediaCommand (const OpalMediaCommand &command, bool aync=false) const
 
virtual bool GetMediaTransportAddresses (OpalConnection &otherConnection, unsigned sessionId, const OpalMediaType &mediaType, OpalTransportAddressArray &transports) 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)
 
OpalBandwidth GetBandwidthAvailable (OpalBandwidth::Direction dir) const
 
virtual bool SetBandwidthAvailable (OpalBandwidth::Direction dir, OpalBandwidth availableBandwidth)
 
virtual bool SetBandwidthAllocated (OpalBandwidth::Direction dir, OpalBandwidth newBandwidth)
 
virtual OpalBandwidth GetBandwidthUsed (OpalBandwidth::Direction dir) const
 
virtual bool SetBandwidthUsed (OpalBandwidth::Direction dir, OpalBandwidth releasedBandwidth, OpalBandwidth requiredBandwidth)
 
 P_DECLARE_TRACED_ENUM (SendUserInputModes, SendUserInputAsQ931, SendUserInputAsString, SendUserInputAsTone, SendUserInputAsRFC2833, SendUserInputAsInlineRFC2833=SendUserInputAsRFC2833, SendUserInputInBand, SendUserInputAsProtocolDefault)
 
virtual void SetSendUserInputMode (SendUserInputModes mode)
 
virtual SendUserInputModes GetSendUserInputMode () const
 
virtual SendUserInputModes GetRealSendUserInputMode () const
 
virtual void OnUserInputString (const PString &value)
 
void OnUserInputStringCallback (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="YX#\r\n", unsigned lastDigitTimeout=4, unsigned firstDigitTimeout=30)
 
virtual PBoolean PromptUserInput (PBoolean play)
 
virtual bool GetConferenceState (OpalConferenceState *state) const
 
virtual bool RequestPresentationRole (bool release)
 
virtual bool OnChangedPresentationRole (const PString &newChairURI, bool request)
 
virtual bool HasPresentationRole () const
 
virtual bool GarbageCollection ()
 
OpalEndPointGetEndPoint () const
 
OpalCallGetCall () const
 
const PString & GetToken () const
 
virtual void SetToken (const PString &newToken)
 
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 OpalProductInfoGetProductInfo () 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
 
virtual OpalTransportAddress GetRemoteAddress () const
 
virtual PString GetRemotePartyURL () const
 
virtual PString GetRemoteIdentity () const
 
P_DEPRECATED PString GetRemotePartyAddress () const
 
P_DEPRECATED const PString GetRemotePartyCallbackURL () const
 
PCaselessString GetRemoteApplication () const
 
const OpalProductInfoGetRemoteProductInfo () const
 
void SetRemoteProductInfo (const OpalProductInfo &info)
 
const PString & GetRedirectingParty () const
 
void SetRedirectingParty (const PString &party)
 
const PString & GetCalledPartyName () const
 
void SetCalledPartyName (const PString &name)
 
const PString & GetCalledPartyNumber () const
 
virtual PString GetCalledPartyURL ()
 
virtual PMultiPartList GetExtraCallInfo () const
 
void CopyPartyNames (const OpalConnection &other)
 
virtual PString GetAlertingType () const
 
virtual bool SetAlertingType (const PString &info)
 
virtual PString GetCallInfo () const
 
virtual PString GetSupportedFeatures () const
 
unsigned GetMinAudioJitterDelay () const
 
unsigned GetMaxAudioJitterDelay () const
 
void SetAudioJitterDelay (unsigned minDelay, unsigned maxDelay)
 
OpalSilenceDetectorGetSilenceDetector () const
 
virtual PString GetIdentifier () const
 
virtual PINDEX GetMaxRtpPayloadSize () const
 
 P_DECLARE_STREAMABLE_ENUM (Phases, UninitialisedPhase, SetUpPhase, ProceedingPhase, AlertingPhase, ConnectedPhase, EstablishedPhase, ForwardingPhase, ReleasingPhase, ReleasedPhase)
 
__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 void OnHold (bool fromRemote, bool onHold)
 

Protected Attributes

PString userName
 
PString password
 
OpalJitterBufferm_jitterBuffer
 
RTP_DataFrame::PayloadTypes opalPayloadType
 
Internal, protected methods, which are invoked only by this

thread

IAX2EndPointendpoint
 
OpalMediaFormatList remoteMediaFormats
 
OpalMediaFormatList localMediaFormats
 
IAX2CallProcessoriax2Processor
 
PBoolean local_hold
 
PBoolean remote_hold
 
- Protected Attributes inherited from OpalConnection
OpalCallm_ownerCall
 
OpalEndPointm_endpoint
 
PString m_callToken
 
PBoolean m_originating
 
OpalProductInfo m_productInfo
 
PString m_localPartyName
 
PString m_displayName
 
PString m_remotePartyName
 
PString m_remotePartyURL
 
OpalProductInfo m_remoteProductInfo
 
PString m_remotePartyNumber
 
PString m_redirectingParty
 
CallEndReason m_callEndReason
 
PString m_calledPartyNumber
 
PString m_calledPartyName
 
SendUserInputModes m_sendUserInputMode
 
PString m_userInputString
 
PSyncPoint m_userInputAvailable
 
OpalSilenceDetectorm_silenceDetector
 
OpalMediaFormat m_filterMediaFormat
 
OpalMediaFormatList m_localMediaFormats
 
StreamDict m_mediaStreams
 
PSafeList< OpalMediaTransportm_mediaTransports
 
OpalJitterBuffer::Params m_jitterParams
 
OpalBandwidth m_rxBandwidthAvailable
 
OpalBandwidth m_txBandwidthAvailable
 
StringOptions m_stringOptions
 
PString m_recordingFilename
 
PNotifier m_recordAudioNotifier
 
PNotifier m_recordVideoNotifier
 
OpalMediaType::AutoStartMap m_autoStartInfo
 
ZeroTime m_phaseTime [NumPhases]
 
std::set< unsigned > m_mediaSessionFailed
 

Friends

class IAX2CallProcessor
 

Additional Inherited Members

- Public Types inherited from OpalConnection
enum  Options {
  FastStartOptionDisable = 0x0001, FastStartOptionEnable = 0x0002, FastStartOptionMask = 0x0003, H245TunnelingOptionDisable = 0x0004,
  H245TunnelingOptionEnable = 0x0008, H245TunnelingOptionMask = 0x000c, H245inSetupOptionDisable = 0x0010, H245inSetupOptionEnable = 0x0020,
  H245inSetupOptionMask = 0x0030, DetectInBandDTMFOptionDisable = 0x0040, DetectInBandDTMFOptionEnable = 0x0080, DetectInBandDTMFOptionMask = 0x00c0,
  RTPAggregationDisable = 0x0100, RTPAggregationEnable = 0x0200, RTPAggregationMask = 0x0300, SendDTMFAsDefault = 0x0000,
  SendDTMFAsString = 0x0400, SendDTMFAsTone = 0x0800, SendDTMFAsRFC2833 = 0x0c00, SendDTMFMask = 0x0c00,
  SynchronousSetUp = 0x1000
}
 
- Static Public Member Functions inherited from OpalConnection
static PString GetCallEndReasonText (CallEndReason reason)
 
static void SetCallEndReasonText (CallEndReasonCodes reasonCode, const PString &newText)
 
- Protected Types inherited from OpalConnection
typedef PSafeDictionary
< StreamKey, OpalMediaStream
StreamDict
 
- Protected Member Functions inherited from OpalConnection
 PDECLARE_MUTEX (m_mediaSessionFailedMutex)
 

Detailed Description

This class handles all data associated with a call to one remote computer. It runs a separate thread, which wakes in response to an incoming sound block from a sound device, or inresponse to an incoming ethernet packet, or in response from the UI for action (like sending dtmf)

It is a thread, and runs when activated by outside events.

Constructor & Destructor Documentation

IAX2Connection::IAX2Connection ( OpalCall call,
IAX2EndPoint endpoint,
const PString &  token,
void *  userData,
const PString &  remoteParty,
const PString &  remotePartyName = PString::Empty() 
)

Construct a connection given the endpoint.

Parameters
endpointOwner call for connection
tokenOwner iax endpoint for connection
userDataToken to identify the connection
remotePartySpecific user data for this call
remotePartyNameUrl we are calling or getting called byThe name of the remote party
IAX2Connection::~IAX2Connection ( )

Destroy this connection, but do it nicely and let attached sound objects close first.

Member Function Documentation

virtual void IAX2Connection::AnsweringCall ( AnswerCallResponse  response)
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.

IAX2 traps this call for no "real" reason, except to know for sure when the audio streams start. This can also be regarded as a convenience function, so we know when the call media beings.

Parameters
responseresponse to incoming call

Reimplemented from OpalConnection.

void IAX2Connection::BuildRemoteCapabilityTable ( unsigned int  remoteCapability,
unsigned int  format 
)

Fill the OpalMediaFormatList which describes the remote nodes capabilities

unsigned int IAX2Connection::ChooseCodec ( )

The local capabilites and remote capabilites are in OpalMediaFormatList classes, stored in this class. The local capbilities have already been ordered by the users preferences. The first entry in the remote capabilities is the remote endpoints preferred codec. Now, we have to select a codec to use for this connection. The selected codec is in the binary value defined by FullFrameVoice::AudioSc

virtual OpalMediaStream* IAX2Connection::CreateMediaStream ( const OpalMediaFormat mediaFormat,
unsigned  sessionID,
PBoolean  isSource 
)
virtual

Open a new media stream. This will create a media stream of class OpalIAX2MediaStream.

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.

Parameters
mediaFormatMedia format for stream
sessionIDSession number for stream
isSourceIs a source stream

Reimplemented from OpalConnection.

void IAX2Connection::EndCallNow ( CallEndReason  reason = EndedByLocalUser)

Cause the call to end now, but do not send any iax hangup frames etc

Parameters
reasonReason for call clearing
virtual PBoolean IAX2Connection::ForwardCall ( const PString &  forwardParty)
virtual

Forward incoming call to specified address. This would typically be called from within the OnIncomingCall() function when an application wishes to redirct an unwanted incoming call.

The return value is true if the call is to be forwarded, false otherwise. Note that if the call is forwarded the current connection is cleared with teh ended call code of EndedByCallForwarded.

Parameters
forwardPartyParty to forward call to.

Reimplemented from OpalConnection.

const PTimeInterval& IAX2Connection::GetCallStartTick ( )
inline

Get the call start time

References IAX2Processor::GetCallStartTick(), and iax2Processor.

PString IAX2Connection::GetCallToken ( )
inline

Return the string that identifies this IAX2Connection instance

References IAX2Processor::GetCallToken(), and iax2Processor.

IAX2EndPoint& IAX2Connection::GetEndPoint ( )
inline

Test to see if it is a status query type iax frame (eg lagrq) and handle it. If the frame is a status query, and it is handled, return true Return reference to the endpoint class

References endpoint.

OpalMediaFormatList IAX2Connection::GetMediaFormats ( ) const
inlinevirtual

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.

This method returns media formats that were decided through the initial exchange of packets when setting up a call (the cmdAccept and cmdNew packets).

The OpalConnection has this method as pure, so it is defined for IAX2.

Reimplemented from OpalConnection.

References remoteMediaFormats.

PString IAX2Connection::GetPassword ( ) const
inline

Get the password

References password.

PINDEX IAX2Connection::GetPreferredCodec ( )

Return the bitmask which specifies the preferred codec. The selected codec is in the binary value defined by FullFrameVoice::AudioSc

IAX2Remote& IAX2Connection::GetRemoteInfo ( )
inline

Get information on Remote class (remote node address & port + source & dest call number.)

References IAX2Processor::GetRemoteInfo(), and iax2Processor.

IAX2SequenceNumbers& IAX2Connection::GetSequenceInfo ( )
inline

Get the sequence number info (inSeqNo and outSeqNo)

References IAX2Processor::GetSequenceInfo(), and iax2Processor.

PINDEX IAX2Connection::GetSupportedCodecs ( )

Return the bitmask which specifies the possible codecs we support. The supported codecs are a bitmask of values defined by FullFrameVoice::AudioSc

PString IAX2Connection::GetUserName ( ) const
inline

Get the username

References userName.

virtual bool IAX2Connection::HoldRemote ( bool  placeOnHold)
virtual

Put the current connection on hold, suspending media streams. The streams from the remote are always paused. The streams from the local to the remote are conditionally paused depending on underlying logic for "music on hold" functionality.

The fromRemote parameter indicates if we a putting the remote on hold (false) or it is a request for the remote to put us on hold (true).

The /p placeOnHold parameter indicates of the command/request is for going on hold or retrieving from hold.

Returns
true if hold request successfully initiated. The OnHold() call back must be monitored for final confirmation of hold state.
Parameters
placeOnHoldFlag for setting on or off hold

Reimplemented from OpalConnection.

void IAX2Connection::IncomingEthernetFrame ( IAX2Frame frame)

Handle a received IAX frame. This may be a mini frame or full frame. Typically, this connection instance will immediately pass the frame on to the CallProcessor::IncomingEthernetFrame() method.

PBoolean IAX2Connection::IsCallTerminating ( )
inline

Report if this Connection is still active

References iax2Processor, and IAX2CallProcessor::IsCallTerminating().

virtual bool IAX2Connection::IsNetworkConnection ( ) const
inlinevirtual

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 bool IAX2Connection::IsOnHold ( bool  fromRemote) const
virtual

Return true if the current connection is on hold. The fromRemote parameter indicates if we are testing if the remote system has us on hold, or we have them on hold.

Parameters
fromRemoteFlag for if remote has us on hold, or we have them

Reimplemented from OpalConnection.

void IAX2Connection::OnConnected ( )
virtual

Capture an Opal generated call back, which tells us the media streams are about to start. In this method, we start the jitter buffer for the IAX2 audio packets, and then call the OPAL OnConnected method to ensure the proper handling takes place.

That this method is called is an indication that the remote endpoint has answered our call and is happy for the call to proceed.

Reimplemented from OpalConnection.

void IAX2Connection::OnEstablished ( )
virtual

A call back function whenever a connection is established. This indicates that a connection to an endpoint was established. This usually occurs after OnConnected() and indicates that the connection is both connected and media can flow.

In the context of IAX2 this means we have received the first full frame of media from the remote endpoint

This method runs when a media stream in OpalConnection is opened. This callback is used to indicate we need to start the "every 10 second do an iax2 lagrq/lagrp+ping/pong exhange process".

This exchange proces is invoked in the IAX2CallProcessor.

Reimplemented from OpalConnection.

virtual void IAX2Connection::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 the OpalEndPoint function of the same name.

Reimplemented from OpalConnection.

void IAX2Connection::OnSetUp ( )

We have received a packet from the remote iax endpoint, requeting a call. Now, we use this method to invoke the opal components to do their bit.

This method is called after OnIncomingConnection().

void IAX2Connection::PutSoundPacketToNetwork ( PBYTEArray *  sund)

Handle a sound packet received from the sound device.

Now onsend this to the remote endpoint.

PBoolean IAX2Connection::ReadSoundPacket ( RTP_DataFrame packet)

Grab a sound packet from the jitterBuffer in this class. Return it to the requesting process, which is in an instance of the OpalIAX2MediaStream class. Note that this class returns RTP_DataFrame instances. These RTP_DataFrame instances were generated by the IAX2CallProcessor class.

void IAX2Connection::ReceivedSoundPacketFromNetwork ( IAX2Frame soundFrame)

We have received an iax2 sound frame from the network. This method places it in the jitter buffer (a member of this class)

void IAX2Connection::RemoteHoldConnection ( )

Signal that the remote side has put the connection on hold

void IAX2Connection::RemoteRetrieveConnection ( )

Signal that the remote side has retrieved the connection

void IAX2Connection::ReportStatistics ( )

Invoked by the User interface, which causes the statistics (count of in/out packets) to be printed

void IAX2Connection::SendDtmf ( const PString &  dtmf)

Provided as a link between the iax endpoint and the iax processor

virtual PBoolean IAX2Connection::SendUserInputString ( const PString &  value)
virtual

sending text fullframes

Reimplemented from OpalConnection.

virtual PBoolean IAX2Connection::SendUserInputTone ( char  tone,
unsigned  duration 
)
virtual

sending dtmf - which is 1 char per IAX2FullFrameDtmf on the frame.

Reimplemented from OpalConnection.

PBoolean IAX2Connection::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 OpalConnection has this method as pure, so it is defined for IAX2.

Parameters
calleeNameName of endpoint being alerted.
withMediaOpen media with alerting

Reimplemented from OpalConnection.

void IAX2Connection::SetCallToken ( PString  newToken)

Give the call token a value. The call token is the ipaddress of the remote node concatented with the remote nodes src number. This is guaranteed to be unique. Sadly, if this connection is setting up the call, the callToken is not known until receipt of the first packet from the remote node.

However, if this connection is created in response to a call, this connection can determine the callToken on examination of that incoming first packet

virtual PBoolean IAX2Connection::SetConnected ( )
virtual

Indicate to remote endpoint we are connected. In other words, tell the remote endpoint we accept the call and things proceed with the call eventuallly moving to established phase.

In addition to the OpalConnection::SetConnected method, we have to do the iax2 connection stuff, which is to send an iax2 answer packet to the remote host.

The IAX2 answer packet is sent by the iax2 call processor, and indicates we have agreed to the incoming call.

Reimplemented from OpalConnection.

void IAX2Connection::SetPassword ( const PString &  inPassword)
inline

Set the password for when we connect to a remote node we use it as authentication. Note this must only be used before SetUpConnection is ran. This is optional because some servers do not required authentication, also if it is not set then the default iax2Ep password will be used instead.

References password.

PBoolean IAX2Connection::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. In IAX2, it sends a New packet..

The behaviour at the opal level is pure. Here, the method is defined.

Reimplemented from OpalConnection.

void IAX2Connection::SetUserName ( const PString &  inUserName)
inline

Set the username for when we connect to a remote node we use it as authentication. Note this must only be used before SetUpConnection is ran. This is optional because some servers do not required authentication, also if it is not set then the default iax2Ep username will be used instead.

References userName.

void IAX2Connection::StartOperation ( )

this method starts the callprocessor of a connection, and maves the phase to setup. Essentially, we start the entire call handling process here.

virtual bool IAX2Connection::TransferConnection ( const PString &  remoteParty)
virtual

Initiate the transfer of an existing call (connection) to a new remote party.

If remoteParty is a valid call token, then the remote party is transferred to that party (consultation transfer) and both calls are cleared.

Parameters
remotePartyRemote party to transfer the existing call to

Reimplemented from OpalConnection.

void IAX2Connection::TransmitFrameToRemoteEndpoint ( IAX2Frame src)

Transmit IAX2Frame to remote endpoint, It is only called by the the IAXProcessor class.

Friends And Related Function Documentation

friend class IAX2CallProcessor
friend

Field Documentation

IAX2EndPoint& IAX2Connection::endpoint
protected

Global variable which specifies IAX2 protocol specific issues

Referenced by GetEndPoint().

IAX2CallProcessor& IAX2Connection::iax2Processor
protected

The thread that processes the list of pending frames on this class

Referenced by GetCallStartTick(), GetCallToken(), GetRemoteInfo(), GetSequenceInfo(), and IsCallTerminating().

PBoolean IAX2Connection::local_hold
protected

Whether the connection is on hold locally

OpalMediaFormatList IAX2Connection::localMediaFormats
protected

The list of media formats (codecs) this end wants to use. This list is defined on constructing this IAX2Connection class

OpalJitterBuffer* IAX2Connection::m_jitterBuffer
protected

This jitter buffer smooths out the delivery times from the network, so that packets arrive in schedule at the far end.

RTP_DataFrame::PayloadTypes IAX2Connection::opalPayloadType
protected

The payload type, which we put on all RTP_DataFrame packets. This variable is placed on all RTP_DataFrame instances, prior to placing these frames into the jitter buffer.

This variable is not used in the transmission of frames.

Note that this variable describes the payload type as opal sees it.

PString IAX2Connection::password
protected

Password for the iax2CallProcessor

Referenced by GetPassword(), and SetPassword().

PBoolean IAX2Connection::remote_hold
protected

Whether the connection is on hold remotely

OpalMediaFormatList IAX2Connection::remoteMediaFormats
protected

The list of media formats (codecs) the remote enpoint can use. This list is defined on receiving a particular Inforation Element

Referenced by GetMediaFormats().

PString IAX2Connection::userName
protected

Username for the iax2CallProcessor

Referenced by GetUserName(), and SetUserName().


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