@voicenter-team/opensips-js 1.0.133 → 1.0.135

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.
@@ -8881,8 +8881,8 @@ function jc(c, t) {
8881
8881
  a[n] = c[n];
8882
8882
  return a;
8883
8883
  }
8884
- var Jp = ht, lh = lt, qc = Ss, ku = bt(), Mu = new Jp("sanityCheck"), zp = [lm], Xp = [em, tm, sm, nm], Qp = [rm, im], He, rs, ah, Zp = function(c, t, n) {
8885
- He = c, rs = t, ah = n;
8884
+ var Jp = ht, lh = lt, qc = Ss, ku = bt(), Mu = new Jp("sanityCheck"), zp = [lm], Xp = [em, tm, sm, nm], Qp = [rm, im], Fe, rs, ah, Zp = function(c, t, n) {
8885
+ Fe = c, rs = t, ah = n;
8886
8886
  var a = Ia(zp), o;
8887
8887
  try {
8888
8888
  for (a.s(); !(o = a.n()).done; ) {
@@ -8895,7 +8895,7 @@ var Jp = ht, lh = lt, qc = Ss, ku = bt(), Mu = new Jp("sanityCheck"), zp = [lm],
8895
8895
  } finally {
8896
8896
  a.f();
8897
8897
  }
8898
- if (He instanceof qc.IncomingRequest) {
8898
+ if (Fe instanceof qc.IncomingRequest) {
8899
8899
  var r = Ia(Xp), d;
8900
8900
  try {
8901
8901
  for (r.s(); !(d = r.n()).done; ) {
@@ -8908,7 +8908,7 @@ var Jp = ht, lh = lt, qc = Ss, ku = bt(), Mu = new Jp("sanityCheck"), zp = [lm],
8908
8908
  } finally {
8909
8909
  r.f();
8910
8910
  }
8911
- } else if (He instanceof qc.IncomingResponse) {
8911
+ } else if (Fe instanceof qc.IncomingResponse) {
8912
8912
  var _ = Ia(Qp), g;
8913
8913
  try {
8914
8914
  for (_.s(); !(g = _.n()).done; ) {
@@ -8925,29 +8925,29 @@ var Jp = ht, lh = lt, qc = Ss, ku = bt(), Mu = new Jp("sanityCheck"), zp = [lm],
8925
8925
  return !0;
8926
8926
  };
8927
8927
  function em() {
8928
- if (He.s("to").uri.scheme !== "sip")
8928
+ if (Fe.s("to").uri.scheme !== "sip")
8929
8929
  return tl(416), !1;
8930
8930
  }
8931
8931
  function tm() {
8932
- if (!He.to_tag && He.call_id.substr(0, 5) === rs.configuration.jssip_id)
8932
+ if (!Fe.to_tag && Fe.call_id.substr(0, 5) === rs.configuration.jssip_id)
8933
8933
  return tl(482), !1;
8934
8934
  }
8935
8935
  function sm() {
8936
- var c = ku.str_utf8_length(He.body), t = He.getHeader("content-length");
8936
+ var c = ku.str_utf8_length(Fe.body), t = Fe.getHeader("content-length");
8937
8937
  if (c < t)
8938
8938
  return tl(400), !1;
8939
8939
  }
8940
8940
  function nm() {
8941
- var c = He.from_tag, t = He.call_id, n = He.cseq, a;
8942
- if (!He.to_tag)
8943
- if (He.method === lh.INVITE) {
8944
- if (rs._transactions.ist[He.via_branch])
8941
+ var c = Fe.from_tag, t = Fe.call_id, n = Fe.cseq, a;
8942
+ if (!Fe.to_tag)
8943
+ if (Fe.method === lh.INVITE) {
8944
+ if (rs._transactions.ist[Fe.via_branch])
8945
8945
  return !1;
8946
8946
  for (var o in rs._transactions.ist)
8947
8947
  if (Object.prototype.hasOwnProperty.call(rs._transactions.ist, o) && (a = rs._transactions.ist[o], a.request.from_tag === c && a.request.call_id === t && a.request.cseq === n))
8948
8948
  return tl(482), !1;
8949
8949
  } else {
8950
- if (rs._transactions.nist[He.via_branch])
8950
+ if (rs._transactions.nist[Fe.via_branch])
8951
8951
  return !1;
8952
8952
  for (var s in rs._transactions.nist)
8953
8953
  if (Object.prototype.hasOwnProperty.call(rs._transactions.nist, s) && (a = rs._transactions.nist[s], a.request.from_tag === c && a.request.call_id === t && a.request.cseq === n))
@@ -8955,23 +8955,23 @@ function nm() {
8955
8955
  }
8956
8956
  }
8957
8957
  function rm() {
8958
- if (He.getHeaders("via").length > 1)
8958
+ if (Fe.getHeaders("via").length > 1)
8959
8959
  return Mu.debug("more than one Via header field present in the response, dropping the response"), !1;
8960
8960
  }
8961
8961
  function im() {
8962
- var c = ku.str_utf8_length(He.body), t = He.getHeader("content-length");
8962
+ var c = ku.str_utf8_length(Fe.body), t = Fe.getHeader("content-length");
8963
8963
  if (c < t)
8964
8964
  return Mu.debug("message body length is lower than the value in Content-Length header field, dropping the response"), !1;
8965
8965
  }
8966
8966
  function lm() {
8967
8967
  for (var c = ["from", "to", "call_id", "cseq", "via"], t = 0, n = c; t < n.length; t++) {
8968
8968
  var a = n[t];
8969
- if (!He.hasHeader(a))
8969
+ if (!Fe.hasHeader(a))
8970
8970
  return Mu.debug("missing mandatory header field : ".concat(a, ", dropping the response")), !1;
8971
8971
  }
8972
8972
  }
8973
8973
  function tl(c) {
8974
- var t = He.getHeaders("via"), n, a = "SIP/2.0 ".concat(c, " ").concat(lh.REASON_PHRASE[c], `\r
8974
+ var t = Fe.getHeaders("via"), n, a = "SIP/2.0 ".concat(c, " ").concat(lh.REASON_PHRASE[c], `\r
8975
8975
  `), o = Ia(t), s;
8976
8976
  try {
8977
8977
  for (o.s(); !(s = o.n()).done; ) {
@@ -8984,10 +8984,10 @@ function tl(c) {
8984
8984
  } finally {
8985
8985
  o.f();
8986
8986
  }
8987
- n = He.getHeader("To"), He.to_tag || (n += ";tag=".concat(ku.newTag())), a += "To: ".concat(n, `\r
8988
- `), a += "From: ".concat(He.getHeader("From"), `\r
8989
- `), a += "Call-ID: ".concat(He.call_id, `\r
8990
- `), a += "CSeq: ".concat(He.cseq, " ").concat(He.method, `\r
8987
+ n = Fe.getHeader("To"), Fe.to_tag || (n += ";tag=".concat(ku.newTag())), a += "To: ".concat(n, `\r
8988
+ `), a += "From: ".concat(Fe.getHeader("From"), `\r
8989
+ `), a += "Call-ID: ".concat(Fe.call_id, `\r
8990
+ `), a += "CSeq: ".concat(Fe.cseq, " ").concat(Fe.method, `\r
8991
8991
  `), a += `\r
8992
8992
  `, ah.send(a);
8993
8993
  }
@@ -9312,7 +9312,7 @@ function La(c) {
9312
9312
  return n.__proto__ || Object.getPrototypeOf(n);
9313
9313
  }, La(c);
9314
9314
  }
9315
- var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp, No = hl, mm = Vp, Jl = bt(), gm = Ws, Tm = Ks(), vm = ih, Uo = Ss, Em = Zp, Po = Lu, je = new _m("UA"), Tt = {
9315
+ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp, No = hl, mm = Vp, Jl = bt(), gm = Ws, Tm = Ks(), vm = ih, Uo = Ss, Em = Zp, Po = Lu, qe = new _m("UA"), Tt = {
9316
9316
  // UA status codes.
9317
9317
  STATUS_INIT: 0,
9318
9318
  STATUS_READY: 1,
@@ -9333,7 +9333,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9333
9333
  }]);
9334
9334
  function n(a) {
9335
9335
  var o;
9336
- if (om(this, n), je.debug("new() [configuration:%o]", a), o = t.call(this), o._cache = {
9336
+ if (om(this, n), console.log("constructor es5"), qe.debug("new() [configuration:%o]", a), o = t.call(this), o._cache = {
9337
9337
  credentials: {}
9338
9338
  }, o._configuration = Object.assign({}, Po.settings), o._dynConfiguration = {}, o._dialogs = {}, o._applicants = {}, o._sessions = {}, o._transport = null, o._contact = null, o._status = Tt.STATUS_INIT, o._error = null, o._transactions = {
9339
9339
  nist: {},
@@ -9359,7 +9359,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9359
9359
  * Resume UA after being closed.
9360
9360
  */
9361
9361
  value: function() {
9362
- je.debug("start()"), this._status === Tt.STATUS_INIT ? this._transport.connect() : this._status === Tt.STATUS_USER_CLOSED ? (je.debug("restarting UA"), this._closeTimer !== null && (clearTimeout(this._closeTimer), this._closeTimer = null, this._transport.disconnect()), this._status = Tt.STATUS_INIT, this._transport.connect()) : this._status === Tt.STATUS_READY ? je.debug("UA is in READY status, not restarted") : je.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"), this._dynConfiguration.register = this._configuration.register;
9362
+ qe.debug("start()"), this._status === Tt.STATUS_INIT ? this._transport.connect() : this._status === Tt.STATUS_USER_CLOSED ? (qe.debug("restarting UA"), this._closeTimer !== null && (clearTimeout(this._closeTimer), this._closeTimer = null, this._transport.disconnect()), this._status = Tt.STATUS_INIT, this._transport.connect()) : this._status === Tt.STATUS_READY ? qe.debug("UA is in READY status, not restarted") : qe.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"), this._dynConfiguration.register = this._configuration.register;
9363
9363
  }
9364
9364
  /**
9365
9365
  * Register.
@@ -9367,7 +9367,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9367
9367
  }, {
9368
9368
  key: "register",
9369
9369
  value: function() {
9370
- je.debug("register()"), this._dynConfiguration.register = !0, this._registrator.register();
9370
+ qe.debug("register()"), this._dynConfiguration.register = !0, this._registrator.register();
9371
9371
  }
9372
9372
  /**
9373
9373
  * Unregister.
@@ -9375,7 +9375,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9375
9375
  }, {
9376
9376
  key: "unregister",
9377
9377
  value: function(o) {
9378
- je.debug("unregister()"), this._dynConfiguration.register = !1, this._registrator.unregister(o);
9378
+ qe.debug("unregister()"), this._dynConfiguration.register = !1, this._registrator.unregister(o);
9379
9379
  }
9380
9380
  /**
9381
9381
  * Get the Registrator instance.
@@ -9413,7 +9413,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9413
9413
  }, {
9414
9414
  key: "call",
9415
9415
  value: function(o, s) {
9416
- je.debug("call()");
9416
+ qe.debug("call()");
9417
9417
  var r = new Yc(this);
9418
9418
  return r.connect(o, s), r;
9419
9419
  }
@@ -9430,7 +9430,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9430
9430
  }, {
9431
9431
  key: "sendMessage",
9432
9432
  value: function(o, s, r) {
9433
- je.debug("sendMessage()");
9433
+ qe.debug("sendMessage()");
9434
9434
  var d = new Jc(this);
9435
9435
  return d.send(o, s, r), d;
9436
9436
  }
@@ -9447,7 +9447,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9447
9447
  }, {
9448
9448
  key: "sendOptions",
9449
9449
  value: function(o, s, r) {
9450
- je.debug("sendOptions()");
9450
+ qe.debug("sendOptions()");
9451
9451
  var d = new zc(this);
9452
9452
  return d.send(o, s, r), d;
9453
9453
  }
@@ -9457,7 +9457,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9457
9457
  }, {
9458
9458
  key: "terminateSessions",
9459
9459
  value: function(o) {
9460
- je.debug("terminateSessions()");
9460
+ qe.debug("terminateSessions()");
9461
9461
  for (var s in this._sessions)
9462
9462
  this._sessions[s].isEnded() || this._sessions[s].terminate(o);
9463
9463
  }
@@ -9469,15 +9469,15 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9469
9469
  key: "stop",
9470
9470
  value: function() {
9471
9471
  var o = this;
9472
- if (je.debug("stop()"), this._dynConfiguration = {}, this._status === Tt.STATUS_USER_CLOSED) {
9473
- je.debug("UA already closed");
9472
+ if (qe.debug("stop()"), this._dynConfiguration = {}, this._status === Tt.STATUS_USER_CLOSED) {
9473
+ qe.debug("UA already closed");
9474
9474
  return;
9475
9475
  }
9476
9476
  this._registrator.close();
9477
9477
  var s = Object.keys(this._sessions).length;
9478
9478
  for (var r in this._sessions)
9479
9479
  if (Object.prototype.hasOwnProperty.call(this._sessions, r)) {
9480
- je.debug("closing session ".concat(r));
9480
+ qe.debug("closing session ".concat(r));
9481
9481
  try {
9482
9482
  this._sessions[r].terminate();
9483
9483
  } catch {
@@ -9521,7 +9521,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9521
9521
  case "authorization_jwt":
9522
9522
  return this._configuration.authorization_jwt;
9523
9523
  default:
9524
- je.warn('get() | cannot get "%s" parameter in runtime', o);
9524
+ qe.warn('get() | cannot get "%s" parameter in runtime', o);
9525
9525
  return;
9526
9526
  }
9527
9527
  }
@@ -9558,7 +9558,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9558
9558
  break;
9559
9559
  }
9560
9560
  default:
9561
- return je.warn('set() | cannot set "%s" parameter in runtime', o), !1;
9561
+ return qe.warn('set() | cannot set "%s" parameter in runtime', o), !1;
9562
9562
  }
9563
9563
  return !0;
9564
9564
  }
@@ -9674,9 +9674,10 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9674
9674
  }, {
9675
9675
  key: "receiveRequest",
9676
9676
  value: function(o) {
9677
+ console.log("receiveRequest");
9677
9678
  var s = o.method;
9678
9679
  if (o.ruri.user !== this._configuration.uri.user && o.ruri.user !== this._contact.uri.user) {
9679
- je.debug("Request-URI does not point to us"), o.method !== pt.ACK && o.reply_sl(404);
9680
+ qe.debug("Request-URI does not point to us"), o.method !== pt.ACK && o.reply_sl(404);
9680
9681
  return;
9681
9682
  }
9682
9683
  if (o.ruri.scheme === pt.SIPS) {
@@ -9685,7 +9686,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9685
9686
  }
9686
9687
  if (!No.checkTransaction(this, o)) {
9687
9688
  if (s === pt.INVITE ? new No.InviteServerTransaction(this, this._transport, o) : s !== pt.ACK && s !== pt.CANCEL && new No.NonInviteServerTransaction(this, this._transport, o), s === pt.OPTIONS) {
9688
- if (this.listeners("newOptions").length === 0) {
9689
+ if (console.log("OPPP in option"), this.listeners("newOptions").length === 0) {
9689
9690
  o.reply(200);
9690
9691
  return;
9691
9692
  }
@@ -9704,7 +9705,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9704
9705
  }
9705
9706
  var h, _;
9706
9707
  if (o.to_tag)
9707
- h = this._findDialog(o.call_id, o.from_tag, o.to_tag), h ? h.receiveRequest(o) : s === pt.NOTIFY ? (_ = this._findSession(o), _ ? _.receiveRequest(o) : (je.debug("received NOTIFY request for a non existent subscription"), o.reply(481, "Subscription does not exist"))) : s !== pt.ACK && o.reply(481);
9708
+ h = this._findDialog(o.call_id, o.from_tag, o.to_tag), h ? h.receiveRequest(o) : s === pt.NOTIFY ? (_ = this._findSession(o), _ ? _.receiveRequest(o) : (qe.debug("received NOTIFY request for a non existent subscription"), o.reply(481, "Subscription does not exist"))) : s !== pt.ACK && o.reply(481);
9708
9709
  else
9709
9710
  switch (s) {
9710
9711
  case pt.INVITE:
@@ -9715,13 +9716,13 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9715
9716
  } else
9716
9717
  _ = new Yc(this), _.init_incoming(o);
9717
9718
  else
9718
- je.warn("INVITE received but WebRTC is not supported"), o.reply(488);
9719
+ qe.warn("INVITE received but WebRTC is not supported"), o.reply(488);
9719
9720
  break;
9720
9721
  case pt.BYE:
9721
9722
  o.reply(481);
9722
9723
  break;
9723
9724
  case pt.CANCEL:
9724
- _ = this._findSession(o), _ ? _.receiveRequest(o) : je.debug("received CANCEL request for a non existent session");
9725
+ _ = this._findSession(o), _ ? _.receiveRequest(o) : qe.debug("received CANCEL request for a non existent session");
9725
9726
  break;
9726
9727
  case pt.ACK:
9727
9728
  break;
@@ -9776,7 +9777,7 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9776
9777
  min_interval: this._configuration.connection_recovery_min_interval
9777
9778
  }), this._transport.onconnecting = ym.bind(this), this._transport.onconnect = Am.bind(this), this._transport.ondisconnect = Cm.bind(this), this._transport.ondata = Rm.bind(this);
9778
9779
  } catch (g) {
9779
- throw je.warn(g), new gm.ConfigurationError("sockets", this._configuration.sockets);
9780
+ throw qe.warn(g), new gm.ConfigurationError("sockets", this._configuration.sockets);
9780
9781
  }
9781
9782
  if (delete this._configuration.sockets, this._configuration.authorization_user || (this._configuration.authorization_user = this._configuration.uri.user), !this._configuration.registrar_server) {
9782
9783
  var r = this._configuration.uri.clone();
@@ -9802,21 +9803,21 @@ var dm = ft.EventEmitter, _m = ht, pt = lt, pm = s_, Yc = fp, Jc = Cp, zc = Mp,
9802
9803
  writable: !1,
9803
9804
  configurable: !1
9804
9805
  }));
9805
- je.debug("configuration parameters after validation:");
9806
+ qe.debug("configuration parameters after validation:");
9806
9807
  for (var _ in this._configuration)
9807
9808
  if (Object.prototype.hasOwnProperty.call(Po.settings, _))
9808
9809
  switch (_) {
9809
9810
  case "uri":
9810
9811
  case "registrar_server":
9811
- je.debug("- ".concat(_, ": ").concat(this._configuration[_]));
9812
+ qe.debug("- ".concat(_, ": ").concat(this._configuration[_]));
9812
9813
  break;
9813
9814
  case "password":
9814
9815
  case "ha1":
9815
9816
  case "authorization_jwt":
9816
- je.debug("- ".concat(_, ": NOT SHOWN"));
9817
+ qe.debug("- ".concat(_, ": NOT SHOWN"));
9817
9818
  break;
9818
9819
  default:
9819
- je.debug("- ".concat(_, ": ").concat(JSON.stringify(this._configuration[_])));
9820
+ qe.debug("- ".concat(_, ": ").concat(JSON.stringify(this._configuration[_])));
9820
9821
  }
9821
9822
  }
9822
9823
  }, {
@@ -9861,6 +9862,7 @@ function Cm(c) {
9861
9862
  this.emit("disconnected", c), this._registrator.onTransportClosed(), this._status !== Tt.STATUS_USER_CLOSED && (this._status = Tt.STATUS_NOT_READY, this._error = Tt.NETWORK_ERROR);
9862
9863
  }
9863
9864
  function Rm(c) {
9865
+ console.log("onTransportData");
9864
9866
  var t = c.transport, n = c.message;
9865
9867
  if (n = vm.parseMessage(n, this), !!n && !(this._status === Tt.STATUS_USER_CLOSED && n instanceof Uo.IncomingRequest) && Em(n, this, t)) {
9866
9868
  if (n instanceof Uo.IncomingRequest)
@@ -15829,17 +15831,17 @@ const sT = ut, Ch = De, Cf = yt, Vu = At(), Bu = new sT("sanityCheck"), nT = [hT
15829
15831
  cT,
15830
15832
  fT
15831
15833
  ];
15832
- let Fe, is, Rh;
15834
+ let je, is, Rh;
15833
15835
  var Ih = (c, t, n) => {
15834
- Fe = c, is = t, Rh = n;
15836
+ je = c, is = t, Rh = n;
15835
15837
  for (const a of nT)
15836
15838
  if (a() === !1)
15837
15839
  return !1;
15838
- if (Fe instanceof Cf.IncomingRequest) {
15840
+ if (je instanceof Cf.IncomingRequest) {
15839
15841
  for (const a of rT)
15840
15842
  if (a() === !1)
15841
15843
  return !1;
15842
- } else if (Fe instanceof Cf.IncomingResponse) {
15844
+ } else if (je instanceof Cf.IncomingResponse) {
15843
15845
  for (const a of iT)
15844
15846
  if (a() === !1)
15845
15847
  return !1;
@@ -15847,30 +15849,30 @@ var Ih = (c, t, n) => {
15847
15849
  return !0;
15848
15850
  };
15849
15851
  function lT() {
15850
- if (Fe.s("to").uri.scheme !== "sip")
15852
+ if (je.s("to").uri.scheme !== "sip")
15851
15853
  return nl(416), !1;
15852
15854
  }
15853
15855
  function aT() {
15854
- if (!Fe.to_tag && Fe.call_id.substr(0, 5) === is.configuration.jssip_id)
15856
+ if (!je.to_tag && je.call_id.substr(0, 5) === is.configuration.jssip_id)
15855
15857
  return nl(482), !1;
15856
15858
  }
15857
15859
  function oT() {
15858
- const c = Vu.str_utf8_length(Fe.body), t = Fe.getHeader("content-length");
15860
+ const c = Vu.str_utf8_length(je.body), t = je.getHeader("content-length");
15859
15861
  if (c < t)
15860
15862
  return nl(400), !1;
15861
15863
  }
15862
15864
  function uT() {
15863
- const c = Fe.from_tag, t = Fe.call_id, n = Fe.cseq;
15865
+ const c = je.from_tag, t = je.call_id, n = je.cseq;
15864
15866
  let a;
15865
- if (!Fe.to_tag)
15866
- if (Fe.method === Ch.INVITE) {
15867
- if (is._transactions.ist[Fe.via_branch])
15867
+ if (!je.to_tag)
15868
+ if (je.method === Ch.INVITE) {
15869
+ if (is._transactions.ist[je.via_branch])
15868
15870
  return !1;
15869
15871
  for (const o in is._transactions.ist)
15870
15872
  if (Object.prototype.hasOwnProperty.call(is._transactions.ist, o) && (a = is._transactions.ist[o], a.request.from_tag === c && a.request.call_id === t && a.request.cseq === n))
15871
15873
  return nl(482), !1;
15872
15874
  } else {
15873
- if (is._transactions.nist[Fe.via_branch])
15875
+ if (is._transactions.nist[je.via_branch])
15874
15876
  return !1;
15875
15877
  for (const o in is._transactions.nist)
15876
15878
  if (Object.prototype.hasOwnProperty.call(is._transactions.nist, o) && (a = is._transactions.nist[o], a.request.from_tag === c && a.request.call_id === t && a.request.cseq === n))
@@ -15878,31 +15880,31 @@ function uT() {
15878
15880
  }
15879
15881
  }
15880
15882
  function cT() {
15881
- if (Fe.getHeaders("via").length > 1)
15883
+ if (je.getHeaders("via").length > 1)
15882
15884
  return Bu.debug("more than one Via header field present in the response, dropping the response"), !1;
15883
15885
  }
15884
15886
  function fT() {
15885
- const c = Vu.str_utf8_length(Fe.body), t = Fe.getHeader("content-length");
15887
+ const c = Vu.str_utf8_length(je.body), t = je.getHeader("content-length");
15886
15888
  if (c < t)
15887
15889
  return Bu.debug("message body length is lower than the value in Content-Length header field, dropping the response"), !1;
15888
15890
  }
15889
15891
  function hT() {
15890
15892
  const c = ["from", "to", "call_id", "cseq", "via"];
15891
15893
  for (const t of c)
15892
- if (!Fe.hasHeader(t))
15894
+ if (!je.hasHeader(t))
15893
15895
  return Bu.debug(`missing mandatory header field : ${t}, dropping the response`), !1;
15894
15896
  }
15895
15897
  function nl(c) {
15896
- const t = Fe.getHeaders("via");
15898
+ const t = je.getHeaders("via");
15897
15899
  let n, a = `SIP/2.0 ${c} ${Ch.REASON_PHRASE[c]}\r
15898
15900
  `;
15899
15901
  for (const o of t)
15900
15902
  a += `Via: ${o}\r
15901
15903
  `;
15902
- n = Fe.getHeader("To"), Fe.to_tag || (n += `;tag=${Vu.newTag()}`), a += `To: ${n}\r
15903
- `, a += `From: ${Fe.getHeader("From")}\r
15904
- `, a += `Call-ID: ${Fe.call_id}\r
15905
- `, a += `CSeq: ${Fe.cseq} ${Fe.method}\r
15904
+ n = je.getHeader("To"), je.to_tag || (n += `;tag=${Vu.newTag()}`), a += `To: ${n}\r
15905
+ `, a += `From: ${je.getHeader("From")}\r
15906
+ `, a += `Call-ID: ${je.call_id}\r
15907
+ `, a += `CSeq: ${je.cseq} ${je.method}\r
15906
15908
  `, a += `\r
15907
15909
  `, Rh.send(a);
15908
15910
  }
@@ -16088,7 +16090,7 @@ rl.load = (c, t) => {
16088
16090
  throw new Xo.ConfigurationError(n, a);
16089
16091
  }
16090
16092
  };
16091
- const _T = ft.EventEmitter, pT = ut, mt = De, mT = rg, If = Sh, bf = qg, wf = Kg, Qo = Tr, gT = yh, aa = At(), TT = As, vT = ys(), ET = Ah, Zo = yt, ST = Ih, eu = rl, qe = new pT("UA"), vt = {
16093
+ const _T = ft.EventEmitter, pT = ut, mt = De, mT = rg, If = Sh, bf = qg, wf = Kg, Qo = Tr, gT = yh, aa = At(), TT = As, vT = ys(), ET = Ah, Zo = yt, ST = Ih, eu = rl, He = new pT("UA"), vt = {
16092
16094
  // UA status codes.
16093
16095
  STATUS_INIT: 0,
16094
16096
  STATUS_READY: 1,
@@ -16104,7 +16106,7 @@ var bh = class extends _T {
16104
16106
  return vt;
16105
16107
  }
16106
16108
  constructor(t) {
16107
- if (qe.debug("new() [configuration:%o]", t), super(), this._cache = {
16109
+ if (He.debug("new() [configuration:%o]", t), super(), this._cache = {
16108
16110
  credentials: {}
16109
16111
  }, this._configuration = Object.assign({}, eu.settings), this._dynConfiguration = {}, this._dialogs = {}, this._applicants = {}, this._sessions = {}, this._transport = null, this._contact = null, this._status = vt.STATUS_INIT, this._error = null, this._transactions = {
16110
16112
  nist: {},
@@ -16143,19 +16145,19 @@ var bh = class extends _T {
16143
16145
  * Resume UA after being closed.
16144
16146
  */
16145
16147
  start() {
16146
- qe.debug("start()"), this._status === vt.STATUS_INIT ? this._transport.connect() : this._status === vt.STATUS_USER_CLOSED ? (qe.debug("restarting UA"), this._closeTimer !== null && (clearTimeout(this._closeTimer), this._closeTimer = null, this._transport.disconnect()), this._status = vt.STATUS_INIT, this._transport.connect()) : this._status === vt.STATUS_READY ? qe.debug("UA is in READY status, not restarted") : qe.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"), this._dynConfiguration.register = this._configuration.register;
16148
+ He.debug("start()"), this._status === vt.STATUS_INIT ? this._transport.connect() : this._status === vt.STATUS_USER_CLOSED ? (He.debug("restarting UA"), this._closeTimer !== null && (clearTimeout(this._closeTimer), this._closeTimer = null, this._transport.disconnect()), this._status = vt.STATUS_INIT, this._transport.connect()) : this._status === vt.STATUS_READY ? He.debug("UA is in READY status, not restarted") : He.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"), this._dynConfiguration.register = this._configuration.register;
16147
16149
  }
16148
16150
  /**
16149
16151
  * Register.
16150
16152
  */
16151
16153
  register() {
16152
- qe.debug("register()"), this._dynConfiguration.register = !0, this._registrator.register();
16154
+ He.debug("register()"), this._dynConfiguration.register = !0, this._registrator.register();
16153
16155
  }
16154
16156
  /**
16155
16157
  * Unregister.
16156
16158
  */
16157
16159
  unregister(t) {
16158
- qe.debug("unregister()"), this._dynConfiguration.register = !1, this._registrator.unregister(t);
16160
+ He.debug("unregister()"), this._dynConfiguration.register = !1, this._registrator.unregister(t);
16159
16161
  }
16160
16162
  /**
16161
16163
  * Get the Registrator instance.
@@ -16185,7 +16187,7 @@ var bh = class extends _T {
16185
16187
  *
16186
16188
  */
16187
16189
  call(t, n) {
16188
- qe.debug("call()");
16190
+ He.debug("call()");
16189
16191
  const a = new If(this);
16190
16192
  return a.connect(t, n), a;
16191
16193
  }
@@ -16200,7 +16202,7 @@ var bh = class extends _T {
16200
16202
  *
16201
16203
  */
16202
16204
  sendMessage(t, n, a) {
16203
- qe.debug("sendMessage()");
16205
+ He.debug("sendMessage()");
16204
16206
  const o = new bf(this);
16205
16207
  return o.send(t, n, a), o;
16206
16208
  }
@@ -16215,7 +16217,7 @@ var bh = class extends _T {
16215
16217
  *
16216
16218
  */
16217
16219
  sendOptions(t, n, a) {
16218
- qe.debug("sendOptions()");
16220
+ He.debug("sendOptions()");
16219
16221
  const o = new wf(this);
16220
16222
  return o.send(t, n, a), o;
16221
16223
  }
@@ -16223,7 +16225,7 @@ var bh = class extends _T {
16223
16225
  * Terminate ongoing sessions.
16224
16226
  */
16225
16227
  terminateSessions(t) {
16226
- qe.debug("terminateSessions()");
16228
+ He.debug("terminateSessions()");
16227
16229
  for (const n in this._sessions)
16228
16230
  this._sessions[n].isEnded() || this._sessions[n].terminate(t);
16229
16231
  }
@@ -16232,15 +16234,15 @@ var bh = class extends _T {
16232
16234
  *
16233
16235
  */
16234
16236
  stop() {
16235
- if (qe.debug("stop()"), this._dynConfiguration = {}, this._status === vt.STATUS_USER_CLOSED) {
16236
- qe.debug("UA already closed");
16237
+ if (He.debug("stop()"), this._dynConfiguration = {}, this._status === vt.STATUS_USER_CLOSED) {
16238
+ He.debug("UA already closed");
16237
16239
  return;
16238
16240
  }
16239
16241
  this._registrator.close();
16240
16242
  const t = Object.keys(this._sessions).length;
16241
16243
  for (const a in this._sessions)
16242
16244
  if (Object.prototype.hasOwnProperty.call(this._sessions, a)) {
16243
- qe.debug(`closing session ${a}`);
16245
+ He.debug(`closing session ${a}`);
16244
16246
  try {
16245
16247
  this._sessions[a].terminate();
16246
16248
  } catch {
@@ -16278,7 +16280,7 @@ var bh = class extends _T {
16278
16280
  case "authorization_jwt":
16279
16281
  return this._configuration.authorization_jwt;
16280
16282
  default:
16281
- qe.warn('get() | cannot get "%s" parameter in runtime', t);
16283
+ He.warn('get() | cannot get "%s" parameter in runtime', t);
16282
16284
  return;
16283
16285
  }
16284
16286
  }
@@ -16313,7 +16315,7 @@ var bh = class extends _T {
16313
16315
  break;
16314
16316
  }
16315
16317
  default:
16316
- return qe.warn('set() | cannot set "%s" parameter in runtime', t), !1;
16318
+ return He.warn('set() | cannot set "%s" parameter in runtime', t), !1;
16317
16319
  }
16318
16320
  return !0;
16319
16321
  }
@@ -16403,9 +16405,10 @@ var bh = class extends _T {
16403
16405
  * Request reception
16404
16406
  */
16405
16407
  receiveRequest(t) {
16408
+ console.log("receiveRequest");
16406
16409
  const n = t.method;
16407
16410
  if (t.ruri.user !== this._configuration.uri.user && t.ruri.user !== this._contact.uri.user) {
16408
- qe.debug("Request-URI does not point to us"), t.method !== mt.ACK && t.reply_sl(404);
16411
+ He.debug("Request-URI does not point to us"), t.method !== mt.ACK && t.reply_sl(404);
16409
16412
  return;
16410
16413
  }
16411
16414
  if (t.ruri.scheme === mt.SIPS) {
@@ -16415,7 +16418,7 @@ var bh = class extends _T {
16415
16418
  if (Qo.checkTransaction(this, t))
16416
16419
  return;
16417
16420
  if (n === mt.INVITE ? new Qo.InviteServerTransaction(this, this._transport, t) : n !== mt.ACK && n !== mt.CANCEL && new Qo.NonInviteServerTransaction(this, this._transport, t), n === mt.OPTIONS) {
16418
- if (this.listeners("newOptions").length === 0) {
16421
+ if (console.log("OPPP in option"), this.listeners("newOptions").length === 0) {
16419
16422
  t.reply(200);
16420
16423
  return;
16421
16424
  }
@@ -16432,7 +16435,7 @@ var bh = class extends _T {
16432
16435
  }
16433
16436
  let a, o;
16434
16437
  if (t.to_tag)
16435
- a = this._findDialog(t.call_id, t.from_tag, t.to_tag), a ? a.receiveRequest(t) : n === mt.NOTIFY ? (o = this._findSession(t), o ? o.receiveRequest(t) : (qe.debug("received NOTIFY request for a non existent subscription"), t.reply(481, "Subscription does not exist"))) : n !== mt.ACK && t.reply(481);
16438
+ a = this._findDialog(t.call_id, t.from_tag, t.to_tag), a ? a.receiveRequest(t) : n === mt.NOTIFY ? (o = this._findSession(t), o ? o.receiveRequest(t) : (He.debug("received NOTIFY request for a non existent subscription"), t.reply(481, "Subscription does not exist"))) : n !== mt.ACK && t.reply(481);
16436
16439
  else
16437
16440
  switch (n) {
16438
16441
  case mt.INVITE:
@@ -16447,13 +16450,13 @@ var bh = class extends _T {
16447
16450
  } else
16448
16451
  o = new If(this), o.init_incoming(t);
16449
16452
  else
16450
- qe.warn("INVITE received but WebRTC is not supported"), t.reply(488);
16453
+ He.warn("INVITE received but WebRTC is not supported"), t.reply(488);
16451
16454
  break;
16452
16455
  case mt.BYE:
16453
16456
  t.reply(481);
16454
16457
  break;
16455
16458
  case mt.CANCEL:
16456
- o = this._findSession(t), o ? o.receiveRequest(t) : qe.debug("received CANCEL request for a non existent session");
16459
+ o = this._findSession(t), o ? o.receiveRequest(t) : He.debug("received CANCEL request for a non existent session");
16457
16460
  break;
16458
16461
  case mt.ACK:
16459
16462
  break;
@@ -16486,35 +16489,36 @@ var bh = class extends _T {
16486
16489
  return s || (o = t + a + n, s = this._dialogs[o], s || null);
16487
16490
  }
16488
16491
  _loadConfig(t) {
16492
+ console.log("in _loadConfig");
16489
16493
  try {
16490
- eu.load(this._configuration, t);
16494
+ console.log("config.load"), eu.load(this._configuration, t);
16491
16495
  } catch (o) {
16492
- throw o;
16496
+ throw console.log("throw in _loadConfig", o), o;
16493
16497
  }
16494
16498
  this._configuration.display_name === 0 && (this._configuration.display_name = "0"), this._configuration.instance_id || (this._configuration.instance_id = aa.newUUID()), this._configuration.jssip_id = aa.createRandomToken(5);
16495
16499
  const n = this._configuration.uri.clone();
16496
16500
  n.user = null, this._configuration.hostport_params = n.toString().replace(/^sip:/i, "");
16497
16501
  try {
16498
- this._transport = new gT(this._configuration.sockets, {
16502
+ console.log("new transport"), this._transport = new gT(this._configuration.sockets, {
16499
16503
  // Recovery options.
16500
16504
  max_interval: this._configuration.connection_recovery_max_interval,
16501
16505
  min_interval: this._configuration.connection_recovery_min_interval
16502
16506
  }), this._transport.onconnecting = yT.bind(this), this._transport.onconnect = AT.bind(this), this._transport.ondisconnect = CT.bind(this), this._transport.ondata = RT.bind(this);
16503
16507
  } catch (o) {
16504
- throw qe.warn(o), new TT.ConfigurationError("sockets", this._configuration.sockets);
16508
+ throw He.warn(o), new TT.ConfigurationError("sockets", this._configuration.sockets);
16505
16509
  }
16506
16510
  if (delete this._configuration.sockets, this._configuration.authorization_user || (this._configuration.authorization_user = this._configuration.uri.user), !this._configuration.registrar_server) {
16507
16511
  const o = this._configuration.uri.clone();
16508
16512
  o.user = null, o.clearParams(), o.clearHeaders(), this._configuration.registrar_server = o;
16509
16513
  }
16510
- this._configuration.no_answer_timeout *= 1e3, this._configuration.contact_uri ? this._configuration.via_host = this._configuration.contact_uri.host : this._configuration.contact_uri = new vT("sip", aa.createRandomToken(8), this._configuration.via_host, null, { transport: "ws" }), this._contact = {
16514
+ this._configuration.no_answer_timeout *= 1e3, this._configuration.contact_uri ? this._configuration.via_host = this._configuration.contact_uri.host : (console.log("this._configuration.contact_uri 1"), this._configuration.contact_uri = new vT("sip", aa.createRandomToken(8), this._configuration.via_host, null, { transport: "ws" }), console.log("this._configuration.contact_uri 2", this._configuration.contact_uri)), this._contact = {
16511
16515
  pub_gruu: null,
16512
16516
  temp_gruu: null,
16513
16517
  uri: this._configuration.contact_uri,
16514
16518
  toString(o = {}) {
16515
16519
  const s = o.anonymous || null, r = o.outbound || null;
16516
16520
  let d = "<";
16517
- return s ? d += this.temp_gruu || "sip:anonymous@anonymous.invalid;transport=ws" : d += this.pub_gruu || this.uri.toString(), r && (s ? !this.temp_gruu : !this.pub_gruu) && (d += ";ob"), d += ">", d;
16521
+ return s ? d += this.temp_gruu || "sip:anonymous@anonymous.invalid;transport=ws" : d += this.pub_gruu || this.uri.toString(), r && (s ? !this.temp_gruu : !this.pub_gruu) && (d += ";ob"), d += ">", console.log("contact", d), d;
16518
16522
  }
16519
16523
  };
16520
16524
  const a = [
@@ -16534,22 +16538,23 @@ var bh = class extends _T {
16534
16538
  writable: !1,
16535
16539
  configurable: !1
16536
16540
  }));
16537
- qe.debug("configuration parameters after validation:");
16541
+ He.debug("configuration parameters after validation:"), He.debug("this._contact.toString:", this._contact.toString());
16538
16542
  for (const o in this._configuration)
16539
16543
  if (Object.prototype.hasOwnProperty.call(eu.settings, o))
16540
16544
  switch (o) {
16541
16545
  case "uri":
16542
16546
  case "registrar_server":
16543
- qe.debug(`- ${o}: ${this._configuration[o]}`);
16547
+ He.debug(`- ${o}: ${this._configuration[o]}`);
16544
16548
  break;
16545
16549
  case "password":
16546
16550
  case "ha1":
16547
16551
  case "authorization_jwt":
16548
- qe.debug(`- ${o}: NOT SHOWN`);
16552
+ He.debug(`- ${o}: NOT SHOWN`);
16549
16553
  break;
16550
16554
  default:
16551
- qe.debug(`- ${o}: ${JSON.stringify(this._configuration[o])}`);
16555
+ He.debug(`- ${o}: ${JSON.stringify(this._configuration[o])}`);
16552
16556
  }
16557
+ console.log("_loadConfig retun");
16553
16558
  }
16554
16559
  };
16555
16560
  function yT(c) {
@@ -16566,6 +16571,7 @@ function CT(c) {
16566
16571
  this.emit("disconnected", c), this._registrator.onTransportClosed(), this._status !== vt.STATUS_USER_CLOSED && (this._status = vt.STATUS_NOT_READY, this._error = vt.NETWORK_ERROR);
16567
16572
  }
16568
16573
  function RT(c) {
16574
+ console.log("onTransportData", c);
16569
16575
  const t = c.transport;
16570
16576
  let n = c.message;
16571
16577
  if (n = ET.parseMessage(n, this), !!n && !(this._status === vt.STATUS_USER_CLOSED && n instanceof Zo.IncomingRequest) && ST(n, this, t)) {
@@ -24054,12 +24060,15 @@ class oE {
24054
24060
  }, this.context.emit("changeCallMetrics", this.callMetrics);
24055
24061
  }
24056
24062
  getCallQuality(t) {
24063
+ this.context.logger.log("LOG 1 before createProbe");
24057
24064
  const n = new nE(this.metricConfig), a = n.createProbe(t.connection, {
24058
24065
  cid: t._id
24059
- }), o = [];
24066
+ });
24067
+ this.context.logger.log("LOG 2 after createProbe");
24068
+ const o = [];
24060
24069
  let s;
24061
24070
  a.onreport = (r) => {
24062
- Object.entries(r.audio).forEach(([_, g]) => {
24071
+ this.context.logger.log("LOG 3 in onreport"), Object.entries(r.audio).forEach(([_, g]) => {
24063
24072
  g.direction === "inbound" && !o.includes(_) && (o.push(_), s = _);
24064
24073
  });
24065
24074
  const d = r.audio[s];
@@ -24082,11 +24091,11 @@ class oE {
24082
24091
  this.initialStreamValue && (this.initialStreamValue.getTracks().forEach((n) => n.stop()), this.initialStreamValue = null), this.initialStreamValue = t;
24083
24092
  }
24084
24093
  async triggerAddStream(t, n) {
24085
- this.setIsMuted(this.muteWhenJoin || this.isMuted), this.initialStreamValue || await this.setupStream();
24094
+ this.context.logger.log("LOG triggerAddStream 1"), this.setIsMuted(this.muteWhenJoin || this.isMuted), this.initialStreamValue || await this.setupStream();
24086
24095
  const a = Pf(this.initialStreamValue, this.microphoneInputLevel * 2), o = this.isMuted || this.muteWhenJoin;
24087
- a.getTracks().forEach((r) => r.enabled = !o), this.setActiveStream(a), await n.connection.getSenders()[0].replaceTrack(a.getTracks()[0]);
24096
+ a.getTracks().forEach((r) => r.enabled = !o), this.setActiveStream(a), await n.connection.getSenders()[0].replaceTrack(a.getTracks()[0]), this.context.logger.log("LOG triggerAddStream 2");
24088
24097
  const s = new MediaStream([t.track]);
24089
- YT(s, n, this.selectedOutputDevice, this.speakerVolume), this.setupVUMeter(s, n._id), this.getCallQuality(n), this.updateCall(n);
24098
+ YT(s, n, this.selectedOutputDevice, this.speakerVolume), this.setupVUMeter(s, n._id), this.context.logger.log("LOG triggerAddStream 3"), this.getCallQuality(n), this.updateCall(n);
24090
24099
  }
24091
24100
  //@requireInitialization()
24092
24101
  initCall(t, n, a = !1) {