#include <sipcon.h>
Inheritance diagram for SIPConnection:
Public Member Functions | |
virtual PBoolean | ForwardCall (const PString &forwardParty) |
virtual SendUserInputModes | GetRealSendUserInputMode () const |
PBoolean | SendUserInputTone (char tone, unsigned duration) |
virtual PBoolean | SendInviteOK (const SDPSessionDescription &sdp) |
virtual PBoolean | SendInviteResponse (SIP_PDU::StatusCodes code, const char *contact=NULL, const char *extra=NULL, const SDPSessionDescription *sdp=NULL) |
virtual PBoolean | SendPDU (SIP_PDU &, const OpalTransportAddress &) |
unsigned | GetNextCSeq () |
OpalTransportAddress | GetLocalAddress (WORD port=0) const |
OpalTransport & | GetTransport () const |
virtual PString | GetLocalPartyAddress () const |
virtual PString | GetExplicitFrom () const |
virtual void | SetLocalPartyAddress () |
void | SetLocalPartyAddress (const PString &addr) |
const PString | GetRemotePartyCallbackURL () const |
SIPEndPoint & | GetEndPoint () const |
const SIPURL & | GetTargetAddress () const |
const PStringList & | GetRouteSet () const |
const SIPAuthentication & | GetAuthenticator () const |
PBoolean | OnOpenIncomingMediaChannels () |
virtual void | OnMediaCommand (OpalMediaCommand ¬e, INT extra) |
Overrides from OpalConnection | |
virtual PBoolean | SetUpConnection () |
virtual PString | GetDestinationAddress () |
virtual void | TransferConnection (const PString &remoteParty, const PString &callIdentity=PString::Empty()) |
virtual void | HoldConnection () |
virtual void | RetrieveConnection () |
virtual PBoolean | IsConnectionOnHold () |
virtual PBoolean | SetAlerting (const PString &calleeName, PBoolean withMedia) |
virtual PBoolean | SetConnected () |
virtual OpalMediaFormatList | GetMediaFormats () const |
virtual OpalMediaStreamPtr | OpenMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, bool isSource) |
virtual bool | CloseMediaStream (OpalMediaStream &stream) |
virtual OpalMediaStream * | CreateMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource) |
virtual void | OnPatchMediaStream (PBoolean isSource, OpalMediaPatch &patch) |
void | AnsweringCall (AnswerCallResponse response) |
virtual PBoolean | IsMediaBypassPossible (unsigned sessionID) const |
virtual void | OnReleased () |
Protocol handling functions | |
virtual void | OnTransactionFailed (SIPTransaction &transaction) |
virtual void | OnReceivedPDU (SIP_PDU &pdu) |
virtual void | OnReceivedINVITE (SIP_PDU &pdu) |
virtual void | OnReceivedReINVITE (SIP_PDU &pdu) |
virtual void | OnReceivedACK (SIP_PDU &pdu) |
virtual void | OnReceivedOPTIONS (SIP_PDU &pdu) |
virtual void | OnReceivedNOTIFY (SIP_PDU &pdu) |
virtual void | OnReceivedREFER (SIP_PDU &pdu) |
virtual void | OnReceivedINFO (SIP_PDU &pdu) |
virtual void | OnReceivedPING (SIP_PDU &pdu) |
virtual void | OnReceivedBYE (SIP_PDU &pdu) |
virtual void | OnReceivedCANCEL (SIP_PDU &pdu) |
virtual void | OnReceivedResponse (SIPTransaction &transaction, SIP_PDU &response) |
virtual void | OnReceivedTrying (SIP_PDU &pdu) |
virtual void | OnReceivedRinging (SIP_PDU &pdu) |
virtual void | OnReceivedSessionProgress (SIP_PDU &pdu) |
virtual PBoolean | OnReceivedAuthenticationRequired (SIPTransaction &transaction, SIP_PDU &response) |
virtual void | OnReceivedRedirection (SIP_PDU &pdu) |
virtual void | OnReceivedOK (SIPTransaction &transaction, SIP_PDU &response) |
virtual void | OnCreatingINVITE (SIP_PDU &pdu) |
virtual void | OnRTPStatistics (const RTP_Session &session) const |
Protected Types | |
enum | { ReleaseWithBYE, ReleaseWithCANCEL, ReleaseWithResponse, ReleaseWithNothing } |
Protected Member Functions | |
PDECLARE_NOTIFIER (PTimer, SIPConnection, OnInviteResponseRetry) | |
PDECLARE_NOTIFIER (PTimer, SIPConnection, OnAckTimeout) | |
virtual RTP_UDP * | OnUseRTPSession (const unsigned rtpSessionId, const OpalTransportAddress &mediaAddress, OpalTransportAddress &localAddress) |
virtual bool | OnSendSDP (bool isAnswerSDP, RTP_SessionManager &rtpSessions, SDPSessionDescription &sdpOut) |
virtual bool | OfferSDPMediaDescription (unsigned rtpSessionId, RTP_SessionManager &rtpSessions, SDPSessionDescription &sdpOut) |
virtual bool | AnswerSDPMediaDescription (const SDPSessionDescription &sdpIn, SDPMediaDescription::MediaType mediaType, unsigned sessionId, SDPSessionDescription &sdpOut) |
virtual void | OnReceivedSDP (SIP_PDU &pdu) |
virtual bool | OnReceivedSDPMediaDescription (SDPSessionDescription &sdp, SDPMediaDescription::MediaType mediaType, unsigned sessionId) |
OpalTransport * | CreateTransport (const OpalTransportAddress &address, PBoolean isLocalAddress=PFalse) |
void | UpdateRemotePartyNameAndNumber () |
Static Protected Member Functions | |
static PBoolean | WriteINVITE (OpalTransport &transport, void *param) |
Protected Attributes | |
SIPEndPoint & | endpoint |
OpalTransport * | transport |
PMutex | transportMutex |
bool | local_hold |
bool | remote_hold |
PString | localPartyAddress |
PString | forwardParty |
SIP_PDU * | originalInvite |
PTime | originalInviteTime |
bool | needReINVITE |
PStringList | routeSet |
SIPURL | targetAddress |
SIPAuthentication | authentication |
PTimer | ackTimer |
PTimer | ackRetry |
SIP_PDU | ackPacket |
bool | ackReceived |
PSafePtr< SIPTransaction > | referTransaction |
PSafeList< SIPTransaction > | forkedInvitations |
PAtomicInteger | lastSentCSeq |
enum SIPConnection:: { ... } | releaseMethod |
OpalMediaFormatList | remoteFormatList |
PString | explicitFrom |
Friends | |
class | SIPInvite |
anonymous enum [protected] |
SIPConnection::SIPConnection | ( | OpalCall & | call, | |
SIPEndPoint & | endpoint, | |||
const PString & | token, | |||
const SIPURL & | address, | |||
OpalTransport * | transport, | |||
unsigned int | options = 0 , |
|||
OpalConnection::StringOptions * | stringOptions = NULL | |||
) |
Create a new connection.
call | Owner call for connection |
endpoint | Owner endpoint for connection |
token | token to identify the connection |
address | Destination address for outgoing call |
transport | Transport INVITE came in on |
options | Connection options |
stringOptions | complex string options |
SIPConnection::~SIPConnection | ( | ) |
Destroy connection.
SIPConnection::SIPConnection | ( | OpalCall & | call, | |
SIPEndPoint & | endpoint, | |||
const PString & | token, | |||
const SIPURL & | address, | |||
OpalTransport * | transport, | |||
unsigned int | options = 0 , |
|||
OpalConnection::StringOptions * | stringOptions = NULL | |||
) |
Create a new connection.
call | Owner call for connection |
endpoint | Owner endpoint for connection |
token | token to identify the connection |
address | Destination address for outgoing call |
transport | Transport INVITE came in on |
options | Connection options |
stringOptions | complex string options |
SIPConnection::~SIPConnection | ( | ) |
Destroy connection.
virtual PBoolean SIPConnection::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 is .
Implements OpalConnection.
virtual PString SIPConnection::GetDestinationAddress | ( | ) | [virtual] |
Get the destination address of an incoming connection. This will, for example, collect a phone number from a POTS line, or get the fields from the H.225 SETUP pdu in a H.323 connection.
The default behaviour returns "*", which by convention means any address the endpoint/connection can get to.
Reimplemented from OpalConnection.
virtual void SIPConnection::TransferConnection | ( | const PString & | remoteParty, | |
const PString & | callIdentity = PString::Empty() | |||
) | [virtual] |
Initiate the transfer of an existing call (connection) to a new remote party.
remoteParty | Remote party to transfer the existing call to |
callIdentity | Call Identity of secondary call if present |
Reimplemented from OpalConnection.
virtual void SIPConnection::HoldConnection | ( | ) | [virtual] |
Put the current connection on hold, suspending all media streams.
Reimplemented from OpalConnection.
virtual void SIPConnection::RetrieveConnection | ( | ) | [virtual] |
Retrieve the current connection from hold, activating all media streams.
Reimplemented from OpalConnection.
virtual PBoolean SIPConnection::IsConnectionOnHold | ( | ) | [virtual] |
Return PTrue if the current connection is on hold.
Reimplemented from OpalConnection.
virtual PBoolean SIPConnection::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 remote endpoint is "ringing".
The default behaviour does nothing.
calleeName | Name of endpoint being alerted. |
Implements OpalConnection.
virtual PBoolean SIPConnection::SetConnected | ( | ) | [virtual] |
Indicate to remote endpoint we are connected.
The default behaviour does nothing.
Implements OpalConnection.
virtual OpalMediaFormatList SIPConnection::GetMediaFormats | ( | ) | const [virtual] |
Get the data formats this endpoint is capable of operating in.
Implements OpalConnection.
virtual OpalMediaStreamPtr SIPConnection::OpenMediaStream | ( | const OpalMediaFormat & | mediaFormat, | |
unsigned | sessionID, | |||
bool | isSource | |||
) | [virtual] |
Open source or sink media stream for session.
mediaFormat | Media format to open |
sessionID | Session to start stream on |
isSource | Stream is a source/sink |
Reimplemented from OpalConnection.
virtual bool SIPConnection::CloseMediaStream | ( | OpalMediaStream & | stream | ) | [virtual] |
Request close of a specific media stream. Note that this is usually asymchronous, the OnClosedMediaStream() function is called when the stream is really closed.
stream | Stream to close |
Reimplemented from OpalConnection.
virtual OpalMediaStream* SIPConnection::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.
mediaFormat | Media format for stream |
sessionID | Session number for stream |
isSource | Is a source stream |
Reimplemented from OpalConnection.
virtual void SIPConnection::OnPatchMediaStream | ( | PBoolean | isSource, | |
OpalMediaPatch & | patch | |||
) | [virtual] |
Overrides from OpalConnection
Reimplemented from OpalConnection.
void SIPConnection::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.
Note sending further AnswerCallPending responses via this function will have the result of an 180 PDU being sent to the remote endpoint. In this way multiple Alerting PDUs may be sent.
Sending a AnswerCallDeferred response would have no effect.
response | Answer response to incoming call |
Reimplemented from OpalConnection.
virtual PBoolean SIPConnection::IsMediaBypassPossible | ( | unsigned | sessionID | ) | const [virtual] |
See if the media can bypass the local host.
The default behaviour returns PFalse indicating that media bypass is not possible.
sessionID | Session ID for media channel |
Reimplemented from OpalConnection.
virtual void SIPConnection::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.
virtual void SIPConnection::OnTransactionFailed | ( | SIPTransaction & | transaction | ) | [virtual] |
Handle the fail of a transaction we initiated.
virtual void SIPConnection::OnReceivedPDU | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming SIP PDU that has been full decoded
virtual void SIPConnection::OnReceivedINVITE | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming INVITE request
virtual void SIPConnection::OnReceivedReINVITE | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming Re-INVITE request
virtual void SIPConnection::OnReceivedACK | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming ACK PDU
virtual void SIPConnection::OnReceivedOPTIONS | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming OPTIONS PDU
virtual void SIPConnection::OnReceivedNOTIFY | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming NOTIFY PDU
virtual void SIPConnection::OnReceivedREFER | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming REFER PDU
virtual void SIPConnection::OnReceivedINFO | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming INFO PDU
virtual void SIPConnection::OnReceivedPING | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming PING PDU
virtual void SIPConnection::OnReceivedBYE | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming BYE PDU
virtual void SIPConnection::OnReceivedCANCEL | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming CANCEL PDU
virtual void SIPConnection::OnReceivedResponse | ( | SIPTransaction & | transaction, | |
SIP_PDU & | response | |||
) | [virtual] |
Handle an incoming response PDU.
virtual void SIPConnection::OnReceivedTrying | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming Trying response PDU
virtual void SIPConnection::OnReceivedRinging | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming Ringing response PDU
virtual void SIPConnection::OnReceivedSessionProgress | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming Session Progress response PDU
virtual PBoolean SIPConnection::OnReceivedAuthenticationRequired | ( | SIPTransaction & | transaction, | |
SIP_PDU & | response | |||
) | [virtual] |
Handle an incoming Proxy Authentication Required response PDU Returns: PTrue if handled, if PFalse is returned connection is released.
virtual void SIPConnection::OnReceivedRedirection | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle an incoming redirect response PDU
virtual void SIPConnection::OnReceivedOK | ( | SIPTransaction & | transaction, | |
SIP_PDU & | response | |||
) | [virtual] |
Handle an incoming OK response PDU. This actually gets any PDU of the class 2xx not just 200.
virtual void SIPConnection::OnCreatingINVITE | ( | SIP_PDU & | pdu | ) | [virtual] |
Handle a sending INVITE request
virtual void SIPConnection::OnRTPStatistics | ( | const RTP_Session & | session | ) | const [virtual] |
Callback from the RTP session for statistics monitoring. This is called every so many packets on the transmitter and receiver threads of the RTP session indicating that the statistics have been updated.
The default behaviour does nothing.
session | Session with statistics |
virtual PBoolean SIPConnection::ForwardCall | ( | const PString & | forwardParty | ) | [virtual] |
Forward incoming connection to the specified address. This would typically be called from within the OnIncomingConnection() function when an application wishes to redirect an unwanted incoming call.
The return value is PTrue if the call is to be forwarded, PFalse otherwise. Note that if the call is forwarded, the current connection is cleared with the ended call code set to EndedByCallForwarded.
forwardParty | Party to forward call to. |
Reimplemented from OpalConnection.
virtual SendUserInputModes SIPConnection::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.
PBoolean SIPConnection::SendUserInputTone | ( | char | tone, | |
unsigned | duration | |||
) | [virtual] |
Send a user input indication to the remote endpoint. This sends DTMF emulation user input. If something more sophisticated than the simple tones that can be sent using the SendUserInput() function.
A duration of zero indicates that no duration is to be indicated. A non-zero logical channel indicates that the tone is to be syncronised with the logical channel at the rtpTimestamp value specified.
The tone parameter must be one of "0123456789#*ABCD!" where '!' indicates a hook flash. If tone is a ' ' character then a signalUpdate PDU is sent that updates the last tone indication sent. See the H.245 specifcation for more details on this.
The default behaviour sends the tone using RFC2833.
Reimplemented from OpalConnection.
virtual PBoolean SIPConnection::SendInviteOK | ( | const SDPSessionDescription & | sdp | ) | [virtual] |
Send a "200 OK" response for the received INVITE message.
virtual PBoolean SIPConnection::SendInviteResponse | ( | SIP_PDU::StatusCodes | code, | |
const char * | contact = NULL , |
|||
const char * | extra = NULL , |
|||
const SDPSessionDescription * | sdp = NULL | |||
) | [virtual] |
Send a response for the received INVITE message.
virtual PBoolean SIPConnection::SendPDU | ( | SIP_PDU & | , | |
const OpalTransportAddress & | ||||
) | [virtual] |
Send a PDU using the connection transport. The PDU is sent to the address given as argument.
unsigned SIPConnection::GetNextCSeq | ( | ) | [inline] |
OpalTransportAddress SIPConnection::GetLocalAddress | ( | WORD | port = 0 |
) | const |
OpalTransport& SIPConnection::GetTransport | ( | ) | const [inline, virtual] |
Reimplemented from OpalConnection.
virtual PString SIPConnection::GetLocalPartyAddress | ( | ) | const [inline, virtual] |
virtual PString SIPConnection::GetExplicitFrom | ( | ) | const [virtual] |
virtual void SIPConnection::SetLocalPartyAddress | ( | ) | [virtual] |
Create full SIPURI - with display name, URL in <> and tag, suitable for From:
void SIPConnection::SetLocalPartyAddress | ( | const PString & | addr | ) | [inline] |
const PString SIPConnection::GetRemotePartyCallbackURL | ( | ) | const [virtual] |
Get the remote party address. This will return the "best guess" at an address to use in a to call the user again later.
Reimplemented from OpalConnection.
SIPEndPoint& SIPConnection::GetEndPoint | ( | ) | const [inline] |
Get the owner endpoint for this connection.
Reimplemented from OpalConnection.
const SIPURL& SIPConnection::GetTargetAddress | ( | ) | const [inline] |
const PStringList& SIPConnection::GetRouteSet | ( | ) | const [inline] |
const SIPAuthentication& SIPConnection::GetAuthenticator | ( | ) | const [inline] |
PBoolean SIPConnection::OnOpenIncomingMediaChannels | ( | ) | [virtual] |
Open the media channels associated with an incoming call
This function is provided to allow an OpalConnection descendant to delay the opening of the media channels associated with an incoming call. By default, this function is called as soon as possible after an incoming connection request has been received (i.e. an INVITE or SETUP) and and do all of the work associated with handling SDP or fastStart eyc
By overriding this function, the media channel open is deferred, which gives the other connections in the call a chance to do something before the media channels are started. This allows for features beyond those provided by the OnAnswer interface
Reimplemented from OpalConnection.
virtual void SIPConnection::OnMediaCommand | ( | OpalMediaCommand & | note, | |
INT | extra | |||
) | [virtual] |
SIPConnection::PDECLARE_NOTIFIER | ( | PTimer | , | |
SIPConnection | , | |||
OnInviteResponseRetry | ||||
) | [protected] |
SIPConnection::PDECLARE_NOTIFIER | ( | PTimer | , | |
SIPConnection | , | |||
OnAckTimeout | ||||
) | [protected] |
virtual RTP_UDP* SIPConnection::OnUseRTPSession | ( | const unsigned | rtpSessionId, | |
const OpalTransportAddress & | mediaAddress, | |||
OpalTransportAddress & | localAddress | |||
) | [protected, virtual] |
virtual bool SIPConnection::OnSendSDP | ( | bool | isAnswerSDP, | |
RTP_SessionManager & | rtpSessions, | |||
SDPSessionDescription & | sdpOut | |||
) | [protected, virtual] |
virtual bool SIPConnection::OfferSDPMediaDescription | ( | unsigned | rtpSessionId, | |
RTP_SessionManager & | rtpSessions, | |||
SDPSessionDescription & | sdpOut | |||
) | [protected, virtual] |
virtual bool SIPConnection::AnswerSDPMediaDescription | ( | const SDPSessionDescription & | sdpIn, | |
SDPMediaDescription::MediaType | mediaType, | |||
unsigned | sessionId, | |||
SDPSessionDescription & | sdpOut | |||
) | [protected, virtual] |
virtual void SIPConnection::OnReceivedSDP | ( | SIP_PDU & | pdu | ) | [protected, virtual] |
virtual bool SIPConnection::OnReceivedSDPMediaDescription | ( | SDPSessionDescription & | sdp, | |
SDPMediaDescription::MediaType | mediaType, | |||
unsigned | sessionId | |||
) | [protected, virtual] |
static PBoolean SIPConnection::WriteINVITE | ( | OpalTransport & | transport, | |
void * | param | |||
) | [static, protected] |
OpalTransport* SIPConnection::CreateTransport | ( | const OpalTransportAddress & | address, | |
PBoolean | isLocalAddress = PFalse | |||
) | [protected] |
void SIPConnection::UpdateRemotePartyNameAndNumber | ( | ) | [protected] |
friend class SIPInvite [friend] |
SIPEndPoint& SIPConnection::endpoint [protected] |
Reimplemented from OpalConnection.
OpalTransport* SIPConnection::transport [protected] |
PMutex SIPConnection::transportMutex [protected] |
bool SIPConnection::local_hold [protected] |
bool SIPConnection::remote_hold [protected] |
PString SIPConnection::localPartyAddress [protected] |
PString SIPConnection::forwardParty [protected] |
SIP_PDU* SIPConnection::originalInvite [protected] |
PTime SIPConnection::originalInviteTime [protected] |
bool SIPConnection::needReINVITE [protected] |
PStringList SIPConnection::routeSet [protected] |
SIPURL SIPConnection::targetAddress [protected] |
SIPAuthentication SIPConnection::authentication [protected] |
PTimer SIPConnection::ackTimer [protected] |
PTimer SIPConnection::ackRetry [protected] |
SIP_PDU SIPConnection::ackPacket [protected] |
bool SIPConnection::ackReceived [protected] |
PSafePtr<SIPTransaction> SIPConnection::referTransaction [protected] |
PSafeList<SIPTransaction> SIPConnection::forkedInvitations [protected] |
PAtomicInteger SIPConnection::lastSentCSeq [protected] |
enum { ... } SIPConnection::releaseMethod [protected] |
OpalMediaFormatList SIPConnection::remoteFormatList [protected] |
PString SIPConnection::explicitFrom [protected] |