### Initialize Environment Configuration Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/configuration.md Commands to set up the .env file from the example and start the services. ```bash cp .env.example .env # Edit .env with your settings docker compose up -d ``` -------------------------------- ### Install Kubernetes Tooling and Firewall Setup Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/README.md Installs necessary Kubernetes tooling and configures the firewall on a cluster node. ```bash # Installs Kubernetes tooling and sets up the firewall. sudo curl https://get.calltelemetry.com | sudo sh -s -- prep-cluster-node ``` -------------------------------- ### Deploy PostgreSQL Operator Examples Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/dev_environment_notes.md Apply the PostgreSQL operator examples to set up a dedicated SQL cluster within the development namespace. ```bash kubectl apply -n ct-dev -f postgres-operator-examples/kustomize/postgres/ct-postgres ``` -------------------------------- ### Start All Services Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/docker-compose-reference.md Starts all defined services in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Install MetalLB using Helm Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/README.md Installs MetalLB, a load balancer for bare metal Kubernetes clusters, using Helm. Ensure you are on the primary node. ```bash kubectl create namespace metallb-system helm repo add metallb https://metallb.github.io/metallb helm install -n metallb-system metallb metallb/metallb ``` -------------------------------- ### Initialize Environment Configuration Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Create the .env file from the provided example template. ```bash cp .env.example .env ``` -------------------------------- ### List Phones Request Example Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example cURL command to list phones with filtering and pagination. ```bash curl 'https://appliance/api/phones?api_key=abcd1234&model=7941&limit=50' ``` -------------------------------- ### Install K3s Primary Node Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/README.md Installs K3s on the primary node, disabling Traefik and ServiceLB. Ensure to replace `` with a strong, unique token. ```bash # From Primary Node. export K3S_TOKEN="" curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE=0644 sh -s server --cluster-init --disable traefik --disable servicelb ``` -------------------------------- ### Install Helm Chart with Custom Values Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/dev_environment_notes.md Install the stable HA Helm chart in the development namespace using the prepared custom values file. ```bash helm install -n ct-dev ct ct_charts/stable-ha -f ./ct_dev.yaml ``` -------------------------------- ### Get Policy Details Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example JSON response structure for retrieving specific policy details. ```json { "id": "policy-uuid", "name": "Block International", "description": "Block calls to international numbers", "enabled": true, "priority": 1, "rules": [ { "id": "rule-uuid", "calling_number_pattern": "", "called_number_pattern": "011.*", "action": "deny", "greeting_id": null, "redirect_number": null, "order": 1, "enabled": true } ], "created_at": "2024-01-15T10:30:45Z", "modified_at": "2024-01-15T11:22:33Z" } ``` -------------------------------- ### Troubleshoot Database Pod Startup Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/kubernetes-reference.md Use these commands to inspect the status and logs of the PostgreSQL pod when it fails to start. ```bash kubectl describe pod calltelemetry-postgres-0 -n calltelemetry kubectl logs calltelemetry-postgres-0 -n calltelemetry ``` -------------------------------- ### CURRI Policy Request cURL Example Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/endpoints.md Example command to send a policy request using cURL. The request body is read from a local file named curri.xml. ```bash curl -X POST \ 'http://192.168.1.100/curri/policy?api_key=089131c3-6de2-4cc2-ae97-cd20975cd09e' \ -H 'Content-Type: application/xml' \ -d @curri.xml ``` -------------------------------- ### Deploy CallTelemetry with Docker Compose Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Use these commands to clone the repository, configure the environment, and start the services. ```bash git clone https://github.com/calltelemetry/calltelemetry.git cd calltelemetry cp .env.example .env # Edit .env with your settings docker compose up -d ``` -------------------------------- ### Factory Reset Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example response returned when a factory reset command is successfully queued. ```json { "command_id": "command-uuid", "device_name": "SEP001122AABBCC", "action": "factory_reset", "status": "queued", "queued_at": "2024-01-15T10:30:45Z" } ``` -------------------------------- ### Install CrunchyData PostgreSQL Operator and CRDs Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/README.md Installs the CrunchyData PostgreSQL Operator and its Custom Resource Definitions (CRDs) using Kustomize. This is done from the primary node. ```bash kubectl create namespace postgres-operator git clone https://github.com/CrunchyData/postgres-operator-examples.git kubectl apply --server-side -k postgres-operator-examples/kustomize/install/default ``` -------------------------------- ### Multi-Cluster Configuration Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/integration-patterns.md Example configuration steps for registering multiple Unified Communications Manager clusters within the CallTelemetry appliance. ```text Administration → Cluster Configuration Cluster 1: callmanager1.site1.com Cluster 2: callmanager2.site2.com ``` -------------------------------- ### List Policies Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example JSON response structure for listing policies. ```json { "data": [ { "id": "policy-uuid", "name": "Block International", "description": "Block calls to international numbers", "enabled": true, "priority": 1, "rule_count": 3, "created_at": "2024-01-15T10:30:45Z", "modified_at": "2024-01-15T11:22:33Z", "modified_by": "admin@example.com" } ], "total_count": 12, "page": 0, "limit": 50 } ``` -------------------------------- ### Docker Compose Profile Configuration Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/configuration.md Examples of setting COMPOSE_PROFILES to enable specific service stacks. ```env COMPOSE_PROFILES= # Base only COMPOSE_PROFILES=jtapi # Base + JTAPI + SeaweedFS COMPOSE_PROFILES=storage # Base + SeaweedFS only ``` -------------------------------- ### Command Status Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example response showing the current status of a previously issued command. ```json { "command_id": "command-uuid", "device_name": "SEP001122AABBCC", "action": "factory_reset", "status": "completed|in_progress|failed", "queued_at": "2024-01-15T10:30:45Z", "sent_at": "2024-01-15T10:31:00Z", "completed_at": "2024-01-15T10:31:15Z", "error_message": null } ``` -------------------------------- ### GET /metrics Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/endpoints.md Application metrics endpoint in Prometheus format. ```APIDOC ## GET /metrics ### Description Provides application metrics in Prometheus format, including HTTP request counts, latencies, policy decision times, database connection pool stats, and JTAPI communication metrics. ### Method GET ### Endpoint /metrics ### Response #### Success Response (200) - **Format** (string) - Prometheus metrics data. ``` -------------------------------- ### Permit Response Example Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/curri-api.md Standard XML response indicating that a call is allowed to proceed. ```xml Permit ``` -------------------------------- ### List Phones Parameters Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Configuration parameters for the GET /api/phones endpoint. ```text api_key= # Required: API key sort= # Optional: Sort by field (name, model, serial) order= # Optional: Sort order (default: asc) limit= # Optional: Results per page (default: 100, max: 1000) offset= # Optional: Pagination offset (default: 0) filter=: # Optional: Filter by field ``` -------------------------------- ### Retrieve Prometheus Metrics Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example output for the metrics endpoint in Prometheus text format. ```text # HELP http_requests_total Total HTTP requests # TYPE http_requests_total counter http_requests_total{method="POST",path="/curri/policy",status="200"} 125634 http_requests_total{method="GET",path="/api/phones",status="200"} 8932 ``` -------------------------------- ### Remote Reboot Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example response returned when a reboot command is successfully sent to the device. ```json { "command_id": "command-uuid", "device_name": "SEP001122AABBCC", "action": "reboot", "status": "sent", "sent_at": "2024-01-15T10:30:45Z" } ``` -------------------------------- ### Install K3s Secondary Node Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/README.md Joins secondary nodes to the K3s cluster. Requires the primary node's IP and the cluster token. Ensure to replace `` and ``. ```bash # From the secondary node to be installed. export primary_ip="" export K3S_TOKEN="" sudo curl -sfL https://get.k3s.io | K3S_URL="https://$primary_ip:6443" K3S_KUBECONFIG_MODE=0644 sh -s server --disable traefik --disable servicelb mkdir -p ~/.kube sudo cat /etc/rancher/k3s/k3s.yaml > ~/.kube/config ``` -------------------------------- ### List Policies Parameters Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Required and optional query parameters for the GET /api/policies endpoint. ```text api_key= # Required enabled= # Optional: Filter by enabled status limit= # Optional: Results per page (default: 50) ``` -------------------------------- ### Unified Communications Manager Configuration Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/integration-patterns.md Example settings for a translation pattern and policy server endpoint within the Cisco Unified Communications Manager interface. ```text Translation Pattern: 9[2-9]XXXXXXX Block This Pattern: checked Policy Server: https://192.168.1.100:443/curri/policy?api_key= ``` -------------------------------- ### Prepare for system upgrade Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Create a database backup and identify the current version before proceeding with an upgrade. ```bash docker compose exec db pg_dump -U calltelemetry calltelemetry_prod | gzip > backup_$(date +%Y%m%d).sql.gz ``` ```bash cat .env | grep VERSION ``` -------------------------------- ### Execute Deployment Commands Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/kubernetes-reference.md Commands to apply the configuration, verify the status, and connect to the database instance. ```bash kubectl apply -f kubernetes/postgres/ct-postgres.yaml # Verify StatefulSet kubectl get statefulset -n calltelemetry kubectl get pvc -n calltelemetry # Connect to database kubectl exec -it calltelemetry-postgres-0 -n calltelemetry -- psql -U calltelemetry -d calltelemetry_prod ``` -------------------------------- ### Clone Deployment Repository Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Initial step to obtain the deployment files from the repository. ```bash git clone https://github.com/calltelemetry/calltelemetry.git cd calltelemetry ``` -------------------------------- ### Prepare TLS Certificates Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Create the directory for custom TLS certificates. ```bash mkdir -p certs # Place appliance.crt and appliance_key.pem in certs/ ``` -------------------------------- ### Deploy PostgreSQL StatefulSet Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/kubernetes-reference.md Applies the database manifest and waits for the pod to reach a ready state. ```bash kubectl apply -f kubernetes/postgres/ct-postgres.yaml kubectl wait --for=condition=Ready pod -l app=calltelemetry-postgres -n calltelemetry --timeout=300s ``` -------------------------------- ### GET /metrics Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/endpoints.md Retrieves Prometheus metrics for monitoring. ```APIDOC ## GET /metrics ### Description Provides Prometheus metrics for scraping by monitoring tools like PRTG or Prometheus. This endpoint is unauthenticated. ### Method GET ### Endpoint /metrics ### Response #### Success Response (200) - **Body** (text/plain) - Prometheus metrics format including caddy_http_requests_total and application internal metrics ``` -------------------------------- ### GET /healthz Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/endpoints.md Performs a service health check. ```APIDOC ## GET /healthz ### Description Service health check endpoint used to verify the status of the application. ### Method GET ### Endpoint /healthz ### Response #### Success Response (200) - **Body** (string) - Plain text status ``` -------------------------------- ### Execute system upgrade Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Update environment variables, pull new images, and restart services to apply changes. ```env WEB_VERSION=x.y.z VUE_VERSION=x.y.z TRACEROUTE_VERSION=x.y.z ``` ```bash docker compose pull ``` ```bash docker compose down ``` ```bash docker compose up -d ``` ```bash docker compose logs -f web | grep -i migration # Or check health docker compose ps | grep healthy ``` -------------------------------- ### GET /api/blocklist Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/features-and-capabilities.md Retrieves a list of all currently blocked numbers. ```APIDOC ## GET /api/blocklist ### Description Returns a JSON array of all blocked entries. ### Method GET ### Endpoint /api/blocklist ### Parameters #### Query Parameters - **api_key** (string) - Required - The API authentication key. ``` -------------------------------- ### Deploy Web Service Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/kubernetes-reference.md Applies the web deployment manifest and monitors the rollout status. ```bash kubectl apply -f calltelemetry-web-deployment.yaml kubectl rollout status deployment/calltelemetry-web -n calltelemetry ``` -------------------------------- ### Initialize Namespace and Database Secrets Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/kubernetes-reference.md Creates the dedicated namespace and a secure database secret with a generated password. ```bash kubectl create namespace calltelemetry kubectl create secret generic calltelemetry-db-secret \ --from-literal=username=calltelemetry \ --from-literal=password=$(openssl rand -base64 32) \ -n calltelemetry ``` -------------------------------- ### GET / (Port 8080) Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/endpoints.md Health check for the Vue application. ```APIDOC ## GET / ### Description Health check for the Vue application. ### Method GET ### Endpoint / ### Response #### Success Response (200) - **Response** (string) - Returns Index HTML or 404. ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Required settings for network, performance, and storage integration. ```env DEFAULT_IPV4=192.168.1.100 # Your appliance IP PERFORMANCE_PROFILE=small # Start here, scale up later POSTGRES_PASSWORD=secure-password S3_ACCESS_KEY_ID=your-key S3_SECRET_ACCESS_KEY=your-secret ``` -------------------------------- ### GET /healthz (Port 4100) Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/endpoints.md Health check for the Traceroute service. ```APIDOC ## GET /healthz ### Description Health check for the Traceroute service. ### Method GET ### Endpoint /healthz ### Response #### Success Response (200) - **Response** (string) - Returns health status. ``` -------------------------------- ### SSD/NVMe Optimization Parameters Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/configuration.md Environment variables for tuning PostgreSQL performance on high-speed storage. ```env PG_RANDOM_PAGE_COST=1.1 PG_EFFECTIVE_IO_CONCURRENCY=200 ``` -------------------------------- ### GET /api/policies/{policy_id} Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Retrieves the full details of a specific policy by its ID. ```APIDOC ## GET /api/policies/{policy_id} ### Description Retrieves the full details of a specific policy, including its associated rules. ### Method GET ### Endpoint /api/policies/{policy_id} ### Parameters #### Path Parameters - **policy_id** (string) - Required - The unique identifier of the policy ### Response #### Success Response (200) - **id** (string) - Policy ID - **name** (string) - Policy name - **description** (string) - Policy description - **enabled** (boolean) - Enabled status - **priority** (number) - Policy priority - **rules** (array) - List of rules associated with the policy - **created_at** (string) - Creation timestamp - **modified_at** (string) - Last modification timestamp #### Response Example { "id": "policy-uuid", "name": "Block International", "description": "Block calls to international numbers", "enabled": true, "priority": 1, "rules": [ { "id": "rule-uuid", "calling_number_pattern": "", "called_number_pattern": "011.*", "action": "deny", "greeting_id": null, "redirect_number": null, "order": 1, "enabled": true } ], "created_at": "2024-01-15T10:30:45Z", "modified_at": "2024-01-15T11:22:33Z" } ``` -------------------------------- ### Deploy CallTelemetry on Kubernetes Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Commands to create the namespace and apply the required PostgreSQL and Traefik manifests. ```bash kubectl create namespace calltelemetry kubectl apply -f kubernetes/postgres/ct-postgres.yaml -n calltelemetry # Deploy web service, vue service, etc. kubectl apply -f kubernetes/traefik.yaml -n calltelemetry ``` -------------------------------- ### GET /api/policies Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Retrieves a list of all policies, with optional filtering by enabled status. ```APIDOC ## GET /api/policies ### Description Retrieves a list of all policies. Supports filtering by enabled status and pagination. ### Method GET ### Endpoint /api/policies ### Parameters #### Query Parameters - **api_key** (string) - Required - API authentication key - **enabled** (boolean) - Optional - Filter by enabled status - **limit** (number) - Optional - Results per page (default: 50) ### Response #### Success Response (200) - **data** (array) - List of policy objects - **total_count** (number) - Total number of policies - **page** (number) - Current page index - **limit** (number) - Results per page #### Response Example { "data": [ { "id": "policy-uuid", "name": "Block International", "description": "Block calls to international numbers", "enabled": true, "priority": 1, "rule_count": 3, "created_at": "2024-01-15T10:30:45Z", "modified_at": "2024-01-15T11:22:33Z", "modified_by": "admin@example.com" } ], "total_count": 12, "page": 0, "limit": 50 } ``` -------------------------------- ### List Blocked Numbers Parameters Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Query parameters for the GET /api/blocklist endpoint. ```text api_key= # Required limit= # Optional: Results per page (default: 100) offset= # Optional: Pagination offset (default: 0) number= # Optional: Filter by number pattern ``` -------------------------------- ### Diagnose Appliance Connectivity Issues Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Use these commands to verify network reachability, Docker network status, and reverse proxy logs when the appliance is unreachable. ```bash # Check network connectivity ping appliance-ip # Check Docker networking docker network ls docker inspect ct # Check reverse proxy docker compose logs caddy | tail -20 ``` -------------------------------- ### Configure Kubectl on Primary Node Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/README.md Sets up kubectl for interacting with the K3s cluster by copying the configuration file. ```bash # From Primary node. mkdir -p ~/.kube sudo cat /etc/rancher/k3s/k3s.yaml > ~/.kube/config ``` -------------------------------- ### Update and Restart Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/docker-compose-reference.md Pulls the latest images and recreates containers to apply updates. ```bash docker compose pull docker compose up -d ``` -------------------------------- ### Restore database from backup Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Stop the web service to prevent data corruption, restore the SQL dump, and verify the data. ```bash # Stop web service (prevent concurrent writes) docker compose stop web # Restore from backup docker compose exec -T db psql -U calltelemetry calltelemetry_prod < backup.sql # Restart web service docker compose start web # Verify docker compose exec db psql -U calltelemetry calltelemetry_prod -c "SELECT COUNT(*) FROM policies" ``` -------------------------------- ### GET /api/blocklist Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Retrieves a list of blocked numbers based on optional filters and pagination. ```APIDOC ## GET /api/blocklist ### Description Retrieves a list of blocked numbers. Supports filtering by number pattern and pagination. ### Method GET ### Endpoint /api/blocklist ### Parameters #### Query Parameters - **api_key** (string) - Required - API key for authentication - **limit** (number) - Optional - Results per page (default: 100) - **offset** (number) - Optional - Pagination offset (default: 0) - **number** (string) - Optional - Filter by number pattern ### Response #### Success Response (200) - **data** (array) - List of blocked number entries - **total_count** (number) - Total number of entries - **page** (number) - Current page index - **limit** (number) - Results per page #### Response Example { "data": [ { "id": "block-entry-uuid", "number": "5551234567", "number_type": "exact|prefix|regex", "reason": "spam", "created_at": "2024-01-15T10:30:45Z", "created_by": "admin@example.com", "last_matched": "2024-01-15T11:22:33Z", "match_count": 42 } ], "total_count": 156, "page": 0, "limit": 100 } ``` -------------------------------- ### Get Phone Details Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md JSON structure returned for a specific phone device. ```json { "id": "phone-uuid", "device_name": "SEP001122AABBCC", "model": "CP-7942G", "serial_number": "FCH1234567890", "ip_address": "192.168.1.100", "firmware_version": "SCCP70.8-3-3S", "hardware_version": "V03", "registered_user": "john.doe", "device_pool": "Default", "phone_template": "Standard 7942", "description": "Executive", "cdp_neighbor": "switch1.example.com", "cdp_interface": "Gi0/1", "cdp_port": "Gi0/1", "lldp_neighbor": "switch1", "lldp_interface": "ge-0/0/1", "device_location": "Building A, Floor 3", "lines": [ { "directory_number": "5551234567", "description": "Main Line" } ], "last_discovered": "2024-01-15T10:30:45Z" } ``` -------------------------------- ### Display project file structure Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/README.md Visual representation of the documentation directory layout. ```text output/ ├── README.md (this file) ├── OVERVIEW.md ├── endpoints.md ├── configuration.md ├── docker-compose-reference.md ├── deployment-reference.md ├── features-and-capabilities.md ├── integration-patterns.md ├── kubernetes-reference.md ├── types.md └── api-reference/ ├── curri-api.md └── management-api.md ``` -------------------------------- ### Rollback system version Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Revert environment configuration and restore the database if an upgrade fails. ```bash docker compose down ``` ```bash # Revert VERSION variables git checkout .env.example cp .env.bak .env ``` ```bash docker compose exec -T db dropdb -U calltelemetry calltelemetry_prod docker compose exec -T db createdb -U calltelemetry calltelemetry_prod docker compose exec -T db psql -U calltelemetry calltelemetry_prod < backup.sql ``` ```bash docker compose up -d ``` -------------------------------- ### Perform database backups Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Methods for backing up the production database using Docker Compose, native PostgreSQL tools, or volume snapshots. ```bash docker compose exec db pg_dump -U calltelemetry calltelemetry_prod > backup.sql gzip backup.sql ``` ```bash docker compose exec db pg_dump -U calltelemetry -Fc calltelemetry_prod > backup.dump ``` ```bash docker volume create backup_db docker compose cp db:/bitnami/postgresql/data - > db_backup.tar ``` -------------------------------- ### Expose the web service Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/kubernetes-reference.md Creates a ClusterIP service to route traffic to the web deployment pods on ports 4000 and 4080. ```yaml apiVersion: v1 kind: Service metadata: name: calltelemetry-web namespace: calltelemetry spec: type: ClusterIP # Or LoadBalancer for external access ports: - name: http-api port: 4000 targetPort: http-api - name: http-metrics port: 4080 targetPort: http-metrics selector: app: calltelemetry-web ``` -------------------------------- ### Prepare Helm Chart Values for Development Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/dev_environment_notes.md Create a custom YAML file to configure Helm chart values for the development environment, specifying IP addresses. ```bash cat < ./custom_dev.yaml # ct_dev.yaml environment: dev primary_ip: /32 secondary_ip: /32 admin_ip: /32 EOF ``` -------------------------------- ### List CDR Records Parameters Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Required and optional query parameters for the GET /api/cdr/records endpoint. ```text api_key= # Required start_time= # Required: Date range start end_time= # Required: Date range end calling_number= # Optional: Filter by calling number called_number= # Optional: Filter by called number limit= # Optional: Results per page (default: 100, max: 10000) offset= # Optional: Pagination offset ``` -------------------------------- ### Database Commands Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/docker-compose-reference.md Provides commands for connecting to the PostgreSQL database and performing backups. ```bash # Connect to PostgreSQL docker compose exec db psql -U calltelemetry -d calltelemetry_prod # Backup docker compose exec db pg_dump -U calltelemetry calltelemetry_prod > backup.sql ``` -------------------------------- ### GET /api/phones/{device_name} Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Retrieves detailed information for a specific phone identified by its MAC address. ```APIDOC ## GET /api/phones/{device_name} ### Description Retrieves detailed configuration and status information for a specific phone. ### Method GET ### Endpoint /api/phones/{device_name} ### Parameters #### Path Parameters - **device_name** (string) - Required - Phone MAC address (e.g., SEP001122AABBCC) #### Query Parameters - **api_key** (string) - Required - API key for authentication ### Response #### Success Response (200) - **id** (string) - Unique identifier for the phone - **device_name** (string) - MAC address of the device - **model** (string) - Phone model - **serial_number** (string) - Device serial number - **ip_address** (string) - Current IP address - **firmware_version** (string) - Installed firmware version - **lines** (array) - List of configured lines on the phone ``` -------------------------------- ### GET /api/phones Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Retrieves a list of all phones managed by the system, with support for sorting, filtering, and pagination. ```APIDOC ## GET /api/phones ### Description Retrieves a list of all phones managed by the system. Supports filtering, sorting, and pagination. ### Method GET ### Endpoint /api/phones ### Parameters #### Query Parameters - **api_key** (string) - Required - API key for authentication - **sort** (string) - Optional - Sort by field (name, model, serial) - **order** (string) - Optional - Sort order (asc or desc, default: asc) - **limit** (number) - Optional - Results per page (default: 100, max: 1000) - **offset** (number) - Optional - Pagination offset (default: 0) - **filter** (string) - Optional - Filter by field (format: field:value) ### Response #### Success Response (200) - **data** (array) - List of phone objects - **total_count** (number) - Total number of phones - **page** (number) - Current page index - **limit** (number) - Limit applied to the request ``` -------------------------------- ### Backup and restore media files Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Use Alpine containers to archive or extract SeaweedFS data volumes. ```bash # Backup SeaweedFS data docker run --rm -v calltelemetry_seaweedfs_data:/data \ -v $(pwd)/backup:/backup \ alpine tar czf /backup/seaweedfs_$(date +%s).tar.gz -C /data . # Restore docker run --rm -v calltelemetry_seaweedfs_data:/data \ -v $(pwd)/backup:/backup \ alpine tar xzf /backup/seaweedfs_*.tar.gz -C /data ``` -------------------------------- ### Rate Limit Exceeded Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example of the HTTP response returned when the API rate limit is exceeded. ```http HTTP/1.1 429 Too Many Requests X-RateLimit-Remaining: 0 X-RateLimit-Reset: 2024-01-15T10:31:45Z ``` -------------------------------- ### Monitor service health with Docker Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Use these commands to check container status, view logs, and verify database connectivity. ```bash docker compose ps # Service status docker compose logs -f web # Application logs docker compose exec db psql -U calltelemetry -c "SELECT 1" # DB health ``` -------------------------------- ### Generate CDR Report Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example JSON response returned when a report generation request is accepted. ```json { "report_id": "report-uuid", "report_type": "advanced", "status": "generating|completed|failed", "started_at": "2024-01-15T10:30:45Z", "download_url": "/api/cdr/reports/report-uuid/download?api_key=...", "file_size_bytes": null } ``` -------------------------------- ### Diagnose S3 and SeaweedFS Storage Issues Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Run these commands to check storage service status, credential configuration, and volume disk space. ```bash # Check SeaweedFS health curl http://seaweedfs:8333/status # Check S3 credentials docker compose logs web | grep -i s3 # Check disk space docker volume inspect calltelemetry_seaweedfs_data ``` -------------------------------- ### List CDR Records Response Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Example JSON response structure for a successful CDR record retrieval. ```json { "data": [ { "call_id": "call-uuid", "calling_number": "5551234567", "called_number": "5559876543", "calling_device": "SEP001122AABBCC", "called_device": "SEP998877665544", "call_start_time": "2024-01-15T10:30:45Z", "call_duration_seconds": 120, "call_type": "voice|video|conference", "call_status": "connected|missed|redirected|blocked", "termination_cause": "normal|busy|no_answer", "policy_action": "permit|deny|redirect", "policy_name": "Block International" } ], "total_count": 5432, "page": 0, "limit": 100 } ``` -------------------------------- ### GET /api/cdr/records Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Retrieves a list of CDR records based on specified time ranges and optional filters. ```APIDOC ## GET /api/cdr/records ### Description Retrieves a list of CDR records based on specified time ranges and optional filters. ### Method GET ### Endpoint /api/cdr/records ### Parameters #### Query Parameters - **api_key** (string) - Required - API authentication key - **start_time** (ISO-8601) - Required - Date range start - **end_time** (ISO-8601) - Required - Date range end - **calling_number** (pattern) - Optional - Filter by calling number - **called_number** (pattern) - Optional - Filter by called number - **limit** (number) - Optional - Results per page (default: 100, max: 10000) - **offset** (number) - Optional - Pagination offset ### Response #### Success Response (200) - **data** (array) - List of CDR records - **total_count** (number) - Total number of records - **page** (number) - Current page index - **limit** (number) - Results per page #### Response Example { "data": [ { "call_id": "call-uuid", "calling_number": "5551234567", "called_number": "5559876543", "calling_device": "SEP001122AABBCC", "called_device": "SEP998877665544", "call_start_time": "2024-01-15T10:30:45Z", "call_duration_seconds": 120, "call_type": "voice|video|conference", "call_status": "connected|missed|redirected|blocked", "termination_cause": "normal|busy|no_answer", "policy_action": "permit|deny|redirect", "policy_name": "Block International" } ], "total_count": 5432, "page": 0, "limit": 100 } ``` -------------------------------- ### GET /api/commands/{command_id} Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/management-api.md Retrieves the current status and details of a previously issued remote control command. ```APIDOC ## GET /api/commands/{command_id} ### Description Retrieves the current status and details of a previously issued remote control command. ### Method GET ### Endpoint /api/commands/{command_id} ### Parameters #### Query Parameters - **api_key** (string) - Required - API key for authentication ### Response #### Success Response (200) - **command_id** (string) - Unique identifier for the command - **device_name** (string) - The device name - **action** (string) - The action performed - **status** (string) - Current status (completed, in_progress, or failed) - **queued_at** (string) - Timestamp when the command was queued - **sent_at** (string) - Timestamp when the command was sent - **completed_at** (string) - Timestamp when the command was completed - **error_message** (string|null) - Error details if the command failed #### Response Example { "command_id": "command-uuid", "device_name": "SEP001122AABBCC", "action": "factory_reset", "status": "completed", "queued_at": "2024-01-15T10:30:45Z", "sent_at": "2024-01-15T10:31:00Z", "completed_at": "2024-01-15T10:31:15Z", "error_message": null } ``` -------------------------------- ### Create Kubernetes Namespace Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/dev_environment_notes.md Use this command to create a new, isolated namespace for the development environment. ```bash kubectl create namespace ct-dev ``` -------------------------------- ### Create Kubernetes Namespace Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/kubernetes-reference.md Initializes a dedicated namespace for CallTelemetry with optional Istio injection. ```bash kubectl create namespace calltelemetry kubectl label namespace calltelemetry istio-injection=enabled # Optional: for service mesh ``` -------------------------------- ### GET /healthz (Port 80/443) Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/endpoints.md Health check endpoint used by Caddy load balancer and external monitors. ```APIDOC ## GET /healthz ### Description Health check endpoint for the primary service. ### Method GET ### Endpoint /healthz ### Response #### Success Response (200) - **Response** (string) - Returns 'OK' or an error message. ``` -------------------------------- ### Run CURRI Load Test with Ali Source: https://github.com/calltelemetry/calltelemetry/blob/master/testing/readme.md Execute a load test against the CURRI policy endpoint. Adjust -w for workers, -r for requests per second, and -d for duration (0 means indefinite). Ensure the policy URL and API key are correct, and provide the request body via --body-file. ```bash ali -w=10 -r 200 -d=0 http://192.168.123.135/curri/policy\?api_key\=089131c3-6de2-4cc2-ae97-cd20975cd09e --method=POST --body-file ./curri.xml ``` -------------------------------- ### Low-Duration Spam Detection Output Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/integration-patterns.md Example output format for identifying high-frequency, low-duration calls indicative of spam campaigns. ```text Source Number | Calls/24h | Avg Duration | Block Rate 555-123-4567 | 1250 | 3 seconds | 45% (after blocking) 555-123-4568 | 980 | 2 seconds | 38% ``` -------------------------------- ### Debug Application Logs Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/deployment-reference.md Use these commands to run services in the foreground, view timestamps, or follow logs in real-time for debugging. ```bash # Start single service in foreground (not detached) docker compose up web # Ctrl+C to stop # View detailed logs with timestamps docker compose logs --timestamps web | tail -100 # Follow logs in real-time docker compose logs -f web ``` -------------------------------- ### Cost Analysis Report Format Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/integration-patterns.md Example report structure for summarizing call volume, duration, and associated carrier costs by destination type. ```text Report: Cost Analysis Period: January 2024 Total Calls: 50,000 Total Duration: 125,000 minutes By Destination: Local: 30,000 calls, 75,000 min, $1,875 (0.025/min) Long Distance: 15,000 calls, 40,000 min, $3,200 (0.080/min) International: 5,000 calls, 10,000 min, $2,500 (0.250/min) Total Cost: $7,575 Cost per Call: $0.15 ``` -------------------------------- ### Performance Tuning Profiles Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/configuration.md Environment variable configurations for different deployment scales. ```env PERFORMANCE_PROFILE=small PG_SHARED_BUFFERS=1GB PG_EFFECTIVE_CACHE_SIZE=3GB DB_POOL_SIZE=50 DB_MEM_LIMIT=4g WEB_MEM_LIMIT=3g ``` ```env PERFORMANCE_PROFILE=medium PG_SHARED_BUFFERS=768MB PG_EFFECTIVE_CACHE_SIZE=8GB PG_WORK_MEM=16MB DB_POOL_SIZE=100 DB_MEM_LIMIT=6g WEB_MEM_LIMIT=4g ``` ```env PERFORMANCE_PROFILE=large PG_SHARED_BUFFERS=2GB PG_EFFECTIVE_CACHE_SIZE=16GB PG_WORK_MEM=32MB DB_POOL_SIZE=150 DB_MEM_LIMIT=8g WEB_MEM_LIMIT=6g ``` -------------------------------- ### Deploy Call Telemetry Application using Helm Source: https://github.com/calltelemetry/calltelemetry/blob/master/kubernetes/README.md Deploys the Call Telemetry application using Helm with a specified custom configuration file. The command should be executed from the primary node. ```bash helm install -n ct ct ct_charts/stable-ha -f ./ct_prod.yaml ``` -------------------------------- ### Caller ID Transformation Attribute Example Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/api-reference/curri-api.md Snippet demonstrating how to include transformed calling party number attributes when CallManager has modified the original number. ```xml 5551234567 5551111111 ``` -------------------------------- ### Backup and Restore PostgreSQL Database Source: https://github.com/calltelemetry/calltelemetry/blob/master/_autodocs/docker-compose-reference.md Commands to perform manual database backups and restores using the Docker Compose exec utility. ```bash # Backup docker compose exec db pg_dump -U calltelemetry calltelemetry_prod > backup.sql # Restore docker compose exec -T db psql -U calltelemetry calltelemetry_prod < backup.sql ```