reSIProcate/DialogUsageManager  9694
Public Types | Public Member Functions | Private Attributes
resip::InviteSessionHandler Class Reference

Base class for class InviteSessionHandler. More...

#include <InviteSessionHandler.hxx>

Inheritance diagram for resip::InviteSessionHandler:
Inheritance graph
[legend]
Collaboration diagram for resip::InviteSessionHandler:
Collaboration graph
[legend]

List of all members.

Public Types

enum  TerminatedReason {
  Error, Timeout, Replaced, LocalBye,
  RemoteBye, LocalCancel, RemoteCancel, Rejected,
  Referred
}
 called when an dialog enters the terminated state - this can happen after getting a BYE, Cancel, or 4xx,5xx,6xx response - or the session times out More...

Public Member Functions

 InviteSessionHandler (bool genericOfferAnswer=false)
virtual ~InviteSessionHandler ()
virtual bool isGenericOfferAnswer ()
virtual void onNewSession (ClientInviteSessionHandle, InviteSession::OfferAnswerType oat, const SipMessage &msg)=0
 called when an initial INVITE or the intial response to an outoing invite
virtual void onNewSession (ServerInviteSessionHandle, InviteSession::OfferAnswerType oat, const SipMessage &msg)=0
virtual void onFailure (ClientInviteSessionHandle, const SipMessage &msg)=0
 Received a failure response from UAS.
virtual void onEarlyMedia (ClientInviteSessionHandle, const SipMessage &, const SdpContents &)=0
 called when an in-dialog provisional response is received that contains a body
virtual void onEarlyMedia (ClientInviteSessionHandle, const SipMessage &, const Contents &)
virtual void onProvisional (ClientInviteSessionHandle, const SipMessage &)=0
 called when dialog enters the Early state - typically after getting 18x
virtual void onConnected (ClientInviteSessionHandle, const SipMessage &msg)=0
 called when a dialog initiated as a UAC enters the connected state
virtual void onConnected (InviteSessionHandle, const SipMessage &msg)=0
 called when a dialog initiated as a UAS enters the connected state
virtual void onConnectedConfirmed (InviteSessionHandle, const SipMessage &msg)
 called when ACK (with out an answer) is received for initial invite (UAS)
virtual void onStaleCallTimeout (ClientInviteSessionHandle h)
 UAC gets no final response within the stale call timeout (default is 3 minutes).
virtual void terminate (ClientInviteSessionHandle h)
 called when an early dialog decides it wants to terminate the dialog.
virtual void onTerminated (InviteSessionHandle, InviteSessionHandler::TerminatedReason reason, const SipMessage *related=0)=0
virtual void onForkDestroyed (ClientInviteSessionHandle)=0
 called when a fork that was created through a 1xx never receives a 2xx because another fork answered and this fork was canceled by a proxy.
virtual void onRedirected (ClientInviteSessionHandle, const SipMessage &msg)=0
 called when a 3xx with valid targets is encountered in an early dialog This is different then getting a 3xx in onTerminated, as another request will be attempted, so the DialogSet will not be destroyed.
virtual void onReadyToSend (InviteSessionHandle, SipMessage &msg)
 called to allow app to adorn a message. default is to send immediately
virtual void onAnswer (InviteSessionHandle, const SipMessage &msg, const SdpContents &)=0
 called when an answer is received - has nothing to do with user answering the call
virtual void onAnswer (InviteSessionHandle, const SipMessage &msg, const Contents &)
virtual void onOffer (InviteSessionHandle, const SipMessage &msg, const SdpContents &)=0
 called when an offer is received - must send an answer soon after this
virtual void onOffer (InviteSessionHandle, const SipMessage &msg, const Contents &)
virtual void onRemoteSdpChanged (InviteSessionHandle, const SipMessage &msg, const SdpContents &)
 called when a modified body is received in a 2xx response to a session-timer reINVITE.
