Example #1
0
        private void SaveCall(string callId, string answeredBy, int status)
        {
            var userAccount = GetUserAccount();
            if (userAccount == null) return;

            var tenant = CoreContext.TenantManager.GetTenant(userAccount.Tenant);
            var cookie = (string)Context.Request.Environment["server.UserCookie"];

            var apiClient = new ApiClient(tenant.GetTenantDomain());
            var request = new ApiRequest(string.Format("crm/voip/call/{0}", callId), cookie)
                {
                    Method = HttpMethod.Post,
                    ResponseType = ResponseType.Json
                };

            request.Parameters.Add(new RequestParameter {Name = "answeredBy", Value = answeredBy});
            request.Parameters.Add(new RequestParameter {Name = "status", Value = status});

            apiClient.GetResponse(request);
        }
Example #2
0
        private void ChangeApiStatus(int status, string userId)
        {
            try
            {
                var userAccount = GetUserAccount();
                if (userAccount == null) return;

                var tenant = CoreContext.TenantManager.GetTenant(userAccount.Tenant);
                var cookie = (string)Context.Request.Environment["server.UserCookie"];

                var apiClient = new ApiClient(tenant.GetTenantDomain());
                var request = new ApiRequest(string.Format("crm/voip/opers/{0}", userId), cookie)
                    {
                        Method = HttpMethod.Put
                    };
                request.Parameters.Add(new RequestParameter {Name = "status", Value = status});
                apiClient.GetResponse(request);
            }
            catch(ApiErrorException e)
            {
                Log.ErrorFormat("ChangeApiStatus userId: {0}, ErrorStackTrace: {1}, ErrorMessage:{2}", userId, e.ErrorStackTrace, e.ErrorMessage);
                throw;
            }
            catch(Exception e)
            {
                Log.Error("ChangeApiStatus userId:" + userId, e);
                throw;
            }
        }
Example #3
0
        private string GetCall(string callId)
        {
            var userAccount = GetUserAccount();
            if (userAccount == null) return null;

            var tenant = CoreContext.TenantManager.GetTenant(userAccount.Tenant);
            var cookie = (string)Context.Request.Environment["server.UserCookie"];

            var apiClient = new ApiClient(tenant.GetTenantDomain());
            var request = new ApiRequest(string.Format("crm/voip/call/{0}", callId), cookie)
                {
                    Method = HttpMethod.Get,
                    ResponseType = ResponseType.Json
                };

            return apiClient.GetResponse(request).Response;
        }