private void PbxProvider_NewCall(object sender, NewCallEventArgs args)
 {
     _queueOfCalls.Enqueue(args.NewCall);
     CallQueued?.Invoke(this, new CallQueuedEventArgs {
         QueuedCall = args.NewCall, CurrentQueuedCallCount = _queueOfCalls.Count
     });
 }
예제 #2
0
        private void OnNewCall(object sender, NewCallEventArgs e)
        {
            if (this.InvokeRequired)
            {
                EventHandler <NewCallEventArgs> eh = OnNewCall;
                this.BeginInvoke(eh, new object[] { sender, e });
                return;
            }

            TapiLine line = (TapiLine)sender;
            TapiCall call = e.Call;

            ListViewItem lvi = new ListViewItem(line.Name);

            lvi.Tag = call;

            lvi.SubItems.AddRange(
                new string[] {
                string.Format("0x{0:X}", call.Id),
                call.CallState.ToString(),
                string.Format("{0} {1}", call.CallerId, call.CallerName),
                string.Format("{0} {1}", call.CalledId, call.CalledName),
            });
            lvCalls.Items.Add(lvi);

            if (call.CallerId != e.Call.Address.Address)
            {
                System.Diagnostics.Process.Start("chrome.exe", "http://obelix/deia/" + call.CallerId.ToString());
            }
        }
예제 #3
0
        void manager_NewCall(object sender, NewCallEventArgs e)
        {
            Call c = new Call();

            c.callee    = e.Call.CalledId;
            c.caller    = e.Call.CallerId;
            c.callId    = e.Call.Id.ToString();
            c.startTime = DateTime.Now;
            switch (e.Call.CallState)
            {
            case CallState.Accepted:
                //first missed
                c.type = CallType.missed;
                break;

            case CallState.Dialing:
                //placed
                c.type = CallType.placed;
                break;

            case CallState.Dialtone:
                //placed
                c.type = CallType.placed;
                break;

            case CallState.Offering:
                //first missed
                c.type = CallType.missed;
                break;
            }
            putCall(c, e.Call.Address.Address);
            NewCall(e, "Manager");
        }
예제 #4
0
        private void OnNewCall(object sender, NewCallEventArgs e)
        {
            if (this.InvokeRequired)
            {
                EventHandler <NewCallEventArgs> eh = OnNewCall;
                this.BeginInvoke(eh, new object[] { sender, e });
                return;
            }

            TapiLine line = (TapiLine)sender;
            TapiCall call = e.Call;

            ListViewItem lvi = new ListViewItem(line.Name);

            lvi.Tag = call;

            lvi.SubItems.AddRange(
                new string[] {
                string.Format("0x{0:X}", call.Id),
                call.CallState.ToString(),
                string.Format("{0} {1}", call.CallerId, call.CallerName),
                string.Format("{0} {1}", call.CalledId, call.CalledName),
            });
            lvCalls.Items.Add(lvi);
        }
