Skip to content

Instantly share code, notes, and snippets.

@aylarov
Last active March 16, 2018 09:36
Show Gist options
  • Save aylarov/d5ec6e96a15c8eadcb2a19466d3fd62c to your computer and use it in GitHub Desktop.
Save aylarov/d5ec6e96a15c8eadcb2a19466d3fd62c to your computer and use it in GitHub Desktop.
Zoom-WebSDK
var regions = {
"US_West": "162.255.37.11",
"US_East": "162.255.36.11",
"China": "221.122.88.195",
"India": "115.114.131.7",
"EMEA": "213.19.144.110"
};
VoxEngine.addEventListener(AppEvents.CallAlerting, function (e) {
/**
* Remove packetization=0
*/
var scheme = JSON.parse(e.scheme);
scheme[''].video[0].codecs = scheme[''].video[0].codecs.filter(function (item) {
return (item !== 97);
});
/**
* Get region from headers (TODO: auto-detect)
*/
var region = e.headers["X-Region"],
ip = regions["EMEA"];
if (typeof region != "undefined") {
if (typeof regions[region] != "undefined") ip = regions[region];
}
/**
* Conference ID
*/
var conf = e.headers["X-Conference"];
if (typeof conf == "undefined") conf = "voximplant";
/**
* Display Name
*/
if (typeof e.headers["X-DisplayName"] != "undefined") displayName = e.headers["X-DisplayName"];
else displayName = "Untitled";
var call = VoxEngine.callSIP("sip:" + conf + "@" + ip, {
callerid: "voximplant",
displayName: displayName,
scheme: JSON.stringify(scheme),
video: true
});
VoxEngine.easyProcess(e.call, call);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment