Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aculab-com/aculab-webrtc

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aculab-com/aculab-webrtc - npm Package Compare versions

Comparing version 4.0.2 to 4.0.6

src/1

10

interface.md

@@ -184,2 +184,6 @@ _aculab-webrtc javascript interface_

### extraSipHeaders
An array of extra SIP Headers to set in the call. Each element in the array is a string in the form \<header_name\>:\<value\>. Each header_name must start with "X-". The extra SIP Headers will be sent when this field is set when calling callClient(), callService() and answer().
AculabCloudCall

@@ -253,2 +257,8 @@ ===============

### getSipHeaders(name)
Gets SIP Headers with header name `name` from the call. Incoming calls can call this function any time. Outgoing calls will only return valid data if the call is in the connected state.
Returns an array of strings containing the values associated with the header name.
AculabCloudCall data properties

@@ -255,0 +265,0 @@ ---------------------------------

2

lib/aculab-cloud-client.d.ts

@@ -83,3 +83,3 @@ import { UserAgent, Web, Session, Core as sipCore } from 'sip.js';

*/
callService(serviceName: string, options?: CallOptions | undefined): AculabCloudOutgoingServiceCall;
callService(serviceName: string): AculabCloudOutgoingServiceCall;
/**

@@ -86,0 +86,0 @@ * Create a client call

@@ -246,2 +246,3 @@ 'use strict';

sessionDescriptionHandlerFactory(session, options) {
console.log("mjw... sessionDescriptionHandlerFactory", options);
// provide a media stream factory

@@ -269,4 +270,2 @@ const mediaStreamFactory = Web.defaultMediaStreamFactory();

if (this.iceServers != null) {
// This is deprecated functionality. iceServers should be passed into
// setPeerConnectionConfiguration
sessionDescriptionHandlerConfiguration.peerConnectionConfiguration.iceServers =

@@ -280,2 +279,3 @@ this.iceServers;

}
console.log("mjw... config", sessionDescriptionHandlerConfiguration.peerConnectionConfiguration);
const logger = session.userAgent.getLogger('sip.SessionDescriptionHandler');

@@ -399,3 +399,3 @@ return new MediaEventSessionDescriptionHandler(logger, mediaStreamFactory, sessionDescriptionHandlerConfiguration);

*/
callService(serviceName, options = undefined) {
callService(serviceName) {
// some users are including the sip: in the service name, strip it

@@ -419,3 +419,3 @@ if (serviceName.startsWith('sip%3A') || serviceName.startsWith('sip%3a')) {

}
const outcall = new AculabCloudOutgoingServiceCall(this, serviceName, options, this._legacy_interface);
const outcall = new AculabCloudOutgoingServiceCall(this, serviceName, this._legacy_interface);
this._calls.add(outcall);

@@ -422,0 +422,0 @@ return outcall;

import type { AculabCloudClient } from './aculab-cloud-client';
import { AculabCloudOutgoingCall } from './aculab-cloud-outgoing-call';
import { CallOptions } from './types';
export declare class AculabCloudOutgoingServiceCall extends AculabCloudOutgoingCall {
constructor(client: AculabCloudClient, serviceName: string, callOptions: CallOptions | undefined, legacy_interface?: boolean);
constructor(client: AculabCloudClient, serviceName: string, legacy_interface?: boolean);
}
//# sourceMappingURL=aculab-cloud-outgoing-service-call.d.ts.map
import { AculabCloudOutgoingCall } from './aculab-cloud-outgoing-call';
import { URI } from 'sip.js';
export class AculabCloudOutgoingServiceCall extends AculabCloudOutgoingCall {
constructor(client, serviceName, callOptions, legacy_interface = false) {
constructor(client, serviceName, legacy_interface = false) {
const uri = new URI('sip', serviceName, `sip-${client._cloud}.aculab.com;transport=tcp`);
super(client, uri, {
earlyMedia: true,
}, callOptions, false, legacy_interface);
}, undefined, false, legacy_interface);
}
}
{
"name": "@aculab-com/aculab-webrtc",
"version": "4.0.2",
"version": "4.0.6",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "types": "lib/index.d.ts",

@@ -148,6 +148,2 @@ 'use strict';

this._transport_connected = false;
// clear registration
if (this._registerer) {
this._registerer.setToken('');
}
// disconnect all calls

@@ -166,3 +162,8 @@ this._calls.forEach(call => {

// queue reconnect attempt
this.reconnect(); // TODO: should this only be "if (err)"
if (err) {
this.reconnect();
} else if (this._registerer) {
// clear registration
this._registerer.setToken('');
};
},

@@ -459,4 +460,4 @@ onInvite: invitation => {

this._calls.size === 0 &&
this._token === null &&
this._registered_token === null
this._token === '' &&
this._registered_token === ''
) {

@@ -627,3 +628,4 @@ // no longer need websocket connection

}
if (!ready && !this._token && this._registerer) {
if (!ready && this._token !== '' && this._registerer) {
this._token = '';
void this._registerer.dispose();

@@ -646,6 +648,6 @@ this._registerer = null;

if (this._registerer) {
this._registerer.setToken('');
} else {
this._checkStop();
void this._registerer.dispose();
this._registerer = null;
}
this._checkStop();
}

@@ -657,3 +659,4 @@

closeConnection() {
void this._ua.transport.disconnect();
this.disableIncoming();
this._ua.transport.disconnect();
}

@@ -660,0 +663,0 @@

@@ -10,2 +10,3 @@ import {AculabCloudCall} from './aculab-cloud-call';

answer_pending: boolean;
_extra_headers: string[] | undefined;
declare _session: CallInvitation;

@@ -17,2 +18,3 @@

this.answer_pending = false;
this._extra_headers = undefined;
}

@@ -27,2 +29,10 @@

MediaEventSessionDescriptionHandler.fixup_options(options);
this._extra_headers = options?.extraSipHeaders;
if (this._extra_headers !== undefined) {
this._extra_headers.forEach((s) => {
if (!s.startsWith("X-")) {
throw new Error("extraSipHeader must start with 'X-'");
}
});
}
this.client.console_log('AculabCloudIncomingCall: answer requested');

@@ -53,5 +63,10 @@ if (this.client._isReady()) {

// FIXME: Allow video and audio for re invite
const opts = {
const sdh_opts = {
sessionDescriptionHandlerOptions: this._sdh_options,
};
let hdr_opts = {};
if (this._extra_headers !== undefined) {
hdr_opts = {extraHeaders: this._extra_headers};
}
const opts = {...sdh_opts, ...hdr_opts};
void this._session.accept(opts);

@@ -68,3 +83,7 @@ }

if (this._session) {
void this._session.progress();
let hdr_opts = {};
if (this._extra_headers !== undefined) {
hdr_opts = {extraHeaders: this._extra_headers};
}
void this._session.progress(hdr_opts);
}

@@ -129,2 +148,6 @@ }

}
getSipHeaders(name: string) {
return this._session.request.getHeaders(name);
}
}

@@ -12,2 +12,3 @@ import {CallInviter} from './call-inviter';

_inviter_options: object;
_accept_message: sipCore.IncomingResponseMessage | undefined;
declare _session: CallInviter;

@@ -29,2 +30,3 @@

MediaEventSessionDescriptionHandler.fixup_options(options);
this._accept_message = undefined;

@@ -82,2 +84,5 @@ if (this.client._isReady()) {

},
onAccept: (response: sipCore.IncomingResponse) => {
this._accept(response);
},
},

