/// 获取发送msg类
        /// <summary>
        /// 获取发送msg类
        /// </summary>
        /// <param name="userevent"></param>
        /// <param name="callid"></param>
        /// <param name="calltype"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public UserEventData InitUserEventData(UserEvent userevent, Calltype calltype, DateTime date, long?callid = null, string taskid = null, int?tasktype = null)
        {
            UserEventData ud = new UserEventData();

            ud.UserEvent   = userevent;
            ud.CallType    = calltype;
            ud.CurrentDate = date;
            //如果callid有值
            if (callid.HasValue == true)
            {
                ud.CallID = callid.Value;
            }
            //主叫
            if (CallRecordORIG == null || string.IsNullOrEmpty(CallRecordORIG.PhoneNum))
            {
                ud.ZhujiaoNum = HollyContactHelper.Instance.GetZhujiaoPhone();
            }
            else
            {
                ud.ZhujiaoNum = CallRecordORIG.PhoneNum;//主叫
            }
            //被叫
            if (CallRecordORIG == null || string.IsNullOrEmpty(CallRecordORIG.ANI))
            {
                ud.BejiaoNum = HollyContactHelper.Instance.GetBeijiaoPhone();
            }
            else
            {
                ud.BejiaoNum = CallRecordORIG.ANI;//被叫
            }

            ud.UserChoice = HollyContactHelper.Instance.GetSkillGroup();  //技能组
            ud.SYS_DNIS   = HollyContactHelper.Instance.GetLuodiNum();    //落地号码
            ud.RecordID   = HollyContactHelper.Instance.GetHollyCallID(); //厂家callid

            //取值
            if (CallRecordORIG != null)
            {
                ud.IsEstablished        = CallRecordORIG.EstablishedTime.HasValue;
                ud.EstablishedStartTime = CallRecordORIG.EstablishedTime;
                ud.RecordIDURL          = CallRecordORIG.AudioURL;//录音地址
                //callid 没有值,从CallRecordORIG中取
                if (callid.HasValue == false)
                {
                    ud.CallID = CallRecordORIG.CallID.HasValue ? CallRecordORIG.CallID.Value : -1;
                }
            }

            ud.TaskID   = taskid;
            ud.TaskType = tasktype;

            Loger.Log4Net.Info("[==BusinessProcess=] InitUserEventData " + userevent + "-" + ud.CallID + "-" + calltype + "-" + date);
            return(ud);
        }
Esempio n. 2
0
        /// 外呼振铃
        /// <summary>
        /// 外呼振铃
        /// </summary>
        private void CustomerOutCome_OnBelling()
        {
            Loger.Log4Net.Info("[事件][CustomerOutCome_OnBelling] 外呼振铃");
            //初始化话务数据
            DateTime date = Common.GetCurrentTime();

            BusinessProcess.Instance.SetRingingTime(date);

            if (BusinessProcess.OutBoundType != OutBoundTypeEnum.OT2_客户端呼出)
            {
                //发送消息到客户端
                UserEventData ud = BusinessProcess.Instance.InitUserEventData(UserEvent.NetworkReached, Calltype.C2_呼出, date);
                SendToWeb(ud.ToString());
            }
        }
Esempio n. 3
0
        /// 强转应答成功事件
        /// <summary>
        /// 强转应答成功事件
        /// </summary>
        private void CompelInCome_OnAnswer()
        {
            Loger.Log4Net.Info("[事件][CompelInCome_OnAnswer] 强转接通");

            //初始化话务数据
            DateTime date = Common.GetCurrentTime();

            BusinessProcess.Instance.SetEstablishedTime(date);
            //设置和用户通话时间(转入时间)
            BusinessProcess.Instance.SetTransferInTime(date);

            //发送消息到客户端
            UserEventData ud2 = BusinessProcess.Instance.InitUserEventData(UserEvent.Established, Calltype.C1_呼入, date);

            SendToWeb(ud2.ToString());
        }
