//
// Copyright (c) 2000  Microsoft Corporation
//

cpp_quote("/* Copyright (c) 2000-2001  Microsoft Corporation  */")

//
// RTCCore.idl : IDL source for RTCCore.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (RTCCore.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";

import "control.odl";

// Types
    
typedef enum RTC_AUDIO_DEVICE
{
    RTCAD_SPEAKER,
    RTCAD_MICROPHONE

} RTC_AUDIO_DEVICE;

typedef enum RTC_VIDEO_DEVICE
{
    RTCVD_RECEIVE,
    RTCVD_PREVIEW

} RTC_VIDEO_DEVICE;

typedef enum RTC_EVENT
{   
    RTCE_CLIENT,
    RTCE_REGISTRATION_STATE_CHANGE, 
    RTCE_SESSION_STATE_CHANGE,
    RTCE_SESSION_OPERATION_COMPLETE,
    RTCE_PARTICIPANT_STATE_CHANGE,
    RTCE_MEDIA,
    RTCE_INTENSITY,
    RTCE_MESSAGING,
    RTCE_BUDDY,
    RTCE_WATCHER,
    RTCE_PROFILE

} RTC_EVENT;

typedef enum RTC_LISTEN_MODE
{
    RTCLM_NONE,
    RTCLM_DYNAMIC,
    RTCLM_BOTH

} RTC_LISTEN_MODE;


typedef enum RTC_CLIENT_EVENT_TYPE
{
    RTCCET_VOLUME_CHANGE,
    RTCCET_DEVICE_CHANGE,
    RTCCET_NETWORK_QUALITY_CHANGE,
    RTCCET_ASYNC_CLEANUP_DONE

} RTC_CLIENT_EVENT_TYPE;

typedef enum RTC_TERMINATE_REASON
{
    RTCTR_NORMAL,
    RTCTR_DND,
    RTCTR_BUSY,
    RTCTR_REJECT,
    RTCTR_TIMEOUT,
    RTCTR_SHUTDOWN

} RTC_TERMINATE_REASON;

typedef enum RTC_REGISTRATION_STATE
{
    RTCRS_NOT_REGISTERED,
    RTCRS_REGISTERING,
    RTCRS_REGISTERED,
    RTCRS_REJECTED,
    RTCRS_UNREGISTERING,
    RTCRS_ERROR,
    RTCRS_LOGGED_OFF,
    RTCRS_LOCAL_PA_LOGGED_OFF,
    RTCRS_REMOTE_PA_LOGGED_OFF

} RTC_REGISTRATION_STATE;


typedef enum RTC_SESSION_STATE
{
    RTCSS_IDLE,
    RTCSS_INCOMING,
    RTCSS_ANSWERING,
    RTCSS_INPROGRESS,
    RTCSS_CONNECTED,
    RTCSS_DISCONNECTED

} RTC_SESSION_STATE;

typedef enum RTC_PARTICIPANT_STATE
{
    RTCPS_IDLE,
    RTCPS_PENDING,
    RTCPS_INCOMING,
    RTCPS_ANSWERING,
    RTCPS_INPROGRESS,
    RTCPS_ALERTING,
    RTCPS_CONNECTED,
    RTCPS_DISCONNECTING,
    RTCPS_DISCONNECTED

} RTC_PARTICIPANT_STATE;

typedef enum RTC_WATCHER_STATE
{
    RTCWS_UNKNOWN,
    RTCWS_OFFERING,
    RTCWS_ALLOWED,
    RTCWS_BLOCKED

} RTC_WATCHER_STATE;

typedef enum RTC_OFFER_WATCHER_MODE
{
    RTCOWM_OFFER_WATCHER_EVENT,
    RTCOWM_AUTOMATICALLY_ADD_WATCHER

} RTC_OFFER_WATCHER_MODE;

typedef enum RTC_PRIVACY_MODE
{
    RTCPM_BLOCK_LIST_EXCLUDED,
    RTCPM_ALLOW_LIST_ONLY

} RTC_PRIVACY_MODE;

typedef enum RTC_SESSION_TYPE
{
    RTCST_PC_TO_PC,
    RTCST_PC_TO_PHONE,
    RTCST_PHONE_TO_PHONE,
    RTCST_IM
    
} RTC_SESSION_TYPE;

typedef enum RTC_PRESENCE_STATUS
{
    RTCXS_PRESENCE_OFFLINE,
    RTCXS_PRESENCE_ONLINE,
    RTCXS_PRESENCE_AWAY,
    RTCXS_PRESENCE_IDLE,
    RTCXS_PRESENCE_BUSY,
    RTCXS_PRESENCE_BE_RIGHT_BACK,
    RTCXS_PRESENCE_ON_THE_PHONE,
    RTCXS_PRESENCE_OUT_TO_LUNCH

} RTC_PRESENCE_STATUS;

typedef enum RTC_MEDIA_EVENT_TYPE
{
    RTCMET_STOPPED,
    RTCMET_STARTED,
    RTCMET_FAILED

} RTC_MEDIA_EVENT_TYPE;

typedef enum RTC_MEDIA_EVENT_REASON
{
    RTCMER_NORMAL,
    RTCMER_HOLD,
    RTCMER_TIMEOUT,
    RTCMER_BAD_DEVICE

} RTC_MEDIA_EVENT_REASON;

typedef enum RTC_MESSAGING_EVENT_TYPE
{
    RTCMSET_MESSAGE,
    RTCMSET_STATUS,

} RTC_MESSAGING_EVENT_TYPE;

typedef enum RTC_MESSAGING_USER_STATUS
{
    RTCMUS_IDLE,
    RTCMUS_TYPING

} RTC_MESSAGING_USER_STATUS;


