Esempio n. 1
0
        /// <summary>
        /// 保存录音文件
        /// </summary>
        /// <param name="callRecord"></param>
        /// <param name="fileName"></param>
        /// <param name="amrBytes"></param>
        /// <returns></returns>
        public async Task <SimplyResult <Guid> > SaveFileAsync(CallRecord callRecord, string fileName, byte[] amrBytes)
        {
            Requires.NotNull(callRecord, nameof(callRecord));
            Requires.NotNullOrEmpty(fileName, nameof(fileName));

            if (!amrBytes?.Any() ?? true)
            {
                return(SimplyResult.Fail(nameof(Errors.EmptyFile), Errors.EmptyFile, Guid.Empty));
            }

            var amrName = $"{callRecord.Id}_{fileName}";
            var mp3Name = $"{callRecord.Id}.mp3";
            var amrPath = Path.Combine(Paths.FFmpegFolder, amrName);
            var mp3Path = Path.Combine(Paths.FFmpegFolder, mp3Name);

            await File.WriteAllBytesAsync(amrPath, amrBytes);

            m_FFmpeg.Instance.Convert(amrName, mp3Name);

            if (File.Exists(mp3Path))
            {
                var mp3Bytes = await File.ReadAllBytesAsync(mp3Path);

                if (mp3Bytes?.Any() ?? false)
                {
                    return(await UploadFileServerAsync(mp3Bytes, "mp3"));
                }
            }

            return(SimplyResult.Fail(nameof(Errors.ConvertFileError), Errors.ConvertFileError, Guid.Empty));
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Записать на диагностику?", "Диагностика", MessageBoxButtons.YesNoCancel);

            if (res == DialogResult.Yes)
            {
                SendToDiagnostic sd = new SendToDiagnostic();
                sd.rec = new CallRecord(DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), UserName.Text, Phone.Text, TechType.Text, Brand.Text, "NONE", Reason.Text, ApplicationStatus.RecordedAtDiagnostic);
                sd.Show();
                this.Close();
            }
            if (res == DialogResult.No)
            {
                DialogResult res2 = MessageBox.Show("Записать на прозвон?", "Прозвон", MessageBoxButtons.YesNoCancel);
                if (res2 == DialogResult.Yes)
                {
                    CallRegistrationForm CRF = new CallRegistrationForm();
                    CRF.Show();
                    CRF.rec = new CallRecord(DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), UserName.Text, Phone.Text, TechType.Text, Brand.Text, "NONE", Reason.Text, ApplicationStatus.OnReCall);
                    this.Close();
                }
                if (res2 == DialogResult.No)
                {
                    CallRecord rec = new CallRecord(DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), UserName.Text, Phone.Text, TechType.Text, Brand.Text, "NONE", Reason.Text, ApplicationStatus.Accepted);
                    rec.SetInDatabase();
                    this.Close();
                }
            }
        }
Esempio n. 3
0
        public void SetRecord(CallRecord record)
        {
            _isLoading = true;
            _record = record;
            panel1.Enabled = _reminderCheckBox.Checked = !_record.WasNotified;

            int dayValue = (int)(_record.NotifyDate.Date.Subtract(_record.DueDate.Date)).TotalDays;
            int timeValue = (int)_record.NotifyDate.TimeOfDay.TotalMinutes;

            foreach (KVP<string, int> item in _reminderDayComboBox.Items)
            {
                if (item.Value == dayValue)
                {
                    _reminderDayComboBox.SelectedItem = item;
                    break;
                }
            }
            foreach (KVP<string, int> item in _reminderTimeComboBox.Items)
            {
                if (item.Value == timeValue)
                {
                    _reminderTimeComboBox.SelectedItem = item;
                    break;
                }
            }
            _isLoading = false;
        }
