mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
add fs_public_ip to webhook payload (only when running in ec2 autoscale group)
This commit is contained in:
@@ -71,6 +71,9 @@ class CallInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.localSipAddress = srf.locals.localSipAddress;
|
this.localSipAddress = srf.locals.localSipAddress;
|
||||||
|
if (srf.locals.publicIp) {
|
||||||
|
this.publicIp = srf.locals.publicIp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,6 +124,9 @@ class CallInfo {
|
|||||||
if (process.env.JAMBONES_API_BASE_URL) {
|
if (process.env.JAMBONES_API_BASE_URL) {
|
||||||
Object.assign(obj, {apiBaseUrl: process.env.JAMBONES_API_BASE_URL});
|
Object.assign(obj, {apiBaseUrl: process.env.JAMBONES_API_BASE_URL});
|
||||||
}
|
}
|
||||||
|
if (this.publicIp) {
|
||||||
|
Object.assign(obj, {fsPublicIp: this.publicIp});
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class SnsNotifier extends Emitter {
|
|||||||
}, 'response from SNS SubscribeURL');
|
}, 'response from SNS SubscribeURL');
|
||||||
const data = await this.describeInstance();
|
const data = await this.describeInstance();
|
||||||
this.lifecycleState = data.AutoScalingInstances[0].LifecycleState;
|
this.lifecycleState = data.AutoScalingInstances[0].LifecycleState;
|
||||||
|
this.emit('SubscriptionConfirmation', {publicIp: this.publicIp});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Notification':
|
case 'Notification':
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ class SingleDialer extends Emitter {
|
|||||||
* (a) create a CallInfo for this call
|
* (a) create a CallInfo for this call
|
||||||
* (a) create a logger for this call
|
* (a) create a logger for this call
|
||||||
*/
|
*/
|
||||||
|
req.srf = srf;
|
||||||
this.callInfo = new CallInfo({
|
this.callInfo = new CallInfo({
|
||||||
direction: CallDirection.Outbound,
|
direction: CallDirection.Outbound,
|
||||||
parentCallInfo: this.parentCallInfo,
|
parentCallInfo: this.parentCallInfo,
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ module.exports = (logger) => {
|
|||||||
lifecycleEmitter = await require('./aws-sns-lifecycle')(logger);
|
lifecycleEmitter = await require('./aws-sns-lifecycle')(logger);
|
||||||
|
|
||||||
lifecycleEmitter
|
lifecycleEmitter
|
||||||
|
.on('SubscriptionConfirmation', ({publicIp}) => {
|
||||||
|
const {srf} = require('../..');
|
||||||
|
srf.locals.publicIp = publicIp;
|
||||||
|
})
|
||||||
.on(LifeCycleEvents.ScaleIn, () => {
|
.on(LifeCycleEvents.ScaleIn, () => {
|
||||||
logger.info('AWS scale-in notification: begin drying up calls');
|
logger.info('AWS scale-in notification: begin drying up calls');
|
||||||
dryUpCalls = true;
|
dryUpCalls = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user