typedef enum RTC_DTMF
{
    RTC_DTMF_0,
    RTC_DTMF_1,
    RTC_DTMF_2,
    RTC_DTMF_3,
    RTC_DTMF_4,
    RTC_DTMF_5,
    RTC_DTMF_6,
    RTC_DTMF_7,
    RTC_DTMF_8,
    RTC_DTMF_9,
    RTC_DTMF_STAR,
    RTC_DTMF_POUND,
    RTC_DTMF_A,
    RTC_DTMF_B,
    RTC_DTMF_C,
    RTC_DTMF_D,
    RTC_DTMF_FLASH

} RTC_DTMF;

typedef enum RTC_PROVIDER_URI
{
    RTCPU_URIHOMEPAGE,
    RTCPU_URIHELPDESK,
    RTCPU_URIPERSONALACCOUNT,
    RTCPU_URIDISPLAYDURINGCALL,
    RTCPU_URIDISPLAYDURINGIDLE

} RTC_PROVIDER_URI;

typedef enum RTC_RING_TYPE
{
    RTCRT_PHONE,
    RTCRT_MESSAGE,
    RTCRT_RINGBACK

} RTC_RING_TYPE;

typedef enum RTC_T120_APPLET
{
    RTCTA_WHITEBOARD,
    RTCTA_APPSHARING

} RTC_T120_APPLET; 

typedef enum RTC_PORT_TYPE
{
    RTCPT_AUDIO_RTP,
    RTCPT_AUDIO_RTCP

} RTC_PORT_TYPE; 

cpp_quote("#define RTCCS_FORCE_PROFILE          0x00000001")
cpp_quote("#define RTCCS_FAIL_ON_REDIRECT       0x00000002")

// Media Types
cpp_quote("#define RTCMT_AUDIO_SEND     0x00000001")
cpp_quote("#define RTCMT_AUDIO_RECEIVE  0x00000002")
cpp_quote("#define RTCMT_VIDEO_SEND     0x00000004")
cpp_quote("#define RTCMT_VIDEO_RECEIVE  0x00000008")
cpp_quote("#define RTCMT_T120_SENDRECV  0x00000010")

cpp_quote("#define RTCMT_ALL_RTP   (       \\")
cpp_quote("         RTCMT_AUDIO_SEND    |  \\")
cpp_quote("         RTCMT_AUDIO_RECEIVE  | \\")
cpp_quote("         RTCMT_VIDEO_SEND  |    \\")
cpp_quote("         RTCMT_VIDEO_RECEIVE )    ")

cpp_quote("#define RTCMT_ALL       (       \\")
cpp_quote("         RTCMT_ALL_RTP    |     \\")
cpp_quote("         RTCMT_T120_SENDRECV  )   ")

// Session Info
cpp_quote("#define RTCSI_PC_TO_PC       0x00000001")
cpp_quote("#define RTCSI_PC_TO_PHONE    0x00000002")
cpp_quote("#define RTCSI_PHONE_TO_PHONE 0x00000004")
cpp_quote("#define RTCSI_IM             0x00000008")

// Transports
cpp_quote("#define RTCTR_UDP            0x00000001")
cpp_quote("#define RTCTR_TCP            0x00000002")
cpp_quote("#define RTCTR_TLS            0x00000004")

// Registration Flags
cpp_quote("#define RTCRF_REGISTER_INVITE_SESSIONS   0x00000001")
cpp_quote("#define RTCRF_REGISTER_MESSAGE_SESSIONS  0x00000002")
cpp_quote("#define RTCRF_REGISTER_PRESENCE          0x00000004")
cpp_quote("#define RTCRF_REGISTER_ALL               0x00000007")

// Event Filters
cpp_quote("#define RTCEF_CLIENT                     0x00000001")
cpp_quote("#define RTCEF_REGISTRATION_STATE_CHANGE  0x00000002")
cpp_quote("#define RTCEF_SESSION_STATE_CHANGE       0x00000004")
cpp_quote("#define RTCEF_SESSION_OPERATION_COMPLETE 0x00000008")
cpp_quote("#define RTCEF_PARTICIPANT_STATE_CHANGE   0x00000010")
cpp_quote("#define RTCEF_MEDIA                      0x00000020")
cpp_quote("#define RTCEF_INTENSITY                  0x00000040")
cpp_quote("#define RTCEF_MESSAGING                  0x00000080")
cpp_quote("#define RTCEF_BUDDY                      0x00000100")
cpp_quote("#define RTCEF_WATCHER                    0x00000200")
cpp_quote("#define RTCEF_PROFILE                    0x00000400")
cpp_quote("#define RTCEF_ALL                        0x000007FF")

// Forward Definitions
interface IRTCClient;
interface IRTCClientPresence;
interface IRTCClientProvisioning;
interface IRTCProfile;
interface IRTCSession;
interface IRTCParticipant;
interface IRTCEventNotification;
interface IRTCEnumProfiles;
interface IRTCEnumParticipants;
interface IRTCCollection;
interface IRTCEnumBuddies;
interface IRTCBuddy;
interface IRTCEnumWatchers;
interface IRTCWatcher;


[
    object,
    uuid(07829e45-9a34-408e-a011-bddf13487cd1),
    helpstring("IRTCClient Interface"),
    pointer_default(unique)
]
interface IRTCClient : IUnknown
{
// initialize, shutdown
    
    [helpstring("method Initialize")]
    HRESULT Initialize();

    [helpstring("method Shutdown")]
    HRESULT Shutdown();

    [helpstring("method PrepareForShutdown")]
    HRESULT PrepareForShutdown();

// events

    [propput, helpstring("property EventFilter")]
    HRESULT EventFilter(
            [in] long lFilter
            );

    [propget, helpstring("property EventFilter")]
    HRESULT EventFilter(
            [out, retval] long * plFilter
            );

// media preferences/capabilities

    [helpstring("method SetPreferredMediaTypes")]
    HRESULT SetPreferredMediaTypes(
            [in] long lMediaTypes,
            [in] VARIANT_BOOL fPersistent
            );

    [propget, helpstring("property PreferredMediaTypes")]
    HRESULT PreferredMediaTypes(
            [out, retval] long * plMediaTypes
            );              
    
    [propget, helpstring("property MediaCapabilities")]
    HRESULT MediaCapabilities(
            [out, retval] long * plMediaTypes
            );                                              

// sessions 
        