@@ -111,2 +116,12 @@ sessionDescriptionHandlerOptions: this._sdh_options,

/**
* accept handler
* @param response sip incoming response
*/
_accept(response: sipCore.IncomingResponse) {
if (response.message && response.message.statusCode === 200) {
this._accept_message = response.message;
}
}
/**
* Disconnect outbound call

@@ -145,2 +160,6 @@ */

}
getSipHeaders(name: string) {
return this._accept_message?.getHeaders(name);
}
}

@@ -15,2 +15,9 @@ import type {AculabCloudClient} from './aculab-cloud-client';

// TODO: add option to allow video
var hdrs = options.extraSipHeaders ?? [];
hdrs.forEach((s) => {
if (!s.startsWith("X-")) {
throw new Error("extraSipHeader must start with 'X-'");
}
});
const uri = new URI(

@@ -25,3 +32,3 @@ 'sip',

{
extraHeaders: ['Authorization: Bearer ' + token],
extraHeaders: ['Authorization: Bearer ' + token].concat(hdrs),
},

@@ -28,0 +35,0 @@ options,

@@ -13,2 +13,15 @@ import type {AculabCloudClient} from './aculab-cloud-client';

) {
var hdrs = callOptions?.extraSipHeaders ?? [];
hdrs.forEach((s) => {
if (!s.startsWith("X-")) {
throw new Error("extraSipHeader must start with 'X-'");
}
});
let inv_opts = {earlyMedia: true};
let hdr_opts = {}
if (hdrs.length > 0) {
hdr_opts = {extraHeaders: hdrs};
}
const invite_opts = {...inv_opts, ...hdr_opts};
const uri = new URI(

@@ -22,5 +35,3 @@ 'sip',

uri,
{
earlyMedia: true,
},
invite_opts,
callOptions,

@@ -27,0 +38,0 @@ false,

@@ -609,24 +609,26 @@ import {SessionDescriptionHandlerModifier, Web, Core as sipCore} from 'sip.js';

const kind = getTransceiverKind(transceiver) as TransceiverKind;
if (transceiver.mid === null) {
if (kind === 'video') {
if (options.constraints?.video && options.receiveVideo) {
offerDirection = 'sendrecv';
} else if (options.constraints?.video) {
offerDirection = 'sendonly';
} else if (options.receiveVideo) {
offerDirection = 'recvonly';
if (kind === 'video') {
if (options.constraints?.video && options.receiveVideo) {
offerDirection = 'sendrecv';
} else if (options.constraints?.video) {
offerDirection = 'sendonly';
} else if (options.receiveVideo) {
offerDirection = 'recvonly';
}
} else if (kind === 'audio') {
if (options.constraints?.audio && options.receiveAudio) {
offerDirection = 'sendrecv';
} else if (options.constraints?.audio) {
offerDirection = 'sendonly';
} else if (options.receiveAudio) {
offerDirection = 'recvonly';
}
}
} else if (kind === 'audio') {
if (options.constraints?.audio && options.receiveAudio) {
offerDirection = 'sendrecv';
} else if (options.constraints?.audio) {
offerDirection = 'sendonly';
} else if (options.receiveAudio) {
offerDirection = 'recvonly';
if (transceiver.direction !== offerDirection) {
transceiver.direction = offerDirection;
}
updateTransceiverCodecsAndBitrates(transceiver, kind);
}
if (transceiver.direction !== offerDirection) {
transceiver.direction = offerDirection;
}
updateTransceiverCodecsAndBitrates(transceiver, kind);
}

@@ -633,0 +635,0 @@ });

@@ -282,2 +282,3 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

void this.unregister();
this.unregistered('DISCONNECTED');
return;

@@ -287,2 +288,3 @@ }

this.terminated();
this.unregistered('DISCONNECTED');
resolve();

@@ -310,6 +312,10 @@ };

setToken(token: string) {
this.user_token = token;
this.change_pending = true;
if (!this.waiting) {
this.processChange();
// Always re-register a token - we might have migrated to a new server.
// Only deregister (token == '') once, though
if (token !== this.user_token || token !== '') {
this.user_token = token;
this.change_pending = true;
if (!this.waiting) {
this.processChange();
}
}

@@ -325,3 +331,3 @@ }

this.force_notify = true;
if (this.user_token) {
if (this.user_token !== '') {
this.options.extraHeaders = [

@@ -328,0 +334,0 @@ 'Authorization: Bearer ' + this.user_token,

@@ -50,2 +50,3 @@ import {RegistererState, Web} from 'sip.js';

offerOptions?: RTCOfferOptions; // legacy options keep for backwards compatibility
extraSipHeaders?: string[];
}

@@ -52,0 +53,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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