public void GetGroupCallRoom(HttpContext context)
        {
            JObject roomObj = new JObject();
            int     userId  = 0;

            try
            {
                if (string.IsNullOrEmpty(userObj["UserID"].ToString()) == true)
                {
                    roomObj = new JObject(new JProperty("Success", false),
                                          new JProperty("Message", "Mandatory parameter missing"),
                                          new JProperty("ErrorCode", "E0001"));

                    context.Response.Write(roomObj);
                    context.Response.End();
                }
                else
                {
                    userId = Convert.ToInt32(userObj["UserID"]);
                }
                Groups_V120 groupsObj = new Groups_V120();
                roomObj = groupsObj.GetGroupCallRoom(MyConf.MyConnectionString, Convert.ToInt32(context.Request["ConferenceID"]), userId);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in AppServices_v2 is " + ex.ToString());
            }
            context.Response.Write(roomObj);
            //Logger.TraceLog("GetGroupCallRoom response  " + roomObj);
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(roomObj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        public void EditGroupCall(HttpContext context)
        {
            JObject paramObj = new JObject();
            JObject editObj  = new JObject();

            HttpContext.Current.Request.InputStream.Position = 0;
            StreamReader _IS     = new StreamReader(HttpContext.Current.Request.InputStream);
            string       payload = _IS.ReadToEnd();

            try
            {
                try
                {
                    paramObj = JObject.Parse(payload);
                }
                catch (Exception ex)
                {
                    editObj = new JObject(new JProperty("Success", false), new JProperty("Message", "Inavalid Request"));
                    context.Response.Write(editObj);
                    return;
                }
                Groups_V120 groupsObj = new Groups_V120();
                editObj = groupsObj.EditGroupCall(MyConf.MyConnectionString, paramObj, userId);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in AppServices_v2 is " + ex.ToString());
            }
            context.Response.Write(editObj);
            //Logger.TraceLog("EditGroupCall response  " + editObj);
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(editObj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        public void AddParticipantInGroupCall(HttpContext context)
        {
            JObject paramObj          = new JObject();
            JObject addParticipantObj = new JObject();

            HttpContext.Current.Request.InputStream.Position = 0;
            StreamReader _IS     = new StreamReader(HttpContext.Current.Request.InputStream);
            string       payload = _IS.ReadToEnd();

            try
            {
                try
                {
                    paramObj = JObject.Parse(payload);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                Groups_V120 groupsObj = new Groups_V120();
                addParticipantObj = groupsObj.AddParticipantInGroupCall(MyConf.MyConnectionString, paramObj, userId);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in AppServices_v2 is " + ex.ToString());
            }
            context.Response.Write(addParticipantObj);
            //Logger.TraceLog("AddParticipantInGroupCall response  " + addParticipantObj);
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(addParticipantObj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        public void InAppPurchaseHistory(HttpContext context)
        {
            JObject     responseJobj = new JObject();
            Groups_V120 groupsObj    = new Groups_V120();

            responseJobj = groupsObj.InAppPurchaseHistory(MyConf.MyConnectionString, userId);
            context.Response.Write(responseJobj);
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(responseJobj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        private void GrpCallCancel(HttpContext context)
        {
            JObject resJobj = new JObject();

            try
            {
                Groups_V120 groupsObj = new Groups_V120();
                resJobj = groupsObj.GrpCallCancel(MyConf.MyConnectionString, Convert.ToInt32(context.Request["ConferenceID"]));
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in GrpCallCancel : " + ex.ToString());
            }


            context.Response.Write(resJobj);
            //Logger.TraceLog("GrpCallCancel response  " + resJobj);
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(resJobj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        private void AndroidBuyCredits(HttpContext context)
        {
            JObject paramObj    = new JObject();
            JObject responseObj = new JObject();

            HttpContext.Current.Request.InputStream.Position = 0;
            StreamReader _IS             = new StreamReader(HttpContext.Current.Request.InputStream);
            string       payload         = _IS.ReadToEnd();
            string       _RequestLogPath = System.Configuration.ConfigurationManager.AppSettings["InAppPurchaseLogsPath"].ToString();
            string       _AccessToken    = context.Request.Headers["AccessToken"].ToString();

            context.Request.SaveAs(_RequestLogPath + _AccessToken + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt", true);

            try
            {
                try
                {
                    paramObj = JObject.Parse(payload);
                }
                catch (Exception ex)
                {
                    Logger.ExceptionLog("Android Buy Credits : " + ex.ToString());
                    responseObj = new JObject(new JProperty("Success", false),
                                              new JProperty("Message", "Inavalid Request"));
                    context.Response.Write(responseObj);
                    return;
                }
                Groups_V120 groupsObj = new Groups_V120();
                responseObj = groupsObj.AndroidBuyCredits(MyConf.MyConnectionString, paramObj, countryID);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in AppServices_v2 is " + ex.ToString());
            }
            context.Response.Write(responseObj);
            //Logger.TraceLog("Purchase Response :" + responseObj.ToString());
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(responseObj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        private void LeaveGroupCall(HttpContext context)
        {
            string  accessToken       = "";
            JObject outputLeaveGrpObj = new JObject();

            accessToken = context.Request.Headers["AccessToken"].ToString();
            try
            {
                Groups_V120 groupsObj = new Groups_V120();
                outputLeaveGrpObj = groupsObj.MemberLeaveFromGrpCall(MyConf.MyConnectionString, Convert.ToInt32(context.Request["ConferenceID"]), userId);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("LeaveGroupCall : " + ex.ToString());
                outputLeaveGrpObj = new JObject(new JProperty("Success", false),
                                                new JProperty("Message", "Something went wrong"));
            }
            context.Response.Write(outputLeaveGrpObj);
            //Logger.TraceLog("LeaveGroupCall response  " + outputLeaveGrpObj);
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(outputLeaveGrpObj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        private void CheckUserConfirmation(HttpContext context)
        {
            JObject responseJObj = new JObject();

            context.Request.InputStream.Position = 0;
            StreamReader _IS       = new StreamReader(context.Request.InputStream);
            string       _Payload  = _IS.ReadToEnd();
            JObject      _ParamObj = JObject.Parse(_Payload);

            try
            {
                Groups_V120 groupsObj = new Groups_V120();
                responseJObj = groupsObj.CheckUserConfirmation(MyConf.MyConnectionString, _ParamObj);
                context.Response.Write(responseJObj);
                //Logger.TraceLog("CheckUserConfirmation response  " + responseJObj);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception In CheckUserConfirmation : " + ex.ToString());
            }
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(responseJObj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        public void UpdateGroupCallName(HttpContext context)
        {
            JObject paramObj          = new JObject();
            JObject updateCallNameObj = new JObject();

            HttpContext.Current.Request.InputStream.Position = 0;
            StreamReader _IS     = new StreamReader(HttpContext.Current.Request.InputStream);
            string       payload = _IS.ReadToEnd();


            int    userid   = 0;
            int    confid   = 0;
            string confname = "";

            try
            {
                if (string.IsNullOrEmpty(userObj["UserID"].ToString()) == true)
                {
                    updateCallNameObj = new JObject(new JProperty("Success", false),
                                                    new JProperty("Message", "Mandatory parameter missing"),
                                                    new JProperty("ErrorCode", "E0001"));

                    context.Response.Write(updateCallNameObj);
                    context.Response.End();
                }
                else
                {
                    userid = Convert.ToInt32(userObj["UserID"]);
                }
                if (context.Request["ConferenceID"] == null)
                {
                    try
                    {
                        paramObj = JObject.Parse(payload);
                    }
                    catch (Exception ex)
                    {
                        Logger.ExceptionLog(ex.StackTrace);
                        context.Response.Write("Invalid Request");
                        context.Response.End();
                    }

                    confid   = Convert.ToInt32(paramObj.SelectToken("ConferenceID"));
                    confname = paramObj.SelectToken("ConferenceName").ToString();
                }
                else
                {
                    confid   = Convert.ToInt32(context.Request["ConferenceID"]);
                    confname = context.Request["ConferenceName"].ToString();
                }


                Groups_V120 groupsObj = new Groups_V120();
                updateCallNameObj = groupsObj.UpdateGroupCallName(MyConf.MyConnectionString,
                                                                  userid, confid, confname);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in AppServices_v2 is " + ex.ToString());
            }
            context.Response.Write(updateCallNameObj);
            //Logger.TraceLog("UpdateGroupCallName response  " + updateCallNameObj);
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(updateCallNameObj.ToString()));
            //RMQClient.enQueueApiStat();
        }
        public void GetAllGroupCalls(HttpContext context)
        {
            JObject groupCallsObj = new JObject();
            int     userId        = 0;
            string  deviceToken   = null;
            int     appSource     = 0;
            string  appVersion    = "";
            string  timeStamp     = context.Request["timestamp"];


            try
            {
                if (string.IsNullOrEmpty(userObj["UserID"].ToString()) == true)
                {
                    groupCallsObj = new JObject(new JProperty("Success", false),
                                                new JProperty("Message", "Mandatory parameter missing"),
                                                new JProperty("ErrorCode", "E0001"));

                    context.Response.Write(groupCallsObj);
                    context.Response.End();
                }
                else
                {
                    userId = Convert.ToInt32(userObj["UserID"]);
                }
                if (string.IsNullOrEmpty(context.Request["DeviceToken"]) == true)
                {
                    deviceToken = "";
                }
                else
                {
                    deviceToken = context.Request["DeviceToken"].ToString();
                }
                if (string.IsNullOrEmpty(context.Request["AppSource"]) == true)
                {
                    appSource = 0;
                }
                else
                {
                    appSource = int.Parse(context.Request["AppSource"].ToString());
                }
                if (string.IsNullOrEmpty(context.Request["timestamp"]) == true)
                {
                    timeStamp = "";
                }
                else
                {
                    timeStamp = context.Request["timestamp"].ToString();
                }

                if (string.IsNullOrEmpty(context.Request["AppVersion"]) == true)
                {
                    appVersion = "";
                }

                else
                {
                    appVersion = context.Request["AppVersion"].ToString();
                }

                Groups_V120 groupsObj = new Groups_V120();
                groupCallsObj = groupsObj.GetAllGroupCalls(MyConf.MyConnectionString, userId, appSource, deviceToken, appVersion, timeStamp);
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in AppServices_v2 is " + ex.ToString());
            }

            context.Response.Write(groupCallsObj);
            //Logger.TraceLog("GetAllGroupCalls response  " + groupCallsObj);
            HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(groupCallsObj.ToString()));
            //RMQClient.enQueueApiStat();
        }