New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nexmo-stitch

Package Overview
Dependencies
Maintainers
5
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nexmo-stitch - npm Package Compare versions

Comparing version 2.0.0 to 2.0.3

12

CHANGELOG.md
# Changelog
## 2.0.3
### Fixes
- Disable audio on logout
- On disable audio bring to initial state the media objects
- Clean up call module, internally
## 2.0.0

@@ -25,3 +33,3 @@

- New call states `call:state:changed` for PSTN -> IP:
- New call states `call:status:changed` for PSTN -> IP:

@@ -34,3 +42,3 @@ - `started`

- `call:state:changed` to be called once per state change
- `call:status:changed` to be called once per state change
- `ANSWERED` was called for member:media false

@@ -37,0 +45,0 @@ - `RINGING` was called mutliple times

1

dist/application.js

@@ -138,3 +138,2 @@ /*

_handleEvent(event) {
if (event.type.startsWith('sip')) {

@@ -141,0 +140,0 @@ sipEventHandler._handleSipCallEvent(event);

@@ -20,46 +20,5 @@ const Event = require('../events/event');

this._handleApplicationEventMap = {
// case: call to PSTN, after knocking event we receive joined
'member:joined': (conversation, event) => {
if (event.body.channel && event.body.channel.knocking_id
&& this.application._call_draft_list.has(event.body.channel.knocking_id)) {
const call = this.application._call_draft_list.get(event.body.channel.knocking_id);
call._setupConversationObject(conversation);
call._setFrom(conversation.me);
this.application._call_draft_list.delete(event.body.channel.knocking_id);
// remove the knocking id for the calls list
// needs to be part of the call_draft_list for call.hangup to perform knocking:delete
delete call.knocking_id;
this.application.calls.set(conversation.id, call);
call._handleStatusChange(event);
this.application.emit('member:call', this.application.conversations[event.cid].members[event.from], call);
}
return event;
},
'member:invited': (conversation, event) => {
// if it was our member
// or if is not a media related invite,
// do nothing
if ((conversation.me && (conversation.me.user.name === event.body.invited_by))
|| (!event.body.user.media || !event.body.user.media.audio)) {
return event;
}
// (IP - IP call)
if (conversation.display_name && conversation.display_name.startsWith('CALL_')) {
const caller = Utils.getMemberFromNameOrNull(conversation, event.body.invited_by) || 'unknown';
const call = new Call(this.application, conversation, caller);
// payload = call;
this.application.calls.set(conversation.id, call);
this.application.emit('member:call', this.application.conversations[event.cid].members[event.from], call);
// VAPI invites (PHONE - IP)
} else if (!event.body.invited_by) {
const call = new Call(this.application, conversation, "unknown");
// payload = call;
this.application.calls.set(conversation.id, call);
call._handleStatusChange(event);
this.application.emit('member:call', this.application.conversations[event.cid].members[event.from], call);
}
return event;
}
'member:joined': this._processMemberJoined,
'member:invited': this._processMemberInvited
};
}

@@ -81,7 +40,50 @@

if (this._handleApplicationEventMap.hasOwnProperty(event.type)) {
return this._handleApplicationEventMap[event.type].call(this, conversation, new Event(conversation, copied_event) || new Event(conversation, copied_event));
return this._handleApplicationEventMap[event.type].call(this, conversation, new Event(conversation, copied_event)) || new Event(conversation, copied_event);
}
return new Event(conversation, copied_event);
}
/**
* case: call to PSTN, after knocking event we receive joined
* @private
*/
_processMemberJoined(conversation, event) {
if (event.body.channel && event.body.channel.knocking_id
&& this.application._call_draft_list.has(event.body.channel.knocking_id)) {
const call = this.application._call_draft_list.get(event.body.channel.knocking_id);
call._setupConversationObject(conversation);
call._setFrom(conversation.me);
this.application._call_draft_list.delete(event.body.channel.knocking_id);
// remove the knocking id for the calls list
// needs to be part of the call_draft_list for call.hangup to perform knocking:delete
delete call.knocking_id;
this.application.calls.set(conversation.id, call);
call._handleStatusChange(event);
this.application.emit('member:call', this.application.conversations[event.cid].members[event.from], call);
}
return event;
}
_processMemberInvited(conversation, event) {
// no need to process the event if it's not media related invite, or the member is us
if ((conversation.me && (conversation.me.user.name === event.body.invited_by))
|| (!event.body.user.media || !event.body.user.media.audio)) {
return event;
}
// (IP - IP call)
if (conversation.display_name && conversation.display_name.startsWith('CALL_')) {
const caller = Utils.getMemberFromNameOrNull(conversation, event.body.invited_by) || 'unknown';
const call = new Call(this.application, conversation, caller);
this.application.calls.set(conversation.id, call);
this.application.emit('member:call', this.application.conversations[event.cid].members[event.from], call);
// VAPI invites (PHONE - IP)
} else if (!event.body.invited_by) {
const call = new Call(this.application, conversation, "unknown");
this.application.calls.set(conversation.id, call);
call._handleStatusChange(event);
this.application.emit('member:call', this.application.conversations[event.cid].members[event.from], call);
}
return event;
}
}
module.exports = ApplicationEventsHandler;