    [helpstring("method CreateSession")]
    HRESULT CreateSession(
            [in] RTC_SESSION_TYPE enType,
            [in] BSTR bstrLocalPhoneURI,
            [in] IRTCProfile * pProfile,
            [in] long     lFlags,
            [out, retval] IRTCSession ** ppSession
            );

// listen mode

    [propput, helpstring("property ListenForIncomingSessions")]
    HRESULT ListenForIncomingSessions(
            [in] RTC_LISTEN_MODE enListen
            );

    [propget, helpstring("property ListenForIncomingSessions")]
    HRESULT ListenForIncomingSessions(
            [out, retval] RTC_LISTEN_MODE * penListen
            );  

// addresses & ports
    [propget, helpstring("property NetworkAddresses")]
    HRESULT NetworkAddresses(
            [in]  VARIANT_BOOL    fTCP,
            [in]  VARIANT_BOOL    fExternal,
            [out, retval] VARIANT * pvAddresses
            );
           
// audio control

    [propput, helpstring("property Volume")]
    HRESULT Volume(
            [in] RTC_AUDIO_DEVICE enDevice,
            [in] long lVolume
            );  

    [propget, helpstring("property Volume")]
    HRESULT Volume(
            [in] RTC_AUDIO_DEVICE enDevice,
            [out, retval] long * plVolume
            );   

    [propput, helpstring("property AudioMuted")]
    HRESULT AudioMuted(
            [in] RTC_AUDIO_DEVICE enDevice,
            [in] VARIANT_BOOL fMuted
            );

    [propget, helpstring("property AudioMuted")]
    HRESULT AudioMuted(
            [in] RTC_AUDIO_DEVICE enDevice,
            [out, retval] VARIANT_BOOL * pfMuted
            ); 

// video window
    
    [propget, helpstring("property IVideoWindow")]
    HRESULT IVideoWindow(
            [in] RTC_VIDEO_DEVICE enDevice,
            [out, retval] IVideoWindow ** ppIVideoWindow
            );  

// audio/video settings

    [propput, helpstring("property PreferredAudioDevice")]
    HRESULT PreferredAudioDevice(
            [in] RTC_AUDIO_DEVICE enDevice,
            [in] BSTR bstrDeviceName
            );  

    [propget, helpstring("property PreferredAudioDevice")]
    HRESULT PreferredAudioDevice(
            [in] RTC_AUDIO_DEVICE enDevice,
            [out, retval] BSTR * pbstrDeviceName
            );
             
    [propput, helpstring("property PreferredVolume")]
    HRESULT PreferredVolume(
            [in] RTC_AUDIO_DEVICE enDevice,
            [in] long lVolume
            );  

    [propget, helpstring("property PreferredVolume")]
    HRESULT PreferredVolume(
            [in] RTC_AUDIO_DEVICE enDevice,
            [out, retval] long * plVolume
            );   

    [propput, helpstring("property PreferredAEC")]
    HRESULT PreferredAEC(
            [in] VARIANT_BOOL bEnable
            );  

    [propget, helpstring("property PreferredAEC")]
    HRESULT PreferredAEC(
            [out, retval] VARIANT_BOOL * pbEnabled
            );
            
    [propput, helpstring("property PreferredVideoDevice")]
    HRESULT PreferredVideoDevice(
            [in] BSTR bstrDeviceName
            );  

    [propget, helpstring("property PreferredVideoDevice")]
    HRESULT PreferredVideoDevice(
            [out, retval] BSTR * pbstrDeviceName
            );


// active media
    
    [propget, helpstring("property ActiveMedia")]
    HRESULT ActiveMedia(
            [out, retval] long * plMediaType
            );


// Network quality
    
    [propput, helpstring("property MaxBitrate")]
    HRESULT MaxBitrate(
            [in] long lMaxBitrate
            );  

    [propget, helpstring("property MaxBitrate")]
    HRESULT MaxBitrate(
            [out, retval] long * plMaxBitrate
            );   

    [propput, helpstring("property TemporalSpatialTradeOff")]
    HRESULT TemporalSpatialTradeOff(
            [in] long lValue
            );  

    [propget, helpstring("property TemporalSpatialTradeOff")]
    HRESULT TemporalSpatialTradeOff(
            [out, retval] long * plValue
            );   

    [propget, helpstring("property NetworkQuality")]
    HRESULT NetworkQuality(
            [out, retval] long * plNetworkQuality
            );


// T120 applet control

    [helpstring("method StartT120Applet")]
    HRESULT StartT120Applet(
            [in] RTC_T120_APPLET   enApplet
            );

    [helpstring("method StopT120Applets")]
    HRESULT StopT120Applets();

    [propget, helpstring("property IsT120AppletRunning")]
    HRESULT IsT120AppletRunning(
            [in] RTC_T120_APPLET   enApplet,
            [out, retval] VARIANT_BOOL * pfRunning
            );


// local user info

    [propget, helpstring("property LocalUserURI")]
    HRESULT LocalUserURI(
            [out, retval] BSTR * pbstrUserURI
            );   

    [propput, helpstring("property LocalUserURI")]
    HRESULT LocalUserURI(
            [in] BSTR  bstrUserURI
            );   

    [propget, helpstring("property LocalUserName")]
    HRESULT LocalUserName(
            [out, retval] BSTR * pbstrUserName
            ); 

    [propput, helpstring("property LocalUserName")]
    HRESULT LocalUserName(
            [in] BSTR  bstrUserName
            ); 

// other    
    
    [helpstring("method PlayRing")]
    HRESULT PlayRing(
            [in] RTC_RING_TYPE enType,
            [in] VARIANT_BOOL bPlay
            );     
    
    [helpstring("method SendDTMF")]
    HRESULT SendDTMF(
            [in] RTC_DTMF enDTMF
            );  

    [helpstring("method InvokeTuningWizard")]
    HRESULT InvokeTuningWizard(
            [in] OAHWND hwndParent
            );