Esempio n. 4
0
        /// <summary>
        /// 创建或者更新电话记录
        /// </summary>
        /// <param name="callRecord">电话记录</param>
        /// <returns></returns>
        public bool CreateOrUpdateCallRecord(CallRecord callRecord)
        {
            int result = 0;

            result = ExecuteUpdate("CreateOrUpdateCallRecord", callRecord);
            return(result > 0);
        }
Esempio n. 5
0
        private void GetCall()
        {
            string reception = UdpReceiverClass.ReceivedMessage;

            // ------------------------------------------------------------------------

            CallRecord cRecord = new CallRecord(UdpReceiverClass.ReceivedMessage);

            if (!cRecord.IsValid)
            {
                return;
            }
            if (IsDuplicate(cRecord))
            {
                return;
            }

            string log_id = GetNewLogID(cRecord);

            // Add to log
            AddToCallLog(cRecord, log_id);

            // POST TO CLOUD
            PostCallToCloud(cRecord, log_id);
        }
Esempio n. 6
0
        public void AddRecord(CallRecordItem item)
        {
            item.GetValidationErrors().ThrowIfHasErrors();

            var dbItem = new CallRecord();

            if (item.Id != 0)
            {
                dbItem = Db.CallRecords.Single(x => x.Id == item.Id);
            }
            else
            {
                dbItem.DateCreate = DateTime.Now;
                Db.CallRecords.Add(dbItem);
            }

            dbItem.DateModify = DateTime.Now;
            dbItem.Content    = item.Content;
            dbItem.PhoneId    = item.PhoneId;

            Db.SaveChanges();

            var companyId = Db.Companies.Single(x => x.Phones.Any(p => p.Id == item.PhoneId)).Id;

            this.App.Company.RefreshDateModify(companyId);

            item.Id = dbItem.Id;
        }
Esempio n. 7
0
        /// <summary>
        /// 创建或者更新电话记录
        /// </summary>
        /// <param name="callRecord">电话记录</param>
        /// <returns></returns>
        public bool CreateOrUpdateCallRecord(CallRecord callRecord)
        {
            string json = JsonConvert.SerializeObject(callRecord);

            byte[] jsonByte = Encoding.UTF8.GetBytes(json);

            int cByte = ParamFieldLength.PACKAGE_HEAD + jsonByte.Length;

            byte[] sendByte   = new byte[cByte];
            int    byteOffset = 0;

            Array.Copy(BitConverter.GetBytes((int)Command.ID_CREATE_CALLRECORD), sendByte, BasicTypeLength.INT32);
            byteOffset = BasicTypeLength.INT32;
            Array.Copy(BitConverter.GetBytes(cByte), 0, sendByte, byteOffset, BasicTypeLength.INT32);
            byteOffset += BasicTypeLength.INT32;
            Array.Copy(jsonByte, 0, sendByte, byteOffset, jsonByte.Length);
            byteOffset += jsonByte.Length;

            bool result = false;

            using (SocketClient socket = new SocketClient(ConstantValuePool.BizSettingConfig.IPAddress, ConstantValuePool.BizSettingConfig.Port))
            {
                Byte[] receiveData = null;
                Int32  operCode    = socket.SendReceive(sendByte, out receiveData);
                if (operCode == (int)RET_VALUE.SUCCEEDED)
                {
                    result = true;
                }
                socket.Close();
            }
            return(result);
        }
Esempio n. 8
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (IsChanged)
     {
         Record                = new CallRecord();
         Record.ID             = ID;
         Record.Date           = DateBox.Text;
         Record.Time           = TimeBox.Text;
         Record.Name           = NameBox.Text;
         Record.Phone          = PhoneBox.Text;
         Record.Type           = "None";
         Record.Brand          = "None";
         Record.Reason         = ReasonBox.Text;
         Record.Status         = CallRecord.StringToStatus(StatusBox.Text);
         Record.RecallDate     = RecallBox.Text;
         Record.DiagnosticDate = DiagnosticBox.Text;
         if (MySQLWork.GetInstance().UpdateRecord(Record))
         {
             MessageBox.Show("Запись обновлена");
             this.Close();
         }
         else
         {
             MessageBox.Show("Ошибка сохранения, сделай скрин ошибки и пришли (в следующий раз)");
         }
     }
     else
     {
         MessageBox.Show("Изменений нет");
     }
 }
