diff --git a/lib/call-session.js b/lib/call-session.js index 1bfd51c..737e713 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -428,6 +428,7 @@ class CallSession extends Emitter { /* only now can we set Contact & From header since they depend on transport and scheme of gw */ const gw = mapGateways.get(uri); if (gw) { + const {scheme, transport} = gw; this.logger.info({gw}, `sending INVITE to ${uri} via carrier ${gw.name}`); hdrs = { ...hdrs, @@ -436,22 +437,22 @@ class CallSession extends Emitter { logger: this.logger, req: this.req, register_from_domain: gw.register_from_domain, - scheme: gw.scheme, - transport: gw.transport, + scheme, + transport, ...(private_network && {host: this.privateSipAddress}) }) : createBLegFromHeader({ logger: this.logger, req: this.req, - scheme: gw.scheme, - transport: gw.transport, + scheme, + transport, ...(private_network && {host: this.privateSipAddress}) }), Contact: createBLegFromHeader({ logger: this.logger, req: this.req, - scheme: gw.scheme, - transport: gw.transport, + scheme, + transport, ...(private_network && {host: this.privateSipAddress}) }), ...(gw.diversion && {