예제 #5
0
 void line_NewCall(object sender, NewCallEventArgs e)
 {
     if (SomeoneIsCalling != null && e.Call.CallOrigin == CallOrigins.External && e.Call.BearerMode == BearerModes.Voice)
     {
         SomeoneIsCalling(sender, new IncomingCallEventArgs(e.Call.CallerId));
     }
 }
        /// <summary>
        /// This is the primary hander for “new” call event’s from the CIT system.
        /// This event is raised by the call state manager after primary translation from the base CTI event.
        /// This event is used to create a Search Request to the system search provider or do other “pre-search” handling
        /// </summary>
        /// <param name="sender">Call State Manager that raised this request.</param>
        /// <param name="e">New Event call Arguments</param>
        private void OnCallManagerStateNewCall(object sender, NewCallEventArgs e)
        {
            // This is how to determin if the current session has a call
            if (((AgentDesktopSession)localSessionManager.ActiveSession).CtiCallRefId != Guid.Empty)
            {
                // I have a call.
                // Do some alert or compenstation logic here.
                // maybe return ;
            }

            // Form a request to the customer provider to launch a customer lookup with CTI data..
            CtiLookupRequest lookupRequest = new CtiLookupRequest(
                e.CallInfo.GetCtiCallRefId, // Internal UII Call ID
                this.ApplicationName,       // Application Name that is raising the Lookup Request.
                e.CallInfo.CallType,        // Type of call
                e.CallInfo.Ani,             // Number that called me.
                e.CallInfo.Dnis);           // Number that they called.

            //If you would like to add in custom properties that can be access by the search provider, use this construct
            // lookupRequest.AddLookupRequestItem("CUSTOMERID", GetParamFromCallState(e.UiiRefCallID, "custID"));

            // Now Serilize the Request and send it to the UII enviroment.
            string sData = GeneralFunctions.Serialize <CtiLookupRequest>(lookupRequest);

            // This is a custom implemented action sender that uses a threaded approach to send this request.
            // It is very important that you do this in a threaded manner because actions are blocking and
            //      can slow down response to the Cti system.
            SendCommandParams cmd = new SendCommandParams("*", CtiLookupRequest.CTILOOKUPACTIONNAME, sData);

            new Thread(new ParameterizedThreadStart(SendAction)).Start(cmd);
        }
예제 #7
0
        private static void NewCall(object sender, NewCallEventArgs e)
        {
            Console.WriteLine("New Call!");
            Console.WriteLine(e.Call.CallerId);
//            Console.WriteLine(e.Call.TrunkId);
//            Console.WriteLine(e.Call.Address);
//            Console.WriteLine(e.Call.CalledId);
//            Console.WriteLine(e.Call.CallState);
        }
 /// <summary>
 /// Event for new call
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void m_TelephonyServer_NewCall(object sender, NewCallEventArgs e)
 {
     try
     {
     }
     catch (Exception ex)
     {
         Log.WriteException(ex, "NewCall");
     }
 }
예제 #9
0
        void AnyPhoneLine_NewCall(object sender, NewCallEventArgs e)
        {
            TapiEventLogEntry entry = new TapiEventLogEntry(
                e.Call.Line.Name,
                e.Call.GetHashCode(),
                TapiEvents.NewCall,
                e.Call.CallState.ToString());

            this.Events.Insert(0, entry);
        }
예제 #10
0
        private void OnNewCall(object sender, NewCallEventArgs e)
        {
            if (InvokeRequired == true)
            {
                this.BeginInvoke(new EventHandler <NewCallEventArgs>(this.OnNewCall), new object[] { sender, e });
                return;
            }

            ActiveCallForm acf = new ActiveCallForm(e.Call);

            acf.Show();
        }
예제 #11
0
        /*
         * Incoming call event handler
         */
        private void Line_NewCall(object sender, NewCallEventArgs e)
        {
            currentIncomingCall = e.Call;
            string callingPhoneNumber = currentIncomingCall.CallerId;

            App.log(String.Format("TAPI line - Incoming call event - Caller ID '{0}' - Called ID '{1}' - Privilege '{2}' - Call '{3}'", currentIncomingCall.CallerId, currentIncomingCall.CalledId, e.Privilege, e.Call));
            App.network.incomingCall(callingPhoneNumber);
            e.Call.Line.Monitor();
            //currentIncomingCall.Line.Close();
            //currentIncomingCall.Line.Dispose();
            //currentIncomingCall.Dispose();
            //currentIncomingCall = null;
        }
예제 #12
0
        private static void OnNewCall(object sender, NewCallEventArgs e)
        {
            TapiLine line = (TapiLine)sender;
            TapiCall call = e.Call;

            Console.WriteLine(call.CallerId);

            StringBuilder sb = new StringBuilder();

            sb.Append("http://127.0.0.1:15477/adresse-by-phone?msn=");
            sb.Append(call.CallerId);
            var result = new WebClient().DownloadString(sb.ToString());

            Console.WriteLine(result);
        }
예제 #13
0
 void address_NewCall(object sender, NewCallEventArgs e)
 {
     NewCall(e, "Address");
 }
