support voip carrier sip proxy (#165)

* support voiip carrier sip proxy

* wip

* wip

* wip
This commit is contained in:
Hoan Luu Huu authored and GitHub committed 2025-02-17 09:47:59 -05:00
1 parent c449feeb9c
commit 9feb6f3c8f
2 files changed
+24 -2

No files matched your search

+14 -1
View File
@@ -323,6 +323,18 @@ const makePartnerFullMediaReleaseKey = (callId) => {
return `a_sdp:${callId}`;
};
function isValidDomainOrIP(input) {
const domainRegex = /^(?!:\/\/)([a-zA-Z0-9.-]+)(:\d+)?$/;
// eslint-disable-next-line max-len
const ipRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(:\d+)?$/;
if (domainRegex.test(input) || ipRegex.test(input)) {
return true;
}
return false; // Invalid input
}
module.exports = {
makeRtpEngineOpts,
selectHostPort,
@@ -336,5 +348,6 @@ module.exports = {
isPrivateVoipNetwork,
isBlackListedSipGateway,
makeFullMediaReleaseKey,
makePartnerFullMediaReleaseKey
makePartnerFullMediaReleaseKey,
isValidDomainOrIP
};