drachtio-srf 4.5.36 → 4.5.38
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/lib/drachtio-agent.js +14 -2
- package/lib/srf.js +8 -0
- package/package.json +1 -1
package/lib/drachtio-agent.js
CHANGED
|
@@ -465,6 +465,17 @@ class DrachtioAgent extends Emitter {
|
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
+
removeRoute(verb) {
|
|
469
|
+
if (!this.verbs.has(verb)) { throw new Error('no route request to remove for ' + verb) ; }
|
|
470
|
+
|
|
471
|
+
this.mapServer.forEach((obj, socket) => {
|
|
472
|
+
if (obj.authenticated) {
|
|
473
|
+
this.wp.send(socket, 'remove_route|' + verb) ;
|
|
474
|
+
this.verbs.delete(verb) ;
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
|
|
468
479
|
disconnect(socket) {
|
|
469
480
|
const sock = socket || this._getDefaultSocket();
|
|
470
481
|
debugSocket(`disconnect: removing socket ${sockPort(sock)}`);
|
|
@@ -515,16 +526,17 @@ class DrachtioAgent extends Emitter {
|
|
|
515
526
|
obj.ready = true ;
|
|
516
527
|
obj.hostport = response[1] ;
|
|
517
528
|
obj.serverVersion = response.length > 2 ? response[2] : null;
|
|
529
|
+
obj.localHostports = response.length > 3 ? response[3] : null;
|
|
518
530
|
debug('sucessfully authenticated, hostport is ', obj.hostport) ;
|
|
519
531
|
|
|
520
532
|
if (this.wp.isClient) {
|
|
521
533
|
this.routeVerbs(socket, obj) ;
|
|
522
534
|
setImmediate(() => {
|
|
523
|
-
this.emit('connect', null, obj.hostport, obj.serverVersion);
|
|
535
|
+
this.emit('connect', null, obj.hostport, obj.serverVersion, obj.localHostports);
|
|
524
536
|
});
|
|
525
537
|
}
|
|
526
538
|
else {
|
|
527
|
-
this.emit('connect', null, obj.hostport, obj.serverVersion);
|
|
539
|
+
this.emit('connect', null, obj.hostport, obj.serverVersion, obj.localHostports);
|
|
528
540
|
}
|
|
529
541
|
if (serverVersionAtLeast(obj.serverVersion, 'v0.8.2')) {
|
|
530
542
|
debug(`server version ${obj.serverVersion} supports pinging`);
|
package/lib/srf.js
CHANGED
|
@@ -1225,6 +1225,14 @@ class Srf extends Emitter {
|
|
|
1225
1225
|
debug('Srf#removeDialog: removing dialog with id %s dialog count is now %d', dialog.id, this._dialogs.size) ;
|
|
1226
1226
|
}
|
|
1227
1227
|
|
|
1228
|
+
unregisterForMessages(sipVerb) {
|
|
1229
|
+
this._app.client.removeRoute(sipVerb) ;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
reregisterForMessages(sipVerb) {
|
|
1233
|
+
this._app.client.route(sipVerb) ;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1228
1236
|
_b2bRequestWithinDialog(dlg, req, res, proxyRequestHeaders, proxyResponseHeaders, callback) {
|
|
1229
1237
|
callback = callback || noop ;
|
|
1230
1238
|
let headers = {} ;
|