Cookie CSS

Saturday, January 2, 2016

Skype for Business DND Audio Calls Only

One seriously missing enterprise voice feature in Skype for Business is the ability to DND (Do Not Disturb) audio calls while maintaining the ability to use the instant message features of Skype for Business.  In a traditional enterprise voice world, you would simply hit DND on your phone and still be able to communicate via chat.  There are several scenarios in which a split on the DND would be nice.

The problem with setting DND to turn off incoming ringing calls is you wind up with this.







Once your status is set the other users attempting to chat with you will be met with this in their IM window.







































You will also get an email with every chat message someone attempts to send, so you have a nice pile of those to fill up your inbox.
















Here is perfect example;

A helpdesk engineer is part of  a Response Group set for attendant mode, and is force by the customer limitations to connect via webex or go to meeting.

In this scenario the user has 2 choices.  The first option is to set Do No Disturb in S4b and lose the ability for others to chat or offer help via chat for the issue at hand.  The second is have a non DND status and be interrupted by ringing call after ringing call in the middle of another task.

So how can we get around this condition and only DND the audio calls, so this user can chat with others on the help-desk and get the customer issue resolved?

The Solution

My team and I recently incorporated a DND audio calls option into our Boss-Admin Executive Console for Skype for Business.  It's a simple toggle button that uses a pretty simple method to essentially ignore ringing calls that come in.






































How does it work?

First register the event to be notified of a new conversion.

        void ConversationManager_ConversationAdded(object sender, ConversationManagerEventArgs e)
       

In that event we want for a new conversation that has audio, check for our flag to DND it, then ignore the call if all of the criteria is met.

 if (Globals.ContainsAVCall(e.Conversation))
                    {
                        if (Globals.DNDAudio)
                        {
                            if (Globals.ContainsAVCall(e.Conversation))
                            {
                                Globals.IgnoreCall(e.Conversation);
                            }
                        }
                    }

Here are the procedures being called in the code above.

        public static void IgnoreCall(Conversation c)
        {
            if (c == null)
                return;

            Task.Factory.StartNew(() =>
            {
                try
                {
                    foreach (Participant p in c.Participants)
                    {
                        if (p != c.SelfParticipant)
                        {
                            logAction("HANGUP", (string)p.Contact.GetContactInformation(ContactInformationType.DisplayName) + " - " + p.Contact.Uri);
                        }
                    }
                }
                catch { }
            });

            try
            {
                if (c.Modalities[ModalityTypes.AudioVideo].CanInvoke(ModalityAction.Disconnect))
                {
                    c.Modalities[ModalityTypes.AudioVideo].BeginDisconnect(ModalityDisconnectReason.Decline, myar =>
                    {

                        try
                        {

                            c.Modalities[ModalityTypes.AudioVideo].EndDisconnect(myar);

                        }
                        catch { }


                    }, null);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(ex, true);
                string er;
                er = "HangupCall: Error Trapped in " + Dlib.ProgramSource + ".\r\n";
                er = er + trace.GetFrame(0).GetMethod().Name + "\r\n" + ex.Message.ToString();
                er = er + "Line: " + trace.GetFrame(0).GetFileLineNumber();
                er = er + "Column: " + trace.GetFrame(0).GetFileColumnNumber();
                ClsEventLog.WriteToEventLogError("BLOC BA BEC", "Error:", er);
            }
        }

        public static bool ContainsAVCall(Conversation c)
        {
            try
            {
                //Console.WriteLine(c.Modalities[ModalityTypes.AudioVideo].State.ToString());
                return c.Modalities.ContainsKey(ModalityTypes.AudioVideo) && c.Modalities[ModalityTypes.AudioVideo].State != ModalityState.Disconnected;
            }
            catch
            {
                return false;
            }
        }

It's that simple, with a little custom programming you can fix the limitations that are part of the S4b default DND method.

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


No comments:

Post a Comment

Any spam comments will be deleted and your user account will be disabled.