    [propget, helpstring("property IsTuned")]
    HRESULT IsTuned(
            [out, retval] VARIANT_BOOL * pfTuned
            );
}                           


[
    object,
    uuid(11c3cbcc-0744-42d1-968a-51aa1bb274c6),
    helpstring("IRTCClientPresence Interface"),
    pointer_default(unique)
]
interface IRTCClientPresence : IUnknown
{

// enable

    [helpstring("method EnablePresence")]
    HRESULT EnablePresence(
            [in] VARIANT_BOOL  fUseStorage,
            [in] VARIANT       varStorage
            );

// snapshots & import/export    
    
    [helpstring("method Export")]
    HRESULT Export(
            [in] VARIANT       varStorage
            );
    
    [helpstring("method Import")]
    HRESULT Import(
            [in] VARIANT       varStorage,
            [in] VARIANT_BOOL  fReplaceAll
            );

// buddies

    [hidden, helpstring("method EnumerateBuddies")]
    HRESULT EnumerateBuddies(   
            [out, retval] IRTCEnumBuddies ** ppEnum
            );

    [propget, helpstring("property Buddies")]
    HRESULT Buddies(   
            [out, retval] IRTCCollection ** ppCollection
            );

    [propget, helpstring("property Buddy")]
    HRESULT Buddy(
            [in] BSTR   bstrPresentityURI,
            [out, retval] IRTCBuddy   **ppBuddy
            );

    [helpstring("method AddBuddy")]
    HRESULT AddBuddy(   
            [in] BSTR   bstrPresentityURI,
            [in] BSTR   bstrUserName,
            [in] BSTR   bstrData,
            [in] VARIANT_BOOL   fPersistent,
            [in] IRTCProfile * pProfile,
            [in] long lFlags,
            [out, retval] IRTCBuddy **ppBuddy
            );
    
    [helpstring("method RemoveBuddy")]
    HRESULT RemoveBuddy(   
            [in] IRTCBuddy    *pBuddy
            );

// watchers
    [hidden, helpstring("method EnumerateWatchers")]
    HRESULT EnumerateWatchers(   
            [out, retval] IRTCEnumWatchers ** ppEnum
            );

    [propget, helpstring("property Watchers")]
    HRESULT Watchers(   
            [out, retval] IRTCCollection ** ppCollection
            );

    [propget, helpstring("property Watcher")]
    HRESULT Watcher(
            [in] BSTR   bstrPresentityURI,
            [out, retval] IRTCWatcher   **ppWatcher
            );

    [helpstring("method AddWatcher")]
    HRESULT AddWatcher(   
            [in] BSTR   bstrPresentityURI,
            [in] BSTR   bstrUserName,
            [in] BSTR   bstrData,
            [in] VARIANT_BOOL  fBlocked,
            [in] VARIANT_BOOL  fPersistent,
            [out, retval] IRTCWatcher **ppWatcher
            );
    
    [helpstring("method RemoveWatcher")]
    HRESULT RemoveWatcher(   
            [in] IRTCWatcher    *pWatcher
            );
    
    [helpstring("method SetLocalPresenceInfo")]
    HRESULT SetLocalPresenceInfo(   
            [in] RTC_PRESENCE_STATUS enStatus,
            [in] BSTR bstrNotes
            );

// policies
    [propget, helpstring("property OfferWatcherMode")]
    HRESULT OfferWatcherMode(   
            [out, retval] RTC_OFFER_WATCHER_MODE * penMode
            );

    [propput, helpstring("property OfferWatcherMode")]
    HRESULT OfferWatcherMode(
            [in] RTC_OFFER_WATCHER_MODE   enMode
            );

    [propget, helpstring("property PrivacyMode")]
    HRESULT PrivacyMode(   
            [out, retval] RTC_PRIVACY_MODE * penMode
            );

    [propput, helpstring("property PrivacyMode")]
    HRESULT PrivacyMode(
            [in] RTC_PRIVACY_MODE   enMode
            );
}  

[
    object,
    uuid(B9F5CF06-65B9-4a80-A0E6-73CAE3EF3822),
    helpstring("IRTCClientProvisioning Interface"),
    pointer_default(unique)
]
interface IRTCClientProvisioning : IUnknown
{
    [helpstring("method CreateProfile")]
    HRESULT CreateProfile(
            [in] BSTR bstrProfileXML,           
            [out, retval] IRTCProfile ** ppProfile
            );

    [helpstring("method EnableProfile")]
    HRESULT EnableProfile(         
            [in] IRTCProfile * pProfile,
            [in] long lRegisterFlags
            );

    [helpstring("method DisableProfile")]
    HRESULT DisableProfile(         
            [in] IRTCProfile * pProfile
            );

    [hidden, helpstring("method EnumerateProfiles")]
    HRESULT EnumerateProfiles(   
            [out, retval] IRTCEnumProfiles ** ppEnum
            );            

    [propget, helpstring("property Profiles")]
    HRESULT Profiles(   
            [out, retval] IRTCCollection ** ppCollection
            );

    [helpstring("method GetProfile")]
    HRESULT GetProfile(            
            [in] BSTR bstrUserAccount,
            [in] BSTR bstrUserPassword,
            [in] BSTR bstrUserURI,
            [in] BSTR bstrServer,
            [in] long lTransport,
            [in] long lCookie
            );

    [propget, helpstring("property SessionCapabilities")]
    HRESULT SessionCapabilities(
            [out, retval] long * plSupportedSessions);
};                                

[
    object,
    uuid(d07eca9e-4062-4dd4-9e7d-722a49ba7303),
    helpstring("IRTCProfile Interface"),
    pointer_default(unique)
]
interface IRTCProfile : IUnknown
{
    [propget, helpstring("property Key")]
    HRESULT Key(
            [out, retval] BSTR * pbstrKey);

    [propget, helpstring("property Name")]
    HRESULT Name(
            [out, retval] BSTR * pbstrName);

    [propget, helpstring("property XML")]
    HRESULT XML(
            [out, retval] BSTR * pbstrXML);

