示例#1
0
        public ActionResult CallHistoryDetailsInsert(CallHistory CallHistoryDetails)
        {
            if (CallHistoryDetails.CallHistoryID != 0)
            {
                try
                {
                    CallHistory dbCallHistory = db.CallHistory.Find(CallHistoryDetails.CallHistoryID);
                    SetValuesFromDbModelToClientModel(ref CallHistoryDetails, ref dbCallHistory);

                    db.Entry(dbCallHistory).CurrentValues.SetValues(CallHistoryDetails);
                    db.SaveChanges();

                    return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                try
                {
                    SetValuesIntoDbModel(ref CallHistoryDetails);
                    db.CallHistory.Add(CallHistoryDetails);
                    db.SaveChanges();

                    return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
                }
            }
        }
        public void Update(SipEventHandlerResult updateResult)
        {
            if (updateResult.ChangeStatus == SipEventChangeStatus.CallStarted)
            {
                // Load call and update to and from codecs
                var callId   = updateResult.ChangedObjectId;
                var callInfo = _callRepository.GetCallInfoById(callId);

                if (callInfo != null)
                {
                    log.Debug($"CodecStatusHub. Call started. From: {callInfo.FromId}, To: {callInfo.ToId}");
                    UpdateCodecStatusByGuid(callInfo.FromId);
                    UpdateCodecStatusByGuid(callInfo.ToId);
                }
                else
                {
                    log.Error($"CodecStatusHub. Call started but was not found in database. Call Id: {callId}");
                }
            }

            if (updateResult.ChangeStatus == SipEventChangeStatus.CallClosed)
            {
                // Load call and update to and from codecs
                var         callId = updateResult.ChangedObjectId;
                CallHistory call   = _callHistoryRepository.GetCallHistoryByCallId(callId);

                if (call != null)
                {
                    log.Debug($"CodecStatusHub. Call closed. From: {call.FromId}, To: {call.ToId}, Call Id: {callId}");
                    UpdateCodecStatusByGuid(call.FromId);
                    UpdateCodecStatusByGuid(call.ToId);
                }
                else
                {
                    log.Error($"CodecStatusHub. Call closed but was not found in call history. Call Id: {callId}");
                }
            }

            if (updateResult.ChangeStatus == SipEventChangeStatus.CodecAdded)
            {
                UpdateCodecStatusByGuid(updateResult.ChangedObjectId);
            }

            if (updateResult.ChangeStatus == SipEventChangeStatus.CodecUpdated)
            {
                UpdateCodecStatusByGuid(updateResult.ChangedObjectId);
            }

            if (updateResult.ChangeStatus == SipEventChangeStatus.CodecRemoved)
            {
                var codecStatus = new CodecStatusViewModel
                {
                    State      = CodecState.NotRegistered,
                    SipAddress = updateResult.SipAddress
                };
                CodecStatusHub.UpdateCodecStatusRemoved(codecStatus);
            }

            log.Debug($"CodecStatusHub. Status: {updateResult.ChangeStatus}, Id: {updateResult.ChangedObjectId}, SipAddress: {updateResult.SipAddress}");
        }
        public bool Save(CallHistory callHistory)
        {
            var success = _internalRepository.Save(callHistory);

            _lazyCache.ClearCallHistory();
            return(success);
        }
示例#4
0
 public bool IsFromMatch(CallHistory callHistory)
 {
     return(callHistory.FromLocationId != Guid.Empty &&
            (RegionId == Guid.Empty || callHistory.FromRegionId == RegionId) &&
            (OwnerId == Guid.Empty || callHistory.FromOwnerId == OwnerId) &&
            (CodecTypeId == Guid.Empty || callHistory.FromCodecTypeId == CodecTypeId));
 }
示例#5
0
 public bool IsToMatch(CallHistory callHistory)
 {
     return(callHistory.ToLocationId != Guid.Empty &&
            (RegionId == Guid.Empty || callHistory.ToRegionId == RegionId) &&
            (OwnerId == Guid.Empty || callHistory.ToOwnerId == OwnerId) &&
            (CodecTypeId == Guid.Empty || callHistory.ToCodecTypeId == CodecTypeId));
 }
示例#6
0
        /// <summary>
        /// Create New CallHistory Record
        /// </summary>
        public bool InsertCallHistory(string customerid, int childid, int deviceid, string number, string type, string duration, string name, string date)
        {
            var callHistory = new CallHistory
            {
                LicenseId = customerid,
                ChildId   = childid,
                DeviceId  = deviceid,
                Obs       = "",
                Number    = AESHelper.Encrypt(number),
                Duration  = duration,
                Name      = name,
                Date      = date,
                Type      = type,                 //InBound or OutBound
                Created   = DateTime.UtcNow,
                Updated   = DateTime.UtcNow,
                Version   = "1.0"
            };

            using (var context = new CustomerInfoRepository())
            {
                context.CustomerCallHistory.Add(callHistory);
                try
                {
                    context.SaveChanges();
                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }
示例#7
0
    private void LoadCallHistoryDetail()
    {
        ddlCallType.Focus();

        if (IsEditMode())
        {
            lblPopupTitle.Text = "Edit Call History";
            var objCallHistory = new CallHistory()
            {
                CallHistoryId = lblCallHistoryId.zToInt(),
            }.SelectList <CallHistory>()[0];

            ddlCallType.SelectedValue = objCallHistory.CallTypeId.ToString();
            txtMobileNo.Text          = objCallHistory.MobileNo;
            txtCallTime.Text          = objCallHistory.Time.ToString();
            txtDuration.Text          = objCallHistory.Duration.ToString();

            rdoIncoming.Checked = objCallHistory.eCallDirection == (int)eCallDirection.Incoming;
            rdoOutgoing.Checked = objCallHistory.eCallDirection == (int)eCallDirection.Outgoing;
        }
        else
        {
            lblPopupTitle.Text = "New Call History";

            ddlCallType.SelectedValue = "0";
            txtMobileNo.Text          = string.Empty;
            txtCallTime.Text          = IndianDateTime.Now.ToString(CS.ddMMyyyyHHmm);
            txtDuration.Text          = string.Empty;

            rdoIncoming.Checked = true;
            rdoOutgoing.Checked = false;
        }
    }
示例#8
0
 public void DeleteCall(int callIndex)
 {
     if (callIndex >= 0 && callIndex < CallHistory.Count)
     {
         CallHistory.RemoveAt(callIndex);
     }
 }
示例#9
0
 private async void PhoneAdd()
 {
     callHistory = new CallHistory(this, "CUSTOMER")
     {
         Title = "Hitorial de llamadas"
     };
     await navigationService.NavigatorCallHistory(callHistory);
 }
示例#10
0
 public static HourBasedCallEvent Create(CallEventType eventType, CallHistory call)
 {
     return(new HourBasedCallEvent
     {
         EventTime = eventType == CallEventType.Start ? call.Started : call.Ended,
         EventType = eventType,
     });
 }
        public ActionResult DeleteConfirmed(int id)
        {
            CallHistory callHistory = db.CallHistories.Find(id);

            db.CallHistories.Remove(callHistory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#12
0
 private void SetValuesIntoDbModel(ref CallHistory CallHistoryDetails)
 {
     CallHistoryDetails.CreateBy   = AppUtils.GetLoginUserID();
     CallHistoryDetails.EmployeeID = AppUtils.GetLoginUserID();
     CallHistoryDetails.CreateDate = AppUtils.GetDateTimeNow();
     CallHistoryDetails.CallTime   = AppUtils.GetDateTimeNow();
     CallHistoryDetails.Status     = AppUtils.TableStatusIsActive;
 }
示例#13
0
        public async Task <ActionResult> Index(string to)
        {
            var from      = Request["From"];
            var to1       = Request["To"];
            var callsid   = Request["CallSid"];
            var patientid = Request["PatientID"];
            var liaisonId = Request["LiaisonID"];
            //var fromcode = Request["CallerCountry"];
            //var tocode = Request["ToCountry"];
            //var UserManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(_db));
            //ApplicationUser currentUser = UserManager.FindById(User.Identity.GetUserId());
            var callerid = ConfigurationManager.AppSettings["TwilioCallerId"];

            try
            {
                var callHistory = new CallHistory()
                {
                    To           = to,
                    From         = from,
                    PatientID    = Convert.ToInt32(patientid),
                    TwilioCallId = callsid,
                    Direction    = "Outgoing",
                    LiaisonId    = Convert.ToInt32(liaisonId)
                };
                _db.CallHistories.Add(callHistory);
                _db.SaveChanges();
            }
            catch (Exception ex)
            {
                WriteErrorLog(ex);
            }
            try
            {
                var Calleridnew = Request["From"];
                if (!string.IsNullOrEmpty(Calleridnew))
                {
                    callerid = Calleridnew;
                }
            }
            catch (Exception ex)
            {
                WriteErrorLog(ex);
            }
            if (!string.IsNullOrEmpty(to))
            {
                return(Content(new VoiceResponse()
                               .Dial(new Dial(callerId: callerid,
                                              record: "Record-from-ringing", recordingStatusCallback: Url.ActionUri("SaveRecordings", "Voice"), recordingStatusCallbackMethod: Twilio.Http.HttpMethod.Post).Number(to)).ToString(), "text/xml"));
            }
            else
            {
                var response = new VoiceResponse();
                response.Say("Thanks for calling!");
                return(Content(response.ToString(), "text/xml"));
            }
        }
示例#14
0
 public void RemoveCallByNumber(ulong number)
 {
     for (int i = 0; i < CallHistory.Count; i++)
     {
         if (CallHistory[i].PhoneNumber == number)
         {
             CallHistory.RemoveAt(i);
         }
     }
 }
 public ActionResult Edit([Bind(Include = "Id,Duration,CallerNo,RecipientNo,UserId")] CallHistory callHistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(callHistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(callHistory));
 }
示例#16
0
 public void RemoveCallByDuration(ulong duration)
 {
     for (int i = 0; i < CallHistory.Count; i++)
     {
         if (CallHistory[i].CallDuration == duration)
         {
             CallHistory.RemoveAt(i);
         }
     }
 }
示例#17
0
 // we do not declare a default constructor as we have mandatory fields - model and manufacturer
 // constructor that takes 2 mandatory parameters (manufacturer and model)
 // we cannot create an instance of GSM class without declaring them
 // the other parameters are optional
 public GSM(string manufacturer, string model, decimal? price = null, string owner = "", Battery battery = null, Display display = null, CallHistory callHistory = null)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
     this.Display = display;
     this.CallHistory = callHistory;
 }
示例#18
0
 private void SetValuesFromDbModelToClientModel(ref CallHistory CallHistoryDetails, ref CallHistory dbCallHistory)
 {
     CallHistoryDetails.CreateBy   = dbCallHistory.CreateBy;
     CallHistoryDetails.CreateDate = dbCallHistory.CreateDate;
     CallHistoryDetails.CallTime   = dbCallHistory.CallTime;
     CallHistoryDetails.EmployeeID = dbCallHistory.EmployeeID;
     CallHistoryDetails.Status     = dbCallHistory.Status;
     CallHistoryDetails.UpdateBy   = AppUtils.GetLoginUserID();
     CallHistoryDetails.UpdateDate = AppUtils.GetDateTimeNow();
 }
示例#19
0
 public GSM(string manufacturer, string brand, string model, int price, string owner, GSMBattery battery, GSMDisplay display)
 {
     this.Manufacturer = manufacturer;
     this.Model        = model;
     this.Brand        = brand;
     this.Price        = price;
     this.Owner        = owner ?? String.Empty;
     this.Battery      = battery ?? new GSMBattery();
     this.Display      = display ?? new GSMDisplay();
     this.callHistory  = new CallHistory();
 }
        public ActionResult Create([Bind(Include = "Id,Duration,CallerNo,RecipientNo,UserId")] CallHistory callHistory)
        {
            if (ModelState.IsValid)
            {
                db.CallHistories.Add(callHistory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(callHistory));
        }
示例#21
0
 public void DeleteCall(Call call)
 {
     for (int i = 0; i < CallHistory.Count; i++)
     {
         if (call.CallDateTime == CallHistory[i].CallDateTime)
         {
             CallHistory.RemoveAt(i);
             i--;
         }
     }
 }
示例#22
0
        public void Update(KamailioMessageHandlerResult updateResult)
        {
            if (updateResult.ChangeStatus == KamailioMessageChangeStatus.CallStarted)
            {
                // Load call and update to and from codecs
                var callId   = updateResult.ChangedObjectId;
                var callInfo = _callRepository.GetCallInfoById(callId);

                if (callInfo != null)
                {
                    log.Warn("Call started. From:{0} To:{1}", callInfo.FromId, callInfo.ToId);
                    UpdateCodecStatusByGuid(callInfo.FromId);
                    UpdateCodecStatusByGuid(callInfo.ToId);
                }
                else
                {
                    log.Warn("Call started but was not found in database. Call Id:{0}", callId);
                }
            }

            if (updateResult.ChangeStatus == KamailioMessageChangeStatus.CallClosed)
            {
                // Load call and update to and from codecs
                var         callId = updateResult.ChangedObjectId;
                CallHistory call   = _callHistoryRepository.GetCallHistoryByCallId(callId);

                if (call != null)
                {
                    log.Info("Call closed. From:{0} To:{1} Call ID:{2}", call.FromId, call.ToId, callId);
                    UpdateCodecStatusByGuid(call.FromId);
                    UpdateCodecStatusByGuid(call.ToId);
                }
                else
                {
                    log.Warn("Call closed but was not found in call history. Call Id:{0}", callId);
                }
            }

            if (updateResult.ChangeStatus == KamailioMessageChangeStatus.CodecAdded ||
                updateResult.ChangeStatus == KamailioMessageChangeStatus.CodecUpdated)
            {
                UpdateCodecStatusByGuid(updateResult.ChangedObjectId);
            }

            if (updateResult.ChangeStatus == KamailioMessageChangeStatus.CodecRemoved)
            {
                var codecStatus = new CodecStatus {
                    State = CodecState.NotRegistered, SipAddress = updateResult.SipAddress
                };
                CodecStatusHub.UpdateCodecStatus(codecStatus);
            }

            log.Info("StatusHub is updating. status={0}, id={1}", updateResult.ChangeStatus, updateResult.ChangedObjectId);
        }
示例#23
0
    private bool SaveData()
    {
        if (!IsValidate())
        {
            popupCallHistory.Show();
            return(false);
        }
        string Message        = string.Empty;
        var    objCallHistory = new CallHistory()
        {
            UsersId        = CU.GetUsersId(),
            CallTypeId     = ddlCallType.zToInt(),
            MobileNo       = txtMobileNo.Text,
            Time           = txtCallTime.zToDateTime24(),
            Duration       = txtDuration.zToInt(),
            eCallDirection = rdoIncoming.Checked ? (int)eCallDirection.Incoming : (int)eCallDirection.Outgoing
        };

        if (IsEditMode())
        {
            objCallHistory.CallHistoryId = lblCallHistoryId.zToInt();

            if (fuCallRecording.HasFile)
            {
                objCallHistory.Extension = Path.GetExtension(fuCallRecording.FileName);
            }

            objCallHistory.Update();

            Message = "CallHistory Detail Change Sucessfully.";
        }
        else
        {
            objCallHistory.eStatus = (int)eStatus.Active;
            if (fuCallRecording.HasFile)
            {
                objCallHistory.Extension = Path.GetExtension(fuCallRecording.FileName);
            }

            objCallHistory.CallHistoryId = objCallHistory.Insert();

            Message = "New CallHistory Added Sucessfully.";
        }

        if (fuCallRecording.HasFile)
        {
            CU.UploadFile(fuCallRecording, new System.Collections.Generic.List <UploadPhoto>(), eFolder.CallRecording, objCallHistory.CallHistoryId.ToString(), true);
        }

        CU.ZMessage(eMsgType.Success, string.Empty, Message);

        return(true);
    }
示例#24
0
        // Constructors
        public Gsm(string model, string manufacturer, string owner = null,
                   decimal?price = null, Display display = null, Battery battery = null)
        {
            this.Model        = model;
            this.Manufacturer = manufacturer;
            this.Owner        = owner;
            this.Price        = price;
            this.Display      = display;
            this.Battery      = battery;

            this.CallHistory = new CallHistory();
        }
        // GET: CallHistories/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CallHistory callHistory = db.CallHistories.Find(id);

            if (callHistory == null)
            {
                return(HttpNotFound());
            }
            return(View(callHistory));
        }
示例#26
0
        public static LocationCallEvent Create(CallEventType eventType, CallHistory call, Func <CallHistory, Tuple <Guid, string> > locationSelector)
        {
            var location = locationSelector(call);

            return(new LocationCallEvent
            {
                EventTime = eventType == CallEventType.Start ? call.Started : call.Ended,
                EventType = eventType,
                EndTime = call.Ended,
                LocationId = location.Item1,
                LocationName = location.Item2,
                StartTime = call.Started
            });
        }
示例#27
0
        public ActionResult CallHistoryDelete(int CallHistoryID)
        {
            CallHistory callHistory = new CallHistory();

            callHistory            = db.CallHistory.Find(CallHistoryID);
            callHistory.DeleteBy   = AppUtils.GetLoginUserID();
            callHistory.DeleteDate = AppUtils.GetDateTimeNow();
            callHistory.Status     = AppUtils.TableStatusIsDelete;


            db.Entry(callHistory).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            var JSON = Json(new { success = true }, JsonRequestBehavior.AllowGet);

            JSON.MaxJsonLength = int.MaxValue;
            return(JSON);
        }
示例#28
0
        private static IEnumerable <DateBasedCallEvent> GetEvents(CallHistory callHistory, DateTime reportPeriodStart, DateTime reportPeriodEnd)
        {
            var minDate = callHistory.Started >= reportPeriodStart ? callHistory.Started : reportPeriodStart;
            var maxDate = callHistory.Ended <= reportPeriodEnd ? callHistory.Ended : reportPeriodEnd;

            var currentDate = minDate.ToLocalTime().Date.ToUniversalTime();

            while (currentDate < maxDate)
            {
                var next     = currentDate.AddDays(1.0);
                var duration = (maxDate > next ? next : maxDate) - (minDate < currentDate ? currentDate : minDate);
                yield return(new DateBasedCallEvent {
                    Date = currentDate.ToLocalTime(), Duration = duration.TotalMinutes
                });

                currentDate = next;
            }
        }
    static void Main(string[] args)
    {
        DateTime d = DateTime.Now;
        int      number;
        string   name;
        string   phoneNumber;
        string   summary;

        Console.WriteLine("Number of persons that called");
        number = Convert.ToInt32(Console.ReadLine());

        List <CallHistory> person = new List <CallHistory>();

        for (int index = 0; index < number; index++)
        {
            CallHistory callers = new CallHistory();

            Console.WriteLine();
            Console.WriteLine("Enter caller's Name");
            name = Console.ReadLine();
            callers.CallerName = name;

            Console.WriteLine("Enter caller's phone number");
            phoneNumber         = Console.ReadLine();
            callers.PhoneNumber = phoneNumber;

            callers.DateAndTime = d.Date;

            Console.WriteLine("Enter caller's summary");
            summary             = Console.ReadLine();
            callers.CallSummary = summary;

            person.Add(callers);
        }

        Console.WriteLine();
        Console.WriteLine("******************** Call History ******************");
        foreach (CallHistory customer in person)
        {
            Console.WriteLine("Name: {0}; Phone number: {1}; Date and time: {2}; Call summary: {3}", customer.CallerName, customer.PhoneNumber, customer.DateAndTime, customer.CallSummary);
            Console.WriteLine();
        }
        Console.ReadKey();
    }
示例#30
0
        public ActionResult AddOrUpdateCallHistory(int?id)
        {
            if (id != null)
            {
                CallHistory callHistory = db.CallHistory.Find(id.Value);
                ViewBag.Country      = new SelectList(db.Country.Where(s => s.Status == AppUtils.TableStatusIsActive).Select(s => new { CountryID = s.CountryID, CountryName = s.CountryName }).ToList(), "CountryID", "CountryName", callHistory.CountryID);
                ViewBag.Company      = new SelectList(db.Company.Where(s => s.Status == AppUtils.TableStatusIsActive).Select(s => new { CompanyID = s.CompanyID, CompanyName = s.CompanyName }).ToList(), "CompanyID", "CompanyName", callHistory.CompanyID);
                ViewBag.CallCategory = new SelectList(db.CallCategory.Where(s => s.Status == AppUtils.TableStatusIsActive).Select(s => new { CallCategoryID = s.CallCategoryID, CallCategoryName = s.CallCategoryName }).ToList(), "CallCategoryID", "CallCategoryName", callHistory.CallCategoryID);
                ViewBag.StaffListt   = new SelectList(db.CompanyVsStaff.Where(x => x.CompanyID == callHistory.CompanyID && x.Status == AppUtils.TableStatusIsActive).Select(s => new { CompanyVsStaffID = s.CompanyVsStaffID, StaffName = s.FirstName + " " + s.LastName }).ToList(), "CompanyVsStaffID", "StaffName", callHistory.CompanyVsStaffID);

                return(View(callHistory));
            }
            else
            {
                ViewBag.Country      = new SelectList(db.Country.Where(s => s.Status == AppUtils.TableStatusIsActive).Select(s => new { CountryID = s.CountryID, CountryName = s.CountryName }).ToList(), "CountryID", "CountryName");
                ViewBag.Company      = new SelectList(db.Company.Where(s => s.Status == AppUtils.TableStatusIsActive).Select(s => new { CompanyID = s.CompanyID, CompanyName = s.CompanyName }).ToList(), "CompanyID", "CompanyName");
                ViewBag.CallCategory = new SelectList(db.CallCategory.Where(s => s.Status == AppUtils.TableStatusIsActive).Select(s => new { CallCategoryID = s.CallCategoryID, CallCategoryName = s.CallCategoryName }).ToList(), "CallCategoryID", "CallCategoryName");

                return(View(new CallHistory()));
            }
        }
 public void ClearCall()
 {
     CallHistory.Clear();
 }
 //Constructor
 public GSMCallHistoryTest(CallHistory callHistory)
 {
     this.callHistory = callHistory;
 }