Ejemplo n.º 1
0
        /// <summary>
        /// This function is used to update the dial status after gettin successfull response from api
        /// </summary>
        /// <param name="grpCallProp"></param>
        /// <param name="apiId"></param>
        /// <param name="reportIdRequestUUIDTable"></param>
        public void UpdateDialResponse(grpcall grpCallProp, String apiId, DataTable reportIdRequestUUIDTable)
        {
            SqlCommand    sqlCmd = default(SqlCommand);
            SqlConnection sqlCon = null;

            try
            {
                sqlCon             = Connection;
                sqlCmd             = new SqlCommand("UpdateDialResponse", sqlCon);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.Add("@ConferenceId", SqlDbType.BigInt).Value   = grpCallProp.ConferenceId;
                sqlCmd.Parameters.Add("@CallUUID", SqlDbType.VarChar, 200).Value = grpCallProp.CallUUID;
                if (grpCallProp.GatewayID == 4)
                {
                    sqlCmd.Parameters.Add("@PlivoApiID", SqlDbType.VarChar, 100).Value = apiId;
                }
                sqlCmd.Parameters.Add("@RequestUUIDs", SqlDbType.Structured).Value = reportIdRequestUUIDTable;
                sqlCon.Open();
                sqlCmd.ExecuteNonQuery();
                sqlCon.Close();
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception At UpdateSystemDownReports() Method " + ex.ToString());
                throw ex;
            }
            finally
            {
                sqlCon = null;
                sqlCon = null;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This function is used to get the plivocalluuids from reports table
        /// </summary>
        /// <param name="InPut"></param>
        /// <param name="_Type"></param>
        /// <param name="grpcall"></param>
        /// <returns></returns>
        public DataSet GetPlivoCallUUIDs(string InPut, short _Type, grpcall grpcall)
        {
            SqlCommand     sqlCmd = default(SqlCommand);
            SqlConnection  sqlCon = null;
            SqlDataAdapter da     = null;
            DataSet        ds     = null;

            try
            {
                if (_Type == 0)
                {
                    sqlCmd = new SqlCommand("Select PlivoCallUUID From reports with(nolock) Where requestuuid In (Select * From dbo.Split(@InPut, ',')) And PlivoCallUUID Is Not Null", sqlCon);
                }
                else
                {
                    sqlCmd = new SqlCommand("Select PlivoCallUUID From reports with(nolock) Where conf_id = " + grpcall.ConferenceId + " And member_id In (Select * From dbo.Split(@InPut, ',')) And PlivoCallUUID Is Not Null", sqlCon);
                }
                sqlCmd.CommandType = CommandType.Text;
                sqlCmd.Parameters.Add("@InPut", SqlDbType.VarChar).Value = InPut;
                da = new SqlDataAdapter();
                da.SelectCommand = sqlCmd;
                ds = new DataSet();
                da.Fill(ds);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Error Getting Plivo CallUUIDs, Reason : " + ex.ToString());
                throw ex;
            }
            return(ds);
        }
Ejemplo n.º 3
0
        public void ValidateConference(grpcall ConferenceObject)
        {
            string[] ValidateActions =
            {
                "dial",
                "mute_dial",
                "unmute_dial_all",
                "mute_dial_all",
                "moderator_dial",
                "MUTE_DIAL_ALL",
                "UNMUTE_DIAL_ALL",
                "MODERATOR_DIAL",
                "MUTE_DIAL",
                "DIAL"
            };
            if (ValidateActions.Contains(_Action))
            {
                if (_Action == "dial" || _Action == "mute_dial" || _Action == "moderator_dial")
                {
                    ConferenceObject.IsValidate          = true;
                    ConferenceObject.ConferenceId        = _ConferenceId;
                    ConferenceObject.Direction           = "OUTBOUND";
                    ConferenceObject.ConferenceNumber    = "";
                    ConferenceObject.ConferenceAccessKey = "";
                    ConferenceObject.TotalNumbers        = 1;
                }
                else
                {
                    ConferenceObject.IsValidate          = true;
                    ConferenceObject.ConferenceId        = _ConferenceId;
                    ConferenceObject.Direction           = "OUTBOUND";
                    ConferenceObject.ConferenceNumber    = "";
                    ConferenceObject.ConferenceAccessKey = "";
                    ConferenceObject.TotalNumbers        = 0;
                }
            }
            else
            {
                ConferenceObject.IsValidate          = false;
                ConferenceObject.ConferenceId        = _ConferenceId;
                ConferenceObject.Direction           = "OUTBOUND";
                ConferenceObject.ConferenceNumber    = "";
                ConferenceObject.ConferenceAccessKey = "";
                ConferenceObject.TotalNumbers        = 0;
            }
            GroupCallBusiness GroupCallobj = new GroupCallBusiness();

            ConferenceValidateObject = GroupCallobj.Validate(MyConf.MyConnectionString, ConferenceObject);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// This function is used to validate the groupcall, which means a groupcall with this id is exists and user is allowed to run this call etc..
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="grpCallId"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public DataSet ValidateGrpCall(grpcall grpCallProp, out short retVal, out string retMsg, out string callUUID, out int errorCode, out long instanceId)
        {
            SqlCommand     sqlCmd = default(SqlCommand);
            SqlConnection  sqlCon = null;
            SqlDataAdapter da     = null;
            DataSet        ds     = null;

            try
            {
                Logger.TraceLog("Validate grpcall Dial DAL" + DateTime.Now.ToString());
                sqlCon             = Connection;
                sqlCmd             = new SqlCommand("ValidateConference", sqlCon);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.Add("@IsValidate", SqlDbType.TinyInt).Value       = grpCallProp.IsValidate;
                sqlCmd.Parameters.Add("@ConferenceId", SqlDbType.BigInt).Value      = grpCallProp.ConferenceId;
                sqlCmd.Parameters.Add("@ConferenceNumber", SqlDbType.VarChar).Value = grpCallProp.ConferenceNumber;
                sqlCmd.Parameters.Add("@UserIdTriggered", SqlDbType.Int).Value      = grpCallProp.UserId;
                sqlCmd.Parameters.Add("@IsMute", SqlDbType.Bit).Value                   = grpCallProp.IsMute;
                sqlCmd.Parameters.Add("@TotalNumbers", SqlDbType.Int).Value             = grpCallProp.TotalNumbers;
                sqlCmd.Parameters.Add("@IsCallFromBonus", SqlDbType.Bit).Value          = grpCallProp.IsCallFromBonus;
                sqlCmd.Parameters.Add("@AccessKey", SqlDbType.VarChar, 10).Value        = grpCallProp.ConferenceAccessKey;
                sqlCmd.Parameters.Add("@CallUUID", SqlDbType.VarChar, 200).Direction    = ParameterDirection.Output;
                sqlCmd.Parameters.Add("@InstanceIdOut", SqlDbType.BigInt).Direction     = ParameterDirection.Output;
                sqlCmd.Parameters.Add("@RetVal", SqlDbType.TinyInt).Direction           = ParameterDirection.Output;
                sqlCmd.Parameters.Add("@ErrorCode", SqlDbType.Int).Direction            = ParameterDirection.Output;
                sqlCmd.Parameters.Add("@RetMessage", SqlDbType.VarChar, 1000).Direction = ParameterDirection.Output;
                da = new SqlDataAdapter(sqlCmd);
                ds = new DataSet();
                Logger.TraceLog("Validate grpcall Dial before calling Sp" + DateTime.Now.ToString());
                da.Fill(ds);
                Logger.TraceLog("Validate grpcall Dial After callhing Sp" + DateTime.Now.ToString());
                retVal     = Convert.ToInt16(sqlCmd.Parameters["@RetVal"].Value);
                errorCode  = Convert.ToInt32(sqlCmd.Parameters["@ErrorCode"].Value);
                retMsg     = sqlCmd.Parameters["@RetMessage"].Value.ToString();
                callUUID   = sqlCmd.Parameters["@CallUUID"].Value.ToString();
                instanceId = Convert.ToInt64(sqlCmd.Parameters["@InstanceIdOut"].Value);
            }
            catch (Exception ex)
            {
                retVal    = 0;
                retMsg    = "Exception at Validating GrpCall";
                errorCode = 101;
                callUUID  = "";
                Logger.ExceptionLog("ValidateGrpCall in GrpCallEnt : " + ex.ToString());
                throw ex;
            }
            return(ds);
        }
Ejemplo n.º 5
0
        public DataSet PrivateRoom(grpcall grpCallObj, out int retVal, out string retMsg)
        {
            SqlConnection  sqlCon      = null;
            SqlCommand     sqlCmd      = null;
            DataSet        ds          = new DataSet();
            SqlDataAdapter da          = new SqlDataAdapter();
            JObject        pushJobject = new JObject();

            try
            {
                sqlCon = Connection;
                sqlCmd = new SqlCommand("TRANFERCALL", sqlCon);
                var _with1 = sqlCmd;
                _with1.CommandType = CommandType.StoredProcedure;
                _with1.Parameters.Add("@ConferenceId", SqlDbType.Int).Value             = grpCallObj.ConferenceId;
                _with1.Parameters.Add("@IsPrivate", SqlDbType.Bit).Value                = grpCallObj.IsInPrivate;
                _with1.Parameters.Add("@IsAll", SqlDbType.Bit).Value                    = grpCallObj.IsAll;
                _with1.Parameters.Add("@CallUUID", SqlDbType.VarChar, 200).Value        = grpCallObj.CallUUID;
                _with1.Parameters.Add("@InstanceId", SqlDbType.BigInt).Value            = grpCallObj.InstanceId;
                _with1.Parameters.Add("@MobileNumber", SqlDbType.VarChar, 20).Value     = grpCallObj.MobileNumber;
                _with1.Parameters.Add("@RetVal", SqlDbType.Int).Direction               = ParameterDirection.Output;
                _with1.Parameters.Add("@RetMessage", SqlDbType.VarChar, 1000).Direction = ParameterDirection.Output;
                da = new SqlDataAdapter(sqlCmd);
                da.Fill(ds);
                retVal = Convert.ToInt32(sqlCmd.Parameters["@RetVal"].Value.ToString());
                retMsg = sqlCmd.Parameters["@RetVal"].Value.ToString();
                Logger.TraceLog("DAL Transfer call" + grpCallObj.ConferenceId + grpCallObj.IsInPrivate + grpCallObj.CallUUID + grpCallObj.MobileNumber + ds.Tables.Count);
            }
            catch (Exception ex)
            {
                retVal = 0;
                Logger.ExceptionLog("Exception in PrivateRoom DAL" + ex.ToString());
                throw;
            }
            finally
            {
                sqlCon = null;
                sqlCmd = null;
            }
            return(ds);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This function is used to update call status to Hangup Which means hangup the calls
        /// </summary>
        /// <param name="grpCallProp"></param>
        /// <param name="retVal"></param>
        /// <param name="retMsg"></param>
        /// <returns></returns>
        public DataSet Hangup(grpcall grpCallProp, out short retVal, out string retMsg)
        {
            SqlCommand     sqlCmd = default(SqlCommand);
            SqlConnection  sqlCon = null;
            SqlDataAdapter da     = null;
            DataSet        ds     = null;

            try
            {
                sqlCon             = Connection;
                sqlCmd             = new SqlCommand("ConferenceHangupGt", sqlCon);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.Add("@ConferenceId", SqlDbType.BigInt).Value          = grpCallProp.ConferenceId;
                sqlCmd.Parameters.Add("@CallUUID", SqlDbType.VarChar, 200).Value        = grpCallProp.CallUUID;
                sqlCmd.Parameters.Add("@InstanceId", SqlDbType.BigInt).Value            = grpCallProp.InstanceId;
                sqlCmd.Parameters.Add("@IsAll", SqlDbType.Bit).Value                    = grpCallProp.IsAll;
                sqlCmd.Parameters.Add("@MobileNumber", SqlDbType.VarChar, 20).Value     = grpCallProp.MobileNumber;
                sqlCmd.Parameters.Add("@RetVal", SqlDbType.TinyInt).Direction           = ParameterDirection.Output;
                sqlCmd.Parameters.Add("@RetMessage", SqlDbType.VarChar, 1000).Direction = ParameterDirection.Output;
                da = new SqlDataAdapter();
                ds = new DataSet();
                da.SelectCommand = sqlCmd;
                HttpContext.Current.Items.Add("DbStartTime", (DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds);
                da.Fill(ds);
                HttpContext.Current.Items.Add("DbEndTime", (DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds);
                retVal = Convert.ToInt16(sqlCmd.Parameters["@RetVal"].Value);
                retMsg = sqlCmd.Parameters["@RetMessage"].Value.ToString();
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog(ex.ToString());
                retVal = 0;
                retMsg = "Database level exception at Hanup the call";
                throw ex;
            }
            finally
            {
            }
            return(ds);
        }
Ejemplo n.º 7
0
        public void UpdateAutodialInfo(grpcall grpcall)
        {
            SqlCommand    sqlCmd = default(SqlCommand);
            SqlConnection sqlCon = null;

            try
            {
                sqlCon             = Connection;
                sqlCmd             = new SqlCommand("update conferenceautodialinfo with(rowlock) set isstarted=1 where token=@token  and confid=@confid and userid=@userid", sqlCon);
                sqlCmd.CommandType = CommandType.Text;
                sqlCmd.Parameters.Add("@userid", SqlDbType.Int).Value        = grpcall.UserId;
                sqlCmd.Parameters.Add("@confid", SqlDbType.Int).Value        = grpcall.ConferenceId;
                sqlCmd.Parameters.Add("@token", SqlDbType.VarChar, 20).Value = grpcall.AutoDialTocken;
                sqlCon.Open();
                sqlCmd.ExecuteNonQuery();
                sqlCon.Close();
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("conference autodial update conferenceautodialinfo" + ex.StackTrace);
                throw ex;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// This Is Used to Get The data from Db To make GrpCall Dial
        /// </summary>
        /// <param name="grpCallPropObj"></param>
        /// <param name="retVal"></param>
        /// <param name="retMsg"></param>
        /// <param name="sendDigits"></param>
        /// <returns></returns>
        public DataSet GrpCallDialEnt(grpcall grpCallPropObj, int isCallFromWeb, out short retVal, out string retMsg, out int durationLimit, out short isCallFromBonus, out int isPaidClient, out string sendDigitsString)
        {
            SqlConnection  sqlConDial = null;
            SqlCommand     sqlCmdDial = null;
            SqlDataAdapter sqlDa      = null;
            DataSet        sqlDs      = null;

            isPaidClient = 0;
            try
            {
                sqlConDial                = Connection;
                sqlCmdDial                = new SqlCommand("ConferenceDialGpApp", sqlConDial);
                sqlCmdDial.CommandType    = CommandType.StoredProcedure;
                sqlCmdDial.CommandTimeout = 0;
                sqlCmdDial.Parameters.Add("@ConferenceId", SqlDbType.BigInt).Value = grpCallPropObj.ConferenceId;
                sqlCmdDial.Parameters.Add("@IsCallFromWeb", SqlDbType.Int).Value   = isCallFromWeb;
                Logger.TraceLog("Mobile Number in Dataaccess for dial" + grpCallPropObj.MobileNumber + "grpCallPropObj.ConferenceId" + grpCallPropObj.ConferenceId + "grpCallPropObj.IsModerator" + grpCallPropObj.IsModerator);
                Logger.TraceLog("grpCallPropObj.IsMute" + grpCallPropObj.IsMute + "grpCallPropObj.IsAll" + grpCallPropObj.IsAll + " grpCallPropObj.UserId" + grpCallPropObj.UserId + "grpCallPropObj.ConferenceAction" + grpCallPropObj.ConferenceAction);
                sqlCmdDial.Parameters.Add("@MobileNumbers", SqlDbType.VarChar, -1).Value = grpCallPropObj.MobileNumber;
                sqlCmdDial.Parameters.Add("@IsModerator", SqlDbType.Bit).Value           = grpCallPropObj.IsModerator;
                sqlCmdDial.Parameters.Add("@IsMute", SqlDbType.Bit).Value                   = grpCallPropObj.IsMute;
                sqlCmdDial.Parameters.Add("@IsAll", SqlDbType.Bit).Value                    = grpCallPropObj.IsAll;
                sqlCmdDial.Parameters.Add("@Direction", SqlDbType.VarChar, 10).Value        = "OUTBOUND";
                sqlCmdDial.Parameters.Add("@ConferenceAction", SqlDbType.VarChar, 20).Value = grpCallPropObj.ConferenceAction;
                sqlCmdDial.Parameters.Add("@ConferenceRoom", SqlDbType.VarChar, 50).Value   = grpCallPropObj.ConferenceRoom;
                sqlCmdDial.Parameters.Add("@CallUUID", SqlDbType.VarChar, 200).Value        = grpCallPropObj.CallUUID;
                sqlCmdDial.Parameters.Add("@InstanceId", SqlDbType.BigInt).Value            = grpCallPropObj.InstanceId;
                sqlCmdDial.Parameters.Add("@IsRetry", SqlDbType.Bit).Value                  = grpCallPropObj.IsRetry;
                sqlCmdDial.Parameters.Add("@UserId", SqlDbType.BigInt).Value                = grpCallPropObj.UserId;
                sqlCmdDial.Parameters.Add("@IsAutodial", SqlDbType.TinyInt).Value           = grpCallPropObj.IsAutodial;
                sqlCmdDial.Parameters.Add("@IsCallFromBonus", SqlDbType.Bit).Direction      = ParameterDirection.InputOutput;
                sqlCmdDial.Parameters["@IsCallFromBonus"].Value = grpCallPropObj.IsCallFromBonus;
                sqlCmdDial.Parameters.Add("@DurationLimit", SqlDbType.BigInt).Direction        = ParameterDirection.Output;
                sqlCmdDial.Parameters.Add("@IsinterConnect", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
                sqlCmdDial.Parameters.Add("@IsPaidClient", SqlDbType.TinyInt).Direction        = ParameterDirection.Output;
                sqlCmdDial.Parameters.Add("@RetVal", SqlDbType.TinyInt).Direction           = ParameterDirection.Output;
                sqlCmdDial.Parameters.Add("@SendDigitsSting", SqlDbType.BigInt).Direction   = ParameterDirection.Output;
                sqlCmdDial.Parameters.Add("@RetMessage", SqlDbType.VarChar, 1000).Direction = ParameterDirection.Output;
                sqlDa = new SqlDataAdapter(sqlCmdDial);
                sqlDs = new DataSet();
                HttpContext.Current.Items.Add("DbStartTime", (DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds);
                Logger.TraceLog("Dial grpcall before executing sp" + DateTime.Now.ToString());
                sqlDa.Fill(sqlDs);
                Logger.TraceLog("Dial grpcall after executing sp" + DateTime.Now.ToString());
                HttpContext.Current.Items.Add("DbEndTime", (DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds);
                retVal           = Convert.ToInt16(sqlCmdDial.Parameters["@RetVal"].Value);
                retMsg           = sqlCmdDial.Parameters["@RetMessage"].Value.ToString();
                sendDigitsString = Convert.ToString(sqlCmdDial.Parameters["@SendDigitsSting"].Value);
                durationLimit    = 0;
                isCallFromBonus  = 0;
                Logger.TraceLog("Retmsg in dial sp" + retMsg);
                if (retVal == 1)
                {
                    if (sqlCmdDial.Parameters["@DurationLimit"].Value != DBNull.Value)
                    {
                        durationLimit = Convert.ToInt32(sqlCmdDial.Parameters["@DurationLimit"].Value);
                    }

                    isCallFromBonus = Convert.ToInt16(sqlCmdDial.Parameters["@IsCallFromBonus"].Value);
                    isPaidClient    = Convert.ToInt16(sqlCmdDial.Parameters["@IsPaidClient"].Value);
                    Logger.TraceLog("Duration Limite" + durationLimit + " isCallFromBonus " + isCallFromBonus + " isPaidClient " + isPaidClient);
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception at GrpCall Dialing : " + ex.ToString());
                retVal          = 0;
                retMsg          = "Some thing went wrong ";
                isCallFromBonus = 0;
                isPaidClient    = 0;
                sqlDs           = null;
                throw ex;
            }
            finally
            {
                if (sqlConDial.State == ConnectionState.Open)
                {
                    sqlConDial.Close();
                }
                sqlConDial = null;
                sqlCmdDial = null;
            }

            return(sqlDs);
        }
Ejemplo n.º 9
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_3.GroupCall_V130 groupcallObj = new BusinessLogicLayer.V_1_3.GroupCall_V130();
                    retryResponse = groupcallObj.GrpCallRetryBLL(sConnString, callBackPropObj.CallUUID, callBackPropObj.RequestUUID, callBackUrl);

                    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_3.GroupCall_V130 GrpcallObj = new V_1_3.GroupCall_V130();
                    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());
        }
Ejemplo n.º 10
0
        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());
        }
Ejemplo n.º 11
0
        public string ValidateInboundCall()
        {
            grpcall grpCallPropObj = new grpcall();
            String  responseXml    = "<Response><Hangup reason='start'/></Response>";
            string  voiceClipUrl   = ConfigurationManager.AppSettings["GrpTalkVoiceClipsUrl"].ToString();

            this.WelcomeClip = voiceClipUrl + "GrpTalkWelcomeClipNew.mp3";
            if ((this.Event == "newcall") || (this.Event == "getkeys"))
            {
                int nodeGatewayId = 0;

                nodeGatewayId      = CheckIsInterConnectCall(this.FromNumber, this.ToNumber);
                this.NodeGatewayId = nodeGatewayId;
                if (nodeGatewayId > 0)
                {
                    string[] digitsObj = null;
                    if (this.Event == "newcall")
                    {
                        responseXml = "<Response><GetDigits timeout='20' numDigits='100' action='" + this.InboundAnswerUrl + "' validDigits='1234567890@*#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'><Play>silence_stream://1000</Play></GetDigits></Response>";
                        return(responseXml);
                    }
                    else if (this.Event == "getkeys")
                    {
                        digitsObj  = this.Digits.Split('A');
                        this.IsAll = false;
                        DataSet interConnectCallsData = GetInterConnectCallssData(Convert.ToInt32(Digits));
                        if (interConnectCallsData.Tables.Count > 0)
                        {
                            this.IsAll        = Convert.ToBoolean(interConnectCallsData.Tables[0].Rows[0]["IsAll"]);
                            this.BatchId      = Convert.ToString(interConnectCallsData.Tables[0].Rows[0]["BatchId"]);
                            this.ConferenceId = Convert.ToInt32(interConnectCallsData.Tables[0].Rows[0]["ConfId"]);
                            this.MobileNumber = Convert.ToString(interConnectCallsData.Tables[0].Rows[0]["MobileNumber"]);


                            grpCallPropObj.IsAll        = Convert.ToBoolean(interConnectCallsData.Tables[0].Rows[0]["IsAll"]);
                            grpCallPropObj.IsMute       = false;
                            grpCallPropObj.CallUUID     = interConnectCallsData.Tables[0].Rows[0]["BatchId"].ToString();
                            grpCallPropObj.ConferenceId = Convert.ToInt32(interConnectCallsData.Tables[0].Rows[0]["ConfId"]);
                            grpCallPropObj.MobileNumber = interConnectCallsData.Tables[0].Rows[0]["MobileNumber"].ToString();

                            responseXml = this.IsAll.ToString() + "---" + this.BatchId + "---conf_id=" + this.ConferenceId.ToString();
                        }
                        else
                        {
                            responseXml = "<Response><Hangup reason='InterConnect Calls data not found'/></Response>";
                            return(responseXml);
                        }
                        int     TimeLimit = 0;
                        DataSet interConnectMembersData = new DataSet();
                        interConnectMembersData = GetInterConnectMembersData(out TimeLimit);
                        if (interConnectMembersData.Tables.Count > 0)
                        {
                            grpCallPropObj.TimeLimit      = TimeLimit;
                            grpCallPropObj.WaitClip       = this.WaitClip;
                            grpCallPropObj.WelcomeClip    = this.WelcomeClip;
                            grpCallPropObj.ConferenceRoom = this.ConferenceRoom;
                            responseXml = this.IsAll.ToString() + "---" + this.BatchId + "---conf_id inter connect members > 0=" + this.ConferenceId.ToString();
                            this.NodeDependedMobileNumberReportIdTable = interConnectMembersData.Tables[0];
                            this.NodeDependendGateWaysTable            = interConnectMembersData.Tables[1];
                            V_1_2.GroupCall_V120 grpCallObj = new V_1_2.GroupCall_V120();
                            grpCallObj.Dial(this.ConnString, grpCallPropObj, this.PreJoinCallBackUrl, this.NodeDependedMobileNumberReportIdTable, this.NodeDependendGateWaysTable);
                            responseXml = "<Response><Conference stayAlone='false'>" + this.ConferenceRoom + "</Conference></Response>";
                            return(responseXml);
                        }
                    }
                    ;
                }
                else
                {
                    responseXml = this.IsAll.ToString() + "---" + this.BatchId + "---conf_id all public calls here =" + this.ConferenceId.ToString() + this.Event;
                    DataSet newcallData     = null;
                    DataSet InBoundCallData = new DataSet();
                    string  dbMessage       = "";
                    int     mode            = 0;
                    Boolean isModetator     = false;

                    newcallData = NewInboundCall(out dbMessage);
                    try
                    {
                        if (dbMessage != "")
                        {
                            Logger.TraceLog("dbMessage " + dbMessage);

                            if (dbMessage.ToLower() == "joinconf")
                            {
                                Logger.TraceLog("table count" + newcallData.Tables[0].Rows.Count.ToString());
                                if (newcallData.Tables[0].Rows.Count > 0)
                                {
                                    mode = Convert.ToInt32(newcallData.Tables[0].Rows[0]["Mode"]);
                                    Logger.TraceLog("Mode : " + mode.ToString());
                                    if (Convert.ToInt32(newcallData.Tables[0].Rows[0]["IsValidatePin"]) == 1)
                                    {
                                        if (newcallData.Tables[0].Rows[0]["AccessKey"].ToString() == this.Digits)
                                        {
                                            responseXml = InBoundCallDial(Convert.ToInt64(newcallData.Tables[0].Rows[0]["GrpCallId"].ToString()), this.FromNumber, this.ToNumber, this.CallUuid, mode);
                                        }
                                        else
                                        {
                                            responseXml = "<Response><play>" + voiceClipUrl + "InvalidPIN.mp3" + "</play></Response>";
                                        }
                                    }
                                    else
                                    {
                                        Logger.TraceLog("from " + this.FromNumber);
                                        responseXml = InBoundCallDial(Convert.ToInt64(newcallData.Tables[0].Rows[0]["GrpCallId"].ToString()), this.FromNumber, this.ToNumber, this.CallUuid, mode);
                                    }
                                }
                                else
                                {
                                    responseXml = "<Response><Speak>No Group Call</Speak></Response>";
                                }
                                Logger.TraceLog("responseXml : " + responseXml);
                                return(responseXml);
                            }
                            else if (dbMessage.ToLower() == "playivrforpin")
                            {
                                responseXml = "<Response><GetDigits action='" + this.PreJoinCallBackUrl + "' method='GET' numDigits='6' timeout='15'><Play>" + voiceClipUrl + "EnterPin.mp3" + "</Play></GetDigits></Response>";
                                Logger.TraceLog("Response Xml : " + responseXml);
                            }
                            else if (dbMessage.ToLower() == "pleasewait")
                            {
                                responseXml = "<Response><play>" + voiceClipUrl + "NonLiveGroupCall.mp3 " + "</play></Response>";
                                Logger.TraceLog("Response Xml : " + responseXml);
                            }
                            else if (dbMessage.ToLower() == "playivr")
                            {
                                Logger.TraceLog("playivr Started");
                                int    i          = 0;
                                string ivrMessage = "<play>" + voiceClipUrl + "PleasePress.mp3" + "</play>";
                                for (i = 0; i <= newcallData.Tables[0].Rows.Count - 1; i++)
                                {
                                    if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 1)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "One.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }
                                    else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 2)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Two.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }
                                    else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 3)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Three.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }
                                    else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 4)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Four.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }
                                    else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 5)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Five.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }
                                    else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 6)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Six.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }
                                    else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 7)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Seven.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }
                                    else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 8)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Eight.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }
                                    else if (Convert.ToInt32(newcallData.Tables[0].Rows[i]["slno"]) == 9)
                                    {
                                        ivrMessage = ivrMessage + "<play>" + voiceClipUrl + "Nine.mp3" + "</play><play>" + voiceClipUrl + "ToJoin.mp3" + "</play>";
                                    }

                                    ivrMessage = ivrMessage + "<speak>" + newcallData.Tables[0].Rows[i]["ConfName"].ToString() + "</speak>";
                                }
                                ivrMessage  = ivrMessage + "<play>" + voiceClipUrl + "PleasePressStar.mp3" + "</play>";
                                ivrMessage  = "<play>" + voiceClipUrl + "MorethanOneCalls.mp3" + "</play>" + ivrMessage;
                                responseXml = "<Response><GetDigits validDigits ='1234567890*' action='" + this.InboundAnswerUrl + "' numDigits='1' timeout='15' method='GET'>" + ivrMessage + "</GetDigits></Response>";
                                Logger.TraceLog("responseXml " + responseXml);
                            }
                            else if (dbMessage.ToLower() == "justcompleted")
                            {
                                responseXml = "<Response><Speak>Selected Group was just before completed</Speak><Hangup/></Response>";
                            }
                            else if (dbMessage.ToLower() == "noconf")
                            {
                                responseXml = "<Response><Speak>No group created With your number</Speak><Hangup/></Response>";
                            }
                            else if (dbMessage.ToLower() == "invalidaccesskey")
                            {
                                responseXml = "<Response><play>" + voiceClipUrl + "InvalidPIN.mp3" + "</play></Response>";
                            }
                            else if (dbMessage.ToLower() == "hangup")
                            {
                                responseXml = "<Response><Hangup 'hangup'/></Response>";
                            }
                            else if (dbMessage.ToLower() == "exception")
                            {
                                responseXml = "<Response><Hangup data= '" + dbMessage + "'/></Response>";
                            }
                            else
                            {
                                responseXml = "<Response><Hangup data= '" + dbMessage + "'/></Response>";
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.ExceptionLog("exception at xml creation : " + ex.ToString());
                    }
                }
            }
            ;
            return(responseXml);
        }
