IAX2Connection Class Reference

#include <iax2con.h>

Inheritance diagram for IAX2Connection:

OpalConnection List of all members.

General worker methods

PString userName
PString password
void IncomingEthernetFrame (IAX2Frame *frame)
IAX2EndPointGetEndPoint ()
void ReportStatistics ()
void Release (CallEndReason reason=EndedByLocalUser)
void ClearCall (CallEndReason reason=EndedByLocalUser)
void EndCallNow (CallEndReason reason=EndedByLocalUser)
OpalConnection::SendUserInputModes GetRealSendUserInputMode () const
void SendDtmf (const PString &dtmf)
virtual BOOL SendUserInputString (const PString &value)
virtual BOOL SendUserInputTone (char tone, unsigned duration)
void AcceptIncomingCall ()
virtual void AnsweringCall (AnswerCallResponse response)
BOOL IsCallTerminating ()
BOOL SetAlerting (const PString &calleeName, BOOL withMedia)
BOOL SetConnected ()
OpalMediaFormatList GetMediaFormats () const
OpalMediaStreamCreateMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, BOOL isSource)
void SetCallToken (PString newToken)
PString GetCallToken ()
void TransmitFrameToRemoteEndpoint (IAX2Frame *src)
void PutSoundPacketToNetwork (PBYTEArray *sund)
void ReceivedSoundPacketFromNetwork (IAX2Frame *soundFrame)
BOOL ReadSoundPacket (DWORD timestamp, RTP_DataFrame &packet)
IAX2RemoteGetRemoteInfo ()
IAX2SequenceNumbersGetSequenceInfo ()
const PTimeInterval & GetCallStartTick ()
virtual void OnSetUp ()
virtual void OnAlerting ()
virtual BOOL OnIncomingCall (unsigned int options, OpalConnection::StringOptions *stringOptions)
virtual void OnConnected ()
virtual void OnEstablished ()
void OnReleased ()
BOOL SetUpConnection ()
PINDEX GetSupportedCodecs ()
PINDEX GetPreferredCodec ()
void BuildRemoteCapabilityTable (unsigned int remoteCapability, unsigned int format)
unsigned int ChooseCodec ()
virtual BOOL IsConnectionOnHold ()
virtual void RetrieveConnection ()
virtual void HoldConnection ()
void RemoteHoldConnection ()
void RemoteRetrieveConnection ()
void SetUserName (PString &inUserName)
PString GetUserName () const
void SetPassword (PString &inPassword)
PString GetPassword () const
virtual void TransferConnection (const PString &remoteParty, const PString &callIdentity=PString::Empty())
virtual BOOL ForwardCall (const PString &forwardParty)

Protected Attributes

IAX2JitterBuffer jitterBuffer
RTP_DataFrame::PayloadTypes opalPayloadType
Internal, protected methods, which are invoked only by this
thread

IAX2EndPointendpoint
OpalMediaFormatList remoteMediaFormats
OpalMediaFormatList localMediaFormats
IAX2CallProcessoriax2Processor
BOOL local_hold
BOOL remote_hold

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:
endpoint  Owner call for connection
token  Owner iax endpoint for connection
userData  Token to identify the connection
remoteParty  Specific user data for this call
remotePartyName  Url 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.

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:
endpoint  Owner call for connection
token  Owner iax endpoint for connection
userData  Token to identify the connection
remoteParty  Specific user data for this call
remotePartyName  Url 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

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.

IAX2EndPoint& IAX2Connection::GetEndPoint (  )  [inline]

Return reference to the endpoint class

void IAX2Connection::ReportStatistics (  ) 

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

void IAX2Connection::Release ( CallEndReason  reason = EndedByLocalUser  )  [virtual]

Release the current connection. This removes the connection from the current call. The call may continue if there are other connections still active on it. If this was the last connection for the call then the call is disposed of as well.

Note that this function will return quickly as the release and disposal of the connections is done by another thread.

The ConnectionRun that manages packets going into/out of the IAX2Connection will continue to run, and will send the appropriate IAX@ hangup messages. Death of the Connection thread will happen when the OnReleased thread of the OpalConnection runs

Parameters:
reason  Reason for call release

Reimplemented from OpalConnection.

void IAX2Connection::ClearCall ( CallEndReason  reason = EndedByLocalUser  ) 

Clear a current call. This sends a hangup frame to the remote endpoint, and then calls OpalConnection::ClearCall();

Parameters:
reason  Reason for call clearing

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:
reason  Reason for call clearing

OpalConnection::SendUserInputModes IAX2Connection::GetRealSendUserInputMode (  )  const [virtual]

Get the real user input indication transmission mode. This will return the user input mode that will actually be used for transmissions. It will be the value of GetSendUserInputMode() provided the remote endpoint is capable of that mode.

Reimplemented from OpalConnection.

void IAX2Connection::SendDtmf ( const PString &  dtmf  ) 

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

virtual BOOL IAX2Connection::SendUserInputString ( const PString &  value  )  [virtual]

sending text fullframes

Reimplemented from OpalConnection.

virtual BOOL IAX2Connection::SendUserInputTone ( char  tone,
unsigned  duration 
) [virtual]

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

Reimplemented from OpalConnection.

void IAX2Connection::AcceptIncomingCall (  ) 

