v1.0.0 1차 완성 버전
53
app/build.gradle.kts
Normal file
@ -0,0 +1,53 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "kr.co.rito.sipsvc"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "kr.co.rito.sipsvc"
|
||||
minSdk = 27
|
||||
targetSdk = 34
|
||||
versionCode = 100
|
||||
versionName = "1.0.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
applicationVariants.all {
|
||||
val variant = this
|
||||
outputs.all {
|
||||
val output = this as com.android.build.gradle.internal.api.BaseVariantOutputImpl
|
||||
output.outputFileName = "sipsvc-${variant.versionName}.apk"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
|
||||
implementation("org.nanohttpd:nanohttpd:2.3.1")
|
||||
}
|
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,26 @@
|
||||
package kr.co.rito.sipsvc;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("kr.co.rito.sipsvc", appContext.getPackageName());
|
||||
}
|
||||
}
|
25
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- allow saving screenshots -->
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Sipsvc"
|
||||
tools:targetApi="31">
|
||||
<service
|
||||
android:name=".SipService"
|
||||
android:enabled="true"
|
||||
android:exported="true"></service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
9
app/src/main/assets/all.min.css
vendored
Normal file
BIN
app/src/main/assets/fa-solid-900.woff2
Normal file
BIN
app/src/main/assets/layout1.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
app/src/main/assets/layout10.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/assets/layout2.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/assets/layout3.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
app/src/main/assets/layout4.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/assets/layout5.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/assets/layout6.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/assets/layout7.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/assets/layout8.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
app/src/main/assets/layout9.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
779
app/src/main/assets/ritosip-rev0.html
Normal file
@ -0,0 +1,779 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang='ko'>
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||||
<title>OSVC</title>
|
||||
<link rel='stylesheet' href='./css/all.min.css'>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; font-family: Arial, sans-serif; }
|
||||
body { display: flex; flex-direction: column; height: 100vh; background: #f4f4f4; }
|
||||
.top-bar {
|
||||
background-color: #5e5e60;
|
||||
color: white;
|
||||
padding: 28px;
|
||||
text-align: left;
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
background: #2c3e50;
|
||||
color: white;
|
||||
padding: 20px;
|
||||
height: 100vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.sidebar h2 { font-size: 18px; margin-bottom: 20px; }
|
||||
.sidebar ul { list-style: none; padding: 0; }
|
||||
.sidebar ul li {
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
transition: 0.3s;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.sidebar ul li:hover { background: #34495e; }
|
||||
.sidebar ul li.active { color: #1abc9c; font-weight: bold; }
|
||||
.submenu {
|
||||
display: none;
|
||||
padding-left: 20px;
|
||||
border-left: 2px solid #1abc9c;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.submenu li {
|
||||
padding: 8px;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
background: #3b4c63;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.submenu li:hover { background: #1abc9c; }
|
||||
.submenu li.active { color: #ffcc00; font-weight: bold; }
|
||||
.content {
|
||||
flex-grow: 1;
|
||||
padding: 20px;
|
||||
background: white;
|
||||
}
|
||||
.content-header {
|
||||
font-size: 24px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.content-header {
|
||||
font-size: 24px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.dashboard-container {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
.dashboard-section {
|
||||
flex: 1;
|
||||
background: #fff;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.system-status ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
.system-status ul li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.status-indicator {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background: green;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.top-button {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
background-color: #d32f2f; /* 빨간색 */
|
||||
border-radius: 20%;
|
||||
display: flex;
|
||||
flex-direction: column; /* 세로 정렬 */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
||||
cursor: pointer;
|
||||
transition: 0.3s;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.top-button i {
|
||||
font-size: 30px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.top-button-text {
|
||||
font-size: 10px;
|
||||
color: white;
|
||||
margin-top: 8px; /* 아이콘과 간격 */
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.top-button:hover {
|
||||
background-color: #b71c1c; /* 어두운 빨간색 */
|
||||
}
|
||||
|
||||
.top-button-green {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
background-color: #2fd32f; /* 초록색 */
|
||||
border-radius: 20%;
|
||||
display: flex;
|
||||
flex-direction: column; /* 세로 정렬 */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
||||
cursor: pointer;
|
||||
transition: 0.3s;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.top-button-green i {
|
||||
font-size: 30px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.top-button-green:hover {
|
||||
background-color: #1cb71c; /* 어두운 초록색 */
|
||||
}
|
||||
|
||||
.top-button-normal {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
background-color: #3c4e60;
|
||||
border-radius: 20%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
||||
cursor: pointer;
|
||||
transition: 0.3s;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.top-button-normal i {
|
||||
font-size: 30px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.top-button-normal:hover {
|
||||
background-color: #1c2e40;
|
||||
}
|
||||
|
||||
.top-info-normal {
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
background-color: #101010;
|
||||
border-radius: 5%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
||||
transition: 0.3s;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.call-timer {
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.time {
|
||||
color: white;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
.input-box {
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
}
|
||||
.input-box input, .combo-box select {
|
||||
width: 300px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
outline: none;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.input-label {
|
||||
vertical-align: middle;
|
||||
margin-right: 10px;
|
||||
line-height: 40px;
|
||||
width:80px;
|
||||
}
|
||||
|
||||
.apply-button {
|
||||
padding: 10px 20px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
.apply-button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.table-inner-button {
|
||||
padding: 5px 15px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
.table-inner-button:hover {
|
||||
background-color: #409039;
|
||||
}
|
||||
|
||||
|
||||
.table-container {
|
||||
margin-top: 20px;
|
||||
backdrop-filter: blur(10px);
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
padding: 20px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
||||
width: 650px;
|
||||
}
|
||||
table {
|
||||
width: 600px;
|
||||
border-collapse: collapse;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
}
|
||||
thead {
|
||||
background: #f4f4f4;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
border-bottom: 2px solid #ddd;
|
||||
}
|
||||
th, td {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
tbody tr:nth-child(even) {
|
||||
background: #fafafa;
|
||||
}
|
||||
tbody tr:hover {
|
||||
background: #f0f0f0;
|
||||
transition: 0.3s;
|
||||
}
|
||||
th {
|
||||
text-transform: none;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 30px;
|
||||
gap: 5px;
|
||||
}
|
||||
.pagination button {
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: white;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.pagination button:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
.pagination .active {
|
||||
background-color: #ddd;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Dimmed 배경 */
|
||||
.modal-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
/* 모달 스타일 */
|
||||
.modal {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
|
||||
position: relative;
|
||||
}
|
||||
.modal h2 {
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
.modal button {
|
||||
margin-top: 20px;
|
||||
padding: 8px 16px;
|
||||
border: none;
|
||||
background: #007bff;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.modal button:hover {
|
||||
background: #0056b3;
|
||||
}
|
||||
/* 로딩 스피너 스타일 */
|
||||
.spinner {
|
||||
margin: 20px auto;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 5px solid #ccc;
|
||||
border-top: 5px solid #007bff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
let seconds = 0;
|
||||
let minutes = 0;
|
||||
let hours = 0;
|
||||
var timerId;
|
||||
|
||||
function updateTimer() {
|
||||
seconds++;
|
||||
if (seconds === 60) {
|
||||
seconds = 0;
|
||||
minutes++;
|
||||
if (minutes === 60) {
|
||||
minutes = 0;
|
||||
hours++;
|
||||
}
|
||||
}
|
||||
|
||||
let formattedTime =
|
||||
(hours < 10 ? '0' + hours : hours) + ':' +
|
||||
(minutes < 10 ? '0' + minutes : minutes) + ':' +
|
||||
(seconds < 10 ? '0' + seconds : seconds);
|
||||
document.getElementById('timer').textContent = formattedTime;
|
||||
}
|
||||
|
||||
timerId = setInterval(updateTimer, 1000);
|
||||
function startCallTimer() {
|
||||
hours = 0;
|
||||
minutes = 0;
|
||||
seconds = 0;
|
||||
}
|
||||
|
||||
// *************************
|
||||
// 테이블 관련 함수 영역
|
||||
// *************************
|
||||
function setupPagination(tableContainer) {
|
||||
let currentPage = 1;
|
||||
const rowsPerPage = 10;
|
||||
const maxPageButtons = 5; // 최대 페이지 번호 개수
|
||||
const table = tableContainer.querySelector('table');
|
||||
const tbody = table.querySelector('tbody');
|
||||
const rows = tbody.querySelectorAll('tr');
|
||||
const paginationContainer = tableContainer.querySelector('.pagination');
|
||||
|
||||
function displayTableRows() {
|
||||
const totalPages = Math.ceil(rows.length / rowsPerPage);
|
||||
rows.forEach((row, index) => {
|
||||
row.style.display = (index >= (currentPage - 1) * rowsPerPage && index < currentPage * rowsPerPage) ? 'table-row' : 'none';
|
||||
});
|
||||
updatePagination(totalPages);
|
||||
}
|
||||
|
||||
function changePage(newPage) {
|
||||
const totalPages = Math.ceil(rows.length / rowsPerPage);
|
||||
currentPage = Math.max(1, Math.min(newPage, totalPages));
|
||||
displayTableRows();
|
||||
}
|
||||
|
||||
function updatePagination(totalPages) {
|
||||
paginationContainer.innerHTML = "";
|
||||
let startPage = Math.max(1, currentPage - Math.floor(maxPageButtons / 2));
|
||||
let endPage = Math.min(totalPages, startPage + maxPageButtons - 1);
|
||||
if (endPage - startPage + 1 < maxPageButtons) {
|
||||
startPage = Math.max(1, endPage - maxPageButtons + 1);
|
||||
}
|
||||
|
||||
let prevButton = document.createElement("button");
|
||||
prevButton.innerText = "이전";
|
||||
prevButton.disabled = currentPage === 1;
|
||||
prevButton.onclick = () => changePage(currentPage - 1);
|
||||
paginationContainer.appendChild(prevButton);
|
||||
|
||||
if (startPage > 1) {
|
||||
let firstPage = document.createElement("button");
|
||||
firstPage.innerText = "1";
|
||||
firstPage.onclick = () => changePage(1);
|
||||
paginationContainer.appendChild(firstPage);
|
||||
if (startPage > 2) {
|
||||
let dots = document.createElement("span");
|
||||
dots.innerText = "...";
|
||||
paginationContainer.appendChild(dots);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = startPage; i <= endPage; i++) {
|
||||
let pageButton = document.createElement("button");
|
||||
pageButton.innerText = i;
|
||||
if (i === currentPage) {
|
||||
pageButton.classList.add("active");
|
||||
}
|
||||
pageButton.onclick = () => changePage(i);
|
||||
paginationContainer.appendChild(pageButton);
|
||||
}
|
||||
|
||||
if (endPage < totalPages) {
|
||||
if (endPage < totalPages - 1) {
|
||||
let dots = document.createElement("span");
|
||||
dots.innerText = "...";
|
||||
paginationContainer.appendChild(dots);
|
||||
}
|
||||
let lastPage = document.createElement("button");
|
||||
lastPage.innerText = totalPages;
|
||||
lastPage.onclick = () => changePage(totalPages);
|
||||
paginationContainer.appendChild(lastPage);
|
||||
}
|
||||
|
||||
let nextButton = document.createElement("button");
|
||||
nextButton.innerText = "다음";
|
||||
nextButton.disabled = currentPage === totalPages;
|
||||
nextButton.onclick = () => changePage(currentPage + 1);
|
||||
paginationContainer.appendChild(nextButton);
|
||||
}
|
||||
|
||||
displayTableRows();
|
||||
}
|
||||
|
||||
/*
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('.table-container').forEach(setupPagination);
|
||||
});
|
||||
*/
|
||||
|
||||
function updateTablePager() {
|
||||
document.querySelectorAll('.table-container').forEach(setupPagination);
|
||||
}
|
||||
|
||||
async function fetchHTML(url) {
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
}
|
||||
const html = await response.text();
|
||||
return html;
|
||||
} catch (error) {
|
||||
console.error('Error fetching HTML:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// *************************
|
||||
// 좌측 메뉴 관련 함수 영역
|
||||
// *************************
|
||||
function toggleSubMenu(id) {
|
||||
let submenu = document.getElementById(id);
|
||||
let icon = document.getElementById(id + '-icon');
|
||||
if (submenu) {
|
||||
if (submenu.style.display === 'block') {
|
||||
submenu.style.display = 'none';
|
||||
icon?.classList.remove('fa-chevron-down');
|
||||
icon?.classList.add('fa-chevron-right');
|
||||
} else {
|
||||
submenu.style.display = 'block';
|
||||
icon?.classList.remove('fa-chevron-right');
|
||||
icon?.classList.add('fa-chevron-down');
|
||||
}
|
||||
}
|
||||
}
|
||||
function loadContent(content, element) {
|
||||
document.getElementById('content-area').innerHTML = content;
|
||||
document.querySelectorAll('.sidebar ul li, .submenu li').forEach(item => item.classList.remove('active'));
|
||||
element.classList.add('active');
|
||||
}
|
||||
function changeContentHeader(headerInfo) {
|
||||
document.getElementById('content-header').innerHTML = headerInfo;
|
||||
}
|
||||
|
||||
function callStart() {
|
||||
var callNumber = document.getElementById('input-call-number').value;
|
||||
startCallTimer();
|
||||
document.getElementById('text-call-number').innerHTML = callNumber;
|
||||
document.getElementById('area-call-progress').style = `visibility:visible`;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function onIpTypeSelectedValue(selectElement) {
|
||||
if(selectElement.options[selectElement.selectedIndex].text == 'DHCP') {
|
||||
document.getElementById('area-static-ipssetting').style = `display:none`;
|
||||
} else if(selectElement.options[selectElement.selectedIndex].text == 'STATIC') {
|
||||
document.getElementById('area-static-ipssetting').style = `display:block`;
|
||||
}
|
||||
//alert('선택된 직업: ' + selectElement.options[selectElement.selectedIndex].text);
|
||||
}
|
||||
|
||||
|
||||
// *************************
|
||||
// 메뉴별 컨텐츠 관련 함수 영역
|
||||
// *************************
|
||||
function callSendContent() {
|
||||
var source = `\
|
||||
<div class='dashboard-section system-status'>\
|
||||
<h3 style='margin-bottom:10px'>전화 걸기</h3>\
|
||||
<div class='input-box'>\
|
||||
<input id='input-call-number' type='text' placeholder='전화번호'>\
|
||||
</div>\
|
||||
<div>\
|
||||
<button class='top-button-green' onclick='callStart()'>\
|
||||
<i class='fa-solid fa-phone-volume'></i>\
|
||||
<div class='top-button-text'>전화걸기</div>\
|
||||
</button>\
|
||||
</div>\
|
||||
</div>`;
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
function callHistoryFromUrl(element) {
|
||||
fetchHTML('./call_history').then(html => {
|
||||
loadContent(html, element);
|
||||
});
|
||||
}
|
||||
|
||||
function callHistoryContent() {
|
||||
var source = `\
|
||||
<div class='dashboard-section system-status'>\
|
||||
<h3 style='margin-bottom:10px'>최근 통화</h3>\
|
||||
<div class='table-container'>\
|
||||
<table>\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th>연결번호</th>\
|
||||
<th>타입</th>\
|
||||
<th></th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody>\
|
||||
<tr><td>7001</td><td>발신</td><td><button class='table-inner-button' onclick='#'>통화</button></td></tr>\
|
||||
<tr><td>7005</td><td>수신</td><td><button class='table-inner-button' onclick='#'>통화</button></td></tr>\
|
||||
<tr><td>7005</td><td>수신</td><td><button class='table-inner-button' onclick='#'>통화</button></td></tr>\
|
||||
<tr><td>7005</td><td>발신</td><td><button class='table-inner-button' onclick='#'>통화</button></td></tr>\
|
||||
<tr><td>7002</td><td>수신</td><td><button class='table-inner-button' onclick='#'>통화</button></td></tr>\
|
||||
<tr><td>7001</td><td>발신</td><td><button class='table-inner-button' onclick='#'>통화</button></td></tr>\
|
||||
</tbody>\
|
||||
</table>\
|
||||
<div class='pagination'></div>\
|
||||
</div>\
|
||||
</div>`;
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
function networkSettingContent() {
|
||||
var source = `\
|
||||
<div class='dashboard-container'>\
|
||||
<div class='dashboard-section system-status'>\
|
||||
<h3 style='margin-bottom:20px'>네트워크 설정</h3>\
|
||||
<div style='display: flex;margin-bottom: 20px'>\
|
||||
<label class='input-label'>IP할당방식</label>\
|
||||
<div class='combo-box'>\
|
||||
<select onchange='onIpTypeSelectedValue(this)'>\
|
||||
<option value=''></option>\
|
||||
<option value='developer'>DHCP</option>\
|
||||
<option value='designer'>STATIC</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
<span id='area-static-ipssetting' style='display:none'>\
|
||||
<div style='display: flex;'>\
|
||||
<label class='input-label'>IP</label>\
|
||||
<div class='input-box'>\
|
||||
<input id='input-ipaddress' type='text'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div style='display: flex;'>\
|
||||
<label class='input-label'>NETMASK</label>\
|
||||
<div class='input-box'>\
|
||||
<input id='input-netmask' type='text'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div style='display: flex;'>\
|
||||
<label class='input-label'>GATEWAY</label>\
|
||||
<div class='input-box'>\
|
||||
<input id='input-gateway' type='text'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div style='display: flex;'>\
|
||||
<label class='input-label'>DNS</label>\
|
||||
<div class='input-box'>\
|
||||
<input id='input-dns' type='text'>\
|
||||
</div>\
|
||||
</div>\
|
||||
</span>\
|
||||
<button class='apply-button' onclick='#'>적용</button>\
|
||||
</div>\
|
||||
</div>`;
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
function dashboardContent() {
|
||||
var source = `<div class='dashboard-container'>\
|
||||
<div class='dashboard-section system-status'>\
|
||||
<h3>시스템 상태</h3>\
|
||||
<ul>\
|
||||
<li><span class='status-indicator'></span>LAN Network</li>\
|
||||
<li><span class='status-indicator'></span>Wi-Fi Network</li>\
|
||||
<li><span class='status-indicator'></span>Built-in Camera</li>\
|
||||
<li><span class='status-indicator'></span>Remote Control</li>\
|
||||
<li><span class='status-indicator'></span>Auto Answer Point-to-Point Video</li>\
|
||||
<li><span class='status-indicator'></span>SIP Registrar Server</li>\
|
||||
</ul>\
|
||||
</div>\
|
||||
<div class='dashboard-section'>\
|
||||
<h3>시스템 정보</h3>\
|
||||
<p><strong>Device Name:</strong> StudioX52-84B2ECFM</p>\
|
||||
<p><strong>Software Version:</strong> 4.4.1-426075</p>\
|
||||
<p><strong>MAC Address:</strong> 00:e0:db:84:b2:ec</p>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>`;
|
||||
|
||||
return source;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class='top-bar'>OSVC</div>
|
||||
|
||||
<span id='area-call-progress' style='visibility:hidden'>
|
||||
<span class='top-info-normal' style='position:absolute;top:7px;left:250px;width:120px'>
|
||||
<div class='call-timer'>통화 번호</div>
|
||||
<div id='text-call-number' class='time'>7003</div>
|
||||
</span>
|
||||
|
||||
<span class='top-info-normal' style='position:absolute;top:7px;left:380px;width:140px'>
|
||||
<div class='call-timer'>통화 시간</div>
|
||||
<div class='time' id='timer'>00:00:00</div>
|
||||
</span>
|
||||
|
||||
|
||||
<div style='position:absolute;top:7px;left:600px'>
|
||||
<button class='top-button-green'>
|
||||
<i class='fas fa-microphone'></i>
|
||||
<div class='top-button-text'>음소거 해제</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style='position:absolute;top:7px;left:700px'>
|
||||
<button class='top-button-normal'>
|
||||
<i class='fa-solid fa-signal'></i>
|
||||
<div class='top-button-text'>통화 통계</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style='position:absolute;top:7px;left:800px'>
|
||||
<button class='top-button-normal'>
|
||||
<i class='fa-solid fa-computer'></i>
|
||||
<div class='top-button-text'>모니터링</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div style='position:absolute;top:7px;left:900px'>
|
||||
<button class='top-button'>
|
||||
<i class='fa-solid fa-phone-slash'></i>
|
||||
<div class='top-button-text'>전화 끊기</div>
|
||||
</button>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
|
||||
<div class='container'>
|
||||
<div class='sidebar'>
|
||||
<h2>OSVC-C220</h2>
|
||||
<ul>
|
||||
<li onclick='loadContent(dashboardContent(), this)' class='active'>대시보드</li>
|
||||
<li onclick='toggleSubMenu(`call-management`)'>통화 관리 <i id='call-management-icon' class='fas fa-chevron-right'></i></li>
|
||||
<ul class='submenu' id='call-management'>
|
||||
<!--<li onclick='loadContent(`<h3>전화 걸기</h3><p>통화 기록을 확인하세요.</p>`, this)'>전화 걸기</li>-->
|
||||
<li onclick='loadContent(callSendContent(), this)'>전화 걸기</li>
|
||||
<li onclick='callHistoryFromUrl(this)'>주소록</li>
|
||||
<li onclick='loadContent(callHistoryContent(), this);updateTablePager();'>최근 통화</li>
|
||||
</ul>
|
||||
<li onclick='loadContent(dashboardContent(), this)'>시스템 정보</li>
|
||||
<li onclick='toggleSubMenu(`settings`)'>설정 <i id='settings-icon' class='fas fa-chevron-right'></i></li>
|
||||
<ul class='submenu' id='settings'>
|
||||
<li onclick='loadContent(networkSettingContent(), this)'>네트워크 설정</li>
|
||||
<li onclick='loadContent(`<h3>일반 설정</h3><p>일반 설정을 확인하세요.</p>`, this)'>일반 설정</li>
|
||||
<li onclick='loadContent(`<h3>보안 설정</h3><p>보안 설정을 확인하세요.</p>`, this)'>보안 설정</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='content'>
|
||||
<!--<div id='content-header' class='content-header'>대시보드 - 시스템 상태</div>-->
|
||||
<div id='content-area'>
|
||||
<div class='dashboard-container'>
|
||||
<div class='dashboard-section system-status'>
|
||||
<h3>시스템 상태</h3>
|
||||
<ul>
|
||||
<li><span class='status-indicator'></span>LAN Network</li>
|
||||
<li><span class='status-indicator'></span>Wi-Fi Network</li>
|
||||
<li><span class='status-indicator'></span>Built-in Camera</li>
|
||||
<li><span class='status-indicator'></span>Remote Control</li>
|
||||
<li><span class='status-indicator'></span>Auto Answer Point-to-Point Video</li>
|
||||
<li><span class='status-indicator'></span>SIP Registrar Server</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='dashboard-section'>
|
||||
<h3>시스템 정보</h3>
|
||||
<p><strong>Device Name:</strong> StudioX52-84B2ECFM</p>
|
||||
<p><strong>Software Version:</strong> 4.4.1-426075</p>
|
||||
<p><strong>MAC Address:</strong> 00:e0:db:84:b2:ec</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
1774
app/src/main/assets/ritosip.html
Normal file
7
app/src/main/assets/signal_1.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg width="60" height="40" viewBox="0 0 60 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="4" y="30" width="8" height="10" rx="2" fill="#003366"/>
|
||||
<rect x="16" y="25" width="8" height="15" rx="2" fill="#CCCCCC"/>
|
||||
<rect x="28" y="20" width="8" height="20" rx="2" fill="#CCCCCC"/>
|
||||
<rect x="40" y="15" width="8" height="25" rx="2" fill="#CCCCCC"/>
|
||||
<rect x="52" y="10" width="8" height="30" rx="2" fill="#CCCCCC"/>
|
||||
</svg>
|
After Width: | Height: | Size: 419 B |
7
app/src/main/assets/signal_2.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg width="60" height="40" viewBox="0 0 60 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="4" y="30" width="8" height="10" rx="2" fill="#003366"/>
|
||||
<rect x="16" y="25" width="8" height="15" rx="2" fill="#003366"/>
|
||||
<rect x="28" y="20" width="8" height="20" rx="2" fill="#CCCCCC"/>
|
||||
<rect x="40" y="15" width="8" height="25" rx="2" fill="#CCCCCC"/>
|
||||
<rect x="52" y="10" width="8" height="30" rx="2" fill="#CCCCCC"/>
|
||||
</svg>
|
After Width: | Height: | Size: 419 B |
7
app/src/main/assets/signal_3.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg width="60" height="40" viewBox="0 0 60 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="4" y="30" width="8" height="10" rx="2" fill="#003366"/>
|
||||
<rect x="16" y="25" width="8" height="15" rx="2" fill="#003366"/>
|
||||
<rect x="28" y="20" width="8" height="20" rx="2" fill="#003366"/>
|
||||
<rect x="40" y="15" width="8" height="25" rx="2" fill="#CCCCCC"/>
|
||||
<rect x="52" y="10" width="8" height="30" rx="2" fill="#CCCCCC"/>
|
||||
</svg>
|
After Width: | Height: | Size: 419 B |
7
app/src/main/assets/signal_4.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg width="60" height="40" viewBox="0 0 60 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="4" y="30" width="8" height="10" rx="2" fill="#003366"/>
|
||||
<rect x="16" y="25" width="8" height="15" rx="2" fill="#003366"/>
|
||||
<rect x="28" y="20" width="8" height="20" rx="2" fill="#003366"/>
|
||||
<rect x="40" y="15" width="8" height="25" rx="2" fill="#003366"/>
|
||||
<rect x="52" y="10" width="8" height="30" rx="2" fill="#CCCCCC"/>
|
||||
</svg>
|
After Width: | Height: | Size: 419 B |
7
app/src/main/assets/signal_5.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<svg width="60" height="40" viewBox="0 0 60 40" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="4" y="30" width="8" height="10" rx="2" fill="#003366"/>
|
||||
<rect x="16" y="25" width="8" height="15" rx="2" fill="#003366"/>
|
||||
<rect x="28" y="20" width="8" height="20" rx="2" fill="#003366"/>
|
||||
<rect x="40" y="15" width="8" height="25" rx="2" fill="#003366"/>
|
||||
<rect x="52" y="10" width="8" height="30" rx="2" fill="#003366"/>
|
||||
</svg>
|
After Width: | Height: | Size: 419 B |
879
app/src/main/java/kr/co/rito/sipsvc/SipService.java
Normal file
@ -0,0 +1,879 @@
|
||||
package kr.co.rito.sipsvc;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.FileUtils;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import fi.iki.elonen.NanoHTTPD;
|
||||
|
||||
public class SipService extends Service {
|
||||
public static String TAG = "SipService";
|
||||
private static final String CHANNEL_ID = "SipServiceChannel";
|
||||
private static Context CONTEXT;
|
||||
private BroadcastReceiver sipReceiver = null;
|
||||
private JSONArray callHistory = null;
|
||||
private JSONArray addressBook = null;
|
||||
|
||||
WebServer server;
|
||||
|
||||
public SipService() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
Log.d(TAG, "Service Created");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.d(TAG, "Service Started");
|
||||
|
||||
CONTEXT = getApplicationContext();
|
||||
|
||||
createNotificationChannel();
|
||||
Notification notification = new Notification.Builder(this, CHANNEL_ID)
|
||||
.setContentTitle("RitoSipService Running")
|
||||
.setContentText("Service is running on background...")
|
||||
.setSmallIcon(android.R.drawable.ic_dialog_info)
|
||||
.build();
|
||||
startForeground(1, notification);
|
||||
|
||||
server = new WebServer();
|
||||
try {
|
||||
server.start();
|
||||
} catch(IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
Log.w("Httpd", "The server could not start.");
|
||||
}
|
||||
|
||||
sipReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if(intent.getAction().equals("kr.co.rito.ritosip.RESPONSE")) {
|
||||
String req = intent.getStringExtra("req");
|
||||
if(req.equals("call_history")) {
|
||||
String res = intent.getStringExtra("data");
|
||||
try {
|
||||
JSONArray json = new JSONArray(res);
|
||||
callHistory = json;
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else if(req.equals("contact_list")) {
|
||||
String res = intent.getStringExtra("data");
|
||||
try {
|
||||
JSONArray json = new JSONArray(res);
|
||||
addressBook = json;
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else if(req.equals("call_result")) {
|
||||
String res = intent.getStringExtra("data");
|
||||
if(res.equals("failed")) {
|
||||
|
||||
}
|
||||
}
|
||||
//Log.w("SipReceiver", "[RITO] Got Response : " + intent.getStringExtra("data"));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction("kr.co.rito.ritosip.RESPONSE");
|
||||
registerReceiver(sipReceiver, filter);
|
||||
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
while(true) {
|
||||
try {
|
||||
sleep(2000);
|
||||
// JSONObject json = new JSONObject();
|
||||
// sendRequestToApp("call_history", json);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Log.d("BackgroundService", "Service Destroyed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
// TODO: Return the communication channel to the service.
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
|
||||
private void createNotificationChannel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel serviceChannel = new NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
"Background Service Channel",
|
||||
NotificationManager.IMPORTANCE_DEFAULT
|
||||
);
|
||||
NotificationManager manager = getSystemService(NotificationManager.class);
|
||||
if (manager != null) {
|
||||
manager.createNotificationChannel(serviceChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void property_set(String key, String val) throws IllegalArgumentException {
|
||||
try {
|
||||
Class<?> SystemProperties = Class.forName("android.os.SystemProperties");
|
||||
//Parameters Types
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] paramTypes = { String.class, String.class };
|
||||
Method set = SystemProperties.getMethod("set", paramTypes);
|
||||
//Parameters
|
||||
Object[] params = { key, val };
|
||||
set.invoke(SystemProperties, params); }
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String property_get(String key) {
|
||||
String ret = "";
|
||||
try {
|
||||
Class<?> SystemProperties = Class.forName("android.os.SystemProperties");
|
||||
//Parameters Types
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] paramTypes = { String.class };
|
||||
Method get = SystemProperties.getMethod("get", paramTypes);
|
||||
//Parameters
|
||||
Object[] params = { key };
|
||||
ret = (String) get.invoke(SystemProperties, params);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
ret = "";
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "IllegalArgumentException e: "+ e.toString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ret = "";
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "Exception e: "+ e.toString());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static void sendRequestToApp(String request, JSONObject param) {
|
||||
Intent intent = new Intent("kr.co.rito.ritosip.REQUEST");
|
||||
intent.setPackage("kr.co.rito.ritosip");
|
||||
intent.putExtra("request", request);
|
||||
intent.putExtra("param", param.toString());
|
||||
|
||||
Log.w(TAG, "Send Intent : " + intent);
|
||||
CONTEXT.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
public static void sendRequestToFactory(String request, Map<String, String> params) {
|
||||
Intent intent = new Intent("kr.co.rito.factory.setting");
|
||||
intent.setPackage("kr.co.rito.factory");
|
||||
intent.putExtra("TYPE", request);
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
//System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue());
|
||||
intent.putExtra(entry.getKey(), entry.getValue());
|
||||
}
|
||||
Log.w(TAG, "Send Intent : " + intent);
|
||||
CONTEXT.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
|
||||
class WebServer extends NanoHTTPD {
|
||||
|
||||
public WebServer() {
|
||||
super(8080);
|
||||
}
|
||||
|
||||
public File getFileFromAssets(Context context, String fileName) throws IOException {
|
||||
// AssetManager를 통해 파일을 읽음
|
||||
AssetManager assetManager = context.getAssets();
|
||||
InputStream inputStream = assetManager.open(fileName);
|
||||
|
||||
// 임시 파일 생성
|
||||
File tempFile = File.createTempFile("temp_", fileName);
|
||||
tempFile.deleteOnExit(); // 애플리케이션 종료 시 삭제
|
||||
|
||||
// 임시 파일에 assets 파일의 내용을 복사
|
||||
try (FileOutputStream outputStream = new FileOutputStream(tempFile)) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = inputStream.read(buffer)) > 0) {
|
||||
outputStream.write(buffer, 0, length);
|
||||
}
|
||||
}
|
||||
|
||||
// InputStream을 닫음
|
||||
inputStream.close();
|
||||
|
||||
return tempFile; // 임시 파일 반환
|
||||
}
|
||||
|
||||
public String getFileNameFromURL(String url) {
|
||||
// 마지막 '/' 이후의 문자열을 파일명으로 추출
|
||||
if (url != null && url.contains("/")) {
|
||||
return url.substring(url.lastIndexOf('/') + 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response serve(String uri, Method method,
|
||||
Map<String, String> header,
|
||||
Map<String, String> parameters,
|
||||
Map<String, String> files) {
|
||||
String answer = "";
|
||||
try {
|
||||
Log.w(TAG, String.format("HTTP[%s] uri : %s", method.toString(), uri));
|
||||
if (uri.equals("/")) {
|
||||
File f = getFileFromAssets(getApplicationContext(), "ritosip.html");
|
||||
FileInputStream fis = new FileInputStream(f);
|
||||
String mimeType = "text/html";
|
||||
Response res = newChunkedResponse(Response.Status.OK, mimeType, fis);
|
||||
return res;
|
||||
} else if (uri.endsWith(".png")) {
|
||||
File uriFile = new File(uri);
|
||||
File f = getFileFromAssets(getApplicationContext(), uriFile.getName());
|
||||
FileInputStream fis = new FileInputStream(f);
|
||||
String mimeType = "image/png";
|
||||
|
||||
Response res = newChunkedResponse(Response.Status.OK, mimeType, fis);
|
||||
res.addHeader("Content-Disposition", "attachment; filename=\"" + f.getName() + "\"");
|
||||
return res;
|
||||
} else if (uri.endsWith(".jpg") || uri.endsWith(".mp4")) {
|
||||
String root = "/mnt/obb";
|
||||
File f = new File(root + "/" + uri);
|
||||
FileInputStream fis = new FileInputStream(f);
|
||||
String mimeType = "image/png";
|
||||
if (uri.endsWith(".jpg")) {
|
||||
mimeType = "image/jpeg";
|
||||
} else if (uri.endsWith(".mp4")) {
|
||||
mimeType = "video/mp4";
|
||||
}
|
||||
|
||||
Response res = newChunkedResponse(Response.Status.OK, mimeType, fis);
|
||||
res.addHeader("Content-Disposition", "attachment; filename=\"" + f.getName() + "\"");
|
||||
return res;
|
||||
} else if (uri.endsWith(".woff2") || uri.endsWith(".ttf")) {
|
||||
String fileName = getFileNameFromURL(uri);
|
||||
File f = getFileFromAssets(getApplicationContext(), fileName);
|
||||
FileInputStream fis = new FileInputStream(f);
|
||||
String mimeType = "font";
|
||||
|
||||
Response res = newChunkedResponse(Response.Status.OK, mimeType, fis);
|
||||
res.addHeader("Content-Disposition", "attachment; filename=\"" + f.getName() + "\"");
|
||||
return res;
|
||||
} else if (uri.endsWith(".js") || uri.endsWith(".css")) {
|
||||
String fileName = getFileNameFromURL(uri);
|
||||
File f = getFileFromAssets(getApplicationContext(), fileName);
|
||||
FileInputStream fis = new FileInputStream(f);
|
||||
String mimeType = "application/javascript";
|
||||
if (uri.endsWith(".css")) {
|
||||
mimeType = "text/css";
|
||||
}
|
||||
|
||||
Response res = newChunkedResponse(Response.Status.OK, mimeType, fis);
|
||||
res.addHeader("Content-Disposition", "attachment; filename=\"" + f.getName() + "\"");
|
||||
return res;
|
||||
} else if (uri.equals("/request_action.html")) {
|
||||
String request = parameters.get("req");
|
||||
if(request.equals("start_call")) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("number", parameters.get("param"));
|
||||
sendRequestToApp("start_call", json);
|
||||
} else if(request.equals("stop_call")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("stop_call", json);
|
||||
} else if(request.equals("property_reset")) {
|
||||
if(parameters.get("param") == "call_event_result") {
|
||||
property_set("sys.ritosip.call.event.result", "");
|
||||
}
|
||||
} else if(request.equals("audio_mute")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("audio_mute", json);
|
||||
} else if(request.equals("audio_unmute")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("audio_unmute", json);
|
||||
} else if(request.equals("video_mute")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("video_mute", json);
|
||||
} else if(request.equals("video_unmute")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("video_unmute", json);
|
||||
} else if(request.equals("audio_source")) {
|
||||
JSONObject json = new JSONObject();
|
||||
if(parameters.containsKey("target")) {
|
||||
json.put("target", parameters.get("target"));
|
||||
}
|
||||
sendRequestToApp("audio_source", json);
|
||||
} else if(request.equals("contact_list")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("contact_list", json);
|
||||
} else if(request.equals("save_address")) {
|
||||
JSONObject json = new JSONObject();
|
||||
if(parameters.containsKey("uri")) {
|
||||
json.put("uri", parameters.get("uri"));
|
||||
}
|
||||
if(parameters.containsKey("name")) {
|
||||
json.put("name", parameters.get("name"));
|
||||
}
|
||||
sendRequestToApp("save_address", json);
|
||||
} else if(request.equals("remove_address")) {
|
||||
JSONObject json = new JSONObject();
|
||||
if(parameters.containsKey("uri")) {
|
||||
json.put("uri", parameters.get("uri"));
|
||||
}
|
||||
sendRequestToApp("remove_address", json);
|
||||
} else if(request.equals("remove_history")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("remove_history", json);
|
||||
} else if(request.equals("network_setting")) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
String ipv4Type = parameters.get("type");
|
||||
if(ipv4Type.equals("dhcp")) {
|
||||
params.put("IPV4TYPE", "DHCP");
|
||||
} else if(ipv4Type.equals("static")) {
|
||||
String address = parameters.get("address");
|
||||
String netmask = parameters.get("netmask");
|
||||
String gateway = parameters.get("gateway");
|
||||
String dns = parameters.get("dns");
|
||||
params.put("IPV4TYPE", "STATIC");
|
||||
params.put("ADDRESS", address);
|
||||
params.put("NETMASK", netmask);
|
||||
params.put("GATEWAY", gateway);
|
||||
params.put("DNS", dns);
|
||||
}
|
||||
params.put("DEVTYPE", "ETHERNET");
|
||||
sendRequestToFactory("Ipv4", params);
|
||||
} else if(request.equals("server_setting")) {
|
||||
String display_name = parameters.get("display_name");
|
||||
String account_name = parameters.get("account_name");
|
||||
String password = parameters.get("password");
|
||||
String server_address = parameters.get("server_address");
|
||||
String transport = parameters.get("transport");
|
||||
String media_encryption = parameters.get("media_encryption");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("display_name", display_name);
|
||||
json.put("account_name", account_name);
|
||||
json.put("password", password);
|
||||
json.put("server_address", server_address);
|
||||
json.put("transport", transport);
|
||||
json.put("media_encryption", media_encryption);
|
||||
sendRequestToApp("set_account", json);
|
||||
} else if(request.equals("layout_setting")) {
|
||||
String layout = parameters.get("layout");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("layout", layout);
|
||||
sendRequestToApp("layout_setting", json);
|
||||
} else if(request.equals("misc_setting")) {
|
||||
String device_name = parameters.get("device_name");
|
||||
String display_type = parameters.get("display_type");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_name", device_name);
|
||||
json.put("display_type", display_type);
|
||||
sendRequestToApp("misc_setting", json);
|
||||
}
|
||||
} else if (uri.equals("/sip_status")) {
|
||||
JSONObject json = new JSONObject();
|
||||
String call_status = property_get("sys.ritosip.call.status");
|
||||
if(call_status.length() == 0) {
|
||||
call_status = "standby";
|
||||
}
|
||||
json.put("call_status", call_status);
|
||||
|
||||
String call_duration = property_get("sys.ritosip.call.duration");
|
||||
if(call_duration.length() == 0) {
|
||||
call_duration = "0";
|
||||
}
|
||||
json.put("call_duration", call_duration);
|
||||
|
||||
String call_number = property_get("sys.ritosip.call.number");
|
||||
if(call_number.contains("@")) {
|
||||
call_number = call_number.split("@")[0];
|
||||
}
|
||||
if(call_number.startsWith("sip:")) {
|
||||
call_number = call_number.split("sip:")[1];
|
||||
}
|
||||
json.put("call_number", call_number);
|
||||
|
||||
String near_screen_file = property_get("sys.ritosip.near_screen_file");
|
||||
near_screen_file = new File(near_screen_file).getName();
|
||||
json.put("near_screen_file", near_screen_file);
|
||||
|
||||
String far_screen_file = property_get("sys.ritosip.far_screen_file");
|
||||
far_screen_file = new File(far_screen_file).getName();
|
||||
json.put("far_screen_file", far_screen_file);
|
||||
|
||||
String net_ip_address = property_get("sys.ritosip.ipv4.address");
|
||||
if(net_ip_address.length() == 0) {
|
||||
net_ip_address = "미할당";
|
||||
}
|
||||
json.put("net_ip_address", net_ip_address);
|
||||
|
||||
String sip_address = property_get("sys.ritosip.sip.address");
|
||||
if(sip_address.length() == 0) {
|
||||
sip_address = "미할당";
|
||||
}
|
||||
json.put("sip_address", sip_address);
|
||||
|
||||
String register_status = property_get("sys.ritosip.sip.status");
|
||||
if(register_status.length() == 0) {
|
||||
register_status = "unregistered";
|
||||
}
|
||||
json.put("server_register_status", register_status);
|
||||
|
||||
String hdmi1_in_status = property_get("sys.ritosip.camera1.status");
|
||||
if(hdmi1_in_status.length() > 0) {
|
||||
json.put("hdmi1_in_status", hdmi1_in_status);
|
||||
}
|
||||
|
||||
String hdmi2_in_status = property_get("sys.ritosip.camera2.status");
|
||||
if(hdmi2_in_status.length() > 0) {
|
||||
json.put("hdmi2_in_status", hdmi2_in_status);
|
||||
}
|
||||
|
||||
String hdmi1_out_status = property_get("sys.ritosip.display1.status");
|
||||
if(hdmi1_out_status.length() > 0) {
|
||||
json.put("hdmi1_out_status", hdmi1_out_status);
|
||||
}
|
||||
|
||||
String hdmi2_out_status = property_get("sys.ritosip.display2.status");
|
||||
if(hdmi2_out_status.length() > 0) {
|
||||
json.put("hdmi2_out_status", hdmi2_out_status);
|
||||
}
|
||||
|
||||
String usb_mic_status = property_get("sys.ritosip.usb.microphone");
|
||||
if(usb_mic_status.length() > 0) {
|
||||
json.put("usb_mic_status", usb_mic_status);
|
||||
}
|
||||
|
||||
|
||||
//String audio_input_device = property_get("sys.rito.audio.input.device");
|
||||
String audio_input_device = property_get("sys.ritosip.audio.input.device");
|
||||
if(audio_input_device.length() > 0) {
|
||||
json.put("audio_input_device", audio_input_device);
|
||||
}
|
||||
|
||||
// String misc_info = property_get("rito.board.serial");
|
||||
// if(misc_info.length() > 0) {
|
||||
// json.put("board_serial", misc_info);
|
||||
// }
|
||||
//
|
||||
// misc_info = property_get("rito.board.mac");
|
||||
// if(misc_info.length() > 0) {
|
||||
// json.put("board_mac", misc_info);
|
||||
// }
|
||||
|
||||
String audio_mute_status = property_get("sys.ritosip.call.mute.audio");
|
||||
if(audio_mute_status.length() == 0) {
|
||||
audio_mute_status = "unmute";
|
||||
}
|
||||
json.put("audio_mute_status", audio_mute_status);
|
||||
|
||||
String video_mute_status = property_get("sys.ritosip.call.mute.video");
|
||||
if(video_mute_status.length() == 0) {
|
||||
video_mute_status = "unmute";
|
||||
}
|
||||
json.put("video_mute_status", video_mute_status);
|
||||
|
||||
String call_event_result = property_get("sys.ritosip.call.event.result");
|
||||
if(call_event_result.length() > 0) {
|
||||
json.put("call_event_result", call_event_result);
|
||||
property_set("sys.ritosip.call.event.result", "");
|
||||
}
|
||||
|
||||
String device_name = property_get("sys.ritosip.device_name");
|
||||
json.put("device_name", device_name);
|
||||
|
||||
|
||||
String account_name = property_get("sys.ritosip.account.account_name");
|
||||
json.put("account_name", account_name);
|
||||
|
||||
String display_name = property_get("sys.ritosip.account.display_name");
|
||||
json.put("display_name", display_name);
|
||||
|
||||
|
||||
String media_encryption = property_get("sys.ritosip.account.media_encryption");
|
||||
if(media_encryption.length() > 0) {
|
||||
json.put("media_encryption", media_encryption.equals("none") ? "사용안함" : "SRTP");
|
||||
}
|
||||
|
||||
String prefer_transport = property_get("sys.ritosip.account.prefer_transport");
|
||||
if(prefer_transport.length() > 0) {
|
||||
json.put("prefer_transport", prefer_transport);
|
||||
}
|
||||
|
||||
String server_address = property_get("sys.ritosip.account.server_address");
|
||||
json.put("server_address", server_address);
|
||||
|
||||
String answer_mode = property_get("sys.ritosip.answer_mode");
|
||||
if(answer_mode.length() > 0) {
|
||||
json.put("answer_mode", answer_mode);
|
||||
}
|
||||
|
||||
String ipv4_iptype = property_get("sys.ritosip.ipv4.iptype");
|
||||
if(ipv4_iptype.length() > 0) {
|
||||
json.put("ipv4_iptype", ipv4_iptype);
|
||||
}
|
||||
|
||||
String ipv4_address = property_get("sys.ritosip.ipv4.address");
|
||||
if(ipv4_address.length() > 0) {
|
||||
json.put("ipv4_address", ipv4_address);
|
||||
}
|
||||
|
||||
String ipv4_gateway = property_get("sys.ritosip.ipv4.gateway");
|
||||
if(ipv4_gateway.length() > 0) {
|
||||
json.put("ipv4_gateway", ipv4_gateway);
|
||||
}
|
||||
|
||||
String ipv4_netmask = property_get("sys.ritosip.ipv4.netmask");
|
||||
if(ipv4_netmask.length() > 0) {
|
||||
json.put("ipv4_netmask", ipv4_netmask);
|
||||
}
|
||||
|
||||
String ipv4_dns = property_get("sys.ritosip.ipv4.dns");
|
||||
if(ipv4_dns.length() > 0) {
|
||||
json.put("ipv4_dns", ipv4_dns);
|
||||
}
|
||||
|
||||
String far_view_display_id = property_get("sys.ritosip.far_view_display_id");
|
||||
if(far_view_display_id.length() > 0) {
|
||||
json.put("far_view_display_id", far_view_display_id);
|
||||
}
|
||||
|
||||
String display_split_mode = property_get("sys.ritosip.display_split_mode");
|
||||
if(display_split_mode.length() > 0) {
|
||||
json.put("display_split_mode", display_split_mode);
|
||||
}
|
||||
|
||||
String total_duration = property_get("sys.ritosip.sip.total_duration");
|
||||
if(total_duration.length() > 0) {
|
||||
json.put("total_duration", total_duration);
|
||||
}
|
||||
|
||||
answer = json.toString();
|
||||
} else if (uri.equals("/call_request")) {
|
||||
JSONObject json = new JSONObject();
|
||||
if(parameters.containsKey("number")) {
|
||||
json.put("number", parameters.get("number"));
|
||||
} else {
|
||||
json.put("number", "7779");
|
||||
}
|
||||
|
||||
sendRequestToApp("start_call", json);
|
||||
} else if (uri.equals("/hang_request")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("stop_call", json);
|
||||
} else if (uri.equals("/account_request")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("set_account", json);
|
||||
} else if (uri.equals("/trigger_update")) {
|
||||
JSONObject json = new JSONObject();
|
||||
sendRequestToApp("call_history", json);
|
||||
sendRequestToApp("contact_list", json);
|
||||
} else if (uri.equals("/call_statistics")) {
|
||||
String videoTxCodec = property_get("sys.ritosip.call.video.txCodec");
|
||||
String videoRxCodec = property_get("sys.ritosip.call.video.rxCodec");
|
||||
String videoFormat = property_get("sys.ritosip.call.video.format");
|
||||
String videoBitrateAll = property_get("sys.ritosip.call.video.current_bitrate");
|
||||
String videoLostAll = property_get("sys.ritosip.call.video.lost");
|
||||
String[] videoBitrate = videoBitrateAll.split("/");
|
||||
String UNKNOWN = "----";
|
||||
if (videoBitrate.length < 2) {
|
||||
videoBitrate = new String[2];
|
||||
videoBitrate[0] = UNKNOWN;
|
||||
videoBitrate[1] = UNKNOWN;
|
||||
}
|
||||
|
||||
String[] videoLost = videoLostAll.split("/");
|
||||
if (videoLost.length < 2) {
|
||||
videoLost = new String[2];
|
||||
videoLost[0] = "0";
|
||||
videoLost[1] = "0";
|
||||
}
|
||||
|
||||
String audioTxCodec = property_get("sys.ritosip.call.audio.txCodec");
|
||||
String audioRxCodec = property_get("sys.ritosip.call.audio.rxCodec");
|
||||
String audioBitrateAll = property_get("sys.ritosip.call.audio.current_bitrate");
|
||||
String audioLostAll = property_get("sys.ritosip.call.audio.lost");
|
||||
String[] audioBitrate = audioBitrateAll.split("/");
|
||||
if (audioBitrate.length < 2) {
|
||||
audioBitrate = new String[2];
|
||||
audioBitrate[0] = UNKNOWN;
|
||||
audioBitrate[1] = UNKNOWN;
|
||||
}
|
||||
|
||||
String[] audioLost = audioLostAll.split("/");
|
||||
if (audioLost.length < 2) {
|
||||
audioLost = new String[2];
|
||||
audioLost[0] = "0";
|
||||
audioLost[1] = "0";
|
||||
} else {
|
||||
for(int i = 0;i < audioLost.length;i++) {
|
||||
if(audioLost[i].equals("?")) {
|
||||
audioLost[i] = "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
answer = "<div class='dashboard-section system-status'>\n" +
|
||||
"\t<h3 style='margin-bottom:10px'>통화 통계</h3>\n" +
|
||||
"\t<div class='table-container'>\n" +
|
||||
"\t\t<table>\n" +
|
||||
"\t\t\t<thead>\n" +
|
||||
"\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t<th>스트림</th>\n" +
|
||||
"\t\t\t\t\t<th>코덱</th>\n" +
|
||||
"\t\t\t\t\t<th>포맷</th>\n" +
|
||||
"\t\t\t\t\t<th>비트레이트</th>\n" +
|
||||
"\t\t\t\t\t<th>패킷로스</th>\n" +
|
||||
"\t\t\t\t</tr>\n" +
|
||||
"\t\t\t</thead>\n" +
|
||||
"\t\t\t<tbody>\n" +
|
||||
// String.format("\t\t\t\t<tr><td>VIDEO TX</td><td>%s</td><td>%sp</td><td>%sk</td><td>0%%</td></tr>\n", videoTxCodec, videoFormat, videoBitrate[0]) +
|
||||
// String.format("\t\t\t\t<tr><td>VIDEO RX</td><td>%s</td><td>%sp</td><td>%sk</td><td>0%%</td></tr>\n", videoRxCodec, videoFormat, videoBitrate[1]) +
|
||||
// String.format("\t\t\t\t<tr><td>AUDIO TX</td><td>%s</td><td>%s</td><td>%sk</td><td>0%%</td></tr>\n", audioTxCodec, UNKNOWN, audioBitrate[0]) +
|
||||
// String.format("\t\t\t\t<tr><td>AUDIO RX</td><td>%s</td><td>%s</td><td>%sk</td><td>0%%</td></tr>\n", audioRxCodec, UNKNOWN, audioBitrate[1]) +
|
||||
String.format("\t\t\t\t<tr><td>VIDEO TX</td><td>%s</td><td>%sp</td><td>%sk</td><td>%s</td></tr>\n", videoTxCodec, videoFormat, videoBitrate[0], videoLost[0]) +
|
||||
String.format("\t\t\t\t<tr><td>VIDEO RX</td><td>%s</td><td>%sp</td><td>%sk</td><td>%s</td></tr>\n", videoRxCodec, videoFormat, videoBitrate[1], videoLost[1]) +
|
||||
String.format("\t\t\t\t<tr><td>AUDIO TX</td><td>%s</td><td>%s</td><td>%sk</td><td>%s</td></tr>\n", audioTxCodec, UNKNOWN, audioBitrate[0], audioLost[0]) +
|
||||
String.format("\t\t\t\t<tr><td>AUDIO RX</td><td>%s</td><td>%s</td><td>%sk</td><td>%s</td></tr>\n", audioRxCodec, UNKNOWN, audioBitrate[1], audioLost[1]) +
|
||||
"\t\t\t</tbody>\n" +
|
||||
"\t\t</table>\t\t\t\n" +
|
||||
"\t</div>\n" +
|
||||
"</div>";
|
||||
} else if (uri.equals("/dashboard")) {
|
||||
String versionInfo = property_get("sys.ritosip.version");
|
||||
String serialInfo = property_get("rito.board.serial");
|
||||
String macInfo = property_get("rito.board.mac");
|
||||
String hdmi1_in_status = property_get("sys.ritosip.camera1.status").equals("plugin") ? "status-indicator" : "status-indicator button-red";
|
||||
String hdmi2_in_status = property_get("sys.ritosip.camera2.status").equals("plugin") ? "status-indicator" : "status-indicator button-red";
|
||||
String hdmi1_out_status = property_get("sys.ritosip.display1.status").equals("connected") ? "status-indicator" : "status-indicator button-red";
|
||||
String hdmi2_out_status = property_get("sys.ritosip.display2.status").equals("connected") ? "status-indicator" : "status-indicator button-red";
|
||||
String usb_mic_status = property_get("sys.ritosip.usb.microphone").equals("connected") ? "status-indicator" : "status-indicator button-red";
|
||||
String register_status_info = property_get("sys.ritosip.sip.status");
|
||||
String total_call_duration = property_get("sys.ritosip.sip.total_duration");
|
||||
String register_status = "status-indicator button-red";
|
||||
|
||||
if(versionInfo.length() == 0) {
|
||||
versionInfo = "1.0.0";
|
||||
}
|
||||
|
||||
if(register_status_info.equals("registered")) {
|
||||
register_status = "status-indicator";
|
||||
} else if(register_status_info.equals("registering")) {
|
||||
register_status = "status-indicator button-orange";
|
||||
}
|
||||
|
||||
answer = "<div class='dashboard-container'>\n" +
|
||||
" <div class='dashboard-section system-status'>\n" +
|
||||
" <h3 style='margin-bottom:10px'>시스템 상태</h3>\n" +
|
||||
" <ul>\n" +
|
||||
" <li><span class='status-indicator'></span>네트워크 연결</li>\n" +
|
||||
String.format(" <li><span id='hdmi1-in-status' class='%s'></span>HDMI 입력 1</li>\n", hdmi1_in_status) +
|
||||
String.format(" <li><span id='hdmi2-in-status' class='%s'></span>HDMI 입력 2</li>\n", hdmi2_in_status) +
|
||||
String.format(" <li><span id='hdmi1-out-status' class='%s'></span>HDMI 출력 1</li>\n", hdmi1_out_status) +
|
||||
String.format(" <li><span id='hdmi2-out-status' class='%s'></span>HDMI 출력 2</li>\n", hdmi2_out_status) +
|
||||
String.format(" <li><span id='usb-mic-status' class='%s'></span>USB 마이크 연결</li>\n", usb_mic_status) +
|
||||
String.format(" <li><span id='server-register-status' class='%s'></span>SIP서버 연결</li>\n", register_status) +
|
||||
" </ul>\n" +
|
||||
" </div>\n" +
|
||||
" <div class='dashboard-section'>\n" +
|
||||
" <h3 style='margin-bottom:10px'>시스템 정보</h3>\n" +
|
||||
" <p class='status-text'><strong>모델명:</strong> OSVC-C220</p>\n" +
|
||||
String.format(" <p class='status-text'><strong>소프트웨어 버전:</strong> v%s</p>\n", versionInfo) +
|
||||
String.format(" <p class='status-text'><strong>시리얼 번호:</strong> %s</p>\n", serialInfo) +
|
||||
String.format(" <p class='status-text'><strong>MAC 주소:</strong> %s</p>\n", macInfo) +
|
||||
String.format(" <p class='status-text'><strong>총통화시간:</strong> <span id='total-duration' /></p>\n") +
|
||||
" </div>\n" +
|
||||
" </div>\n" +
|
||||
" </div>";
|
||||
} else if (uri.equals("/call_address")) {
|
||||
answer = "<div class='dashboard-container'>\n" +
|
||||
"\t<div class='dashboard-section system-status'>\n" +
|
||||
"\t\t<h3 style='margin-bottom:10px'>주소록</h3>\n" +
|
||||
"\t\t<div class='table-container'>\n" +
|
||||
"\t\t\t<div class=\"search-box\">\n" +
|
||||
"\t\t\t\t<input type=\"text\" placeholder=\"검색...\">\n" +
|
||||
"\t\t\t</div>\n" +
|
||||
"\t\t\t<table>\n" +
|
||||
"\t\t\t\t<thead>\n" +
|
||||
"\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t<th style='display:none'>URI</th>\n" +
|
||||
"\t\t\t\t\t\t<th width='30%'>연결번호</th>\n" +
|
||||
"\t\t\t\t\t\t<th width='30%'>이름</th>\n" +
|
||||
"\t\t\t\t\t\t<th>제어</th>\n" +
|
||||
"\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t</thead>\n" +
|
||||
"\t\t\t\t<tbody>\n";
|
||||
|
||||
if(addressBook != null) {
|
||||
for (int i = 0; i < addressBook.length(); i++) {
|
||||
JSONObject json = addressBook.getJSONObject(i);
|
||||
String peerUri = json.getString("uri");
|
||||
String name = json.getString("name");
|
||||
peerUri = peerUri.replace("sip:", "");
|
||||
String peerNumber = peerUri.split("@")[0];
|
||||
|
||||
// answer +=
|
||||
// String.format("\t\t\t\t\t\t\t<tr><td style='display:none'>%s</td><td>%s</td><td>%s</td><td><button class='table-inner-button' onclick='callStartWithNumber(%s)'>통화</button><button class='table-inner-button button-orange' style='margin-left:3px' onclick='modifyContact(%s)'>수정</button><button class='table-inner-button button-red' style='margin-left:3px' onclick='removeContact(%s)'>삭제</button></td></tr>\n",
|
||||
// peerUri, peerNumber, name, peerNumber, peerUri, peerUri);
|
||||
|
||||
answer +=
|
||||
String.format("\t\t\t\t\t\t\t<tr><td style='display:none'>%s</td><td>%s</td><td>%s</td><td><button class='table-inner-button' onclick='callStartWithNumber(\"%s\")'>통화</button><button class='table-inner-button button-red' style='margin-left:3px' onclick='removeContact(\"%s\")'>삭제</button></td></tr>\n",
|
||||
peerUri, peerNumber, name, peerNumber, json.getString("uri"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
answer += "\t\t\t\t</tbody>\n" +
|
||||
"\t\t\t</table>\n" +
|
||||
"\t\t\t<div class='pagination'></div>\n" +
|
||||
"\t\t</div>\n" +
|
||||
"\t</div>\n" +
|
||||
"\t<div class='dashboard-section'>\n" +
|
||||
"\t<h3 style='margin-bottom:10px'>주소록 관리</h3>\n" +
|
||||
"\t\t<h3 style='margin-bottom:20px'></h3>\n" +
|
||||
"<div style='display: flex;'>\n" +
|
||||
"\t\t\t\t\t\t\t<label class='input-label'>연결번호</label>\n" +
|
||||
"\t\t\t\t\t\t\t<div class='input-box'>\n" +
|
||||
"\t\t\t\t\t\t\t\t<input id='input-uri' type='text'>\n" +
|
||||
"\t\t\t\t\t\t\t</div>\n" +
|
||||
"\t\t\t\t\t\t</div>\n" +
|
||||
"\t\t\t\t\t\t<div style='display: flex;'>\n" +
|
||||
"\t\t\t\t\t\t\t<label class='input-label'>이름</label>\n" +
|
||||
"\t\t\t\t\t\t\t<div class='input-box'>\n" +
|
||||
"\t\t\t\t\t\t\t\t<input id='input-name' type='text'>\n" +
|
||||
"\t\t\t\t\t\t\t</div>\n" +
|
||||
"\t\t\t\t\t\t</div>" +
|
||||
" \t\t\t\t\t<button class='top-button-green' style='margin-bottom:15px' onclick='saveAddressBook()'>\n" +
|
||||
" <i class='fa-solid fa-user-plus'></i>\n" +
|
||||
" <div class='top-button-text'>저장하기</div>\n" +
|
||||
" </button>"+
|
||||
"\t</div>\n" +
|
||||
"</div>";
|
||||
} else if (uri.equals("/call_history")) {
|
||||
answer = "<div class='dashboard-section system-status'>\n" +
|
||||
"\t\t\t\t<h3 style='margin-bottom:10px'>최근 통화</h3>\n" +
|
||||
"\t\t\t\t<div class='table-container'>\n" +
|
||||
"\t\t\t\t\t<table>\n" +
|
||||
"\t\t\t\t\t\t<thead>\n" +
|
||||
"\t\t\t\t\t\t\t<tr>\n" +
|
||||
"\t\t\t\t\t\t\t\t<th>연결번호</th>\n" +
|
||||
"\t\t\t\t\t\t\t\t<th>타입</th>\n" +
|
||||
"\t\t\t\t\t\t\t\t<th>통화일시</th>\n" +
|
||||
"\t\t\t\t\t\t\t\t<th></th>\n" +
|
||||
"\t\t\t\t\t\t\t</tr>\n" +
|
||||
"\t\t\t\t\t\t</thead>\n" +
|
||||
"\t\t\t\t\t\t<tbody>\n";
|
||||
|
||||
if(callHistory != null) {
|
||||
for (int i = 0; i < callHistory.length(); i++) {
|
||||
JSONObject json = callHistory.getJSONObject(i);
|
||||
String peerUri = json.getString("peerUri");
|
||||
String callTime = json.getString("stopTime");
|
||||
peerUri = peerUri.replace("sip:", "");
|
||||
peerUri = peerUri.split(";")[0];
|
||||
String peerNumber = peerUri.split("@")[0];
|
||||
String strDirection = "송신";
|
||||
if(json.getString("direction").equals("in")) {
|
||||
strDirection = "수신";
|
||||
}
|
||||
|
||||
callTime = callTime.split("\\+")[0];
|
||||
callTime = callTime.replace("T", " ");
|
||||
|
||||
answer +=
|
||||
String.format("\t\t\t\t\t\t\t<tr><td>%s</td><td>%s</td><td>%s</td><td><button class='table-inner-button' onclick='callStartWithNumber(%s)'>통화</button></td></tr>\n",
|
||||
peerUri, strDirection, callTime, peerNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
answer +=
|
||||
"</tbody>\n" +
|
||||
"\t\t\t\t\t</table>\n" +
|
||||
"\t\t\t\t\t<div class='pagination'></div>\n" +
|
||||
"\t\t\t\t</div>\n" +
|
||||
" \t\t\t\t\t<button class='top-button' style='margin-top:15px' onclick='removeHistory()'>\n" +
|
||||
" <i class='fa-solid fa-trash'></i>\n" +
|
||||
" <div class='top-button-text'>전체삭제</div>\n" +
|
||||
" </button>"+
|
||||
"\t\t\t</div>";
|
||||
|
||||
//answer += "<button class='apply-button' onclick='applyMiscSetting()'>전체삭제</button>";
|
||||
} else if (uri.equals("/system_status")) {
|
||||
JSONObject json = new JSONObject();
|
||||
String mediaInput = property_get("sys.ritosip.media.input");
|
||||
if(mediaInput.length() == 0) {
|
||||
mediaInput = "camera";
|
||||
}
|
||||
json.put("media_input", mediaInput);
|
||||
|
||||
String micMute = property_get("sys.ritosip.call.mute.audio");
|
||||
if(micMute.length() == 0) {
|
||||
micMute = "unmute";
|
||||
}
|
||||
json.put("mic_mute", micMute);
|
||||
|
||||
answer = json.toString();
|
||||
} else if (uri.equals("/mic_control")) {
|
||||
JSONObject json = new JSONObject();
|
||||
if(parameters.containsKey("mic_mute")) {
|
||||
json.put("mic_mute", parameters.get("number"));
|
||||
}
|
||||
|
||||
sendRequestToApp("mic_control", json);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return NanoHTTPD.newFixedLengthResponse(answer);
|
||||
}
|
||||
}
|
||||
}
|
13
app/src/main/java/kr/co/rito/sipsvc/Utils.java
Normal file
@ -0,0 +1,13 @@
|
||||
package kr.co.rito.sipsvc;
|
||||
|
||||
public class Utils {
|
||||
public static void shellCommand(String order) {
|
||||
try {
|
||||
Process process = Runtime.getRuntime().exec(order);
|
||||
process.waitFor();
|
||||
process.destroy();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
30
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
6
app/src/main/res/mipmap-anydpi/ic_launcher.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
6
app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 7.6 KiB |
16
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Sipsvc" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
10
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
3
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">sipsvc</string>
|
||||
</resources>
|
16
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Sipsvc" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
17
app/src/test/java/kr/co/rito/sipsvc/ExampleUnitTest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package kr.co.rito.sipsvc;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
4
build.gradle.kts
Normal file
@ -0,0 +1,4 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.1" apply false
|
||||
}
|
21
gradle.properties
Normal file
@ -0,0 +1,21 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Tue Feb 18 21:30:32 KST 2025
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
185
gradlew
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
89
gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
18
settings.gradle.kts
Normal file
@ -0,0 +1,18 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "sipsvc"
|
||||
include(":app")
|
||||
|