Example #1
0
        private static void EstablishPrivateAudioChannelCompleted(
            IAsyncResult result)
        {
            AcdServiceChannel musicChannel     = result.AsyncState as AcdServiceChannel;
            EstablishMoHChannelAsyncResult ear = result as EstablishMoHChannelAsyncResult;

            try
            {
                musicChannel.EndEstablishPrivateAudioChannel(result);
            }
            catch (RealTimeException rtex)
            {
                musicChannel.BeginShutDown(dar =>
                {
                    AcdServiceChannel channel = dar.AsyncState as AcdServiceChannel;
                    channel.EndShutDown(dar);
                },
                                           musicChannel);
                ear.SetAsCompleted(rtex, false);
            }
        }
Example #2
0
        private void StartUpMohChannelCompleted(IAsyncResult result)
        {
            object[] args = result.AsyncState as object[];

            AcdServiceChannel musicChannel   = args[0] as AcdServiceChannel;
            string            participantUri = args[1] as String;
            CallReceivedEventArgs <AudioVideoCall> callReceivedArgs = args[2] as CallReceivedEventArgs <AudioVideoCall>;
            EstablishMoHChannelAsyncResult         ear = args[3] as EstablishMoHChannelAsyncResult;

            try
            {
                musicChannel.EndStartUp(result);

                try
                {
                    musicChannel.BeginEstablishPrivateAudioChannel(participantUri,
                                                                   true /*outsideMix*/,
                                                                   EstablishPrivateAudioChannelCompleted,
                                                                   musicChannel);
                }
                catch (InvalidOperationException ivoex)
                {
                    musicChannel.BeginShutDown(dar =>
                    {
                        AcdServiceChannel channel = dar.AsyncState as AcdServiceChannel;
                        channel.EndShutDown(dar);
                    },
                                               musicChannel);

                    ear.SetAsCompleted(new OperationFailureException("AcdMusicOnHoldServer failed begin establishing private audio channel", ivoex), false);
                }
            }
            catch (RealTimeException rtex)
            {
                callReceivedArgs.Call.Decline();
                ear.SetAsCompleted(rtex, false);
            }
        }