Example #1
0
        private void Couplemodeclient_CallTerminatedEvent(object obj, CommandMsg msg)
        {
            SetMessage(string.Empty);
            SetNumber(string.Empty);

            if (callstate == CALL_STATES.CONNECTED)
            {
                //CallLists calllist = new CallLists();
                //curCall.Enddate = DateTime.Now;
                //calllist.modify(curCall);

                Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                {
                    if (pb.calls == null)
                        pb.calls = new CallLists();

                    curCall.Enddate = DateTime.Now;

                    try
                    {
                        pb.calls.modify(curCall);

                        CallList cl = pb.dgridCustCallList.SelectedItem as CallList;
                        if (cl == null)
                        {
                            var items = pb.dgridCustCallList.ItemsSource as CallLists;
                            cl = items.FirstOrDefault(x => x.Idx == curCall.Idx);
                        }

                        if (cl != null)
                            cl.Enddate = curCall.Enddate;

                        cl = pb.dgCallList.SelectedItem as CallList;
                        if (cl == null)
                        {
                            var items = pb.dgCallList.ItemsSource as CallLists;
                            cl = items.FirstOrDefault(x => x.Idx == curCall.Idx);
                        }

                        if (cl != null)
                            cl.Enddate = curCall.Enddate;
                    }
                    catch (FbException e)
                    {
                        util.WriteLog(e.ErrorCode, e.Message);
                    }
                }));
            }

            if (recorder != null)
            {
                recorder.Close();
                recorder.Dispose();
                recorder = null;

                IsRecording = false;
            }

            if (curCall != null) curCall = null;

            this.UIChanging(msg.status);
        }
Example #2
0
        private void Client_EnableRecordRequestOnNatSuccessEvent(object obj, CommandMsg msg)
        {
            recorder = new RTPRecorderCouple(21011, CONNECTED_MODE.NAT);

            IsRecording = true;
            this.SetMessage(Application.Current.FindResource("ISRECORDING").ToString());
        }
Example #3
0
        private void Client_EnableRecordRequestSuccessEvent(object obj, CommandMsg msg)
        {
            if (msg.status == USRSTRUCTS.STATUS_NAT_SUCCESS)
            {
                client.RecordStartRequestOnNat(curCall.Cust_Tel);
                // recorder = new RTPRecorderCouple(msg.port, CONNECTED_MODE.NAT);
            }
            else
            {
                // recorder = new RTPRecorderCouple(msg.port, CONNECTED_MODE.PUBLIC);
                recorder = new RTPRecorderCouple(CONNECTED_MODE.PUBLIC);
            }

            // recorder = new RTPRecorderCouple(msg.port, connectedmode);

            // client.RecordStartRequestOnNat(curCall.Cust_Tel);

            IsRecording = true;
            this.SetMessage(Application.Current.FindResource("ISRECORDING").ToString());
        }
Example #4
0
        private void Client_DisableRecordRequestSuccessEvent(object obj, CommandMsg msg)
        {
            if (recorder != null)
            {
                recorder.Close();
                recorder.Dispose();
                recorder = null;
            }

            IsRecording = false;
            this.SetMessage(Application.Current.FindResource("ISNOTRECORDING").ToString());
        }
Example #5
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;

            SaveIni();
            client.UnRegister();
            client.StopSocket();

            if (IsRecording)
            {
                if (recorder != null)
                {
                    recorder.Close();
                    recorder.Dispose();
                    recorder = null;
                }
            }

            if (pb != null)
                pb.SaveIni();

            e.Cancel = false;
        }