예제 #14
0
 void NewCall(NewCallEventArgs e, string from)
 {
     log.Debug(from + " new call: " + e.Call.ToString() + " under " + e.Privilege.ToString() + " privilege. Extension: " + e.Call.Address.ToString() + " , state: " + e.Call.CallState.ToString());
     ss.SetLineControl(GetLineControl(e.Call.Address));
 }
예제 #15
0
 void manager_NewCall(object sender, NewCallEventArgs e)
 {
     Call c = new Call();
     c.callee = e.Call.CalledId;
     c.caller = e.Call.CallerId;
     c.callId = e.Call.Id.ToString();
     c.startTime = DateTime.Now;
     switch (e.Call.CallState)
     {
         case CallState.Accepted:
             //first missed
             c.type = CallType.missed;
             break;
         case CallState.Dialing:
             //placed 
             c.type = CallType.placed;
             break;
         case CallState.Dialtone:
             //placed
             c.type = CallType.placed;
             break;
         case CallState.Offering:
             //first missed
             c.type = CallType.missed;
             break;
     }
     putCall(c, e.Call.Address.Address);
     NewCall(e, "Manager");
 }
예제 #16
0
 void line_NewCall(object sender, NewCallEventArgs e)
 {
     NewCall(e, "Line");
 }
예제 #17
0
 void line_NewCall(object sender, NewCallEventArgs e)
 {
     NewCall(e, "Line");
 }
예제 #18
0
 void NewCall(NewCallEventArgs e, string from)
 {
     log.Debug(from + " new call: " + e.Call.ToString() + " under " + e.Privilege.ToString() + " privilege. Extension: " + e.Call.Address.ToString() + " , state: " + e.Call.CallState.ToString());
     ss.SetLineControl(GetLineControl(e.Call.Address));
 }
예제 #19
0
 void address_NewCall(object sender, NewCallEventArgs e)
 {
     NewCall(e, "Address");
 }
예제 #20
0
        /// <summary>
        /// New call event for channel
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ChannelResource_NewCall(object sender, NewCallEventArgs e)
        {
            if (e.ChannelResource is MsiChannel)
            {
                Log.Write("|MC|Msi {0} went off hook", e.ChannelResource.DeviceName);

                // Start something here to managed an off hook agent...

                //Check if the agent is logged in or not and play message
                //to agent to Login else add to off hook list
                ManagedAgent   ma = ManagedAgent.CheckAgentLoggedIn(e.ChannelResource.DeviceName);
                ManagedChannel mc = null;

                if (ma != null)
                {
                    if (!ma.AgentDetails.AllwaysOffHook)
                    {
                        foreach (ManagedChannel mc2 in ManagedChannel.MsiChannelList)
                        {
                            if (mc2.ChannelResource.Equals(e.ChannelResource))
                            {
                                mc = mc2;
                                break;
                            }
                        }

                        if (mc == null)
                        {
                            Log.Write("|MC|ChannelResource_NewCall unable to locate channel.");
                        }
                        else
                        {
                            ma.InboundAgent(mc);
                        }
                    }
                    else
                    {
                        Log.Write("|MC|ChannelResource_NewCall AllwaysOffHook agent with station-{0}", e.ChannelResource.DeviceName);
                    }
                }
                else
                {
                    try
                    {
                        // VoiceResource on MSIChannel,
                        // e.ChannelResource.VoiceResource.PlayTTS("Please Login");
                    }
                    finally
                    {
                        e.ChannelResource.Disconnect();
                    }
                }
            }
            else
            {
                // Handle new call event
                try
                {
                    Log.Write("|MC|{0} NewCall. Answering.", e.ChannelResource.DeviceName);   // MONROE
                    e.ChannelResource.Answer();
                    Log.Write("|MC|{0} Playing Good Bye Message.", e.ChannelResource.DeviceName);
                    e.ChannelResource.VoiceResource.Play(@"AudioFiles\Goodbye.wav");
                }
                finally
                {
                    Log.Write("|MC|{0} Disconnecting.", e.ChannelResource.DeviceName);
                    e.ChannelResource.Disconnect();
                }
            }
        }