Beispiel #1
0
        private void _btnPickup_Click(object sender, EventArgs e)
        {
            ITapiCall      tc  = CurrentAddress.Pickup(_tbNumber.Text, null);
            ActiveCallForm acf = new ActiveCallForm(tc);

            acf.Show();
        }
Beispiel #2
0
        private void _btnUnpark_Click(object sender, EventArgs e)
        {
            ITapiCall      tc  = CurrentAddress.Unpark(_tbNumber.Text);
            ActiveCallForm acf = new ActiveCallForm(tc);

            acf.Show();
        }
Beispiel #3
0
 /* make outgoing call */
 public void makeCall(string plainPhoneNumber)
 {
     App.log("TAPI address - Making outgoing call to '" + plainPhoneNumber + "'");
     if (currentAddress != null)
     {
         if (currentAddress.Address != "")
         {
             if (!App.Setup.CanMakeCall)
             {
                 dropCall();
                 callNumberAsSoonAsPossible = plainPhoneNumber;
             }
             else
             {
                 try
                 {
                     currentOutgoingCall = currentAddress.MakeCall(plainPhoneNumber);
                     App.log(String.Format("TAPI address - Made call to '{0}'", plainPhoneNumber));
                 }
                 catch (Exception ex)
                 {
                     App.log(ex.Message);
                 }
             }
         }
     }
 }
Beispiel #4
0
 internal DeviceSpecificEventArgs(TapiCall call, IntPtr p1, IntPtr p2, IntPtr p3)
 {
     Line   = call.Line;
     Call   = call;
     Param1 = p1;
     Param2 = p2;
     Param3 = p3;
 }
        public ActiveCallForm(ITapiCall call)
        {
            var line = call.Line;

            _call = call;
            line.CallInfoChanged  += OnCallInfoChange;
            line.CallStateChanged += OnCallStateChange;

            InitializeComponent();
        }
Beispiel #6
0
 /* cleanup the outgoing call object */
 private void disposeOutgoingCall()
 {
     if (currentOutgoingCall != null)
     {
         //App.log("TAPI address - disposing outgoing call");
         currentOutgoingCall.Dispose();
         App.log("TAPI address - Disposed outgoing call");
         currentOutgoingCall = null;
     }
 }
Beispiel #7
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;
        }
Beispiel #8
0
        /* is called when main win is loaded */
        public void init()
        {
            App.isMgrInitializationPhase = true;
            bool didInitalize = false;

            try
            {
                didInitalize = mgr.Initialize(); // CRITICAL - will remain in an endless loop, if the windows system CONTROL PANEL is opened and the current bound TAPI DRIVER configuration is opened!
            }
            catch (Exception ex)
            {
                App.log(ex.Message);
            }
            App.isMgrInitializationPhase = false;
            if (didInitalize)
            {
                App.Setup.Lines.Clear();
                App.Setup.Addresses.Clear();
                currentLine          = null;
                currentAddress       = null;
                addressCollection    = null;
                currentOutgoingCall  = null;
                currentIncomingCall  = null;
                allLinesAndAddresses = "";
                lineCollection       = mgr.Lines;
                App.log(String.Format("{0}x TSP (Telephony service provider) lines detected", lineCollection.Count()));
                foreach (TapiLine line in lineCollection)
                {
                    App.Setup.Lines.Add(line.Name);
                    //line.Changed += Line_Changed;
                    //line.NewCall += Line_NewCall;
                    //line.Ringing += Line_Ringing;
                    allLinesAndAddresses += "|" + line.Name;
                    if (line.Addresses != null)
                    {
                        if (line.Addresses.Count() > 0)
                        {
                            foreach (TapiAddress adr in line.Addresses)
                            {
                                allLinesAndAddresses += "~" + adr.Address;
                            }
                        }
                        else
                        {
                            App.log(String.Format("Line '{0}' addresses are empty!", line.Name));
                        }
                    }
                    else
                    {
                        App.log(String.Format("Line '{0}' addresses collection is NULL!", line.Name));
                    }
                }
                if (allLinesAndAddresses != "")
                {
                    allLinesAndAddresses = allLinesAndAddresses.Substring(1);
                }

                if (App.Setup.Line != "")
                {
                    setCurrentLine(App.Setup.Line);
                }
                if (App.Setup.Address != "")
                {
                    setCurrentAddress(App.Setup.Address);
                }

                App.isRefreshingTapiSession = true; // start session
            }
        }