A Go-based API for processing call recordings, providing automated transcription and analysis. Upload call recordings via REST API, process them with a background worker system, and retrieve transcriptions and analytical insights.
# Clone the repository
git clone [email protected]:namanag97/call_in_go.git
cd call_in_go
# Set up the database
./reinit_postgres.sh
# Install dependencies
go mod download
# Build the application
go build -o ./bin/call-processor ./call-processor
# Run the application
./bin/call-processor
- Go 1.18 or higher
- PostgreSQL 13 or higher
- S3-compatible storage (like MinIO or AWS S3)
- Google Cloud account (for Speech-to-Text API)
- Create a
.env
file in the project root with the following variables:
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=go_project
STORAGE_ENDPOINT=localhost:9000
STORAGE_ACCESS_KEY=minioadmin
STORAGE_SECRET_KEY=minioadmin
STORAGE_BUCKET=call-recordings
GOOGLE_APPLICATION_CREDENTIALS=/path/to/google-credentials.json
To initialize the PostgreSQL database for this project, run:
./reinit_postgres.sh
This script will:
- Stop any running PostgreSQL service
- Remove existing data directory
- Initialize a new PostgreSQL database
- Start the PostgreSQL service
- Create a database called
go_project
# Development mode
go run ./call-processor
# Production mode
go build -o ./bin/call-processor ./call-processor
./bin/call-processor
go test ./...
call-processor/
- Contains the call processing application
We welcome contributions to this project! Here's how you can help:
- Fork the repository - Create your own fork of the project
- Create a feature branch -
git checkout -b feature/your-feature-name
- Make your changes - Implement your feature or bug fix
- Run tests - Ensure your changes don't break existing functionality
- Commit your changes - Use descriptive commit messages
- Push to your branch -
git push origin feature/your-feature-name
- Open a pull request - Submit your changes for review
Please follow the code style guidelines and include appropriate tests with your changes.
- Pick an issue from the issue tracker
- Create a branch for your work
- Implement the feature or fix
- Write tests for your changes
- Update documentation if necessary
- Submit a pull request
This Go-based API provides call recording processing capabilities, including ingestion, transcription, and analysis of audio recordings.
POST /recordings
: Upload a new call recordingGET /recordings/:id
: Get recording by IDGET /recordings
: List recordings with filtering optionsDELETE /recordings/:id
: Delete a recording
POST /recordings/:id/transcribe
: Start transcription of a recordingGET /transcriptions/:id
: Get transcription by IDGET /recordings/:id/transcription
: Get transcription by recording ID
POST /recordings/:id/analyze
: Analyze a recording's transcriptionGET /analysis/:id
: Get analysis results by IDGET /recordings/:id/analysis
: Get analysis results for a recording
GET /jobs/:id
: Get job status by IDGET /jobs/stats
: Get worker statisticsGET /jobs/health
: Get worker healthPOST /jobs/maintenance/clear-stuck
: Clear stuck jobs older than specified duration
- Bulk endpoints for processing multiple recordings
The system uses a worker-based processing model:
- Job Queue: Tasks are queued as jobs with specific types
- Worker Manager: Coordinates job processing with handlers for each job type
- Repository Layer: Interface for data storage (PostgreSQL implementation)
- Service Layer: Business logic, separate from API controllers
- Worker System: Background processing with retry logic, stuck job handling
- Storage: S3-compatible storage for recordings
- STT: Speech-to-text processing using Google Speech API
- Event Bus: In-memory or Kafka-based event handling
# Upload a recording
curl -X POST -F "[email protected]" \
-F "metadata={\"callType\":\"customer_service\"}" \
http://localhost:8080/recordings
# Start transcription
curl -X POST http://localhost:8080/recordings/123e4567-e89b-12d3-a456-426614174000/transcribe
# Get transcription
curl http://localhost:8080/transcriptions/123e4567-e89b-12d3-a456-426614174000
# Check job status
curl http://localhost:8080/jobs/123e4567-e89b-12d3-a456-426614174000
Configuration is handled via environment variables with reasonable defaults, loaded from .env
file when available.