Evrything is done through RTCModule class,
there are 3 main public functions:
Initialize : where you gather init params like the windows handle for video, note also that the window procedure handles a custom-event fired by IRTCEventNotification, infact i didn't want to handle async notitications directly from IRTCEventNotification to the RTCModule class which embeds and rtcevents object, but rather fire an message, and then let it be routed to RTCModule via the window proc, so that evrything is serialized, ie: evrything executes in the context of the main thread that owns RTCModule object and owns the window handle.Of course I feared sync problems when yet trying to do a very compact module.
there is then PostRegisterAtBSS which triggers provisionning and of course the actual registration is defered untill an provisioning completion event is fired.
Finally there's DoCall which creates a session between two UAs.
Now to the other functions there are many, I also discontinued developments for these days, but I intend to develop upon this abstraction untill I get something worjing in a separate Dlg application, then finally insert the module into my main application where I need audio/video chat (no presence, no groups, no text chat, no app sharing, etc).
Here's the .h file where you can note how I re-organized the RTCSample code, and give me your email to send you the whole project, if the organization seems acceptable to you.
class CRTCModule
{
public:
CRTCModule(void);
CMainDlg* m_pDlg;
void PrintString(CString str);
public:
~CRTCModule(void);
private:
IRTCClient2 * m_pClient;
CRTCEvents * m_pEvents;
int login_status;//1 for unlogged, 2 for logReq_pending, 3 for logged
IRTCProfile2 * m_pProfile;
int session_status;//1 for nothing, 2 for calling, 3 for ok
IRTCSession * m_pSession;
RTC_SESSION_STATE m_enState;
public:
BOOL Initialize(HWND m_hWnd,CString& strErr);
BOOL PostRegisterAtBSS(CString strURI,CString server,CString& strErr);
BOOL DoCall(CString strURI,CString& strErr);
void OnRTCEvent(UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
/////INITIALIZE RELATED
BOOL InitRTCObject(CString& strErr);//Called by Initialize;
BOOL _SetRTCObjectAnswerModeAndAllowedPorts(CString& strErr);//Called by RegisterRTCObjectForEvents.
BOOL RegisterRTCObjectForEvents(HWND m_hWnd,CString& strErr);//Called by Initialize
BOOL SetLocalPresence(CString& strErr);//Should be called by Initialize at the end.
//////LOGON RELATED
BOOL DoProvisioning(CString user,CString server,CString& strErr);
void OnProvisioningFailed(CString strErr);
void OnProvisioningSuccess(IRTCProfileEvent2 *pEvent);
BOOL DoActualRegister(CString& strErr);
BOOL DoEnablePresence(BOOL fEnable,CString& strErr);
//
void OnRegistrationInProgress();
void OnUnRegistrationInProgress();
void OnNotRegistered();
void OnRegistered();
void OnRegistrationError();
void OnRegisteredOff();
///////SESSION RELATED
void DeliverSessionState(RTC_SESSION_STATE enState);
void DeliverParticipantState(IRTCParticipant * pParticipant, RTC_PARTICIPANT_STATE enState);
void DeliverMedia(long lMediaType, RTC_MEDIA_EVENT_TYPE enType, RTC_MEDIA_EVENT_REASON enReason);
// Update the video controls display
void ShowVideo(RTC_VIDEO_DEVICE enDevice, BOOL fShow);
//////RTCEVENT HELPERS
void OnRTCProfileEvent(IRTCProfileEvent2 *pEvent);
void OnRTCRegistrationStateChangeEvent(IRTCRegistrationStateChangeEvent *pEvent);
void OnRTCSessionStateChangeEvent(IRTCSessionStateChangeEvent *pEvent);
void OnRTCParticipantStateChangeEvent(IRTCParticipantStateChangeEvent *pEvent);
void OnRTCMediaEvent(IRTCMediaEvent *pEvent);