@@ -170,5 +170,2 @@ const logger = require('loglevel');

_processMedia(event) {
if (this.application.calls && this.application.calls.has(this.conversation.id)) {
this.application.calls.get(this.conversation.id)._handleStatusChange(event);
}
this.conversation.members[event.from]._handleEvent(event);

@@ -175,0 +172,0 @@ return null;

@@ -37,3 +37,3 @@ /*

* @property {Member} from - the member that is changed
* @property {MEMBER_CALL_STATES} state - the new state
* @property {Call.MEMBER_CALL_STATES} state - the new state
* @property {Event} event - the actual event

@@ -50,6 +50,6 @@ * @example <caption>listen for member state events</caption>

*
* @event Call#call:status:changed
* @event Application#call:status:changed
* @property {Call} call - the actual event
* @example <caption>listen for call status events</caption>
* call.on("call:status:changed",(call) => {
* application.on("call:status:changed",(call) => {
* console.log("call: " + call.status);

@@ -122,2 +122,3 @@ * });

_attachCallListeners() {
// Conversation level listeners
this.conversation.releaseGroup('call_module');

@@ -142,2 +143,7 @@ this.conversation.on('member:left', 'call_module', (from, event) => {

});
this.conversation.on('member:media', 'call_module', (from, event) => {
if (this.application.calls && this.application.calls.has(this.conversation.id)) {
this.application.calls.get(this.conversation.id)._handleStatusChange(event);
}
});
}

@@ -287,3 +293,3 @@

* @param {Call.CALL_STATUS} this.CALL_STATUS the call status to set
* @emits Call#call:status:changed
* @emits Application#call:status:changed
* @private

@@ -403,2 +409,5 @@ */

hangUp() {
if (this.conversation) {
this.conversation.media.disable();
}
if (!this.knocking_id) {

@@ -405,0 +414,0 @@ return this.conversation.leave();

@@ -40,5 +40,5 @@ /*

* @property {Conversation} parentConversation the conversation object this media instance belongs to
* @property {Member} parentConversation.remoteMembers The remote members
* @property {Member[]} parentConversation.remoteMembers The remote members
* @property {number} parentConversation.streamIndex the index of the streams, updated in each new peer offer
* @property {object[]} parentConversation.rtcObjects data related to the rtc connection
* @property {object} parentConversation.rtcObjects data related to the rtc connection
* @property {string} parentConversation.rtcObjects.id the rtc_id

@@ -229,3 +229,3 @@ * @property {PeerConnection} parentConversation.rtcObjects.pc the current PeerConnection object

this.parentConversation.on('member:left', (member_left) => {
this.parentConversation.on('member:left', 'media_module', (member_left) => {
this._handleMemberLeft(member_left);

@@ -232,0 +232,0 @@ })

@@ -73,3 +73,3 @@ /*

repository: 'https://github.com/Nexmo/conversation-js-sdk',
SDK_version: '2.0.0',
SDK_version: '2.0.3',
url: 'https://ws.nexmo.com',

@@ -76,0 +76,0 @@ iceServers: [{

@@ -5,3 +5,3 @@ {

"repository": "https://github.com/Nexmo/conversation-js-sdk",
"version": "2.0.0",
"version": "2.0.3",
"keywords": [

@@ -19,3 +19,3 @@ "nexmo",

"dependencies": {
"detect-browser": "^2.5.1",
"detect-browser": "^3.0.0",
"loglevel": "^1.6.1",

@@ -22,0 +22,0 @@ "loglevel-plugin-prefix": "^0.8.4",

@@ -5,3 +5,3 @@ # Nexmo Stitch SDK for JavaScript

The Conversation SDK is intended to provide a ready solution for developers who want to integrate chat, voice and video into their apps.
The Stitch SDK is intended to provide a ready solution for developers who want to integrate chat, voice and video into their apps.

@@ -12,3 +12,3 @@ ## Installation

A dependency manager for Node packages. You can install the Conversation SDK with the following command:
A dependency manager for Node packages. You can install the Stitch SDK with the following command:

@@ -41,5 +41,5 @@ ```bash

Copyright (c) 2018 Nexmo, Inc. All rights reserved. Licensed only under the Nexmo Conversation SDK License Agreement (the "License") located at
Copyright (c) 2018 Nexmo, Inc. All rights reserved. Licensed only under the Nexmo Stitch SDK License Agreement (the "License") located at
By downloading or otherwise using our software or services, you acknowledge that you have read, understand and agree to be bound by the Nexmo Conversation SDK License Agreement and Privacy Policy.
By downloading or otherwise using our software or services, you acknowledge that you have read, understand and agree to be bound by the Nexmo Stitch SDK License Agreement and Privacy Policy.

@@ -46,0 +46,0 @@ You may not use, exercise any rights with respect to or exploit this SDK, or any modifications or derivative works thereof, except in accordance with the License.

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc