opensips-js 0.1.27 → 0.1.28

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/dist/index.d.ts CHANGED
@@ -454,6 +454,8 @@ declare interface IOpenSIPSJSOptions {
454
454
  },
455
455
  modules: Array<Modules>
456
456
  pnExtraHeaders?: ExtraContactParams
457
+ msrpDomain?: string
458
+ msrpWs?: boolean
457
459
  }
458
460
 
459
461
  declare interface IRoom {
@@ -139,7 +139,7 @@ ${t}
139
139
  `;return this.body&&(t+=`\r
140
140
  ${this.body}\r
141
141
  `),t+=`-------${this.ident}$\r
142
- `,t}}const Re={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9};class nu extends ft.EventEmitter{constructor(t){super(),this._id=null,this.my_ip="127.0.0.1",this._ua=t,this.auth_id=ke.createRandomToken(10),this._status=Re.STATUS_NULL,this._dialog=null,this._earlyDialogs={},this._contact=null,this._from_tag=null,this._to_tag=null,this._msgHistory=[],this.target_addr=[],this.my_addr=[],this.credentials={username:t._configuration.authorization_user,ha1:t._configuration.ha1,realm:t._configuration.realm},this._request=null,this.status="new",this.target="",this.message="",this._connectionPromiseQueue=Promise.resolve(),this._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},this._direction=null,this._local_identity=null,this._remote_identity=null,this._start_time=null,this._end_time=null,this._tones=null,this._sessionTimers={enabled:this._ua.configuration.session_timers,refreshMethod:this._ua.configuration.session_timers_refresh_method,defaultExpires:H.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},this._msrpKeepAliveTimer=null}static get C(){return Re}get direction(){return this._direction}get connection(){return this._connection}get id(){return this._id}connect(t=""){t!==""&&(this._direction="outgoing"),this.target=t,this._connection=new WebSocket(`wss://${this._ua.options.msrpDomain||this._ua._configuration.realm}`,"msrp"),this._connection.binaryType="arraybuffer",this._connection.onopen=n=>{console.log("open",n),this.onopen()},this._connection.onclose=n=>{console.log("close",n),this.onclose()},this._connection.onmessage=n=>{console.log("msg",n),this.onmessage(n)},this._connection.onerror=n=>{console.log("error",n),this.onerror()}}_sendKeepAlive(){const t=new ur("");t.method="SEND";let n="";this.my_addr[1]&&(n=this.my_addr[1]),this.target_addr[1]&&(n+=" "+this.target_addr[1]),this.target_addr[0]&&(n+=" "+this.target_addr[0]),t.addHeader("To-Path",n),t.addHeader("From-Path",`${this.my_addr[0]}`),t.addHeader("Message-ID",ke.createRandomToken(10)),t.addHeader("Byte-Range","0-0/0"),t.addHeader("Content-Type","text/plain"),t.body="",this._connection.send(t.toString())}answer(){if(!this._createDialog(this._request,"UAS")){this._request.reply(500,"Error creating dialog");return}this._status=Re.STATUS_ANSWERED,clearTimeout(this._timers.userNoAnswerTimer),this.connect()}acceptParty(t){this._request.parseSDP(!0),this._request.reply(200,"OK",[],`v=0
142
+ `,t}}const Re={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9};class nu extends ft.EventEmitter{constructor(t){super(),this._id=null,this.my_ip="127.0.0.1",this._ua=t,this.auth_id=ke.createRandomToken(10),this._status=Re.STATUS_NULL,this._dialog=null,this._earlyDialogs={},this._contact=null,this._from_tag=null,this._to_tag=null,this._msgHistory=[],this.target_addr=[],this.my_addr=[],this.credentials={username:t._configuration.authorization_user,ha1:t._configuration.ha1,realm:t._configuration.realm},this._request=null,this.status="new",this.target="",this.message="",this._connectionPromiseQueue=Promise.resolve(),this._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},this._direction=null,this._local_identity=null,this._remote_identity=null,this._start_time=null,this._end_time=null,this._tones=null,this._sessionTimers={enabled:this._ua.configuration.session_timers,refreshMethod:this._ua.configuration.session_timers_refresh_method,defaultExpires:H.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},this._msrpKeepAliveTimer=null}static get C(){return Re}get direction(){return this._direction}get connection(){return this._connection}get id(){return this._id}connect(t=""){t!==""&&(this._direction="outgoing"),this.target=t;const n=this._ua.options.msrpWs?"ws":"wss";this._connection=new WebSocket(`${n}://${this._ua.options.msrpDomain||this._ua._configuration.realm}`,"msrp"),this._connection.binaryType="arraybuffer",this._connection.onopen=a=>{console.log("open",a),this.onopen()},this._connection.onclose=a=>{console.log("close",a),this.onclose()},this._connection.onmessage=a=>{console.log("msg",a),this.onmessage(a)},this._connection.onerror=a=>{console.log("error",a),this.onerror()}}_sendKeepAlive(){const t=new ur("");t.method="SEND";let n="";this.my_addr[1]&&(n=this.my_addr[1]),this.target_addr[1]&&(n+=" "+this.target_addr[1]),this.target_addr[0]&&(n+=" "+this.target_addr[0]),t.addHeader("To-Path",n),t.addHeader("From-Path",`${this.my_addr[0]}`),t.addHeader("Message-ID",ke.createRandomToken(10)),t.addHeader("Byte-Range","0-0/0"),t.addHeader("Content-Type","text/plain"),t.body="",this._connection.send(t.toString())}answer(){if(!this._createDialog(this._request,"UAS")){this._request.reply(500,"Error creating dialog");return}this._status=Re.STATUS_ANSWERED,clearTimeout(this._timers.userNoAnswerTimer),this.connect()}acceptParty(t){this._request.parseSDP(!0),this._request.reply(200,"OK",[],`v=0
143
143
  o=- 4232740119537112802 2 IN IP4 ${this.my_ip}
144
144
  c=IN IP4 ${this.my_ip}
145
145
  t=0 0
@@ -18962,14 +18962,16 @@ class nu extends ft.EventEmitter {
18962
18962
  return this._id;
18963
18963
  }
18964
18964
  connect(t = "") {
18965
- t !== "" && (this._direction = "outgoing"), this.target = t, this._connection = new WebSocket(`wss://${this._ua.options.msrpDomain || this._ua._configuration.realm}`, "msrp"), this._connection.binaryType = "arraybuffer", this._connection.onopen = (n) => {
18966
- console.log("open", n), this.onopen();
18967
- }, this._connection.onclose = (n) => {
18968
- console.log("close", n), this.onclose();
18969
- }, this._connection.onmessage = (n) => {
18970
- console.log("msg", n), this.onmessage(n);
18971
- }, this._connection.onerror = (n) => {
18972
- console.log("error", n), this.onerror();
18965
+ t !== "" && (this._direction = "outgoing"), this.target = t;
18966
+ const n = this._ua.options.msrpWs ? "ws" : "wss";
18967
+ this._connection = new WebSocket(`${n}://${this._ua.options.msrpDomain || this._ua._configuration.realm}`, "msrp"), this._connection.binaryType = "arraybuffer", this._connection.onopen = (a) => {
18968
+ console.log("open", a), this.onopen();
18969
+ }, this._connection.onclose = (a) => {
18970
+ console.log("close", a), this.onclose();
18971
+ }, this._connection.onmessage = (a) => {
18972
+ console.log("msg", a), this.onmessage(a);
18973
+ }, this._connection.onerror = (a) => {
18974
+ console.log("error", a), this.onerror();
18973
18975
  };
18974
18976
  }
18975
18977
  _sendKeepAlive() {
@@ -139,7 +139,7 @@ ${t}
139
139
  `;return this.body&&(t+=`\r
140
140
  ${this.body}\r
141
141
  `),t+=`-------${this.ident}$\r
142
- `,t}}const Ce={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9};class Eu extends ct.EventEmitter{constructor(t){super(),this._id=null,this.my_ip="127.0.0.1",this._ua=t,this.auth_id=Pe.createRandomToken(10),this._status=Ce.STATUS_NULL,this._dialog=null,this._earlyDialogs={},this._contact=null,this._from_tag=null,this._to_tag=null,this._msgHistory=[],this.target_addr=[],this.my_addr=[],this.credentials={username:t._configuration.authorization_user,ha1:t._configuration.ha1,realm:t._configuration.realm},this._request=null,this.status="new",this.target="",this.message="",this._connectionPromiseQueue=Promise.resolve(),this._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},this._direction=null,this._local_identity=null,this._remote_identity=null,this._start_time=null,this._end_time=null,this._tones=null,this._sessionTimers={enabled:this._ua.configuration.session_timers,refreshMethod:this._ua.configuration.session_timers_refresh_method,defaultExpires:H.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},this._msrpKeepAliveTimer=null}static get C(){return Ce}get direction(){return this._direction}get connection(){return this._connection}get id(){return this._id}connect(t=""){t!==""&&(this._direction="outgoing"),this.target=t,this._connection=new WebSocket(`wss://${this._ua.options.msrpDomain||this._ua._configuration.realm}`,"msrp"),this._connection.binaryType="arraybuffer",this._connection.onopen=n=>{console.log("open",n),this.onopen()},this._connection.onclose=n=>{console.log("close",n),this.onclose()},this._connection.onmessage=n=>{console.log("msg",n),this.onmessage(n)},this._connection.onerror=n=>{console.log("error",n),this.onerror()}}_sendKeepAlive(){const t=new Vn("");t.method="SEND";let n="";this.my_addr[1]&&(n=this.my_addr[1]),this.target_addr[1]&&(n+=" "+this.target_addr[1]),this.target_addr[0]&&(n+=" "+this.target_addr[0]),t.addHeader("To-Path",n),t.addHeader("From-Path",`${this.my_addr[0]}`),t.addHeader("Message-ID",Pe.createRandomToken(10)),t.addHeader("Byte-Range","0-0/0"),t.addHeader("Content-Type","text/plain"),t.body="",this._connection.send(t.toString())}answer(){if(!this._createDialog(this._request,"UAS")){this._request.reply(500,"Error creating dialog");return}this._status=Ce.STATUS_ANSWERED,clearTimeout(this._timers.userNoAnswerTimer),this.connect()}acceptParty(t){this._request.parseSDP(!0),this._request.reply(200,"OK",[],`v=0
142
+ `,t}}const Ce={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9};class Eu extends ct.EventEmitter{constructor(t){super(),this._id=null,this.my_ip="127.0.0.1",this._ua=t,this.auth_id=Pe.createRandomToken(10),this._status=Ce.STATUS_NULL,this._dialog=null,this._earlyDialogs={},this._contact=null,this._from_tag=null,this._to_tag=null,this._msgHistory=[],this.target_addr=[],this.my_addr=[],this.credentials={username:t._configuration.authorization_user,ha1:t._configuration.ha1,realm:t._configuration.realm},this._request=null,this.status="new",this.target="",this.message="",this._connectionPromiseQueue=Promise.resolve(),this._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},this._direction=null,this._local_identity=null,this._remote_identity=null,this._start_time=null,this._end_time=null,this._tones=null,this._sessionTimers={enabled:this._ua.configuration.session_timers,refreshMethod:this._ua.configuration.session_timers_refresh_method,defaultExpires:H.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},this._msrpKeepAliveTimer=null}static get C(){return Ce}get direction(){return this._direction}get connection(){return this._connection}get id(){return this._id}connect(t=""){t!==""&&(this._direction="outgoing"),this.target=t;const n=this._ua.options.msrpWs?"ws":"wss";this._connection=new WebSocket(`${n}://${this._ua.options.msrpDomain||this._ua._configuration.realm}`,"msrp"),this._connection.binaryType="arraybuffer",this._connection.onopen=a=>{console.log("open",a),this.onopen()},this._connection.onclose=a=>{console.log("close",a),this.onclose()},this._connection.onmessage=a=>{console.log("msg",a),this.onmessage(a)},this._connection.onerror=a=>{console.log("error",a),this.onerror()}}_sendKeepAlive(){const t=new Vn("");t.method="SEND";let n="";this.my_addr[1]&&(n=this.my_addr[1]),this.target_addr[1]&&(n+=" "+this.target_addr[1]),this.target_addr[0]&&(n+=" "+this.target_addr[0]),t.addHeader("To-Path",n),t.addHeader("From-Path",`${this.my_addr[0]}`),t.addHeader("Message-ID",Pe.createRandomToken(10)),t.addHeader("Byte-Range","0-0/0"),t.addHeader("Content-Type","text/plain"),t.body="",this._connection.send(t.toString())}answer(){if(!this._createDialog(this._request,"UAS")){this._request.reply(500,"Error creating dialog");return}this._status=Ce.STATUS_ANSWERED,clearTimeout(this._timers.userNoAnswerTimer),this.connect()}acceptParty(t){this._request.parseSDP(!0),this._request.reply(200,"OK",[],`v=0
143
143
  o=- 4232740119537112802 2 IN IP4 ${this.my_ip}
144
144
  c=IN IP4 ${this.my_ip}
145
145
  t=0 0
@@ -139,7 +139,7 @@ ${t}
139
139
  `;return this.body&&(t+=`\r
140
140
  ${this.body}\r
141
141
  `),t+=`-------${this.ident}$\r
142
- `,t}}const Ce={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9};class Eu extends ct.EventEmitter{constructor(t){super(),this._id=null,this.my_ip="127.0.0.1",this._ua=t,this.auth_id=Pe.createRandomToken(10),this._status=Ce.STATUS_NULL,this._dialog=null,this._earlyDialogs={},this._contact=null,this._from_tag=null,this._to_tag=null,this._msgHistory=[],this.target_addr=[],this.my_addr=[],this.credentials={username:t._configuration.authorization_user,ha1:t._configuration.ha1,realm:t._configuration.realm},this._request=null,this.status="new",this.target="",this.message="",this._connectionPromiseQueue=Promise.resolve(),this._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},this._direction=null,this._local_identity=null,this._remote_identity=null,this._start_time=null,this._end_time=null,this._tones=null,this._sessionTimers={enabled:this._ua.configuration.session_timers,refreshMethod:this._ua.configuration.session_timers_refresh_method,defaultExpires:H.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},this._msrpKeepAliveTimer=null}static get C(){return Ce}get direction(){return this._direction}get connection(){return this._connection}get id(){return this._id}connect(t=""){t!==""&&(this._direction="outgoing"),this.target=t,this._connection=new WebSocket(`wss://${this._ua.options.msrpDomain||this._ua._configuration.realm}`,"msrp"),this._connection.binaryType="arraybuffer",this._connection.onopen=n=>{console.log("open",n),this.onopen()},this._connection.onclose=n=>{console.log("close",n),this.onclose()},this._connection.onmessage=n=>{console.log("msg",n),this.onmessage(n)},this._connection.onerror=n=>{console.log("error",n),this.onerror()}}_sendKeepAlive(){const t=new Vn("");t.method="SEND";let n="";this.my_addr[1]&&(n=this.my_addr[1]),this.target_addr[1]&&(n+=" "+this.target_addr[1]),this.target_addr[0]&&(n+=" "+this.target_addr[0]),t.addHeader("To-Path",n),t.addHeader("From-Path",`${this.my_addr[0]}`),t.addHeader("Message-ID",Pe.createRandomToken(10)),t.addHeader("Byte-Range","0-0/0"),t.addHeader("Content-Type","text/plain"),t.body="",this._connection.send(t.toString())}answer(){if(!this._createDialog(this._request,"UAS")){this._request.reply(500,"Error creating dialog");return}this._status=Ce.STATUS_ANSWERED,clearTimeout(this._timers.userNoAnswerTimer),this.connect()}acceptParty(t){this._request.parseSDP(!0),this._request.reply(200,"OK",[],`v=0
142
+ `,t}}const Ce={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9};class Eu extends ct.EventEmitter{constructor(t){super(),this._id=null,this.my_ip="127.0.0.1",this._ua=t,this.auth_id=Pe.createRandomToken(10),this._status=Ce.STATUS_NULL,this._dialog=null,this._earlyDialogs={},this._contact=null,this._from_tag=null,this._to_tag=null,this._msgHistory=[],this.target_addr=[],this.my_addr=[],this.credentials={username:t._configuration.authorization_user,ha1:t._configuration.ha1,realm:t._configuration.realm},this._request=null,this.status="new",this.target="",this.message="",this._connectionPromiseQueue=Promise.resolve(),this._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},this._direction=null,this._local_identity=null,this._remote_identity=null,this._start_time=null,this._end_time=null,this._tones=null,this._sessionTimers={enabled:this._ua.configuration.session_timers,refreshMethod:this._ua.configuration.session_timers_refresh_method,defaultExpires:H.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},this._msrpKeepAliveTimer=null}static get C(){return Ce}get direction(){return this._direction}get connection(){return this._connection}get id(){return this._id}connect(t=""){t!==""&&(this._direction="outgoing"),this.target=t;const n=this._ua.options.msrpWs?"ws":"wss";this._connection=new WebSocket(`${n}://${this._ua.options.msrpDomain||this._ua._configuration.realm}`,"msrp"),this._connection.binaryType="arraybuffer",this._connection.onopen=a=>{console.log("open",a),this.onopen()},this._connection.onclose=a=>{console.log("close",a),this.onclose()},this._connection.onmessage=a=>{console.log("msg",a),this.onmessage(a)},this._connection.onerror=a=>{console.log("error",a),this.onerror()}}_sendKeepAlive(){const t=new Vn("");t.method="SEND";let n="";this.my_addr[1]&&(n=this.my_addr[1]),this.target_addr[1]&&(n+=" "+this.target_addr[1]),this.target_addr[0]&&(n+=" "+this.target_addr[0]),t.addHeader("To-Path",n),t.addHeader("From-Path",`${this.my_addr[0]}`),t.addHeader("Message-ID",Pe.createRandomToken(10)),t.addHeader("Byte-Range","0-0/0"),t.addHeader("Content-Type","text/plain"),t.body="",this._connection.send(t.toString())}answer(){if(!this._createDialog(this._request,"UAS")){this._request.reply(500,"Error creating dialog");return}this._status=Ce.STATUS_ANSWERED,clearTimeout(this._timers.userNoAnswerTimer),this.connect()}acceptParty(t){this._request.parseSDP(!0),this._request.reply(200,"OK",[],`v=0
143
143
  o=- 4232740119537112802 2 IN IP4 ${this.my_ip}
144
144
  c=IN IP4 ${this.my_ip}
145
145
  t=0 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opensips-js",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "The JS package for opensips",
5
5
  "default": "src/index.ts",
6
6
  "jsdelivr": "dist/opensips-js.iife.js",
@@ -186,6 +186,8 @@ export interface IOpenSIPSJSOptions {
186
186
  },
187
187
  modules: Array<Modules>
188
188
  pnExtraHeaders?: ExtraContactParams
189
+ msrpDomain?: string
190
+ msrpWs?: boolean
189
191
  }
190
192
 
191
193
  export interface TriggerListenerOptions {