Esempio n. 4
0
        /// 外呼初始化
        /// <summary>
        /// 外呼初始化
        /// </summary>
        private void CustomerOutCome_OnInit()
        {
            Loger.Log4Net.Info("[事件][CustomerOutCome_OnInit] 外呼建立");
            //初始化话务数据
            DateTime date = Common.GetCurrentTime();

            CurrentCallInfo.CallIDForHangupEmpty = CurrentCallInfo.CallID = Common.GetNewCallID(date);
            BusinessProcess.Instance.InitCallRecordORIG(CurrentCallInfo.CallID, Calltype.C2_呼出);
            BusinessProcess.Instance.SetInitiatedTime(date);

            if (BusinessProcess.OutBoundType != OutBoundTypeEnum.OT2_客户端呼出)
            {
                //发送消息到客户端
                UserEventData ud = BusinessProcess.Instance.InitUserEventData(UserEvent.Initiated, Calltype.C2_呼出, date);
                SendToWeb(ud.ToString());
            }
        }
Esempio n. 5
0
        /// 呼入客服接通成功
        /// <summary>
        /// 呼入客服接通成功
        /// </summary>
        private void CustomerInCome_OnAnswer()
        {
            Loger.Log4Net.Info("[事件][CustomerInCome_OnAnswer] 客服接通");
            if (BusinessProcess.CallRecordORIG != null)
            {
                //初始化话务数据
                DateTime date = Common.GetCurrentTime();
                BusinessProcess.Instance.SetEstablishedTime(date);

                //自动外呼不发接通成功消息
                if (HollyContactHelper.Instance.IsAutoCall == false)
                {
                    //发送消息到客户端
                    UserEventData ud = BusinessProcess.Instance.InitUserEventData(UserEvent.Established, Calltype.C1_呼入, date);
                    SendToWeb(ud.ToString());
                }
            }
            else
            {
                Loger.Log4Net.Info("[事件][CustomerInCome_OnAnswer] 客服接通异常:BusinessProcess.CallRecordORIG 为空");
            }
        }
Esempio n. 6
0
        /// 咨询振铃&转接振铃事件
        /// <summary>
        /// 咨询振铃&转接振铃事件
        /// </summary>
        private void ConsultInCome_OnBelling(string type)
        {
            Loger.Log4Net.Info("[事件][ConsultInCome_OnBelling] 咨询振铃");

            //初始化话务数据
            DateTime date = Common.GetCurrentTime();

            BusinessProcess.Instance.InitCallRecordORIG(Common.GetNewCallID(date), Calltype.C3_转接);
            BusinessProcess.Instance.SetInitiatedTime(date);
            BusinessProcess.Instance.SetRingingTime(date);

            //发送消息到web端
            //发送消息到客户端
            UserEventData ud1 = BusinessProcess.Instance.InitUserEventData(UserEvent.Transferred, Calltype.C1_呼入, date);

            SendToWeb(ud1.ToString());

            //3秒自动摘机
            AfterTime  = 3;
            LabelTitle = type + "来电";
            SetlblAgentStatusName(LabelTitle + " " + AfterTime);
            timer_zhaiji.Enabled = true;
        }
Esempio n. 7
0
        /// 咨询应答成功事件
        /// <summary>
        /// 咨询应答成功事件
        /// </summary>
        private void ConsultInCome_OnAnswer()
        {
            Loger.Log4Net.Info("[事件][ConsultInCome_OnAnswer] 咨询接通");

            //初始化话务数据
            DateTime date = Common.GetCurrentTime();

            BusinessProcess.Instance.SetEstablishedTime(date);

            //发送消息到客户端
            UserEventData ud2 = BusinessProcess.Instance.InitUserEventData(UserEvent.Established, Calltype.C1_呼入, date);

            SendToWeb(ud2.ToString());

            Action <object> callback = new Action <object>(x =>
            {
                //和用户接通了
                DateTime date2 = Common.GetCurrentTime();
                //设置和用户通话时间(转入时间)
                BusinessProcess.Instance.SetTransferInTime(date2);
            });

            AgentToCustomerCallBack(callback);
        }
