[reSIProcate] dum changes to Invite Sessions
Rohan, Ken and I spent about 6 hours working on the InviteSession state
machines. The goals were the following:
- get PRACK and UPDATE working
- improve the API for invite sessions
- properly define the behavior for UAC and UAS in all cases
I will be checking in some state diagrams in sip/resiprocate/doc that
summarize the findings from the design session. We will be coding a new
version of the InviteSessions as well.
Some conclusions that we made:
- offer/answer state machine should not be separate from signaling
- need to handle PRACK and UPDATE in the same state machine
- separate state machine for UAC and UAS
- one mechanism for adorning sip messages
(use InviteSessionHandler::onReadyToSend only)
- send methods go away
- provideOffer/provideAnswer will potentially result in signaling, may
also just queue a response to be sent later.
Proposed changes to api:
class ClientInviteSession
{
public:
void end();
virtual void provideOffer(const SdpContents* offer);
virtual void provideAnswer(const SdpContents* answer);
};
class ServerInviteSession
{
public:
void reject(int code);
void accept(int code=200);
void provisional(int code);
void end();
virtual void provideOffer(const SdpContents* offer);
virtual void provideAnswer(const SdpContents* answer);
};
class InviteSession
{
public:
// rejects current INVITE or reINVITE. May assert if accept
// doesn't make sense in this state.
virtual void reject(int code);
// accept the current INVITE or reINVITE. May assert if accept
// doesn't make sense in this state.
virtual void accept(int code=200);
// if 100rel is supported or depending on the state, these may
// result in signaling immediately. Otherwise, queue for when
// necessary. May assert if no offer/answer is permissible in this
// state.
virtual void provideOffer(const SdpContents* offer);
virtual void provideAnswer(const SdpContents* answer);
// request a target refresh.
void targetRefresh(const NameAddr& localUri);
void sendInfo(std::auto_ptr<Contents> body);
void sendRefer(const NameAddr& referTo);
void sendRefer(const NameAddr& referTo,InviteSessionHandle replace);
};