Skip to content

Commit 98f4cf1

Browse files
committed
add support for CN region
Signed-off-by: Alex Li <zhiqinli@amazon.com>
1 parent ced19d0 commit 98f4cf1

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

samples/Common.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,12 @@ STATUS initializePeerConnection(PSampleConfiguration pSampleConfiguration, PRtcP
357357
configuration.iceTransportPolicy = ICE_TRANSPORT_POLICY_ALL;
358358

359359
// Set the STUN server
360-
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, pSampleConfiguration->channelInfo.pRegion);
360+
PCHAR pKinesisVideoStunUrl = KINESIS_VIDEO_STUN_URL;
361+
if (STRSTR(pSampleConfiguration->channelInfo.pRegion, "cn-")) {
362+
// Use CN region uri postfix instead
363+
pKinesisVideoStunUrl = KINESIS_VIDEO_STUN_URL_CN;
364+
}
365+
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, pKinesisVideoStunUrl, pSampleConfiguration->channelInfo.pRegion);
361366

362367
if (pSampleConfiguration->useTurn) {
363368
// Set the URIs from the configuration

src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,8 @@ extern "C" {
623623
/**
624624
* Parameterized string for KVS STUN Server
625625
*/
626-
#define KINESIS_VIDEO_STUN_URL "stun:stun.kinesisvideo.%s.amazonaws.com:443"
626+
#define KINESIS_VIDEO_STUN_URL "stun:stun.kinesisvideo.%s.amazonaws.com:443"
627+
#define KINESIS_VIDEO_STUN_URL_CN "stun:stun.kinesisvideo.%s.amazonaws.com.cn:443"
627628

628629
/**
629630
* Default signaling SSL port

src/source/Signaling/ChannelInfo.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,13 @@ STATUS createValidateChannelInfo(PChannelInfo pOrigChannelInfo, PChannelInfo* pp
125125
STRCPY(pCurPtr, pOrigChannelInfo->pControlPlaneUrl);
126126
} else {
127127
// Create a fully qualified URI
128+
PCHAR pControlPlaneUriPostfix = CONTROL_PLANE_URI_POSTFIX;
129+
if (STRSTR(pChannelInfo->pRegion, "cn-")) {
130+
// Use CN region uri postfix instead
131+
pControlPlaneUriPostfix = CONTROL_PLANE_URI_POSTFIX_CN;
132+
}
128133
SNPRINTF(pCurPtr, MAX_CONTROL_PLANE_URI_CHAR_LEN, "%s%s.%s%s", CONTROL_PLANE_URI_PREFIX, KINESIS_VIDEO_SERVICE_NAME, pChannelInfo->pRegion,
129-
CONTROL_PLANE_URI_POSTFIX);
134+
pControlPlaneUriPostfix);
130135
}
131136

132137
pChannelInfo->pControlPlaneUrl = pCurPtr;

0 commit comments

Comments
 (0)