Skip to content

Commit

Permalink
VC ARN set to PSTN when no VC created
Browse files Browse the repository at this point in the history
  • Loading branch information
docwho2 committed Nov 21, 2023
1 parent 4a761b7 commit 5a31dfc
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/main/java/cloud/cleo/chimesma/cdk/InfrastructureStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public InfrastructureStack(final Construct parent, final String id, final StackP
final boolean hasPBX = PBX_HOSTNAME != null && !PBX_HOSTNAME.isBlank();
final boolean hasVC = VOICE_CONNECTOR != null && !VOICE_CONNECTOR.isBlank();

String vc_arn = "PSTN";
if (hasVC || hasPBX) {
// Start with list of Twilio NA ranges for SIP Trunking
var cidrAllowList = List.of(AclCidr.ipv4("54.172.60.0/30"), AclCidr.ipv4("54.244.51.0/30"),
Expand Down Expand Up @@ -94,22 +95,16 @@ public InfrastructureStack(final Construct parent, final String id, final StackP
.value(vc.getOutboundName())
.build());

// If there is no PBX in play for SIP routing, set to PSTN to indicate to SMA Lambda that all transfers are PSTN
// IE, no need for VC_ARN to be set
String vc_arn;
if (hasPBX) {
vc_arn = vc.getArn();
} else {
vc_arn = "PSTN";
}
// If VC was created set to ARN otherwise leave at PSTN
vc_arn = vc.getArn();
} else {
vc = null;
new StringParameter(this, "VC_ARN_PARAM", StringParameterProps.builder()
.parameterName("/" + getStackName() + "/VC_ARN")
.description("The ARN for the Voice Connector")
.stringValue("PSTN")
.build());
}
new StringParameter(this, "VC_ARN_PARAM", StringParameterProps.builder()
.parameterName("/" + getStackName() + "/VC_ARN")
.description("The ARN for the Voice Connector")
.stringValue(vc_arn)
.build());

}

Expand Down

0 comments on commit 5a31dfc

Please sign in to comment.