예제 #1
0
 /// <summary>
 /// To create a new customer call anchor.
 /// </summary>
 /// <param name="customerSession">Customer session.</param>
 /// <param name="customerConversation">Customer conversation.</param>
 public CustomerCallAnchor(CustomerSession customerSession, ILogger logger, Conversation customerConversation)
 {
     this.customerConversation      = customerConversation;
     this.customerRemoteParticipant = customerConversation.RemoteParticipants[0];
     this.customerSession           = customerSession;
     this.logger = logger;
 }
예제 #2
0
 /// <summary>
 /// To create a new IM IVR.
 /// </summary>
 /// <param name="customerSession">Customer session.</param>
 /// <param name="imCall">Im call.</param>
 /// <param name="menu">Menu to use.</param>
 /// <param name="conversationContextChannel">Conversation context channel.</param>
 /// <param name="logger">Logger.</param>
 public InstantMessagingIVR(CustomerSession customerSession,
                            InstantMessagingCall imCall,
                            ConversationContextChannel conversationContextChannel,
                            Menu menu,
                            ILogger logger)
 {
     this.customerSession = customerSession;
     this.logger          = logger;
     this.imCall          = imCall;
     this.RegisterIMcallEventHandlers(imCall);
     this.menu = menu;
     if (conversationContextChannel != null)
     {
         this.channel = conversationContextChannel;
         this.RegisterContextChannelHandlers(this.channel);
     }
 }
예제 #3
0
        /// <summary>
        /// Accept IM from Lync client
        /// </summary>
        /// <param name="sender">Source of the event</param>
        /// <param name="e">InstantMessagingCall arguments</param>
        private void IM_Received(object sender, CallReceivedEventArgs <InstantMessagingCall> e)
        {
            bool handled = false;

            if (e.IsNewConversation)
            {
                lock (this.activeCustomerSessions)
                {
                    if (!this.activeCustomerSessions.ContainsKey(e.Call.RemoteEndpoint.Uri))
                    {
                        Customer        customer        = new Customer(e.Call.RemoteEndpoint.Uri);
                        Menu            menu            = new Menu(this.moreInformationMessage, this.moreInformationLink, this.cweMessage, this.registryFilePath, this.XmlParser);
                        CustomerSession customerSession = new CustomerSession(customer, menu, this, this.logger);
                        this.activeCustomerSessions.Add(e.Call.RemoteEndpoint.Uri, customerSession);
                        customerSession.HandleIncomingInstantMessagingCall(e.Call);
                        handled = true;
                    }
                }
            }


            if (!handled)
            {
                try
                {
                    this.logger.Log("Declining IM call since this is a modality escalating call.");
                    Console.WriteLine("Declining IM call since this is a modality escalating call.");
                    e.Call.Decline();
                }
                catch (InvalidOperationException ioe)
                {
                    this.logger.Log("Exception while declining call {0}", ioe);
                    Console.WriteLine("Exception while declining call {0}", ioe);
                }
                catch (RealTimeException rte)
                {
                    this.logger.Log("Exception while declining call {0}", rte);
                    Console.WriteLine("Exception while declining call {0}", rte);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Accept AV.
        /// </summary>
        /// <param name="sender">Source of the event</param>
        /// <param name="e">AudioVideoCall arguments</param>
        private void AV_Received(object sender, CallReceivedEventArgs <AudioVideoCall> e)
        {
            bool handled = false;

            if (e.IsConferenceDialOut)
            {
                if (e.Call.Conversation.Id != null)
                {
                    string customerUri = e.Call.Conversation.Id.Trim('>', '<');
                    lock (this.activeCustomerSessions)
                    {
                        if (activeCustomerSessions.ContainsKey(customerUri))
                        {
                            activeCustomerSessions[customerUri].HandleIncomingDialOutCall(e.Call);
                            handled = true;
                        }
                    }
                }
            }
            else if (e.IsNewConversation)
            {
                if (e.Call.Conversation.Id != null)
                {
                    string customerUri = e.Call.Conversation.Id.Trim('>', '<');
                    lock (this.activeCustomerSessions)
                    {
                        if (activeCustomerSessions.ContainsKey(customerUri))
                        {
                            activeCustomerSessions[customerUri].HandleIncomingAudioCall(e.Call);
                            handled = true;
                        }
                        else
                        {
                            string          uri             = e.Call.RemoteEndpoint.Uri;
                            Customer        customer        = new Customer(uri);
                            Menu            menu            = new Menu(this.moreInformationMessage, this.moreInformationLink, this.cweMessage, this.registryFilePath, this.XmlParser);
                            CustomerSession customerSession = new CustomerSession(customer, menu, this, this.logger);
                            this.activeCustomerSessions.Add(e.Call.RemoteEndpoint.Uri, customerSession);
                            customerSession.HandleIncomingAudioCall(e.Call);
                            handled = true;
                        }
                    }
                }
            }


            if (!handled)
            {
                try
                {
                    this.logger.Log("Declining AV call since this is a modality escalating call.");
                    Console.WriteLine("Declining AV call since this is a modality escalating call.");
                    e.Call.Decline();
                }
                catch (InvalidOperationException ioe)
                {
                    this.logger.Log("Exception while declining call {0}", ioe);
                    Console.WriteLine("Exception while declining call {0}", ioe);
                }
                catch (RealTimeException rte)
                {
                    this.logger.Log("Exception while declining call {0}", rte);
                    Console.WriteLine("Exception while declining call {0}", rte);
                }
            }
        }