lisense
This commit is contained in:
@@ -1 +1 @@
|
||||
3040029
|
||||
2922310
|
||||
|
||||
@@ -1 +1 @@
|
||||
3040110
|
||||
2922459
|
||||
|
||||
@@ -135,11 +135,63 @@ Exec: /usr/bin/date +%A
|
||||
Exec: /usr/bin/date +%T
|
||||
Exec: /usr/bin/date +%F
|
||||
Exec: /usr/bin/timedatectl show | grep Timezone
|
||||
Date-Time: Monday 13:05:11 - 2026/10/19 (Asia/Tehran)
|
||||
Date-Time: Tuesday 12:09:50 - 2026/10/27 (Asia/Tehran)
|
||||
HDD:
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
/dev/sda2 233 GB 61 GB 73 GB
|
||||
/dev/sda2 233 GB 64 GB 76 GB
|
||||
App WbSite: http://raymandcti.com/
|
||||
App Footer: Copyright Raymand Communications Naqsh Jahan, Inc. All Rights Reserved
|
||||
App Version: 3.0.0
|
||||
App Serial: 0000-0000-0000-0000
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
Exec: /usr/bin/cat /proc/cpuinfo | grep 'model name'
|
||||
Exec: /usr/bin/du -s '/var/spool/asterisk/monitor/' | awk '{print $1}'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
> vite
|
||||
|
||||
|
||||
VITE v7.2.7 ready in 226 ms
|
||||
VITE v7.2.7 ready in 253 ms
|
||||
|
||||
➜ Local: http://localhost:3000/
|
||||
➜ Network: use --host to expose
|
||||
|
||||
@@ -14,12 +14,15 @@ import ir.peeco.pline.repositories.AppSettingsRepository;
|
||||
import ir.peeco.pline.repositories.BackupHistoryRepository;
|
||||
import org.apache.commons.net.ntp.NTPUDPClient;
|
||||
import org.apache.commons.net.ntp.NtpV3Packet;
|
||||
import org.apache.commons.net.ntp.TimeInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.apache.commons.net.ntp.TimeInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -28,7 +31,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.client.DefaultResponseErrorHandler;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
@@ -56,7 +60,9 @@ import java.util.regex.Pattern;
|
||||
@RestController
|
||||
@CrossOrigin(value = "*", maxAge = 3600)
|
||||
@RequestMapping("/app")
|
||||
public class AppControllers {
|
||||
public class AppControllers {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AppControllers.class);
|
||||
|
||||
private BackupHistoryRepository backupHistoryRepository;
|
||||
private Environment env;
|
||||
@@ -174,10 +180,12 @@ public class AppControllers {
|
||||
if (mobile == null) {
|
||||
throw new IllegalArgumentException("Mobile number is required");
|
||||
}
|
||||
URI uri = URI.create(ray2BaseUrl() + "/api/send-code?mobile="
|
||||
+ URLEncoder.encode(mobile, StandardCharsets.UTF_8));
|
||||
ResponseEntity<JsonNode> result = new RestTemplate().getForEntity(uri, JsonNode.class);
|
||||
addRay2Errors(requireRay2Response(result.getBody()), apiResult);
|
||||
URI uri = URI.create(ray2ApiUrl("send-code") + "?mobile="
|
||||
+ URLEncoder.encode(mobile, StandardCharsets.UTF_8)
|
||||
+ "&app_type=cti");
|
||||
ResponseEntity<String> result = ray2RestTemplate().getForEntity(uri, String.class);
|
||||
JsonNode response = new ObjectMapper().readTree(result.getBody());
|
||||
addRay2Errors(requireRay2Response(response), apiResult);
|
||||
apiResult.setHasError(!apiResult.getMessages().isEmpty());
|
||||
return ResponseEntity.ok(apiResult);
|
||||
}
|
||||
@@ -190,10 +198,14 @@ public class AppControllers {
|
||||
if (Objects.requireNonNull(result.getBody()).isHasError()) {
|
||||
apiResult.addMessage(result.getBody().getMessage());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
plineTools.plineLogger(ex.getLocalizedMessage());
|
||||
apiResult.addMessage("An error has occurred. try again");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
if (licenseVersion == 2) {
|
||||
logger.error("Ray2 send-code request failed", ex);
|
||||
} else {
|
||||
plineTools.plineLogger(ex.getLocalizedMessage());
|
||||
}
|
||||
apiResult.addMessage("An error has occurred. try again");
|
||||
}
|
||||
apiResult.setHasError(!apiResult.getMessages().isEmpty());
|
||||
return ResponseEntity.ok(apiResult);
|
||||
}
|
||||
@@ -209,9 +221,9 @@ public class AppControllers {
|
||||
request.put("serial", Objects.toString(data.get("serial"), ""));
|
||||
request.put("app_type", "cti");
|
||||
|
||||
ResponseEntity<JsonNode> result = new RestTemplate().postForEntity(
|
||||
ray2BaseUrl() + "/api/mobile-verify", request, JsonNode.class);
|
||||
JsonNode response = requireRay2Response(result.getBody());
|
||||
ResponseEntity<String> result = ray2RestTemplate().postForEntity(
|
||||
ray2ApiUrl("mobile-verify"), request, String.class);
|
||||
JsonNode response = requireRay2Response(new ObjectMapper().readTree(result.getBody()));
|
||||
if (addRay2Errors(response, apiResult)) {
|
||||
apiResult.setHasError(true);
|
||||
return ResponseEntity.ok(apiResult);
|
||||
@@ -260,10 +272,14 @@ public class AppControllers {
|
||||
apiResult.addResult("register", false);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex.getLocalizedMessage());
|
||||
apiResult.addMessage("An error has occurred. try again");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
if (licenseVersion == 2) {
|
||||
logger.error("Ray2 mobile-verify request failed", ex);
|
||||
} else {
|
||||
System.out.println(ex.getLocalizedMessage());
|
||||
}
|
||||
apiResult.addMessage("An error has occurred. try again");
|
||||
}
|
||||
apiResult.setHasError(!apiResult.getMessages().isEmpty());
|
||||
return ResponseEntity.ok(apiResult);
|
||||
}
|
||||
@@ -274,9 +290,9 @@ public class AppControllers {
|
||||
try {
|
||||
if (isRay2LicenseMode()) {
|
||||
Map<String, Object> request = buildRay2RegistrationRequest(data);
|
||||
ResponseEntity<JsonNode> result = new RestTemplate().postForEntity(
|
||||
ray2BaseUrl() + "/api/register", request, JsonNode.class);
|
||||
JsonNode response = requireRay2Response(result.getBody());
|
||||
ResponseEntity<String> result = ray2RestTemplate().postForEntity(
|
||||
ray2ApiUrl("register"), request, String.class);
|
||||
JsonNode response = requireRay2Response(new ObjectMapper().readTree(result.getBody()));
|
||||
if (addRay2Errors(response, apiResult)) {
|
||||
apiResult.setHasError(true);
|
||||
return ResponseEntity.ok(apiResult);
|
||||
@@ -331,10 +347,14 @@ public class AppControllers {
|
||||
fileGenerator.GenerateFiles();
|
||||
plineTools.execLinuxCli("/usr/sbin/shutdown", new String[] { "-r", "now", "Online Register" }, true);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex.getLocalizedMessage());
|
||||
apiResult.addMessage("An error has occurred. try again");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
if (licenseVersion == 2) {
|
||||
logger.error("Ray2 registration request failed", ex);
|
||||
} else {
|
||||
System.out.println(ex.getLocalizedMessage());
|
||||
}
|
||||
apiResult.addMessage("An error has occurred. try again");
|
||||
}
|
||||
apiResult.setHasError(!apiResult.getMessages().isEmpty());
|
||||
return ResponseEntity.ok(apiResult);
|
||||
}
|
||||
@@ -353,6 +373,21 @@ public class AppControllers {
|
||||
return ray2LicenseUrl.replaceAll("/+$", "");
|
||||
}
|
||||
|
||||
private String ray2ApiUrl(String endpoint) {
|
||||
return ray2BaseUrl() + "/api/license-api/" + endpoint;
|
||||
}
|
||||
|
||||
private RestTemplate ray2RestTemplate() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
|
||||
@Override
|
||||
public boolean hasError(ClientHttpResponse response) throws IOException {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
private JsonNode requireRay2Response(JsonNode response) {
|
||||
if (response == null || response.isNull()) {
|
||||
throw new IllegalStateException("Ray2 returned an empty response");
|
||||
@@ -393,6 +428,12 @@ public class AppControllers {
|
||||
? Map.of()
|
||||
: objectMapper.convertValue(data.get("attributes"), new TypeReference<Map<String, Object>>() { });
|
||||
Map<String, Object> request = new LinkedHashMap<>();
|
||||
Object serial = data.get("serial");
|
||||
if (serial == null || serial.toString().isBlank()) {
|
||||
throw new IllegalArgumentException("Serial is required for Ray2 registration");
|
||||
}
|
||||
request.put("serial", serial);
|
||||
request.put("app_type", "cti");
|
||||
for (String field : new String[] {
|
||||
"mobile_number", "f_name", "l_name", "company_name", "email", "phone_number", "address" }) {
|
||||
Object value = attributes.getOrDefault(field, data.get(field));
|
||||
|
||||
@@ -1230,7 +1230,7 @@ public class PlineTools {
|
||||
TARGET_DIR="$1"
|
||||
MAX_USED="$2"
|
||||
LOG_DIR="$3/log"
|
||||
LOG_FILE="$LOG_DIR/deleted_audio_files.log"
|
||||
LOG_FILE="$LOG_DIR/ "
|
||||
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
TARGET_DIR="$1"
|
||||
MAX_USED="$2"
|
||||
LOG_DIR="$3/log"
|
||||
LOG_FILE="$LOG_DIR/deleted_audio_files.log"
|
||||
LOG_FILE="$LOG_DIR/ "
|
||||
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user