Esempio n. 9
0
        private void btnIgnore_Click(object sender, EventArgs e)
        {
            int  status    = 2; //忽略
            bool hasChange = false;

            foreach (DataGridViewRow dgvRow in dgvCallRecord.Rows)
            {
                if ((bool)dgvRow.Cells[0].Value)
                {
                    CallRecord callRecord = new CallRecord();
                    callRecord.CallRecordID = new Guid(dgvRow.Cells[4].Value.ToString());
                    callRecord.Status       = status;
                    hasChange = CustomersService.GetInstance().CreateOrUpdateCallRecord(callRecord);
                }
            }
            if (hasChange)
            {
                status = 0; //未接来电
                IList <CallRecord> callRecordList = CustomersService.GetInstance().GetCallRecordByStatus(status);
                if (callRecordList != null && callRecordList.Count > 0)
                {
                    dgvCallRecord.Rows.Clear();
                    foreach (CallRecord item in callRecordList)
                    {
                        int index = dgvCallRecord.Rows.Add();
                        dgvCallRecord.Rows[index].Cells[0].Value = false;
                        dgvCallRecord.Rows[index].Cells[1].Value = item.Telephone;
                        dgvCallRecord.Rows[index].Cells[2].Value = item.CustomerName;
                        dgvCallRecord.Rows[index].Cells[3].Value = item.CallTime.ToString("yyyy-MM-dd HH:mm");
                        dgvCallRecord.Rows[index].Cells[4].Value = item.CallRecordID;
                    }
                }
            }
        }
