private void call2_CallStateChanged(object sender, CallStateChangedArgs e) { if (e.State == CallState.Answered) { _mediaSender.AttachToCall(_call2); _mediaReceiver.AttachToCall(_call2); StartDevices(); InvokeGUIThread(() => { btnTransfer.Visible = false; btnEnviarTransf.Visible = true; }); } else if (e.State == CallState.InCall) { StartDevices(); } if (e.State.IsCallEnded()) { _call2 = null; _mediaSender.Detach(); _mediaReceiver.Detach(); _mediaSender.AttachToCall(_call); _mediaReceiver.AttachToCall(_call); StartDevices(); InvokeGUIThread(() => { btnTransfer.Visible = true; }); } }
private void Call_CallStateChanged(object sender, CallStateChangedArgs e) { SIPCall call1 = (SIPCall)sender; if (e.State == CallState.Answered) { CallStart.Add(call1.CallID, NpgsqlTypes.NpgsqlDateTime.Now); } if (e.State == CallState.Completed) { NpgsqlTypes.NpgsqlDateTime startValue; if (CallStart.TryGetValue(call1.CallID, out startValue)) { Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("@calling_user_id", call1.CallerIDAsCaller); parameters.Add("@called_user_id", call1.DialInfo.Dialed); parameters.Add("@source_ip", call1.BasicInfo.Owner.InstanceInfo.Transport.RemoteEndPoint.ToString()); parameters.Add("@start_billing", startValue); parameters.Add("@stop_billing", NpgsqlTypes.NpgsqlDateTime.Now); parameters.Add("@call_id", call1.CallID); string command = "insert into billing (calling_user_id, called_user_id, source_ip, start_billing, stop_billing, call_id)" + "values(@calling_user_id, @called_user_id, @source_ip, @start_billing, @stop_billing, @call_id)"; _database.WriteDataToDB(command, parameters); CallStart.Remove(call1.CallID); } } }
private void call_CallStateChanged(object sender, CallStateChangedArgs e) { InvokeGUIThread(mymsg = "Call state: {0}." + e.State); if (e.State == CallState.Answered) { StartDevices(); MediaReciever.AttachToCall(PhoneCall); MediaSender.AttachToCall(PhoneCall); InvokeGUIThread(mymsg = "Call started" + e.State); } if (e.State.IsCallEnded() == true) { StopDevices(); MediaReciever.Detach(); MediaSender.Detach(); WireDownCallEvents(); PhoneCall = null; InvokeGUIThread(mymsg = "Call ended" + e.State); } }
/// <summary> /// Ggestionar cambio de estado al llamar. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void callStateChanged(object sender, CallStateChangedArgs e) { log.Info("Estado en la llamada: " + e.State); if (e.State == CallState.Answered) { startPlayer(); } }
private void Call_CallStateChanged(object sender, CallStateChangedArgs e) { if (e.State == CallState.Answered) { StartSpeaker(); call.Answer(); AttachReceiveCall(); } }
/// <summary> /// This will be called when the state of the call has changed. (eg. ringing, answered, rejected) /// </summary> private static void mySoftphone_CallStateChanged(object sender, CallStateChangedArgs e) { Console.WriteLine("Call state changed: {0}", e.State); if (e.State.IsCallEnded()) { StartToDial(); } }
void call_CallStateChanged(object sender, CallStateChangedArgs e) { OnCompleted(); // if (e.State == CallState.Answered) // _mp3Player.Start(); // else if (e.State.IsCallEnded()) // OnCompleted(); }
private void call_CallStateChanged(object sender, CallStateChangedArgs e) { switch (e.State) { case CallState.Ringing: StateChanged?.Invoke(PhoneState.Ringing); break; case CallState.InCall: StateChanged?.Invoke(PhoneState.InCall); break; default: StateChanged?.Invoke(PhoneState.Other); break; } RaiseMessage?.Invoke(e.State.ToString()); if (e.State == CallState.Answered) { if (microphone != null) { microphone.Start(); } if (speaker != null) { speaker.Start(); } mediaSender.AttachToCall(call); mediaReceiver.AttachToCall(call); return; } if (e.State.IsCallEnded()) { if (microphone != null) { microphone.Stop(); } if (speaker != null) { speaker.Stop(); } mediaSender.Detach(); mediaReceiver.Detach(); UnsubscribeFromCallEvents(sender as IPhoneCall); call = null; StateChanged?.Invoke(PhoneState.CallEnded); } }
private void AlarmCall_CallStateChanged(object sender, CallStateChangedArgs e) { var call = sender as ICall; Log.Write("Call state changed to " + e.State); if (e.State.IsCallEnded()) { call.CallStateChanged -= AlarmCall_CallStateChanged; } }
private void Call_CallStateChanged(object sender, CallStateChangedArgs e) { if (e.State == CallState.Answered) { MessageBox.Show("tra loi"); StartSpeaker(); StartMicrophone(); AttachSendCall(); AttachReceiveCall(); ConnectViewerProvider(); } }
private void call_CallStateChanged(object sender, CallStateChangedArgs e) { _message = new List <string>(); _message.Add(e.State.ToString()); StopMp3Ring(); if (e.State == CallState.Answered) { StartDevices(); _mediaReceiver.AttachToCall(_call); _mediaSender.AttachToCall(_call); //InvokeGUIThread(() => { lb_Log.Items.Add("Call started."); }); } if (e.State == CallState.InCall) { //btn_Hold.Enabled = true; //btn_Hold.Text = "Hold"; StartDevices(); } if (e.State.IsRinging()) { StartMP3Ring("Ringing.mp3"); } if (e.State == CallState.Busy) { StartMP3Ring("Busy.mp3"); } if (e.State.IsCallEnded()) { //_localHeld = false; StopDevices(); _mediaReceiver.Detach(); _mediaSender.Detach(); WireDownCallEvents(); _call = null; //InvokeGUIThread(() => { lb_Log.Items.Add("Call ended."); tb_Display.Text = string.Empty; }); } if (e.State == CallState.LocalHeld) { StopDevices(); } }
private void call_CallStateChanged(object sender, CallStateChangedArgs e) { if (e.State == CallState.Ringing && cStateDirection.Text == "In") { answerPanel.Visible = true; } else { answerPanel.Visible = false; } if (e.State == CallState.Setup || e.State == CallState.Cancelled || e.State == CallState.Busy) { caller.Text = null; cState.Text = "Dialing"; agentCurrentState.Text = "Dialing"; main.resetTimer(); infoTable.Rows.Clear(); } else if (e.State == CallState.Ringing || e.State == CallState.RingingWithEarlyMedia) { cState.Text = "Ringing"; agentCurrentState.Text = "Ringing"; main.resetTimer(); main.activateDefaultVoiceDevices(); } else if (e.State == CallState.Answered) { // web browser event ? main.activateDefaultVoiceDevices(); } else if (e.State == CallState.InCall) { cState.Text = "InCall"; agentCurrentState.Text = "InCall"; main.resetTimer(); } else if (e.State == CallState.Completed) { caller.Text = null; cState.Text = "Available"; agentCurrentState.Text = "Available"; main.resetTimer(); infoTable.Rows.Clear(); } else if (e.State == CallState.LocalHeld) { cState.Text = "Hold"; agentCurrentState.Text = "Hold"; main.resetTimer(); } }
/// <summary> /// This will be called when the state of the call has changed. (eg. ringing, answered, rejected) /// </summary> private static void mySoftphone_CallStateChanged(object sender, CallStateChangedArgs e) { Console.WriteLine("Call state changed: {0}", e.State); if (e.State.IsCallEnded()) { StartToDial(); } if (e.State == CallState.Error) { Console.WriteLine("Call error occured. {0}", e.Reason); } }
private void call_CallStateChanged(object sender, CallStateChangedArgs e) { if (e.State == CallState.Answered) { //player.Stop(); StartDevices(); _mediaReceiver.AttachToCall(frmSipAccount._call); _mediaSender.AttachToCall(frmSipAccount._call); AsynThread(() => { lb_Log.Items.Add("Call started."); }); } if (e.State == CallState.InCall) { //isCalling = false; player.Stop(); StartDevices(); } if (e.State.IsCallEnded()) { StopDevices(); _mediaReceiver.Detach(); _mediaSender.Detach(); UnSubcribeCallEvents(); } if (e.State == CallState.LocalHeld) { AsynThread(() => { lb_Log.Items.Add("Call Hold."); }); StopDevices(); } if (e.State == CallState.Ringing) { AsynThread(() => { //if (isCalling) // playSound(calling); //else playSound(ringing); }); } DispatchAsync(() => { var handler = CallStateChanged; if (handler != null) { handler(this, e); } }); }
void mySoftphone_CallStateChanged(object sender, CallStateChangedArgs e) { InvokeGUIThread(() => { textBox1.Text += "Call state changed:" + e.State; }); if (e.State.IsCallEnded()) { StartToDial(); } /* * if (e.State == CallState.Answered && exampleSteps == "Calling") * { * exampleSteps = "Held"; * mySoftphone.HoldCall(); * InvokeGUIThread(() => { log.Text += "\nThe call is: " + exampleSteps + " by the user!"; }); * } * * if (e.State == CallState.LocalHeld) * { * exampleSteps = "Unheld"; * Console.WriteLine("\nPress any key to take the call off hold."); * Console.ReadKey(); * InvokeGUIThread(() => { log.Text += "\nThe call is: " + exampleSteps + " by the user!"; }); * mySoftphone.HoldCall(); * } * * if (e.State == CallState.InCall && exampleSteps == "Unheld") * { * exampleSteps = "HangedUp"; * InvokeGUIThread(() => { log.Text += "\nThe call is: " + exampleSteps + " by the user!"; }); * mySoftphone.HangUp(); * } * * if (e.State == CallState.Completed && exampleSteps == "HangedUp") * { * exampleSteps = "Redialed"; * Console.WriteLine("\nPress any key to redial."); * Console.ReadKey(); * InvokeGUIThread(() => { log.Text += "\nThe call is: " + exampleSteps + " by the user!"; }); * mySoftphone.StartCall(numberToCall); * } * * * if (e.State == CallState.Answered && exampleSteps == "Redialed") * { * exampleSteps = "Transfering"; * mySoftphone.TransferTo(numberToTransfer); * InvokeGUIThread(() => { log.Text += "\nThe call is: " + exampleSteps + " by the user!"; }); * }*/ }
static void call_CallStateChanged(object sender, CallStateChangedArgs e) { //Console.WriteLine("Call state: {0}.", e.State); //labell7.Text = ""+ e.State; labell7.Invoke(new MethodInvoker(delegate { labell7.Text = "" + e.State; })); if (e.State == CallState.Answered) { SetupDevices(); } if (e.State.IsCallEnded()) { CloseDevices(); } }
private void OutgoingCallStateChanged(object sender, CallStateChangedArgs e) { if (e.State == CallState.Answered) { PlayMsg(); } else if (e.State.IsCallEnded()) { var handler = Completed; if (handler != null) { handler(this, EventArgs.Empty); } } }
private void call_CallStateChanged(object sender, CallStateChangedArgs e) { if (e.State == CallState.Answered)//rozmowa odebrana { SetupDevices(); } else if (e.Reason == "INVITE timed out") //użytkownik nie odebrał { stoper.Stop(); //stoper odpowiadający za "dzwonię...." Status_TextBlock.Dispatcher.Invoke(() => { ZakonczRozmowe_Button.IsEnabled = false; Status_TextBlock.Text = "Status: Użytkownik nie odpowiada."; }); } else if (e.State.IsCallEnded())//rozmowa zakończona { CloseDevices(); call = null; Status_TextBlock.Dispatcher.Invoke(() => { Status_TextBlock.Text = "Status: Online, teraz można rozpocząć rozmowę"; }); } else if (e.State.IsInCall()) { Status_TextBlock.Dispatcher.Invoke(() => { Status_TextBlock.Text = "Status: w trakcie rozmowy z użytkownikiem " + call.OtherParty.UserName; }); } else if (e.Reason == "Dialing")//trwa nawiązywanie połączenia { uplynelo_sekund = 0; stoper = new System.Windows.Threading.DispatcherTimer(); stoper.Interval = TimeSpan.FromMilliseconds(500); stoper.Tick += ((object sender2, EventArgs e2) => { uplynelo_sekund++; Status_TextBlock.Dispatcher.Invoke(() => { Status_TextBlock.Text = "Status: Dzownię"; for (int i = 0; i < uplynelo_sekund % 6; i++) { Status_TextBlock.Text += "."; } }); }); stoper.Start(); } else { Status_TextBlock.Dispatcher.Invoke(() => { Status_TextBlock.Text = "Status: " + e.State + ", " + e.Reason; }); } }
public void call_CallStateChanged(object sender, CallStateChangedArgs e) { if (e.State == CallState.Completed) { Console.WriteLine("zakonczono rozmowe"); } if (e.State == CallState.Answered) { //SetupMp3Player(); SetupDevices(); } if (e.State.IsCallEnded()) { CloseDevices(); } }
private void call_CallStateChanged(object sender, CallStateChangedArgs e) { InvokeGUIThread(() => { lb_Log.Items.Add("Callstate changed." + e.State.ToString()); tb_Display.Text = e.State.ToString(); }); if (e.State == CallState.Answered) { btn_Hold.Enabled = true; btn_Hold.Text = "Hold"; StartDevices(); mediaReceiver.AttachToCall(call); mediaSender.AttachToCall(call); InvokeGUIThread(() => { lb_Log.Items.Add("Call started."); }); } if (e.State == CallState.InCall) { btn_Hold.Enabled = true; btn_Hold.Text = "Hold"; StartDevices(); } if (e.State.IsCallEnded() == true) { localHeld = false; StopDevices(); mediaReceiver.Detach(); mediaSender.Detach(); WireDownCallEvents(); call = null; InvokeGUIThread(() => { lb_Log.Items.Add("Call ended."); tb_Display.Text = string.Empty; }); } if (e.State == CallState.LocalHeld) { StopDevices(); } }
void call_CallStateChanged(object sender, CallStateChangedArgs e) { call = sender as IPhoneCall; if (e.State == CallState.Answered) { channelList[whichChannel].conferenceRoom.AddToConference(call); channelList[whichChannel].addUser(new User(temp_name, call.CallID)); Console.WriteLine(temp_name + " added to channel: " + whichChannel); buildChannelMessageInfo(); database.AddUserToChannel(temp_name, channelList[whichChannel].GetName()); } else if (e.State.IsCallEnded()) { channelList[whichChannel].conferenceRoom.RemoveFromConference(call); //channelList[whichChannel].remUser(call.CallID); Console.WriteLine(temp_name + " removed from channel: " + whichChannel); } }
private void _call_CallStateChanged(object sender, CallStateChangedArgs e) { var handler = CallStateChanged; if (handler != null) handler(sender, e); if (e.State.IsCallEnded()) { if (Call != null) { Call.CallStateChanged -= _call_CallStateChanged; _videoSender.Detach(); _audioSender.Detach(); _connector.Dispose(); Call = null; } } }
static void call_CallStateChanged(object sender, CallStateChangedArgs e) { Status.Invoke(new MethodInvoker(delegate { Status.Text = e.State.ToString(); })); if (e.State == CallState.Completed) { MessageBox.Show("Zakończono rozmowę"); } if (e.State == CallState.Answered) { SetupDevices(); } if (e.State.IsCallEnded()) { CloseDevices(); } }
static void call_CallStateChanged(object sender, CallStateChangedArgs e) { Console.WriteLine("Call state: {0}.", e.State); if (e.State == CallState.Completed) { MessageBox.Show("Zakończono rozmowę"); } if (e.State == CallState.Answered) { SetupDevices(); } if (e.State.IsCallEnded()) { CloseDevices(); } }
void call_CallStateChanged(object sender, CallStateChangedArgs e) { Console.WriteLine("Call state: {0}.", e.State); Invoke((MethodInvoker) delegate { infoTxt.Text = infoTxt.Text + ("Call state:" + e.State.ToString()) + "\r\n"; }); if (e.State == CallState.Answered) { SetupDevices(); } if (e.State.IsCallEnded()) { CloseDevices(); } }
void call_CallStateChanged(object sender, CallStateChangedArgs e) { InvokeGUIThread(() => { lbl_CallState.Text = e.State.ToString(); }); if (e.State == CallState.Answered) { StartDevices(); _mediaSender.AttachToCall(_call); _mediaReceiver.AttachToCall(_call); InvokeGUIThread(() => { tb_Display.Text = "In call with: " + ((IPhoneCall)sender).DialInfo.Dialed; }); } else if (e.State == CallState.InCall) { StartDevices(); } if (e.State == CallState.LocalHeld || e.State == CallState.InactiveHeld) { StopDevices(); InvokeGUIThread(() => { btn_Hold.Text = "Unhold"; }); } else { InvokeGUIThread(() => { btn_Hold.Text = "Hold"; }); } if (e.State.IsCallEnded()) { StopDevices(); _mediaSender.Detach(); _mediaReceiver.Detach(); WireDownCallEvents(); _call = null; InvokeGUIThread(() => { tb_Display.Text = String.Empty; }); ClearUserInfos(); } }
private void SingleCall_CallStateChanged(object sender, CallStateChangedArgs e) { var call = sender as ICall; if (call == null) { return; } Log.Write("Call state changed to " + e.State); CurrentCallState = call.CallState; if (call.CallState.IsCallEnded()) { DisconnectFromCall(); call.CallStateChanged -= SingleCall_CallStateChanged; Call = null; } }
private void _call_CallStateChanged(object sender, CallStateChangedArgs e) { var handler = CallStateChanged; if (handler != null) { handler(sender, e); } if (e.State.IsCallEnded()) { if (Call != null) { Call.CallStateChanged -= _call_CallStateChanged; _videoSender.Detach(); _audioSender.Detach(); _connector.Dispose(); Call = null; } } }
/// <summary> /// This will be called when the state of the call call has changed. /// </summary> /// <remarks> /// In this sample only three states will be handled: Answered, InCall, Ended, LocalHeld /// /// Answered: when the call has been answered, the audio devices will be started and attached to the call. /// It is required to comminicate with the other party and hear them. /// The devices are connected at softphone initialization time, /// so no need to connect them every time when a call is being answered. /// /// InCall: when the call is in an active state, the audio deveices will be started. /// /// LocalHeld: the call is locall on hold, the audio devices will be stopped. /// /// Ended: when the call ends, the audio devices will be stopped and detached from the call. /// </remarks> private void call_CallStateChanged(object sender, CallStateChangedArgs e) { // the call has been answered if (e.State == CallState.Answered) { //StartDevices(); //ConnectMedia(); } // the call is in active communication state // IMPORTANT: this state can occur multiple times. for example when answering the call or the call has been taken off hold. if (e.State == CallState.InCall) { // StartDevices(); } // the call has ended if (e.State.IsCallEnded()) { if (_call != null) { CallFinished(); } } // when the call is locally on hold, stop the audio devices if (e.State == CallState.LocalHeld) { StopDevices(); } DispatchAsync(() => { var handler = CallStateChanged; if (handler != null) { handler(this, e); } }); }
private void SoftphoneOnCallStateChanged(object sender, CallStateChangedArgs e) { lock (_lockObj) { if (e.State == CallState.InCall || e.State == CallState.Answered) { SetPhoneStatus(PhoneStatus.InCall, PhoneState.OtherUserId); } else if (e.State.IsOneOf(CallState.Forwarding, CallState.Queued, CallState.Ringing, CallState.Transferring)) { if (PhoneState.Status != PhoneStatus.IncomingCall) { SetPhoneStatus(PhoneStatus.Calling, PhoneState.OtherUserId); } } else { SetPhoneStatus(PhoneStatus.Registered, null); } } }
/// <summary> /// Occurs when the phone call state has changed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void call_CallStateChanged(object sender, CallStateChangedArgs e) { Console.WriteLine("Call state changed: " + e.State); switch (e.State) { case CallState.InCall: ConnectDevicesToCall(); break; case CallState.Completed: DisconnectDevicesFromCall(); WireDownCallEvents(); call = null; break; case CallState.Cancelled: WireDownCallEvents(); call = null; break; } }
void call_CallStateChanged(object sender, CallStateChangedArgs e) { message = "Call state: " + e.State; if (e.State == CallState.Answered) { try { TextToSpeech TTS = new TextToSpeech(); mediaSender.AttachToCall(call); connector.Connect(TTS, mediaSender); TTS.AddAndStartText("Hello World!"); //call.BlindTransfer("**13000"); //message = "Transfered"; } catch(Exception e1) { message = e1.ToString(); } } if (e.State == CallState.InCall) { message = "InCall"; } if (e.State == CallState.Transferring) { message = "Transferring"; } if (e.State == CallState.Ringing) { message = "Ringing"; } if (e.State == CallState.Completed) { message = "Completed"; done =1; } }
private void SingleCall_CallStateChanged(object sender, CallStateChangedArgs e) { var call = sender as ICall; if (call == null) return; Log.Write("Call state changed to " + e.State); CurrentCallState = call.CallState; if (call.CallState.IsCallEnded()) { DisconnectFromCall(); call.CallStateChanged -= SingleCall_CallStateChanged; Call = null; } }
/// <summary> /// This will be called when the state of a call has changed. /// </summary> private void Call_CallStateChanged(object sender, CallStateChangedArgs e) { IPhoneCall call = sender as IPhoneCall; if (call == null) return; CallState state = e.State; OnPhoneCallStateChanged(call); CheckStopRingback(); CheckStopRingtone(); lock (_sync) { // start ringtones if (state.IsRinging()) { if (call.IsIncoming) MediaHandlers.StartRingtone(); else MediaHandlers.StartRingback(); return; } // call has been answered if (state == CallState.Answered) { return; } // attach media to the selected call when the remote party sends media data if (state.IsRemoteMediaCommunication()) { if (SelectedCall.Equals(call)) { MediaHandlers.AttachAudio(call); MediaHandlers.AttachAudio(call); } return; } // detach media from the selected call in hold state or when the call has ended if (state == CallState.LocalHeld || state == CallState.InactiveHeld || state.IsCallEnded()) { if (SelectedCall.Equals(call)) { MediaHandlers.DetachAudio(); } } // call has ended, clean up if (state.IsCallEnded()) { DisposeCall(call); CallHistory.Add(call); PhoneCalls.Remove(call); return; } } }