virtual void onRemoteAnswerChanged (InviteSessionHandle, const SipMessage &msg, const Contents &)
virtual void onOfferRequestRejected (InviteSessionHandle, const SipMessage &msg)
 Called when an error response is received for a reinvite-nobody request (via requestOffer)
virtual void onOfferRequired (InviteSessionHandle, const SipMessage &msg)=0
 called when an Invite w/out offer is sent, or any other context which requires an offer from the user
virtual void onOfferRejected (InviteSessionHandle, const SipMessage *msg)=0
 called if an offer in a UPDATE or re-INVITE was rejected - not real useful.
virtual void onInfo (InviteSessionHandle, const SipMessage &msg)=0
 called when INFO message is received
virtual void onInfoSuccess (InviteSessionHandle, const SipMessage &msg)=0
 called when response to INFO message is received
virtual void onInfoFailure (InviteSessionHandle, const SipMessage &msg)=0
virtual void onMessage (InviteSessionHandle, const SipMessage &msg)=0
 called when MESSAGE message is received
virtual void onMessageSuccess (InviteSessionHandle, const SipMessage &msg)=0
 called when response to MESSAGE message is received
virtual void onMessageFailure (InviteSessionHandle, const SipMessage &msg)=0
virtual void onRefer (InviteSessionHandle, ServerSubscriptionHandle, const SipMessage &msg)=0
 called when an REFER message is received.
virtual void onReferNoSub (InviteSessionHandle, const SipMessage &msg)=0
virtual void onReferRejected (InviteSessionHandle, const SipMessage &msg)=0
 called when an REFER message receives a failure response
virtual void onReferAccepted (InviteSessionHandle, ClientSubscriptionHandle, const SipMessage &msg)=0
 called when an REFER message receives an accepted response
virtual void onAckReceived (InviteSessionHandle, const SipMessage &msg)
 called when ACK is received
virtual void onAckNotReceived (InviteSessionHandle)
 default behaviour is to send a BYE to end the dialog
virtual void onStaleReInviteTimeout (InviteSessionHandle h)
 UAC gets no final response within the stale re-invite timeout (default is 40 seconds).
virtual void onIllegalNegotiation (InviteSessionHandle, const SipMessage &msg)
 will be called if reINVITE or UPDATE in dialog fails
virtual void onSessionExpired (InviteSessionHandle)
 will be called if Session-Timers are used and Session Timer expires default behaviour is to send a BYE to send the dialog
virtual void onFlowTerminated (InviteSessionHandle)
 Called when a TCP or TLS flow to the server has terminated.

Private Attributes

bool mGenericOfferAnswer

Detailed Description

Base class for class InviteSessionHandler.

The application must override this class and provide an imlementation of the handlers below. The class must then be set as an invite session handler on dum (DialogUsageManager::setInviteSessionHandler()).

If you wish to handle invite session offer/answers using generic contents instead of SDP, then construct this class with a bool argument of true, and be sure to add implementations of all of the handlers below that take a Contents parameter type (ie. onEarlyMedia, onOffer, onAnswer, and onRemoteAnswerChanged). Overriding these methods will cause their SdpContent counterparts to not be called. You can then provide a basic empty body implementation of these SdpContent versions of the callbacks.

