Invite a Participant to an Audio/Video Session

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.

After an audio/video session is created and related session events are registered, a Unified Communications Client API application invites a user to participate in the session. When the audio/video session is a peer-to-peer session involving another user, the remote participant is added using the SIP or TEL URI of the remote user. A TEL URI is used when the remote user joins the session using a telephone. In contrast, the remote participant SIP URI is a conference MCU URI when the audio/video session has been created to participate in a conference.

Using Unified Communications Client API, inviting a participant amounts to the following activities:

When a local client initiates a new video session, the client is responsible for creating the remote participant and associated media channels. Note that an incoming media session carries a fully configured remote participant complete with media channels. The local client does not add media channels to participants obtained from a session received in an invitation from a remote client.

  • Creating a IUccSessionParticipant object by calling CreateParticipant on the session object.
  • Calling QueryInterface on the participant object to get a IUccAudioVideoSessionParticipant interface. Audio/video channel functionality is available with this participant interface.
  • Registering for appropriate events that can be raised by the IUccSessionParticipant and IUccAudioVideoSessionParticipant objects.
  • Using the IUccAudioVideoSessionParticipant to create an audio channel connecting to the invited participant.
  • Adding the audio channel to the IUccAudioVideoSessionParticipant object for the invited participant.
  • Adding the participant object to the audio/video session.

Note

In Unified Communications Client API, making a computer-to-phone call follows the same programming pattern as making a computer-to-computer call. The caller must supply the SIP URI of the telephone to be called and must use audio-only media channel. The SIP URI format of a telephone is of the "sip:14255551111@sipserver.contoso.com".

The following C# code snippet illustrates this process.

IUccSession session;
string sipUri = "sip:jaya@contoso.com";

public void AddParticipant(string sipUri)
{
   IUccSessionParticipant participant = null;
   try
   {
       UccUri u = _UriManager.ParseUri(sipUri);
       participant = this.session.CreateParticipant(u, null);
       if (participant != null)
       {
           IUccAudioVideoSessionParticipant p = participant as IUccAudioVideoSessionParticipant;
           IUccMediaChannel c = p.CreateChannel(
                     UCC_MEDIA_TYPES.UCCMT_AUDIO, null);
           c.PreferredMedia = (int)(UCC_MEDIA_DIRECTIONS.UCCMD_RECEIVE | UCC_MEDIA_DIRECTIONS.UCCMD_SEND);
           p.AddChannel(c);
           this.session.AddParticipant(participant, null);
       }
   }
   catch (COMException ex)
   {
       MessageBox.Show(ex.Message);
   }
}

Attempts to add an audio channel on a computer without a sound card installed fails. After a participant is added to an AV session, by calling the AddParticipant method, the invited participant, if online, receives the invitation in a notification of the OnIncomingSession event. The AV session is established only after the invited participant accepts the invitation.

See Also

Concepts

Create an Audio Session
End an Audio/Video Session