Ejemplo n.º 12
0
        private JObject grpCall(HttpContext context)
        {
            GroupCallBusiness GroupCallobj     = new GroupCallBusiness();
            grpcall           ConferenceObject = new grpcall();

            if (string.IsNullOrEmpty(context.Request["from"]) == false)
            {
                //if (context.RequestValidate(context.Request["userid"], context.Request["conf_id"], context.Request["token"]) == "SUCCESS")
                //{
                //    token = context.Request["token"];
                //    _UserId =Convert.ToInt16(context.Request["userid"]);
                //    _ConferenceId = Convert.ToInt16(context.Request["conf_id"]);
                //    ConferenceObject.AutoDialTocken = token;
                //    AutoDial = 1;
                //}
                //else
                //{
                //   Jobj.Add(new JObject(new JProperty("Status", 401), new JProperty("ErrorReason", "Unauthorized Access")));
                //    return Jobj;
                //}
            }
            else
            {
                if (context.Request.UrlReferrer != null && context.Request.UrlReferrer.ToString().Contains(System.Configuration.ConfigurationManager.AppSettings["Domain"].ToString()))
                {
                }
                else
                {
                    Jobj.Add(new JObject(new JProperty("Status", 401), new JProperty("ErrorReason", "Unauthorized Access")));
                    return(Jobj);
                }
                if (string.IsNullOrEmpty(Convert.ToString(UserSession.UserId)))
                {
                    Jobj.Add(new JObject(new JProperty("Status", 401), new JProperty("ErrorReason", "SessionExpired")));
                    return(Jobj);
                }
                if (!(context.Request.Cookies["SessionId"] != null && !string.IsNullOrEmpty(Convert.ToString(UserSession.UserId)) && context.Request.Cookies["SessionId"].Value == Convert.ToString(UserSession.UserId)))
                {
                    Jobj.Add(new JObject(new JProperty("Status", 401), new JProperty("ErrorReason", "SessionExpired")));
                    return(Jobj);
                }
                _UserId       = Convert.ToInt16(UserSession.UserId);
                _ConferenceId = Convert.ToInt16(context.Request["conf_id"]);
                AutoDial      = 0;
            }


            try
            {
                string member = null;
                _Action = context.Request["action"].ToString();
                if (string.IsNullOrEmpty(context.Request["member"]))
                {
                    member = context.Request["moderator"];
                }
                else
                {
                    member = context.Request["member"];
                }
                int GroupId = Convert.ToInt32(context.Request["GroupId"]);

                ValidateConference(ConferenceObject);

                if (ConferenceValidateObject.SelectToken("Status").ToString() == "0")
                {
                    logclass.LogRequest(ConferenceValidateObject.SelectToken("Message").ToString());
                    Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", ConferenceValidateObject.SelectToken("Message").ToString()));
                    return(Jobj);
                }
                ConferenceObject.ConferenceAction = _Action;
                ConferenceObject.UserId           = _UserId;
                ConferenceObject = GroupCallobj.SetConferenceVariables(ConferenceValidateObject);

                if (_Action.ToUpper() == "MUTE_DIAL_ALL")
                {
                    try
                    {
                        JObject DialResponse = new JObject();
                        ConferenceObject.MemberName  = "";
                        ConferenceObject.IsModerator = false;
                        ConferenceObject.IsMute      = true;
                        ConferenceObject.IsAll       = true;
                        DialResponse = GroupCallobj.Dial(MyConf.MyConnectionString, ConferenceObject);
                        return(DialResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong with the server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "UNMUTE_DIAL_ALL")
                {
                    try
                    {
                        JObject DialResponse = new JObject();
                        ConferenceObject.MemberName  = "";
                        ConferenceObject.IsModerator = false;
                        ConferenceObject.IsMute      = false;
                        ConferenceObject.IsAll       = true;
                        if (AutoDial == 1)
                        {
                            ConferenceObject.IsAutodial = 1;
                        }
                        else
                        {
                            ConferenceObject.IsAutodial = 0;
                        }
                        DialResponse = GroupCallobj.Dial(MyConf.MyConnectionString, ConferenceObject);
                        return(DialResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "MODERATOR_DIAL")
                {
                    try
                    {
                        JObject DialResponse = new JObject();
                        ConferenceObject.MemberName  = member;
                        ConferenceObject.IsModerator = true;
                        ConferenceObject.IsMute      = false;
                        ConferenceObject.IsAll       = false;
                        if (AutoDial == 1)
                        {
                            ConferenceObject.IsAutodial = 1;
                        }
                        else
                        {
                            ConferenceObject.IsAutodial = 0;
                        }
                        DialResponse = GroupCallobj.Dial(MyConf.MyConnectionString, ConferenceObject);
                        return(DialResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "MUTE_DIAL")
                {
                    try
                    {
                        JObject DialResponse = new JObject();
                        ConferenceObject.MemberName  = member;
                        ConferenceObject.IsModerator = false;
                        ConferenceObject.IsMute      = true;
                        ConferenceObject.IsAll       = false;
                        DialResponse = GroupCallobj.Dial(MyConf.MyConnectionString, ConferenceObject);
                        return(DialResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "DIAL")
                {
                    try
                    {
                        JObject DialResponse = new JObject();
                        ConferenceObject.MemberName  = member;
                        ConferenceObject.IsModerator = false;
                        ConferenceObject.IsMute      = false;
                        ConferenceObject.IsAll       = false;
                        DialResponse = GroupCallobj.Dial(MyConf.MyConnectionString, ConferenceObject);
                        return(DialResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "MODERATOR_HANGUP")
                {
                    try
                    {
                        JObject HangupResponse = new JObject();
                        ConferenceObject.IsModerator = true;
                        ConferenceObject.IsAll       = false;
                        HangupResponse = GroupCallobj.Hangup(MyConf.MyConnectionString, ConferenceObject);
                        return(HangupResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "HANGUP_MEMBER")
                {
                    try
                    {
                        JObject HangupResponse = new JObject();
                        ConferenceObject.IsModerator = false;
                        ConferenceObject.IsAll       = false;
                        ConferenceObject.MemberName  = member;
                        HangupResponse = GroupCallobj.Hangup(MyConf.MyConnectionString, ConferenceObject);
                        return(HangupResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "HANGUP_ALL")
                {
                    try
                    {
                        JObject HangupResponse = new JObject();
                        ConferenceObject.IsModerator = false;
                        ConferenceObject.IsAll       = true;
                        HangupResponse = GroupCallobj.Hangup(MyConf.MyConnectionString, ConferenceObject);
                        return(HangupResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "MUTE_MEMBER")
                {
                    try
                    {
                        JObject MuteResponse = new JObject();
                        ConferenceObject.IsMute     = true;
                        ConferenceObject.IsAll      = false;
                        ConferenceObject.MemberName = member;
                        MuteResponse = GroupCallobj.MuteUnmute(ConferenceObject, MyConf.MyConnectionString);
                        return(MuteResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "MUTE_ALL")
                {
                    try
                    {
                        JObject MuteResponse = new JObject();
                        ConferenceObject.IsMute     = true;
                        ConferenceObject.IsAll      = true;
                        ConferenceObject.MemberName = "";
                        MuteResponse = GroupCallobj.MuteUnmute(ConferenceObject, MyConf.MyConnectionString);
                        return(MuteResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "UNMUTE_MEMBER")
                {
                    try
                    {
                        JObject UnMuteResponse = new JObject();
                        ConferenceObject.IsMute     = false;
                        ConferenceObject.IsAll      = false;
                        ConferenceObject.MemberName = member;
                        UnMuteResponse = GroupCallobj.MuteUnmute(ConferenceObject, MyConf.MyConnectionString);
                        return(UnMuteResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "UNMUTE_ALL")
                {
                    try
                    {
                        JObject UnMuteResponse = new JObject();
                        ConferenceObject.IsMute     = false;
                        ConferenceObject.IsAll      = true;
                        ConferenceObject.MemberName = "";
                        UnMuteResponse = GroupCallobj.MuteUnmute(ConferenceObject, MyConf.MyConnectionString);
                        return(UnMuteResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "DEAF_MEMBER")
                {
                    try
                    {
                        JObject DeafResponse = new JObject();
                        ConferenceObject.IsDeaf     = true;
                        ConferenceObject.IsAll      = false;
                        ConferenceObject.MemberName = member;
                        DeafResponse = GroupCallobj.DeafUndeaf(ConferenceObject, MyConf.MyConnectionString);
                        return(DeafResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "DEAF_ALL")
                {
                    try
                    {
                        JObject DeafResponse = new JObject();
                        ConferenceObject.IsDeaf     = true;
                        ConferenceObject.IsAll      = true;
                        ConferenceObject.MemberName = "";
                        DeafResponse = GroupCallobj.DeafUndeaf(ConferenceObject, MyConf.MyConnectionString);
                        return(DeafResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "UNDEAF_MEMBER")
                {
                    try
                    {
                        JObject UnDeafResponse = new JObject();
                        ConferenceObject.IsDeaf     = false;
                        ConferenceObject.IsAll      = false;
                        ConferenceObject.MemberName = member;
                        UnDeafResponse = GroupCallobj.DeafUndeaf(ConferenceObject, MyConf.MyConnectionString);
                        return(UnDeafResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
                else if (_Action.ToUpper() == "UNDEAF_ALL")
                {
                    try
                    {
                        JObject UnDeafResponse = new JObject();
                        ConferenceObject.IsDeaf     = false;
                        ConferenceObject.IsAll      = true;
                        ConferenceObject.MemberName = "";
                        UnDeafResponse = GroupCallobj.DeafUndeaf(ConferenceObject, MyConf.MyConnectionString);
                        return(UnDeafResponse);
                    }
                    catch (Exception ex)
                    {
                        logclass.LogRequest(ex.StackTrace);
                        Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                        return(Jobj);
                    }
                }
            }
            catch (Exception ex)
            {
                Jobj = new JObject(new JProperty("Status", 0), new JProperty("ErrorReason", "Something Wrong With The Server"));
                return(Jobj);
            }
            if (Jobj.SelectToken("Status") == null)
            {
                Jobj = new JObject(new JProperty("Status", 1), new JProperty("Message", "SUCCESS"));
            }
            return(Jobj);
        }