@exotel-npm-dev/webrtc-client-sdk 1.0.3 → 1.0.5

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.
@@ -0,0 +1,37 @@
1
+ # Demonstrations
2
+
3
+ ## Building
4
+
5
+ index.html require exotel sdk bundle.
6
+
7
+ Steps to generating webrtc core bundle.
8
+
9
+ * go to webrtc client sdk
10
+
11
+ `cd <path>/webrtc-client-sdk`
12
+
13
+ * generate core bundle
14
+
15
+ ```
16
+ npm install
17
+ npm run build
18
+ ```
19
+
20
+ * `exotelsdk.js` will generate in `dist` directory along with wav files.
21
+
22
+ ## Running
23
+
24
+ The demos will run in Chrome, Firefox, or other web browsers which supports WebRTC.
25
+
26
+ In your web browser, open the `index.html` file in this directory to run the demos.
27
+
28
+
29
+ ## Development
30
+
31
+ This demonstration are build on simple html which provides some basic functionality via a simple interface.
32
+
33
+ ## Issues
34
+ ### ringtone not playing
35
+
36
+ 1. remove the wav files from `../dist/`.
37
+ 2. copy the wav files from `assets/sounds` and paste to `../dist/`.
@@ -0,0 +1,3 @@
1
+ #openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
2
+
3
+ rm -rf dist;cd ..;npm uninstall @exotel-npm-dev/webrtc-core-sdk;npm install ../webrtc-core-sdk;npm run build;cp -r dist demo-non-npm/;cd demo-non-npm;http-server -S -C ~/pki/cert.pem -K ~/pki/key.pem
@@ -0,0 +1,80 @@
1
+ const exWebClient = new exotelSDK.ExotelWebClient();
2
+ var call = null;
3
+ function UserAgentRegistration() {
4
+ var sipInfo = JSON.parse(phone)[0];
5
+ var sipAccountInfo= {
6
+ 'userName': sipInfo.Username,
7
+ 'authUser': sipInfo.Username,
8
+ 'sipdomain': sipInfo.Domain,
9
+ 'domain': sipInfo.HostServer + ":" + sipInfo.Port,
10
+ 'displayname': sipInfo.DisplayName,
11
+ 'secret': sipInfo.Password,
12
+ 'port': sipInfo.Port,
13
+ 'security': sipInfo.Security,
14
+ 'endpoint':sipInfo.EndPoint
15
+ };
16
+ exWebClient.initWebrtc(sipAccountInfo, RegisterEventCallBack, CallListenerCallback, SessionCallback)
17
+ console.log("Test.js: Calling DoRegister")
18
+ exWebClient.DoRegister();
19
+ }
20
+
21
+ function registerToggle() {
22
+ if(document.getElementById("registerButton").innerHTML === "REGISTER") {
23
+ UserAgentRegistration();
24
+ } else {
25
+ exWebClient.unregister();
26
+ }
27
+ }
28
+
29
+ function CallListenerCallback(callObj, eventType, phone) {
30
+ call = exWebClient.getCall();
31
+ document.getElementById("call_status").innerHTML = eventType +" "+phone;
32
+ }
33
+
34
+ function RegisterEventCallBack (state, phone){
35
+ document.getElementById("status").innerHTML = state;
36
+ if (state === 'registered') {
37
+ document.getElementById("registerButton").innerHTML = "UNREGISTER";
38
+ } else {
39
+ document.getElementById("registerButton").innerHTML = "REGISTER";
40
+ }
41
+
42
+ }
43
+
44
+ function SessionCallback(state, phone) {
45
+ console.log('Session state:', state, 'for number...', phone);
46
+ }
47
+
48
+ function toggleMuteButton() {
49
+ if(call){
50
+ call.Mute();
51
+ if(document.getElementById("muteButton").innerHTML === "UNMUTE"){
52
+ document.getElementById("muteButton").innerHTML = "MUTE";
53
+ } else {
54
+ document.getElementById("muteButton").innerHTML = "UNMUTE";
55
+ }
56
+ }
57
+ }
58
+
59
+ function acceptCall() {
60
+ if(call) {
61
+ call.Answer();
62
+ }
63
+ }
64
+
65
+ function rejectCall() {
66
+ if(call) {
67
+ call.Hangup();
68
+ }
69
+ }
70
+
71
+ function toggleHoldButton() {
72
+ if(call) {
73
+ call.HoldToggle();
74
+ if(document.getElementById("holdButton").innerHTML === "UNHOLD"){
75
+ document.getElementById("holdButton").innerHTML = "HOLD";
76
+ } else {
77
+ document.getElementById("holdButton").innerHTML = "UNHOLD";
78
+ }
79
+ }
80
+ }
@@ -0,0 +1 @@
1
+ export default __webpack_public_path__ + "2fbb7f0f87f09e54287f342b151bcc44.wav";