    // Provider

    [propget, helpstring("property ProviderName")]
    HRESULT ProviderName(
            [out, retval] BSTR * pbstrName); 

    [propget, helpstring("property ProviderURI")]
    HRESULT ProviderURI(
            [in] RTC_PROVIDER_URI enURI,
            [out, retval] BSTR * pbstrURI); 

    [propget, helpstring("property ProviderData")]
    HRESULT ProviderData(
            [out, retval] BSTR * pbstrData);

    // Client

    [propget, helpstring("property ClientName")]
    HRESULT ClientName(
            [out, retval] BSTR * pbstrName); 

    [propget, helpstring("property ClientBanner")]
    HRESULT ClientBanner(
            [out, retval] VARIANT_BOOL * pfBanner); 

    [propget, helpstring("property ClientMinVer")]
    HRESULT ClientMinVer(
            [out, retval] BSTR * pbstrMinVer); 

    [propget, helpstring("property ClientCurVer")]
    HRESULT ClientCurVer(
            [out, retval] BSTR * pbstrCurVer); 

    [propget, helpstring("property ClientUpdateURI")]
    HRESULT ClientUpdateURI(
            [out, retval] BSTR * pbstrUpdateURI); 

    [propget, helpstring("property ClientData")]
    HRESULT ClientData(
            [out, retval] BSTR * pbstrData); 

    // User

    [propget, helpstring("property UserURI")]
    HRESULT UserURI(
            [out, retval] BSTR * pbstrUserURI);

    [propget, helpstring("property UserName")]
    HRESULT UserName(
            [out, retval] BSTR * pbstrUserName);
    
    [propget, helpstring("property UserAccount")]
    HRESULT UserAccount(
            [out, retval] BSTR * pbstrUserAccount);

    [helpstring("method SetCredentials")]
    HRESULT SetCredentials(
            [in]    BSTR    bstrUserURI,
            [in]    BSTR    bstrUserAccount,
            [in]    BSTR    bstrPassword);

    // Server
        
    [propget, helpstring("property SessionCapabilities")]
    HRESULT SessionCapabilities(
            [out, retval] long * plSupportedSessions);

    // Registration

    [propget, helpstring("property State")]
    HRESULT State(
            [out, retval] RTC_REGISTRATION_STATE * penState);

};

[
    object,
    uuid(387c8086-99be-42fb-9973-7c0fc0ca9fa8),
    helpstring("IRTCSession Interface"),
    pointer_default(unique)
]
interface IRTCSession : IUnknown
{
    // properties

    [propget, helpstring("property Client")]
    HRESULT Client(
            [out, retval] IRTCClient **ppClient
            );

    [propget, helpstring("property State")]
    HRESULT State(
            [out, retval] RTC_SESSION_STATE * penState
            );                
    
    [propget, helpstring("property Type")]
    HRESULT Type(
            [out, retval] RTC_SESSION_TYPE * penType
            );
    
    [propget, helpstring("property Profile")]
    HRESULT Profile(
            [out, retval] IRTCProfile ** ppProfile
            );
    
    [propget, helpstring("property Participants")]
    HRESULT Participants(
            [out, retval] IRTCCollection ** ppCollection
            );
    
    // call control

    [helpstring("method Answer")]
    HRESULT Answer(); 

    [helpstring("method Terminate")]
    HRESULT Terminate(
            [in] RTC_TERMINATE_REASON enReason
            );  

    [helpstring("method Redirect")]
    HRESULT Redirect(
            [in] RTC_SESSION_TYPE enType,
            [in] BSTR bstrLocalPhoneURI,
            [in] IRTCProfile * pProfile,
            [in] long     lFlags
            );  

    [helpstring("method AddParticipant")]
    HRESULT AddParticipant(
            [in] BSTR bstrAddress,
            [in] BSTR bstrName,
            [out, retval] IRTCParticipant ** ppParticipant
            );

    [helpstring("method RemoveParticipant")]
    HRESULT RemoveParticipant(
            [in] IRTCParticipant * pParticipant
            );              

    [hidden, helpstring("method EnumerateParticipants")]
    HRESULT EnumerateParticipants(
            [out, retval] IRTCEnumParticipants ** ppEnum
            );
             
    [propget, helpstring("property CanAddParticipants")]
    HRESULT CanAddParticipants(
            [out, retval] VARIANT_BOOL * pfCanAdd
            );   

    // redirection context control
    [propget, helpstring("property RedirectedUserURI")]
    HRESULT RedirectedUserURI(
            [out, retval] BSTR * pbstrUserURI
            );

    [propget, helpstring("property RedirectedUserName")]
    HRESULT RedirectedUserName(
            [out, retval] BSTR * pbstrUserName
            );
               
    [helpstring("method NextRedirectedUser")]
    HRESULT NextRedirectedUser();

    // instant messaging

    [helpstring("method SendMessage")]
    HRESULT SendMessage(
            [in] BSTR bstrMessageHeader,
            [in] BSTR bstrMessage,
            [in] long lCookie
            );
          
    [helpstring("method SendMessageStatus")]
    HRESULT SendMessageStatus(
            [in] RTC_MESSAGING_USER_STATUS enUserStatus,
            [in] long lCookie
            );

// stream & custom media control            
    [helpstring("method AddStream")]
    HRESULT AddStream(
            [in] long lMediaType,
            [in] long lCookie
            );     
    
    [helpstring("method RemoveStream")]
    HRESULT RemoveStream(
            [in] long lMediaType,
            [in] long lCookie
            ); 

// keys
    [propput, helpstring("property EncryptionKey")]
    HRESULT EncryptionKey(
            [in] long lMediaType,
            [in] BSTR EncryptionKey
            );

};

[
    object,
    uuid(ae86add5-26b1-4414-af1d-b94cd938d739),
    helpstring("IRTCParticipant Interface"),
    pointer_default(unique)
]
interface IRTCParticipant : IUnknown
{
    [propget, helpstring("property UserURI")]
    HRESULT UserURI(
            [out, retval] BSTR * pbstrUserURI
            );   