Esempio n. 8
0
        /// 外呼应答
        /// <summary>
        /// 外呼应答
        /// </summary>
        private void CustomerOutCome_OnAnswer()
        {
            //合力bug:外呼假失败
            HollyBUGForCallOut();

            Loger.Log4Net.Info("[事件][CustomerOutCome_OnAnswer] 外呼应答");
            if (BusinessProcess.CallRecordORIG != null)
            {
                //初始化话务数据
                DateTime date = Common.GetCurrentTime();
                BusinessProcess.Instance.SetEstablishedTime(date);

                if (BusinessProcess.OutBoundType != OutBoundTypeEnum.OT2_客户端呼出)
                {
                    //发送消息到客户端
                    UserEventData ud = BusinessProcess.Instance.InitUserEventData(UserEvent.Established, Calltype.C2_呼出, date);
                    SendToWeb(ud.ToString());
                }
            }
            else
            {
                Loger.Log4Net.Info("[事件][CustomerOutCome_OnAnswer] 外呼应答异常:BusinessProcess.CallRecordORIG 为空");
            }
        }
Esempio n. 9
0
        /// 挂断通用事件
        /// <summary>
        /// 挂断通用事件
        /// </summary>
        /// <param name="releasetype"></param>
        private void OnHangup(ReleaseType releasetype)
        {
            Loger.Log4Net.Info("[事件][OnHangup] 挂断");
            //3种情况=呼入,呼出,未知
            Calltype ctype = HollyContactHelper.Instance.GetCallDir();

            //话后处理
            if (ctype == Calltype.C2_呼出)
            {
                //合力bug:外呼假失败
                HollyBUGForCallOut();
                //呼出没有话后
                Action <object> callback = new Action <object>(x =>
                {
                    //结束话后
                    HollyContactHelper.Instance.AfterCallEnd();
                    //呼出时计算话后信息
                    Loger.Log4Net.Info("[==BusinessProcess=][UpdateCallRecordAfterTime] 呼出时退出话后更新话后信息");
                    BusinessProcess.Instance.UpdateCallRecordAfterTime();
                });
                ToAfterCallCallBack(callback);
            }
            else
            {
                //呼入+自动外呼 存在话后时间
                //话后有时间限制
                AfterTime = CommonFunction.ObjectToInteger(ConfigurationUtil.GetAppSettingValue("AfterTime"), 60);
                SetlblAgentStatusName("话后 " + AfterTime);
                timer_after.Enabled = true;
            }

            if (BusinessProcess.CallRecordORIG != null)
            {
                //初始化话务数据
                DateTime date = Common.GetCurrentTime();
                //设置挂断时间
                BusinessProcess.Instance.SetReleaseTime(date, releasetype);
                //数据入库
                CallRecordHelper.Instance.InsertCallRecordNew(false);

                if (ctype != Calltype.C2_呼出)
                {
                    //呼入+自动外呼时,计算话后信息
                    //注册退出话后的事件
                    Action <object> callback = new Action <object>(x =>
                    {
                        Loger.Log4Net.Info("[==BusinessProcess=][UpdateCallRecordAfterTime] 呼入时退出话后更新话后信息");
                        BusinessProcess.Instance.UpdateCallRecordAfterTime();
                    });
                    //退出话后时触发
                    ExitAfterCallCallBack(callback);
                }

                //发送消息到客户端
                if (BusinessProcess.OutBoundType != OutBoundTypeEnum.OT2_客户端呼出)
                {
                    UserEventData ud = null;
                    //呼入(普通呼入,转接,拦截)
                    if (ctype == Calltype.C1_呼入 && HollyContactHelper.Instance.IsAutoCall == false)
                    {
                        ud = BusinessProcess.Instance.InitUserEventData(UserEvent.Released, Calltype.C1_呼入, date);
                    }
                    //呼出(呼出,自动外呼,未知)
                    else
                    {
                        ud = BusinessProcess.Instance.InitUserEventData(UserEvent.Released, Calltype.C2_呼出, date);
                    }
                    SendToWeb(ud.ToString());
                }
                //挂断是,数据还原初始值
                BusinessProcess.OutBoundType = OutBoundTypeEnum.OT0_未知;
            }
            else
            {
                Loger.Log4Net.Info("[事件][OnHangup] 异常:BusinessProcess.CallRecordORIG 为空");
            }
        }
