+
+
+
+
+
+
+
+
+
+
+
+
Initiator Identity: {{ audioCall.initiator_identity_hash || "Unknown" }}
+
Call Hash: {{ audioCall.hash }}
+
+ Status: Active
+ Status: Inactive
+
+
+ Direction: Outbound
+ Direction: Inbound
+
+
+
+
+
+
+
@@ -111,6 +150,8 @@
data() {
return {
+ audioCalls: [],
+
isWebsocketConnected: false,
callHash: null,
txBytes: 0,
@@ -129,22 +170,35 @@
},
mounted: function() {
+ // update calls list
+ this.updateCallsList();
+
+ // update calls list every 3 seconds
+ setInterval(() => {
+ this.updateCallsList();
+ }, 3000);
+
},
methods: {
- async joinCall() {
+ async joinExistingCall() {
// make sure call hash provided
- if(!this.callHash){
+ if(!this.callHash) {
alert("Enter hash of existing call.");
return;
}
+ await this.joinCall(this.callHash);
+
+ },
+ async joinCall(callHash) {
+
// reset stats
this.txBytes = 0;
this.rxBytes = 0;
// connect to websocket
- this.ws = new WebSocket(location.origin.replace(/^http/, 'ws') + `/api/v1/calls/${this.callHash}/audio`);
+ this.ws = new WebSocket(location.origin.replace(/^http/, 'ws') + `/api/v1/calls/${callHash}/audio`);
this.ws.addEventListener('open', async () => {
@@ -333,6 +387,19 @@
return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i];
},
+ async updateCallsList() {
+ try {
+
+ // fetch calls
+ const response = await axios.get("/api/v1/calls");
+
+ // update ui
+ this.audioCalls = response.data.audio_calls;
+
+ } catch(e) {
+ // do nothing on error
+ }
+ },
},
}).mount('#app');