{"id":26893470,"url":"https://github.com/oalles/sip-platform","last_synced_at":"2025-03-31T23:58:04.968Z","repository":{"id":214404325,"uuid":"685170693","full_name":"oalles/sip-platform","owner":"oalles","description":"A Sip domain management application based on redis, redis gears v2 prerelease and kamailio","archived":false,"fork":false,"pushed_at":"2023-12-27T22:21:30.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-17T15:35:24.839Z","etag":null,"topics":["javascript","kamailio","redis","redis-gears","redis-om-spring","redis-stack","sip"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oalles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-08-30T16:56:58.000Z","updated_at":"2024-04-17T15:35:24.840Z","dependencies_parsed_at":"2023-12-28T01:08:50.863Z","dependency_job_id":null,"html_url":"https://github.com/oalles/sip-platform","commit_stats":null,"previous_names":["oalles/sip-platform"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oalles%2Fsip-platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oalles%2Fsip-platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oalles%2Fsip-platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oalles%2Fsip-platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oalles","download_url":"https://codeload.github.com/oalles/sip-platform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246558113,"owners_count":20796696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","kamailio","redis","redis-gears","redis-om-spring","redis-stack","sip"],"created_at":"2025-03-31T23:58:04.462Z","updated_at":"2025-03-31T23:58:04.947Z","avatar_url":"https://github.com/oalles.png","language":"Java","readme":"## A SIP Domain Management Application with Java, Redis, Redis OM Spring, Redis Gears V2, and Kamailio\n\nThe goal is simply to experiment with the [Redis Gears 2 (Triggers and Functions) prerelease](https://github.com/RedisGears/RedisGears/releases/tag/v2.0.15-m16), \nwhich includes V8 JavaScript Engine support, allowing us to subscribe JavaScript functions that automatically execute code on data changes directly in the Redis database.\n\nDisclaimer: This project is all about the exploration rather than the end result. \n\n## Scenario\nWe will be developing a SIP domain management application to facilitate user registration and connection to a SIP domain.\n\nHaving chosen Redis as our backend database and Kamailio to manage SIP communications, our primary goal is to develop a real-time synchronization system that ensures consistent and accurate data\nbetween our custom SipPlatform business model and the required Kamailio model.\n\n![Diagram](./images/sip-platform.png)\n\n## Description\n\nOur business logic is composed of two main components:\n\n1. **Java Service:** It serves as the primary interface for data manipulation.\n2. **Redis Gears V2 functions:** to ensure that any changes in the business model are promptly reflected in Kamailio's configuration for SIP registration and management.\n\nOur **custom domain model** is inspired by the [Twilio SIP API](https://www.twilio.com/docs/voice/sip/api), focusing primarily on two classes:\n[SipDomain](backend/src/main/java/es/omarall/sip/platform/sipdomains/SipDomain.java) and [Credential](backend/src/main/java/es/omarall/sip/platform/credentials/Credential.java).\n\nWith support from [Spring OM Redis](https://github.com/redis/redis-om-spring), built on [Spring Data Redis](https://github.com/spring-projects/spring-data-redis), we will effectively map our Java model to RedisJSON documents.\n[RedisJSON](https://redis.com/modules/redis-json/) module, will enable us to use Redis as a high-performance NoSQL document database. SipDomain and Credential models will be stored as JSON documents.\n\nWe plan to use Redis Gears v2 to subscribe JavaScript functions to [keyspace notifications](https://redis.io/docs/manual/keyspace-notifications/) which will help us:\n\n* include auditing metadata into our SIPPlatform domain entities.\n* ensure Kamailio's configuration consistency, as any updates to our domain entities will be immediately delivered.\n\n## Redis Gears V2 Functions\nA more detailed description [here](redis-functions/README.md).\n\n## SipPlatform Java Service\nA more detailed description [here](backend/README.md).\n\n## SIP Domain Implementation with Kamailio and Redis\n\n[Kamailio](https://www.kamailio.org/) is a powerful SIP (Session Initiation Protocol) server that can be customized to handle a wide range of SIP-related functionalities.\n\nWhile Kamailio supports various databases, we're specifically choosing [Redis](https://www.kamailio.org/docs/modules/devel/modules/db_redis.html) for our example.\n\nTo enable Redis as the database backend for Kamailio, specific configurations need to be set. \nHere's an overview of what the Kamailio configuration file for Redis might look [here](environment/README.md).\n\n## Prerequisites\n* Node.js (v18.18.0) and npm(9.8.1) installed\n* Redis Stack Server running with Key Space Notifications enabled: `CONFIG SET notify-keyspace-events KEA`\n* Maven (3.8.3) and Java (11) installed\n* docker and docker-compose\n\n## Usage\n1. Start Redis Stack Server and Kamailio instances with [docker-compose](environment/docker-compose.yml):\n\n```bash\n$ cd environment\n$ docker-compose up\n```\n\n2. Start the [Redis Insights](https://docs.redis.com/latest/ri/installing/install-redis-desktop/) gui, start the profiler, open the CLI and run the following command in order check whether *keyspace events notifications* are enabled:\n\n```text\nCONFIG GET notify-keyspace-events\n# CONFIG SET notify-keyspace-events KEA\n```\n\n3. Deploy javascript code to Redis Stack server:\n```bash\n$ cd redis-functions\n$ npm install\n$ npm run deploy\n\u003e redis-functions@1.0.0 deploy\n\u003e gears-api index.js\n\nDeployed! :)\n```\n\n4. Run the java backend application. This will create the necessary Redis indexes.\n(If you flush all redis data, be sure to rerun it in order to recreate the indexes\n\n```bash\n$ cd backend\n$ mvn spring-boot:run\n```\n\n5. Try creating a SipDomain, a Credential entities and request a DomainReload to Kamailio:\n\n```text\nPOST http://localhost:8080/domains\n{\n    \"name\": \"fictsip.com\"\n}\n```\n\n```text\nPOST http://localhost:8080/credentials\n{\n    \"domain\": \"fictsip.com\",\n    \"username\": \"omar\",\n    \"password\": \"omar\"\n}\n```\n\n```text\nPOST http://localhost:5060/RPC\n{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"domain.reload\",\n    \"id\": 1 # increment this id for each request\n}\n```\n\nA postman collection is provided: \n\n[![Try with Postman](https://run.pstmn.io/button.svg)](https://www.postman.com/blue-station-895244/workspace/sipplatform/collection/9271443-c56ff492-eaa2-4c25-9373-0994165d22f0?action=share\u0026creator=9271443)\n\n\n7. Try SIP registration to the created domain with the created credentials with a soft phone.\n![Zoiper registered](./images/zoiper-registered.png)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foalles%2Fsip-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foalles%2Fsip-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foalles%2Fsip-platform/lists"}