/// <summary> /// It starts a call with the dialed number or in case of an incoming call it accepts, picks up the call. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonPickUp_Click(object sender, EventArgs e) { if (inComingCall) { inComingCall = false; call.Accept(); return; } if (call != null) return; if (string.IsNullOrEmpty(_TelefonNo)) return; if (phoneLineInformation != PhoneLineState.RegistrationSucceeded && phoneLineInformation != PhoneLineState.NoRegNeeded) { MessageBox.Show("Phone line state is not valid!"); return; } call = softPhone.CreateCallObject(phoneLine, _TelefonNo); WireUpCallEvents(); call.Start(); }
private void _btnPhone_Click(object sender, EventArgs e) { if (!_callState.HasValue || _callState.Value == CallState.Completed) { FormHelper.ValidateCondition(SipUtil.IsSipUri(_txtToUri.Text), "To-uri"); _outgoingCall = _softPhone.CreateCall(); WireEvents(_outgoingCall); _outgoingCall.Start(_txtToUri.Text); Log("Call started"); } else if (_callState.Value == CallState.Ringing) { _incomingCall.Accept(); } else if (_callState.Value == CallState.Ringback || _callState.Value == CallState.InCall) { _outgoingCall.Stop(); } }