Example handler for generic (non-sdp only) invite sessions: class MyInviteSessionHandler : public InviteSessionHandler { MyInviteSessionHandler() : InviteSessionHandler(true) {}; ... virtual void onOffer(InviteSessionHandle, const SipMessage& msg, const SdpContents&) {} // No body required virtual void onOffer(InviteSessionHandle, const SipMessage& msg, const Contents&) { Add handler body here } ... };

Definition at line 40 of file InviteSessionHandler.hxx.


Member Enumeration Documentation

called when an dialog enters the terminated state - this can happen after getting a BYE, Cancel, or 4xx,5xx,6xx response - or the session times out

Enumerator:
Error 
Timeout 
Replaced 
LocalBye 
RemoteBye 
LocalCancel 
RemoteCancel 
Rejected 
Referred 

Definition at line 84 of file InviteSessionHandler.hxx.

      {
         Error,
         Timeout, 
         Replaced,
         LocalBye,
         RemoteBye,
         LocalCancel,
         RemoteCancel,
         Rejected, //Only as UAS, UAC has distinct onFailure callback
         Referred
      };

Constructor & Destructor Documentation

resip::InviteSessionHandler::InviteSessionHandler ( bool  genericOfferAnswer = false) [inline]

Definition at line 43 of file InviteSessionHandler.hxx.

: mGenericOfferAnswer(genericOfferAnswer) {}
virtual resip::InviteSessionHandler::~InviteSessionHandler ( ) [inline, virtual]

Definition at line 44 of file InviteSessionHandler.hxx.

{}

Member Function Documentation

virtual bool resip::InviteSessionHandler::isGenericOfferAnswer ( ) [inline, virtual]
void InviteSessionHandler::onAckNotReceived ( InviteSessionHandle  handle) [virtual]

default behaviour is to send a BYE to end the dialog

Definition at line 40 of file InviteSessionHandler.cxx.

References resip::InviteSession::AckNotReceived, and InfoLog.

Referenced by resip::InviteSession::dispatch().

{
   InfoLog(<< "InviteSessionHandler::onAckNotReceived");
   handle->end(InviteSession::AckNotReceived);
}
void InviteSessionHandler::onAckReceived ( InviteSessionHandle  ,
const SipMessage msg 
) [virtual]

called when ACK is received

Definition at line 35 of file InviteSessionHandler.cxx.

Referenced by resip::InviteSession::dispatchConnected().

{
}
virtual void resip::InviteSessionHandler::onAnswer ( InviteSessionHandle  ,
const SipMessage msg,
const SdpContents  
) [pure virtual]
void InviteSessionHandler::onAnswer ( InviteSessionHandle  h,
const SipMessage msg,
const Contents body 
) [virtual]

Definition at line 67 of file InviteSessionHandler.cxx.

References mGenericOfferAnswer, and onAnswer().

{
        if(!mGenericOfferAnswer)
   {
      const SdpContents* sdp = dynamic_cast<const SdpContents*>(&body);
      assert(sdp);
      onAnswer(h, msg, *sdp);
   }
}

Here is the call graph for this function:

virtual void resip::InviteSessionHandler::onConnected ( ClientInviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onConnected ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
void InviteSessionHandler::onConnectedConfirmed ( InviteSessionHandle  handle,
const SipMessage msg 
) [virtual]

called when ACK (with out an answer) is received for initial invite (UAS)

Definition at line 116 of file InviteSessionHandler.cxx.

Referenced by resip::ServerInviteSession::dispatchAccepted().

{
}
virtual void resip::InviteSessionHandler::onEarlyMedia ( ClientInviteSessionHandle  ,
const SipMessage ,
const SdpContents  
) [pure virtual]

called when an in-dialog provisional response is received that contains a body

Implemented in TestInviteSessionHandler, TestInviteSessionHandler, resip::TestInviteSessionHandler, Controller, resip::BasicClientUserAgent, and resip::UserAgent.

Referenced by resip::ClientInviteSession::dispatchEarly(), and onEarlyMedia().

void InviteSessionHandler::onEarlyMedia ( ClientInviteSessionHandle  h,
const SipMessage msg,
const Contents body 
) [virtual]

Definition at line 12 of file InviteSessionHandler.cxx.

References mGenericOfferAnswer, and onEarlyMedia().

{
        if(!mGenericOfferAnswer)
   {
      const SdpContents* sdp = dynamic_cast<const SdpContents*>(&body);
      assert(sdp);
      onEarlyMedia(h, msg, *sdp);
   }
}

Here is the call graph for this function:

virtual void resip::InviteSessionHandler::onFailure ( ClientInviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
void InviteSessionHandler::onFlowTerminated ( InviteSessionHandle  ) [virtual]

Called when a TCP or TLS flow to the server has terminated.

This can be caused by socket errors, or missing CRLF keep alives pong responses from the server. supports RFC5626 (outbound). Default implementation is to do nothing

Reimplemented in resip::BasicClientUserAgent.

Definition at line 121 of file InviteSessionHandler.cxx.

References InfoLog.

Referenced by resip::InviteSession::flowTerminated().

{
   InfoLog(<< "InviteSessionHandler::onFlowTerminated");
}
virtual void resip::InviteSessionHandler::onForkDestroyed ( ClientInviteSessionHandle  ) [pure virtual]

called when a fork that was created through a 1xx never receives a 2xx because another fork answered and this fork was canceled by a proxy.

Implemented in TestInviteSessionHandler, TestInviteSessionHandler, Controller, resip::TestInviteSessionHandler, resip::BasicClientUserAgent, and resip::UserAgent.

Referenced by resip::ClientInviteSession::dispatch().

void InviteSessionHandler::onIllegalNegotiation ( InviteSessionHandle  handle,
const SipMessage msg 
) [virtual]

will be called if reINVITE or UPDATE in dialog fails

Definition at line 54 of file InviteSessionHandler.cxx.

References InfoLog.

Referenced by resip::InviteSession::dispatchSentReinvite(), resip::InviteSession::dispatchSentReinviteNoOffer(), and resip::InviteSession::dispatchSentUpdate().

{
   InfoLog(<< "InviteSessionHandler::onIllegalNegotiation");
}
virtual void resip::InviteSessionHandler::onInfo ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onInfoFailure ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onInfoSuccess ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onMessage ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onMessageFailure ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onMessageSuccess ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onNewSession ( ClientInviteSessionHandle  ,
InviteSession::OfferAnswerType  oat,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onNewSession ( ServerInviteSessionHandle  ,
InviteSession::OfferAnswerType  oat,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onOffer ( InviteSessionHandle  ,
const SipMessage msg,
const SdpContents  
) [pure virtual]
void InviteSessionHandler::onOffer ( InviteSessionHandle  h,
const SipMessage msg,
const Contents body 
) [virtual]

Definition at line 78 of file InviteSessionHandler.cxx.

References mGenericOfferAnswer, and onOffer().

{
        if(!mGenericOfferAnswer)
   {
      const SdpContents* sdp = dynamic_cast<const SdpContents*>(&body);
      assert(sdp);
      onOffer(h, msg, *sdp);
   }
}

Here is the call graph for this function:

virtual void resip::InviteSessionHandler::onOfferRejected ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
void InviteSessionHandler::onOfferRequestRejected ( InviteSessionHandle  ,
const SipMessage msg 
) [virtual]

Called when an error response is received for a reinvite-nobody request (via requestOffer)

Reimplemented in resip::BasicClientUserAgent.

Definition at line 111 of file InviteSessionHandler.cxx.

Referenced by resip::InviteSession::dispatchReinviteNoOfferGlare().

{
}
virtual void resip::InviteSessionHandler::onOfferRequired ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]

called when an Invite w/out offer is sent, or any other context which requires an offer from the user

Implemented in TestUas, TestInviteSessionHandler, resip::TestInviteSessionHandler, TestInviteSessionHandler, Controller, resip::BasicClientUserAgent, and resip::UserAgent.

Referenced by resip::InviteSession::dispatchConnected().

virtual void resip::InviteSessionHandler::onProvisional ( ClientInviteSessionHandle  ,
const SipMessage  
) [pure virtual]
void InviteSessionHandler::onReadyToSend ( InviteSessionHandle  ,
SipMessage msg 
) [virtual]

called to allow app to adorn a message. default is to send immediately

Reimplemented in resip::BasicClientUserAgent.

Definition at line 105 of file InviteSessionHandler.cxx.

Referenced by resip::InviteSession::onReadyToSend().

{
   // default is to do nothing. this is for adornment   
}
virtual void resip::InviteSessionHandler::onRedirected ( ClientInviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]

called when a 3xx with valid targets is encountered in an early dialog This is different then getting a 3xx in onTerminated, as another request will be attempted, so the DialogSet will not be destroyed.

Basically an onTermintated that conveys more information. checking for 3xx respones in onTerminated will not work as there may be no valid targets.

Implemented in TestInviteSessionHandler, resip::TestInviteSessionHandler, TestInviteSessionHandler, resip::BasicClientUserAgent, Controller, and resip::UserAgent.

Referenced by resip::ClientInviteSession::handleRedirect().

virtual void resip::InviteSessionHandler::onRefer ( InviteSessionHandle  ,
ServerSubscriptionHandle  ,
const SipMessage msg 
) [pure virtual]

called when an REFER message is received.

The refer is accepted or rejected using the server subscription. If the offer is accepted, DialogUsageManager::makeInviteSessionFromRefer can be used to create an InviteSession that will send notify messages using the ServerSubscription

Implemented in TestInviteSessionHandler, resip::TestInviteSessionHandler, TestInviteSessionHandler, Controller, resip::BasicClientUserAgent, and resip::UserAgent.

Referenced by resip::Dialog::dispatch().

virtual void resip::InviteSessionHandler::onReferAccepted ( InviteSessionHandle  ,
ClientSubscriptionHandle  ,
const SipMessage msg 
) [pure virtual]

called when an REFER message receives an accepted response

Implemented in TestInviteSessionHandler, resip::TestInviteSessionHandler, TestInviteSessionHandler, Controller, resip::BasicClientUserAgent, and resip::UserAgent.

Referenced by resip::Dialog::dispatch().

virtual void resip::InviteSessionHandler::onReferNoSub ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]
virtual void resip::InviteSessionHandler::onReferRejected ( InviteSessionHandle  ,
const SipMessage msg 
) [pure virtual]

called when an REFER message receives a failure response

Implemented in TestInviteSessionHandler, resip::TestInviteSessionHandler, TestInviteSessionHandler, Controller, resip::BasicClientUserAgent, and resip::UserAgent.

Referenced by resip::Dialog::dispatch().

void InviteSessionHandler::onRemoteAnswerChanged ( InviteSessionHandle  h,
const SipMessage msg,
const Contents body 
) [virtual]

Definition at line 94 of file InviteSessionHandler.cxx.

References mGenericOfferAnswer, and onRemoteSdpChanged().

Referenced by resip::InviteSession::dispatchSentReinvite().

{
        if(!mGenericOfferAnswer)
   {
      const SdpContents* sdp = dynamic_cast<const SdpContents*>(&body);
      assert(sdp);
      onRemoteSdpChanged(h, msg, *sdp);
   }
}

Here is the call graph for this function:

void InviteSessionHandler::onRemoteSdpChanged ( InviteSessionHandle  ,
const SipMessage msg,
const SdpContents  
) [virtual]

called when a modified body is received in a 2xx response to a session-timer reINVITE.

Under normal circumstances where the response body is unchanged from current remote body no handler is called

Reimplemented in resip::BasicClientUserAgent.

Definition at line 89 of file InviteSessionHandler.cxx.

Referenced by onRemoteAnswerChanged().

{
}
void InviteSessionHandler::onSessionExpired ( InviteSessionHandle  handle) [virtual]

will be called if Session-Timers are used and Session Timer expires default behaviour is to send a BYE to send the dialog

Definition at line 60 of file InviteSessionHandler.cxx.

References InfoLog, and resip::InviteSession::SessionExpired.

Referenced by resip::InviteSession::dispatch().

{
   InfoLog(<< "InviteSessionHandler::onSessionExpired");
   handle->end(InviteSession::SessionExpired);
}
void InviteSessionHandler::onStaleCallTimeout ( ClientInviteSessionHandle  h) [virtual]

UAC gets no final response within the stale call timeout (default is 3 minutes).

This is just a notification. After the notification is called, the InviteSession will then call InviteSessionHandler::terminate()

Reimplemented in TestInviteSessionHandler, resip::TestInviteSessionHandler, TestInviteSessionHandler, resip::BasicClientUserAgent, Controller, and resip::UserAgent.

Definition at line 23 of file InviteSessionHandler.cxx.

References InfoLog.

Referenced by resip::ClientInviteSession::dispatch().

{
    InfoLog(<< "InviteSessionHandler::onStaleCallTimeout");
}
void InviteSessionHandler::onStaleReInviteTimeout ( InviteSessionHandle  h) [virtual]

UAC gets no final response within the stale re-invite timeout (default is 40 seconds).

Default behaviour is to send a BYE to end the dialog.

Definition at line 47 of file InviteSessionHandler.cxx.

References InfoLog, and resip::InviteSession::StaleReInvite.

Referenced by resip::InviteSession::dispatch().

{
   InfoLog(<< "InviteSessionHandler::onStaleReInviteTimeout");
   handle->end(InviteSession::StaleReInvite);
}
virtual void resip::InviteSessionHandler::onTerminated ( InviteSessionHandle  ,
InviteSessionHandler::TerminatedReason  reason,
const SipMessage related = 0 
) [pure virtual]

Implemented in TestUas, TestUac, TestInviteSessionHandler, TestSMIMEInviteHandler, resip::TestInviteSessionHandler, TestInviteSessionHandler, resip::BasicClientUserAgent, Controller, and resip::UserAgent.

Referenced by resip::ClientInviteSession::dispatch(), resip::InviteSession::dispatch(), resip::ServerInviteSession::dispatchAccepted(), resip::ServerInviteSession::dispatchAcceptedWaitingAnswer(), resip::ServerInviteSession::dispatchBye(), resip::InviteSession::dispatchBye(), resip::ServerInviteSession::dispatchCancel(), resip::InviteSession::dispatchCancel(), resip::ClientInviteSession::dispatchCancelled(), resip::ClientInviteSession::dispatchEarly(), resip::ClientInviteSession::dispatchEarlyWithAnswer(), resip::ClientInviteSession::dispatchEarlyWithOffer(), resip::InviteSession::dispatchPrack(), resip::ClientInviteSession::dispatchQueuedUpdate(), resip::ClientInviteSession::dispatchSentAnswer(), resip::InviteSession::dispatchSentReinvite(), resip::InviteSession::dispatchSentReinviteNoOffer(), resip::InviteSession::dispatchSentUpdate(), resip::ClientInviteSession::dispatchSentUpdateEarly(), resip::ClientInviteSession::dispatchSentUpdateEarlyGlare(), resip::InviteSession::dispatchUnhandledInvite(), resip::ServerInviteSession::dispatchUnknown(), resip::ServerInviteSession::dispatchWaitingToHangup(), resip::InviteSession::dispatchWaitingToHangup(), resip::ServerInviteSession::dispatchWaitingToOffer(), resip::ServerInviteSession::dispatchWaitingToRequestOffer(), resip::InviteSession::dispatchWaitingToTerminate(), resip::ClientInviteSession::end(), resip::ServerInviteSession::end(), resip::InviteSession::end(), resip::ServerInviteSession::redirect(), resip::ClientInviteSession::reject(), and resip::ServerInviteSession::reject().

void InviteSessionHandler::terminate ( ClientInviteSessionHandle  h) [virtual]

called when an early dialog decides it wants to terminate the dialog.

Default behavior is to CANCEL all related early dialogs as well.

Definition at line 29 of file InviteSessionHandler.cxx.

Referenced by resip::ClientInviteSession::dispatch().

{
   h->getAppDialogSet()->end();
}

Member Data Documentation


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