@voicenter-team/opensips-js 1.0.16 → 1.0.17

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.
package/build/index.d.ts CHANGED
@@ -47,6 +47,8 @@ declare class OpenSIPSJS extends UA {
47
47
  private initialized;
48
48
  private readonly options;
49
49
  private readonly newRTCSessionEventName;
50
+ private readonly registeredEventName;
51
+ private readonly unregisteredEventName;
50
52
  private readonly activeCalls;
51
53
  private readonly extendedCalls;
52
54
  private _currentActiveRoomId;
package/build/index.js CHANGED
@@ -32,6 +32,8 @@ class OpenSIPSJS extends UA_1.default {
32
32
  super(configuration);
33
33
  this.initialized = false;
34
34
  this.newRTCSessionEventName = 'newRTCSession';
35
+ this.registeredEventName = 'registered';
36
+ this.unregisteredEventName = 'unregistered';
35
37
  this.activeCalls = {};
36
38
  this.extendedCalls = {};
37
39
  this.state = {
@@ -577,7 +579,12 @@ class OpenSIPSJS extends UA_1.default {
577
579
  }
578
580
  const call = this.state.extendedCalls[callId];
579
581
  if (!call._is_confirmed && !call._is_canceled) {
580
- call.refer(`sip:${target}@${this.sipDomain}`);
582
+ const redirectTarget = `sip:${target}@${this.sipDomain}`;
583
+ call.terminate({
584
+ status_code: 302,
585
+ reason_phrase: 'Moved Temporarily',
586
+ extraHeaders: [`Contact: ${redirectTarget}`]
587
+ });
581
588
  return;
582
589
  }
583
590
  this._updateCallStatus({ callId, isTransferring: true });
@@ -782,42 +789,14 @@ class OpenSIPSJS extends UA_1.default {
782
789
  this.emit('ready', value);
783
790
  }
784
791
  start() {
785
- this.on('connecting', (res) => {
786
- console.log('ON connecting', res);
787
- });
788
- this.on('connected', (res) => {
789
- console.log('ON connected', res);
790
- });
791
- this.on('disconnected', (res) => {
792
- console.log('ON disconnected', res);
793
- });
794
- this.on('registered', (res) => {
792
+ this.on(this.registeredEventName, () => {
795
793
  this.setInitialized(true);
796
- console.log('ON registered', res);
797
794
  });
798
- this.on('unregistered', (res) => {
795
+ this.on(this.unregisteredEventName, () => {
799
796
  this.setInitialized(false);
800
- console.log('ON unregistered', res);
801
- });
802
- this.on('registrationFailed', (res) => {
803
- console.log('ON registrationFailed', res);
804
- });
805
- this.on('registrationExpiring', (res) => {
806
- console.log('ON registrationExpiring', res);
807
- });
808
- this.on('newMessage', (res) => {
809
- console.log('ON newMessage', res);
810
- });
811
- this.on('sipEvent', (res) => {
812
- console.log('ON sipEvent', res);
813
- });
814
- this.on('newOptions', (res) => {
815
- console.log('ON newOptions', res);
816
797
  });
817
798
  this.on(this.newRTCSessionEventName, this.newRTCSessionCallback.bind(this));
818
799
  super.start();
819
- //this.setInitialized()
820
- //this.setDefaultMediaDevices()
821
800
  this.setMediaDevices(true);
822
801
  return this;
823
802
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voicenter-team/opensips-js",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "The JS package for opensips",
5
5
  "default": "src/index.ts",
6
6
  "main": "build/index.js",