{"id":13405948,"url":"https://github.com/havfo/WEBRTC-to-SIP","last_synced_at":"2025-03-14T10:32:11.335Z","repository":{"id":44364880,"uuid":"52993062","full_name":"havfo/WEBRTC-to-SIP","owner":"havfo","description":"Setup for a WEBRTC client and Kamailio server to call SIP clients","archived":false,"fork":false,"pushed_at":"2023-10-19T06:27:56.000Z","size":1045,"stargazers_count":272,"open_issues_count":3,"forks_count":146,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-07-31T19:48:26.408Z","etag":null,"topics":["bridge","kamailio","rtpengine","sip","turn","webrtc","webrtc-client"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"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/havfo.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":"2016-03-02T20:11:54.000Z","updated_at":"2024-07-18T11:56:13.000Z","dependencies_parsed_at":"2024-01-18T23:05:04.732Z","dependency_job_id":"3b76ab70-013b-4c23-b36a-f488cae0313d","html_url":"https://github.com/havfo/WEBRTC-to-SIP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/havfo%2FWEBRTC-to-SIP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/havfo%2FWEBRTC-to-SIP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/havfo%2FWEBRTC-to-SIP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/havfo%2FWEBRTC-to-SIP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/havfo","download_url":"https://codeload.github.com/havfo/WEBRTC-to-SIP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221458266,"owners_count":16825278,"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":["bridge","kamailio","rtpengine","sip","turn","webrtc","webrtc-client"],"created_at":"2024-07-30T19:02:16.781Z","updated_at":"2025-03-14T10:32:11.329Z","avatar_url":"https://github.com/havfo.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# WEBRTC to SIP client and server\nHow to setup Kamailio + RTPEngine + TURN server to enable calling between WebRTC client and legacy SIP clients. This config is IPv6 enabled by default. This setup will bridge SRTP --\u003e RTP and ICE --\u003e nonICE to make a WebRTC client (sip.js) be able to call legacy SIP clients. The WebRTC client can be found [here](https://github.com/havfo/SipCaller).\n\nThis setup is for Debian 12 Bookworm.\n\nThis setup is configured to run with the following services:\n\n- Kamailio + RTPEngine + Nginx (proxy + WebRTC client) + coturn\n\nThe configuration is setup to always bridge via RTPEngine. To change the behavior, take a look in the `NATMANAGE` route.\n\n## Architecture\n![WebRTC - SIP architecture](https://raw.githubusercontent.com/havfo/WEBRTC-to-SIP/master/images/webrtc-sip.png \"WebRTC to SIP architecture\")\n\n## Get certificates\nFor the certificates you need, a simple solution is Let's Encrypt certificates. They will work for both Kamailio TLS, Nginx TLS and TURN TLS. Run the following (you must stop services running on port 443 during certificate request/renewal):\n```bash\napt-get install certbot\ncertbot certonly --standalone -d YOUR-DOMAIN\n```\nYou will then find the certificates under:\n```bash\n/etc/letsencrypt/live/YOUR-DOMAIN/privkey.pem\n/etc/letsencrypt/live/YOUR-DOMAIN/fullchain.pem\n```\n\n## Get configuration files\n```bash\ngit clone https://github.com/havfo/WEBRTC-to-SIP.git\ncd WEBRTC-to-SIP\nfind . -type f -print0 | xargs -0 sed -i 's/XXXXXX-XXXXXX/PUT-IPV6-OF-YOUR-SIP-SERVER-HERE/g'\nfind . -type f -print0 | xargs -0 sed -i 's/XXXXX-XXXXX/PUT-IPV4-OF-YOUR-SIP-SERVER-HERE/g'\nfind . -type f -print0 | xargs -0 sed -i 's/XXXX-XXXX/PUT-DOMAIN-OF-YOUR-SIP-SERVER-HERE/g'\n```\n\n## Install RTPEngine\nThis will do the SRTP-RTP bridging needed to make WebRTC clients talk to legacy SIP server/clients. You can find the latest build instructions in their [readme](https://github.com/sipwise/rtpengine#on-a-debian-system).\n\nThe easiest way of installing is to get it from Sipwise repository:\n```bash\necho 'deb https://deb.sipwise.com/spce/mr11.5.1/ bookworm main' \u003e /etc/apt/sources.list.d/sipwise.list\necho 'deb-src https://deb.sipwise.com/spce/mr11.5.1/ bookworm main' \u003e\u003e /etc/apt/sources.list.d/sipwise.list\nwget -q -O - https://deb.sipwise.com/spce/keyring/sipwise-keyring-bootstrap.gpg | apt-key add -\napt-get update\napt-get install -y ngcp-keyring ngcp-rtpengine\n```\n\nAfter you have successfully installed RTPEngine, copy the configuration from this repository.\n```bash\ncd WEBRTC-to-SIP\ncp etc/default/ngcp-rtpengine-daemon /etc/default/\ncp etc/rtpengine/rtpengine.conf /etc/rtpengine/\n/etc/init.d/ngcp-rtpengine-daemon restart\n```\n\n## Install IPTables firewall (optional)\nRTPEngine handles the chain for itself, but make sure to not block the RTP-ports it is using. Take a look in iptables.sh for details, and apply it by doing the following. This will persist after reboot. You can run the iptables.sh script at any time after it is set up.\n```bash\ncd WEBRTC-to-SIP\nchmod +x iptables.sh\ncp etc/network/if-up.d/iptables /etc/network/if-up.d/\nchmod +x /etc/network/if-up.d/iptables\ntouch /etc/iptables/firewall.conf\ntouch /etc/iptables/firewall6.conf\n./iptables.sh\n```\n\n## Install Kamailio\n```bash\napt-get install kamailio kamailio-websocket-modules kamailio-mysql-modules kamailio-tls-modules kamailio-presence-modules mysql-server\ncd WEBRTC-to-SIP\ncp etc/kamailio/* /etc/kamailio/\nkamdbctl create\n```\nSelect yes (Y) to all options.\n\n```bash\nkamctl add websip websip\nservice kamailio restart\n```\n\n## Install WebRTC client\nThis will install the client that can be found [here](https://github.com/havfo/SipCaller).\n\nInstall Nginx:\n```sh\napt-get update\napt-get install nginx libnginx-mod-stream\ncd WEBRTC-to-SIP\ncp etc/nginx/nginx.conf /etc/nginx/\ncp etc/nginx/conf.d/default.conf /etc/nginx/conf.d/\ncp -r client/* /var/www/html/\nservice nginx restart\n```\n\n## Install TURN server\n```sh\napt-get install coturn\ncp etc/default/coturn /etc/default/\ncp etc/turnserver.conf /etc/\nservice coturn restart\n```\n\n## Testing\nYou should now be able to go to https://XXXX-XXXX/ and call legacy SIP clients. Click the account icon in the top right corner and add the following settings:\n\n- Display name: Whatever\n- SIP URI: websip@XXXX-XXXX\n- Password: websip\n- Outbound Proxy: wss://XXXX-XXXX/ws\n\nTo manually configure other TURN servers, change the config in `client/config.js`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavfo%2FWEBRTC-to-SIP","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhavfo%2FWEBRTC-to-SIP","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavfo%2FWEBRTC-to-SIP/lists"}