    [propget, helpstring("property Name")]
    HRESULT Name(
            [out, retval] BSTR * pbstrName
            );  

    [propget, helpstring("property Removable")]
    HRESULT Removable(
            [out, retval] VARIANT_BOOL * pfRemovable
            );

    [propget, helpstring("property State")]
    HRESULT State(
            [out, retval] RTC_PARTICIPANT_STATE * penState
            );   
            
    [propget, helpstring("property Session")]
    HRESULT Session(
            [out, retval] IRTCSession ** ppSession
            );             
};

[
    object,
    uuid(D6D5AB3B-770E-43e8-800A-79B062395FCA),
    dual,
    helpstring("IRTCProfileEvent"),
    pointer_default(unique)
]
interface IRTCProfileEvent : IDispatch
{
    [propget, id(1), helpstring("property Profile")]
    HRESULT Profile( [out, retval] IRTCProfile ** ppProfile );

    [propget, id(2), helpstring("property Cookie")]
    HRESULT Cookie( [out, retval] long * plCookie );
    
    [propget, id(3), helpstring("property StatusCode")]
    HRESULT StatusCode( [out, retval] long * plStatusCode );
}

[
    object,
    uuid(2b493b7a-3cba-4170-9c8b-76a9dacdd644),
    dual,
    helpstring("IRTCClientEvent"),
    pointer_default(unique)
]
interface IRTCClientEvent : IDispatch
{
    [propget, id(1), helpstring("property EventType")]
    HRESULT EventType( [out, retval] RTC_CLIENT_EVENT_TYPE * penEventType );
    
    [propget, id(2), helpstring("property Client")]
    HRESULT Client( [out, retval] IRTCClient **ppClient );
}

[
    object,
    uuid(62d0991b-50ab-4f02-b948-ca94f26f8f95),
    dual,
    helpstring("IRTCRegistrationStateChangeEvent"),
    pointer_default(unique)
]
interface IRTCRegistrationStateChangeEvent : IDispatch
{
    [propget, id(1), helpstring("property Profile")]
    HRESULT Profile( [out, retval] IRTCProfile ** ppProfile );
    
    [propget, id(2), helpstring("property State")]
    HRESULT State( [out, retval] RTC_REGISTRATION_STATE * penState );

    [propget, id(3), helpstring("property StatusCode")]
    HRESULT StatusCode( [out, retval] long * plStatusCode );

    [propget, id(4), helpstring("property StatusText")]
    HRESULT StatusText( [out, retval] BSTR * pbstrStatusText );
}


[
    object,
    uuid(b5bad703-5952-48b3-9321-7f4500521506),
    dual,
    helpstring("IRTCSessionStateChangeEvent"),
    pointer_default(unique)
]
interface IRTCSessionStateChangeEvent : IDispatch
{
    [propget, id(1), helpstring("property Session")]
    HRESULT Session( [out, retval] IRTCSession ** ppSession );
    
    [propget, id(2), helpstring("property State")]
    HRESULT State( [out, retval] RTC_SESSION_STATE * penState );

    [propget, id(3), helpstring("property StatusCode")]
    HRESULT StatusCode( [out, retval] long * plStatusCode );

    [propget, id(4), helpstring("property StatusText")]
    HRESULT StatusText( [out, retval] BSTR * pbstrStatusText );
}
[
    object,
    uuid(a6bff4c0-f7c8-4d3c-9a41-3550f78a95b0),
    dual,
    helpstring("IRTCSessionOperationCompleteEvent"),
    pointer_default(unique)
]

interface IRTCSessionOperationCompleteEvent : IDispatch
{
    [propget, id(1), helpstring("property Session")]
    HRESULT Session( [out, retval] IRTCSession ** ppSession );
    
    [propget, id(2), helpstring("property Cookie")]
    HRESULT Cookie( [out, retval] long * plCookie );

    [propget, id(3), helpstring("property StatusCode")]
    HRESULT StatusCode( [out, retval] long * plStatusCode );

    [propget, id(4), helpstring("property StatusText")]
    HRESULT StatusText( [out, retval] BSTR * pbstrStatusText );
}

[
    object,
    uuid(09bcb597-f0fa-48f9-b420-468cea7fde04),
    dual,
    helpstring("IRTCParticipantStateChangeEvent"),
    pointer_default(unique)
]
interface IRTCParticipantStateChangeEvent : IDispatch
{
    [propget, id(1), helpstring("property Participant")]
    HRESULT Participant( [out, retval] IRTCParticipant ** ppParticipant );
    
    [propget, id(2), helpstring("property State")]
    HRESULT State( [out, retval] RTC_PARTICIPANT_STATE * penState );

    [propget, id(3), helpstring("property StatusCode")]
    HRESULT StatusCode( [out, retval] long * plStatusCode );
}

[
    object,
    uuid(099944fb-bcda-453e-8c41-e13da2adf7f3),
    dual,
    helpstring("IRTCMediaEvent"),
    pointer_default(unique)
]
interface IRTCMediaEvent : IDispatch
{
    [propget, id(1), helpstring("property MediaType")]
    HRESULT MediaType( [out, retval] long * pMediaType );
    
    [propget, id(2), helpstring("property EventType")]
    HRESULT EventType( [out, retval] RTC_MEDIA_EVENT_TYPE * penEventType );

    [propget, id(3), helpstring("property EventReason")]
    HRESULT EventReason( [out, retval] RTC_MEDIA_EVENT_REASON * penEventReason );
}


[
    object,
    uuid(4c23bf51-390c-4992-a41d-41eec05b2a4b),
    dual,
    helpstring("IRTCIntensityEvent"),
    pointer_default(unique)
]
interface IRTCIntensityEvent : IDispatch
{
    [propget, id(1), helpstring("property Level")]
    HRESULT Level( [out, retval] long * plLevel );
    
    [propget, id(2), helpstring("property Min")]
    HRESULT Min( [out, retval] long * plMin );