Esempio n. 10
0
        public ModelInvokeResult <CallRecordPK> Update(string strId, CallRecord callRecord)
        {
            ModelInvokeResult <CallRecordPK> result = new ModelInvokeResult <CallRecordPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();

                statements.Add(new IBatisNetBatchStatement {
                    StatementName = callRecord.GetUpdateMethodName(), ParameterObject = callRecord.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new CallRecordPK {
                    Id = int.Parse(strId)
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Esempio n. 11
0
        private void UntargetedCall_Click(object sender, EventArgs e)
        {
            CallRecord rec = new CallRecord(DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), UserName.Text, Phone.Text, TechType.Text, Brand.Text, "NONE", Reason.Text, ApplicationStatus.WrongCall);

            rec.SetInDatabase();
            //fc.SwitchForm(fc.mainForm);
            this.Close();
        }
Esempio n. 12
0
        public CallNodeModel(FrameDetailViewModel owner, PerfNodeStats node, CallRecord stats, int nodeIndex)
            : this(owner) {
            MergedStats     = node;
            CallRecordIndex = nodeIndex;

            InclTime = stats.TimeMS;
            ExclTime = stats.ExclusiveTimeMS;
            Calls    = stats.CallCount;
        }
Esempio n. 13
0
        public async Task <ActionResult> DeleteConfirmed(long id)
        {
            CallRecord callRecord = await db.CallRecords.FindAsync(id);

            db.CallRecords.Remove(callRecord);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 14
0
        public async Task CreateAsync(CallRecord callRecord)
        {
            Requires.NotNull(callRecord, nameof(callRecord));

            callRecord.CreatorId = callRecord.OwnerId;
            callRecord.UpdaterId = callRecord.OwnerId;

            await m_CallRecordRepository.Instance.CreateAsync(callRecord);
        }
Esempio n. 15
0
        private void PostCallToCloud(CallRecord cRecord, string log_id)
        {
            string ln = cRecord.Line.ToString();

            if (ln.Length == 1)
            {
                ln = "0" + ln;
            }
            string dur = cRecord.Duration.ToString();

            while (dur.Length < 4)
            {
                dur = "0" + dur;
            }

            string url = rbUseSuppliedUrl.Checked ? tbSuppliedURL.Text : tbGeneratedURL.Text;

            int hour = int.Parse(cRecord.DateTime.Hour.ToString());

            if (hour > 12)
            {
                hour = hour - 12;
            }
            if (hour == 0)
            {
                hour = 12;
            }
            string formattedTime = cRecord.DateTime.Month.ToString().PadLeft(2, '0') + "/" + cRecord.DateTime.Day.ToString().PadLeft(2, '0') + " " +
                                   hour.ToString().PadLeft(2, '0') + ":" + cRecord.DateTime.Minute.ToString().PadLeft(2, '0') + " " + cRecord.DateTime.ToString("tt", CultureInfo.InvariantCulture);

            if (rbBasicUnit.Checked)
            {
                if (cRecord.IsStartRecord() && !cRecord.Detailed)
                {
                    PostToUrl(url, ln, formattedTime, cRecord.PhoneNumber, cRecord.Name, cRecord.InboundOrOutboundOrBlock, cRecord.StartOrEnd, cRecord.DetailedType, dur, (cRecord.Detailed ? "" : cRecord.RingType.ToString() + cRecord.RingNumber.ToString()), log_id);
                }
            }
            else
            {
                if (cRecord.Detailed)
                {
                    formattedTime = cRecord.DateTime.Month.ToString().PadLeft(2, '0') + "/" + cRecord.DateTime.Day.ToString().PadLeft(2, '0') + " " +
                                    hour.ToString().PadLeft(2, '0') + ":" + cRecord.DateTime.Minute.ToString().PadLeft(2, '0') + ":" + cRecord.DateTime.Second.ToString().PadLeft(2, '0');

                    if (!string.IsNullOrEmpty(tbStatus.Text))
                    {
                        PostToUrl(url, ln, formattedTime, cRecord.PhoneNumber, cRecord.Name, cRecord.InboundOrOutboundOrBlock, cRecord.StartOrEnd, cRecord.DetailedType, dur, (cRecord.Detailed ? "" : cRecord.RingType.ToString() + cRecord.RingNumber.ToString()), log_id);
                    }
                }
                else
                {
                    PostToUrl(url, ln, formattedTime, cRecord.PhoneNumber, cRecord.Name, cRecord.InboundOrOutboundOrBlock, cRecord.StartOrEnd, cRecord.DetailedType, dur, (cRecord.Detailed ? "" : cRecord.RingType.ToString() + cRecord.RingNumber.ToString()), log_id);
                }
            }
        }
Esempio n. 16
0
        public async Task <ActionResult> Edit([Bind(Include = "call_id,call_day,call_time,available,contact_id,phone,Email")] CallRecord callRecord)
        {
            if (ModelState.IsValid)
            {
                db.Entry(callRecord).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(callRecord));
        }
Esempio n. 17
0
        public void TestCreateCallRoutingRecord()
        {
            var rec = new CallRecord {
                CallId = "1000046", Instance = "ESUBA"
            };

            Assert.IsTrue(rec.Execute(), rec.LastError);

            rec.Status = "COMPLETED-UNIT-TEST";
            Assert.IsTrue(CallRoutingRecord.CreateCallRoutingRecordFromCallRecord(rec), "Operation Failed!");
        }
Esempio n. 18
0
        private void CallBack(Object stateObject)
        {
            if (ConstantValuePool.BizSettingConfig.telCallConfig.Enabled && ConstantValuePool.IsTelCallWorking)
            {
                if (ConstantValuePool.BizSettingConfig.telCallConfig.Model == 0 || ConstantValuePool.BizSettingConfig.telCallConfig.Model == 1)
                {
                    if (LDT.Check_State(ConstantValuePool.TelCallID) == 255)
                    {
                        string strPhoneNo = LDT.GetNumber_Tel(1).ToString();
                        if (strPhoneNo.Length > 0)
                        {
                            //创建通话记录
                            CallRecord callRecord = new CallRecord();
                            callRecord.CallRecordID = Guid.NewGuid();
                            callRecord.Telephone    = strPhoneNo;
                            callRecord.CallTime     = DateTime.Now;
                            callRecord.Status       = 0;
                            CustomersService.GetInstance().CreateOrUpdateCallRecord(callRecord);

                            this.lbTelephone.Text     = strPhoneNo;
                            this.txtCustomerName.Text = string.Empty;
                            this.txtAddress1.Text     = string.Empty;
                            this.txtAddress2.Text     = string.Empty;
                            this.txtAddress3.Text     = string.Empty;
                            _customerInfo             = CustomersService.GetInstance().GetCustomerInfoByPhone(strPhoneNo);
                            if (_customerInfo != null)
                            {
                                txtCustomerName.Text = _customerInfo.CustomerName;
                                txtAddress1.Text     = _customerInfo.DeliveryAddress1;
                                txtAddress2.Text     = _customerInfo.DeliveryAddress2;
                                txtAddress3.Text     = _customerInfo.DeliveryAddress3;
                                if (_customerInfo.ActiveIndex == 1)
                                {
                                    ckAddress1.Checked = true;
                                }
                                else if (_customerInfo.ActiveIndex == 2)
                                {
                                    ckAddress2.Checked = true;
                                }
                                else if (_customerInfo.ActiveIndex == 3)
                                {
                                    ckAddress3.Checked = true;
                                }
                            }
                        }
                    }
                }
                if (ConstantValuePool.BizSettingConfig.telCallConfig.Model == 0)
                {
                    ConstantValuePool.IsTelCallWorking = LDT.Plugin_Tel(ConstantValuePool.TelCallID);
                }
            }
        }
Esempio n. 19
0
        protected ScriptBase(ScriptInfo pScript, ISession pSession, CallStatistics pCallStatistics)
        {
            Script         = pScript;
            session        = pSession;
            callStatistics = pCallStatistics;

            account         = new Account();
            promptManager   = new PromptManager(Script);
            callState       = CallState.Initializing;
            cdr             = new CallRecord(session);
            outboundAttempt = 1;
        }
Esempio n. 20
0
        public async Task <ActionResult> Create([Bind(Include = "call_id,call_day,call_time,contact_id,available,phone,Email")] CallRecord callRecord)
        {
            if (ModelState.IsValid)
            {
                db.CallRecords.Add(callRecord);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", "SalesForceContact"));
            }


            return(View(callRecord));
        }
Esempio n. 21
0
        internal static CfCallRecord FromCallRecord(CallRecord source)
        {
            if (source == null)
            {
                return(null);
            }
            var result           = EnumeratedMapper.EnumFromSoapEnumerated <CfResult>(source.Result);
            var questionResponse = ActionRecordQuestionResponseMapper.FromActionRecordQuestionResponse(source.QuestionResponse);
            var recordingMeta    = RecordingMetaMapper.FromRecordingMeta(source.RecordingMeta);

            return(new CfCallRecord(result, source.FinishTime, source.BilledAmount, questionResponse, source.id, source.OriginateTime,
                                    source.AnswerTime, source.Duration, recordingMeta));
        }
Esempio n. 22
0
 private void SetRecord()
 {
     this.Text          = this.Text + " №" + ID.ToString();
     Record             = MySQLWork.GetInstance().GetRecord(ID);
     DateBox.Text       = Record.Date;
     TimeBox.Text       = Record.Time;
     NameBox.Text       = Record.Name;
     PhoneBox.Text      = Record.Phone;
     ReasonBox.Text     = Record.Reason;
     StatusBox.Text     = CallRecord.StatusToString(Record.Status);
     RecallBox.Text     = Record.RecallDate;
     DiagnosticBox.Text = Record.DiagnosticDate;
 }
Esempio n. 23
0
        // GET: CallRecords/Details/5
        public async Task <ActionResult> Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CallRecord callRecord = await db.CallRecords.FindAsync(id);

            if (callRecord == null)
            {
                return(HttpNotFound());
            }
            return(View(callRecord));
        }
Esempio n. 24
0
        public void saveRecord(CallRecord callRecord)
        {
            trans = session.BeginTransaction();

            try
            {
                session.Save(callRecord);
                trans.Commit();
            }
            catch (Exception)
            {
                throw new Exception();
            }
        }
Esempio n. 25
0
        public DialogResult ShowDialog(CallRecord record)
        {
            timer1.Enabled = true;
            _callRecord = record;

            if (DateTime.Now > record.DueDate)
            {
                this._dueLabel.Text = "Overdue";
            }
            else
            {
                string dueDate = string.Empty;

                if (record.DueDate.Date == DateTime.Now.Date)
                {
                    dueDate = "Today";
                }
                else if (record.DueDate.Date == DateTime.Now.AddDays(1).Date)
                {
                    dueDate = "Tomorrow";
                }
                else
                {
                    dueDate = record.DueDate.ToShortDateString();
                }

                this._dueLabel.Text = string.Format("Due {0}", dueDate);
            }
            this._callReasonLabel.Text = record.Description;
            this._contactPictureBox.Image = record.GetImage(this._contactPictureBox.Size);
            this._nameLabel.Text = record.Name;

            if (null == this._contactPictureBox.Image)
            {
                this._contactPictureBox.Image = Properties.Resources.user;
                this._contactPictureBox.SizeMode = PictureBoxSizeMode.CenterImage;
            }

            Led vib = new Led();
            vib.SetLedStatus(1, Led.LedState.On);
            System.Threading.Thread.Sleep(200);
            vib.SetLedStatus(1, Led.LedState.Off);
            System.Threading.Thread.Sleep(200);
            vib.SetLedStatus(1, Led.LedState.On);
            System.Threading.Thread.Sleep(200);
            vib.SetLedStatus(1, Led.LedState.Off);

            return base.ShowDialog();
        }
Esempio n. 26
0
        private void StatusBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox obj = (ComboBox)sender;

            if (obj.Text != CallRecord.StatusToString(Record.Status))
            {
                obj.ForeColor = Color.Red;
                IsChanged     = true;
            }
            else
            {
                obj.ForeColor = Color.Black;
                IsChanged     = false;
            }
        }
Esempio n. 27
0
 private void dgvCallRecord_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvCallRecord.CurrentRow != null)
     {
         int selectIndex = dgvCallRecord.CurrentRow.Index;
         telephone = dgvCallRecord.Rows[selectIndex].Cells[1].Value.ToString();
         const int  status     = 1; //已接来电
         CallRecord callRecord = new CallRecord
         {
             CallRecordID = new Guid(dgvCallRecord.Rows[selectIndex].Cells[4].Value.ToString()),
             Status       = status
         };
         CustomersService.GetInstance().CreateOrUpdateCallRecord(callRecord);
         this.Close();
     }
 }