Esempio n. 10
0
        /// 用户进线
        /// <summary>
        /// 用户进线
        /// </summary>
        private void CustomerInCome_OnBelling()
        {
            Loger.Log4Net.Info("[事件][CustomerInCome_OnBelling] 客服振铃");
            DateTime date = Common.GetCurrentTime();

            //新的话务ID
            NewCallID = Common.GetNewCallID(date);
            CurrentCallInfo.CallIDForHangupEmpty  = CurrentCallInfo.CallID = NewCallID;
            CurrentCallInfo.CallNumForHangupEmpty = CurrentCallInfo.CallNum = HollyContactHelper.Instance.GetZhujiaoPhone();
            LabelColor = Color.Black;

            //构造数据和发送数据
            CallInType callintype = GetCallInType();

            // 普通呼入
            if (callintype == CallInType.普通呼入)
            {
                //呼入
                //初始化话务数据
                BusinessProcess.Instance.InitCallRecordORIG(NewCallID, Calltype.C1_呼入);
                BusinessProcess.Instance.SetInitiatedTime(date);
                BusinessProcess.Instance.SetRingingTime(date);

                //发送消息到客户端
                UserEventData ud = BusinessProcess.Instance.InitUserEventData(UserEvent.Transferred, Calltype.C1_呼入, date, NewCallID);
                SendToWeb(ud.ToString());
                //3秒自动摘机
                AfterTime  = 3;
                LabelTitle = "客户来电";

                //判断是否专属客户&坐席
                string agentid = "";
                if (HollyContactHelper.Instance.IsSpecialAgentCall(out agentid))
                {
                    SendLogToServer(date, agentid);
                    LabelColor = Color.Orange;
                }
            }
            else if (callintype == CallInType.自动呼入)
            {
                //自动外呼
                BusinessProcess.OutBoundType = OutBoundTypeEnum.OT4_自动外呼;
                //初始化话务数据
                BusinessProcess.Instance.InitCallRecordORIG(NewCallID, Calltype.C2_呼出);
                BusinessProcess.Instance.SetInitiatedTime(date);
                BusinessProcess.Instance.SetRingingTime(date);

                //呼入
                string BusinessID = HollyContactHelper.Instance.GetZDBusinessID();
                if (!string.IsNullOrEmpty(BusinessID))
                {
                    //发送消息到客户端
                    UserEventData ud = BusinessProcess.Instance.InitUserEventData(UserEvent.AutoCall, Calltype.C1_呼入, date, NewCallID, BusinessID, 1);
                    //提前预设接通时间
                    ud.IsEstablished        = true;
                    ud.EstablishedStartTime = date;
                    SendToWeb(ud.ToString());
                }
                else
                {
                    MessageBox.Show("获取当前通话的任务ID失败,无法打开任务处理页面!");
                    //当前没有通话页面,无法发送页面事件
                    CurrentOutBoundTabPageName = "";
                    Loger.Log4Net.Info("[事件][CustomerInCome_OnBelling] 获取当前通话的任务ID失败,无法打开任务处理页面!");
                }

                //1秒自动摘机
                AfterTime  = 1;
                LabelTitle = "外呼来电";
            }
            else if (callintype == CallInType.监控呼入)
            {
                //初始化话务数据
                BusinessProcess.Instance.InitCallRecordORIG(NewCallID, Calltype.C4_拦截);
                BusinessProcess.Instance.SetInitiatedTime(date);
                BusinessProcess.Instance.SetRingingTime(date);

                if (Main_ConMonitor_Calltype == Calltype.C1_呼入)
                {
                    //发送消息到客户端
                    UserEventData ud = BusinessProcess.Instance.InitUserEventData(UserEvent.Transferred, Calltype.C1_呼入, date, NewCallID);
                    SendToWeb(ud.ToString());
                }
                //自动摘机
                AfterTime  = 1;
                LabelTitle = "接管来电";
            }

            //清空
            NewCallID = -1;
            //自动摘机
            SetlblAgentStatusName(LabelTitle + " " + AfterTime, LabelColor);
            timer_zhaiji.Enabled = true;
        }