示例#1
0
        /// <summary>
        /// THis Method is used to update the call status from remote server
        /// </summary>
        /// <param name="sConnString"></param>
        /// <param name="methodType"></param>
        /// <param name="callBackIpAddr"></param>
        /// <param name="callBackReqObj"></param>
        /// <param name="pusherAppId"></param>
        /// <param name="pusherAppKey"></param>
        /// <param name="pusherAppsecret"></param>
        /// <param name="HangupCauses"></param>
        /// <param name="respContext"></param>
        /// <param name="callBackUrl"></param>
        /// <returns></returns>
        public string UpdateCallBacks(string sConnString, string methodType, string callBackIpAddr, JObject callBackReqObj, string pusherAppId, string pusherAppKey, string pusherAppsecret, string HangupCauses, HttpContext respContext, string callBackUrl)
        {
            //Parsing The Data
            ParseResponse(methodType, callBackReqObj, respContext);

            string pusherCallStatus = callBackPropObj.CallStatus;
            string eventName        = "call_status";

            string[] hangupCasuesForRetry = null;
            hangupCasuesForRetry = HangupCauses.Split(",".ToCharArray());
            try
            {
                //Updating GroupCall Status Method calling
                globalDs = UpdateCallBacksCallDb(sConnString, callBackPropObj, callBackIpAddr);
                Pusher pusherObj = new Pusher(pusherAppId, pusherAppKey, pusherAppsecret);

                JObject retryResponse = new JObject();
                if (hangupCasuesForRetry.Contains(callBackPropObj.EndReason))
                {
                    BusinessLogicLayer.V_1_5.GroupCall groupcallObj = new BusinessLogicLayer.V_1_5.GroupCall();
                    retryResponse = groupcallObj.GrpCallRetryBLL(sConnString, callBackPropObj.CallUUID, callBackPropObj.RequestUUID, callBackUrl, 0);

                    callBackResponse.Append("Retry Response : " + retryResponse.ToString());
                    if (Convert.ToBoolean(retryResponse.SelectToken("Success").ToString()) == true)
                    {
                        pusherCallStatus = "redial";
                    }
                }


                if (globalDs.Tables.Count > 0 && globalDs.Tables[0].Rows.Count > 0)
                {
                    var _with1 = globalDs.Tables[0];
                    if (Convert.ToInt32(globalDs.Tables[0].Rows[0]["IsInterConnect"]) == 0)
                    {
                        ITriggerResult PusherResponse = null;
                        PusherResponse = pusherObj.Trigger(globalDs.Tables[0].Rows[0]["ConferenceName"].ToString(), eventName, new
                        {
                            direction              = "outbound",
                            plivo_event            = callBackPropObj.Event,
                            plivo_conferene_action = callBackPropObj.GrpCallAction,
                            to_num        = globalDs.Tables[0].Rows[0]["MobileNumber"],
                            conf_room     = grpCallName,
                            call_status   = pusherCallStatus,
                            mute          = globalDs.Tables[0].Rows[0]["Mute"],
                            deaf          = globalDs.Tables[0].Rows[0]["Deaf"],
                            member        = globalDs.Tables[0].Rows[0]["Member"],
                            conf_type     = globalDs.Tables[0].Rows[0]["ConferenceType"],
                            conf_digits   = callBackPropObj.Digits,
                            conf_id       = globalDs.Tables[0].Rows[0]["ConferenceId"],
                            record_status = globalDs.Tables[0].Rows[0]["RecordStatus"],
                            record_count  = globalDs.Tables[0].Rows[0]["RecordCount"],
                            dig_prs_count = globalDs.Tables[0].Rows[0]["DigitPressCount"],
                            inpro_count   = globalDs.Tables[0].Rows[0]["InprogressCount"],
                            unmute_count  = globalDs.Tables[0].Rows[0]["UnmuteCount"],
                            mute_count    = globalDs.Tables[0].Rows[0]["MuteCount"],
                            end_reason    = globalDs.Tables[0].Rows[0]["end_reason"],
                            isinprogress  = isInProgress
                        });
                    }
                    callBackResponse.Append("CurrentMemberDetails ==> ");
                    foreach (DataRow _Row in globalDs.Tables[0].Rows)
                    {
                        foreach (DataColumn _Column in _Row.Table.Columns)
                        {
                            if (_Row[_Column.ColumnName] == DBNull.Value)
                            {
                                callBackResponse.Append(_Column.ColumnName + " : NULL");
                            }
                            else
                            {
                                callBackResponse.Append(_Column.ColumnName + " : " + _Row[_Column.ColumnName]);
                            }
                            callBackResponse.Append(" | ");
                        }
                        callBackResponse.Append(" @@@ ");
                    }
                    //If isRecording = 0 AndAlso globalglobalDs.Tables(0).Rows.Item(0)("InprogressCount") > 1 Then
                    //    logclass.LogRequest("Enters Into Conference Recording block --" & globalDs.Tables(0).Rows.Item(0)("ConferenceId").Tostring())
                    //    ConferenceRecord(globalDs.Tables(0).Rows.Item(0)("ConferenceId"), 1)
                    //End If
                }
                else
                {
                    callBackResponse.Append("No Member Data Returned From Database");
                }
                if (globalDs.Tables.Count > 1 && globalDs.Tables[1].Rows.Count > 0)
                {
                    callBackResponse.Append("AloneMemberDetails ==> ");
                    foreach (DataRow _Row in globalDs.Tables[1].Rows)
                    {
                        foreach (DataColumn _Column in _Row.Table.Columns)
                        {
                            if (_Row[_Column.ColumnName] == DBNull.Value)
                            {
                                callBackResponse.Append(_Column.ColumnName + " : NULL");
                            }
                            else
                            {
                                callBackResponse.Append(_Column.ColumnName + " : " + _Row[_Column.ColumnName]);
                            }
                            callBackResponse.Append(" | ");
                        }
                        callBackResponse.Append(" @@@ ");
                    }
                    JObject         aloneHangupResponse = new JObject();
                    JObject         alonePlayResponse   = new JObject();
                    var             _with2     = globalDs.Tables[1];
                    V_1_5.GroupCall GrpcallObj = new V_1_5.GroupCall();
                    alonePlayResponse = GrpcallObj.PlayToAConferenceCall(globalDs.Tables[1].Rows[0]["ConferenceRoom"].ToString(), Convert.ToInt32(globalDs.Tables[1].Rows[0]["MemberId"]), globalDs.Tables[1].Rows[0]["HttpUrl"].ToString(), "http://new.grpTalk.com/DefaultClips/thank_you.mp3");
                    System.Threading.Thread.Sleep(6000);
                    //ConferenceObject.ConferenceRecording(globalDs.Tables(0).Rows.Item(0)("ConferenceId"), 2)
                    grpcall callObj = new grpcall();
                    callObj.ConferenceId         = Convert.ToInt32(globalDs.Tables[1].Rows[0]["ConferenceId"]);
                    callObj.ConferenceRoom       = globalDs.Tables[1].Rows[0]["ConferenceRoom"].ToString();
                    callObj.CallUUID             = globalDs.Tables[1].Rows[0]["CallUUID"].ToString();
                    callObj.ConferenceAction     = "HANGUP_ALL";
                    callObj.IsAll                = true;
                    callObj.HttpConferenceApiUrl = globalDs.Tables[1].Rows[0]["HttpUrl"].ToString();

                    aloneHangupResponse = GrpcallObj.GrpCallHanUp(sConnString, callObj);

                    //Send Notification to App
                    PusherNotifier mobileNotifierObj = new PusherNotifier();
                    mobileNotifierObj.IsStarted = 0;
                    mobileNotifierObj.GrpCallID = Convert.ToInt32(globalDs.Tables[1].Rows[0]["ConferenceId"]);
                    GrpcallObj.MobileNotifier(sConnString, mobileNotifierObj);

                    callBackResponse.Append("Alone Play Response Is : " + alonePlayResponse.ToString());
                    callBackResponse.Append("Alone Hangup Response Is : " + aloneHangupResponse.ToString());
                }
                else
                {
                    callBackResponse.Append("No Alone Member");
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("exception at callBackresponseBLL : " + ex.ToString());
                callBackResponse.Append("Exception : " + ex.ToString()).ToString();
            }
            return(callBackResponse.ToString());
        }
        public string UpdateCallBacks(string sConnString, string methodType, string callBackIpAddr, JObject callBackReqObj, string pusherAppId, string pusherAppKey, string pusherAppsecret, string HangupCauses, HttpContext respContext, string callBackUrl)
        {
            //Parsing The Data
            ParseResponse(methodType, callBackReqObj, respContext);

            string pusherCallStatus = callBackPropObj.CallStatus;
            string eventName        = "call_status";

            string[] hangupCasuesForRetry = null;
            int      hangUpCount          = 0;
            int      callDrop             = 0;

            hangupCasuesForRetry = HangupCauses.Split(",".ToCharArray());
            try
            {
                //Updating GroupCall Status Method calling
                globalDs = UpdateCallBacksCallDb(sConnString, callBackPropObj, callBackIpAddr);
                Pusher pusherObj = new Pusher(pusherAppId, pusherAppKey, pusherAppsecret);

                JObject retryResponse = new JObject();
                if (hangupCasuesForRetry.Contains(callBackPropObj.EndReason))
                {
                    if (callBackPropObj.StartTime > 0 && (callBackPropObj.EndTime - callBackPropObj.StartTime) > 0)
                    {
                        callDrop = 1;
                    }
                    BusinessLogicLayer.V_1_5.GroupCall groupcallObj = new BusinessLogicLayer.V_1_5.GroupCall();
                    retryResponse = groupcallObj.GrpCallRetryBLL(sConnString, callBackPropObj.CallUUID, callBackPropObj.RequestUUID, callBackUrl, callDrop);
                    callBackResponse.Append("Retry Response : " + retryResponse.ToString());
                    if (string.IsNullOrEmpty(retryResponse.SelectToken("Success").ToString()) == false)
                    {
                        if (Convert.ToBoolean(retryResponse.SelectToken("Success").ToString()) == true)
                        {
                            pusherCallStatus = "redial";
                        }
                    }
                }
                if (globalDs.Tables.Count > 0 && globalDs.Tables[0].Rows.Count > 0)
                {
                    var _with1 = globalDs.Tables[0];

                    Logger.TraceLog("Pusher REsponse for outbound Main");
                    if (Convert.ToInt32(globalDs.Tables[0].Rows[0]["IsInterConnect"]) == 0)
                    {
                        if (pusherCallStatus == "redial")
                        {
                            hangUpCount = Convert.ToInt32(globalDs.Tables[0].Rows[0]["HangUpCount"]) - 1;
                        }
                        else
                        {
                            hangUpCount = Convert.ToInt32(globalDs.Tables[0].Rows[0]["HangUpCount"]);
                        }


                        Logger.TraceLog("Pusher REsponse for outbound");
                        ITriggerResult PusherResponse = null;
                        PusherResponse = pusherObj.Trigger(globalDs.Tables[0].Rows[0]["ConferenceName"].ToString(), eventName, new
                        {
                            direction              = "outbound",
                            plivo_event            = callBackPropObj.Event,
                            plivo_conferene_action = callBackPropObj.GrpCallAction,
                            to_num          = globalDs.Tables[0].Rows[0]["MobileNumber"],
                            conf_room       = grpCallName,
                            call_status     = pusherCallStatus,
                            mute            = globalDs.Tables[0].Rows[0]["Mute"],
                            deaf            = globalDs.Tables[0].Rows[0]["Deaf"],
                            isprivate       = globalDs.Tables[0].Rows[0]["IsPrivate"],
                            member          = globalDs.Tables[0].Rows[0]["Member"],
                            MemberJoinTime  = Convert.ToString(globalDs.Tables[0].Rows[0]["MemberJoinTime"]),
                            conf_type       = globalDs.Tables[0].Rows[0]["ConferenceType"],
                            conf_digits     = callBackPropObj.Digits,
                            IsMember        = globalDs.Tables[0].Rows[0]["IsMember"],
                            conf_id         = globalDs.Tables[0].Rows[0]["ConferenceId"],
                            record_status   = globalDs.Tables[0].Rows[0]["RecordStatus"],
                            record_count    = globalDs.Tables[0].Rows[0]["RecordCount"],
                            dig_prs_count   = globalDs.Tables[0].Rows[0]["DigitPressCount"],
                            inpro_count     = globalDs.Tables[0].Rows[0]["InprogressCount"],
                            unmute_count    = globalDs.Tables[0].Rows[0]["UnmuteCount"],
                            mute_count      = globalDs.Tables[0].Rows[0]["MuteCount"],
                            end_reason      = globalDs.Tables[0].Rows[0]["end_reason"],
                            isinprogress    = isInProgress,
                            AllMembersCount = globalDs.Tables[0].Rows[0]["AllMembersCount"],
                            OnCallCount     = globalDs.Tables[0].Rows[0]["OnCallCount"],
                            HangUpCount     = hangUpCount,
                            MuteCount       = globalDs.Tables[0].Rows[0]["MuteMemCount"],
                            HandRaiseCount  = globalDs.Tables[0].Rows[0]["HandRaiseCount"],
                            MembersCount    = globalDs.Tables[0].Rows[0]["AllMembersCount"],
                            PrivateCount    = globalDs.Tables[0].Rows[0]["PrivateCount"]
                        });
                    }
                    callBackResponse.Append("CurrentMemberDetails ==> ");
                    foreach (DataRow _Row in globalDs.Tables[0].Rows)
                    {
                        foreach (DataColumn _Column in _Row.Table.Columns)
                        {
                            if (_Row[_Column.ColumnName] == DBNull.Value)
                            {
                                callBackResponse.Append(_Column.ColumnName + " : NULL");
                            }
                            else
                            {
                                callBackResponse.Append(_Column.ColumnName + " : " + _Row[_Column.ColumnName]);
                            }
                            callBackResponse.Append(" | ");
                        }
                        callBackResponse.Append(" @@@ ");
                    }
                }

                else
                {
                    callBackResponse.Append("No Member Data Returned From Database");
                }
                if (globalDs.Tables.Count > 1 && globalDs.Tables[1].Rows.Count > 0)
                {
                    if (Convert.ToInt32(globalDs.Tables[0].Rows[0]["PrivateCount"]) == 0)
                    {
                        callBackResponse.Append("AloneMemberDetails ==> ");
                        foreach (DataRow _Row in globalDs.Tables[1].Rows)
                        {
                            foreach (DataColumn _Column in _Row.Table.Columns)
                            {
                                if (_Row[_Column.ColumnName] == DBNull.Value)
                                {
                                    callBackResponse.Append(_Column.ColumnName + " : NULL");
                                }
                                else
                                {
                                    callBackResponse.Append(_Column.ColumnName + " : " + _Row[_Column.ColumnName]);
                                }
                                callBackResponse.Append(" | ");
                            }
                            callBackResponse.Append(" @@@ ");
                        }
                        JObject aloneHangupResponse = new JObject();
                        JObject alonePlayResponse   = new JObject();
                        var     _with2 = globalDs.Tables[1];
                        BusinessLogicLayer.V_1_4.GroupCall_V140 GrpcallObj = new BusinessLogicLayer.V_1_4.GroupCall_V140();
                        alonePlayResponse = GrpcallObj.PlayToAConferenceCall(globalDs.Tables[1].Rows[0]["ConferenceRoom"].ToString(), Convert.ToString(globalDs.Tables[1].Rows[0]["MemberId"]), globalDs.Tables[1].Rows[0]["HttpUrl"].ToString(), "https://new.grpTalk.com/DefaultClips/thank_you.mp3");
                        System.Threading.Thread.Sleep(6000);
                        //ConferenceObject.ConferenceRecording(globalDs.Tables(0).Rows.Item(0)("ConferenceId"), 2)
                        grpcall callObj = new grpcall();
                        callObj.ConferenceId         = Convert.ToInt32(globalDs.Tables[1].Rows[0]["ConferenceId"]);
                        callObj.ConferenceRoom       = globalDs.Tables[1].Rows[0]["ConferenceRoom"].ToString();
                        callObj.CallUUID             = globalDs.Tables[1].Rows[0]["CallUUID"].ToString();
                        callObj.ConferenceAction     = "HANGUP_ALL";
                        callObj.IsAll                = true;
                        callObj.HttpConferenceApiUrl = globalDs.Tables[1].Rows[0]["HttpUrl"].ToString();
                        aloneHangupResponse          = GrpcallObj.GrpCallHanUp(sConnString, callObj);
                        //Send Notification to App
                        PusherNotifier mobileNotifierObj = new PusherNotifier();
                        mobileNotifierObj.IsStarted = 0;
                        mobileNotifierObj.GrpCallID = Convert.ToInt32(globalDs.Tables[1].Rows[0]["ConferenceId"]);
                        GrpcallObj.MobileNotifier(sConnString, mobileNotifierObj);
                        callBackResponse.Append("Alone Play Response Is : " + alonePlayResponse.ToString());
                        callBackResponse.Append("Alone Hangup Response Is : " + aloneHangupResponse.ToString());
                    }
                }
                else
                {
                    callBackResponse.Append("No Alone Member");
                }
                if (globalDs.Tables.Count > 2)
                {
                    JObject privateResponse = new JObject();
                    if (globalDs.Tables[2].Rows.Count > 0)
                    {
                        Logger.TraceLog("Private Membs" + globalDs.Tables[2].Rows.Count);
                        V_1_4.GroupCall_V140 grpCallObj = new V_1_4.GroupCall_V140();
                        for (int row = 0; row < globalDs.Tables[2].Rows.Count; row++)
                        {
                            privateResponse = grpCallObj.PrivatePublicApi(Convert.ToString(globalDs.Tables[2].Rows[row]["Conferenceroom"]), Convert.ToString(globalDs.Tables[2].Rows[row]["member_id"]), false, Convert.ToString(globalDs.Tables[2].Rows[row]["HttpUrl"]), Convert.ToBoolean(globalDs.Tables[2].Rows[row]["Mute"]));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("exception at callBackresponseBLL : " + ex.ToString());
                callBackResponse.Append("Exception : " + ex.ToString());
            }
            return(callBackResponse.ToString());
        }