Esempio n. 28
0
        public DialogResult ShowDialog(CallRecord record, bool newRecord)
        {
            _record = record;
            this.detailsGeneral1.CallRecord = record;
            this.detailsNotes1.CallRecord = record;
            this._completeMenuItem.Enabled = record.IsActive;

            if (newRecord)
            {
                this._completeMenuItem.Enabled = false;
                this._closeMenuItem.Text = "Save";
            }

            Cursor.Current = Cursors.Default;
            return base.ShowDialog();
        }
Esempio n. 29
0
        private void HeardIt(UdpReceiverClass u, EventArgs e)
        {
            // HELP : example how to call method
            // Invoke((MethodInvoker)(() => methodName()));
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)(GetCall));
            }
            else
            {
                string     reception = UdpReceiverClass.ReceivedMessage;
                CallRecord cRecord   = new CallRecord(UdpReceiverClass.ReceivedMessage);

                string log_id = GetNewLogID(cRecord);
                AddToCallLog(cRecord, log_id, false);
                PostCallToCloud(cRecord, log_id);
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Update the navigation property callRecords in communications
        /// <param name="body"></param>
        /// <param name="requestConfiguration">Configuration for the request such as headers, query parameters, and middleware options.</param>
        /// </summary>
        public RequestInformation CreatePatchRequestInformation(CallRecord body, Action <CallRecordItemRequestBuilderPatchRequestConfiguration> requestConfiguration = default)
        {
            _ = body ?? throw new ArgumentNullException(nameof(body));
            var requestInfo = new RequestInformation {
                HttpMethod     = Method.PATCH,
                UrlTemplate    = UrlTemplate,
                PathParameters = PathParameters,
            };

            requestInfo.SetContentFromParsable(RequestAdapter, "application/json", body);
            if (requestConfiguration != null)
            {
                var requestConfig = new CallRecordItemRequestBuilderPatchRequestConfiguration();
                requestConfiguration.Invoke(requestConfig);
                requestInfo.AddRequestOptions(requestConfig.Options);
                requestInfo.AddHeaders(requestConfig.Headers);
            }
            return(requestInfo);
        }
Esempio n. 31
0
        public static CallRecord[] ProcessCallRecords(byte[] data, HookedClient.HookedMethods hookedMethods = null)
        {
            var result = new List <CallRecord>();

            var br = new BinaryReader(new MemoryStream(data));

            while (br.BaseStream.Position != br.BaseStream.Length)
            {
                var cr = new CallRecord();
                cr.RecordSize = br.ReadUInt32();
                cr.RecordData = br.ReadBytes((int)cr.RecordSize);

                var brCr = new BinaryReader(new MemoryStream(cr.RecordData));
                cr.CallId     = brCr.ReadUInt32();
                cr.FunctionId = brCr.ReadUInt32();
                cr.ThreadId   = brCr.ReadUInt32();

                if (hookedMethods != null)
                {
                    cr.Method = hookedMethods.MethodIds[cr.FunctionId];
                    if (cr.Method.SaveCallback)
                    {
                        var callStackLen = brCr.ReadUInt32();
                        cr.CallStack = new List <CallStackEntry>((int)callStackLen);
                        for (int i = 0; i < callStackLen; i++)
                        {
                            cr.CallStack.Add(new CallStackEntry {
                                Address = brCr.ReadUInt32()
                            });
                        }
                    }

                    cr.ParametersBeforeCall = ReadCallParameters(brCr, cr.Method.ApiMethod.Arguments);
                    cr.ReturnValue          = brCr.ReadUInt32();
                    cr.ParametersAfterCall  = ReadCallParameters(brCr, cr.Method.ApiMethod.Arguments);
                }

                result.Add(cr);
            }

            return(result.ToArray());
        }
Esempio n. 32
0
        public void User_Creates_A_Call_Record_For_Phone_Number(string phoneNumber, bool isRightPartyContact)
        {
            var updatedCallRecord = CallRecordManager.GetCallRecord(25925251);
            var newCall           = new CallRecord
            {
                StartTime           = DateTime.Now,
                EndTime             = DateTime.Now.AddHours(1),
                AccountBalance      = updatedCallRecord.AccountBalance,
                AccountNumber       = _testScope.accountId.ToString(),
                PhoneNumber         = phoneNumber,
                Disposition         = 1,
                Answered            = true,
                IsRightPartyContact = isRightPartyContact,
                IsContact           = true,
                IsAttempt           = true,
                AccountSystemId     = 1
            };

            newCall.Save();
        }
Esempio n. 33
0
        public void OnHook(List <CallRecord> myCallHistoryRecords)
        {
            try
            {
                CallRecord tmpCallRecord;
                switch (_CallDirection)
                {
                case CALL_DIRECTION.CallDirectionIn:
                    if (_CallDuration > 0)
                    {
                        tmpCallRecord = new CallRecord(DateTime.Now, CallStatus.CallReceived, _LastDialedNumber, _CallDuration);
                    }
                    else
                    {
                        tmpCallRecord = new CallRecord(DateTime.Now, CallStatus.CallMissed, _LastDialedNumber, _CallDuration);
                    }
                    myCallHistoryRecords.Add(tmpCallRecord);
                    break;

                case CALL_DIRECTION.CallDirectionOut:
                    tmpCallRecord = new CallRecord(DateTime.Now, CallStatus.CallDialed, _LastDialedNumber, _CallDuration);
                    myCallHistoryRecords.Add(tmpCallRecord);
                    break;
                }
            }
            catch (Exception)
            {
                //throw;
            }



            _CallActive           = false;
            _CallConferenceActive = false;
            _CallDirection        = CALL_DIRECTION.CallDirectionNone;
            _CallHoldActive       = false;
            _CallRecordingActive  = false;
            _CallTransferActive   = false;
            _State        = TELEPHONY_RETURN_VALUE.SipOnHook;
            _CallDuration = 0;
        }
Esempio n. 34
0
        /// <summary>
        /// 创建或者更新电话记录
        /// </summary>
        /// <param name="callRecord">电话记录</param>
        /// <returns></returns>
        public bool CreateOrUpdateCallRecord(CallRecord callRecord)
        {
            bool result = false;

            try
            {
                _daoManager.OpenConnection();
                _customerOrderDao.CreateOrUpdateCallRecord(callRecord);
                result = true;
            }
            catch (Exception exception)
            {
                result = false;
                LogHelper.GetInstance().Error(string.Format("[CreateOrUpdateCallRecord]参数:callRecord_{0}", JsonConvert.SerializeObject(callRecord)), exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(result);
        }
Esempio n. 35
0
 private void button2_Click(object sender, EventArgs e)
 {
     //停止计时
     this.timer1.Enabled = false;
     this.timer2.Dispose();
     //记录通话信息
     CallRecord callRecord = new CallRecord();
     callRecord.FPhoneNumber = Int64.Parse(textBox2.Text);
     callRecord.TPhoneNumber = Int64.Parse(textBox1.Text);
     string record = on + "-" + DateTime.Now + " time:" + this.label2.Text;
     CallRecordDao dao = new CallRecordDao();
     callRecord.T_from = on;
     callRecord.T_to = DateTime.Now;
     dao.saveRecord(callRecord);
 }
Esempio n. 36
0
        //代理方法,负责定时检查用户手机余额,如果用户余额不够,则挂机.并且登记通话记录.
        private void proxy(Object obj)
        {
            Mobile p = (Mobile)obj;
            p.Mobilenumber = Int64.Parse(textBox2.Text);
            //简单测试,每分钟扣费0.2元
            if (!mobileDaoCheckBalance.checkBalance(Int64.Parse(textBox2.Text), 0f,0.2f))
            {
                //停止计时

                this.timer2.Dispose();
                this.timer1.Enabled = false;
                //记录通话信息
                CallRecord callRecord = new CallRecord();
                callRecord.FPhoneNumber = Int64.Parse(textBox2.Text);
                callRecord.TPhoneNumber = Int64.Parse(textBox1.Text);
                string record = on + "-" + DateTime.Now + " time:" + this.label2.Text;
                CallRecordDao dao = new CallRecordDao();
                callRecord.T_from = on;
                callRecord.T_to = DateTime.Now;
                dao.saveRecord(callRecord);
                MessageBox.Show("你的余额不足,已经挂机.", "wrong", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }