Skip to content

Commit

Permalink
add support for CN region
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Li <[email protected]>
  • Loading branch information
codingspirit committed Jan 6, 2023
1 parent ced19d0 commit 9d3ac79
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion samples/Common.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,13 @@ STATUS initializePeerConnection(PSampleConfiguration pSampleConfiguration, PRtcP
configuration.iceTransportPolicy = ICE_TRANSPORT_POLICY_ALL;

// Set the STUN server
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, pSampleConfiguration->channelInfo.pRegion);
PCHAR pKinesisVideoStunUrlPostFix = KINESIS_VIDEO_STUN_URL_POSTFIX;
// If region is in CN, add CN region uri postfix
if (STRSTR(pSampleConfiguration->channelInfo.pRegion, "cn-")) {
pKinesisVideoStunUrlPostFix = KINESIS_VIDEO_STUN_URL_POSTFIX_CN;
}
SNPRINTF(configuration.iceServers[0].urls, MAX_ICE_CONFIG_URI_LEN, KINESIS_VIDEO_STUN_URL, pSampleConfiguration->channelInfo.pRegion,
pKinesisVideoStunUrlPostFix);

if (pSampleConfiguration->useTurn) {
// Set the URIs from the configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,9 @@ extern "C" {
/**
* Parameterized string for KVS STUN Server
*/
#define KINESIS_VIDEO_STUN_URL "stun:stun.kinesisvideo.%s.amazonaws.com:443"
#define KINESIS_VIDEO_STUN_URL_POSTFIX "amazonaws.com"
#define KINESIS_VIDEO_STUN_URL_POSTFIX_CN "amazonaws.com.cn"
#define KINESIS_VIDEO_STUN_URL "stun:stun.kinesisvideo.%s.%s:443"

/**
* Default signaling SSL port
Expand Down
4 changes: 4 additions & 0 deletions src/source/Signaling/ChannelInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ STATUS createValidateChannelInfo(PChannelInfo pOrigChannelInfo, PChannelInfo* pp
// Create a fully qualified URI
SNPRINTF(pCurPtr, MAX_CONTROL_PLANE_URI_CHAR_LEN, "%s%s.%s%s", CONTROL_PLANE_URI_PREFIX, KINESIS_VIDEO_SERVICE_NAME, pChannelInfo->pRegion,
CONTROL_PLANE_URI_POSTFIX);
// If region is in CN, add CN region uri postfix
if (STRSTR(pChannelInfo->pRegion, "cn-")) {
STRCAT(pCurPtr, ".cn");
}
}

pChannelInfo->pControlPlaneUrl = pCurPtr;
Expand Down

0 comments on commit 9d3ac79

Please sign in to comment.