Пример #1
0
        ////Asymmetric ASM;

        //public Form1()
        //{
        //    InitializeComponent();
        //    //IDVRConnect iDVR = new IDVRConnect();
        //    //iDVR.OnCallStart += new _IIDVRCtiConnectEvents_OnCallStartEventHandler(iDVR_OnCallStart);
        //    iDVR.OnCallStart += new _IIDVRCtiConnectEvents_OnCallStartEventHandler(iDVR_OnCallStart);
        //    iDVR.OnServerDown += new _IIDVRCtiConnectEvents_OnServerDownEventHandler(iDVR_OnServerDown);
        //}

        void _objCPCC_OnCallStart(IPhoneStatus pStatus)
        {
            try
            {
                FileStream   fs    = new FileStream(@"C:\TelStratTest\logfile.log", FileMode.Append, FileAccess.Write, FileShare.Read);
                StreamWriter swrtr = new StreamWriter(fs);

                string nextline = "PortName: " + pStatus.PortFirstName + pStatus.PortLastName + "\r\n";

                //nextline += "PortMiddleName: " + pStatus.PortMiddleName + "\r\n";

                //nextline += "PortLastName: " + pStatus.PortLastName + "\r\n";

                nextline += "AgentId: " + pStatus.AgentID.ToString() + "\r\n";

                nextline += "AgentFirstName: " + pStatus.AgentFirstName.ToString() + "\r\n";

                nextline += "AgentLastName: " + pStatus.AgentLastName.ToString() + "\r\n";

                nextline += "ANI: " + pStatus.ANI.ToString() + "\r\n";

                nextline += "ChannelNumber: " + pStatus.ChannelNumber.ToString() + "\r\n";

                nextline += "Port: " + pStatus.Port.ToString() + "\r\n";

                string rem11 = System.DateTime.Today.ToShortDateString() + pStatus.PortLastName.Substring(2);
                nextline += "Remark1: " + rem11 + "\r\n"; //pStatus.Remark1 + "\r\n";


                nextline += "StartTime: " + pStatus.StartTime.ToString() + "\r\n";

                nextline += "Status: " + pStatus.Status.ToString() + "\r\n";

                nextline += "UniqueId: " + pStatus.UniqueID.ToString() + "\r\n";

                nextline += "\r\n\r\n\r\n";

                swrtr.WriteLine(nextline);

                swrtr.Close();
                j++;
                //throw new Exception("The method or operation is not implemented.");
            }
            catch (Exception ev)
            {
                MessageBox.Show("Error in FileStream: " + ev.Message.ToString());
            }

            string rem1 = System.DateTime.Today.ToShortDateString() + pStatus.PortLastName.Substring(2); //"This is rem1 test data. Time: ";
            string rem2 = System.DateTime.Now.ToShortTimeString() + pStatus.PortLastName.Substring(2);

            cstErrorCodes ec = pStatus.AddRemark(rem1, rem2);
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            cst = _objCPCC.EnableDecode(true);
            _objCPCC.GetRecentCall();
            //IRecordedCall RecCall = new IRecordedCall();
            //IRecordedCallList RecCallList = iDVR.GetRecordedCall();


            //RecordingCriteria recCrit = new RecordingCriteria();
            RecordingCriteriaList CritList = new RecordingCriteriaList();

            try
            {
                CritList = _objCPCC.GetRecordingCriteria();
                foreach (RecordingCriteria recCrit in CritList)
                {
                    //foreach (object Item in CritList)
                    //{
                    //    lBx1.Items.Add("NameOrSQLFilter:\n");
                    //    lBx1.Items.Add(recCrit.NameOrSQLSortFilter.ToString());
                    //    lBx1.Items.Add("Mask:\n");
                    //    lBx1.Items.Add(recCrit.Mask.ToString());
                    //    lBx1.Items.Add("PortFilterList:\n");
                    //    lBx1.Items.Add(recCrit.PortFilterList.ToString());
                    //    lBx1.Items.Add("DayMask:\n");
                    //    lBx1.Items.Add(recCrit.DayMask.ToString());
                    //    lBx1.Items.Add("AdministratorOwner:\n");
                    //    lBx1.Items.Add(recCrit.AdministerOwner.ToString());
                    //    lBx1.Items.Add("Remark:\n");
                    //    lBx1.Items.Add(recCrit.Remark.ToString());
                    //    lBx1.Items.Add("\n");

                    //}

                    IRecordedCallList RecCallList = _objCPCC.GetRecordedCall("Hard Disk", recCrit);
                    int cnt = RecCallList.Count;
                    int i   = 0;
                    foreach (IRecordedCall RecCall in RecCallList)
                    {
                        i++;
                        RecCall.DownloadVoiceFile("C:\\TelStratTest\\DownloadedCall" + i.ToString() + ".wav");
                        bool notDone = true;
                        while (notDone)
                        {
                            switch (RecCall.GetDownloadStatus())
                            {
                            case cstDownloadStatus.DownloadInProcess:
                                notDone = true;
                                break;

                            case cstDownloadStatus.DownloadComplete:
                                notDone = false;
                                break;

                            case cstDownloadStatus.DownloadFileNotFound:
                                notDone = false;
                                break;
                            }
                        }

                        RecCall.PlayVoiceFile("C:\\TelStratTest\\DownloadedCall" + i.ToString() + ".wav");
                    }
                }
            }
            catch (Exception ev)
            {
                MessageBox.Show("Error in 'GetRecordingCriteria': " + ev.Message.ToString());
            }
        }