arnacon-webrtc-service 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +67 -0
  2. package/config.json +146 -0
  3. package/package.json +43 -0
  4. package/services/basicService.json +20 -0
  5. package/services/email.json +22 -0
  6. package/services/esimera.json +20 -0
  7. package/services/phonemyemail.json +20 -0
  8. package/services/secnum.json +20 -0
  9. package/services/vodaphone.json +20 -0
  10. package/webRTCservice/build.js +3 -0
  11. package/webRTCservice/clean.js +3 -0
  12. package/webRTCservice/core.js +30 -0
  13. package/webRTCservice/modules/blockchain.js +311 -0
  14. package/webRTCservice/modules/bridge.js +189 -0
  15. package/webRTCservice/modules/callFlow.js +262 -0
  16. package/webRTCservice/modules/callRouter.js +108 -0
  17. package/webRTCservice/modules/callRuntimeCore.js +112 -0
  18. package/webRTCservice/modules/dataChannel.js +55 -0
  19. package/webRTCservice/modules/handlers.js +60 -0
  20. package/webRTCservice/modules/handshakeFlow.js +71 -0
  21. package/webRTCservice/modules/httpServer.js +155 -0
  22. package/webRTCservice/modules/inboundCallFlow.js +111 -0
  23. package/webRTCservice/modules/messagingFlow.js +92 -0
  24. package/webRTCservice/modules/notification.js +413 -0
  25. package/webRTCservice/modules/offerFlow.js +111 -0
  26. package/webRTCservice/modules/peerConnection.js +258 -0
  27. package/webRTCservice/modules/polyfills.js +138 -0
  28. package/webRTCservice/modules/providerPolicy.js +36 -0
  29. package/webRTCservice/modules/sdpUtils.js +117 -0
  30. package/webRTCservice/modules/sessionStore.js +207 -0
  31. package/webRTCservice/modules/signalingHandlers.js +144 -0
  32. package/webRTCservice/modules/signalingPipeline.js +93 -0
  33. package/webRTCservice/modules/sipClient.js +179 -0
  34. package/webRTCservice/modules/sipRuntime.js +54 -0
  35. package/webRTCservice/package.json +15 -0
  36. package/webRTCservice/services/basicService.js +76 -0
  37. package/webRTCservice/services/basicService.runner.js +7 -0
  38. package/webRTCservice/services/email.js +103 -0
  39. package/webRTCservice/services/esimera.js +114 -0
  40. package/webRTCservice/services/esimera.runner.js +7 -0
  41. package/webRTCservice/services/phonemyemail.js +90 -0
  42. package/webRTCservice/services/secnum.js +91 -0
  43. package/webRTCservice/services/vodaphone.js +83 -0
  44. package/webRTCservice/validateExports.js +19 -0
  45. package/webRTCservice/webRTCmanager.js +969 -0
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # test2_kamailio
2
+
3
+ This folder contains the Kamailio + WebRTC gateway runtime config and deploy helpers.
4
+
5
+ ## Production Config Injector
6
+
7
+ The production config injector is:
8
+
9
+ - `deploy-config.sh`
10
+
11
+ It reads values from `config.json` and writes them into:
12
+
13
+ - `ron_kamailio.cfg` (`#!substdef` values at the top)
14
+ - `tls.cfg` (`private_key` and `certificate` paths)
15
+
16
+ It does **not** restart services by itself.
17
+
18
+ ## How To Run (Production)
19
+
20
+ From inside this folder:
21
+
22
+ ```bash
23
+ cd /path/to/test2Server/test2_kamailio
24
+ DEPLOY_ENV=production ./deploy-config.sh
25
+ ```
26
+
27
+ If execute permissions are missing:
28
+
29
+ ```bash
30
+ chmod +x ./deploy-config.sh
31
+ DEPLOY_ENV=production ./deploy-config.sh
32
+ ```
33
+
34
+ ## What It Injects
35
+
36
+ From `config.json -> production`:
37
+
38
+ - `domain` -> `MY_DOMAIN`
39
+ - `publicIp` -> `MY_PUBLIC_IP`
40
+ - `bindIp` -> `MY_BIND_IP`
41
+ - `providers.secnum.outboundSbcAddress` -> `MY_SBC_IP`
42
+ - first `providers.*.trustedIngressIps[0]` -> `MY_TRUSTED_PEER_1`
43
+ - second `providers.*.trustedIngressIps[1]` -> `MY_TRUSTED_PEER_2`
44
+ - `kamailioWssPort` -> `MY_WSS_PORT`
45
+ - `tlsCertPath` -> `tls.cfg` certificate/private key paths
46
+
47
+ ## Safe Deploy Sequence
48
+
49
+ ```bash
50
+ cd /path/to/test2Server/test2_kamailio
51
+ DEPLOY_ENV=production ./deploy-config.sh
52
+ kamailio -c -f /path/to/test2Server/test2_kamailio/ron_kamailio.cfg
53
+ sudo systemctl restart kamailio
54
+ sudo systemctl restart webrtcmanager
55
+ ```
56
+
57
+ Then verify:
58
+
59
+ ```bash
60
+ sudo systemctl status kamailio --no-pager
61
+ curl -sS http://127.0.0.1:8188/health
62
+ ```
63
+
64
+ ## Notes
65
+
66
+ - If `DEPLOY_ENV` is not set, script defaults to `development`.
67
+ - Keep `config.json` as the single source of truth for env-specific values.
package/config.json ADDED
@@ -0,0 +1,146 @@
1
+ {
2
+ "development": {
3
+ "common": {
4
+ "domain": "test2.cellact.nl",
5
+ "kamailioWssHost": "172.31.24.141",
6
+ "publicIp": "3.125.225.232",
7
+ "bindIp": "172.31.24.141",
8
+ "tlsCertPath": "/etc/letsencrypt/live/test2.cellact.nl",
9
+ "kamailioWssPort": 8443,
10
+ "roflBaseUrl": "https://p8000.m1485.test-proxy-b.rofl.app",
11
+ "messageProcessorUrl": "https://europe-west3-asterisk-tts-test.cloudfunctions.net/client_msg_processor",
12
+ "polygon": {
13
+ "rpc": "https://polygon-bor-rpc.publicnode.com",
14
+ "ENSRegistry": "0x6e0A65396233B8A29d76cA2DDd87bc5F19A82c36",
15
+ "NameWrapper": "0xCAb1585C37118d066Bc3AD79919B4CAE5cd42BC2",
16
+ "ServiceProviderRegistry": "0x86F58E4AadCB0188a11447641F4df3d66323959d",
17
+ "ProvisionRegistry": "0x461f38fdCD44a92cD0fBE7ba9498903EFd944740",
18
+ "CustomENS": "0xb32Feb0530C73FEc90BB985fA40894196938a9f6"
19
+ },
20
+ "sapphire": {
21
+ "rpc": "https://sapphire.oasis.io",
22
+ "NotificationManagerRegistry": "0xB5B5a6320BB0Fdf3F08122475F71B51f5210B437"
23
+ },
24
+ "sapphireTestnet": {
25
+ "rpc": "https://testnet.sapphire.oasis.io",
26
+ "NFTCallerIdPool": "0xFB3DD146F1aFfbA661533Ec49298D01f20104CF6"
27
+ }
28
+ },
29
+ "services": {
30
+ "esimera": {
31
+ "providerId": "esimera",
32
+ "notifyPort": 9000,
33
+ "callbackPort": 9100,
34
+ "configPath": "./services/esimera.json",
35
+ "modulePath": "./webRTCservice/services/esimera.js"
36
+ },
37
+ "secnum": {
38
+ "providerId": "secnum",
39
+ "notifyPort": 9001,
40
+ "callbackPort": 9101,
41
+ "configPath": "./services/secnum.json",
42
+ "modulePath": "./webRTCservice/services/secnum.js"
43
+ },
44
+ "phonemyemail": {
45
+ "providerId": "phonemyemail",
46
+ "notifyPort": 9002,
47
+ "callbackPort": 9102,
48
+ "configPath": "./services/phonemyemail.json",
49
+ "modulePath": "./webRTCservice/services/phonemyemail.js"
50
+ },
51
+ "email": {
52
+ "providerId": "email",
53
+ "notifyPort": 9003,
54
+ "callbackPort": 9103,
55
+ "configPath": "./services/email.json",
56
+ "modulePath": "./webRTCservice/services/email.js"
57
+ },
58
+ "vodaphone": {
59
+ "providerId": "vodaphone",
60
+ "notifyPort": 9004,
61
+ "callbackPort": 9104,
62
+ "configPath": "./services/vodaphone.json",
63
+ "modulePath": "./webRTCservice/services/vodaphone.js"
64
+ },
65
+ "basicService": {
66
+ "providerId": "basicService",
67
+ "notifyPort": 9005,
68
+ "callbackPort": 9105,
69
+ "configPath": "./services/basicService.json",
70
+ "modulePath": "./webRTCservice/services/basicService.js"
71
+ }
72
+ }
73
+ },
74
+ "production": {
75
+ "common": {
76
+ "domain": "ron1.cellact.nl",
77
+ "kamailioWssHost": "172.31.6.219",
78
+ "publicIp": "51.17.152.103",
79
+ "bindIp": "172.31.6.219",
80
+ "tlsCertPath": "/etc/letsencrypt/live/ron1.cellact.nl",
81
+ "kamailioWssPort": 8443,
82
+ "roflBaseUrl": "https://p8000.m206.opf-mainnet-rofl-35.rofl.app",
83
+ "messageProcessorUrl": "https://europe-west3-asterisk-tts-test.cloudfunctions.net/client_msg_processor",
84
+ "polygon": {
85
+ "rpc": "https://polygon-bor-rpc.publicnode.com",
86
+ "ENSRegistry": "0x6e0A65396233B8A29d76cA2DDd87bc5F19A82c36",
87
+ "NameWrapper": "0xCAb1585C37118d066Bc3AD79919B4CAE5cd42BC2",
88
+ "ServiceProviderRegistry": "0x86F58E4AadCB0188a11447641F4df3d66323959d",
89
+ "ProvisionRegistry": "0x461f38fdCD44a92cD0fBE7ba9498903EFd944740",
90
+ "CustomENS": "0xb32Feb0530C73FEc90BB985fA40894196938a9f6"
91
+ },
92
+ "sapphire": {
93
+ "rpc": "https://sapphire.oasis.io",
94
+ "NotificationManagerRegistry": "0xB5B5a6320BB0Fdf3F08122475F71B51f5210B437"
95
+ },
96
+ "sapphireTestnet": {
97
+ "rpc": "https://sapphire.oasis.io",
98
+ "NFTCallerIdPool": "0x903796dc34Bb9A5eD76A41bBA6C40CfebD1f4269"
99
+ }
100
+ },
101
+ "services": {
102
+ "esimera": {
103
+ "providerId": "esimera",
104
+ "notifyPort": 9000,
105
+ "callbackPort": 9100,
106
+ "configPath": "./services/esimera.json",
107
+ "modulePath": "./webRTCservice/services/esimera.js"
108
+ },
109
+ "secnum": {
110
+ "providerId": "secnum",
111
+ "notifyPort": 9001,
112
+ "callbackPort": 9101,
113
+ "configPath": "./services/secnum.json",
114
+ "modulePath": "./webRTCservice/services/secnum.js"
115
+ },
116
+ "phonemyemail": {
117
+ "providerId": "phonemyemail",
118
+ "notifyPort": 9002,
119
+ "callbackPort": 9102,
120
+ "configPath": "./services/phonemyemail.json",
121
+ "modulePath": "./webRTCservice/services/phonemyemail.js"
122
+ },
123
+ "email": {
124
+ "providerId": "email",
125
+ "notifyPort": 9003,
126
+ "callbackPort": 9103,
127
+ "configPath": "./services/email.json",
128
+ "modulePath": "./webRTCservice/services/email.js"
129
+ },
130
+ "vodaphone": {
131
+ "providerId": "vodaphone",
132
+ "notifyPort": 9004,
133
+ "callbackPort": 9104,
134
+ "configPath": "./services/vodaphone.json",
135
+ "modulePath": "./webRTCservice/services/vodaphone.js"
136
+ },
137
+ "basicService": {
138
+ "providerId": "basicService",
139
+ "notifyPort": 9005,
140
+ "callbackPort": 9105,
141
+ "configPath": "./services/basicService.json",
142
+ "modulePath": "./webRTCservice/services/basicService.js"
143
+ }
144
+ }
145
+ }
146
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "arnacon-webrtc-service",
3
+ "version": "0.1.0",
4
+ "description": "Arnacon WebRTC core runtime and service modules",
5
+ "main": "./webRTCservice/core.js",
6
+ "type": "commonjs",
7
+ "exports": {
8
+ ".": "./webRTCservice/core.js",
9
+ "./core": "./webRTCservice/core.js",
10
+ "./service/esimera": "./webRTCservice/services/esimera.js",
11
+ "./service/esimera/runner": "./webRTCservice/services/esimera.runner.js",
12
+ "./service/esimera/config": "./services/esimera.json",
13
+ "./service/basicService": "./webRTCservice/services/basicService.js",
14
+ "./service/basicService/runner": "./webRTCservice/services/basicService.runner.js",
15
+ "./service/basicService/config": "./services/basicService.json"
16
+ },
17
+ "files": [
18
+ "webRTCservice/**/*",
19
+ "services/**/*",
20
+ "config.json"
21
+ ],
22
+ "scripts": {
23
+ "build": "node webRTCservice/build.js",
24
+ "clean": "node webRTCservice/clean.js",
25
+ "validate:exports": "node webRTCservice/validateExports.js",
26
+ "pack:dry": "npm pack --dry-run",
27
+ "start:service:esimera": "SERVICE_ID=esimera node webRTCservice/webRTCmanager.js",
28
+ "start:service:basic": "SERVICE_ID=basicService node webRTCservice/webRTCmanager.js",
29
+ "prepublishOnly": "npm run build && npm run validate:exports",
30
+ "publish:patch": "npm version patch && npm publish",
31
+ "publish:minor": "npm version minor && npm publish",
32
+ "publish:major": "npm version major && npm publish"
33
+ },
34
+ "dependencies": {
35
+ "ethers": "^5.7.2",
36
+ "sip.js": "^0.21.2",
37
+ "werift": "*",
38
+ "ws": "^8.16.0"
39
+ },
40
+ "engines": {
41
+ "node": ">=18"
42
+ }
43
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "development": {
3
+ "providerId": "basicService",
4
+ "static": {
5
+ "status": "active",
6
+ "domains": ["basicservice.global"],
7
+ "trustedIngressIps": ["127.0.0.1"],
8
+ "outboundSbcAddress": ""
9
+ }
10
+ },
11
+ "production": {
12
+ "providerId": "basicService",
13
+ "static": {
14
+ "status": "active",
15
+ "domains": ["basicservice.global"],
16
+ "trustedIngressIps": ["127.0.0.1"],
17
+ "outboundSbcAddress": ""
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "development": {
3
+ "providerId": "email",
4
+ "static": {
5
+ "status": "active",
6
+ "domains": ["email.global"],
7
+ "identityType": "email",
8
+ "trustedIngressIps": ["51.85.90.127"],
9
+ "outboundSbcAddress": "185.62.121.10"
10
+ }
11
+ },
12
+ "production": {
13
+ "providerId": "email",
14
+ "static": {
15
+ "status": "active",
16
+ "domains": ["email.global"],
17
+ "identityType": "email",
18
+ "trustedIngressIps": ["51.85.90.127"],
19
+ "outboundSbcAddress": "185.62.121.10"
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "development": {
3
+ "providerId": "esimera",
4
+ "static": {
5
+ "status": "active",
6
+ "domains": ["esimeratest.global", "esimera.global"],
7
+ "trustedIngressIps": ["51.85.90.127"],
8
+ "outboundSbcAddress": "185.62.121.10"
9
+ }
10
+ },
11
+ "production": {
12
+ "providerId": "esimera",
13
+ "static": {
14
+ "status": "active",
15
+ "domains": ["esimera.global", "esimeratest.global"],
16
+ "trustedIngressIps": ["51.85.90.127"],
17
+ "outboundSbcAddress": "185.62.121.10"
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "development": {
3
+ "providerId": "phonemyemail",
4
+ "static": {
5
+ "status": "active",
6
+ "domains": ["phonemyemail.global"],
7
+ "trustedIngressIps": ["51.85.90.127"],
8
+ "outboundSbcAddress": "185.62.121.10"
9
+ }
10
+ },
11
+ "production": {
12
+ "providerId": "phonemyemail",
13
+ "static": {
14
+ "status": "active",
15
+ "domains": ["phonemyemail.global"],
16
+ "trustedIngressIps": ["51.85.90.127"],
17
+ "outboundSbcAddress": "185.62.121.10"
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "development": {
3
+ "providerId": "secnum",
4
+ "static": {
5
+ "status": "active",
6
+ "domains": ["secnumtest.global", "secnum.global", "cellactm.global", "cellactl.global"],
7
+ "trustedIngressIps": ["51.85.90.127"],
8
+ "outboundSbcAddress": "185.62.121.10"
9
+ }
10
+ },
11
+ "production": {
12
+ "providerId": "secnum",
13
+ "static": {
14
+ "status": "active",
15
+ "domains": ["secnum.global", "secnumtest.global", "cellactm.global", "cellactl.global"],
16
+ "trustedIngressIps": ["51.85.90.127"],
17
+ "outboundSbcAddress": "185.62.121.10"
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "development": {
3
+ "providerId": "vodaphone",
4
+ "static": {
5
+ "status": "active",
6
+ "domains": ["vodaphonetest.global", "vodaphone.global"],
7
+ "trustedIngressIps": ["51.85.90.127"],
8
+ "outboundSbcAddress": "67.67.67.67"
9
+ }
10
+ },
11
+ "production": {
12
+ "providerId": "vodaphone",
13
+ "static": {
14
+ "status": "active",
15
+ "domains": ["vodaphone.global", "vodaphonetest.global"],
16
+ "trustedIngressIps": ["51.85.90.127"],
17
+ "outboundSbcAddress": "67.67.67.67"
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ console.log("Build step complete (source package, no transpilation required).");
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ console.log("Clean step complete (no generated artifacts to remove).");
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+
5
+ function startServiceProcess({
6
+ serviceId,
7
+ deployEnv = process.env.DEPLOY_ENV || "development",
8
+ internalApiToken = process.env.INTERNAL_API_TOKEN || "",
9
+ } = {}) {
10
+ if (!serviceId) {
11
+ throw new Error("startServiceProcess requires serviceId");
12
+ }
13
+ process.env.DEPLOY_ENV = deployEnv;
14
+ process.env.SERVICE_ID = serviceId;
15
+ if (internalApiToken) {
16
+ process.env.INTERNAL_API_TOKEN = internalApiToken;
17
+ }
18
+ return require("./webRTCmanager");
19
+ }
20
+
21
+ module.exports = {
22
+ startServiceProcess,
23
+ createSessionStore: require("./modules/sessionStore").createSessionStore,
24
+ createHttpServers: require("./modules/httpServer").createHttpServers,
25
+ createPublicServer: require("./modules/httpServer").createPublicServer,
26
+ createInternalServer: require("./modules/httpServer").createInternalServer,
27
+ createHandlers: require("./modules/handlers").createHandlers,
28
+ createSignalingPipeline: require("./modules/signalingPipeline").createSignalingPipeline,
29
+ corePath: path.join(__dirname),
30
+ };