Send appropriate packets to the remote node to indicate we will accept this call. Note that this method is called from the endpoint thread, (not this IAX2Connection's thread

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.

Sending a AnswerCallDeferred response would have no effect.

Reimplemented from OpalConnection.

BOOL IAX2Connection::IsCallTerminating (  )  [inline]

Report if this Connection is still active

BOOL IAX2Connection::SetAlerting ( const PString &  calleeName,
BOOL  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 is pure.

Parameters:
withMedia  Name of endpoint being alerted. Open media with alerting

Implements OpalConnection.

BOOL IAX2Connection::SetConnected (  )  [virtual]

Indicate to remote endpoint we are connected.

The default behaviour is pure.

Implements OpalConnection.

OpalMediaFormatList IAX2Connection::GetMediaFormats (  )  const [inline, 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 is pure.

Implements OpalConnection.

OpalMediaStream* IAX2Connection::CreateMediaStream ( const OpalMediaFormat mediaFormat,
unsigned  sessionID,
BOOL  isSource 
) [virtual]

Open a new media stream. This will create a media stream of subclass OpalIAXMediaStream.

The sessionID parameter is (in this case) not needed by a particular media stream and is ignored.

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:
sessionID  Media format for stream
isSource  Session number for stream Is a source stream

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 cal, 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

PString IAX2Connection::GetCallToken (  )  [inline]

Return the string that identifies this IAX2Connection instance

void IAX2Connection::TransmitFrameToRemoteEndpoint ( IAX2Frame src  ) 

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

void IAX2Connection::PutSoundPacketToNetwork ( PBYTEArray *  sund  ) 

Handle a sound packet received from the sound device.

Now onsend this to the remote endpoint.

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)

BOOL IAX2Connection::ReadSoundPacket ( DWORD  timestamp,
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.

IAX2Remote& IAX2Connection::GetRemoteInfo (  )  [inline]

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

IAX2SequenceNumbers& IAX2Connection::GetSequenceInfo (  )  [inline]

Get the sequence number info (inSeqNo and outSeqNo)

const PTimeInterval& IAX2Connection::GetCallStartTick (  )  [inline]

Get the call start time

virtual void IAX2Connection::OnSetUp (  )  [virtual]

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().

virtual void IAX2Connection::OnAlerting (  )  [virtual]

Call back for remote party being alerted. This function is called after the connection is informed that the remote endpoint is "ringing". Generally some time after the SetUpConnection() function was called, this is function is called.

If FALSE is returned the connection is aborted.

If an application overrides this function, it should generally call the ancestor version for correct operation. An application would typically only intercept this function if it wishes to do some form of logging. For this you can obtain the name of the caller by using the function OpalConnection::GetRemotePartyName().

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

Reimplemented from OpalConnection.

virtual BOOL IAX2Connection::OnIncomingCall ( unsigned int  options,
OpalConnection::StringOptions stringOptions 
) [virtual]

virtual void IAX2Connection::OnConnected (  )  [virtual]

A call back function whenever a connection is "connected". This indicates that an iax link to an endpoint has been made & verified. Now, the endpoint has to receive information on this. Further, media has to start to flow.

In the context of IAX, this means that the accept and verification packets have been procesed, and or that we have received the first media from the remote end.

Reimplemented from OpalConnection.

virtual void IAX2Connection::OnEstablished (  )  [virtual]

A call back function whenever a connection is established. This indicates that a connection to an endpoint was established. This differs from OnConnected() in that the media streams are started.

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

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

Reimplemented from OpalConnection.

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.

BOOL 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.

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

Implements OpalConnection.

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

PINDEX IAX2Connection::GetPreferredCodec (  ) 

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

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 BOOL IAX2Connection::IsConnectionOnHold (  )  [virtual]

Return TRUE if the current connection is on hold.

Reimplemented from OpalConnection.

virtual void IAX2Connection::RetrieveConnection (  )  [virtual]

Take the current connection off hold

Reimplemented from OpalConnection.

virtual void IAX2Connection::HoldConnection (  )  [virtual]

Put the current connection on hold, suspending all media streams.

Reimplemented from OpalConnection.

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::SetUserName ( 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.

PString IAX2Connection::GetUserName (  )  const [inline]

Get the username

void IAX2Connection::SetPassword ( 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.

PString IAX2Connection::GetPassword (  )  const [inline]

Get the password

virtual void IAX2Connection::TransferConnection ( const PString &  remoteParty,
const PString &  callIdentity = PString::Empty() 
) [virtual]

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

Parameters:
remoteParty  Remote party to transfer the existing call to
callIdentity  Call Identity of secondary call if present

Reimplemented from OpalConnection.

virtual BOOL 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:
forwardParty  Party to forward call to.

Reimplemented from OpalConnection.


Member Data Documentation

PString IAX2Connection::userName [protected]

Username for the iax2CallProcessor

PString IAX2Connection::password [protected]

Password for the iax2CallProcessor

IAX2EndPoint& IAX2Connection::endpoint [protected]

Global variable which specifies IAX2 protocol specific issues

Reimplemented from OpalConnection.

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

OpalMediaFormatList IAX2Connection::localMediaFormats [protected]

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

IAX2CallProcessor& IAX2Connection::iax2Processor [protected]

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

BOOL IAX2Connection::local_hold [protected]

Whether the connection is on hold locally

BOOL IAX2Connection::remote_hold [protected]

Whether the connection is on hold remotely

IAX2JitterBuffer IAX2Connection::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.


The documentation for this class was generated from the following file:
Generated on Fri Mar 7 06:34:02 2008 for OPAL by  doxygen 1.5.1