Bridge Communications

Saturday, September 12, 2015

Muting your microphone using the Lync Client SDK

During a conversation it is handy to be able to mute yourself on occasion.  An good example would be right before you sneeze.  Most phones, and even the Lync/Skype4b client can do this for you with ease, but what if you want to do it using code?


























Step 1.  Find the conversation.

Conversation c;

Step 2.  Find yourself

 foreach (Participant p in c.Participants)
                {
                    if (p.IsSelf)
                    {

Step 3.  Mute if not muted

if (!p.IsMuted)
                        {
                            p.BeginSetMute(true, rc =>
                            {
                                try
                                {
                                    p.EndSetMute(rc);
                                }
                                catch { }
                            }
                            , null);
                        }

Important Note;

The BeginSetMute call takes a Boolean parameter that can be true or false, so you can use it to "un-mute" yourself as well.

That will conclude this weeks blog post.  If you have any questions hit me up on twitter.

Doug Routledge, C# Lync, Skype for Business, SQL, Exchange, UC Developer  BridgeOC
Twitter - @droutledge @ndbridge

No comments:

Post a Comment