Esempio n. 1
0
 void call_StateChanged(object sender, CallStateChangedEventArgs args)
 {
     if (args.State == CallState.Terminated)
     {
         // call removed
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Im call state changed event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ImCallStateChanged(object sender, CallStateChangedEventArgs e)
        {
            InstantMessagingCall imCall = sender as InstantMessagingCall;

            if (e.State == CallState.Terminated)
            {
                this.UnregisterIMcallEventHandlers(imCall);
            }
        }
Esempio n. 3
0
 private void Call_StateChanged(Call sender, CallStateChangedEventArgs args)
 {
     switch (args.NewState)
     {
     case CallState.Disconnected:
         RemoveIncomingOrActiveCallToastNotifications();
         sender.StateChanged -= Call_StateChanged;
         RefreshCallNotification();
         break;
     }
 }
Esempio n. 4
0
 private void ServiceChannelCallStateChanged(object sender, CallStateChangedEventArgs e)
 {
     if (e.State == CallState.Terminating)
     {
         this.Shutdown();
     }
     else if (e.State == CallState.Terminated)
     {
         this.UnregisterServiceCallHandlers();
     }
 }
Esempio n. 5
0
        private void HandleCallStateChanged(object sender, CallStateChangedEventArgs e)
        {
            if ((e.State == CallState.Established) || (e.State == CallState.Establishing))
            {
                SetButtonEnabledState(hangupCallButton, true);
            }
            else
            {
                SetButtonEnabledState(hangupCallButton, false);
            }
            if (!callEventsCB.Checked)
            {
                return;
            }

            AddResultStringToOutput("\n Underlying Call state changed. From: " + e.PreviousState.ToString()
                                    + " To: " + e.State.ToString() + ".");
            AddResultStringToOutput("\n Reason for state change: " + e.TransitionReason.ToString());
        }
Esempio n. 6
0
 private void CallOnStateChanged(object sender, CallStateChangedEventArgs e) {
     switch (_state) {
         case ZMachineSessionState.InitialMessage:
             break;
         case ZMachineSessionState.PickGame:
             break;
         case ZMachineSessionState.PlayingGame:
             if (e.State == CallState.Terminated) {
                 //AddInput("save");
                 //AddInput("quit");
                 //AddInput("y");
                 ZMachineHub.SendQuit(ID);
                 Task.Delay(3000).ContinueWith(task => _engine.Dispose());
             }
             break;
         case ZMachineSessionState.Quiting:
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Esempio n. 7
0
        // Handler for the StateChanged event on the outbound call.
        void outboundAVCall_StateChanged(object sender, CallStateChangedEventArgs e)
        {
            Console.WriteLine("Outbound call - state change.\nPrevious state: "
                              + e.PreviousState + "\nCurrent state: " + e.State
                              + "\nTransitionReason: " + e.TransitionReason + "\n");
            if (e.TransitionReason == CallStateTransitionReason.TerminatedRemotely)
            {
                // If one call has been terminated remotely, unregister for
                // notification of the StateChanged event.
                _inboundAVCall.StateChanged  -= inboundAVCall_StateChanged;
                _outboundAVCall.StateChanged -= outboundAVCall_StateChanged;
                _outboundAVCall.BeginTerminate(TerminateCallCB, _outboundAVCall);

                if (_inboundAVCall != null)
                {
                    Console.WriteLine("Terminating the inbound call...");
                    _inboundAVCall.BeginTerminate(TerminateCallCB, _inboundAVCall);
                }

                FinishShutdown();
            }
        }
Esempio n. 8
0
 private async Task SaveCallIntoHistory(Call call, CallStateChangedEventArgs args)
 {
     PhoneCallHistoryEntry historyEntry = new PhoneCallHistoryEntry()
     {
         IsIncoming         = call.Direction == CallDirection.Incoming,
         IsMissed           = args.OldState == CallState.Incoming,
         IsSeen             = args.OldState != CallState.Incoming,
         OtherAppReadAccess = PhoneCallHistoryEntryOtherAppReadAccess.Full,
         StartTime          = call.StartTime ?? DateTimeOffset.Now,
         Duration           = call.EndTime - call.StartTime,
         Media             = PhoneCallHistoryEntryMedia.Audio,
         IsCallerIdBlocked = false,
         IsEmergency       = false,
         IsRinging         = false,
         IsSuppressed      = false,
         IsVoicemail       = call.field_BF0.HasFlag(PH_CALL_INFO_field_BF0.VoicemailCall),
         RemoteId          = call.Line?.Transport + "|" + call.Line?.Transport switch
         {
             PhoneLineTransport.Cellular => call.Line.Id.ToString(),
             PhoneLineTransport.VoipApp => call.OwningApplication.PackageFamilyName,
             PhoneLineTransport.Bluetooth => call.Line.TransportDeviceId,
             _ => "Unknown"
         },
        void AudioVideoCall_StateChanged(object sender, CallStateChangedEventArgs e)
        {
            Call call = sender as Call;

            //Call participants allow for disambiguation.
            NonBlockingConsole.WriteLine("The AudioVideo call with Local Participant: " + call.Conversation.LocalParticipant +
                " and Remote Participant: " + call.RemoteEndpoint.Participant +
                " has changed state. The previous call state was: " + e.PreviousState +
                " and the current state is: " + e.State);

            Message m = new Message("The AudioVideo call with Local Participant: " + call.Conversation.LocalParticipant +
                " and Remote Participant: " + call.RemoteEndpoint.Participant +
                " has changed state. The previous call state was: " + e.PreviousState +
                " and the current state is: " + e.State,
                MessageType.Audio,
                _transcriptRecorder.Conversation.Id);
            _transcriptRecorder.OnMessageReceived(m);

            if ((e.State == CallState.Terminating)
                || (e.State == CallState.Terminated))
            {
                NonBlockingConsole.WriteLine("Shutting down AVTranscriptRecorder");
                _waitForAudioVideoCallTerminated.Set();
                this.Shutdown();
            }

            // call top level event handler
            if (_audioVideoCallStateChangedEventHandler != null)
            {
                _audioVideoCallStateChangedEventHandler(sender, e);
            }
        }
 private void OnCallStateChanged(object sender, CallStateChangedEventArgs e)
 {
     _logger.Log("Call state changed to {0}", e.State);
 }
Esempio n. 11
0
 // Handles the StateChanged event on the incoming audio-video call.
 void AudioVideoCall_StateChanged(object sender, CallStateChangedEventArgs e)
 {
     Console.WriteLine("Previous call state: " + e.PreviousState + "\nCurrent state: " + e.State);
 }
Esempio n. 12
0
        private async void Call_StateChanged(Call sender, CallStateChangedEventArgs args)
        {
            switch (args.NewState)
            {
            case CallState.Disconnected:
                switch (args.OldState)
                {
                case CallState.Incoming:
                    App.Current.ToastNotifier.Show(App.Current.CreateMissedCallToastNotification(sender));
                    PhoneCallHistoryEntry missedCall = new PhoneCallHistoryEntry()
                    {
                        Address = new PhoneCallHistoryEntryAddress()
                        {
                            DisplayName    = sender.Name,
                            RawAddress     = sender.Number,
                            RawAddressKind = PhoneCallHistoryEntryRawAddressKind.PhoneNumber
                        },
                        IsIncoming         = true,
                        IsMissed           = true,
                        Media              = PhoneCallHistoryEntryMedia.Audio,
                        OtherAppReadAccess = PhoneCallHistoryEntryOtherAppReadAccess.Full,
                        //SourceId = sender.Line.Id.ToString(),
                        //SourceIdKind = PhoneCallHistorySourceIdKind.CellularPhoneLineId,
                        StartTime = sender.EndTime ?? DateTimeOffset.Now,
                    };
                    await App.Current.CallHistoryStore.SaveEntryAsync(missedCall);

                    goto default;

                case CallState.Dialing:
                case CallState.OnHold:
                case CallState.ActiveTalking:
                    PhoneCallHistoryEntry call = new PhoneCallHistoryEntry()
                    {
                        Address = new PhoneCallHistoryEntryAddress()
                        {
                            DisplayName    = sender.Name,
                            RawAddress     = sender.Number,
                            RawAddressKind = PhoneCallHistoryEntryRawAddressKind.PhoneNumber
                        },
                        IsSeen             = true,
                        IsIncoming         = sender.Direction == CallDirection.Incoming,
                        Duration           = sender.EndTime - sender.StartTime,
                        Media              = PhoneCallHistoryEntryMedia.Audio,
                        OtherAppReadAccess = PhoneCallHistoryEntryOtherAppReadAccess.Full,
                        //SourceId = sender.Line.Id.ToString(),
                        //SourceIdKind = PhoneCallHistorySourceIdKind.CellularPhoneLineId,
                        StartTime = sender.StartTime ?? DateTimeOffset.Now,
                    };
                    await App.Current.CallHistoryStore.SaveEntryAsync(call);

                    goto default;

                default:
                    switch (args.StateReason)
                    {
                    default:
                        sender.StateChanged -= Call_StateChanged;
                        break;
                    }
                    break;
                }
                break;
            }
        }