Share via


Create a Session and Make a Call

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

The following code example shows how to make a call. The session is created, then a participant is added to the session to initiate the call. The operations in the Initialize RTC example must be performed before using this code.

Note

This code has not been thoroughly tested, does not contain error checking, and is not intended for production use.

HRESULT hr = S_OK;
BSTR bstrLocalURI = NULL;
BSTR bstrDestURI = NULL;
RTC_SESSION_TYPE SessionType;

SessionType = // Specify session type 

{
    bstrLocalURI = SysAllocString(_T("tel:+14257034556"));
}

// Get the URI to call; this can be a SIP or a TEL URI.
bstrDestURI = SysAllocString(_T("sip:someone@example.com")); 

// Create the session with the specified session type and local URI.
hr = pIRTCClient->CreateSession( SessionType, 
                                 bstrLocalURI, 
                                 NULL,
                                 &pIRTCSession );

// if (hr != S_OK) process error here.

// The AddParticipant method sets the session into the active state
// and creates the IRTCParticipant interface. 
IRTCParticipant *pIRTCParticipant;
hr = pIRTCSession->AddParticipant( bstrDestURI, 
                                   NULL, 
                                   &pIRTCParticipant );

// if (hr != S_OK) process error here.

See Also

Concepts

Fundamental RTC Code Examples