    [propget, id(3), helpstring("property Max")]
    HRESULT Max( [out, retval] long * plMax );

    [propget, id(4), helpstring("property Direction")]
    HRESULT Direction( [out, retval] RTC_AUDIO_DEVICE * penDirection );
}

[
    object,
    uuid(d3609541-1b29-4de5-a4ad-5aebaf319512),
    dual,
    helpstring("IRTCMessagingEvent"),
    pointer_default(unique)
]
interface IRTCMessagingEvent : IDispatch
{
    [propget, id(1), helpstring("property Session")]
    HRESULT Session( [out, retval] IRTCSession ** ppSession );

    [propget, id(2), helpstring("property Participant")]
    HRESULT Participant( [out, retval] IRTCParticipant ** ppParticipant );
    
    [propget, id(3), helpstring("property Type")]
    HRESULT EventType( [out, retval] RTC_MESSAGING_EVENT_TYPE * penEventType );
    
    [propget, id(4), helpstring("property Message")]
    HRESULT Message( [out, retval] BSTR * pbstrMessage );

    [propget, id(5), helpstring("property MessageHeader")]
    HRESULT MessageHeader( [out, retval] BSTR * pbstrMessageHeader );
    
    [propget, id(6), helpstring("property UserStatus")]
    HRESULT UserStatus( [out, retval] RTC_MESSAGING_USER_STATUS * penUserStatus );
}

[
    object,
    uuid(f36d755d-17e6-404e-954f-0fc07574c78d),
    dual,
    helpstring("IRTCBuddyEvent"),
    pointer_default(unique)
]
interface IRTCBuddyEvent : IDispatch
{
    [propget, id(1), helpstring("property Buddy")]
    HRESULT Buddy( [out, retval] IRTCBuddy ** ppBuddy );
}


[
    object,
    uuid(f30d7261-587a-424f-822c-312788f43548),
    dual,
    helpstring("IRTCWatcherEvent"),
    pointer_default(unique)
]
interface IRTCWatcherEvent : IDispatch
{
    [propget, id(1), helpstring("property Watcher")]
    HRESULT Watcher( [out, retval] IRTCWatcher ** ppWatcher );
}

[
    object,
    uuid(EC7C8096-B918-4044-94F1-E4FBA0361D5C),
    helpstring("IRTCCollection interface"),
    dual
]
interface IRTCCollection : IDispatch
{
    [propget, helpstring("Returns number of items in collection.")]
    HRESULT Count(
            [out, retval] long * lCount
            );

    [propget, id(DISPID_VALUE),
        helpstring("Given an index, returns an item in the collection.")]
    HRESULT Item(
            [in] long Index,
            [out, retval] VARIANT * pVariant
            );

    [propget, restricted, id(DISPID_NEWENUM),
        helpstring("returns an enumerator for the collection.")]
        HRESULT _NewEnum(
            [out, retval] IUnknown ** ppNewEnum
            );
}




[
    object,
    uuid(fcd56f29-4a4f-41b2-ba5c-f5bccc060bf6),
    hidden,
    helpstring("IRTCEnumParticipants interface"),
    pointer_default(unique)
]   
interface IRTCEnumParticipants : IUnknown
{
    HRESULT Next(
            [in] ULONG celt,
            [out, size_is(celt)] IRTCParticipant ** ppElements,
            [in,out,ptr] ULONG * pceltFetched
            );

    HRESULT Reset( void );

    HRESULT Skip (
            [in] ULONG celt
            );

    HRESULT Clone (
            [out, retval] IRTCEnumParticipants ** ppEnum
            );
}

[
    object,
    uuid(29b7c41c-ed82-4bca-84ad-39d5101b58e3),
    hidden,
    helpstring("IRTCEnumProfiles interface"),
    pointer_default(unique)
]  
interface IRTCEnumProfiles : IUnknown
{
    HRESULT Next(
            [in] ULONG celt,
            [out, size_is(celt)] IRTCProfile ** ppElements,
            [in,out,ptr] ULONG * pceltFetched
            );

    HRESULT Reset( void );

    HRESULT Skip (
            [in] ULONG celt
            );

    HRESULT Clone (
            [out, retval] IRTCEnumProfiles ** ppEnum
            );
}



[
    object,
    uuid(f7296917-5569-4b3b-b3af-98d1144b2b87),
    hidden,
    helpstring("IRTCEnumBuddies interface"),
    pointer_default(unique)
]   
interface IRTCEnumBuddies : IUnknown
{
    HRESULT Next(
            [in] ULONG celt,
            [out, size_is(celt)] IRTCBuddy ** ppElements,
            [in,out,ptr] ULONG * pceltFetched
            );

    HRESULT Reset( void );

    HRESULT Skip (
            [in] ULONG celt
            );

    HRESULT Clone (
            [out, retval] IRTCEnumBuddies ** ppEnum
            );
}

[
    object,
    uuid(a87d55d7-db74-4ed1-9ca4-77a0e41b413e),
    hidden,
    helpstring("IRTCEnumWatchers interface"),
    pointer_default(unique)
]   
interface IRTCEnumWatchers : IUnknown
{
    HRESULT Next(
            [in] ULONG celt,
            [out, size_is(celt)] IRTCWatcher ** ppElements,
            [in,out,ptr] ULONG * pceltFetched
            );

    HRESULT Reset( void );

    HRESULT Skip (
            [in] ULONG celt
            );

    HRESULT Clone (
            [out, retval] IRTCEnumWatchers ** ppEnum
            );
}

[
    object,
    uuid(8b22f92c-cd90-42db-a733-212205c3e3df),
    helpstring("IRTCPresenceContact Interface"),
    pointer_default(unique)
]
interface IRTCPresenceContact : IUnknown
{
    [propget, helpstring("property PresentityURI")]
    HRESULT PresentityURI(
            [out, retval] BSTR * pbstrPresentityURI
            );   

    [propput, helpstring("property PresentityURI")]
    HRESULT PresentityURI(
            [in] BSTR bstrPresentityURI
            ); 

