Accept a Conference Invitation

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Unlike peer-to-peer session invitations, a conference session invitation does not provide an active session for collaboration with a remote user. Instead, the conference invitation provides a conference URI that the local client uses to create a new conference session whose remote participant is a conference Focus.

To accept a conference invitation:

  1. Register a session evaluator.
  2. Handle incoming session events of the type UCC_SESSION_TYPE.UCCST_APPLICATION.
  3. Extract the new conference URI from the conference invitation.
  4. Create a new session of the type UCC_SESSION_TYPE.UCCST_CONFERENCE.
  5. Join the conference session using the supplied conference URI.

Accept a Conference Invitation

A conference invitation from a remote user is sent to the local client using an application session (IUccApplicationSession). The client platform catches the incoming application session but does not raise the OnIncomingSession event to the client unless the client session evaluator has indicated that the incoming application session should be handled. If the evaluator indicates the incoming session should be raised to the client, the platform raises OnIncomingSession and the client catches the event. Within the event handler, the client casts the IUccSession instance provided by the platform to the IUccApplicationSession interface. This interface exposes the properties that a client must read to extract the conference URI used to create the new conference session.

Register a Session Evaluator

The client must register a session evaluator with the platform that the platform calls to evaluate the incoming application session. The evaluator is defined by the client and should provide a mechanism to compare a session content type with a set of known content types that a client is interested in handling.

The following example registers a session evaluator on a platform using an instance of IUccSessionManager.

// EndPoint is a class field instance of IUccEndpoint.
// sm is a class field instance of IUccSessionManager.
this.sm = this.endPoint as IUccSessionManager;
this.sm.RegisterSessionDescriptionEvaluator(this);

Once the session evaluator is registered on a client platform, the platform can evaluate incoming application sessions for the client. If the session evaluator defined by the client and called by the platform returns a Booleantrue value, the platform raises OnIncomingSession to the client.

/// <summary>
/// Callback function is called by the platform to determine whether
/// to pass an incoming application session to the client or reject it
/// </summary>
/// <param name="bstrContentType">XML Schema of incoming session description XML stream</param>
/// <param name="bstrSessionDescription">The application session description</param>
/// <returns>Boolean true or false</returns>
bool _IUccSessionDescriptionEvaluator.Evaluate(string bstrContentType, string bstrSessionDescription)
{
    bool returnValue = false;
    if (_acceptAppSessionList.Count > 0)
    {
        if (bstrContentType.ToLower().Trim() == "application/ms-conf-invite+xml")
            returnValue = true;
    }
    return returnValue;
}

Handle OnIncomingSession

The incoming application session is exposed to the client as the Session property of the IUccIncomingSessionEvent parameter. The Session property value is an instance of IUccSession that the client must cast to IUccApplicationSession to expose an XML string containing the conference URI property along with other conference invitation strings.

The following example handles the OnIncomingSession event.

/// <summary>
/// Handles session invitations by displaying a dialog for
/// local user advising user of invitation and providing a mechanism
/// for the user to respond to the invitation
/// </summary>
/// <param name="pEventSource"></param>
/// <param name="pEventData"></param>
void _IUccSessionManagerEvents.OnIncomingSession(
    IUccEndpoint pEventSource,
    UccIncomingSessionEvent pEventData)
{
    if (pEventData.Context != null)
    {
        string metaData = this.GetSessionMetaData("Bink", pEventData);
    }

    string avType = string.Empty;
    UccUri pxyUri = UccpAppComponents.UCCPPlatformManager.myUriManager.ParseUri(proxyEndpointSipURI);
    if (pEventSource.Uri == pxyUri)
        avType = "PSTN";

    DialogResult result;
    // The user agreed to accept the invitation.
    try
    {
        // If (pEventData.Inviter.State != UCC_SESSION_ENTITY_STATE.UCCSES_CONNECTED)
        //{
        //    return;
        //}
        switch (pEventData.Session.Type)
        {
            case UCC_SESSION_TYPE.UCCST_INSTANT_MESSAGING:
                break;
            case UCC_SESSION_TYPE.UCCST_AUDIO_VIDEO:
                break;
            case UCC_SESSION_TYPE.UCCST_APPLICATION:

                UccIncomingInvitationEvent inInvitation = pEventData as UccIncomingInvitationEvent;


                // Create text reader as the source of XMLDocument XML stream.
                TextReader tr = new StringReader(inInvitation.RemoteSessionDescription);
                XmlDocument inviteDoc = new XmlDocument();
                inviteDoc.Load(tr);


                // Get the conference Focus URI from the XML stream.
                this.myConferenceUri = this.ExtractConferenceUri(
                    inviteDoc, 
                    "Conferencing/focus-uri");

                // Application session contained a conference Focus URI.
                if (this.myConferenceUri.Length > 0)
                {

                    MessageBox.Show("Conference Focus URI:" + this.myConferenceUri);

                    // Get the conference subject from the XML stream.
                    string conferenceSubject = this.ExtractConferenceUri(inviteDoc, "Conferencing/subject");

                    // Get the IM greeting text from the XML stream.
                    string conferenceIMGreeting = this.ExtractConferenceUri(inviteDoc, "Conferencing/im/first-im");

                    // Get Boolean flag indicating that IM modality is available for the conference.
                    Boolean conferenceIMAvailable = false;
                    System.Boolean.TryParse(this.ExtractConferenceUri(inviteDoc, "Conferencing/im/@available"), out conferenceIMAvailable);

                }
                break;

            default:
                break;
        }

    }
    catch (COMException ce)
    {
        MessageBox.Show (
            "COM Exception on Incoming Session in SessionManager: ",
            ce.Message);
    }
    catch (NullReferenceException ne)
    {
        MessageBox.Show(
            "Null Reference Exception on Incoming Session in SessionManager: ",
            ne.Message);
    }
}

/// <summary>
/// Extract text node value and return as string based on xpath parameter
/// </summary>
/// <param name="pXMLStream">XML Stream</param>
/// <param name="pXPathExp">string XPath expression for desired text node</param>
/// <returns>string Text value of desired node</returns>
private string ExtractConferenceUri(XmlDocument pDocument, string pXPathExp)
{
     string returnValue = string.Empty;

     // Process the XML remote session description to 
     // extract conference related values.

     try
     {

         // Get node of interest using xpath expression parameter.
         XmlNode focusNode = pDocument.SelectSingleNode(pXPathExp);

         // Get text value of desired element node.
         returnValue = focusNode.InnerText;

     }
     catch (XmlException xe)
     {
         MessageBox.Show(
           "XML Exception on Incoming Conference Invitation in Application Session: ",
            xe.Message);

     }

     return returnValue;
}

Join the Conference Session

After the conference is created, a user joins the conference using the conference Focus URI obtained in the previous example. For more information, see Join a Conference Session.

See Also

Concepts

Join a Conference Session