Beispiel #1
0
        public bool Hold(string callid, string caller)
        {
            TapiCall    call    = null;
            TapiAddress address = GetAddress(caller);
            bool        success = false;

            log.Debug("Hold call " + callid + " from " + caller);
            if (address != null)
            {
                log.Debug("Parsing " + address.Calls.Length.ToString() + " from " + address.ToString());
                foreach (TapiCall tc in address.Calls)
                {
                    log.Debug("Call " + tc.ToString() + " from " + caller + " is being compared:" + tc.Id.ToString() + ": " + callid);
                    if (tc.Id.ToString() == callid)
                    {
                        call = tc;
                        break;
                    }
                }
                if (call != null)
                {
                    log.Debug("Holding call " + callid + " from " + caller);
                    call.Hold();
                    success = true;
                }
            }
            return(success);
        }
Beispiel #2
0
 private void buttonDial_Click(object sender, EventArgs e)
 {
     startConference = false;
     timer1.Enabled  = false;
     try
     {
         if (!String.IsNullOrEmpty(_internalAgentPhone))
         {
             line = TapiApp.Lines.SingleOrDefault(q => q.Name.Contains(_internalAgentPhone));
         }
         else
         {
             line = TapiApp.Lines.SingleOrDefault(q => q.Name.Contains(comboBoxLine.Text));
         }
         if (line == null)
         {
             return;
         }
         if (!line.IsOpen)
         {
             line.Open(false, CallHandler);
         }
         line.DisconnectOnBusy = true;
         line.NoAnswerTimeout  = 15;
         ActiveCall            = line.Dial(txtPhone1.Text, false);
         string msg = String.Format("شماره گیری {0} بر روی خط '{1}'", txtPhone2.Text, line.Name);
         AddToLog(msg);
         bool completed = false;
         while (!completed)
         {
             Application.DoEvents();
             if (ActiveCall.State == TapiCallState.Connected)
             {
                 ActiveCall.Hold();
                 TapiCall consulationCall = line.Dial(txtPhone2.Text.Trim(), false);
                 while (!completed)
                 {
                     if (consulationCall.State == TapiCallState.Connected)
                     {
                         ActiveCall.CompleteTransfer(consulationCall, false);
                         ActiveCall.Disconnect();
                         completed = true;
                     }
                     else if (consulationCall.State == TapiCallState.Disconnected)
                     {
                         completed = true;
                         Application.Exit();
                     }
                 }
             }
             else if (ActiveCall.State == TapiCallState.Disconnected)
             {
                 completed = true;
                 Application.Exit();
             }
         }
     }
     catch (TapiException exc)
     {
         MessageBox.Show(exc.Message, "TapiException!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message, "Exception!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
 }
Beispiel #3
0
 private void btnHold_Click(object sender, EventArgs e)
 {
     _call.Hold();
 }