    [propget, helpstring("property Name")]
    HRESULT Name(
            [out, retval] BSTR * pbstrName
            );                 
    
    [propput, helpstring("property Name")]
    HRESULT Name(
            [in] BSTR bstrName
            );                 
    
    [propget, helpstring("property Data")]
    HRESULT Data(
            [out, retval] BSTR * pbstrData
            );                 
    
    [propput, helpstring("property Data")]
    HRESULT Data(
            [in] BSTR bstrData
            );
                             
    [propget, helpstring("property Persistent")]
    HRESULT Persistent(
            [out, retval] VARIANT_BOOL *pfPersistent
            );                 
    
    [propput, helpstring("property Persistent")]
    HRESULT Persistent(
            [in] VARIANT_BOOL fPersistent
            );                 
  
};


[
    object,
    uuid(fcb136c8-7b90-4e0c-befe-56edf0ba6f1c),
    helpstring("IRTCBuddy Interface"),
    pointer_default(unique)
]
interface IRTCBuddy : IRTCPresenceContact
{  
    [propget, helpstring("property Status")]
    HRESULT Status(
            [out, retval] RTC_PRESENCE_STATUS * penStatus
            );
    
    [propget, helpstring("property Notes")]
    HRESULT Notes(
            [out, retval] BSTR * pbstrNotes
            );
};


[
    object,
    uuid(c7cedad8-346b-4d1b-ac02-a2088df9be4f),
    helpstring("IRTCWatcher Interface"),
    pointer_default(unique)
]
interface IRTCWatcher : IRTCPresenceContact
{

    [propget, helpstring("property State")]
    HRESULT State(
            [out, retval] RTC_WATCHER_STATE * penState
            );                
    
    [propput, helpstring("property State")]
    HRESULT State(
            [in] RTC_WATCHER_STATE  enState
            );                
                     
};


[
    object,
    uuid(13fa24c7-5748-4b21-91f5-7397609ce747),
    helpstring("IRTCEventNotification Interface"),
    oleautomation,
    pointer_default(unique)
]
interface IRTCEventNotification : IUnknown
{
    [id(1), helpstring("method Event")]
    HRESULT Event(
            [in] RTC_EVENT RTCEvent,
            [in] IDispatch * pEvent
            );
}

[
    uuid(176ddfbe-fec0-4d55-bc87-84cff1ef7f91),
    helpstring("IRTCDispatchEventNotification Interface")
]
dispinterface IRTCDispatchEventNotification
{
    properties:
    methods:

    [id(1), helpstring("method Event")]
    HRESULT Event(
            [in] RTC_EVENT RTCEvent,
            [in] IDispatch * pEvent
            );
};

[
    object,
    uuid(DA77C14B-6208-43ca-8DDF-5B60A0A69FAC),
    helpstring("IRTCPortManager Interface"),
    oleautomation,
    pointer_default(unique)
]
interface IRTCPortManager : IUnknown
{
    [id(1), helpstring("method GetMapping")] 
    HRESULT GetMapping(
            [in] BSTR bstrRemoteAddress,
            [in] RTC_PORT_TYPE enPortType,
            [in, out] BSTR * pbstrInternalLocalAddress,
            [in, out] long * plInternalLocalPort,
            [in, out] BSTR * pbstrExternalLocalAddress,
            [in, out] long * plExternalLocalPort
            ); 

    [id(2), helpstring("method UpdateRemoteAddress")]
    HRESULT UpdateRemoteAddress(
            [in] BSTR bstrRemoteAddress,
            [in] BSTR bstrInternalLocalAddress,
            [in] long lInternalLocalPort,
            [in] BSTR bstrExternalLocalAddress,
            [in] long lExternalLocalPort
            );

    [id(3), helpstring("method ReleaseMapping")]
    HRESULT ReleaseMapping(
            [in] BSTR bstrInternalLocalAddress,
            [in] long lInternalLocalPort,
            [in] BSTR bstrExternalLocalAddress,
            [in] long lExternalLocalAddress
            );
}

[
    object,
    uuid(a072f1d6-0286-4e1f-85f2-17a2948456ec),
    helpstring("IRTCSessionPortManagement Interface"),
    pointer_default(unique)
]
interface IRTCSessionPortManagement : IUnknown
{
    HRESULT SetPortManager(
            [in] IRTCPortManager * pPortManager
            );
};

[
    uuid(cd260094-de10-4aee-ac73-ef87f6e12683),
    version(1.0),
    helpstring("RTCCore 1.0 Type Library")
]
library RTCCORELib
{
    importlib("stdole32.tlb");

    interface IRTCProfile;
    interface IRTCSession;
    interface IRTCParticipant;    
    interface IRTCEnumProfiles;
    interface IRTCEnumParticipants;
    interface IRTCCollection;
    interface IRTCEnumBuddies;
    interface IRTCBuddy;
    interface IRTCEnumWatchers;
    interface IRTCWatcher;
    interface IRTCEventNotification;
    interface IRTCClientEvent;
    interface IRTCRegistrationStateChangeEvent;
    interface IRTCSessionStateChangeEvent;
    interface IRTCSessionOperationCompleteEvent;
    interface IRTCParticipantStateChangeEvent;
    interface IRTCMediaEvent;
    interface IRTCIntensityEvent;
    interface IRTCMessagingEvent;
    interface IRTCBuddyEvent;
    interface IRTCWatcherEvent;
    interface IRTCPortManager;
    interface IRTCSessionPortManagement;
    dispinterface IRTCDispatchEventNotification;

    [
        uuid(7a42ea29-a2b7-40c4-b091-f6f024aa89be),
        helpstring("RTCClient Class")
    ]
    coclass RTCClient
    {        
        [default] interface IRTCClient;        
        interface IRTCClientPresence;
        interface IRTCClientProvisioning;
        [default, source] dispinterface IRTCDispatchEventNotification;
        [defaultvtable, source] interface IRTCEventNotification;
    };
};

